https://mooseframework.inl.gov
Functions
Water97FluidPropertiesTest.C File Reference

Go to the source code of this file.

Functions

 TEST_F (Water97FluidPropertiesTest, fluidName)
 Test that the fluid name is correctly returned. More...
 
 TEST_F (Water97FluidPropertiesTest, molarMass)
 Test that the molar mass is correctly returned. More...
 
 TEST_F (Water97FluidPropertiesTest, criticalProperties)
 Test that the critical properties are correctly returned. More...
 
 TEST_F (Water97FluidPropertiesTest, triplePointProperties)
 Test that the triple point properties are correctly returned. More...
 
 TEST_F (Water97FluidPropertiesTest, inRegion)
 Verify that the correct region is provided for a given pressure and temperature. More...
 
 TEST_F (Water97FluidPropertiesTest, inRegionPH)
 Verify that the correct region is provided for a given pressure and enthalpy. More...
 
 TEST_F (Water97FluidPropertiesTest, b23)
 Verify calculation of the boundary between regions 2 and 3 using the verification point (P,T) = (16.5291643 MPa, 623.15 K) Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007. More...
 
 TEST_F (Water97FluidPropertiesTest, b2bc)
 Verify calculation of the boundary between regions 2b and 2c for the backwards equation T(p,h) using the verification point (p,h) = (100 MPa, 0.3516004323e4 kj/kg) from Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007. More...
 
 TEST_F (Water97FluidPropertiesTest, b3ab)
 Verify calculation of the boundary between regions 3a and 3b for the backwards equation T(p,h) using the verification point (p,h) = (25 MPa, 2.095936454e3 kj/kg) from Revised Supplementary Release on Backward Equations for the Functions T(p,h), v(p,h) and T(p,s), v(p,s) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam. More...
 
 TEST_F (Water97FluidPropertiesTest, vaporPressure)
 Verify calculation of water properties in region 4 (saturation line) using the verification values given in Table 35 of Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007. More...
 
 TEST_F (Water97FluidPropertiesTest, vaporTemperature)
 Verify calculation of water properties in region 4 (saturation line) using the verification values given in Table 36 of Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007. More...
 
 TEST_F (Water97FluidPropertiesTest, subregion3)
 Verify calculation of the subregion in all 26 subregions in region 3 from Revised Supplementary Release on Backward Equations for Specific Volume as a Function of Pressure and Temperature v(p,T) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam. More...
 
 TEST_F (Water97FluidPropertiesTest, subregion3Density)
 Verify calculation of the density in all 26 subregions in region 3 from Revised Supplementary Release on Backward Equations for Specific Volume as a Function of Pressure and Temperature v(p,T) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam. More...
 
 TEST_F (Water97FluidPropertiesTest, properties)
 Verify calculation of the water properties in all regions using verification data provided in IAPWS guidelines. More...
 
 TEST_F (Water97FluidPropertiesTest, derivatives)
 Verify calculation of the derivatives in all regions by comparing with finite differences. More...
 
 TEST_F (Water97FluidPropertiesTest, combined)
 Verify that the methods that return multiple properties in one call return identical values as the individual methods. More...
 
 TEST_F (Water97FluidPropertiesTest, henry)
 Verify calculation of Henry's constant using data from Guidelines on the Henry's constant and vapour liquid distribution constant for gases in H20 and D20 at high temperatures, IAPWS (2004). More...
 
 TEST_F (Water97FluidPropertiesTest, conservative)
 Verify that calculations from conservative variables are accurate. More...
 

Function Documentation

◆ TEST_F() [1/18]

TEST_F ( Water97FluidPropertiesTest  ,
fluidName   
)

Test that the fluid name is correctly returned.

Definition at line 16 of file Water97FluidPropertiesTest.C.

16 { EXPECT_EQ(_fp->fluidName(), "water"); }

◆ TEST_F() [2/18]

TEST_F ( Water97FluidPropertiesTest  ,
molarMass   
)

Test that the molar mass is correctly returned.

Definition at line 21 of file Water97FluidPropertiesTest.C.

21 { ABS_TEST(_fp->molarMass(), 18.015e-3, 1.0e-15); }

◆ TEST_F() [3/18]

TEST_F ( Water97FluidPropertiesTest  ,
criticalProperties   
)

Test that the critical properties are correctly returned.

Definition at line 26 of file Water97FluidPropertiesTest.C.

27 {
28  ABS_TEST(_fp->criticalPressure(), 22.064e6, 1.0e-15);
29  ABS_TEST(_fp->criticalTemperature(), 647.096, 1.0e-15);
30  ABS_TEST(_fp->criticalDensity(), 322.0, 1.0e-15);
31 }

◆ TEST_F() [4/18]

TEST_F ( Water97FluidPropertiesTest  ,
triplePointProperties   
)

Test that the triple point properties are correctly returned.

Definition at line 36 of file Water97FluidPropertiesTest.C.

37 {
38  ABS_TEST(_fp->triplePointPressure(), 611.657, 1.0e-15);
39  ABS_TEST(_fp->triplePointTemperature(), 273.16, 1.0e-15);
40 }

◆ TEST_F() [5/18]

TEST_F ( Water97FluidPropertiesTest  ,
inRegion   
)

Verify that the correct region is provided for a given pressure and temperature.

Also verify that an error is thrown if pressure and temperature are outside the range of validity

Definition at line 47 of file Water97FluidPropertiesTest.C.

48 {
49  // Region 1
50  EXPECT_EQ(_fp->inRegion(3.0e6, 300), (unsigned int)1);
51  EXPECT_EQ(_fp->inRegion(80.0e6, 300), (unsigned int)1);
52  EXPECT_EQ(_fp->inRegion(3.0e6, 500), (unsigned int)1);
53 
54  // Region 2
55  EXPECT_EQ(_fp->inRegion(3.5e3, 300), (unsigned int)2);
56  EXPECT_EQ(_fp->inRegion(30.0e6, 700), (unsigned int)2);
57  EXPECT_EQ(_fp->inRegion(75.0e6, 950), (unsigned int)2);
58 
59  // Region 3
60  EXPECT_EQ(_fp->inRegion(25.588e6, 650), (unsigned int)3);
61  EXPECT_EQ(_fp->inRegion(22.298e6, 650), (unsigned int)3);
62  EXPECT_EQ(_fp->inRegion(78.32e6, 750), (unsigned int)3);
63 
64  // Region 5
65  EXPECT_EQ(_fp->inRegion(0.5e6, 1500), (unsigned int)5);
66  EXPECT_EQ(_fp->inRegion(30.0e6, 1500), (unsigned int)5);
67  EXPECT_EQ(_fp->inRegion(30.0e6, 2000), (unsigned int)5);
68 
69  // Test out of range errors
70  try
71  {
72  // Trigger invalid pressure error
73  _fp->inRegion(101.0e6, 300.0);
74  // TODO: this test fails with the following line that should be uncommented:
75  // FAIL() << "missing expected error";
76  }
77  catch (const std::exception & e)
78  {
79  std::string msg(e.what());
80  ASSERT_NE(msg.find("Pressure 1.01e+08 is out of range in fp: inRegion()"), std::string::npos)
81  << "failed with unexpected error: " << msg;
82  }
83 
84  try
85  {
86  // Trigger another invalid pressure error
87  _fp->inRegion(51.0e6, 1200.0);
88  FAIL() << "missing expected error";
89  }
90  catch (const std::exception & e)
91  {
92  std::string msg(e.what());
93  ASSERT_NE(msg.find("Pressure 5.1e+07 is out of range in fp: inRegion()"), std::string::npos)
94  << "failed with unexpected error: " << msg;
95  }
96 
97  try
98  {
99  // Trigger invalid temperature error
100  _fp->inRegion(5.0e6, 2001.0);
101  // TODO: this test fails with the following line that should be uncommented:
102  // FAIL() << "missing expected error";
103  }
104  catch (const std::exception & e)
105  {
106  std::string msg(e.what());
107  ASSERT_NE(msg.find("Temperature 2001 is out of range in fp: inRegion()"), std::string::npos)
108  << "failed with unexpected error: " << msg;
109  }
110 }
void ErrorVector unsigned int

◆ TEST_F() [6/18]

TEST_F ( Water97FluidPropertiesTest  ,
inRegionPH   
)

Verify that the correct region is provided for a given pressure and enthalpy.

Also verify that an error is thrown if pressure and enthalpy are outside the range of validity

Definition at line 117 of file Water97FluidPropertiesTest.C.

118 {
119  // Region 1
120  EXPECT_EQ(_fp->inRegionPH(3.0e6, _fp->h_from_p_T(3.0e6, 300)), (unsigned int)1);
121  EXPECT_EQ(_fp->inRegionPH(80.0e6, _fp->h_from_p_T(80.0e6, 300)), (unsigned int)1);
122  EXPECT_EQ(_fp->inRegionPH(3.0e6, _fp->h_from_p_T(3.0e6, 500)), (unsigned int)1);
123 
124  // Region 4
125  const auto p_test = _fp->vaporPressure(400);
126  EXPECT_EQ(_fp->inRegionPH(p_test, _fp->h_from_p_T(p_test, 400 - 0.01) + 1e2), (unsigned int)4);
127  EXPECT_EQ(_fp->inRegionPH(p_test, _fp->h_from_p_T(p_test, 400 + 0.01) - 1e2), (unsigned int)4);
128 
129  // Region 2
130  EXPECT_EQ(_fp->inRegionPH(3.5e3, _fp->h_from_p_T(3.5e3, 300)), (unsigned int)2);
131  EXPECT_EQ(_fp->inRegionPH(30.0e6, _fp->h_from_p_T(30.0e6, 700)), (unsigned int)2);
132  EXPECT_EQ(_fp->inRegionPH(75.0e6, _fp->h_from_p_T(75.0e6, 950)), (unsigned int)2);
133 
134  // Region 3
135  EXPECT_EQ(_fp->inRegionPH(25.588e6, _fp->h_from_p_T(25.588e6, 650)), (unsigned int)3);
136  EXPECT_EQ(_fp->inRegionPH(22.298e6, _fp->h_from_p_T(22.298e6, 650)), (unsigned int)3);
137  EXPECT_EQ(_fp->inRegionPH(78.32e6, _fp->h_from_p_T(78.32e6, 750)), (unsigned int)3);
138 
139  // Region 5
140  EXPECT_EQ(_fp->inRegionPH(0.5e6, _fp->h_from_p_T(0.5e6, 1500)), (unsigned int)5);
141  EXPECT_EQ(_fp->inRegionPH(30.0e6, _fp->h_from_p_T(30.0e6, 1500)), (unsigned int)5);
142  EXPECT_EQ(_fp->inRegionPH(30.0e6, _fp->h_from_p_T(30.0e6, 2000)), (unsigned int)5);
143 
144  // Test out of range errors
145  // Low enthalpy
146  try
147  {
148  // Trigger invalid pressure error
149  _fp->inRegionPH(101.0e6, 0.1);
150  FAIL() << "missing expected error";
151  }
152  catch (const std::exception & e)
153  {
154  std::string msg(e.what());
155  ASSERT_NE(msg.find("Pressure 1.01e+08 is out of range in fp: inRegion()"), std::string::npos)
156  << "failed with unexpected error: " << msg;
157  }
158 
159  // Low pressure, too high enthalpy
160  try
161  {
162  // Trigger another invalid pressure error
163  _fp->inRegionPH(1.0e6, 1e8);
164  FAIL() << "missing expected error";
165  }
166  catch (const std::exception & e)
167  {
168  std::string msg(e.what());
169  ASSERT_NE(msg.find("Enthalpy 1e+08 is out of range in fp: inRegionPH()"), std::string::npos)
170  << "failed with unexpected error: " << msg;
171  }
172 
173  // Medium pressure, too high enthalpy
174  try
175  {
176  // Trigger invalid temperature error
177  _fp->inRegionPH(20e6, 1e8);
178  FAIL() << "missing expected error";
179  }
180  catch (const std::exception & e)
181  {
182  std::string msg(e.what());
183  ASSERT_NE(msg.find("Enthalpy 1e+08 is out of range in fp: inRegionPH()"), std::string::npos)
184  << "failed with unexpected error: " << msg;
185  }
186 
187  // High pressure, too high enthalpy
188  try
189  {
190  // Trigger invalid temperature error
191  _fp->inRegionPH(70e6, 1e8);
192  FAIL() << "missing expected error";
193  }
194  catch (const std::exception & e)
195  {
196  std::string msg(e.what());
197  ASSERT_NE(msg.find("Enthalpy 1e+08 is out of range in fp: inRegionPH()"), std::string::npos)
198  << "failed with unexpected error: " << msg;
199  }
200 }

◆ TEST_F() [7/18]

TEST_F ( Water97FluidPropertiesTest  ,
b23   
)

Verify calculation of the boundary between regions 2 and 3 using the verification point (P,T) = (16.5291643 MPa, 623.15 K) Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007.

Definition at line 208 of file Water97FluidPropertiesTest.C.

209 {
210  REL_TEST(_fp->b23T(16.5291643e6), 623.15, 1.0e-8);
211  REL_TEST(_fp->b23p(623.15), 16.5291643e6, 1.0e-8);
212 }

◆ TEST_F() [8/18]

TEST_F ( Water97FluidPropertiesTest  ,
b2bc   
)

Verify calculation of the boundary between regions 2b and 2c for the backwards equation T(p,h) using the verification point (p,h) = (100 MPa, 0.3516004323e4 kj/kg) from Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007.

Definition at line 221 of file Water97FluidPropertiesTest.C.

221 { REL_TEST(_fp->b2bc(100.0e6), 0.3516004323e7, 1.0e-8); }

◆ TEST_F() [9/18]

TEST_F ( Water97FluidPropertiesTest  ,
b3ab   
)

Verify calculation of the boundary between regions 3a and 3b for the backwards equation T(p,h) using the verification point (p,h) = (25 MPa, 2.095936454e3 kj/kg) from Revised Supplementary Release on Backward Equations for the Functions T(p,h), v(p,h) and T(p,s), v(p,s) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

Definition at line 232 of file Water97FluidPropertiesTest.C.

232 { REL_TEST(_fp->b3ab(25.0e6), 2.095936454e6, 1.0e-8); }

◆ TEST_F() [10/18]

TEST_F ( Water97FluidPropertiesTest  ,
vaporPressure   
)

Verify calculation of water properties in region 4 (saturation line) using the verification values given in Table 35 of Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007.

Definition at line 240 of file Water97FluidPropertiesTest.C.

241 {
242  REL_TEST(_fp->vaporPressure(300), 3.53658941e3, 1.0e-8);
243  REL_TEST(_fp->vaporPressure(500), 2.63889776e6, 1.0e-8);
244  REL_TEST(_fp->vaporPressure(600), 12.3443146e6, 1.0e-8);
245 }

◆ TEST_F() [11/18]

TEST_F ( Water97FluidPropertiesTest  ,
vaporTemperature   
)

Verify calculation of water properties in region 4 (saturation line) using the verification values given in Table 36 of Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007.

Definition at line 253 of file Water97FluidPropertiesTest.C.

254 {
255  REL_TEST(_fp->vaporTemperature(0.1e6), 372.755919, 1.0e-8);
256  REL_TEST(_fp->vaporTemperature(1.0e6), 453.035632, 1.0e-8);
257  REL_TEST(_fp->vaporTemperature(10.0e6), 584.149488, 1.0e-8);
258 }

◆ TEST_F() [12/18]

TEST_F ( Water97FluidPropertiesTest  ,
subregion3   
)

Verify calculation of the subregion in all 26 subregions in region 3 from Revised Supplementary Release on Backward Equations for Specific Volume as a Function of Pressure and Temperature v(p,T) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

Definition at line 267 of file Water97FluidPropertiesTest.C.

268 {
269  EXPECT_EQ(_fp->subregion3(50.0e6, 630.0), (unsigned int)0);
270  EXPECT_EQ(_fp->subregion3(80.0e6, 670.0), (unsigned int)0);
271  EXPECT_EQ(_fp->subregion3(50.0e6, 710.0), (unsigned int)1);
272  EXPECT_EQ(_fp->subregion3(80.0e6, 750.0), (unsigned int)1);
273  EXPECT_EQ(_fp->subregion3(20.0e6, 630.0), (unsigned int)2);
274  EXPECT_EQ(_fp->subregion3(30.0e6, 650.0), (unsigned int)2);
275  EXPECT_EQ(_fp->subregion3(26.0e6, 656.0), (unsigned int)3);
276  EXPECT_EQ(_fp->subregion3(30.0e6, 670.0), (unsigned int)3);
277  EXPECT_EQ(_fp->subregion3(26.0e6, 661.0), (unsigned int)4);
278  EXPECT_EQ(_fp->subregion3(30.0e6, 675.0), (unsigned int)4);
279  EXPECT_EQ(_fp->subregion3(26.0e6, 671.0), (unsigned int)5);
280  EXPECT_EQ(_fp->subregion3(30.0e6, 690.0), (unsigned int)5);
281  EXPECT_EQ(_fp->subregion3(23.6e6, 649.0), (unsigned int)6);
282  EXPECT_EQ(_fp->subregion3(24.0e6, 650.0), (unsigned int)6);
283  EXPECT_EQ(_fp->subregion3(23.6e6, 652.0), (unsigned int)7);
284  EXPECT_EQ(_fp->subregion3(24.0e6, 654.0), (unsigned int)7);
285  EXPECT_EQ(_fp->subregion3(23.6e6, 653.0), (unsigned int)8);
286  EXPECT_EQ(_fp->subregion3(24.0e6, 655.0), (unsigned int)8);
287  EXPECT_EQ(_fp->subregion3(23.5e6, 655.0), (unsigned int)9);
288  EXPECT_EQ(_fp->subregion3(24.0e6, 660.0), (unsigned int)9);
289  EXPECT_EQ(_fp->subregion3(23.0e6, 660.0), (unsigned int)10);
290  EXPECT_EQ(_fp->subregion3(24.0e6, 670.0), (unsigned int)10);
291  EXPECT_EQ(_fp->subregion3(22.6e6, 646.0), (unsigned int)11);
292  EXPECT_EQ(_fp->subregion3(23.0e6, 646.0), (unsigned int)11);
293  EXPECT_EQ(_fp->subregion3(22.6e6, 648.6), (unsigned int)12);
294  EXPECT_EQ(_fp->subregion3(22.8e6, 649.3), (unsigned int)12);
295  EXPECT_EQ(_fp->subregion3(22.6e6, 649.0), (unsigned int)13);
296  EXPECT_EQ(_fp->subregion3(22.8e6, 649.7), (unsigned int)13);
297  EXPECT_EQ(_fp->subregion3(22.6e6, 649.1), (unsigned int)14);
298  EXPECT_EQ(_fp->subregion3(22.8e6, 649.9), (unsigned int)14);
299  EXPECT_EQ(_fp->subregion3(22.6e6, 649.4), (unsigned int)15);
300  EXPECT_EQ(_fp->subregion3(22.8e6, 650.2), (unsigned int)15);
301  EXPECT_EQ(_fp->subregion3(21.1e6, 640.0), (unsigned int)16);
302  EXPECT_EQ(_fp->subregion3(21.8e6, 643.0), (unsigned int)16);
303  EXPECT_EQ(_fp->subregion3(21.1e6, 644.0), (unsigned int)17);
304  EXPECT_EQ(_fp->subregion3(21.8e6, 648.0), (unsigned int)17);
305  EXPECT_EQ(_fp->subregion3(19.1e6, 635.0), (unsigned int)18);
306  EXPECT_EQ(_fp->subregion3(20.0e6, 638.0), (unsigned int)18);
307  EXPECT_EQ(_fp->subregion3(17.0e6, 626.0), (unsigned int)19);
308  EXPECT_EQ(_fp->subregion3(20.0e6, 640.0), (unsigned int)19);
309  EXPECT_EQ(_fp->subregion3(21.5e6, 644.6), (unsigned int)20);
310  EXPECT_EQ(_fp->subregion3(22.0e6, 646.1), (unsigned int)20);
311  EXPECT_EQ(_fp->subregion3(22.5e6, 648.6), (unsigned int)21);
312  EXPECT_EQ(_fp->subregion3(22.3e6, 647.9), (unsigned int)21);
313  EXPECT_EQ(_fp->subregion3(22.15e6, 647.5), (unsigned int)22);
314  EXPECT_EQ(_fp->subregion3(22.3e6, 648.1), (unsigned int)22);
315  EXPECT_EQ(_fp->subregion3(22.11e6, 648.0), (unsigned int)23);
316  EXPECT_EQ(_fp->subregion3(22.3e6, 649.0), (unsigned int)23);
317  EXPECT_EQ(_fp->subregion3(22.0e6, 646.84), (unsigned int)24);
318  EXPECT_EQ(_fp->subregion3(22.064e6, 647.05), (unsigned int)24);
319  EXPECT_EQ(_fp->subregion3(22.0e6, 646.89), (unsigned int)25);
320  EXPECT_EQ(_fp->subregion3(22.064e6, 647.15), (unsigned int)25);
321 }
void ErrorVector unsigned int

◆ TEST_F() [13/18]

TEST_F ( Water97FluidPropertiesTest  ,
subregion3Density   
)

Verify calculation of the density in all 26 subregions in region 3 from Revised Supplementary Release on Backward Equations for Specific Volume as a Function of Pressure and Temperature v(p,T) for Region 3 of the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam.

Definition at line 330 of file Water97FluidPropertiesTest.C.

331 {
332  const Real tol = 1.0e-8;
333 
334  REL_TEST(_fp->densityRegion3(50.0e6, 630.0), 1.0 / 0.001470853100, tol);
335  REL_TEST(_fp->densityRegion3(80.0e6, 670.0), 1.0 / 0.001503831359, tol);
336  REL_TEST(_fp->densityRegion3(50.0e6, 710.0), 1.0 / 0.002204728587, tol);
337  REL_TEST(_fp->densityRegion3(80.0e6, 750.0), 1.0 / 0.001973692940, tol);
338  REL_TEST(_fp->densityRegion3(20.0e6, 630.0), 1.0 / 0.001761696406, tol);
339  REL_TEST(_fp->densityRegion3(30.0e6, 650.0), 1.0 / 0.001819560617, tol);
340  REL_TEST(_fp->densityRegion3(26.0e6, 656.0), 1.0 / 0.002245587720, tol);
341  REL_TEST(_fp->densityRegion3(30.0e6, 670.0), 1.0 / 0.002506897702, tol);
342  REL_TEST(_fp->densityRegion3(26.0e6, 661.0), 1.0 / 0.002970225962, tol);
343  REL_TEST(_fp->densityRegion3(30.0e6, 675.0), 1.0 / 0.003004627086, tol);
344  REL_TEST(_fp->densityRegion3(26.0e6, 671.0), 1.0 / 0.005019029401, tol);
345  REL_TEST(_fp->densityRegion3(30.0e6, 690.0), 1.0 / 0.004656470142, tol);
346  REL_TEST(_fp->densityRegion3(23.6e6, 649.0), 1.0 / 0.002163198378, tol);
347  REL_TEST(_fp->densityRegion3(24.0e6, 650.0), 1.0 / 0.002166044161, tol);
348  REL_TEST(_fp->densityRegion3(23.6e6, 652.0), 1.0 / 0.002651081407, tol);
349  REL_TEST(_fp->densityRegion3(24.0e6, 654.0), 1.0 / 0.002967802335, tol);
350  REL_TEST(_fp->densityRegion3(23.6e6, 653.0), 1.0 / 0.003273916816, tol);
351  REL_TEST(_fp->densityRegion3(24.0e6, 655.0), 1.0 / 0.003550329864, tol);
352  REL_TEST(_fp->densityRegion3(23.5e6, 655.0), 1.0 / 0.004545001142, tol);
353  REL_TEST(_fp->densityRegion3(24.0e6, 660.0), 1.0 / 0.005100267704, tol);
354  REL_TEST(_fp->densityRegion3(23.0e6, 660.0), 1.0 / 0.006109525997, tol);
355  REL_TEST(_fp->densityRegion3(24.0e6, 670.0), 1.0 / 0.006427325645, tol);
356  REL_TEST(_fp->densityRegion3(22.6e6, 646.0), 1.0 / 0.002117860851, tol);
357  REL_TEST(_fp->densityRegion3(23.0e6, 646.0), 1.0 / 0.002062374674, tol);
358  REL_TEST(_fp->densityRegion3(22.6e6, 648.6), 1.0 / 0.002533063780, tol);
359  REL_TEST(_fp->densityRegion3(22.8e6, 649.3), 1.0 / 0.002572971781, tol);
360  REL_TEST(_fp->densityRegion3(22.6e6, 649.0), 1.0 / 0.002923432711, tol);
361  REL_TEST(_fp->densityRegion3(22.8e6, 649.7), 1.0 / 0.002913311494, tol);
362  REL_TEST(_fp->densityRegion3(22.6e6, 649.1), 1.0 / 0.003131208996, tol);
363  REL_TEST(_fp->densityRegion3(22.8e6, 649.9), 1.0 / 0.003221160278, tol);
364  REL_TEST(_fp->densityRegion3(22.6e6, 649.4), 1.0 / 0.003715596186, tol);
365  REL_TEST(_fp->densityRegion3(22.8e6, 650.2), 1.0 / 0.003664754790, tol);
366  REL_TEST(_fp->densityRegion3(21.1e6, 640.0), 1.0 / 0.001970999272, tol);
367  REL_TEST(_fp->densityRegion3(21.8e6, 643.0), 1.0 / 0.002043919161, tol);
368  REL_TEST(_fp->densityRegion3(21.1e6, 644.0), 1.0 / 0.005251009921, tol);
369  REL_TEST(_fp->densityRegion3(21.8e6, 648.0), 1.0 / 0.005256844741, tol);
370  REL_TEST(_fp->densityRegion3(19.1e6, 635.0), 1.0 / 0.001932829079, tol);
371  REL_TEST(_fp->densityRegion3(20.0e6, 638.0), 1.0 / 0.001985387227, tol);
372  REL_TEST(_fp->densityRegion3(17.0e6, 626.0), 1.0 / 0.008483262001, tol);
373  REL_TEST(_fp->densityRegion3(20.0e6, 640.0), 1.0 / 0.006227528101, tol);
374  REL_TEST(_fp->densityRegion3(21.5e6, 644.6), 1.0 / 0.002268366647, tol);
375  REL_TEST(_fp->densityRegion3(22.0e6, 646.1), 1.0 / 0.002296350553, tol);
376  REL_TEST(_fp->densityRegion3(22.5e6, 648.6), 1.0 / 0.002832373260, tol);
377  REL_TEST(_fp->densityRegion3(22.3e6, 647.9), 1.0 / 0.002811424405, tol);
378  REL_TEST(_fp->densityRegion3(22.15e6, 647.5), 1.0 / 0.003694032281, tol);
379  REL_TEST(_fp->densityRegion3(22.3e6, 648.1), 1.0 / 0.003622226305, tol);
380  REL_TEST(_fp->densityRegion3(22.11e6, 648.0), 1.0 / 0.004528072649, tol);
381  REL_TEST(_fp->densityRegion3(22.3e6, 649.0), 1.0 / 0.004556905799, tol);
382  REL_TEST(_fp->densityRegion3(22.0e6, 646.84), 1.0 / 0.002698354719, tol);
383  REL_TEST(_fp->densityRegion3(22.064e6, 647.05), 1.0 / 0.002717655648, tol);
384  REL_TEST(_fp->densityRegion3(22.0e6, 646.89), 1.0 / 0.003798732962, tol);
385  REL_TEST(_fp->densityRegion3(22.064e6, 647.15), 1.0 / 0.003701940010, tol);
386 }
const double tol
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [14/18]

TEST_F ( Water97FluidPropertiesTest  ,
properties   
)

Verify calculation of the water properties in all regions using verification data provided in IAPWS guidelines.

Density, enthalpy, internal energy, entropy, cp and speed of sound data from: Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, IAPWS 2007.

Viscosity data from: Table 4 of Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance.

Thermal conductivity data from: Table D1 of Revised Release on the IAPS Formulation 1985 for the Thermal Conductivity of Ordinary Water Substance

Definition at line 403 of file Water97FluidPropertiesTest.C.

404 {
405  Real p0, p1, p2, T0, T1, T2;
406 
407  const Real tol = 1.0e-8;
408  const Real tol2 = 1.0e-12;
409 
410  // Region 1 properties
411  p0 = 3.0e6;
412  p1 = 80.0e6;
413  p2 = 3.0e6;
414  T0 = 300.0;
415  T1 = 300.0;
416  T2 = 500.0;
417 
418  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 0.00100215168, tol);
419  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 0.000971180894, tol);
420  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.00120241800, tol);
421  REL_TEST(_fp->h_from_p_T(p0, T0), 115.331273e3, tol);
422  REL_TEST(_fp->h_from_p_T(p1, T1), 184.142828e3, tol);
423  REL_TEST(_fp->h_from_p_T(p2, T2), 975.542239e3, tol);
424  REL_TEST(_fp->e_from_p_T(p0, T0), 112.324818e3, tol);
425  REL_TEST(_fp->e_from_p_T(p1, T1), 106.448356e3, tol);
426  REL_TEST(_fp->e_from_p_T(p2, T2), 971.934985e3, tol);
427  REL_TEST(_fp->s_from_p_T(p0, T0), 0.392294792e3, tol);
428  REL_TEST(_fp->s_from_p_T(p1, T1), 0.368563852e3, tol);
429  REL_TEST(_fp->s_from_p_T(p2, T2), 2.58041912e3, tol);
430  REL_TEST(_fp->cp_from_p_T(p0, T0), 4.17301218e3, tol);
431  REL_TEST(_fp->cp_from_p_T(p1, T1), 4.01008987e3, tol);
432  REL_TEST(_fp->cp_from_p_T(p2, T2), 4.65580682e3, tol);
433  REL_TEST(_fp->c_from_p_T(p0, T0), 1507.73921, tol);
434  REL_TEST(_fp->c_from_p_T(p1, T1), 1634.69054, tol);
435  REL_TEST(_fp->c_from_p_T(p2, T2), 1240.71337, tol);
436 
437  // Lower tolerance for cv as it is compared with values from NIST
438  REL_TEST(_fp->cv_from_p_T(p0, T0), 4.1207e3, REL_TOL_EXTERNAL_VALUE);
439 
440  // (h,p) properties
441  Real h0, h1, h2;
442  h0 = _fp->h_from_p_T(p0, T0);
443  h1 = _fp->h_from_p_T(p1, T1);
444  h2 = _fp->h_from_p_T(p2, T2);
445  REL_TEST(_fp->s_from_h_p(h0, p0), 0.392294792e3, 1e-3);
446  REL_TEST(_fp->s_from_h_p(h1, p1), 0.368563852e3, 1e-3);
447  REL_TEST(_fp->s_from_h_p(h2, p2), 2.58041912e3, 1e-4);
448 
449  // Region 2 properties
450  p0 = 3.5e3;
451  p1 = 3.5e3;
452  p2 = 30.0e6;
453  T0 = 300.0;
454  T1 = 700.0;
455  T2 = 700.0;
456 
457  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 39.4913866, tol);
458  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 92.3015898, tol);
459  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.00542946619, tol);
460  REL_TEST(_fp->h_from_p_T(p0, T0), 2549.91145e3, tol);
461  REL_TEST(_fp->h_from_p_T(p1, T1), 3335.68375e3, tol);
462  REL_TEST(_fp->h_from_p_T(p2, T2), 2631.49474e3, tol);
463  REL_TEST(_fp->e_from_p_T(p0, T0), 2411.6916e3, tol);
464  REL_TEST(_fp->e_from_p_T(p1, T1), 3012.62819e3, tol);
465  REL_TEST(_fp->e_from_p_T(p2, T2), 2468.61076e3, tol);
466  REL_TEST(_fp->s_from_p_T(p0, T0), 8.52238967e3, tol);
467  REL_TEST(_fp->s_from_p_T(p1, T1), 10.1749996e3, tol);
468  REL_TEST(_fp->s_from_p_T(p2, T2), 5.17540298e3, tol);
469  REL_TEST(_fp->cp_from_p_T(p0, T0), 1.91300162e3, tol);
470  REL_TEST(_fp->cp_from_p_T(p1, T1), 2.08141274e3, tol);
471  REL_TEST(_fp->cp_from_p_T(p2, T2), 10.3505092e3, tol);
472  REL_TEST(_fp->c_from_p_T(p0, T0), 427.920172, tol);
473  REL_TEST(_fp->c_from_p_T(p1, T1), 644.289068, tol);
474  REL_TEST(_fp->c_from_p_T(p2, T2), 480.386523, tol);
475 
476  // Lower tolerance for cv as it is compared with values from NIST
477  REL_TEST(_fp->cv_from_p_T(p0, T0), 1.4415e3, REL_TOL_EXTERNAL_VALUE);
478 
479  // (h,p) properties
480  h0 = _fp->h_from_p_T(p0, T0);
481  h1 = _fp->h_from_p_T(p1, T1);
482  h2 = _fp->h_from_p_T(p2, T2);
483  REL_TEST(_fp->s_from_h_p(h0, p0), 8.52238967e3, 1e-5);
484  REL_TEST(_fp->s_from_h_p(h1, p1), 10.1749996e3, 1e-6);
485  REL_TEST(_fp->s_from_h_p(h2, p2), 5.17540298e3, 1e-4);
486 
487  // Region 3 properties
488  p0 = 25.5837018e6;
489  p1 = 22.2930643e6;
490  p2 = 78.3095639e6;
491  T0 = 650.0;
492  T1 = 650.0;
493  T2 = 750.0;
494 
495  // Note: lower tolerance in this region as density is calculated using backwards equation
496  REL_TEST(_fp->rho_from_p_T(p0, T0), 500.0, 1.0e-5);
497  REL_TEST(_fp->rho_from_p_T(p1, T1), 200.0, 1.0e-5);
498  REL_TEST(_fp->rho_from_p_T(p2, T2), 500.0, 1.0e-5);
499  REL_TEST(_fp->h_from_p_T(p0, T0), 1863.43019e3, 1.0e-5);
500  REL_TEST(_fp->h_from_p_T(p1, T1), 2375.12401e3, 1.0e-5);
501  REL_TEST(_fp->h_from_p_T(p2, T2), 2258.68845e3, 1.0e-5);
502  REL_TEST(_fp->e_from_p_T(p0, T0), 1812.26279e3, 1.0e-5);
503  REL_TEST(_fp->e_from_p_T(p1, T1), 2263.65868e3, 1.0e-5);
504  REL_TEST(_fp->e_from_p_T(p2, T2), 2102.06932e3, 1.0e-5);
505  REL_TEST(_fp->s_from_p_T(p0, T0), 4.05427273e3, 1.0e-5);
506  REL_TEST(_fp->s_from_p_T(p1, T1), 4.85438792e3, 1.0e-5);
507  REL_TEST(_fp->s_from_p_T(p2, T2), 4.46971906e3, 1.0e-5);
508  REL_TEST(_fp->cp_from_p_T(p0, T0), 13.8935717e3, 1.0e-4);
509  REL_TEST(_fp->cp_from_p_T(p1, T1), 44.6579342e3, 1.0e-5);
510  REL_TEST(_fp->cp_from_p_T(p2, T2), 6.34165359e3, 1.0e-5);
511  REL_TEST(_fp->c_from_p_T(p0, T0), 502.005554, 1.0e-5);
512  REL_TEST(_fp->c_from_p_T(p1, T1), 383.444594, 1.0e-5);
513  REL_TEST(_fp->c_from_p_T(p2, T2), 760.696041, 1.0e-5);
514 
515  // Lower tolerance for cv as it is compared with values from NIST
516  REL_TEST(_fp->cv_from_p_T(p0, T0), 3.1910e3, REL_TOL_EXTERNAL_VALUE);
517 
518  // (h,p) properties
519  h0 = _fp->h_from_p_T(p0, T0);
520  h1 = _fp->h_from_p_T(p1, T1);
521  h2 = _fp->h_from_p_T(p2, T2);
522  REL_TEST(_fp->s_from_h_p(h0, p0), 4.05427273e3, 1e-4);
523  REL_TEST(_fp->s_from_h_p(h1, p1), 4.85438792e3, 2e-4);
524  REL_TEST(_fp->s_from_h_p(h2, p2), 4.46971906e3, 2e-5);
525 
526  // Region 5 properties
527  p0 = 0.5e6;
528  p1 = 30.0e6;
529  p2 = 30.0e6;
530  T0 = 1500.0;
531  T1 = 1500.0;
532  T2 = 2000.0;
533 
534  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 1.38455090, tol);
535  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 0.0230761299, tol);
536  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.0311385219, tol);
537  REL_TEST(_fp->h_from_p_T(p0, T0), 5219.76855e3, tol);
538  REL_TEST(_fp->h_from_p_T(p1, T1), 5167.23514e3, tol);
539  REL_TEST(_fp->h_from_p_T(p2, T2), 6571.22604e3, tol);
540  REL_TEST(_fp->e_from_p_T(p0, T0), 4527.4931e3, tol);
541  REL_TEST(_fp->e_from_p_T(p1, T1), 4474.95124e3, tol);
542  REL_TEST(_fp->e_from_p_T(p2, T2), 5637.07038e3, tol);
543  REL_TEST(_fp->s_from_p_T(p0, T0), 9.65408875e3, tol);
544  REL_TEST(_fp->s_from_p_T(p1, T1), 7.72970133e3, tol);
545  REL_TEST(_fp->s_from_p_T(p2, T2), 8.53640523e3, tol);
546  REL_TEST(_fp->cp_from_p_T(p0, T0), 2.61609445e3, tol);
547  REL_TEST(_fp->cp_from_p_T(p1, T1), 2.72724317e3, tol);
548  REL_TEST(_fp->cp_from_p_T(p2, T2), 2.88569882e3, tol);
549  REL_TEST(_fp->c_from_p_T(p0, T0), 917.06869, tol);
550  REL_TEST(_fp->c_from_p_T(p1, T1), 928.548002, tol);
551  REL_TEST(_fp->c_from_p_T(p2, T2), 1067.36948, tol);
552 
553  // Lower tolerance for cv as it is compared with values from NIST
554  REL_TEST(_fp->cv_from_p_T(p0, T0), 2.1534e3, REL_TOL_EXTERNAL_VALUE);
555 
556  // (h,p) properties
557  // T_from_p_h is not implemented in zone 5
558 
559  // Viscosity
560  ABS_TEST(_fp->mu_from_rho_T(998.0, 298.15), 889.735100e-6, tol2);
561  ABS_TEST(_fp->mu_from_rho_T(1200.0, 298.15), 1437.649467e-6, tol2);
562  ABS_TEST(_fp->mu_from_rho_T(1000.0, 373.15), 307.883622e-6, tol2);
563  ABS_TEST(_fp->mu_from_rho_T(1.0, 433.15), 14.538324e-6, tol2);
564  ABS_TEST(_fp->mu_from_rho_T(1000.0, 433.15), 217.685358e-6, tol2);
565  ABS_TEST(_fp->mu_from_rho_T(1.0, 873.15), 32.619287e-6, tol2);
566  ABS_TEST(_fp->mu_from_rho_T(100.0, 873.15), 35.802262e-6, tol2);
567  ABS_TEST(_fp->mu_from_rho_T(600.0, 873.15), 77.430195e-6, tol2);
568  ABS_TEST(_fp->mu_from_rho_T(1.0, 1173.15), 44.217245e-6, tol2);
569  ABS_TEST(_fp->mu_from_rho_T(100.0, 1173.15), 47.640433e-6, tol2);
570  ABS_TEST(_fp->mu_from_rho_T(400.0, 1173.15), 64.154608e-6, tol2);
571  REL_TEST(_fp->mu_from_p_T(1e6, 298.15), 889.898581797e-6, REL_TOL_EXTERNAL_VALUE);
572  REL_TEST(_fp->mu_from_p_T(2e6, 298.15), 889.763899645e-6, REL_TOL_EXTERNAL_VALUE);
573  REL_TEST(_fp->mu_from_p_T(1e6, 373.15), 281.825180491e-6, REL_TOL_EXTERNAL_VALUE);
574  REL_TEST(_fp->mu_from_p_T(2e6, 373.15), 282.09550632e-6, REL_TOL_EXTERNAL_VALUE);
575  REL_TEST(_fp->mu_from_p_T(1e6, 433.15), 170.526801634e-6, REL_TOL_EXTERNAL_VALUE);
576  REL_TEST(_fp->mu_from_p_T(2e6, 433.15), 170.780193827e-6, REL_TOL_EXTERNAL_VALUE);
577  REL_TEST(_fp->mu_from_p_T(1e6, 873.15), 3.2641885983e-5, REL_TOL_EXTERNAL_VALUE);
578  REL_TEST(_fp->mu_from_p_T(2e6, 873.15), 3.26820969808e-5, REL_TOL_EXTERNAL_VALUE);
579  REL_TEST(_fp->mu_from_p_T(1e6, 1173.15), 4.42374919686e-5, REL_TOL_EXTERNAL_VALUE);
580  REL_TEST(_fp->mu_from_p_T(2e6, 1173.15), 4.42823959629e-5, REL_TOL_EXTERNAL_VALUE);
581 
582  // Thermal conductivity
583  REL_TEST(_fp->k_from_p_T(1.0e6, 323.15), 0.641, 1.0e-4);
584  REL_TEST(_fp->k_from_p_T(20.0e6, 623.15), 0.4541, 1.0e-4);
585  REL_TEST(_fp->k_from_p_T(50.0e6, 773.15), 0.2055, 1.0e-4);
586 
587  ABS_TEST(_fp->k_from_p_T(1.0e6, 323.15), 0.640972, 5e-7);
588  ABS_TEST(_fp->k_from_p_T(20.0e6, 623.15), 0.454131, 7e-7);
589  ABS_TEST(_fp->k_from_p_T(50.0e6, 773.15), 0.205485, 5e-7);
590 
591  // Backwards equation T(p,h)
592  // Region 1
593  REL_TEST(_fp->T_from_p_h(3.0e6, 500.0e3), 0.391798509e3, tol);
594  REL_TEST(_fp->T_from_p_h(80.0e6, 500.0e3), 0.378108626e3, tol);
595  REL_TEST(_fp->T_from_p_h(80.0e6, 1500.0e3), 0.611041229e3, tol);
596  REL_TEST(_fp->T_from_p_h((ADReal)80.0e6, (ADReal)1500.0e3).value(), 0.611041229e3, tol);
597 
598  // Region 2 (subregion a)
599  REL_TEST(_fp->T_from_p_h(1.0e3, 3000.0e3), 0.534433241e3, tol);
600  REL_TEST(_fp->T_from_p_h(3.0e6, 3000.0e3), 0.575373370e3, tol);
601  REL_TEST(_fp->T_from_p_h(3.0e6, 4000.0e3), 0.101077577e4, tol);
602 
603  // Region 2 (subregion b)
604  REL_TEST(_fp->T_from_p_h(5.0e6, 3500.0e3), 0.801299102e3, tol);
605  REL_TEST(_fp->T_from_p_h(5.0e6, 4000.0e3), 0.101531583e4, tol);
606  REL_TEST(_fp->T_from_p_h(25.0e6, 3500.0e3), 0.875279054e3, tol);
607 
608  // Region 2 (subregion c)
609  REL_TEST(_fp->T_from_p_h(40.0e6, 2700.0e3), 0.743056411e3, tol);
610  REL_TEST(_fp->T_from_p_h(60.0e6, 2700.0e3), 0.791137067e3, tol);
611  REL_TEST(_fp->T_from_p_h(60.0e6, 3200.0e3), 0.882756860e3, tol);
612 
613  // Region 3 (subregion a)
614  REL_TEST(_fp->T_from_p_h(20.0e6, 1700.0e3), 0.6293083892e3, tol);
615  REL_TEST(_fp->T_from_p_h(50.0e6, 2000.0e3), 0.6905718338e3, tol);
616  REL_TEST(_fp->T_from_p_h(100.0e6, 2100.0e3), 0.7336163014e3, tol);
617 
618  // Region 3 (subregion b)
619  REL_TEST(_fp->T_from_p_h(20.0e6, 2500.0e3), 0.6418418053e3, tol);
620  REL_TEST(_fp->T_from_p_h(50.0e6, 2400.0e3), 0.7351848618e3, tol);
621  REL_TEST(_fp->T_from_p_h(100.0e6, 2700.0e3), 0.8420460876e3, tol);
622 }
const double tol
DualNumber< Real, DNDerivativeType, false > ADReal
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [15/18]

TEST_F ( Water97FluidPropertiesTest  ,
derivatives   
)

Verify calculation of the derivatives in all regions by comparing with finite differences.

Definition at line 628 of file Water97FluidPropertiesTest.C.

629 {
630  const Real tol = REL_TOL_DERIVATIVE;
631 
632  // Region 1
633  Real p = 3.0e6;
634  Real T = 300.0;
635  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
636  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
637  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
638  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
639 
640  // Region 2
641  p = 3.5e3;
642  T = 300.0;
643  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
644  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
645  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
646  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
647 
648  // Region 3
649  p = 26.0e6;
650  T = 650.0;
651  DERIV_TEST(_fp->rho_from_p_T, p, T, 1.0e-2);
652  DERIV_TEST(_fp->e_from_p_T, p, T, 1.0e-2);
653  DERIV_TEST(_fp->h_from_p_T, p, T, 1.0e-2);
654  DERIV_TEST(_fp->s_from_p_T, p, T, 1.0e-2);
655 
656  // Region 4 (saturation curve)
657  T = 300.0;
658  const Real dT = 1.0e-4;
659 
660  Real dpSat_dT_fd = (_fp->vaporPressure(T + dT) - _fp->vaporPressure(T - dT)) / (2.0 * dT);
661  Real pSat = 0.0, dpSat_dT = 0.0;
662  _fp->vaporPressure(T, pSat, dpSat_dT);
663 
664  REL_TEST(dpSat_dT, dpSat_dT_fd, 1.0e-6);
665 
666  // Region 5
667  p = 30.0e6;
668  T = 1500.0;
669  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
670  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
671  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
672  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
673 
674  // Viscosity
675  Real rho = 998.0, drho_dp = 0.0, drho_dT = 0.0;
676  T = 298.15;
677  Real drho = 1.0e-4;
678 
679  Real dmu_drho_fd =
680  (_fp->mu_from_rho_T(rho + drho, T) - _fp->mu_from_rho_T(rho - drho, T)) / (2.0 * drho);
681  Real mu = 0.0, dmu_drho = 0.0, dmu_dT = 0.0;
682  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
683 
684  ABS_TEST(mu, _fp->mu_from_rho_T(rho, T), 1.0e-15);
685  REL_TEST(dmu_drho, dmu_drho_fd, 1.0e-6);
686 
687  // To properly test derivative wrt temperature, use p and T and calculate density,
688  // so that the change in density wrt temperature is included
689  p = 1.0e6;
690  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
691  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
692  Real dmu_dT_fd = (_fp->mu_from_rho_T(_fp->rho_from_p_T(p, T + dT), T + dT) -
693  _fp->mu_from_rho_T(_fp->rho_from_p_T(p, T - dT), T - dT)) /
694  (2.0 * dT);
695 
696  REL_TEST(dmu_dT, dmu_dT_fd, 1.0e-6);
697 
698  // Check derivative of viscosity wrt pressure
699  Real dp = 1.0e1;
700 
701  Real dmu_dp_fd = (_fp->mu_from_p_T(p + dp, T) - _fp->mu_from_p_T(p - dp, T)) / (2.0 * dp);
702  Real dmu_dp = 0.0;
703  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
704 
705  REL_TEST(dmu_dp, dmu_dp_fd, 1.0e-5);
706 
707  // Check derivatives of temperature calculated using pressure and enthalpy using AD
708  ADReal adp = 3.0e6;
709  Moose::derivInsert(adp.derivatives(), 0, 1.0);
710 
711  ADReal adh = 4.0e6;
712  Moose::derivInsert(adh.derivatives(), 1, 1.0);
713 
714  ADReal adT = _ad_fp->T_from_p_h(adp, adh);
715 
716  REL_TEST(adT.value(), 0.101077577e4, 1.0e-8);
717 
718  Real dT_dp_fd = (_fp->T_from_p_h(adp.value() + dp, adh.value()) -
719  _fp->T_from_p_h(adp.value() - dp, adh.value())) /
720  (2.0 * dp);
721 
722  REL_TEST(adT.derivatives()[0], dT_dp_fd, tol);
723 
724  const Real dh = 1.0;
725  Real dT_dh_fd = (_fp->T_from_p_h(adp.value(), adh.value() + dh) -
726  _fp->T_from_p_h(adp.value(), adh.value() - dh)) /
727  (2.0 * dh);
728 
729  REL_TEST(adT.derivatives()[1], dT_dh_fd, tol);
730 
731  // Check derivatives of (p, h) routines
732  p = 3.0e6;
733  T = 300.0;
734  Real h = _fp->h_from_p_T(p, T);
735  DERIV_TEST(_fp->s_from_h_p, h, p, tol);
736 }
const double T
const double tol
DualNumber< Real, DNDerivativeType, false > ADReal
const double rho
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real p
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N >> &derivs, libMesh::dof_id_type index, Real value)
const double mu

◆ TEST_F() [16/18]

TEST_F ( Water97FluidPropertiesTest  ,
combined   
)

Verify that the methods that return multiple properties in one call return identical values as the individual methods.

Definition at line 742 of file Water97FluidPropertiesTest.C.

743 {
744  const Real p = 1.0e6;
745  const Real T = 300.0;
746  const Real tol = REL_TOL_CONSISTENCY;
747 
748  // Single property methods
749  Real rho, drho_dp, drho_dT;
750  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
751  Real mu, dmu_dp, dmu_dT;
752  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
753  Real e, de_dp, de_dT;
754  _fp->e_from_p_T(p, T, e, de_dp, de_dT);
755 
756  // Combined property methods
757  Real rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT, e2, de2_dp, de2_dT;
758  _fp->rho_mu_from_p_T(p, T, rho2, mu2);
759 
760  ABS_TEST(rho, rho2, tol);
761  ABS_TEST(mu, mu2, tol);
762 
763  _fp->rho_mu_from_p_T(p, T, rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT);
764  ABS_TEST(rho, rho2, tol);
765  ABS_TEST(drho_dp, drho2_dp, tol);
766  ABS_TEST(drho_dT, drho2_dT, tol);
767  ABS_TEST(mu, mu2, tol);
768  ABS_TEST(dmu_dp, dmu2_dp, tol);
769  ABS_TEST(dmu_dT, dmu2_dT, tol);
770 
771  _fp->rho_e_from_p_T(p, T, rho2, drho2_dp, drho2_dT, e2, de2_dp, de2_dT);
772  ABS_TEST(rho, rho2, tol);
773  ABS_TEST(drho_dp, drho2_dp, tol);
774  ABS_TEST(drho_dT, drho2_dT, tol);
775  ABS_TEST(e, e2, tol);
776  ABS_TEST(de_dp, de2_dp, tol);
777  ABS_TEST(de_dT, de2_dT, tol);
778 }
const double T
const double tol
const double rho
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real p
const double mu

◆ TEST_F() [17/18]

TEST_F ( Water97FluidPropertiesTest  ,
henry   
)

Verify calculation of Henry's constant using data from Guidelines on the Henry's constant and vapour liquid distribution constant for gases in H20 and D20 at high temperatures, IAPWS (2004).

Definition at line 785 of file Water97FluidPropertiesTest.C.

786 {
787  const Real tol = REL_TOL_EXTERNAL_VALUE;
788 
789  // CO2 constants
790  const std::vector<Real> co2{-8.55445, 4.01195, 9.52345};
791  REL_TEST(_fp->henryConstant(300.0, co2), 173.63e6, tol);
792  REL_TEST(_fp->henryConstant(500.0, co2), 520.79e6, tol);
793 
794  // CH4 constants
795  const std::vector<Real> ch4{-10.44708, 4.66491, 12.1298};
796  REL_TEST(_fp->henryConstant(400.0, ch4), 6017.1e6, REL_TOL_EXTERNAL_VALUE);
797  REL_TEST(_fp->henryConstant(600.0, ch4), 801.8e6, REL_TOL_EXTERNAL_VALUE);
798 
799  // Test derivative of Henry's constant wrt temperature
800  const Real dT = 1.0e-4;
801  const Real dKh_dT_fd =
802  (_fp->henryConstant(500.0 + dT, co2) - _fp->henryConstant(500.0 - dT, co2)) / (2.0 * dT);
803 
804  Real Kh = 0.0, dKh_dT = 0.0;
805  _fp->henryConstant(500.0, co2, Kh, dKh_dT);
806  REL_TEST(Kh, _fp->henryConstant(500.0, co2), REL_TOL_CONSISTENCY);
807  REL_TEST(dKh_dT_fd, dKh_dT, REL_TOL_DERIVATIVE);
808 }
const double tol
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [18/18]

TEST_F ( Water97FluidPropertiesTest  ,
conservative   
)

Verify that calculations from conservative variables are accurate.

Definition at line 813 of file Water97FluidPropertiesTest.C.

814 {
815  auto run_tests = [this](const auto & example)
816  {
817  typedef typename std::decay<decltype(example)>::type TestType;
818  const TestType pressure = 1.01e5;
819  const TestType temperature = 298.15;
820 
821  const auto rho = _fp->rho_from_p_T(pressure, temperature);
822  const auto v = 1 / rho;
823  auto e = _fp->e_from_p_T(pressure, temperature);
824 
825  auto [p_test, T_test] = _fp->p_T_from_v_e(v, e);
826  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
827  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
828 
829  decltype(p_test) rho_test;
830  std::tie(rho_test, T_test) = _fp->rho_T_from_v_e(v, e);
831  REL_TEST(rho, rho_test, REL_TOL_CONSISTENCY);
832  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
833 
834  REL_TEST(_fp->k_from_p_T(pressure, temperature), _fp->k_from_v_e(v, e), REL_TOL_CONSISTENCY);
835  REL_TEST(_fp->e_from_p_rho(pressure, rho), e, REL_TOL_CONSISTENCY);
836 
837  constexpr Real perturbation_factor = 1 + 1e-8;
838  TestType de_dp, de_drho, de_dT;
839  _fp->e_from_p_rho(pressure, rho, e, de_dp, de_drho);
840  auto de_dp_diff =
841  (_fp->e_from_p_rho(perturbation_factor * pressure, rho) - e) / (1e-8 * pressure);
842  REL_TEST(de_dp, de_dp_diff, 1e-2);
843  auto de_drho_diff = (_fp->e_from_p_rho(pressure, perturbation_factor * rho) - e) / (1e-8 * rho);
844  REL_TEST(de_drho, de_drho_diff, 1e-2);
845 
846  _fp->e_from_p_T(pressure, temperature, e, de_dp, de_dT);
847  de_dp_diff =
848  (_fp->e_from_p_T(perturbation_factor * pressure, temperature) - e) / (1e-8 * pressure);
849  REL_TEST(de_dp, de_dp_diff, 1e-2);
850  auto de_dT_diff =
851  (_fp->e_from_p_T(pressure, perturbation_factor * temperature) - e) / (1e-8 * temperature);
852  REL_TEST(de_dT, de_dT_diff, 1e-2);
853 
854  auto h = _fp->h_from_p_T(pressure, temperature);
855  std::tie(p_test, T_test) = _fp->p_T_from_v_h(v, h);
856  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
857  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
858 
859  REL_TEST(_fp->e_from_v_h(v, h), e, REL_TOL_CONSISTENCY);
860  REL_TEST(_fp->T_from_v_e(v, e), temperature, REL_TOL_CONSISTENCY);
861  REL_TEST(_fp->c_from_v_e(v, e), _fp->c_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
862  REL_TEST(_fp->cp_from_v_e(v, e), _fp->cp_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
863  REL_TEST(_fp->cv_from_v_e(v, e), _fp->cv_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
864  REL_TEST(_fp->mu_from_v_e(v, e), _fp->mu_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
865  REL_TEST(_fp->k_from_v_e(v, e), _fp->k_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
866 
867  const Real p0 = MetaPhysicL::raw_value(pressure) * 1.01;
868  const Real T0 = MetaPhysicL::raw_value(temperature) * 1.01;
869 
870  auto s = _fp->s_from_p_T(pressure, temperature);
871  bool conversion_succeeded = false;
872  _fp->p_T_from_h_s(h, s, p0, T0, p_test, T_test, conversion_succeeded);
873  EXPECT_TRUE(conversion_succeeded);
874  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
875  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
876  };
877 
878  run_tests(Real{});
879  run_tests(ADReal{});
880 }
auto raw_value(const Eigen::Map< T > &in)
const double v
static const std::string temperature
Definition: NS.h:60
DualNumber< Real, DNDerivativeType, false > ADReal
const double rho
void run_tests()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string pressure
Definition: NS.h:57