Line data Source code
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 :
10 : #include "IdealGasFluidProperties.h"
11 : #include "Conversion.h"
12 :
13 : #include "metaphysicl/raw_type.h"
14 :
15 : registerMooseObject("FluidPropertiesApp", IdealGasFluidProperties);
16 :
17 : InputParameters
18 1706 : IdealGasFluidProperties::validParams()
19 : {
20 1706 : InputParameters params = SinglePhaseFluidProperties::validParams();
21 1706 : params += NaNInterface::validParams();
22 :
23 3412 : params.addRangeCheckedParam<Real>("gamma", 1.4, "gamma > 1", "gamma value (cp/cv)");
24 3412 : params.addParam<Real>("molar_mass", 29.0e-3, "Constant molar mass of the fluid (kg/mol)");
25 3412 : params.addParam<Real>("e_ref", 0, "Reference specific internal energy [J/kg]");
26 3412 : params.addParam<Real>("mu", 18.23e-6, "Dynamic viscosity, Pa.s");
27 3412 : params.addParam<Real>("k", 25.68e-3, "Thermal conductivity, W/(m-K)");
28 3412 : params.addParam<Real>("T_c", 0, "Critical temperature, K");
29 3412 : params.addParam<Real>("rho_c", 0, "Critical density, kg/m3");
30 3412 : params.addParam<Real>("e_c", 0, "Internal energy at the critical point, J/kg");
31 :
32 1706 : params.addClassDescription("Fluid properties for an ideal gas");
33 :
34 1706 : return params;
35 0 : }
36 :
37 944 : IdealGasFluidProperties::IdealGasFluidProperties(const InputParameters & parameters)
38 : : SinglePhaseFluidProperties(parameters),
39 : NaNInterface(this),
40 :
41 944 : _gamma(getParam<Real>("gamma")),
42 1888 : _molar_mass(getParam<Real>("molar_mass")),
43 1888 : _e_ref(getParam<Real>("e_ref")),
44 :
45 944 : _R_specific(_R / _molar_mass),
46 944 : _cp(_gamma * _R_specific / (_gamma - 1.0)),
47 944 : _cv(_cp / _gamma),
48 :
49 1888 : _mu(getParam<Real>("mu")),
50 1888 : _k(getParam<Real>("k")),
51 :
52 1888 : _T_c(getParam<Real>("T_c")),
53 1888 : _rho_c(getParam<Real>("rho_c")),
54 2832 : _e_c(getParam<Real>("e_c"))
55 : {
56 944 : }
57 :
58 908 : IdealGasFluidProperties::~IdealGasFluidProperties() {}
59 :
60 : std::string
61 1 : IdealGasFluidProperties::fluidName() const
62 : {
63 1 : return "ideal_gas";
64 : }
65 :
66 : Real
67 61581 : IdealGasFluidProperties::p_from_v_e(Real v, Real e) const
68 : {
69 61581 : if (v == 0.0)
70 0 : return getNaN("Invalid value of specific volume detected (v = " + Moose::stringify(v) + ").");
71 :
72 61581 : return (_gamma - 1.0) * (e - _e_ref) / v;
73 : }
74 :
75 : ADReal
76 1 : IdealGasFluidProperties::p_from_v_e(const ADReal & v, const ADReal & e) const
77 : {
78 1 : if (v.value() == 0.0)
79 0 : return getNaN("Invalid value of specific volume detected (v = " + Moose::stringify(v.value()) +
80 0 : ").");
81 :
82 2 : return (_gamma - 1.0) * (e - _e_ref) / v;
83 : }
84 :
85 : void
86 4 : IdealGasFluidProperties::p_from_v_e(Real v, Real e, Real & p, Real & dp_dv, Real & dp_de) const
87 : {
88 4 : p = p_from_v_e(v, e);
89 4 : dp_dv = -(_gamma - 1.0) * (e - _e_ref) / v / v;
90 4 : dp_de = (_gamma - 1.0) / v;
91 4 : }
92 :
93 : void
94 0 : IdealGasFluidProperties::p_from_v_e(
95 : const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
96 : {
97 0 : p = p_from_v_e(v, e);
98 0 : dp_dv = -(_gamma - 1.0) * (e - _e_ref) / v / v;
99 0 : dp_de = (_gamma - 1.0) / v;
100 0 : }
101 :
102 : Real
103 62251 : IdealGasFluidProperties::T_from_v_e(Real /*v*/, Real e) const
104 : {
105 62251 : return (e - _e_ref) / _cv;
106 : }
107 :
108 : ADReal
109 0 : IdealGasFluidProperties::T_from_v_e(const ADReal & /*v*/, const ADReal & e) const
110 : {
111 0 : return (e - _e_ref) / _cv;
112 : }
113 :
114 : void
115 5 : IdealGasFluidProperties::T_from_v_e(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
116 : {
117 5 : T = T_from_v_e(v, e);
118 5 : dT_dv = 0.0;
119 5 : dT_de = 1.0 / _cv;
120 5 : }
121 :
122 : void
123 0 : IdealGasFluidProperties::T_from_v_e(
124 : const ADReal & v, const ADReal & e, ADReal & T, ADReal & dT_dv, ADReal & dT_de) const
125 : {
126 0 : T = T_from_v_e(v, e);
127 0 : dT_dv = 0.0;
128 0 : dT_de = 1.0 / _cv;
129 0 : }
130 :
131 : Real
132 20604 : IdealGasFluidProperties::c_from_v_e(Real v, Real e) const
133 : {
134 20604 : Real T = T_from_v_e(v, e);
135 :
136 20604 : Real c2 = _gamma * _R_specific * T;
137 20604 : if (c2 < 0)
138 : {
139 0 : c2 = 0;
140 0 : flagInvalidSolution(
141 : "Sound speed squared (gamma * R * T) is negative: c2 = " + Moose::stringify(c2) + ".");
142 : }
143 :
144 20604 : return std::sqrt(c2);
145 : }
146 :
147 : ADReal
148 0 : IdealGasFluidProperties::c_from_v_e(const ADReal & v, const ADReal & e) const
149 : {
150 : using std::sqrt;
151 0 : const auto T = T_from_v_e(v, e);
152 :
153 0 : auto c2 = _gamma * _R_specific * T;
154 0 : if (MetaPhysicL::raw_value(c2) < 0)
155 : {
156 0 : c2 = 0;
157 0 : flagInvalidSolution(
158 : "Sound speed squared (gamma * R * T) is negative: c2 = " + Moose::stringify(c2) + ".");
159 : }
160 :
161 0 : return sqrt(c2);
162 : }
163 :
164 : void
165 2 : IdealGasFluidProperties::c_from_v_e(Real v, Real e, Real & c, Real & dc_dv, Real & dc_de) const
166 : {
167 : Real T, dT_dv, dT_de;
168 2 : T_from_v_e(v, e, T, dT_dv, dT_de);
169 :
170 2 : c = std::sqrt(_gamma * _R_specific * T);
171 :
172 2 : const Real dc_dT = 0.5 / c * _gamma * _R_specific;
173 2 : dc_dv = dc_dT * dT_dv;
174 2 : dc_de = dc_dT * dT_de;
175 2 : }
176 :
177 : Real
178 120115 : IdealGasFluidProperties::c_from_p_T(Real /*p*/, Real T) const
179 : {
180 120115 : return std::sqrt(_cp * _R * T / (_cv * _molar_mass));
181 : }
182 :
183 : ADReal
184 0 : IdealGasFluidProperties::c_from_p_T(const ADReal & /*p*/, const ADReal & T) const
185 : {
186 : using std::sqrt;
187 0 : return sqrt(_cp * _R * T / (_cv * _molar_mass));
188 : }
189 :
190 : void
191 1 : IdealGasFluidProperties::c_from_p_T(
192 : const Real /*p*/, const Real T, Real & c, Real & dc_dp, Real & dc_dT) const
193 : {
194 1 : c = std::sqrt(_cp * _R * T / (_cv * _molar_mass));
195 1 : dc_dp = 0;
196 1 : dc_dT = 0.5 / c * _cp * _R / (_cv * _molar_mass);
197 1 : }
198 :
199 : Real
200 134 : IdealGasFluidProperties::beta_from_p_T(Real /*p*/, Real T) const
201 : {
202 134 : return 1.0 / T;
203 : }
204 :
205 : ADReal
206 0 : IdealGasFluidProperties::beta_from_p_T(const ADReal & /*p*/, const ADReal & T) const
207 : {
208 0 : return 1.0 / T;
209 : }
210 :
211 : void
212 1 : IdealGasFluidProperties::beta_from_p_T(
213 : const Real /*p*/, const Real T, Real & beta, Real & dbeta_dp, Real & dbeta_dT) const
214 : {
215 1 : beta = 1.0 / T;
216 1 : dbeta_dp = 0;
217 1 : dbeta_dT = -1.0 / Utility::pow<2>(T);
218 1 : }
219 :
220 : Real
221 20605 : IdealGasFluidProperties::cp_from_v_e(Real, Real) const
222 : {
223 20605 : return _cp;
224 : }
225 :
226 : void
227 1 : IdealGasFluidProperties::cp_from_v_e(Real v, Real e, Real & cp, Real & dcp_dv, Real & dcp_de) const
228 : {
229 1 : cp = cp_from_v_e(v, e);
230 1 : dcp_dv = 0.0;
231 1 : dcp_de = 0.0;
232 1 : }
233 :
234 : Real
235 20605 : IdealGasFluidProperties::cv_from_v_e(Real, Real) const
236 : {
237 20605 : return _cv;
238 : }
239 :
240 : void
241 1 : IdealGasFluidProperties::cv_from_v_e(Real v, Real e, Real & cv, Real & dcv_dv, Real & dcv_de) const
242 : {
243 1 : cv = cv_from_v_e(v, e);
244 1 : dcv_dv = 0.0;
245 1 : dcv_de = 0.0;
246 1 : }
247 :
248 : Real
249 1 : IdealGasFluidProperties::gamma_from_v_e(Real, Real) const
250 : {
251 1 : return _gamma;
252 : }
253 :
254 : Real
255 1 : IdealGasFluidProperties::gamma_from_p_T(Real, Real) const
256 : {
257 1 : return _gamma;
258 : }
259 :
260 : Real
261 20686 : IdealGasFluidProperties::mu_from_v_e(Real, Real) const
262 : {
263 20686 : return _mu;
264 : }
265 :
266 : void
267 1 : IdealGasFluidProperties::mu_from_v_e(Real v, Real e, Real & mu, Real & dmu_dv, Real & dmu_de) const
268 : {
269 1 : mu = this->mu_from_v_e(v, e);
270 1 : dmu_dv = 0.0;
271 1 : dmu_de = 0.0;
272 1 : }
273 :
274 : Real
275 20685 : IdealGasFluidProperties::k_from_v_e(Real, Real) const
276 : {
277 20685 : return _k;
278 : }
279 :
280 : void
281 1 : IdealGasFluidProperties::k_from_v_e(
282 : Real /*v*/, Real /*e*/, Real & k, Real & dk_dv, Real & dk_de) const
283 : {
284 1 : k = _k;
285 1 : dk_dv = 0;
286 1 : dk_de = 0;
287 1 : }
288 :
289 : Real
290 20602 : IdealGasFluidProperties::s_from_v_e(Real v, Real e) const
291 : {
292 20602 : const Real T = T_from_v_e(v, e);
293 20602 : const Real p = p_from_v_e(v, e);
294 20602 : const Real n = std::pow(T, _gamma) / std::pow(p, _gamma - 1.0);
295 20602 : if (n <= 0.0)
296 0 : return getNaN("Negative argument in the ln() function.");
297 20602 : return _cv * std::log(n);
298 : }
299 :
300 : void
301 1 : IdealGasFluidProperties::s_from_v_e(Real v, Real e, Real & s, Real & ds_dv, Real & ds_de) const
302 : {
303 : Real T, dT_dv, dT_de;
304 1 : T_from_v_e(v, e, T, dT_dv, dT_de);
305 :
306 : Real p, dp_dv, dp_de;
307 1 : p_from_v_e(v, e, p, dp_dv, dp_de);
308 :
309 1 : const Real n = std::pow(T, _gamma) / std::pow(p, _gamma - 1.0);
310 1 : if (n <= 0.0)
311 : {
312 0 : s = getNaN("Negative argument in the ln() function.");
313 0 : ds_dv = getNaN();
314 0 : ds_de = getNaN();
315 : }
316 : else
317 : {
318 1 : s = _cv * std::log(n);
319 :
320 1 : const Real dn_dT = _gamma * std::pow(T, _gamma - 1.0) / std::pow(p, _gamma - 1.0);
321 1 : const Real dn_dp = std::pow(T, _gamma) * (1.0 - _gamma) * std::pow(p, -_gamma);
322 :
323 1 : const Real dn_dv = dn_dT * dT_dv + dn_dp * dp_dv;
324 1 : const Real dn_de = dn_dT * dT_de + dn_dp * dp_de;
325 :
326 1 : ds_dv = _cv / n * dn_dv;
327 1 : ds_de = _cv / n * dn_de;
328 : }
329 1 : }
330 :
331 : Real
332 120226 : IdealGasFluidProperties::s_from_p_T(Real p, Real T) const
333 : {
334 120226 : const Real n = std::pow(T, _gamma) / std::pow(p, _gamma - 1.0);
335 120226 : if (n <= 0.0)
336 0 : return getNaN("Negative argument in the ln() function.");
337 120226 : return _cv * std::log(n);
338 : }
339 :
340 : void
341 93 : IdealGasFluidProperties::s_from_p_T(Real p, Real T, Real & s, Real & ds_dp, Real & ds_dT) const
342 : {
343 93 : const Real n = std::pow(T, _gamma) / std::pow(p, _gamma - 1.0);
344 93 : if (n <= 0.0)
345 : {
346 0 : s = getNaN("Negative argument in the ln() function.");
347 0 : ds_dp = getNaN();
348 0 : ds_dT = getNaN();
349 : }
350 : else
351 : {
352 93 : s = _cv * std::log(n);
353 :
354 93 : const Real dn_dT = _gamma * std::pow(T, _gamma - 1.0) / std::pow(p, _gamma - 1.0);
355 93 : const Real dn_dp = std::pow(T, _gamma) * (1.0 - _gamma) * std::pow(p, -_gamma);
356 :
357 93 : ds_dp = _cv / n * dn_dp;
358 93 : ds_dT = _cv / n * dn_dT;
359 : }
360 93 : }
361 :
362 : Real
363 43 : IdealGasFluidProperties::s_from_h_p(Real h, Real p) const
364 : {
365 43 : const Real aux = p * std::pow((h - _e_ref) / (_gamma * _cv), -_gamma / (_gamma - 1));
366 43 : if (aux <= 0.0)
367 0 : return getNaN("Non-positive argument in the ln() function.");
368 43 : return -(_gamma - 1) * _cv * std::log(aux);
369 : }
370 :
371 : void
372 1 : IdealGasFluidProperties::s_from_h_p(Real h, Real p, Real & s, Real & ds_dh, Real & ds_dp) const
373 : {
374 1 : s = s_from_h_p(h, p);
375 :
376 1 : const Real aux = p * std::pow((h - _e_ref) / (_gamma * _cv), -_gamma / (_gamma - 1));
377 1 : const Real daux_dh = p * std::pow((h - _e_ref) / (_gamma * _cv), -_gamma / (_gamma - 1) - 1) *
378 1 : (-_gamma / (_gamma - 1)) / (_gamma * _cv);
379 1 : const Real daux_dp = std::pow((h - _e_ref) / (_gamma * _cv), -_gamma / (_gamma - 1));
380 1 : ds_dh = -(_gamma - 1) * _cv / aux * daux_dh;
381 1 : ds_dp = -(_gamma - 1) * _cv / aux * daux_dp;
382 1 : }
383 :
384 : Real
385 22 : IdealGasFluidProperties::rho_from_p_s(Real p, Real s) const
386 : {
387 22 : const Real aux = (s + _cv * std::log(std::pow(p, _gamma - 1.0))) / _cv;
388 22 : const Real T = std::pow(std::exp(aux), 1.0 / _gamma);
389 22 : return rho_from_p_T(p, T);
390 : }
391 :
392 : void
393 1 : IdealGasFluidProperties::rho_from_p_s(
394 : Real p, Real s, Real & rho, Real & drho_dp, Real & drho_ds) const
395 : {
396 : // T(p,s)
397 1 : const Real aux = (s + _cv * std::log(std::pow(p, _gamma - 1.0))) / _cv;
398 1 : const Real T = std::pow(std::exp(aux), 1 / _gamma);
399 :
400 : // dT/dp
401 1 : const Real dT_dp = 1.0 / _gamma * std::pow(std::exp(aux), 1.0 / _gamma - 1.0) * std::exp(aux) /
402 1 : std::pow(p, _gamma - 1.0) * (_gamma - 1.0) * std::pow(p, _gamma - 2.0);
403 :
404 : // dT/ds
405 : const Real dT_ds =
406 1 : 1.0 / _gamma * std::pow(std::exp(aux), 1.0 / _gamma - 1.0) * std::exp(aux) / _cv;
407 :
408 : // Drho/Dp = d/dp[rho(p, T(p,s))] = drho/dp + drho/dT * dT/dp
409 : Real drho_dp_partial, drho_dT;
410 1 : rho_from_p_T(p, T, rho, drho_dp_partial, drho_dT);
411 1 : drho_dp = drho_dp_partial + drho_dT * dT_dp;
412 :
413 : // Drho/Ds = d/ds[rho(p, T(p,s))] = drho/dT * dT/ds
414 1 : drho_ds = drho_dT * dT_ds;
415 1 : }
416 :
417 : Real
418 9 : IdealGasFluidProperties::e_from_v_h(Real /*v*/, Real h) const
419 : {
420 9 : return (h + (_gamma - 1.0) * _e_ref) / _gamma;
421 : }
422 :
423 : void
424 2 : IdealGasFluidProperties::e_from_v_h(Real v, Real h, Real & e, Real & de_dv, Real & de_dh) const
425 : {
426 2 : e = e_from_v_h(v, h);
427 2 : de_dv = 0.0;
428 2 : de_dh = 1.0 / _gamma;
429 2 : }
430 :
431 : Real
432 1505606 : IdealGasFluidProperties::rho_from_p_T(Real p, Real T) const
433 : {
434 1505606 : return p * _molar_mass / (_R * T);
435 : }
436 :
437 : ADReal
438 0 : IdealGasFluidProperties::rho_from_p_T(const ADReal & p, const ADReal & T) const
439 : {
440 0 : return p * _molar_mass / (_R * T);
441 : }
442 :
443 : void
444 0 : IdealGasFluidProperties::rho_from_p_T(
445 : const ADReal & p, const ADReal & T, ADReal & rho, ADReal & drho_dp, ADReal & drho_dT) const
446 : {
447 0 : rho = rho_from_p_T(p, T);
448 0 : drho_dp = _molar_mass / (_R * T);
449 0 : drho_dT = -p * _molar_mass / (_R * T * T);
450 0 : }
451 :
452 : void
453 1385247 : IdealGasFluidProperties::rho_from_p_T(
454 : Real p, Real T, Real & rho, Real & drho_dp, Real & drho_dT) const
455 : {
456 1385247 : rho = rho_from_p_T(p, T);
457 1385247 : drho_dp = _molar_mass / (_R * T);
458 1385247 : drho_dT = -p * _molar_mass / (_R * T * T);
459 1385247 : }
460 :
461 : Real
462 104 : IdealGasFluidProperties::e_from_p_rho(Real p, Real rho) const
463 : {
464 104 : return p / (_gamma - 1.0) / rho + _e_ref;
465 : }
466 :
467 : ADReal
468 0 : IdealGasFluidProperties::e_from_p_rho(const ADReal & p, const ADReal & rho) const
469 : {
470 0 : return p / (_gamma - 1.0) / rho + _e_ref;
471 : }
472 :
473 : void
474 1 : IdealGasFluidProperties::e_from_p_rho(
475 : Real p, Real rho, Real & e, Real & de_dp, Real & de_drho) const
476 : {
477 1 : e = e_from_p_rho(p, rho);
478 1 : de_dp = 1.0 / (_gamma - 1.0) / rho;
479 1 : de_drho = -p / (_gamma - 1.0) / rho / rho;
480 1 : }
481 :
482 : void
483 0 : IdealGasFluidProperties::e_from_p_rho(
484 : const ADReal & p, const ADReal & rho, ADReal & e, ADReal & de_dp, ADReal & de_drho) const
485 : {
486 0 : e = e_from_p_rho(p, rho);
487 0 : de_dp = 1.0 / (_gamma - 1.0) / rho;
488 0 : de_drho = -p / (_gamma - 1.0) / rho / rho;
489 0 : }
490 :
491 : Real
492 756 : IdealGasFluidProperties::e_from_T_v(Real T, Real /*v*/) const
493 : {
494 756 : return _cv * T + _e_ref;
495 : }
496 :
497 : void
498 7 : IdealGasFluidProperties::e_from_T_v(Real T, Real /*v*/, Real & e, Real & de_dT, Real & de_dv) const
499 : {
500 7 : e = _cv * T + _e_ref;
501 7 : de_dT = _cv;
502 7 : de_dv = 0.0;
503 7 : }
504 :
505 : ADReal
506 0 : IdealGasFluidProperties::e_from_T_v(const ADReal & T, const ADReal & /*v*/) const
507 : {
508 0 : return _cv * T + _e_ref;
509 : }
510 :
511 : void
512 0 : IdealGasFluidProperties::e_from_T_v(
513 : const ADReal & T, const ADReal & /*v*/, ADReal & e, ADReal & de_dT, ADReal & de_dv) const
514 : {
515 0 : e = _cv * T + _e_ref;
516 0 : de_dT = _cv;
517 0 : de_dv = 0.0;
518 0 : }
519 :
520 : Real
521 8812 : IdealGasFluidProperties::p_from_T_v(Real T, Real v) const
522 : {
523 8812 : return (_gamma - 1.0) * _cv * T / v;
524 : }
525 :
526 : void
527 278 : IdealGasFluidProperties::p_from_T_v(Real T, Real v, Real & p, Real & dp_dT, Real & dp_dv) const
528 : {
529 278 : p = (_gamma - 1.0) * _cv * T / v;
530 278 : dp_dT = (_gamma - 1.0) * _cv / v;
531 278 : dp_dv = -(_gamma - 1.0) * _cv * T / (v * v);
532 278 : }
533 :
534 : Real
535 6 : IdealGasFluidProperties::h_from_T_v(Real T, Real /*v*/) const
536 : {
537 6 : return _gamma * _cv * T + _e_ref;
538 : }
539 :
540 : void
541 84 : IdealGasFluidProperties::h_from_T_v(Real T, Real /*v*/, Real & h, Real & dh_dT, Real & dh_dv) const
542 : {
543 84 : h = _gamma * _cv * T + _e_ref;
544 84 : dh_dT = _gamma * _cv;
545 84 : dh_dv = 0.0;
546 84 : }
547 :
548 : Real
549 86 : IdealGasFluidProperties::s_from_T_v(Real T, Real v) const
550 : {
551 86 : Real p = p_from_T_v(T, v);
552 86 : return s_from_p_T(p, T);
553 : }
554 :
555 : void
556 92 : IdealGasFluidProperties::s_from_T_v(Real T, Real v, Real & s, Real & ds_dT, Real & ds_dv) const
557 : {
558 : Real p, dp_dT_v, dp_dv_T;
559 : Real ds_dp_T, ds_dT_p;
560 92 : p_from_T_v(T, v, p, dp_dT_v, dp_dv_T);
561 92 : s_from_p_T(p, T, s, ds_dp_T, ds_dT_p);
562 92 : ds_dT = ds_dT_p + ds_dp_T * dp_dT_v;
563 92 : ds_dv = ds_dp_T * dp_dv_T;
564 92 : }
565 :
566 : Real
567 84 : IdealGasFluidProperties::cv_from_T_v(Real /*T*/, Real /*v*/) const
568 : {
569 84 : return _cv;
570 : }
571 :
572 : Real
573 32 : IdealGasFluidProperties::e_spndl_from_v(Real /*v*/) const
574 : {
575 32 : return _e_c;
576 : }
577 :
578 : void
579 0 : IdealGasFluidProperties::v_e_spndl_from_T(Real /*T*/, Real & v, Real & e) const
580 : {
581 0 : v = 1. / _rho_c;
582 0 : e = _e_c;
583 0 : }
584 :
585 : Real
586 812507 : IdealGasFluidProperties::h_from_p_T(Real /*p*/, Real T) const
587 : {
588 812507 : return _cp * T + _e_ref;
589 : }
590 :
591 : void
592 692125 : IdealGasFluidProperties::h_from_p_T(Real p, Real T, Real & h, Real & dh_dp, Real & dh_dT) const
593 : {
594 692125 : h = h_from_p_T(p, T);
595 692125 : dh_dp = 0.0;
596 692125 : dh_dT = _cp;
597 692125 : }
598 :
599 : Real
600 813269 : IdealGasFluidProperties::e_from_p_T(Real /*p*/, Real T) const
601 : {
602 813269 : return _cv * T + _e_ref;
603 : }
604 :
605 : void
606 693121 : IdealGasFluidProperties::e_from_p_T(Real p, Real T, Real & e, Real & de_dp, Real & de_dT) const
607 : {
608 693121 : e = e_from_p_T(p, T);
609 693121 : de_dp = 0.0;
610 693121 : de_dT = _cv;
611 693121 : }
612 :
613 : Real
614 23 : IdealGasFluidProperties::p_from_h_s(Real h, Real s) const
615 : {
616 23 : return std::pow((h - _e_ref) / (_gamma * _cv), _gamma / (_gamma - 1.0)) *
617 23 : std::exp(-s / ((_gamma - 1.0) * _cv));
618 : }
619 :
620 : void
621 1 : IdealGasFluidProperties::p_from_h_s(Real h, Real s, Real & p, Real & dp_dh, Real & dp_ds) const
622 : {
623 1 : p = p_from_h_s(h, s);
624 1 : dp_dh = _gamma / (_gamma - 1.0) / (_gamma * _cv) *
625 1 : std::pow((h - _e_ref) / (_gamma * _cv), 1.0 / (_gamma - 1.0)) *
626 1 : std::exp(-s / ((_gamma - 1.0) * _cv));
627 1 : dp_ds = std::pow((h - _e_ref) / (_gamma * _cv), _gamma / (_gamma - 1)) *
628 1 : std::exp(-s / ((_gamma - 1) * _cv)) / ((1 - _gamma) * _cv);
629 1 : }
630 :
631 : Real
632 469 : IdealGasFluidProperties::g_from_v_e(Real v, Real e) const
633 : {
634 : // g(p,T) for SGEOS is given by Equation (37) in the following reference:
635 : //
636 : // Ray A. Berry, Richard Saurel, Olivier LeMetayer
637 : // The discrete equation method (DEM) for fully compressible, two-phase flows in
638 : // ducts of spatially varying cross-section
639 : // Nuclear Engineering and Design 240 (2010) p. 3797-3818
640 : //
641 469 : const Real p = p_from_v_e(v, e);
642 469 : const Real T = T_from_v_e(v, e);
643 :
644 469 : return _gamma * _cv * T - _cv * T * std::log(std::pow(T, _gamma) / std::pow(p, _gamma - 1.0));
645 : }
646 :
647 : Real
648 1002 : IdealGasFluidProperties::molarMass() const
649 : {
650 1002 : return _molar_mass;
651 : }
652 :
653 : Real
654 32 : IdealGasFluidProperties::criticalTemperature() const
655 : {
656 32 : return _T_c;
657 : }
658 :
659 : Real
660 48 : IdealGasFluidProperties::criticalDensity() const
661 : {
662 48 : return _rho_c;
663 : }
664 :
665 : Real
666 16 : IdealGasFluidProperties::criticalInternalEnergy() const
667 : {
668 16 : return _e_c;
669 : }
670 :
671 : Real
672 42 : IdealGasFluidProperties::T_from_p_h(Real, Real h) const
673 : {
674 42 : return (h - _e_ref) / _gamma / _cv;
675 : }
676 :
677 : void
678 1 : IdealGasFluidProperties::T_from_p_h(Real /*p*/, Real h, Real & T, Real & dT_dp, Real & dT_dh) const
679 : {
680 1 : T = (h - _e_ref) / (_gamma * _cv);
681 1 : dT_dp = 0;
682 1 : dT_dh = 1.0 / (_gamma * _cv);
683 1 : }
684 :
685 : Real
686 120160 : IdealGasFluidProperties::cv_from_p_T(Real /* pressure */, Real /* temperature */) const
687 : {
688 120160 : return _cv;
689 : }
690 :
691 : void
692 1 : IdealGasFluidProperties::cv_from_p_T(Real p, Real T, Real & cv, Real & dcv_dp, Real & dcv_dT) const
693 : {
694 1 : cv = cv_from_p_T(p, T);
695 1 : dcv_dp = 0.0;
696 1 : dcv_dT = 0.0;
697 1 : }
698 :
699 : Real
700 120154 : IdealGasFluidProperties::cp_from_p_T(Real /* pressure */, Real /* temperature */) const
701 : {
702 120154 : return _cp;
703 : }
704 :
705 : void
706 1 : IdealGasFluidProperties::cp_from_p_T(Real p, Real T, Real & cp, Real & dcp_dp, Real & dcp_dT) const
707 : {
708 1 : cp = cp_from_p_T(p, T);
709 1 : dcp_dp = 0.0;
710 1 : dcp_dT = 0.0;
711 1 : }
712 :
713 : Real
714 120133 : IdealGasFluidProperties::mu_from_p_T(Real /* pressure */, Real /* temperature */) const
715 : {
716 120133 : return _mu;
717 : }
718 :
719 : void
720 1 : IdealGasFluidProperties::mu_from_p_T(Real p, Real T, Real & mu, Real & dmu_dp, Real & dmu_dT) const
721 : {
722 1 : mu = this->mu_from_p_T(p, T);
723 1 : dmu_dp = 0.0;
724 1 : dmu_dT = 0.0;
725 1 : }
726 :
727 : Real
728 120133 : IdealGasFluidProperties::k_from_p_T(Real /* pressure */, Real /* temperature */) const
729 : {
730 120133 : return _k;
731 : }
732 :
733 : void
734 1 : IdealGasFluidProperties::k_from_p_T(Real p, Real T, Real & k, Real & dk_dp, Real & dk_dT) const
735 : {
736 1 : k = k_from_p_T(p, T);
737 1 : dk_dp = 0.0;
738 1 : dk_dT = 0.0;
739 1 : }
740 :
741 : Real
742 0 : IdealGasFluidProperties::pp_sat_from_p_T(Real /*p*/, Real /*T*/) const
743 : {
744 0 : mooseError(__PRETTY_FUNCTION__, " not implemented. Use a real fluid property class!");
745 : }
|