[Test] Move testIAPWSTripP into the gtest suite
This commit is contained in:
parent
1cc0d42988
commit
61a457121a
5 changed files with 35 additions and 124 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "cantera/thermo/WaterPropsIAPWSphi.h"
|
#include "cantera/thermo/WaterPropsIAPWSphi.h"
|
||||||
|
#include "cantera/thermo/WaterPropsIAPWS.h"
|
||||||
|
|
||||||
using namespace Cantera;
|
using namespace Cantera;
|
||||||
|
|
||||||
|
|
@ -46,3 +47,37 @@ TEST_F(WaterPropsIAPWSphi_Test, check2) {
|
||||||
EXPECT_NEAR(phi0_dt(), 0.000000000000e+00, 1e-11);
|
EXPECT_NEAR(phi0_dt(), 0.000000000000e+00, 1e-11);
|
||||||
EXPECT_NEAR(phiR_dt(), -1.332147204361e+00, 1e-11);
|
EXPECT_NEAR(phiR_dt(), -1.332147204361e+00, 1e-11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WaterPropsIAPWS_Test : public testing::Test
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WaterPropsIAPWS water;
|
||||||
|
};
|
||||||
|
|
||||||
|
// See values on p. 395 of Wagner & Pruss.
|
||||||
|
TEST_F(WaterPropsIAPWS_Test, triple_point_liquid)
|
||||||
|
{
|
||||||
|
double T = 273.16;
|
||||||
|
double pres = water.psat(T);
|
||||||
|
EXPECT_NEAR(pres, 611.655, 2e-3);
|
||||||
|
EXPECT_NEAR(water.density(T, pres, WATER_LIQUID), 999.793, 2e-3);
|
||||||
|
EXPECT_NEAR(water.intEnergy(), 0.0, 5e-7);
|
||||||
|
EXPECT_NEAR(water.entropy(), 0.0, 5e-9);
|
||||||
|
EXPECT_NEAR(water.enthalpy(), 11.0214, 2e-4);
|
||||||
|
EXPECT_NEAR(water.Gibbs(), 11.0214, 2e-4);
|
||||||
|
EXPECT_NEAR(water.cv(), 75978.2, 2e-1);
|
||||||
|
EXPECT_NEAR(water.cp(), 76022.8, 2e-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(WaterPropsIAPWS_Test, triple_point_gas)
|
||||||
|
{
|
||||||
|
double T = 273.16;
|
||||||
|
double pres = water.psat(T);
|
||||||
|
EXPECT_NEAR(water.density(T, pres, WATER_GAS), 4.85458e-3, 2e-8);
|
||||||
|
EXPECT_NEAR(water.intEnergy(), 4.27848e7, 2e2);
|
||||||
|
EXPECT_NEAR(water.entropy(), 164939., 2e0);
|
||||||
|
EXPECT_NEAR(water.enthalpy(), 4.50547e7, 2e2);
|
||||||
|
EXPECT_NEAR(water.Gibbs(), 11.0214, 2e-4);
|
||||||
|
EXPECT_NEAR(water.cv(), 25552.6, 2e-1);
|
||||||
|
EXPECT_NEAR(water.cp(), 33947.1, 2e-1);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,8 +205,6 @@ CompileAndTest('stoichSub', 'cathermo/stoichSub',
|
||||||
'stoichSub', 'output_blessed.txt')
|
'stoichSub', 'output_blessed.txt')
|
||||||
CompileAndTest('IAPWSPres', 'cathermo/testIAPWSPres',
|
CompileAndTest('IAPWSPres', 'cathermo/testIAPWSPres',
|
||||||
'testIAPWSPres', 'output_blessed.txt')
|
'testIAPWSPres', 'output_blessed.txt')
|
||||||
CompileAndTest('IAPWSTripP', 'cathermo/testIAPWSTripP',
|
|
||||||
'testIAPWSTripP', 'output_blessed.txt')
|
|
||||||
CompileAndTest('WaterPDSS', 'cathermo/testWaterPDSS',
|
CompileAndTest('WaterPDSS', 'cathermo/testWaterPDSS',
|
||||||
'testWaterPDSS', 'output_blessed.txt')
|
'testWaterPDSS', 'output_blessed.txt')
|
||||||
CompileAndTest('WaterSSTP', 'cathermo/testWaterTP',
|
CompileAndTest('WaterSSTP', 'cathermo/testWaterTP',
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
|
|
||||||
This test is used to make sure that the basic functions in
|
|
||||||
the water property routine satisfy tests
|
|
||||||
specified in the paper:
|
|
||||||
|
|
||||||
W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the
|
|
||||||
Thermodynamic Properties of Ordinary Water Substance
|
|
||||||
for General and Scientific Use," J. Phys. Chem.
|
|
||||||
Ref. Data, v. 31, 387 - 442, 2002.
|
|
||||||
|
|
||||||
This routine exercises the calculation of triple point thermo properties.
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
psat(273.16) = 611.655
|
|
||||||
dens (liquid) = 999.793 kg m-3
|
|
||||||
intEng (liquid) = ~0.0 J/kmol (fabs(u) < 5.0E-7)
|
|
||||||
S (liquid) = ~0.0 J/kmolK (fabs(s) < 5.0E-9)
|
|
||||||
h (liquid) = 11.0214 J/kmol
|
|
||||||
h (liquid) = 0.611782 J/kg
|
|
||||||
g (liquid) = 11.0214 J/kmol
|
|
||||||
cv (liquid) = 75978.2 J/kmolK
|
|
||||||
cp (liquid) = 76022.8 J/kmolK
|
|
||||||
dens (gas) = 0.00485458 kg m-3
|
|
||||||
intEng (gas) = 4.27848e+07 J/kmol
|
|
||||||
S (gas) = 164939 J/kmolK
|
|
||||||
h (gas) = 4.50547e+07 J/kmol
|
|
||||||
h (gas) = 2.50092e+06 J/kg
|
|
||||||
g (gas) = 11.0214 J/kmol
|
|
||||||
cv (gas) = 25552.6 J/kmolK
|
|
||||||
cp (gas) = 33947.1 J/kmolK
|
|
||||||
|
|
||||||
Delta g = ~0.0 J/kmol ( < 1.0E-5)
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
||||||
|
|
||||||
#include "cantera/thermo/WaterPropsIAPWS.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace Cantera;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
|
||||||
_set_output_format(_TWO_DIGIT_EXPONENT);
|
|
||||||
#endif
|
|
||||||
double dens, u, s, h, cv, cp, pres;
|
|
||||||
WaterPropsIAPWS* water = new WaterPropsIAPWS();
|
|
||||||
|
|
||||||
double T;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print out the triple point conditions
|
|
||||||
*/
|
|
||||||
T = 273.16;
|
|
||||||
pres = water->psat(T);
|
|
||||||
printf("psat(%g) = %g\n", T, pres);
|
|
||||||
|
|
||||||
dens = water->density(T, pres, WATER_LIQUID);
|
|
||||||
printf("dens (liquid) = %g kg m-3\n", dens);
|
|
||||||
|
|
||||||
u = water->intEnergy();
|
|
||||||
if (fabs(u) < 5.0E-7) {
|
|
||||||
printf("intEng (liquid) = ~0.0 J/kmol (fabs(u) < 5.0E-7)\n");
|
|
||||||
} else {
|
|
||||||
printf("intEng (liquid) = %g J/kmol\n", u);
|
|
||||||
}
|
|
||||||
|
|
||||||
s = water->entropy();
|
|
||||||
if (fabs(s) < 5.0E-9) {
|
|
||||||
printf("S (liquid) = ~0.0 J/kmolK (fabs(s) < 5.0E-9)\n");
|
|
||||||
} else {
|
|
||||||
printf("S (liquid) = %g J/kmolK\n", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
h = water->enthalpy();
|
|
||||||
printf("h (liquid) = %g J/kmol\n", h);
|
|
||||||
printf("h (liquid) = %g J/kg\n", (h)/18.015268);
|
|
||||||
|
|
||||||
double g_liq = water->Gibbs();
|
|
||||||
printf("g (liquid) = %g J/kmol\n", g_liq);
|
|
||||||
|
|
||||||
|
|
||||||
cv = water->cv();
|
|
||||||
printf("cv (liquid) = %g J/kmolK\n", cv);
|
|
||||||
|
|
||||||
cp = water->cp();
|
|
||||||
printf("cp (liquid) = %g J/kmolK\n", cp);
|
|
||||||
|
|
||||||
|
|
||||||
dens = water->density(T, pres, WATER_GAS);
|
|
||||||
printf("dens (gas) = %g kg m-3\n", dens);
|
|
||||||
|
|
||||||
|
|
||||||
u = water->intEnergy();
|
|
||||||
printf("intEng (gas) = %g J/kmol\n", u);
|
|
||||||
|
|
||||||
s = water->entropy();
|
|
||||||
printf("S (gas) = %g J/kmolK\n", s);
|
|
||||||
|
|
||||||
h = water->enthalpy();
|
|
||||||
printf("h (gas) = %g J/kmol\n", h);
|
|
||||||
printf("h (gas) = %g J/kg\n", (h)/18.015268);
|
|
||||||
|
|
||||||
double g_gas = water->Gibbs();
|
|
||||||
printf("g (gas) = %g J/kmol\n", g_gas);
|
|
||||||
|
|
||||||
|
|
||||||
cv = water->cv();
|
|
||||||
printf("cv (gas) = %g J/kmolK\n", cv);
|
|
||||||
|
|
||||||
cp = water->cp();
|
|
||||||
printf("cp (gas) = %g J/kmolK\n", cp);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
double deltaG = g_liq - g_gas;
|
|
||||||
if (fabs(deltaG) < 1.0E-5) {
|
|
||||||
printf("Delta g = ~0.0 J/kmol ( < 1.0E-5)\n");
|
|
||||||
} else {
|
|
||||||
printf("Delta g = %g J/kmol\n", g_liq - g_gas);
|
|
||||||
}
|
|
||||||
delete water;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue