https://mooseframework.inl.gov
FlibeFluidProperties.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 
10 #include "FlibeFluidProperties.h"
11 
12 registerMooseObject("FluidPropertiesApp", FlibeFluidProperties);
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 flibe");
24  return params;
25 }
26 
28  : SinglePhaseFluidProperties(parameters),
29  _drho_dp(getParam<Real>("drho_dp")),
30  _drho_dT(-0.4884),
31  _p_atm(101325.0),
32  _cp(2416.0),
33  _c0(2413.0),
34  _dp_dT_at_constant_v(-_drho_dT / _drho_dp)
35 {
36 }
37 
38 std::string
40 {
41  return "flibe";
42 }
43 
44 Real
46 {
47  return 99.037703E-3;
48 }
49 
50 Real
52 {
54  return (1.0 / v - _drho_dT * temperature - _c0) / _drho_dp + _p_atm;
55 }
56 
57 void
58 FlibeFluidProperties::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 
74 void
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 
92 Real
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 
112 void
113 FlibeFluidProperties::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 
128 void
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 
145 Real
146 FlibeFluidProperties::T_from_p_h(Real /* p */, Real h) const
147 {
148  return h / _cp;
149 }
150 
151 ADReal
152 FlibeFluidProperties::T_from_p_h(const ADReal & /* p */, const ADReal & h) const
153 {
154  return h / _cp;
155 }
156 
157 Real FlibeFluidProperties::cp_from_v_e(Real /*v*/, Real /*e*/) const { return _cp; }
158 
159 void
160 FlibeFluidProperties::cp_from_v_e(Real v, Real e, Real & cp, Real & dcp_dv, Real & dcp_de) const
161 {
162  cp = cp_from_v_e(v, e);
163  dcp_dv = 0.0;
164  dcp_de = 0.0;
165 }
166 
167 Real
169 {
170  // definition of Cv by replacing e by h + p * v
171  Real cp = cp_from_v_e(v, e);
172  return cp - _dp_dT_at_constant_v * v;
173 }
174 
175 void
176 FlibeFluidProperties::cv_from_v_e(Real v, Real e, Real & cv, Real & dcv_dv, Real & dcv_de) const
177 {
178  cv = cv_from_v_e(v, e);
179  dcv_dv = -_dp_dT_at_constant_v;
180  dcv_de = 0.0;
181 }
182 
183 void
185  const ADReal & v, const ADReal & e, ADReal & cv, ADReal & dcv_dv, ADReal & dcv_de) const
186 {
187  cv = SinglePhaseFluidProperties::cv_from_v_e(v, e);
188  dcv_dv = -_dp_dT_at_constant_v;
189  dcv_de = 0.0;
190 }
191 
192 Real
194 {
196  return 1.16e-4 * std::exp(3755.0 / temperature);
197 }
198 
199 Real
201 {
203  return 5.0e-4 * temperature + 0.63;
204 }
205 
206 Real
208 {
209  return _drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0;
210 }
211 
212 void
214  Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const
215 {
217  drho_dp = _drho_dp;
218  drho_dT = _drho_dT;
219 }
220 
221 void
223  const ADReal & temperature,
224  ADReal & rho,
225  ADReal & drho_dp,
226  ADReal & drho_dT) const
227 {
228  rho = SinglePhaseFluidProperties::rho_from_p_T(pressure, temperature);
229  drho_dp = _drho_dp;
230  drho_dT = _drho_dT;
231 }
232 
233 ADReal
235 {
236  return 1.0 / (_drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0);
237 }
238 
239 Real
241 {
242  return 1.0 / (_drho_dT * temperature + _drho_dp * (pressure - _p_atm) + _c0);
243 }
244 
245 void
247  Real pressure, Real temperature, Real & v, Real & dv_dp, Real & dv_dT) const
248 {
250  dv_dp = -v * v * _drho_dp;
251  dv_dT = -v * v * _drho_dT;
252 }
253 
254 Real
255 FlibeFluidProperties::h_from_p_T(Real /*pressure*/, Real temperature) const
256 {
257  // definition of h for constant Cp
258  Real cp = cp_from_v_e(0.0 /* dummy */, 0.0 /* dummy */);
259  return cp * temperature;
260 }
261 
262 void
264  Real pressure, Real temperature, Real & h, Real & dh_dp, Real & dh_dT) const
265 {
267  Real cp = cp_from_v_e(0.0 /* dummy */, 0.0 /* dummy */);
268 
269  dh_dp = 0.0;
270  dh_dT = cp;
271 }
272 
273 Real
275 {
276  // definition of h = e + p * v
278  Real cp = cp_from_v_e(v, 0.0 /* dummy */);
279  return cp * temperature - pressure * v;
280 }
281 
282 void
284  Real pressure, Real temperature, Real & e, Real & de_dp, Real & de_dT) const
285 {
287 
288  Real v, dv_dp, dv_dT;
289  v_from_p_T(pressure, temperature, v, dv_dp, dv_dT);
290 
291  // definition of e = h - p * v
292  de_dp = -pressure * dv_dp - v;
293 
294  // definition of e = h - p * v
295  Real cp = cp_from_v_e(v, e);
296  de_dT = cp - pressure * dv_dT;
297 }
298 
299 Real
300 FlibeFluidProperties::e_from_p_rho(Real p, Real rho) const
301 {
302  return e_from_p_T(p, T_from_p_rho(p, rho));
303 }
304 
305 Real
306 FlibeFluidProperties::T_from_p_rho(Real p, Real rho) const
307 {
308  Real temperature = (rho - (p - _p_atm) * _drho_dp - _c0) / _drho_dT;
309  return temperature;
310 }
311 
312 Real FlibeFluidProperties::cp_from_p_T(Real /*pressure*/, Real /*temperature*/) const
313 {
314  return _cp;
315 }
316 
317 void
319  Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
320 {
322  dcp_dp = 0.0;
323  dcp_dT = 0.0;
324 }
325 
326 Real
328 {
331  return cv_from_v_e(v, e);
332 }
333 
334 void
336  Real pressure, Real temperature, Real & cv, Real & dcv_dp, Real & dcv_dT) const
337 {
339  dcv_dp = 0.0;
340  dcv_dT = 0.0;
341 }
342 
343 Real
344 FlibeFluidProperties::mu_from_p_T(Real /*pressure*/, Real temperature) const
345 {
346  return 1.16e-4 * std::exp(3755.0 / temperature);
347 }
348 
349 void
351  Real pressure, Real temperature, Real & mu, Real & dmu_dp, Real & dmu_dT) const
352 {
353  mu = this->mu_from_p_T(pressure, temperature);
354  dmu_dp = 0.0;
355  dmu_dT = -1.16e-4 * std::exp(3755.0 / temperature) * 3755.0 / (temperature * temperature);
356 }
357 
358 Real
359 FlibeFluidProperties::k_from_p_T(Real /*pressure*/, Real temperature) const
360 {
361  return 5.0e-4 * temperature + 0.63;
362 }
363 
364 void
366  Real pressure, Real temperature, Real & k, Real & dk_dp, Real & dk_dT) const
367 {
368  k = this->k_from_p_T(pressure, temperature);
369  dk_dp = 0.0;
370  dk_dT = 5.0e-4;
371 }
virtual Real molarMass() const override
Molar mass.
virtual std::string fluidName() const override
Fluid name.
static const std::string cv
Definition: NS.h:122
const Real _dp_dT_at_constant_v
derivative of pressure with respect to temperature at constant specific volume
virtual Real cv_from_v_e(Real v, Real e) const override
Isochoric specific heat from specific volume and specific internal energy.
static InputParameters validParams()
const Real _c0
additive constant to rho(P, T) correlation
virtual Real T_from_p_h(Real p, Real h) const override
Temperature and its derivatives from pressure and specific enthalpy.
static InputParameters validParams()
virtual Real e_from_p_rho(Real p, Real rho) const override
Specific energy from pressure and density.
const Real _drho_dT
Derivative of density with respect to temperature at fixed pressure.
FlibeFluidProperties(const InputParameters &parameters)
static const std::string temperature
Definition: NS.h:59
virtual Real cp_from_v_e(Real v, Real e) const override
Isobaric specific heat from specific volume and specific internal energy.
DualNumber< Real, DNDerivativeType, true > ADReal
Fluid properties for 2LiF-BeF2 (flibe) .
virtual Real mu_from_p_T(Real p, Real T) const override
Dynamic viscosity from pressure and temperature.
static const std::string cp
Definition: NS.h:121
virtual Real rho_from_p_T(Real p, Real T) const override
Density from pressure and temperature.
e e e e s T T T T T rho v v T e h
virtual Real T_from_v_e(Real v, Real e) const override
Temperature from specific volume and specific internal energy.
static const std::string mu
Definition: NS.h:123
const Real _cp
specific heat at constant pressure
const Real _p_atm
Atmospheric pressure, Pa.
virtual Real cv_from_p_T(Real p, Real T) const override
Isochoric specific heat capacity from pressure and temperature.
Common class for single phase fluid properties.
virtual Real cp_from_p_T(Real p, Real T) const override
Isobaric specific heat capacity from pressure and temperature.
const Real & _drho_dp
Derivative of density with respect to pressure at fixed temperature.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real v_from_p_T(Real p, Real T) const override
Specific volume from pressure and temperature.
static const std::string v
Definition: NS.h:84
static const std::string pressure
Definition: NS.h:56
virtual Real k_from_p_T(Real p, Real T) const override
Thermal conductivity from pressure and temperature.
virtual Real h_from_p_T(Real p, Real T) const override
Specific enthalpy from pressure and temperature.
void addClassDescription(const std::string &doc_string)
virtual Real k_from_v_e(Real v, Real e) const override
Thermal conductivity from specific volume and specific internal energy.
virtual Real e_from_p_T(Real p, Real T) const override
Specific internal energy from pressure and temperature.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
registerMooseObject("FluidPropertiesApp", FlibeFluidProperties)
virtual Real mu_from_v_e(Real v, Real e) const override
Dynamic viscosity from specific volume and specific internal energy.
static const std::string k
Definition: NS.h:130
virtual Real T_from_p_rho(Real p, Real rho) const
Temperature and its derivatives from pressure and specific enthalpy.
virtual Real p_from_v_e(Real v, Real e) const override
Pressure from specific volume and specific internal energy.