https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FlinakFluidProperties.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
11
13
16{
18 params.addRangeCheckedParam<Real>(
19 "drho_dp",
20 1.7324E-7,
21 "drho_dp > 0.0",
22 "derivative of density with respect to pressure (at constant temperature)");
23 params.addClassDescription("Fluid properties for flinak");
24 return params;
25}
26
28 : SinglePhaseFluidProperties(parameters),
29 _drho_dp(getParam<Real>("drho_dp")),
30 _drho_dT(-0.73),
31 _p_atm(101325.0),
32 _cp(2010.0),
33 _c0(2729.0),
34 _dp_dT_at_constant_v(-_drho_dT / _drho_dp)
35{
36}
37
38std::string
40{
41 return "flinak";
42}
43
44Real
46{
47 return 41.291077435E-3;
48}
49
50Real
52{
53 Real temperature = T_from_v_e(v, e);
54 return (1.0 / v - _drho_dT * temperature - _c0) / _drho_dp + _p_atm;
55}
56
57void
58FlinakFluidProperties::p_from_v_e(Real v, Real e, Real & p, Real & dp_dv, Real & dp_de) const
59{
60 p = p_from_v_e(v, e);
61
62 // chain rule, (dp_de)_v = (dp_dT)_v * (dT_de)_v
63 Real T, dT_dv, dT_de;
64 T_from_v_e(v, e, T, dT_dv, dT_de);
65 dp_de = _dp_dT_at_constant_v * dT_de;
66
67 // cyclic relation, (dP_dv)_e = - (dp_de)_v * (de_dv)_p
68 Real cp = cp_from_v_e(v, e);
69 Real dT_dv_at_constant_p = -1.0 / (_drho_dT * v * v);
70 Real de_dv_at_constant_p = cp * dT_dv_at_constant_p - p;
71 dp_dv = -dp_de * de_dv_at_constant_p;
72}
73
74void
76 const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
77{
78 p = SinglePhaseFluidProperties::p_from_v_e(v, e);
79
80 // chain rule, (dp_de)_v = (dp_dT)_v * (dT_de)_v
81 ADReal T, dT_dv, dT_de;
82 T_from_v_e(v, e, T, dT_dv, dT_de);
83 dp_de = _dp_dT_at_constant_v * dT_de;
84
85 // cyclic relation, (dP_dv)_e = - (dp_de)_v * (de_dv)_p
86 auto cp = SinglePhaseFluidProperties::cp_from_v_e(v, e);
87 auto dT_dv_at_constant_p = -1.0 / (_drho_dT * v * v);
88 auto de_dv_at_constant_p = cp * dT_dv_at_constant_p - p;
89 dp_dv = -dp_de * de_dv_at_constant_p;
90}
91
92Real
94{
95 // We need to write these in a somewhat strange manner to ensure that pressure
96 // and temperature do not depend implicitly on each other, causing a circular
97 // logic problem. Substituting the definition for pressure based on the
98 // rho * (h - e) = P, where h = Cp * T into the density correlation for flibe,
99 // we can rearrange and get temperature in terms of only v and e
100
101 // p = (Cp * T - e) / v
102 // T = (1 / v - drho_dp * [p - p_atm] + _c0) / drho_dT
103 // = (1 / v - drho_dp * [(Cp * T - e) / v - p_atm] + _c0) / drho_dT
104 // = (1 + drho_dp * e + p_atm * v * drho_dp - _c0 * v) / (drho_dT * v + drho_dp * Cp)
105
106 Real cp = cp_from_v_e(v, e);
107 Real numerator = 1.0 + _drho_dp * (e + _p_atm * v) - _c0 * v;
108 Real denominator = _drho_dT * v + _drho_dp * cp;
109 return numerator / denominator;
110}
111
112void
113FlinakFluidProperties::T_from_v_e(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
114{
115 T = T_from_v_e(v, e);
116
117 // reciprocity relation based on the definition of cv
118 Real cv = cv_from_v_e(v, e);
119 dT_de = 1.0 / cv;
120
121 // cyclic relation, (dT_dv)_e = -(dT_de)_v * (de_dv)_T
122 Real p = p_from_v_e(v, e);
123 Real dp_dv_at_constant_T = -1.0 / (_drho_dp * v * v);
124 Real de_dv_at_constant_T = -(p + v * dp_dv_at_constant_T);
125 dT_dv = -dT_de * de_dv_at_constant_T;
126}
127
128void
130 const ADReal & v, const ADReal & e, ADReal & T, ADReal & dT_dv, ADReal & dT_de) const
131{
132 T = SinglePhaseFluidProperties::T_from_v_e(v, e);
133
134 // reciprocity relation based on the definition of cv
135 auto cv = SinglePhaseFluidProperties::cv_from_v_e(v, e);
136 dT_de = 1.0 / cv;
137
138 // cyclic relation, (dT_dv)_e = -(dT_de)_v * (de_dv)_T
139 auto p = SinglePhaseFluidProperties::p_from_v_e(v, e);
140 auto dp_dv_at_constant_T = -1.0 / (_drho_dp * v * v);
141 auto de_dv_at_constant_T = -(p + v * dp_dv_at_constant_T);
142 dT_dv = -dT_de * de_dv_at_constant_T;
143}
144
145Real
146FlinakFluidProperties::T_from_p_h(Real /* p */, Real h) const
147{
148 return h / _cp;
149}
150
151ADReal
152FlinakFluidProperties::T_from_p_h(const ADReal & /* p */, const ADReal & h) const
153{
154 return h / _cp;
155}
156
157Real
159{
160 Real temperature = (rho - (p - _p_atm) * _drho_dp - _c0) / _drho_dT;
161 return temperature;
162}
163
164Real
165FlinakFluidProperties::cp_from_v_e(Real /*v*/, Real /*e*/) const
166{
167 return _cp;
168}
169
170void
171FlinakFluidProperties::cp_from_v_e(Real v, Real e, Real & cp, Real & dcp_dv, Real & dcp_de) const
172{
173 cp = cp_from_v_e(v, e);
174 dcp_dv = 0.0;
175 dcp_de = 0.0;
176}
177
178Real
180{
181 // definition of Cv by replacing e by h + p * v
182 Real cp = cp_from_v_e(v, e);
183 return cp - _dp_dT_at_constant_v * v;
184}
185
186void
187FlinakFluidProperties::cv_from_v_e(Real v, Real e, Real & cv, Real & dcv_dv, Real & dcv_de) const
188{
189 cv = cv_from_v_e(v, e);
190 dcv_dv = -_dp_dT_at_constant_v;
191 dcv_de = 0.0;
192}
193
194void
196 const ADReal & v, const ADReal & e, ADReal & cv, ADReal & dcv_dv, ADReal & dcv_de) const
197{
198 cv = SinglePhaseFluidProperties::cv_from_v_e(v, e);
199 dcv_dv = -_dp_dT_at_constant_v;
200 dcv_de = 0.0;
201}
202
203Real
205{
206 Real temperature = T_from_v_e(v, e);
207 return 4.0e-5 * std::exp(4170.0 / temperature);
208}
209
210Real
212{
213 Real temperature = T_from_v_e(v, e);
214 return 5.0e-4 * temperature + 0.43;
215}
216
217Real
218FlinakFluidProperties::rho_from_p_T(Real pressure, Real temperature) const
219{
220 return _drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0;
221}
222
223void
225 Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const
226{
227 rho = rho_from_p_T(pressure, temperature);
228 drho_dp = _drho_dp;
229 drho_dT = _drho_dT;
230}
231
232void
234 const ADReal & temperature,
235 ADReal & rho,
236 ADReal & drho_dp,
237 ADReal & drho_dT) const
238{
239 rho = SinglePhaseFluidProperties::rho_from_p_T(pressure, temperature);
240 drho_dp = _drho_dp;
241 drho_dT = _drho_dT;
242}
243
244ADReal
245FlinakFluidProperties::v_from_p_T(const ADReal & pressure, const ADReal & temperature) const
246{
247 return 1.0 / (_drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0);
248}
249
250Real
251FlinakFluidProperties::v_from_p_T(Real pressure, Real temperature) const
252{
253 return 1.0 / (_drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0);
254}
255
256void
258 Real pressure, Real temperature, Real & v, Real & dv_dp, Real & dv_dT) const
259{
260 v = v_from_p_T(pressure, temperature);
261 dv_dp = -v * v * _drho_dp;
262 dv_dT = -v * v * _drho_dT;
263}
264
265Real
266FlinakFluidProperties::h_from_p_T(Real /*pressure*/, Real temperature) const
267{
268 // definition of h for constant Cp
269 Real cp = cp_from_v_e(0.0 /* dummy */, 0.0 /* dummy */);
270 return cp * temperature;
271}
272
273void
275 Real pressure, Real temperature, Real & h, Real & dh_dp, Real & dh_dT) const
276{
277 h = h_from_p_T(pressure, temperature);
278 Real cp = cp_from_v_e(0.0 /* dummy */, 0.0 /* dummy */);
279
280 dh_dp = 0.0;
281 dh_dT = cp;
282}
283
284Real
285FlinakFluidProperties::e_from_p_T(Real pressure, Real temperature) const
286{
287 // definition of h = e + p * v
288 Real v = v_from_p_T(pressure, temperature);
289 Real cp = cp_from_v_e(v, 0.0 /* dummy */);
290 return cp * temperature - pressure * v;
291}
292
293void
295 Real pressure, Real temperature, Real & e, Real & de_dp, Real & de_dT) const
296{
297 e = e_from_p_T(pressure, temperature);
298
299 Real v, dv_dp, dv_dT;
300 v_from_p_T(pressure, temperature, v, dv_dp, dv_dT);
301
302 // definition of e = h - p * v
303 de_dp = -pressure * dv_dp - v;
304
305 // definition of e = h - p * v
306 Real cp = cp_from_v_e(v, e);
307 de_dT = cp - pressure * dv_dT;
308}
309
310Real
312{
313 return e_from_p_T(p, T_from_p_rho(p, rho));
314}
315
316Real
317FlinakFluidProperties::beta_from_p_T(Real pressure, Real temperature) const
318{
319 Real rho, drho_dp, drho_dT;
320 rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
321 return -drho_dT / rho;
322}
323
324Real
325FlinakFluidProperties::cp_from_p_T(Real /*pressure*/, Real /*temperature*/) const
326{
327 return _cp;
328}
329
330void
332 Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
333{
334 cp = cp_from_p_T(pressure, temperature);
335 dcp_dp = 0.0;
336 dcp_dT = 0.0;
337}
338
339Real
340FlinakFluidProperties::cv_from_p_T(Real pressure, Real temperature) const
341{
342 Real v = v_from_p_T(pressure, temperature);
343 Real e = e_from_p_T(pressure, temperature);
344 return cv_from_v_e(v, e);
345}
346
347void
349 Real pressure, Real temperature, Real & cv, Real & dcv_dp, Real & dcv_dT) const
350{
351 cv = cv_from_p_T(pressure, temperature);
352 dcv_dp = 0.0;
353 dcv_dT = 0.0;
354}
355
356Real
357FlinakFluidProperties::mu_from_p_T(Real /*pressure*/, Real temperature) const
358{
359 return 4.0e-5 * std::exp(4170.0 / temperature);
360}
361
362void
364 Real pressure, Real temperature, Real & mu, Real & dmu_dp, Real & dmu_dT) const
365{
366 mu = this->mu_from_p_T(pressure, temperature);
367 dmu_dp = 0.0;
368 dmu_dT = -4.0e-5 * std::exp(4170.0 / temperature) * 4170.0 / (temperature * temperature);
369}
370
371Real
372FlinakFluidProperties::k_from_p_T(Real /*pressure*/, Real temperature) const
373{
374 return 5.0e-4 * temperature + 0.43;
375}
376
377void
379 Real pressure, Real temperature, Real & k, Real & dk_dp, Real & dk_dT) const
380{
381 k = this->k_from_p_T(pressure, temperature);
382 dk_dp = 0.0;
383 dk_dT = 5.0e-4;
384}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("FluidPropertiesApp", FlinakFluidProperties)
const double mu
const Real p
const double rho
const double T
const double v
Fluid properties for 0.465 LiF - 0.115 NaF - 0.42 KF (flinak) .
virtual Real rho_from_p_T(Real p, Real T) const override
Density from pressure and temperature.
virtual Real T_from_p_h(Real p, Real h) const override
Temperature from pressure and specific enthalpy.
virtual Real v_from_p_T(Real p, Real T) const override
Specific volume from pressure and temperature.
const Real _p_atm
Atmospheric pressure, Pa.
virtual Real molarMass() const override
Molar mass.
virtual Real cv_from_v_e(Real v, Real e) const override
Isochoric specific heat from specific volume and specific internal energy.
FlinakFluidProperties(const InputParameters &parameters)
virtual Real e_from_p_T(Real p, Real T) const override
Specific internal energy from pressure and temperature.
virtual Real cv_from_p_T(Real p, Real T) const override
Isochoric specific heat capacity from pressure and temperature.
virtual Real T_from_v_e(Real v, Real e) const override
Temperature from specific volume and specific internal energy.
virtual Real mu_from_v_e(Real v, Real e) const override
Dynamic viscosity from specific volume and specific internal energy.
const Real _dp_dT_at_constant_v
derivative of pressure with respect to temperature at constant specific volume
virtual Real p_from_v_e(Real v, Real e) const override
Pressure from specific volume and specific internal energy.
virtual Real e_from_p_rho(Real p, Real rho) const override
Specific internal energy from pressure and density.
const Real & _drho_dp
Derivative of density with respect to pressure at fixed temperature.
virtual Real k_from_v_e(Real v, Real e) const override
Thermal conductivity from specific volume and specific internal energy.
const Real _cp
specific heat at constant pressure
virtual Real cp_from_p_T(Real p, Real T) const override
Isobaric specific heat capacity from pressure and temperature.
const Real _c0
additive constant to rho(P, T) correlation
virtual Real cp_from_v_e(Real v, Real e) const override
Isobaric specific heat from specific volume and specific internal energy.
static InputParameters validParams()
virtual Real k_from_p_T(Real p, Real T) const override
Thermal conductivity from pressure and temperature.
virtual Real T_from_p_rho(Real p, Real rho) const
Temperature from pressure and density.
const Real _drho_dT
Derivative of density with respect to temperature at fixed pressure.
virtual Real h_from_p_T(Real p, Real T) const override
Specific enthalpy from pressure and temperature.
virtual Real beta_from_p_T(Real p, Real T) const override
Thermal expansion coefficient from pressure and temperature.
virtual std::string fluidName() const override
Fluid name.
virtual Real mu_from_p_T(Real p, Real T) const override
Dynamic viscosity from pressure and temperature.
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Common class for single phase fluid properties.
static InputParameters validParams()
e e e e s T T T T T rho v v T e h