[Thermo] Fix pure fluid thermal expansion coefficient calculation

This commit is contained in:
Ray Speth 2016-10-19 19:44:20 -04:00
parent f6df8f31b3
commit b1a1ce6e23
2 changed files with 16 additions and 1 deletions

View file

@ -105,6 +105,21 @@ class TestPureFluid(utilities.CanteraTest):
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

View file

@ -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()