https://mooseframework.inl.gov
Loading...
Searching...
No Matches
HydrogenFluidPropertiesTest.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12
16TEST_F(HydrogenFluidPropertiesTest, fluidName) { EXPECT_EQ(_fp->fluidName(), "hydrogen"); }
17
22{
23 ABS_TEST(_fp->molarMass(), 2.01588e-3, REL_TOL_SAVED_VALUE);
24}
25
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}
35
39TEST_F(HydrogenFluidPropertiesTest, triplePointProperties)
40{
41 ABS_TEST(_fp->triplePointPressure(), 7.7e3, REL_TOL_SAVED_VALUE);
42 ABS_TEST(_fp->triplePointTemperature(), 13.952, REL_TOL_SAVED_VALUE);
43}
44
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}
57
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}
72
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}
89
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}
109
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}
150
155TEST_F(HydrogenFluidPropertiesTest, derivativesNearCritical)
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}
172
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}
235
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
TEST_F(HydrogenFluidPropertiesTest, fluidName)
Test that the fluid name is correctly returned.