https://mooseframework.inl.gov
NitrogenFluidPropertiesTest.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 
16 TEST_F(NitrogenFluidPropertiesTest, fluidName) { EXPECT_EQ(_fp->fluidName(), "nitrogen"); }
17 
22 {
23  ABS_TEST(_fp->molarMass(), 28.01348e-3, REL_TOL_SAVED_VALUE);
24 }
25 
29 TEST_F(NitrogenFluidPropertiesTest, criticalProperties)
30 {
31  ABS_TEST(_fp->criticalPressure(), 3.3958e6, REL_TOL_SAVED_VALUE);
32  ABS_TEST(_fp->criticalTemperature(), 126.192, REL_TOL_SAVED_VALUE);
33  ABS_TEST(_fp->criticalDensity(), 313.3, REL_TOL_SAVED_VALUE);
34 }
35 
39 TEST_F(NitrogenFluidPropertiesTest, triplePointProperties)
40 {
41  ABS_TEST(_fp->triplePointPressure(), 12.523e3, REL_TOL_SAVED_VALUE);
42  ABS_TEST(_fp->triplePointTemperature(), 63.151, REL_TOL_SAVED_VALUE);
43 }
44 
50 {
51  const Real tol = REL_TOL_EXTERNAL_VALUE;
52 
53  // Vapor pressure
54  REL_TEST(_fp->vaporPressure(80.0), 0.13687e6, tol);
55  REL_TEST(_fp->vaporPressure(100.0), 0.77827e6, tol);
56  REL_TEST(_fp->vaporPressure(120.0), 2.51058e6, tol);
57  //
58  // Saturated vapor density
59  REL_TEST(_fp->saturatedVaporDensity(80.0), 0.21737 * 1000.0 * _fp->molarMass(), tol);
60  REL_TEST(_fp->saturatedVaporDensity(100.0), 1.1409 * 1000.0 * _fp->molarMass(), tol);
61  REL_TEST(_fp->saturatedVaporDensity(120.0), 4.4653 * 1000.0 * _fp->molarMass(), tol);
62 
63  // Saturated liquid density
64  REL_TEST(_fp->saturatedLiquidDensity(80.0), 28.341 * 1000.0 * _fp->molarMass(), tol);
65  REL_TEST(_fp->saturatedLiquidDensity(100.0), 24.608 * 1000.0 * _fp->molarMass(), tol);
66  REL_TEST(_fp->saturatedLiquidDensity(120.0), 18.682 * 1000.0 * _fp->molarMass(), tol);
67 }
68 
75 {
76  const Real tol = REL_TOL_EXTERNAL_VALUE;
77  const std::vector<Real> hc = _fp->henryCoefficients();
78 
79  REL_TEST(hc[0], -9.67578, tol);
80  REL_TEST(hc[1], 4.72162, tol);
81  REL_TEST(hc[2], 11.70585, tol);
82 }
83 
89 TEST_F(NitrogenFluidPropertiesTest, thermalConductivity)
90 {
91  const Real tol = REL_TOL_EXTERNAL_VALUE;
92 
93  REL_TEST(_fp->k_from_rho_T(0.0, 300.0), 25.9361e-3, tol);
94  REL_TEST(_fp->k_from_rho_T(5.0 * 1000.0 * _fp->molarMass(), 300.0), 32.7694e-3, tol);
95 
96  const Real p = _fp->p_from_rho_T(5.0 * 1000.0 * _fp->molarMass(), 300.0);
97  REL_TEST(_fp->k_from_p_T(p, 300.0), 32.7694e-3, tol);
98 }
99 
106 {
107  const Real tol = REL_TOL_EXTERNAL_VALUE;
108 
109  REL_TEST(_fp->mu_from_rho_T(0.0, 100.0), 6.90349e-6, tol);
110  REL_TEST(_fp->mu_from_rho_T(25.0 * 1000.0 * _fp->molarMass(), 100.0), 79.7418e-6, tol);
111  REL_TEST(_fp->mu_from_rho_T(10.0 * 1000.0 * _fp->molarMass(), 200.0), 21.081e-6, tol);
112 
113  const Real p = _fp->p_from_rho_T(5.0 * 1000.0 * _fp->molarMass(), 300.0);
114  REL_TEST(_fp->mu_from_p_T(p, 300.0), 20.7430e-6, tol);
115 }
116 
125 {
126  // Pressure = 1 MPa, temperature = 280 K
127  Real p = 1.0e6;
128  Real T = 280.0;
129 
130  const Real tol = REL_TOL_EXTERNAL_VALUE;
131 
132  REL_TEST(_fp->rho_from_p_T(p, T), 0.43104 * 1000.0 * _fp->molarMass(), tol);
133  REL_TEST(_fp->h_from_p_T(p, T), 8070.2 / _fp->molarMass(), tol);
134  REL_TEST(_fp->e_from_p_T(p, T), 5750.3 / _fp->molarMass(), tol);
135  REL_TEST(_fp->s_from_p_T(p, T), 170.41 / _fp->molarMass(), tol);
136  REL_TEST(_fp->cp_from_p_T(p, T), 29.66 / _fp->molarMass(), tol);
137  REL_TEST(_fp->cv_from_p_T(p, T), 20.89 / _fp->molarMass(), tol);
138  REL_TEST(_fp->c_from_p_T(p, T), 342.4, tol);
139 
140  // Pressure = 1 MPa, temperature = 500 K
141  T = 500.0;
142  REL_TEST(_fp->rho_from_p_T(p, T), 0.23958 * 1000.0 * _fp->molarMass(), tol);
143  REL_TEST(_fp->e_from_p_T(p, T), 10395.0 / _fp->molarMass(), tol);
144  REL_TEST(_fp->h_from_p_T(p, T), 14569.0 / _fp->molarMass(), tol);
145  REL_TEST(_fp->s_from_p_T(p, T), 187.54 / _fp->molarMass(), tol);
146  REL_TEST(_fp->cp_from_p_T(p, T), 29.72 / _fp->molarMass(), tol);
147  REL_TEST(_fp->cv_from_p_T(p, T), 21.29 / _fp->molarMass(), tol);
148  REL_TEST(_fp->c_from_p_T(p, T), 457.0, tol);
149 
150  // Pressure = 10 MPa, temperature = 500 K
151  p = 10.0e6;
152  REL_TEST(_fp->rho_from_p_T(p, T), 2.3024 * 1000.0 * _fp->molarMass(), tol);
153  REL_TEST(_fp->e_from_p_T(p, T), 10154.0 / _fp->molarMass(), tol);
154  REL_TEST(_fp->h_from_p_T(p, T), 14497.0 / _fp->molarMass(), tol);
155  REL_TEST(_fp->s_from_p_T(p, T), 167.93 / _fp->molarMass(), tol);
156  REL_TEST(_fp->cp_from_p_T(p, T), 30.82 / _fp->molarMass(), tol);
157  REL_TEST(_fp->cv_from_p_T(p, T), 21.49 / _fp->molarMass(), tol);
158  REL_TEST(_fp->c_from_p_T(p, T), 483.1, tol);
159 }
160 
166 {
167  const Real tol = REL_TOL_DERIVATIVE;
168 
169  const Real p = 1.0e6;
170  Real T = 350.0;
171 
172  DERIV_TEST(_fp->rho_from_p_T, p, T, tol);
173  DERIV_TEST(_fp->mu_from_p_T, p, T, tol);
174  DERIV_TEST(_fp->e_from_p_T, p, T, tol);
175  DERIV_TEST(_fp->h_from_p_T, p, T, tol);
176  DERIV_TEST(_fp->k_from_p_T, p, T, tol);
177 
178  // Viscosity from density and temperature
179  T = 360.0;
180  const Real drho = 1.0e-4;
181  Real rho, drho_dp, drho_dT;
182  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
183 
184  Real dmu_drho_fd =
185  (_fp->mu_from_rho_T(rho + drho, T) - _fp->mu_from_rho_T(rho - drho, T)) / (2.0 * drho);
186  Real mu = 0.0, dmu_drho = 0.0, dmu_dT = 0.0;
187  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
188 
189  ABS_TEST(mu, _fp->mu_from_rho_T(rho, T), REL_TOL_CONSISTENCY);
190  REL_TEST(dmu_drho, dmu_drho_fd, tol);
191 
192  // To properly test derivative wrt temperature, use p and T and calculate density,
193  // so that the change in density wrt temperature is included
194  const Real dp = 1.0e1;
195  const Real dT = 1.0e-4;
196  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
197  _fp->mu_from_rho_T(rho, T, drho_dT, mu, dmu_drho, dmu_dT);
198 
199  Real dmu_dT_fd = (_fp->mu_from_rho_T(_fp->rho_from_p_T(p, T + dT), T + dT) -
200  _fp->mu_from_rho_T(_fp->rho_from_p_T(p, T - dT), T - dT)) /
201  (2.0 * dT);
202 
203  REL_TEST(dmu_dT, dmu_dT_fd, tol);
204 
205  Real dmu_dp_fd = (_fp->mu_from_p_T(p + dp, T) - _fp->mu_from_p_T(p - dp, T)) / (2.0 * dp);
206  Real dmu_dp = 0.0;
207  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
208 
209  ABS_TEST(mu, _fp->mu_from_p_T(p, T), REL_TOL_CONSISTENCY);
210  REL_TEST(dmu_dp, dmu_dp_fd, tol);
211 
212  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
213  dmu_dT_fd = (_fp->mu_from_p_T(p, T + dT) - _fp->mu_from_p_T(p, T - dT)) / (2.0 * dT);
214 
215  REL_TEST(dmu_dT, dmu_dT_fd, tol);
216 }
217 
223 {
224  const Real p = 1.0e6;
225  const Real T = 300.0;
226  const Real tol = REL_TOL_CONSISTENCY;
227 
228  // Single property methods
229  Real rho, drho_dp, drho_dT;
230  _fp->rho_from_p_T(p, T, rho, drho_dp, drho_dT);
231  Real mu, dmu_dp, dmu_dT;
232  _fp->mu_from_p_T(p, T, mu, dmu_dp, dmu_dT);
233  Real e, de_dp, de_dT;
234  _fp->e_from_p_T(p, T, e, de_dp, de_dT);
235 
236  // Combined property methods
237  Real rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT, e2, de2_dp, de2_dT;
238  _fp->rho_mu_from_p_T(p, T, rho2, mu2);
239 
240  ABS_TEST(rho, rho2, tol);
241  ABS_TEST(mu, mu2, tol);
242 
243  _fp->rho_mu_from_p_T(p, T, rho2, drho2_dp, drho2_dT, mu2, dmu2_dp, dmu2_dT);
244  ABS_TEST(rho, rho2, tol);
245  ABS_TEST(drho_dp, drho2_dp, tol);
246  ABS_TEST(drho_dT, drho2_dT, tol);
247  ABS_TEST(mu, mu2, tol);
248  ABS_TEST(dmu_dp, dmu2_dp, tol);
249  ABS_TEST(dmu_dT, dmu2_dT, tol);
250 
251  _fp->rho_e_from_p_T(p, T, rho2, drho2_dp, drho2_dT, e2, de2_dp, de2_dT);
252  ABS_TEST(rho, rho2, tol);
253  ABS_TEST(drho_dp, drho2_dp, tol);
254  ABS_TEST(drho_dT, drho2_dT, tol);
255  ABS_TEST(e, e2, tol);
256  ABS_TEST(de_dp, de2_dp, tol);
257  ABS_TEST(de_dT, de2_dT, tol);
258 }
const double tol
TEST_F(NitrogenFluidPropertiesTest, fluidName)
Test that the fluid name is correctly returned.
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real