diff --git a/test_problems/cathermo/HMW_test_1/.cvsignore b/test_problems/cathermo/HMW_test_1/.cvsignore index 8df702c54..004da4fdc 100644 --- a/test_problems/cathermo/HMW_test_1/.cvsignore +++ b/test_problems/cathermo/HMW_test_1/.cvsignore @@ -7,4 +7,4 @@ outputa.txt HMW_test_1.d diff_test.out table.csv - +csvCode.txt diff --git a/test_problems/cathermo/HMW_test_3/.cvsignore b/test_problems/cathermo/HMW_test_3/.cvsignore index 929315411..2d1b35d17 100644 --- a/test_problems/cathermo/HMW_test_3/.cvsignore +++ b/test_problems/cathermo/HMW_test_3/.cvsignore @@ -6,3 +6,4 @@ diff_test.out output.txt outputa.txt table.csv +csvCode.txt diff --git a/test_problems/cathermo/testIAPWSPres/output_blessed.txt b/test_problems/cathermo/testIAPWSPres/output_blessed.txt index 42d4ec45b..69bfd8773 100644 --- a/test_problems/cathermo/testIAPWSPres/output_blessed.txt +++ b/test_problems/cathermo/testIAPWSPres/output_blessed.txt @@ -1,8 +1,8 @@ pres = 182080 psat(273.16) = 611.655 dens (liquid) = 999.793 kg m-3 -intEng (liquid) = -1.91143e-08 J/kmol -S (liquid) = -8.47431e-11 J/kmolK +intEng (liquid) ~= 0.0 J/kmol (less than fabs(5.0E-7)) +S (liquid) ~= 0.0 J/kmolK (less than fabs(1.0E-9)) h (liquid) = 11.0214 J/kmol h (liquid) = 0.611782 J/kg dens (gas) = 0.00485458 kg m-3 diff --git a/test_problems/cathermo/testIAPWSPres/testPress.cpp b/test_problems/cathermo/testIAPWSPres/testPress.cpp index c03259cf7..7bcc1eef9 100644 --- a/test_problems/cathermo/testIAPWSPres/testPress.cpp +++ b/test_problems/cathermo/testIAPWSPres/testPress.cpp @@ -1,5 +1,6 @@ #include "stdio.h" +#include "math.h" #include "WaterPropsIAPWS.h" #include using namespace std; @@ -26,10 +27,18 @@ int main () { printf("dens (liquid) = %g kg m-3\n", dens); u = water->intEnergy(T, dens); - printf("intEng (liquid) = %g J/kmol\n", u); + if (fabs(u) < 5.0E-7) { + printf("intEng (liquid) ~= 0.0 J/kmol (less than fabs(5.0E-7))\n"); + } else { + printf("intEng (liquid) = %g J/kmol\n", u); + } s = water->entropy(T, dens); - printf("S (liquid) = %g J/kmolK\n", s); + if (fabs(s) < 1.0E-9) { + printf("S (liquid) ~= 0.0 J/kmolK (less than fabs(1.0E-9))\n"); + } else { + printf("S (liquid) = %g J/kmolK\n", s); + } h = water->enthalpy(T, dens); printf("h (liquid) = %g J/kmol\n", h); diff --git a/test_problems/cathermo/testIAPWSTripP/output_blessed.txt b/test_problems/cathermo/testIAPWSTripP/output_blessed.txt index c7cb3c7cd..62cf72cad 100644 --- a/test_problems/cathermo/testIAPWSTripP/output_blessed.txt +++ b/test_problems/cathermo/testIAPWSTripP/output_blessed.txt @@ -1,7 +1,7 @@ psat(273.16) = 611.655 dens (liquid) = 999.793 kg m-3 -intEng (liquid) = -1.91143e-08 J/kmol -S (liquid) = -8.47431e-11 J/kmolK +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 @@ -16,4 +16,4 @@ g (gas) = 11.0214 J/kmol cv (gas) = 25552.6 J/kmolK cp (gas) = 33947.1 J/kmolK -Delta g = 4.13909e-06 J/kmol +Delta g = ~0.0 J/kmol ( < 1.0E-5) diff --git a/test_problems/cathermo/testIAPWSTripP/testTripleP.cpp b/test_problems/cathermo/testIAPWSTripP/testTripleP.cpp index 70d63475a..533fbeed3 100644 --- a/test_problems/cathermo/testIAPWSTripP/testTripleP.cpp +++ b/test_problems/cathermo/testIAPWSTripP/testTripleP.cpp @@ -1,5 +1,6 @@ #include "stdio.h" +#include "math.h" #include "WaterPropsIAPWS.h" #include using namespace std; @@ -24,10 +25,18 @@ int main () { printf("dens (liquid) = %g kg m-3\n", dens); u = water->intEnergy(T, dens); - printf("intEng (liquid) = %g J/kmol\n", u); + 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(T, dens); - printf("S (liquid) = %g J/kmolK\n", s); + 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(T, dens); printf("h (liquid) = %g J/kmol\n", h); @@ -69,9 +78,12 @@ int main () { printf("cp (gas) = %g J/kmolK\n", cp); printf("\n"); - printf("Delta g = %g J/kmol\n", g_liq - g_gas); - - + 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; } diff --git a/test_problems/cathermo/testWaterPDSS/output_blessed.txt b/test_problems/cathermo/testWaterPDSS/output_blessed.txt index c9eeac340..abaf3c870 100644 --- a/test_problems/cathermo/testWaterPDSS/output_blessed.txt +++ b/test_problems/cathermo/testWaterPDSS/output_blessed.txt @@ -20,7 +20,7 @@ Liquid 1bar or psat Standard State T press psat Cp0 S0 -(G0-H298)/T H0-H298 (K) (bar) (bar) (J/molK) (J/molK) (J/molK) (kJ/mol) 273.19 1 0.00612989 76.0121 63.3157 70.2194 -1.88603 - 298.15 1 0.0316993 75.3276 69.9224 69.9224 2.38419e-13 + 298.15 1 0.0316993 75.3276 69.9224 69.9224 0 300 1 0.0353681 75.3153 70.3884 69.9239 0.139344 373.15 1.01621 1.01418 75.9465 86.857 71.6855 5.66125 400 2.46261 2.45769 76.6642 92.1544 72.8766 7.71115 diff --git a/test_problems/cathermo/testWaterPDSS/testWaterPDSS.cpp b/test_problems/cathermo/testWaterPDSS/testWaterPDSS.cpp index a4de4e16e..9c4ec33d4 100644 --- a/test_problems/cathermo/testWaterPDSS/testWaterPDSS.cpp +++ b/test_problems/cathermo/testWaterPDSS/testWaterPDSS.cpp @@ -13,6 +13,14 @@ using namespace std; using namespace Cantera; +double tvalue(double val, double atol = 1.0E-9) { + double rval = val; + if (fabs(val) < atol) { + rval = 0.0; + } + return rval; +} + int main () { double dens, u, s, h, cv, cp, pres; @@ -62,7 +70,7 @@ int main () { temp = T[i]; w->setState_TP(temp, presLow); h = w->enthalpy_mole(); - delh0 = h - h298; + delh0 = tvalue(h - h298, 1.0E-6); g = w->gibbs_mole(); delg0 = (g - h298)/temp + GasConstant * log(oneBar/presLow); Cp0 = w->cp_mole(); @@ -104,7 +112,7 @@ int main () { } w->setState_TP(temp, press); h = w->enthalpy_mole(); - delh0 = h - h298l; + delh0 = tvalue(h - h298l, 1.0E-6); g = w->gibbs_mole(); delg0 = (g - h298l)/temp; Cp0 = w->cp_mole(); diff --git a/test_problems/cathermo/testWaterTP/output_blessed.txt b/test_problems/cathermo/testWaterTP/output_blessed.txt index fc2f9f22a..a38522636 100644 --- a/test_problems/cathermo/testWaterTP/output_blessed.txt +++ b/test_problems/cathermo/testWaterTP/output_blessed.txt @@ -22,7 +22,7 @@ Liquid 1bar or psat Standard State T press psat Cp0 S0 -(G0-H298)/T H0-H298 (K) (bar) (bar) (J/molK) (J/molK) (J/molK) (kJ/mol) 273.19 1 0.00612989 76.0121 63.3157 70.2194 -1.88603 - 298.15 1 0.0316993 75.3276 69.9224 69.9224 2.38419e-13 + 298.15 1 0.0316993 75.3276 69.9224 69.9224 0 300 1 0.0353681 75.3153 70.3884 69.9239 0.139344 373.15 1.01621 1.01418 75.9465 86.857 71.6855 5.66125 400 2.46261 2.45769 76.6642 92.1544 72.8766 7.71115 diff --git a/test_problems/cathermo/testWaterTP/testWaterTP.cpp b/test_problems/cathermo/testWaterTP/testWaterTP.cpp index 64d6d09fb..ed06ab55f 100644 --- a/test_problems/cathermo/testWaterTP/testWaterTP.cpp +++ b/test_problems/cathermo/testWaterTP/testWaterTP.cpp @@ -2,10 +2,22 @@ * $Id$ */ #include "stdio.h" +#include "math.h" #include "WaterTP.h" #include using namespace std; + +double tvalue(double val, double atol = 1.0E-9) { + double rval = val; + if (fabs(val) < atol) { + rval = 0.0; + } + return rval; +} + + + int main () { double dens, u, s, h, cv, cp, pres; @@ -54,7 +66,7 @@ int main () { temp = T[i]; w->setState_TP(temp, presLow); h = w->enthalpy_mole(); - delh0 = h - h298; + delh0 = tvalue(h - h298, 1.0E-6); g = w->gibbs_mole(); delg0 = (g - h298)/temp + GasConstant * log(oneBar/presLow); Cp0 = w->cp_mole(); @@ -96,7 +108,7 @@ int main () { } w->setState_TP(temp, press); h = w->enthalpy_mole(); - delh0 = h - h298l; + delh0 = tvalue(h - h298l, 1.0E-6); g = w->gibbs_mole(); delg0 = (g - h298l)/temp; Cp0 = w->cp_mole();