https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
HydrogenFluidPropertiesTest.C File Reference

Go to the source code of this file.

Functions

 TEST_F (HydrogenFluidPropertiesTest, fluidName)
 Test that the fluid name is correctly returned.
 
 TEST_F (HydrogenFluidPropertiesTest, molarMass)
 Test that the molar mass is correctly returned.
 
 TEST_F (HydrogenFluidPropertiesTest, criticalProperties)
 Test that the critical properties are correctly returned.
 
 TEST_F (HydrogenFluidPropertiesTest, triplePointProperties)
 Test that the triple point properties are correctly returned.
 
 TEST_F (HydrogenFluidPropertiesTest, vapor)
 Verify calculation of vapor pressure, vapor density and saturated liquid density.
 
 TEST_F (HydrogenFluidPropertiesTest, henry)
 Verify that the coefficients for Henry's constant are correct using Guidelines on the Henry's constant and vapour liquid distribution constant for gases in H20 and D20 at high temperatures, IAPWS (2004).
 
 TEST_F (HydrogenFluidPropertiesTest, thermalConductivity)
 Verify calculation of thermal conductivity using data from Assael, Assael, Huber, Perkins and Takata, Correlation of te thermal conductivity of normal and parahydrogen from the triple point to 1000 K and up to 100 Mpa, Journal of Physical and Chemical Reference Data, 40 (2011)
 
 TEST_F (HydrogenFluidPropertiesTest, viscosity)
 Verify calculation of viscosity using data from Muzny, Huber and Kazakov, Correlation for the viscosity of normal hydrogen obtained from symbolic regression, Journal of Chemical and Engineering Data, 58, 969-979 (2013)
 
 TEST_F (HydrogenFluidPropertiesTest, properties)
 Verify calculation of thermophysical properties of Hydrogen using reference data from NIST.
 
 TEST_F (HydrogenFluidPropertiesTest, derivativesNearCritical)
 Verify calculation of the derivatives of all properties by comparing with finite differences.
 
 TEST_F (HydrogenFluidPropertiesTest, derivatives)
 
 TEST_F (HydrogenFluidPropertiesTest, combined)
 Verify that the methods that return multiple properties in one call return identical values as the individual methods.
 

Function Documentation

◆ TEST_F() [1/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
combined   
)

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

Definition at line 240 of file HydrogenFluidPropertiesTest.C.

241{
242 const Real p = 1.0e6;
243 const Real T = 300.0;
244 const Real tol = REL_TOL_CONSISTENCY;
245
246 // Single property methods
247 Real rho, drho_dp, drho_dT;
248 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
249 Real mu, dmu_dp, dmu_dT;
250 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
251 Real e, de_dp, de_dT;
252 _fp->e_from_p_T(p, T, e, de_dp, de_dT);
253
254 // Combined property methods
255 Real rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT, e2, de2_dp, de2_dT;
256 _fp->rho_mu_from_p_T(p, T, rho2, mu2);
257
258 ABS_TEST(rho, rho2, tol);
259 ABS_TEST(mu, mu2, tol);
260
261 _fp->rho_mu_from_p_T(p, T, rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT);
262 ABS_TEST(rho, rho2, tol);
263 ABS_TEST(drho_dp, drho2_dp, tol);
264 ABS_TEST(drho_dT, drho2_dT, tol);
265 ABS_TEST(mu, mu2, tol);
266 ABS_TEST(dmu_dp, dmu2_dp, tol);
267 ABS_TEST(dmu_dT, dmu2_dT, tol);
268
269 _fp->rho_e_from_p_T(p, T, rho2, drho2_dp, drho2_dT, e2, de2_dp, de2_dT);
270 ABS_TEST(rho, rho2, tol);
271 ABS_TEST(drho_dp, drho2_dp, tol);
272 ABS_TEST(drho_dT, drho2_dT, tol);
273 ABS_TEST(e, e2, tol);
274 ABS_TEST(de_dp, de2_dp, tol);
275 ABS_TEST(de_dT, de2_dT, tol);
276}
const double tol
const double mu
const Real p
const double rho
const double T
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST_F() [2/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
criticalProperties   
)

Test that the critical properties are correctly returned.

Definition at line 29 of file HydrogenFluidPropertiesTest.C.

30{
31 ABS_TEST(_fp->criticalPressure(), 1.2964e6, REL_TOL_SAVED_VALUE);
32 ABS_TEST(_fp->criticalTemperature(), 33.145, REL_TOL_SAVED_VALUE);
33 ABS_TEST(_fp->criticalDensity(), 31.26226704, REL_TOL_SAVED_VALUE);
34}

◆ TEST_F() [3/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
derivatives   
)

Definition at line 173 of file HydrogenFluidPropertiesTest.C.

174{
175 const Real tol = REL_TOL_DERIVATIVE;
176
177 const Real p = 1.0e6;
178 Real T = 350.0;
179
180 DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
181 DERIV_TEST(_fp->mu_from_p_T, p, T, tol);
182 DERIV_TEST(_fp->e_from_p_T, p, T, tol);
183 DERIV_TEST(_fp->h_from_p_T, p, T, tol);
184 DERIV_TEST(_fp->s_from_p_T, p, T, tol);
185 DERIV_TEST(_fp->k_from_p_T, p, T, tol);
186
187 // Viscosity from density and temperature
188 T = 360.0;
189 const Real drho = 1.0e-4;
190 Real rho, drho_dp, drho_dT;
191 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
192
193 Real dmu_drho_fd =
194 (_fp->mu_from_rho_T(rho + drho, T) - _fp->mu_from_rho_T(rho - drho, T)) / (2.0 * drho);
195 Real mu = 0.0, dmu_drho = 0.0, dmu_dT = 0.0;
196 _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
197
198 ABS_TEST(mu, _fp->mu_from_rho_T(rho, T), REL_TOL_CONSISTENCY);
199 REL_TEST(dmu_drho, dmu_drho_fd, tol);
200
201 // To properly test derivative wrt temperature, use p and T and calculate density,
202 // so that the change in density wrt temperature is included
203 const Real dp = 1.0e1;
204 const Real dT = 1.0e-4;
205 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
206 _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
207
208 Real dmu_dT_fd = (_fp->mu_from_rho_T(_fp->rho_from_p_T(p, T + dT), T + dT) -
209 _fp->mu_from_rho_T(_fp->rho_from_p_T(p, T - dT), T - dT)) /
210 (2.0 * dT);
211
212 REL_TEST(dmu_dT, dmu_dT_fd, tol);
213
214 Real dmu_dp_fd = (_fp->mu_from_p_T(p + dp, T) - _fp->mu_from_p_T(p - dp, T)) / (2.0 * dp);
215 Real dmu_dp = 0.0;
216 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
217
218 ABS_TEST(mu, _fp->mu_from_p_T(p, T), REL_TOL_CONSISTENCY);
219 REL_TEST(dmu_dp, dmu_dp_fd, tol);
220
221 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
222 dmu_dT_fd = (_fp->mu_from_p_T(p, T + dT) - _fp->mu_from_p_T(p, T - dT)) / (2.0 * dT);
223
224 REL_TEST(dmu_dT, dmu_dT_fd, tol);
225
226 // The temperature derivative must be finite at the collision integral reducing
227 // temperature (30.41 K), where log(T*) = 0
228 const Real T_star = 30.41;
229 rho = 70.0;
230 _fp->mu_from_rho_T(rho, T_star, 0.0, mu, dmu_drho, dmu_dT);
231 dmu_dT_fd =
232 (_fp->mu_from_rho_T(rho, T_star + dT) - _fp->mu_from_rho_T(rho, T_star - dT)) / (2.0 * dT);
233 REL_TEST(dmu_dT, dmu_dT_fd, tol);
234}

◆ TEST_F() [4/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
derivativesNearCritical   
)

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

Definition at line 155 of file HydrogenFluidPropertiesTest.C.

156{
157 const Real tol = REL_TOL_DERIVATIVE;
158
159 // Slightly supercritical state (Tc = 33.145 K, pc = 1.2964 MPa)
160 const Real p = 1.4e6;
161 const Real T = 36.0;
162
163 DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
164 DERIV_TEST(_fp->e_from_p_T, p, T, tol);
165 DERIV_TEST(_fp->h_from_p_T, p, T, tol);
166
167 // The isobaric heat capacity is the temperature derivative of the enthalpy
168 Real h, dh_dp, dh_dT;
169 _fp->h_from_p_T(p, T, h, dh_dp, dh_dT);
170 REL_TEST(_fp->cp_from_p_T(p, T), dh_dT, REL_TOL_CONSISTENCY);
171}

◆ TEST_F() [5/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
fluidName   
)

Test that the fluid name is correctly returned.

Definition at line 16 of file HydrogenFluidPropertiesTest.C.

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

◆ TEST_F() [6/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
henry   
)

Verify that the coefficients for Henry's constant are correct using 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 63 of file HydrogenFluidPropertiesTest.C.

64{
65 const Real tol = REL_TOL_EXTERNAL_VALUE;
66 const std::vector<Real> hc = _fp->henryCoefficients();
67
68 REL_TEST(hc[0], -4.73284, tol);
69 REL_TEST(hc[1], 6.08954, tol);
70 REL_TEST(hc[2], 6.06066, tol);
71}

◆ TEST_F() [7/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
molarMass   
)

Test that the molar mass is correctly returned.

Definition at line 21 of file HydrogenFluidPropertiesTest.C.

22{
23 ABS_TEST(_fp->molarMass(), 2.01588e-3, REL_TOL_SAVED_VALUE);
24}

◆ TEST_F() [8/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
properties   
)

Verify calculation of thermophysical properties of Hydrogen using reference data from NIST.

Definition at line 114 of file HydrogenFluidPropertiesTest.C.

115{
116 // Pressure = 1 MPa, temperature = 280 K
117 Real p = 1.0e6;
118 Real T = 280.0;
119
120 const Real tol = REL_TOL_EXTERNAL_VALUE;
121
122 REL_TEST(_fp->rho_from_p_T(p, T), 0.86069, tol);
123 REL_TEST(_fp->h_from_p_T(p, T), 3676.1e3, tol);
124 REL_TEST(_fp->e_from_p_T(p, T), 2514.2e3, tol);
125 REL_TEST(_fp->s_from_p_T(p, T), 43.025e3, tol);
126 REL_TEST(_fp->cp_from_p_T(p, T), 14.26e3, tol);
127 REL_TEST(_fp->cv_from_p_T(p, T), 10.112e3, tol);
128 REL_TEST(_fp->c_from_p_T(p, T), 1283.9, tol);
129
130 // Pressure = 1 MPa, temperature = 500 K
131 T = 500.0;
132 REL_TEST(_fp->rho_from_p_T(p, T), 0.48302, tol);
133 REL_TEST(_fp->h_from_p_T(p, T), 6856.5e3, tol);
134 REL_TEST(_fp->e_from_p_T(p, T), 4786.2e3, tol);
135 REL_TEST(_fp->s_from_p_T(p, T), 51.401e3, tol);
136 REL_TEST(_fp->cp_from_p_T(p, T), 14.52e3, tol);
137 REL_TEST(_fp->cv_from_p_T(p, T), 10.392e3, tol);
138 REL_TEST(_fp->c_from_p_T(p, T), 1704.1, tol);
139
140 // Pressure = 10 MPa, temperature = 500 K
141 p = 10.0e6;
142 REL_TEST(_fp->rho_from_p_T(p, T), 4.6658, tol);
143 REL_TEST(_fp->h_from_p_T(p, T), 6923.4e3, tol);
144 REL_TEST(_fp->e_from_p_T(p, T), 4780.1e3, tol);
145 REL_TEST(_fp->s_from_p_T(p, T), 41.892e3, tol);
146 REL_TEST(_fp->cp_from_p_T(p, T), 14.584e3, tol);
147 REL_TEST(_fp->cv_from_p_T(p, T), 10.436e3, tol);
148 REL_TEST(_fp->c_from_p_T(p, T), 1764.3, tol);
149}

◆ TEST_F() [9/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
thermalConductivity   
)

Verify calculation of thermal conductivity using data from Assael, Assael, Huber, Perkins and Takata, Correlation of te thermal conductivity of normal and parahydrogen from the triple point to 1000 K and up to 100 Mpa, Journal of Physical and Chemical Reference Data, 40 (2011)

Definition at line 79 of file HydrogenFluidPropertiesTest.C.

80{
81 const Real tol = REL_TOL_EXTERNAL_VALUE;
82
83 REL_TEST(_fp->k_from_rho_T(0.80844, 298.15), 186.97e-3, tol);
84 REL_TEST(_fp->k_from_rho_T(30.0, 35.0), 71.854e-3, tol);
85 REL_TEST(_fp->k_from_rho_T(15.879, 400.0), 248.6e-3, tol);
86
87 REL_TEST(_fp->k_from_p_T(30.0e6, 400.0), 248.6e-3, tol);
88}

◆ TEST_F() [10/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
triplePointProperties   
)

Test that the triple point properties are correctly returned.

Definition at line 39 of file HydrogenFluidPropertiesTest.C.

40{
41 ABS_TEST(_fp->triplePointPressure(), 7.7e3, REL_TOL_SAVED_VALUE);
42 ABS_TEST(_fp->triplePointTemperature(), 13.952, REL_TOL_SAVED_VALUE);
43}

◆ TEST_F() [11/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
vapor   
)

Verify calculation of vapor pressure, vapor density and saturated liquid density.

Definition at line 49 of file HydrogenFluidPropertiesTest.C.

50{
51 const Real tol = REL_TOL_EXTERNAL_VALUE;
52
53 // Vapor pressure
54 REL_TEST(_fp->vaporPressure(14.0), 7.541e3, tol);
55 REL_TEST(_fp->vaporPressure(30.0), 0.80432e6, tol);
56}

◆ TEST_F() [12/12]

TEST_F ( HydrogenFluidPropertiesTest  ,
viscosity   
)

Verify calculation of viscosity using data from Muzny, Huber and Kazakov, Correlation for the viscosity of normal hydrogen obtained from symbolic regression, Journal of Chemical and Engineering Data, 58, 969-979 (2013)

Definition at line 96 of file HydrogenFluidPropertiesTest.C.

97{
98 const Real tol = 10.0 * REL_TOL_EXTERNAL_VALUE;
99
100 // The dilute-gas limit does not depend on the density correlation, so it can be
101 // compared at the standard tolerance
102 REL_TEST(_fp->mu_from_rho_T(0.0, 298.15), 8.8997e-6, REL_TOL_EXTERNAL_VALUE);
103 REL_TEST(_fp->mu_from_rho_T(0.68911, 350.0), 9.9645e-6, tol);
104 REL_TEST(_fp->mu_from_rho_T(6.5764, 350.0), 1.0147e-5, tol);
105
106 REL_TEST(_fp->mu_from_p_T(1.0e6, 350.0), 9.9645e-6, tol);
107 REL_TEST(_fp->mu_from_p_T(10.0e6, 350.0), 1.0147e-5, tol);
108}