Skip to content

Commit

Permalink
[Thermo] Fix pure fluid thermal expansion coefficient calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Oct 19, 2016
1 parent f6df8f3 commit b1a1ce6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions interfaces/cython/cantera/test/test_purefluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ def test_properties_near_max(self):
self.check_fd_properties(self.water.max_temp*(1-1e-5), 101325,
self.water.max_temp*(1-1e-4), 101325, 1e-2)

def test_isothermal_compressibility_lowP(self):
# Low-pressure limit corresponds to ideal gas
ref = ct.Solution('gri30.xml')
ref.TPX = 450, 12, 'H2O:1.0'
self.water.TP = 450, 12
self.assertNear(ref.isothermal_compressibility,
self.water.isothermal_compressibility, 1e-5)

def test_thermal_expansion_coeff_lowP(self):
# Low-pressure limit corresponds to ideal gas
ref = ct.Solution('gri30.xml')
ref.TPX = 450, 12, 'H2O:1.0'
self.water.TP = 450, 12
self.assertNear(ref.thermal_expansion_coeff,
self.water.thermal_expansion_coeff, 1e-5)
def test_TPX(self):
self.water.TX = 400, 0.8
T,P,X = self.water.TPX
Expand Down
2 changes: 1 addition & 1 deletion src/tpx/Sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ double Substance::thermalExpansionCoeff()
Set(PropertyPair::TP, T2, p0);
double v2 = v();
Set(PropertyPair::TP, Tsave, p0);
return (v2 - v1)/((v2 + v1)*(T2-T1));
return 2.0*(v2 - v1)/((v2 + v1)*(T2-T1));
}

double Substance::isothermalCompressibility()
Expand Down

0 comments on commit b1a1ce6

Please sign in to comment.