diff --git a/include/cantera/thermo/WaterPropsIAPWSphi.h b/include/cantera/thermo/WaterPropsIAPWSphi.h index 83e1454b1..0554e81d8 100644 --- a/include/cantera/thermo/WaterPropsIAPWSphi.h +++ b/include/cantera/thermo/WaterPropsIAPWSphi.h @@ -71,12 +71,6 @@ public: */ doublereal phi_tt(doublereal tau, doublereal delta); - //! Internal check # 1 - void check1(); - - //! Internal check # 2 - void check2(); - //! Calculate the dimensionless pressure at tau and delta; /*! * pM/(rhoRT) = delta * phi_d() = 1.0 + delta phiR_d() @@ -156,7 +150,7 @@ public: */ doublereal phiR() const; -private: +protected: //! Calculate Equation 6.5 for phi0, the ideal gas part of the //! dimensionless Helmholtz free energy. doublereal phi0() const; @@ -183,15 +177,6 @@ private: //! Calculate the mixed derivative d2_phi0/(dtau ddelta) doublereal phi0_dt() const; - /** - * Calculates all of the functions at a one point and prints out the - * result. It's used for conducting the internal check. - * - * @param tau Dimensionless temperature = T_c/T - * @param delta Dimensionless density = delta = rho / Rho_c - */ - void intCheck(doublereal tau, doublereal delta); - //! Value of internally calculated polynomials of powers of TAU doublereal TAUp[52]; diff --git a/src/thermo/WaterPropsIAPWSphi.cpp b/src/thermo/WaterPropsIAPWSphi.cpp index d77dc55e5..5d07ad35f 100644 --- a/src/thermo/WaterPropsIAPWSphi.cpp +++ b/src/thermo/WaterPropsIAPWSphi.cpp @@ -375,50 +375,6 @@ WaterPropsIAPWSphi::WaterPropsIAPWSphi() : } } -void WaterPropsIAPWSphi::intCheck(doublereal tau, doublereal delta) -{ - tdpolycalc(tau, delta); - doublereal nau = phi0(); - doublereal res = phiR(); - doublereal res_d = phiR_d(); - doublereal nau_d = phi0_d(); - doublereal res_dd = phiR_dd(); - doublereal nau_dd = phi0_dd(); - doublereal res_t = phiR_t(); - doublereal nau_t = phi0_t(); - doublereal res_tt = phiR_tt(); - doublereal nau_tt = phi0_tt(); - doublereal res_dt = phiR_dt(); - doublereal nau_dt = phi0_dt(); - - writelogf("nau = %20.12e\t\tres = %20.12e\n", nau, res); - writelogf("nau_d = %20.12e\t\tres_d = %20.12e\n", nau_d, res_d); - writelogf("nau_dd = %20.12e\t\tres_dd = %20.12e\n", nau_dd, res_dd); - writelogf("nau_t = %20.12e\t\tres_t = %20.12e\n", nau_t, res_t); - writelogf("nau_tt = %20.12e\t\tres_tt = %20.12e\n", nau_tt, res_tt); - writelogf("nau_dt = %20.12e\t\tres_dt = %20.12e\n", nau_dt, res_dt); -} - -void WaterPropsIAPWSphi::check1() -{ - doublereal T = 500.; - doublereal rho = 838.025; - doublereal tau = T_c/T; - doublereal delta = rho / Rho_c; - writelog(" T = 500 K, rho = 838.025 kg m-3\n"); - intCheck(tau, delta); -} - -void WaterPropsIAPWSphi::check2() -{ - doublereal T = 647; - doublereal rho = 358.0; - doublereal tau = T_c/T; - doublereal delta = rho / Rho_c; - writelog(" T = 647 K, rho = 358.0 kg m-3\n"); - intCheck(tau, delta); -} - void WaterPropsIAPWSphi::tdpolycalc(doublereal tau, doublereal delta) { if ((tau != TAUsave) || 1) { diff --git a/test/thermo/water_iapws.cpp b/test/thermo/water_iapws.cpp new file mode 100644 index 000000000..0ad24d079 --- /dev/null +++ b/test/thermo/water_iapws.cpp @@ -0,0 +1,48 @@ +#include "gtest/gtest.h" +#include "cantera/thermo/WaterPropsIAPWSphi.h" + +using namespace Cantera; + +const double T_c = 647.096; +const double Rho_c = 322.0; + +class WaterPropsIAPWSphi_Test : public testing::Test, public WaterPropsIAPWSphi +{ +}; + +// Test agreement with values given in Table 6.6 of: W. Wagner, A. Pruss, "The +// IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water +// Substance for General and Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, +// 2002. + +TEST_F(WaterPropsIAPWSphi_Test, check1) { + tdpolycalc(T_c / 500.0, 838.025 / Rho_c); + EXPECT_NEAR(phi0(), 2.047977334796e+00, 1e-11); + EXPECT_NEAR(phiR(), -3.426932056816e+00, 1e-11); + EXPECT_NEAR(phi0_d(), 3.842367471137e-01, 1e-11); + EXPECT_NEAR(phiR_d(), -3.643666503639e-01, 1e-11); + EXPECT_NEAR(phi0_dd(), -1.476378778326e-01, 1e-11); + EXPECT_NEAR(phiR_dd(), 8.560637009746e-01, 1e-11); + EXPECT_NEAR(phi0_t(), 9.046111061752e+00, 1e-11); + EXPECT_NEAR(phiR_t(), -5.814034352384e+00, 1e-11); + EXPECT_NEAR(phi0_tt(), -1.932491850131e+00, 1e-11); + EXPECT_NEAR(phiR_tt(), -2.234407368843e+00, 1e-11); + EXPECT_NEAR(phi0_dt(), 0.000000000000e+00, 1e-11); + EXPECT_NEAR(phiR_dt(), -1.121769146703e+00, 1e-11); +} + +TEST_F(WaterPropsIAPWSphi_Test, check2) { + tdpolycalc(T_c / 647.0, 358.0 / Rho_c); + EXPECT_NEAR(phi0(), -1.563196050525e+00, 1e-11); + EXPECT_NEAR(phiR(), -1.212026565041e+00, 1e-11); + EXPECT_NEAR(phi0_d(), 8.994413407821e-01, 1e-11); + EXPECT_NEAR(phiR_d(), -7.140120243713e-01, 1e-11); + EXPECT_NEAR(phi0_dd(), -8.089947255079e-01, 1e-11); + EXPECT_NEAR(phiR_dd(), 4.757306956457e-01, 1e-11); + EXPECT_NEAR(phi0_t(), 9.803439179390e+00, 1e-11); + EXPECT_NEAR(phiR_t(), -3.217225007752e+00, 1e-11); + EXPECT_NEAR(phi0_tt(), -3.433163341431e+00, 1e-11); + EXPECT_NEAR(phiR_tt(), -9.960295065593e+00, 1e-11); + EXPECT_NEAR(phi0_dt(), 0.000000000000e+00, 1e-11); + EXPECT_NEAR(phiR_dt(), -1.332147204361e+00, 1e-11); +} diff --git a/test_problems/SConscript b/test_problems/SConscript index aad5635ca..a712094d6 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -203,8 +203,6 @@ CompileAndTest('IMSTester', 'cathermo/ims', 'IMSTester', 'output_blessed.txt') CompileAndTest('ISSPTester', 'cathermo/issp', 'ISSPTester', 'output_blessed.txt') CompileAndTest('stoichSub', 'cathermo/stoichSub', 'stoichSub', 'output_blessed.txt') -CompileAndTest('IAPWSphi', 'cathermo/testIAPWS', - 'testIAPWSphi', 'output_blessed.txt') CompileAndTest('IAPWSPres', 'cathermo/testIAPWSPres', 'testIAPWSPres', 'output_blessed.txt') CompileAndTest('IAPWSTripP', 'cathermo/testIAPWSTripP', diff --git a/test_problems/cathermo/testIAPWS/README b/test_problems/cathermo/testIAPWS/README deleted file mode 100644 index a93a48b7c..000000000 --- a/test_problems/cathermo/testIAPWS/README +++ /dev/null @@ -1,15 +0,0 @@ - -This test is used to make sure that the basic functions in -the water property routine satisfies the derivative 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. - -On page 436 of that reference, value for phi, the nondimensional -helmholtz free energy and its first and second derivatives, -are given at 2 representative points. This test makes sure -that the values agree with the paper's values. - diff --git a/test_problems/cathermo/testIAPWS/output_blessed.txt b/test_problems/cathermo/testIAPWS/output_blessed.txt deleted file mode 100644 index 283661388..000000000 --- a/test_problems/cathermo/testIAPWS/output_blessed.txt +++ /dev/null @@ -1,14 +0,0 @@ - T = 500 K, rho = 838.025 kg m-3 -nau = 2.047977334796e+00 res = -3.426932056816e+00 -nau_d = 3.842367471137e-01 res_d = -3.643666503639e-01 -nau_dd = -1.476378778326e-01 res_dd = 8.560637009746e-01 -nau_t = 9.046111061752e+00 res_t = -5.814034352384e+00 -nau_tt = -1.932491850131e+00 res_tt = -2.234407368843e+00 -nau_dt = 0.000000000000e+00 res_dt = -1.121769146703e+00 - T = 647 K, rho = 358.0 kg m-3 -nau = -1.563196050525e+00 res = -1.212026565041e+00 -nau_d = 8.994413407821e-01 res_d = -7.140120243713e-01 -nau_dd = -8.089947255079e-01 res_dd = 4.757306956457e-01 -nau_t = 9.803439179390e+00 res_t = -3.217225007752e+00 -nau_tt = -3.433163341431e+00 res_tt = -9.960295065593e+00 -nau_dt = 0.000000000000e+00 res_dt = -1.332147204361e+00 diff --git a/test_problems/cathermo/testIAPWS/testIAPWSphi.cpp b/test_problems/cathermo/testIAPWS/testIAPWSphi.cpp deleted file mode 100644 index 1ec37e640..000000000 --- a/test_problems/cathermo/testIAPWS/testIAPWSphi.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "cantera/thermo/WaterPropsIAPWSphi.h" -#include - -#include - -using namespace std; -using namespace Cantera; - -int main() -{ -#if defined(_MSC_VER) && _MSC_VER < 1900 - _set_output_format(_TWO_DIGIT_EXPONENT); -#endif - WaterPropsIAPWSphi* phi = new WaterPropsIAPWSphi(); - - phi->check1(); - phi->check2(); - - delete phi; - return 0; -}