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, 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/17]

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/17]

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/17]

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/17]

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/17]

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(30.0e6, 700), (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/17]

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 118 of file Water97FluidPropertiesTest.C.

119 {
120  REL_TEST(_fp->b23T(16.5291643e6), 623.15, 1.0e-8);
121  REL_TEST(_fp->b23p(623.15), 16.5291643e6, 1.0e-8);
122 }

◆ TEST_F() [7/17]

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 131 of file Water97FluidPropertiesTest.C.

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

◆ TEST_F() [8/17]

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 142 of file Water97FluidPropertiesTest.C.

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

◆ TEST_F() [9/17]

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 150 of file Water97FluidPropertiesTest.C.

151 {
152  REL_TEST(_fp->vaporPressure(300), 3.53658941e3, 1.0e-8);
153  REL_TEST(_fp->vaporPressure(500), 2.63889776e6, 1.0e-8);
154  REL_TEST(_fp->vaporPressure(600), 12.3443146e6, 1.0e-8);
155 }

◆ TEST_F() [10/17]

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 163 of file Water97FluidPropertiesTest.C.

164 {
165  REL_TEST(_fp->vaporTemperature(0.1e6), 372.755919, 1.0e-8);
166  REL_TEST(_fp->vaporTemperature(1.0e6), 453.035632, 1.0e-8);
167  REL_TEST(_fp->vaporTemperature(10.0e6), 584.149488, 1.0e-8);
168 }

◆ TEST_F() [11/17]

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 177 of file Water97FluidPropertiesTest.C.

178 {
179  EXPECT_EQ(_fp->subregion3(50.0e6, 630.0), (unsigned int)0);
180  EXPECT_EQ(_fp->subregion3(80.0e6, 670.0), (unsigned int)0);
181  EXPECT_EQ(_fp->subregion3(50.0e6, 710.0), (unsigned int)1);
182  EXPECT_EQ(_fp->subregion3(80.0e6, 750.0), (unsigned int)1);
183  EXPECT_EQ(_fp->subregion3(20.0e6, 630.0), (unsigned int)2);
184  EXPECT_EQ(_fp->subregion3(30.0e6, 650.0), (unsigned int)2);
185  EXPECT_EQ(_fp->subregion3(26.0e6, 656.0), (unsigned int)3);
186  EXPECT_EQ(_fp->subregion3(30.0e6, 670.0), (unsigned int)3);
187  EXPECT_EQ(_fp->subregion3(26.0e6, 661.0), (unsigned int)4);
188  EXPECT_EQ(_fp->subregion3(30.0e6, 675.0), (unsigned int)4);
189  EXPECT_EQ(_fp->subregion3(26.0e6, 671.0), (unsigned int)5);
190  EXPECT_EQ(_fp->subregion3(30.0e6, 690.0), (unsigned int)5);
191  EXPECT_EQ(_fp->subregion3(23.6e6, 649.0), (unsigned int)6);
192  EXPECT_EQ(_fp->subregion3(24.0e6, 650.0), (unsigned int)6);
193  EXPECT_EQ(_fp->subregion3(23.6e6, 652.0), (unsigned int)7);
194  EXPECT_EQ(_fp->subregion3(24.0e6, 654.0), (unsigned int)7);
195  EXPECT_EQ(_fp->subregion3(23.6e6, 653.0), (unsigned int)8);
196  EXPECT_EQ(_fp->subregion3(24.0e6, 655.0), (unsigned int)8);
197  EXPECT_EQ(_fp->subregion3(23.5e6, 655.0), (unsigned int)9);
198  EXPECT_EQ(_fp->subregion3(24.0e6, 660.0), (unsigned int)9);
199  EXPECT_EQ(_fp->subregion3(23.0e6, 660.0), (unsigned int)10);
200  EXPECT_EQ(_fp->subregion3(24.0e6, 670.0), (unsigned int)10);
201  EXPECT_EQ(_fp->subregion3(22.6e6, 646.0), (unsigned int)11);
202  EXPECT_EQ(_fp->subregion3(23.0e6, 646.0), (unsigned int)11);
203  EXPECT_EQ(_fp->subregion3(22.6e6, 648.6), (unsigned int)12);
204  EXPECT_EQ(_fp->subregion3(22.8e6, 649.3), (unsigned int)12);
205  EXPECT_EQ(_fp->subregion3(22.6e6, 649.0), (unsigned int)13);
206  EXPECT_EQ(_fp->subregion3(22.8e6, 649.7), (unsigned int)13);
207  EXPECT_EQ(_fp->subregion3(22.6e6, 649.1), (unsigned int)14);
208  EXPECT_EQ(_fp->subregion3(22.8e6, 649.9), (unsigned int)14);
209  EXPECT_EQ(_fp->subregion3(22.6e6, 649.4), (unsigned int)15);
210  EXPECT_EQ(_fp->subregion3(22.8e6, 650.2), (unsigned int)15);
211  EXPECT_EQ(_fp->subregion3(21.1e6, 640.0), (unsigned int)16);
212  EXPECT_EQ(_fp->subregion3(21.8e6, 643.0), (unsigned int)16);
213  EXPECT_EQ(_fp->subregion3(21.1e6, 644.0), (unsigned int)17);
214  EXPECT_EQ(_fp->subregion3(21.8e6, 648.0), (unsigned int)17);
215  EXPECT_EQ(_fp->subregion3(19.1e6, 635.0), (unsigned int)18);
216  EXPECT_EQ(_fp->subregion3(20.0e6, 638.0), (unsigned int)18);
217  EXPECT_EQ(_fp->subregion3(17.0e6, 626.0), (unsigned int)19);
218  EXPECT_EQ(_fp->subregion3(20.0e6, 640.0), (unsigned int)19);
219  EXPECT_EQ(_fp->subregion3(21.5e6, 644.6), (unsigned int)20);
220  EXPECT_EQ(_fp->subregion3(22.0e6, 646.1), (unsigned int)20);
221  EXPECT_EQ(_fp->subregion3(22.5e6, 648.6), (unsigned int)21);
222  EXPECT_EQ(_fp->subregion3(22.3e6, 647.9), (unsigned int)21);
223  EXPECT_EQ(_fp->subregion3(22.15e6, 647.5), (unsigned int)22);
224  EXPECT_EQ(_fp->subregion3(22.3e6, 648.1), (unsigned int)22);
225  EXPECT_EQ(_fp->subregion3(22.11e6, 648.0), (unsigned int)23);
226  EXPECT_EQ(_fp->subregion3(22.3e6, 649.0), (unsigned int)23);
227  EXPECT_EQ(_fp->subregion3(22.0e6, 646.84), (unsigned int)24);
228  EXPECT_EQ(_fp->subregion3(22.064e6, 647.05), (unsigned int)24);
229  EXPECT_EQ(_fp->subregion3(22.0e6, 646.89), (unsigned int)25);
230  EXPECT_EQ(_fp->subregion3(22.064e6, 647.15), (unsigned int)25);
231 }
void ErrorVector unsigned int

◆ TEST_F() [12/17]

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 240 of file Water97FluidPropertiesTest.C.

241 {
242  const Real tol = 1.0e-8;
243 
244  REL_TEST(_fp->densityRegion3(50.0e6, 630.0), 1.0 / 0.001470853100, tol);
245  REL_TEST(_fp->densityRegion3(80.0e6, 670.0), 1.0 / 0.001503831359, tol);
246  REL_TEST(_fp->densityRegion3(50.0e6, 710.0), 1.0 / 0.002204728587, tol);
247  REL_TEST(_fp->densityRegion3(80.0e6, 750.0), 1.0 / 0.001973692940, tol);
248  REL_TEST(_fp->densityRegion3(20.0e6, 630.0), 1.0 / 0.001761696406, tol);
249  REL_TEST(_fp->densityRegion3(30.0e6, 650.0), 1.0 / 0.001819560617, tol);
250  REL_TEST(_fp->densityRegion3(26.0e6, 656.0), 1.0 / 0.002245587720, tol);
251  REL_TEST(_fp->densityRegion3(30.0e6, 670.0), 1.0 / 0.002506897702, tol);
252  REL_TEST(_fp->densityRegion3(26.0e6, 661.0), 1.0 / 0.002970225962, tol);
253  REL_TEST(_fp->densityRegion3(30.0e6, 675.0), 1.0 / 0.003004627086, tol);
254  REL_TEST(_fp->densityRegion3(26.0e6, 671.0), 1.0 / 0.005019029401, tol);
255  REL_TEST(_fp->densityRegion3(30.0e6, 690.0), 1.0 / 0.004656470142, tol);
256  REL_TEST(_fp->densityRegion3(23.6e6, 649.0), 1.0 / 0.002163198378, tol);
257  REL_TEST(_fp->densityRegion3(24.0e6, 650.0), 1.0 / 0.002166044161, tol);
258  REL_TEST(_fp->densityRegion3(23.6e6, 652.0), 1.0 / 0.002651081407, tol);
259  REL_TEST(_fp->densityRegion3(24.0e6, 654.0), 1.0 / 0.002967802335, tol);
260  REL_TEST(_fp->densityRegion3(23.6e6, 653.0), 1.0 / 0.003273916816, tol);
261  REL_TEST(_fp->densityRegion3(24.0e6, 655.0), 1.0 / 0.003550329864, tol);
262  REL_TEST(_fp->densityRegion3(23.5e6, 655.0), 1.0 / 0.004545001142, tol);
263  REL_TEST(_fp->densityRegion3(24.0e6, 660.0), 1.0 / 0.005100267704, tol);
264  REL_TEST(_fp->densityRegion3(23.0e6, 660.0), 1.0 / 0.006109525997, tol);
265  REL_TEST(_fp->densityRegion3(24.0e6, 670.0), 1.0 / 0.006427325645, tol);
266  REL_TEST(_fp->densityRegion3(22.6e6, 646.0), 1.0 / 0.002117860851, tol);
267  REL_TEST(_fp->densityRegion3(23.0e6, 646.0), 1.0 / 0.002062374674, tol);
268  REL_TEST(_fp->densityRegion3(22.6e6, 648.6), 1.0 / 0.002533063780, tol);
269  REL_TEST(_fp->densityRegion3(22.8e6, 649.3), 1.0 / 0.002572971781, tol);
270  REL_TEST(_fp->densityRegion3(22.6e6, 649.0), 1.0 / 0.002923432711, tol);
271  REL_TEST(_fp->densityRegion3(22.8e6, 649.7), 1.0 / 0.002913311494, tol);
272  REL_TEST(_fp->densityRegion3(22.6e6, 649.1), 1.0 / 0.003131208996, tol);
273  REL_TEST(_fp->densityRegion3(22.8e6, 649.9), 1.0 / 0.003221160278, tol);
274  REL_TEST(_fp->densityRegion3(22.6e6, 649.4), 1.0 / 0.003715596186, tol);
275  REL_TEST(_fp->densityRegion3(22.8e6, 650.2), 1.0 / 0.003664754790, tol);
276  REL_TEST(_fp->densityRegion3(21.1e6, 640.0), 1.0 / 0.001970999272, tol);
277  REL_TEST(_fp->densityRegion3(21.8e6, 643.0), 1.0 / 0.002043919161, tol);
278  REL_TEST(_fp->densityRegion3(21.1e6, 644.0), 1.0 / 0.005251009921, tol);
279  REL_TEST(_fp->densityRegion3(21.8e6, 648.0), 1.0 / 0.005256844741, tol);
280  REL_TEST(_fp->densityRegion3(19.1e6, 635.0), 1.0 / 0.001932829079, tol);
281  REL_TEST(_fp->densityRegion3(20.0e6, 638.0), 1.0 / 0.001985387227, tol);
282  REL_TEST(_fp->densityRegion3(17.0e6, 626.0), 1.0 / 0.008483262001, tol);
283  REL_TEST(_fp->densityRegion3(20.0e6, 640.0), 1.0 / 0.006227528101, tol);
284  REL_TEST(_fp->densityRegion3(21.5e6, 644.6), 1.0 / 0.002268366647, tol);
285  REL_TEST(_fp->densityRegion3(22.0e6, 646.1), 1.0 / 0.002296350553, tol);
286  REL_TEST(_fp->densityRegion3(22.5e6, 648.6), 1.0 / 0.002832373260, tol);
287  REL_TEST(_fp->densityRegion3(22.3e6, 647.9), 1.0 / 0.002811424405, tol);
288  REL_TEST(_fp->densityRegion3(22.15e6, 647.5), 1.0 / 0.003694032281, tol);
289  REL_TEST(_fp->densityRegion3(22.3e6, 648.1), 1.0 / 0.003622226305, tol);
290  REL_TEST(_fp->densityRegion3(22.11e6, 648.0), 1.0 / 0.004528072649, tol);
291  REL_TEST(_fp->densityRegion3(22.3e6, 649.0), 1.0 / 0.004556905799, tol);
292  REL_TEST(_fp->densityRegion3(22.0e6, 646.84), 1.0 / 0.002698354719, tol);
293  REL_TEST(_fp->densityRegion3(22.064e6, 647.05), 1.0 / 0.002717655648, tol);
294  REL_TEST(_fp->densityRegion3(22.0e6, 646.89), 1.0 / 0.003798732962, tol);
295  REL_TEST(_fp->densityRegion3(22.064e6, 647.15), 1.0 / 0.003701940010, tol);
296 }
const double tol
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [13/17]

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 313 of file Water97FluidPropertiesTest.C.

314 {
315  Real p0, p1, p2, T0, T1, T2;
316 
317  const Real tol = 1.0e-8;
318  const Real tol2 = 1.0e-12;
319 
320  // Region 1 properties
321  p0 = 3.0e6;
322  p1 = 80.0e6;
323  p2 = 3.0e6;
324  T0 = 300.0;
325  T1 = 300.0;
326  T2 = 500.0;
327 
328  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 0.00100215168, tol);
329  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 0.000971180894, tol);
330  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.00120241800, tol);
331  REL_TEST(_fp->h_from_p_T(p0, T0), 115.331273e3, tol);
332  REL_TEST(_fp->h_from_p_T(p1, T1), 184.142828e3, tol);
333  REL_TEST(_fp->h_from_p_T(p2, T2), 975.542239e3, tol);
334  REL_TEST(_fp->e_from_p_T(p0, T0), 112.324818e3, tol);
335  REL_TEST(_fp->e_from_p_T(p1, T1), 106.448356e3, tol);
336  REL_TEST(_fp->e_from_p_T(p2, T2), 971.934985e3, tol);
337  REL_TEST(_fp->s_from_p_T(p0, T0), 0.392294792e3, tol);
338  REL_TEST(_fp->s_from_p_T(p1, T1), 0.368563852e3, tol);
339  REL_TEST(_fp->s_from_p_T(p2, T2), 2.58041912e3, tol);
340  REL_TEST(_fp->cp_from_p_T(p0, T0), 4.17301218e3, tol);
341  REL_TEST(_fp->cp_from_p_T(p1, T1), 4.01008987e3, tol);
342  REL_TEST(_fp->cp_from_p_T(p2, T2), 4.65580682e3, tol);
343  REL_TEST(_fp->c_from_p_T(p0, T0), 1507.73921, tol);
344  REL_TEST(_fp->c_from_p_T(p1, T1), 1634.69054, tol);
345  REL_TEST(_fp->c_from_p_T(p2, T2), 1240.71337, tol);
346 
347  // Lower tolerance for cv as it is compared with values from NIST
348  REL_TEST(_fp->cv_from_p_T(p0, T0), 4.1207e3, REL_TOL_EXTERNAL_VALUE);
349 
350  // (h,p) properties
351  Real h0, h1, h2;
352  h0 = _fp->h_from_p_T(p0, T0);
353  h1 = _fp->h_from_p_T(p1, T1);
354  h2 = _fp->h_from_p_T(p2, T2);
355  REL_TEST(_fp->s_from_h_p(h0, p0), 0.392294792e3, 1e-3);
356  REL_TEST(_fp->s_from_h_p(h1, p1), 0.368563852e3, 1e-3);
357  REL_TEST(_fp->s_from_h_p(h2, p2), 2.58041912e3, 1e-4);
358 
359  // Region 2 properties
360  p0 = 3.5e3;
361  p1 = 3.5e3;
362  p2 = 30.0e6;
363  T0 = 300.0;
364  T1 = 700.0;
365  T2 = 700.0;
366 
367  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 39.4913866, tol);
368  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 92.3015898, tol);
369  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.00542946619, tol);
370  REL_TEST(_fp->h_from_p_T(p0, T0), 2549.91145e3, tol);
371  REL_TEST(_fp->h_from_p_T(p1, T1), 3335.68375e3, tol);
372  REL_TEST(_fp->h_from_p_T(p2, T2), 2631.49474e3, tol);
373  REL_TEST(_fp->e_from_p_T(p0, T0), 2411.6916e3, tol);
374  REL_TEST(_fp->e_from_p_T(p1, T1), 3012.62819e3, tol);
375  REL_TEST(_fp->e_from_p_T(p2, T2), 2468.61076e3, tol);
376  REL_TEST(_fp->s_from_p_T(p0, T0), 8.52238967e3, tol);
377  REL_TEST(_fp->s_from_p_T(p1, T1), 10.1749996e3, tol);
378  REL_TEST(_fp->s_from_p_T(p2, T2), 5.17540298e3, tol);
379  REL_TEST(_fp->cp_from_p_T(p0, T0), 1.91300162e3, tol);
380  REL_TEST(_fp->cp_from_p_T(p1, T1), 2.08141274e3, tol);
381  REL_TEST(_fp->cp_from_p_T(p2, T2), 10.3505092e3, tol);
382  REL_TEST(_fp->c_from_p_T(p0, T0), 427.920172, tol);
383  REL_TEST(_fp->c_from_p_T(p1, T1), 644.289068, tol);
384  REL_TEST(_fp->c_from_p_T(p2, T2), 480.386523, tol);
385 
386  // Lower tolerance for cv as it is compared with values from NIST
387  REL_TEST(_fp->cv_from_p_T(p0, T0), 1.4415e3, REL_TOL_EXTERNAL_VALUE);
388 
389  // (h,p) properties
390  h0 = _fp->h_from_p_T(p0, T0);
391  h1 = _fp->h_from_p_T(p1, T1);
392  h2 = _fp->h_from_p_T(p2, T2);
393  REL_TEST(_fp->s_from_h_p(h0, p0), 8.52238967e3, 1e-5);
394  REL_TEST(_fp->s_from_h_p(h1, p1), 10.1749996e3, 1e-6);
395  REL_TEST(_fp->s_from_h_p(h2, p2), 5.17540298e3, 1e-4);
396 
397  // Region 3 properties
398  p0 = 25.5837018e6;
399  p1 = 22.2930643e6;
400  p2 = 78.3095639e6;
401  T0 = 650.0;
402  T1 = 650.0;
403  T2 = 750.0;
404 
405  // Note: lower tolerance in this region as density is calculated using backwards equation
406  REL_TEST(_fp->rho_from_p_T(p0, T0), 500.0, 1.0e-5);
407  REL_TEST(_fp->rho_from_p_T(p1, T1), 200.0, 1.0e-5);
408  REL_TEST(_fp->rho_from_p_T(p2, T2), 500.0, 1.0e-5);
409  REL_TEST(_fp->h_from_p_T(p0, T0), 1863.43019e3, 1.0e-5);
410  REL_TEST(_fp->h_from_p_T(p1, T1), 2375.12401e3, 1.0e-5);
411  REL_TEST(_fp->h_from_p_T(p2, T2), 2258.68845e3, 1.0e-5);
412  REL_TEST(_fp->e_from_p_T(p0, T0), 1812.26279e3, 1.0e-5);
413  REL_TEST(_fp->e_from_p_T(p1, T1), 2263.65868e3, 1.0e-5);
414  REL_TEST(_fp->e_from_p_T(p2, T2), 2102.06932e3, 1.0e-5);
415  REL_TEST(_fp->s_from_p_T(p0, T0), 4.05427273e3, 1.0e-5);
416  REL_TEST(_fp->s_from_p_T(p1, T1), 4.85438792e3, 1.0e-5);
417  REL_TEST(_fp->s_from_p_T(p2, T2), 4.46971906e3, 1.0e-5);
418  REL_TEST(_fp->cp_from_p_T(p0, T0), 13.8935717e3, 1.0e-4);
419  REL_TEST(_fp->cp_from_p_T(p1, T1), 44.6579342e3, 1.0e-5);
420  REL_TEST(_fp->cp_from_p_T(p2, T2), 6.34165359e3, 1.0e-5);
421  REL_TEST(_fp->c_from_p_T(p0, T0), 502.005554, 1.0e-5);
422  REL_TEST(_fp->c_from_p_T(p1, T1), 383.444594, 1.0e-5);
423  REL_TEST(_fp->c_from_p_T(p2, T2), 760.696041, 1.0e-5);
424 
425  // Lower tolerance for cv as it is compared with values from NIST
426  REL_TEST(_fp->cv_from_p_T(p0, T0), 3.1910e3, REL_TOL_EXTERNAL_VALUE);
427 
428  // (h,p) properties
429  h0 = _fp->h_from_p_T(p0, T0);
430  h1 = _fp->h_from_p_T(p1, T1);
431  h2 = _fp->h_from_p_T(p2, T2);
432  REL_TEST(_fp->s_from_h_p(h0, p0), 4.05427273e3, 1e-4);
433  REL_TEST(_fp->s_from_h_p(h1, p1), 4.85438792e3, 2e-4);
434  REL_TEST(_fp->s_from_h_p(h2, p2), 4.46971906e3, 2e-5);
435 
436  // Region 5 properties
437  p0 = 0.5e6;
438  p1 = 30.0e6;
439  p2 = 30.0e6;
440  T0 = 1500.0;
441  T1 = 1500.0;
442  T2 = 2000.0;
443 
444  REL_TEST(_fp->rho_from_p_T(p0, T0), 1.0 / 1.38455090, tol);
445  REL_TEST(_fp->rho_from_p_T(p1, T1), 1.0 / 0.0230761299, tol);
446  REL_TEST(_fp->rho_from_p_T(p2, T2), 1.0 / 0.0311385219, tol);
447  REL_TEST(_fp->h_from_p_T(p0, T0), 5219.76855e3, tol);
448  REL_TEST(_fp->h_from_p_T(p1, T1), 5167.23514e3, tol);
449  REL_TEST(_fp->h_from_p_T(p2, T2), 6571.22604e3, tol);
450  REL_TEST(_fp->e_from_p_T(p0, T0), 4527.4931e3, tol);
451  REL_TEST(_fp->e_from_p_T(p1, T1), 4474.95124e3, tol);
452  REL_TEST(_fp->e_from_p_T(p2, T2), 5637.07038e3, tol);
453  REL_TEST(_fp->s_from_p_T(p0, T0), 9.65408875e3, tol);
454  REL_TEST(_fp->s_from_p_T(p1, T1), 7.72970133e3, tol);
455  REL_TEST(_fp->s_from_p_T(p2, T2), 8.53640523e3, tol);
456  REL_TEST(_fp->cp_from_p_T(p0, T0), 2.61609445e3, tol);
457  REL_TEST(_fp->cp_from_p_T(p1, T1), 2.72724317e3, tol);
458  REL_TEST(_fp->cp_from_p_T(p2, T2), 2.88569882e3, tol);
459  REL_TEST(_fp->c_from_p_T(p0, T0), 917.06869, tol);
460  REL_TEST(_fp->c_from_p_T(p1, T1), 928.548002, tol);
461  REL_TEST(_fp->c_from_p_T(p2, T2), 1067.36948, tol);
462 
463  // Lower tolerance for cv as it is compared with values from NIST
464  REL_TEST(_fp->cv_from_p_T(p0, T0), 2.1534e3, REL_TOL_EXTERNAL_VALUE);
465 
466  // (h,p) properties
467  // T_from_p_h is not implemented in zone 5
468 
469  // Viscosity
470  ABS_TEST(_fp->mu_from_rho_T(998.0, 298.15), 889.735100e-6, tol2);
471  ABS_TEST(_fp->mu_from_rho_T(1200.0, 298.15), 1437.649467e-6, tol2);
472  ABS_TEST(_fp->mu_from_rho_T(1000.0, 373.15), 307.883622e-6, tol2);
473  ABS_TEST(_fp->mu_from_rho_T(1.0, 433.15), 14.538324e-6, tol2);
474  ABS_TEST(_fp->mu_from_rho_T(1000.0, 433.15), 217.685358e-6, tol2);
475  ABS_TEST(_fp->mu_from_rho_T(1.0, 873.15), 32.619287e-6, tol2);
476  ABS_TEST(_fp->mu_from_rho_T(100.0, 873.15), 35.802262e-6, tol2);
477  ABS_TEST(_fp->mu_from_rho_T(600.0, 873.15), 77.430195e-6, tol2);
478  ABS_TEST(_fp->mu_from_rho_T(1.0, 1173.15), 44.217245e-6, tol2);
479  ABS_TEST(_fp->mu_from_rho_T(100.0, 1173.15), 47.640433e-6, tol2);
480  ABS_TEST(_fp->mu_from_rho_T(400.0, 1173.15), 64.154608e-6, tol2);
481  REL_TEST(_fp->mu_from_p_T(1e6, 298.15), 889.898581797e-6, REL_TOL_EXTERNAL_VALUE);
482  REL_TEST(_fp->mu_from_p_T(2e6, 298.15), 889.763899645e-6, REL_TOL_EXTERNAL_VALUE);
483  REL_TEST(_fp->mu_from_p_T(1e6, 373.15), 281.825180491e-6, REL_TOL_EXTERNAL_VALUE);
484  REL_TEST(_fp->mu_from_p_T(2e6, 373.15), 282.09550632e-6, REL_TOL_EXTERNAL_VALUE);
485  REL_TEST(_fp->mu_from_p_T(1e6, 433.15), 170.526801634e-6, REL_TOL_EXTERNAL_VALUE);
486  REL_TEST(_fp->mu_from_p_T(2e6, 433.15), 170.780193827e-6, REL_TOL_EXTERNAL_VALUE);
487  REL_TEST(_fp->mu_from_p_T(1e6, 873.15), 3.2641885983e-5, REL_TOL_EXTERNAL_VALUE);
488  REL_TEST(_fp->mu_from_p_T(2e6, 873.15), 3.26820969808e-5, REL_TOL_EXTERNAL_VALUE);
489  REL_TEST(_fp->mu_from_p_T(1e6, 1173.15), 4.42374919686e-5, REL_TOL_EXTERNAL_VALUE);
490  REL_TEST(_fp->mu_from_p_T(2e6, 1173.15), 4.42823959629e-5, REL_TOL_EXTERNAL_VALUE);
491 
492  // Thermal conductivity
493  REL_TEST(_fp->k_from_p_T(1.0e6, 323.15), 0.641, 1.0e-4);
494  REL_TEST(_fp->k_from_p_T(20.0e6, 623.15), 0.4541, 1.0e-4);
495  REL_TEST(_fp->k_from_p_T(50.0e6, 773.15), 0.2055, 1.0e-4);
496 
497  ABS_TEST(_fp->k_from_p_T(1.0e6, 323.15), 0.640972, 5e-7);
498  ABS_TEST(_fp->k_from_p_T(20.0e6, 623.15), 0.454131, 7e-7);
499  ABS_TEST(_fp->k_from_p_T(50.0e6, 773.15), 0.205485, 5e-7);
500 
501  // Backwards equation T(p,h)
502  // Region 1
503  REL_TEST(_fp->T_from_p_h(3.0e6, 500.0e3), 0.391798509e3, tol);
504  REL_TEST(_fp->T_from_p_h(80.0e6, 500.0e3), 0.378108626e3, tol);
505  REL_TEST(_fp->T_from_p_h(80.0e6, 1500.0e3), 0.611041229e3, tol);
506  REL_TEST(_fp->T_from_p_h((ADReal)80.0e6, (ADReal)1500.0e3).value(), 0.611041229e3, tol);
507 
508  // Region 2 (subregion a)
509  REL_TEST(_fp->T_from_p_h(1.0e3, 3000.0e3), 0.534433241e3, tol);
510  REL_TEST(_fp->T_from_p_h(3.0e6, 3000.0e3), 0.575373370e3, tol);
511  REL_TEST(_fp->T_from_p_h(3.0e6, 4000.0e3), 0.101077577e4, tol);
512 
513  // Region 2 (subregion b)
514  REL_TEST(_fp->T_from_p_h(5.0e6, 3500.0e3), 0.801299102e3, tol);
515  REL_TEST(_fp->T_from_p_h(5.0e6, 4000.0e3), 0.101531583e4, tol);
516  REL_TEST(_fp->T_from_p_h(25.0e6, 3500.0e3), 0.875279054e3, tol);
517 
518  // Region 2 (subregion c)
519  REL_TEST(_fp->T_from_p_h(40.0e6, 2700.0e3), 0.743056411e3, tol);
520  REL_TEST(_fp->T_from_p_h(60.0e6, 2700.0e3), 0.791137067e3, tol);
521  REL_TEST(_fp->T_from_p_h(60.0e6, 3200.0e3), 0.882756860e3, tol);
522 
523  // Region 3 (subregion a)
524  REL_TEST(_fp->T_from_p_h(20.0e6, 1700.0e3), 0.6293083892e3, tol);
525  REL_TEST(_fp->T_from_p_h(50.0e6, 2000.0e3), 0.6905718338e3, tol);
526  REL_TEST(_fp->T_from_p_h(100.0e6, 2100.0e3), 0.7336163014e3, tol);
527 
528  // Region 3 (subregion b)
529  REL_TEST(_fp->T_from_p_h(20.0e6, 2500.0e3), 0.6418418053e3, tol);
530  REL_TEST(_fp->T_from_p_h(50.0e6, 2400.0e3), 0.7351848618e3, tol);
531  REL_TEST(_fp->T_from_p_h(100.0e6, 2700.0e3), 0.8420460876e3, tol);
532 }
const double tol
DualNumber< Real, DNDerivativeType, true > ADReal
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [14/17]

TEST_F ( Water97FluidPropertiesTest  ,
derivatives   
)

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

Definition at line 538 of file Water97FluidPropertiesTest.C.

539 {
540  const Real tol = REL_TOL_DERIVATIVE;
541 
542  // Region 1
543  Real p = 3.0e6;
544  Real T = 300.0;
545  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
546  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
547  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
548  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
549 
550  // Region 2
551  p = 3.5e3;
552  T = 300.0;
553  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
554  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
555  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
556  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
557 
558  // Region 3
559  p = 26.0e6;
560  T = 650.0;
561  DERIV_TEST(_fp->rho_from_p_T, p, T, 1.0e-2);
562  DERIV_TEST(_fp->e_from_p_T, p, T, 1.0e-2);
563  DERIV_TEST(_fp->h_from_p_T, p, T, 1.0e-2);
564  DERIV_TEST(_fp->s_from_p_T, p, T, 1.0e-2);
565 
566  // Region 4 (saturation curve)
567  T = 300.0;
568  const Real dT = 1.0e-4;
569 
570  Real dpSat_dT_fd = (_fp->vaporPressure(T + dT) - _fp->vaporPressure(T - dT)) / (2.0 * dT);
571  Real pSat = 0.0, dpSat_dT = 0.0;
572  _fp->vaporPressure(T, pSat, dpSat_dT);
573 
574  REL_TEST(dpSat_dT, dpSat_dT_fd, 1.0e-6);
575 
576  // Region 5
577  p = 30.0e6;
578  T = 1500.0;
579  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
580  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
581  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
582  DERIV_TEST(_fp->s_from_p_T, p, T, tol);
583 
584  // Viscosity
585  Real rho = 998.0, drho_dp = 0.0, drho_dT = 0.0;
586  T = 298.15;
587  Real drho = 1.0e-4;
588 
589  Real dmu_drho_fd =
590  (_fp->mu_from_rho_T(rho + drho, T) - _fp->mu_from_rho_T(rho - drho, T)) / (2.0 * drho);
591  Real mu = 0.0, dmu_drho = 0.0, dmu_dT = 0.0;
592  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
593 
594  ABS_TEST(mu, _fp->mu_from_rho_T(rho, T), 1.0e-15);
595  REL_TEST(dmu_drho, dmu_drho_fd, 1.0e-6);
596 
597  // To properly test derivative wrt temperature, use p and T and calculate density,
598  // so that the change in density wrt temperature is included
599  p = 1.0e6;
600  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
601  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
602  Real dmu_dT_fd = (_fp->mu_from_rho_T(_fp->rho_from_p_T(p, T + dT), T + dT) -
603  _fp->mu_from_rho_T(_fp->rho_from_p_T(p, T - dT), T - dT)) /
604  (2.0 * dT);
605 
606  REL_TEST(dmu_dT, dmu_dT_fd, 1.0e-6);
607 
608  // Check derivative of viscosity wrt pressure
609  Real dp = 1.0e1;
610 
611  Real dmu_dp_fd = (_fp->mu_from_p_T(p + dp, T) - _fp->mu_from_p_T(p - dp, T)) / (2.0 * dp);
612  Real dmu_dp = 0.0;
613  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
614 
615  REL_TEST(dmu_dp, dmu_dp_fd, 1.0e-5);
616 
617  // Check derivatives of temperature calculated using pressure and enthalpy using AD
618  ADReal adp = 3.0e6;
619  Moose::derivInsert(adp.derivatives(), 0, 1.0);
620 
621  ADReal adh = 4.0e6;
622  Moose::derivInsert(adh.derivatives(), 1, 1.0);
623 
624  ADReal adT = _ad_fp->T_from_p_h(adp, adh);
625 
626  REL_TEST(adT.value(), 0.101077577e4, 1.0e-8);
627 
628  Real dT_dp_fd = (_fp->T_from_p_h(adp.value() + dp, adh.value()) -
629  _fp->T_from_p_h(adp.value() - dp, adh.value())) /
630  (2.0 * dp);
631 
632  REL_TEST(adT.derivatives()[0], dT_dp_fd, tol);
633 
634  const Real dh = 1.0;
635  Real dT_dh_fd = (_fp->T_from_p_h(adp.value(), adh.value() + dh) -
636  _fp->T_from_p_h(adp.value(), adh.value() - dh)) /
637  (2.0 * dh);
638 
639  REL_TEST(adT.derivatives()[1], dT_dh_fd, tol);
640 
641  // Check derivatives of (p, h) routines
642  p = 3.0e6;
643  T = 300.0;
644  Real h = _fp->h_from_p_T(p, T);
645  DERIV_TEST(_fp->s_from_h_p, h, p, tol);
646 }
const double tol
DualNumber< Real, DNDerivativeType, true > ADReal
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N >> &derivs, libMesh::dof_id_type index, Real value)

◆ TEST_F() [15/17]

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 652 of file Water97FluidPropertiesTest.C.

653 {
654  const Real p = 1.0e6;
655  const Real T = 300.0;
656  const Real tol = REL_TOL_CONSISTENCY;
657 
658  // Single property methods
659  Real rho, drho_dp, drho_dT;
660  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
661  Real mu, dmu_dp, dmu_dT;
662  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
663  Real e, de_dp, de_dT;
664  _fp->e_from_p_T(p, T, e, de_dp, de_dT);
665 
666  // Combined property methods
667  Real rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT, e2, de2_dp, de2_dT;
668  _fp->rho_mu_from_p_T(p, T, rho2, mu2);
669 
670  ABS_TEST(rho, rho2, tol);
671  ABS_TEST(mu, mu2, tol);
672 
673  _fp->rho_mu_from_p_T(p, T, rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT);
674  ABS_TEST(rho, rho2, tol);
675  ABS_TEST(drho_dp, drho2_dp, tol);
676  ABS_TEST(drho_dT, drho2_dT, tol);
677  ABS_TEST(mu, mu2, tol);
678  ABS_TEST(dmu_dp, dmu2_dp, tol);
679  ABS_TEST(dmu_dT, dmu2_dT, tol);
680 
681  _fp->rho_e_from_p_T(p, T, rho2, drho2_dp, drho2_dT, e2, de2_dp, de2_dT);
682  ABS_TEST(rho, rho2, tol);
683  ABS_TEST(drho_dp, drho2_dp, tol);
684  ABS_TEST(drho_dT, drho2_dT, tol);
685  ABS_TEST(e, e2, tol);
686  ABS_TEST(de_dp, de2_dp, tol);
687  ABS_TEST(de_dT, de2_dT, tol);
688 }
const double tol
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [16/17]

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 695 of file Water97FluidPropertiesTest.C.

696 {
697  const Real tol = REL_TOL_EXTERNAL_VALUE;
698 
699  // CO2 constants
700  const std::vector<Real> co2{-8.55445, 4.01195, 9.52345};
701  REL_TEST(_fp->henryConstant(300.0, co2), 173.63e6, tol);
702  REL_TEST(_fp->henryConstant(500.0, co2), 520.79e6, tol);
703 
704  // CH4 constants
705  const std::vector<Real> ch4{-10.44708, 4.66491, 12.1298};
706  REL_TEST(_fp->henryConstant(400.0, ch4), 6017.1e6, REL_TOL_EXTERNAL_VALUE);
707  REL_TEST(_fp->henryConstant(600.0, ch4), 801.8e6, REL_TOL_EXTERNAL_VALUE);
708 
709  // Test derivative of Henry's constant wrt temperature
710  const Real dT = 1.0e-4;
711  const Real dKh_dT_fd =
712  (_fp->henryConstant(500.0 + dT, co2) - _fp->henryConstant(500.0 - dT, co2)) / (2.0 * dT);
713 
714  Real Kh = 0.0, dKh_dT = 0.0;
715  _fp->henryConstant(500.0, co2, Kh, dKh_dT);
716  REL_TEST(Kh, _fp->henryConstant(500.0, co2), REL_TOL_CONSISTENCY);
717  REL_TEST(dKh_dT_fd, dKh_dT, REL_TOL_DERIVATIVE);
718 }
const double tol
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [17/17]

TEST_F ( Water97FluidPropertiesTest  ,
conservative   
)

Verify that calculations from conservative variables are accurate.

Definition at line 723 of file Water97FluidPropertiesTest.C.

724 {
725  auto run_tests = [this](const auto & example)
726  {
727  typedef typename std::decay<decltype(example)>::type TestType;
728  const TestType pressure = 1.01e5;
729  const TestType temperature = 298.15;
730 
731  const auto rho = _fp->rho_from_p_T(pressure, temperature);
732  const auto v = 1 / rho;
733  auto e = _fp->e_from_p_T(pressure, temperature);
734 
735  auto [p_test, T_test] = _fp->p_T_from_v_e(v, e);
736  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
737  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
738 
739  decltype(p_test) rho_test;
740  std::tie(rho_test, T_test) = _fp->rho_T_from_v_e(v, e);
741  REL_TEST(rho, rho_test, REL_TOL_CONSISTENCY);
742  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
743 
744  REL_TEST(_fp->k_from_p_T(pressure, temperature), _fp->k_from_v_e(v, e), REL_TOL_CONSISTENCY);
745  REL_TEST(_fp->e_from_p_rho(pressure, rho), e, REL_TOL_CONSISTENCY);
746 
747  constexpr Real perturbation_factor = 1 + 1e-8;
748  TestType de_dp, de_drho, de_dT;
749  _fp->e_from_p_rho(pressure, rho, e, de_dp, de_drho);
750  auto de_dp_diff =
751  (_fp->e_from_p_rho(perturbation_factor * pressure, rho) - e) / (1e-8 * pressure);
752  REL_TEST(de_dp, de_dp_diff, 1e-2);
753  auto de_drho_diff = (_fp->e_from_p_rho(pressure, perturbation_factor * rho) - e) / (1e-8 * rho);
754  REL_TEST(de_drho, de_drho_diff, 1e-2);
755 
756  _fp->e_from_p_T(pressure, temperature, e, de_dp, de_dT);
757  de_dp_diff =
758  (_fp->e_from_p_T(perturbation_factor * pressure, temperature) - e) / (1e-8 * pressure);
759  REL_TEST(de_dp, de_dp_diff, 1e-2);
760  auto de_dT_diff =
761  (_fp->e_from_p_T(pressure, perturbation_factor * temperature) - e) / (1e-8 * temperature);
762  REL_TEST(de_dT, de_dT_diff, 1e-2);
763 
764  auto h = _fp->h_from_p_T(pressure, temperature);
765  std::tie(p_test, T_test) = _fp->p_T_from_v_h(v, h);
766  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
767  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
768 
769  REL_TEST(_fp->e_from_v_h(v, h), e, REL_TOL_CONSISTENCY);
770  REL_TEST(_fp->T_from_v_e(v, e), temperature, REL_TOL_CONSISTENCY);
771  REL_TEST(_fp->c_from_v_e(v, e), _fp->c_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
772  REL_TEST(_fp->cp_from_v_e(v, e), _fp->cp_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
773  REL_TEST(_fp->cv_from_v_e(v, e), _fp->cv_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
774  REL_TEST(_fp->mu_from_v_e(v, e), _fp->mu_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
775  REL_TEST(_fp->k_from_v_e(v, e), _fp->k_from_p_T(pressure, temperature), REL_TOL_CONSISTENCY);
776 
777  const Real p0 = MetaPhysicL::raw_value(pressure) * 1.01;
778  const Real T0 = MetaPhysicL::raw_value(temperature) * 1.01;
779 
780  auto s = _fp->s_from_p_T(pressure, temperature);
781  bool conversion_succeeded = false;
782  _fp->p_T_from_h_s(h, s, p0, T0, p_test, T_test, conversion_succeeded);
783  EXPECT_TRUE(conversion_succeeded);
784  REL_TEST(pressure, p_test, REL_TOL_CONSISTENCY);
785  REL_TEST(temperature, T_test, REL_TOL_CONSISTENCY);
786  };
787 
788  run_tests(Real{});
789  run_tests(ADReal{});
790 }
auto raw_value(const Eigen::Map< T > &in)
static const std::string temperature
Definition: NS.h:59
DualNumber< Real, DNDerivativeType, true > ADReal
void run_tests()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
static const std::string pressure
Definition: NS.h:56