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

Go to the source code of this file.

Functions

 TEST_F (CO2FluidPropertiesTest, fluidName)
 Test that the fluid name is correctly returned.
 
 TEST_F (CO2FluidPropertiesTest, molarMass)
 Test that the molar mass is correctly returned.
 
 TEST_F (CO2FluidPropertiesTest, criticalProperties)
 Test that the critical properties are correctly returned.
 
 TEST_F (CO2FluidPropertiesTest, triplePointProperties)
 Test that the triple point properties are correctly returned.
 
 TEST_F (CO2FluidPropertiesTest, melting)
 Verify calculation of melting pressure using experimental data from Michels et al, The melting line of carbon dioxide up to 2800 atmospheres, Physica 9 (1942).
 
 TEST_F (CO2FluidPropertiesTest, sublimation)
 Verify calculation of sublimation pressure using data from Bedford et al., Recommended values of temperature for a selected set of secondary reference points, Metrologia 20 (1984).
 
 TEST_F (CO2FluidPropertiesTest, vapor)
 Verify calculation of vapor pressure, vapor density and saturated liquid density using experimental data from Duschek et al., Measurement and correlation of the (pressure, density, temperature) relation of cabon dioxide II.
 
 TEST_F (CO2FluidPropertiesTest, partialDensity)
 Verify calculation of partial density at infinite dilution using data from Hnedkovsky et al., Volumes of aqueous solutions of CH4, CO2, H2S, and NH3 at temperatures from 298.15 K to 705 K and pressures to 35 MPa, J.
 
 TEST_F (CO2FluidPropertiesTest, 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 (CO2FluidPropertiesTest, thermalConductivity)
 Verify calculation of thermal conductivity using data from Scalabrin et al., A Reference Multiparameter Thermal Conductivity Equation for Carbon Dioxide with an Optimized Functional Form, J.
 
 TEST_F (CO2FluidPropertiesTest, viscosity)
 Verify calculation of viscosity using data from Fenghour et al., The viscosity of carbon dioxide, J.
 
 TEST_F (CO2FluidPropertiesTest, propertiesSW)
 Verify calculation of thermophysical properties of CO2 from the Span and Wagner EOS using verification data provided in A New Equation of State for Carbon Dioxide Covering the Fluid Region from the Triple-Point Temperature to 1100K at Pressures up to 800 MPa, J.
 
 TEST_F (CO2FluidPropertiesTest, derivativesNearCritical)
 Verify calculation of the derivatives of all properties by comparing with finite differences.
 
 TEST_F (CO2FluidPropertiesTest, derivatives)
 
 TEST_F (CO2FluidPropertiesTest, combined)
 Verify that the methods that return multiple properties in one call return identical values as the individual methods.
 

Function Documentation

◆ TEST_F() [1/15]

TEST_F ( CO2FluidPropertiesTest  ,
combined   
)

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

Definition at line 306 of file CO2FluidPropertiesTest.C.

307{
308 const Real p = 1.0e6;
309 const Real T = 300.0;
310 const Real tol = REL_TOL_CONSISTENCY;
311
312 // Single property methods
313 Real rho, drho_dp, drho_dT;
314 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
315 Real mu, dmu_dp, dmu_dT;
316 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
317 Real e, de_dp, de_dT;
318 _fp->e_from_p_T(p, T, e, de_dp, de_dT);
319
320 // Combined property methods
321 Real rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT, e2, de2_dp, de2_dT;
322 _fp->rho_mu_from_p_T(p, T, rho2, mu2);
323
324 ABS_TEST(rho, rho2, tol);
325 ABS_TEST(mu, mu2, tol);
326
327 _fp->rho_mu_from_p_T(p, T, rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT);
328 ABS_TEST(rho, rho2, tol);
329 ABS_TEST(drho_dp, drho2_dp, tol);
330 ABS_TEST(drho_dT, drho2_dT, tol);
331 ABS_TEST(mu, mu2, tol);
332 ABS_TEST(dmu_dp, dmu2_dp, tol);
333 ABS_TEST(dmu_dT, dmu2_dT, tol);
334
335 _fp->rho_e_from_p_T(p, T, rho2, drho2_dp, drho2_dT, e2, de2_dp, de2_dT);
336 ABS_TEST(rho, rho2, tol);
337 ABS_TEST(drho_dp, drho2_dp, tol);
338 ABS_TEST(drho_dT, drho2_dT, tol);
339 ABS_TEST(e, e2, tol);
340 ABS_TEST(de_dp, de2_dp, tol);
341 ABS_TEST(de_dT, de2_dT, tol);
342}
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/15]

TEST_F ( CO2FluidPropertiesTest  ,
criticalProperties   
)

Test that the critical properties are correctly returned.

Definition at line 29 of file CO2FluidPropertiesTest.C.

30{
31 ABS_TEST(_fp->criticalPressure(), 7.3773e6, REL_TOL_SAVED_VALUE);
32 ABS_TEST(_fp->criticalTemperature(), 304.1282, REL_TOL_SAVED_VALUE);
33 ABS_TEST(_fp->criticalDensity(), 467.6, REL_TOL_SAVED_VALUE);
34}

◆ TEST_F() [3/15]

TEST_F ( CO2FluidPropertiesTest  ,
derivatives   
)

Definition at line 248 of file CO2FluidPropertiesTest.C.

249{
250 const Real tol = REL_TOL_DERIVATIVE;
251
252 const Real p = 1.0e6;
253 Real T = 350.0;
254
255 DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
256 DERIV_TEST(_fp->mu_from_p_T, p, T, tol);
257 DERIV_TEST(_fp->e_from_p_T, p, T, tol);
258 DERIV_TEST(_fp->h_from_p_T, p, T, tol);
259 DERIV_TEST(_fp->s_from_p_T, p, T, tol);
260 DERIV_TEST(_fp->k_from_p_T, p, T, tol);
261
262 // Viscosity from density and temperature
263 T = 360.0;
264 const Real drho = 1.0e-4;
265 Real rho, drho_dp, drho_dT;
266 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
267
268 Real dmu_drho_fd =
269 (_fp->mu_from_rho_T(rho + drho, T) - _fp->mu_from_rho_T(rho - drho, T)) / (2.0 * drho);
270 Real mu = 0.0, dmu_drho = 0.0, dmu_dT = 0.0;
271 _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
272
273 ABS_TEST(mu, _fp->mu_from_rho_T(rho, T), REL_TOL_CONSISTENCY);
274 REL_TEST(dmu_drho, dmu_drho_fd, tol);
275
276 // To properly test derivative wrt temperature, use p and T and calculate density,
277 // so that the change in density wrt temperature is included
278 const Real dp = 1.0e1;
279 const Real dT = 1.0e-4;
280 _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
281 _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
282
283 Real dmu_dT_fd = (_fp->mu_from_rho_T(_fp->rho_from_p_T(p, T + dT), T + dT) -
284 _fp->mu_from_rho_T(_fp->rho_from_p_T(p, T - dT), T - dT)) /
285 (2.0 * dT);
286
287 REL_TEST(dmu_dT, dmu_dT_fd, tol);
288
289 Real dmu_dp_fd = (_fp->mu_from_p_T(p + dp, T) - _fp->mu_from_p_T(p - dp, T)) / (2.0 * dp);
290 Real dmu_dp = 0.0;
291 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
292
293 ABS_TEST(mu, _fp->mu_from_p_T(p, T), REL_TOL_CONSISTENCY);
294 REL_TEST(dmu_dp, dmu_dp_fd, tol);
295
296 _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
297 dmu_dT_fd = (_fp->mu_from_p_T(p, T + dT) - _fp->mu_from_p_T(p, T - dT)) / (2.0 * dT);
298
299 REL_TEST(dmu_dT, dmu_dT_fd, tol);
300}

◆ TEST_F() [4/15]

TEST_F ( CO2FluidPropertiesTest  ,
derivativesNearCritical   
)

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

Definition at line 226 of file CO2FluidPropertiesTest.C.

227{
228 const Real tol = REL_TOL_DERIVATIVE;
229
230 // Slightly supercritical state (Tc = 304.1282 K, pc = 7.3773 MPa), where the nonanalytic
231 // terms of the residual Helmholtz free energy contribute significantly
232 const Real p = 7.5e6;
233 const Real T = 305.0;
234
235 // Properties vary steeply this close to the critical point, so the default relative
236 // perturbation of 1e-6 leaves a finite-difference truncation error just above the
237 // tolerance; 1e-7 brings it well below while staying above round-off
238 DERIV_TEST_CUSTOM_PERTURBATION(_fp->rho_from_p_T, p, T, tol, 1e-7);
239 DERIV_TEST_CUSTOM_PERTURBATION(_fp->e_from_p_T, p, T, tol, 1e-7);
240 DERIV_TEST_CUSTOM_PERTURBATION(_fp->h_from_p_T, p, T, tol, 1e-7);
241
242 // The isobaric heat capacity is the temperature derivative of the enthalpy
243 Real h, dh_dp, dh_dT;
244 _fp->h_from_p_T(p, T, h, dh_dp, dh_dT);
245 REL_TEST(_fp->cp_from_p_T(p, T), dh_dT, REL_TOL_CONSISTENCY);
246}

◆ TEST_F() [5/15]

TEST_F ( CO2FluidPropertiesTest  ,
fluidName   
)

Test that the fluid name is correctly returned.

Definition at line 16 of file CO2FluidPropertiesTest.C.

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

◆ TEST_F() [6/15]

TEST_F ( CO2FluidPropertiesTest  ,
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 124 of file CO2FluidPropertiesTest.C.

125{
126 const Real tol = REL_TOL_EXTERNAL_VALUE;
127 const std::vector<Real> hc = _fp->henryCoefficients();
128
129 REL_TEST(hc[0], -8.55445, tol);
130 REL_TEST(hc[1], 4.01195, tol);
131 REL_TEST(hc[2], 9.52345, tol);
132}

◆ TEST_F() [7/15]

TEST_F ( CO2FluidPropertiesTest  ,
melting   
)

Verify calculation of melting pressure using experimental data from Michels et al, The melting line of carbon dioxide up to 2800 atmospheres, Physica 9 (1942).

Note that results in this reference are given in atm, but have been converted to MPa here. As we are comparing with experimental data, calculated values within 1% are considered satisfactory.

Definition at line 54 of file CO2FluidPropertiesTest.C.

55{
56 const Real tol = 10.0 * REL_TOL_EXTERNAL_VALUE;
57
58 REL_TEST(_fp->meltingPressure(217.03), 2.57e6, tol);
59 REL_TEST(_fp->meltingPressure(235.29), 95.86e6, tol);
60 REL_TEST(_fp->meltingPressure(266.04), 286.77e6, tol);
61}

◆ TEST_F() [8/15]

TEST_F ( CO2FluidPropertiesTest  ,
molarMass   
)

Test that the molar mass is correctly returned.

Definition at line 21 of file CO2FluidPropertiesTest.C.

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

◆ TEST_F() [9/15]

TEST_F ( CO2FluidPropertiesTest  ,
partialDensity   
)

Verify calculation of partial density at infinite dilution using data from Hnedkovsky et al., Volumes of aqueous solutions of CH4, CO2, H2S, and NH3 at temperatures from 298.15 K to 705 K and pressures to 35 MPa, J.

Chem. Thermo. 28, 1996. As we are comparing with experimental data, calculated values within 5% are considered satisfactory.

Definition at line 110 of file CO2FluidPropertiesTest.C.

111{
112 const Real tol = 50.0 * REL_TOL_EXTERNAL_VALUE;
113
114 REL_TEST(_fp->partialDensity(373.15), 1182.8, tol);
115 REL_TEST(_fp->partialDensity(473.35), 880.0, tol);
116 REL_TEST(_fp->partialDensity(573.15), 593.8, tol);
117}

◆ TEST_F() [10/15]

TEST_F ( CO2FluidPropertiesTest  ,
propertiesSW   
)

Verify calculation of thermophysical properties of CO2 from the Span and Wagner EOS using verification data provided in A New Equation of State for Carbon Dioxide Covering the Fluid Region from the Triple-Point Temperature to 1100K at Pressures up to 800 MPa, J.

Phys. Chem. Ref. Data, 25 (1996)

Definition at line 178 of file CO2FluidPropertiesTest.C.

179{
180 // Pressure = 1 MPa, temperature = 280 K
181 Real p = 1.0e6;
182 Real T = 280.0;
183
184 const Real tol = REL_TOL_EXTERNAL_VALUE;
185
186 REL_TEST(_fp->rho_from_p_T(p, T), 20.199, tol);
187 REL_TEST(_fp->h_from_p_T(p, T), -26.385e3, tol);
188 REL_TEST(_fp->e_from_p_T(p, T), -75.892e3, tol);
189 REL_TEST(_fp->s_from_p_T(p, T), -0.51326e3, tol);
190 REL_TEST(_fp->cp_from_p_T(p, T), 0.92518e3, tol);
191 REL_TEST(_fp->cv_from_p_T(p, T), 0.67092e3, tol);
192 REL_TEST(_fp->c_from_p_T(p, T), 252.33, tol);
193
194 // Pressure = 1 MPa, temperature = 500 K
195 T = 500.0;
196 REL_TEST(_fp->rho_from_p_T(p, T), 10.664, tol);
197 REL_TEST(_fp->h_from_p_T(p, T), 185.60e3, tol);
198 REL_TEST(_fp->e_from_p_T(p, T), 91.829e3, tol);
199 REL_TEST(_fp->s_from_p_T(p, T), 0.04225e3, tol);
200 REL_TEST(_fp->cp_from_p_T(p, T), 1.0273e3, tol);
201 REL_TEST(_fp->cv_from_p_T(p, T), 0.82823e3, tol);
202 REL_TEST(_fp->c_from_p_T(p, T), 339.81, tol);
203
204 // Pressure = 10 MPa, temperature = 500 K
205 p = 10.0e6;
206 REL_TEST(_fp->rho_from_p_T(p, T), 113.07, tol);
207 REL_TEST(_fp->h_from_p_T(p, T), 157.01e3, tol);
208 REL_TEST(_fp->e_from_p_T(p, T), 68.569e3, tol);
209 REL_TEST(_fp->s_from_p_T(p, T), -0.4383e3, tol);
210 REL_TEST(_fp->cp_from_p_T(p, T), 1.1624e3, tol);
211 REL_TEST(_fp->cv_from_p_T(p, T), 0.85516e3, tol);
212 REL_TEST(_fp->c_from_p_T(p, T), 337.45, tol);
213
214 // Verify properties from p, h
215 {
216 Real h1 = _fp->h_from_p_T(p, T);
217 Real T1 = _fp->T_from_p_h(p, h1);
218 REL_TEST(T1, T, REL_TOL_CONSISTENCY);
219 }
220}

◆ TEST_F() [11/15]

TEST_F ( CO2FluidPropertiesTest  ,
sublimation   
)

Verify calculation of sublimation pressure using data from Bedford et al., Recommended values of temperature for a selected set of secondary reference points, Metrologia 20 (1984).

Definition at line 68 of file CO2FluidPropertiesTest.C.

69{
70 REL_TEST(_fp->sublimationPressure(194.6857), 0.101325e6, REL_TOL_EXTERNAL_VALUE);
71}

◆ TEST_F() [12/15]

TEST_F ( CO2FluidPropertiesTest  ,
thermalConductivity   
)

Verify calculation of thermal conductivity using data from Scalabrin et al., A Reference Multiparameter Thermal Conductivity Equation for Carbon Dioxide with an Optimized Functional Form, J.

Phys. Chem. Ref. Data 35 (2006)

Definition at line 140 of file CO2FluidPropertiesTest.C.

141{
142 const Real tol = REL_TOL_EXTERNAL_VALUE;
143
144 REL_TEST(_fp->k_from_rho_T(23.435, 250.0), 13.45e-3, tol);
145 REL_TEST(_fp->k_from_rho_T(18.579, 300.0), 17.248e-3, tol);
146 REL_TEST(_fp->k_from_rho_T(11.899, 450.0), 29.377e-3, tol);
147
148 REL_TEST(_fp->k_from_p_T(1.0e6, 250.0), 1.34504e-2, tol);
149 REL_TEST(_fp->k_from_p_T(1.0e6, 300.0), 1.72483e-2, tol);
150 REL_TEST(_fp->k_from_p_T(1.0e6, 450.0), 2.93767e-2, tol);
151}

◆ TEST_F() [13/15]

TEST_F ( CO2FluidPropertiesTest  ,
triplePointProperties   
)

Test that the triple point properties are correctly returned.

Definition at line 39 of file CO2FluidPropertiesTest.C.

40{
41 ABS_TEST(_fp->triplePointPressure(), 0.51795e6, REL_TOL_SAVED_VALUE);
42 ABS_TEST(_fp->triplePointTemperature(), 216.592, REL_TOL_SAVED_VALUE);
43}

◆ TEST_F() [14/15]

TEST_F ( CO2FluidPropertiesTest  ,
vapor   
)

Verify calculation of vapor pressure, vapor density and saturated liquid density using experimental data from Duschek et al., Measurement and correlation of the (pressure, density, temperature) relation of cabon dioxide II.

Saturated-liquid and saturated-vapor densities and the vapor pressure along the entire coexstance curve, J. Chem. Thermo. 22 (1990). As we are comparing with experimental data, calculated values within 1% are considered satisfactory.

Definition at line 82 of file CO2FluidPropertiesTest.C.

83{
84 const Real tol = 10.0 * REL_TOL_EXTERNAL_VALUE;
85
86 // Vapor pressure
87 REL_TEST(_fp->vaporPressure(217.0), 0.52747e6, tol);
88 REL_TEST(_fp->vaporPressure(245.0), 1.51887e6, tol);
89 REL_TEST(_fp->vaporPressure(303.8), 7.32029e6, tol);
90
91 // Saturated vapor density
92 REL_TEST(_fp->saturatedVaporDensity(217.0), 14.0017, tol);
93 REL_TEST(_fp->saturatedVaporDensity(245.0), 39.5048, tol);
94 REL_TEST(_fp->saturatedVaporDensity(303.8), 382.30, tol);
95
96 // Saturated liquid density
97 REL_TEST(_fp->saturatedLiquidDensity(217.0), 1177.03, tol);
98 REL_TEST(_fp->saturatedLiquidDensity(245.0), 1067.89, tol);
99 REL_TEST(_fp->saturatedLiquidDensity(303.8), 554.14, tol);
100}

◆ TEST_F() [15/15]

TEST_F ( CO2FluidPropertiesTest  ,
viscosity   
)

Verify calculation of viscosity using data from Fenghour et al., The viscosity of carbon dioxide, J.

Phys. Chem. Ref. Data, 27, 31-44 (1998)

Definition at line 158 of file CO2FluidPropertiesTest.C.

159{
160 const Real tol = REL_TOL_EXTERNAL_VALUE;
161
162 REL_TEST(_fp->mu_from_rho_T(20.199, 280.0), 14.15e-6, tol);
163 REL_TEST(_fp->mu_from_rho_T(15.105, 360.0), 17.94e-6, tol);
164 REL_TEST(_fp->mu_from_rho_T(10.664, 500.0), 24.06e-6, tol);
165
166 REL_TEST(_fp->mu_from_p_T(1.0e6, 280.0), 1.41505e-05, tol);
167 REL_TEST(_fp->mu_from_p_T(1.0e6, 360.0), 1.79395e-05, tol);
168 REL_TEST(_fp->mu_from_p_T(1.0e6, 500.0), 2.40643e-05, tol);
169}