https://mooseframework.inl.gov
NaKFluidProperties.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 "NaKFluidProperties.h"
11 
12 registerMooseObject("FluidPropertiesApp", NaKFluidProperties);
13 
16 {
18  params.addClassDescription("Fluid properties for NaK");
19  params.addRequiredParam<Real>(
20  "weight_fraction_K",
21  "Weight fraction of potassium in NaK. Only eutectic is implemented (X_K = 0.778)");
22  return params;
23 }
24 
26  : SinglePhaseFluidProperties(parameters), _MNaK((39.102 + 22.9898) / 1000)
27 {
28  // We did not implement other weight fractions
29  const Real Xk = getParam<Real>("weight_fraction_K");
30  if (Xk != 0.778)
31  paramError("weight_fraction_K",
32  "Only 0.778 weight percent potassium (eutectic) is implemented");
33 
34  // Compute mole fractions from mass fractions
35  const Real AwK = 39.102;
36  const Real AwNa = 22.9898;
37  _Nk = Xk / AwK / (Xk / AwK + (1 - Xk) / AwNa);
38 }
39 
41 
42 std::string
44 {
45  return "NaK";
46 }
47 
48 Real
50 {
51  return _MNaK;
52 }
53 
54 Real
55 NaKFluidProperties::T_from_p_h(Real /* pressure */, Real enthalpy) const
56 {
57  // analytical inversion of h_from_p_T
58  Real h2 = enthalpy * enthalpy;
59  Real B1 =
60  std::pow(183.357574154983 * std::sqrt(8405 * h2 - 8208700353 * enthalpy + 9265308922016000) +
61  16810 * enthalpy - 8208700353,
62  1. / 3);
63  return _T_c2k + 0.174216027874564 * (3.65930571002297 * B1 - 2.28699205892461e7 / B1 + 3087);
64 }
65 
66 Real
68 {
69  // NOTE we could also invert analytically the third degree polynomial, see Cardan's method
70  auto lambda = [&](Real p, Real current_T, Real & new_rho, Real & drho_dp, Real & drho_dT)
71  { rho_from_p_T(p, current_T, new_rho, drho_dp, drho_dT); };
73  density,
75  _tolerance,
76  lambda,
77  name() + "::T_from_p_rho",
79  .first;
80  // check for nans
81  if (std::isnan(T))
82  mooseError("Conversion from pressure (p = ",
83  pressure,
84  ") and density (rho = ",
85  density,
86  ") to temperature failed to converge.");
87  return T;
88 }
89 
90 Real
91 NaKFluidProperties::rho_from_p_T(Real /*pressure*/, Real temperature) const
92 {
93  const Real Tc = temperature - _T_c2k;
94  // Range from liquid Na and K density correlation ranges
95  if (Tc < 210 || Tc > 1110)
96  flagInvalidSolution(
97  "NaK density evaluated outside of Na density temperature range [210, 1110] C");
98  if (Tc < 63.2 || Tc > 1250)
99  flagInvalidSolution(
100  "NaK density evaluated outside of K density temperature range [63, 1250] C");
101 
102  // Eq. 1.8 page 18 of NaK handbook
103  const Real v_k = 1. / (0.8415 - 2.172e-4 * Tc - 2.7e-8 * Tc * Tc + 4.77e-12 * Tc * Tc * Tc);
104  // Eq. 1.5 page 15 of NaK handbook
105  const Real v_Na = 1. / (0.9453 - 2.2473e-4 * Tc);
106  // Eq. 1.9 page 15 of NaK handbook
107  return 1000 / (_Nk * v_k + (1 - _Nk) * v_Na);
108 }
109 
110 void
112  Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const
113 {
114  rho = this->rho_from_p_T(pressure, temperature);
115  drho_dp = 0;
116 
117  const Real Tc = temperature - _T_c2k;
118  // Eq. 1.8 page 18 of NaK handbook
119  const Real v_k = 1. / (0.8415 - 2.172e-4 * Tc - 2.7e-8 * Tc * Tc + 4.77e-12 * Tc * Tc * Tc);
120  // Eq. 1.5 page 15 of NaK handbook
121  const Real v_Na = 1. / (0.9453 - 2.2473e-4 * Tc);
122  drho_dT =
123  1000 *
124  -(_Nk * -(-2.172e-4 - 2 * 2.7e-8 * Tc + 3 * 4.77e-12 * Tc * Tc) * MathUtils::pow(v_k, 2) +
125  (1 - _Nk) * 2.2473e-4 * MathUtils::pow(v_Na, 2)) /
126  MathUtils::pow(_Nk * v_k + (1 - _Nk) * v_Na, 2);
127 }
128 
129 Real
131 {
133 }
134 
135 Real
137 {
140 }
141 
142 void
144  Real pressure, Real temperature, Real & e, Real & de_dp, Real & de_dT) const
145 {
146  Real h, dh_dp, dh_dT;
147  h_from_p_T(pressure, temperature, h, dh_dp, dh_dT);
148  Real rho, drho_dp, drho_dT;
149  rho_from_p_T(pressure, temperature, rho, drho_dp, drho_dT);
150 
151  e = h - pressure / rho;
152  de_dp = dh_dp + pressure * drho_dp / rho / rho - 1.0 / rho;
153  de_dT = dh_dT + pressure * drho_dT / rho / rho;
154 }
155 
156 Real
157 NaKFluidProperties::cp_from_p_T(Real /*pressure*/, Real temperature) const
158 {
159  const Real Tc = temperature - _T_c2k;
160  // Eq. 1.59 page 53 of the NaK handbook
161  // converted from cal/g/C
162  return (0.232 - 8.82e-5 * Tc + 8.2e-8 * Tc * Tc) * 4200;
163 }
164 
165 void
167  Real /*pressure*/, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
168 {
169  const Real Tc = temperature - _T_c2k;
170  // Eq. 1.59 page 53 of the NaK handbook
171  // converted from cal/g/C
172  cp = cp_from_p_T(-1, temperature);
173  dcp_dp = 0;
174  dcp_dT = (-8.82e-5 + 2 * 8.2e-8 * Tc) * 4200;
175 }
176 
177 Real
179 {
180  Real e, de_dp, de_dT;
181  e_from_p_T(pressure, temperature, e, de_dp, de_dT);
182  return de_dT;
183 }
184 
185 Real
186 NaKFluidProperties::mu_from_p_T(Real /*pressure*/, Real temperature) const
187 {
188  /* eq. 1.18-19 page 24 of NaK handbook */
189  // No range given
190  // Converted from centipoise
191  const Real rho = rho_from_p_T(-1, temperature) / 1000;
192  if (temperature < _T_c2k + 400)
193  return 0.001 * 0.116 * std::pow(rho, 1 / 3.) * exp(688 * rho / temperature);
194  else
195  return 0.001 * 0.082 * std::pow(rho, 1 / 3.) * exp(979 * rho / temperature);
196 }
197 
198 void
200  Real /*pressure*/, Real temperature, Real & mu, Real & dmu_dp, Real & dmu_dT) const
201 {
202  /* eq. 1.18-19 page 24 of NaK handbook */
203  // No range given
204  // Converted from centipoise
205  Real rho, drho_dp, drho_dT;
206  rho_from_p_T(-1, temperature, rho, drho_dp, drho_dT);
207  rho /= 1000;
208  drho_dT /= 1000;
209  if (temperature < _T_c2k + 400)
210  {
211  mu = 0.001 * 0.116 * std::pow(rho, 1 / 3.) * exp(688 * rho / temperature);
212  dmu_dp = 0;
213  dmu_dT =
214  0.001 * 0.116 * exp(688 * rho / temperature) *
215  (1 / 3. * drho_dT * std::pow(rho, -2 / 3.) +
216  std::pow(rho, 1 / 3.) * 688 * (drho_dT * temperature - rho) / temperature / temperature);
217  }
218  else
219  {
220  mu = 0.001 * 0.082 * std::pow(rho, 1 / 3.) * exp(979 * rho / temperature);
221  dmu_dp = 0;
222  dmu_dT =
223  0.001 * 0.082 * exp(979 * rho / temperature) *
224  (1 / 3. * drho_dT * std::pow(rho, -2 / 3.) +
225  std::pow(rho, 1 / 3.) * 979 * (drho_dT * temperature - rho) / temperature / temperature);
226  }
227 }
228 
229 Real
230 NaKFluidProperties::k_from_p_T(Real /*pressure*/, Real temperature) const
231 {
232  const Real Tc = temperature - _T_c2k;
233  /* eq. 1.53 page 46 handbook */
234  // Note: reported as very sensitive to the composition
235  // Range: 150 - 680 C
236  // Converted from (W/cm-C)
237  if (Tc < 150 || Tc > 680)
238  flagInvalidSolution(
239  "NaK thermal diffusivity evaluated outside of temperature range [150, 680] C");
240  return 100 * (0.214 + 2.07e-4 * Tc - 2.2e-7 * Tc * Tc);
241 }
242 
243 void
245  Real /*pressure*/, Real temperature, Real & k, Real & dk_dp, Real & dk_dT) const
246 {
247  const Real Tc = temperature - _T_c2k;
248  k = k_from_p_T(0, temperature);
249  dk_dp = 0.0;
250  dk_dT = 100 * (2.07e-4 - 2 * 2.2e-7 * Tc);
251 }
252 
253 Real
254 NaKFluidProperties::h_from_p_T(Real /*pressure*/, Real temperature) const
255 {
256  // Integration of cv
257  const Real Tc = temperature - _T_c2k;
258  return (0.232 * Tc - 8.82e-5 / 2 * Tc * Tc + 8.2e-8 / 3 * Tc * Tc * Tc) * 4200;
259 }
260 
261 void
263  Real pressure, Real temperature, Real & h, Real & dh_dp, Real & dh_dT) const
264 {
265  const Real Tc = temperature - _T_c2k;
266  h = (0.232 * Tc - 8.82e-5 / 2 * Tc * Tc + 8.2e-8 / 3 * Tc * Tc * Tc) * 4200;
267  dh_dp = 0;
268  dh_dT = cp_from_p_T(pressure, temperature);
269 }
static InputParameters validParams()
Real T_from_p_rho(Real pressure, Real density) const
NaK fluid properties as a function of pressure (Pa) and temperature (K).
auto exp(const T &)
static InputParameters validParams()
virtual Real k_from_p_T(Real pressure, Real temperature) const override
virtual Real molarMass() const override
Molar mass [kg/mol].
static const std::string density
Definition: NS.h:33
static const std::string temperature
Definition: NS.h:59
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::pair< T, T > NewtonSolve(const T &x, const T &y, const Real z_initial_guess, const Real tolerance, const Functor &func, const std::string &caller_name, const unsigned int max_its=100)
NewtonSolve does a 1D Newton Solve to solve the equation y = f(x, z) for variable z...
static const std::string cp
Definition: NS.h:121
const Real _tolerance
Newton&#39;s method may be used to convert between variable sets.
e e e e s T T T T T rho v v T e h
const Real _MNaK
NaK molar mass (kg/mol)
static const std::string mu
Definition: NS.h:123
Common class for single phase fluid properties.
virtual Real cp_from_p_T(Real pressure, Real temperature) const override
NaKFluidProperties(const InputParameters &parameters)
void paramError(const std::string &param, Args... args) const
virtual Real h_from_p_T(Real pressure, Real temperature) const override
virtual Real T_from_p_h(Real pressure, Real enthalpy) const override
Real _Nk
K molar fraction.
virtual std::string fluidName() const override
Fluid name.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real mu_from_p_T(Real p, Real T) const override
const unsigned int _max_newton_its
Maximum number of iterations for the variable conversion newton solves.
virtual Real e_from_p_T(Real pressure, Real temperature) const override
static const std::string pressure
Definition: NS.h:56
registerMooseObject("FluidPropertiesApp", NaKFluidProperties)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual Real rho_from_p_T(Real pressure, Real temperature) const override
virtual Real e_from_p_rho(Real pressure, Real density) const override
T pow(T x, int e)
const Real _T_initial_guess
Initial guess for temperature (or temperature used to compute the initial guess)
MooseUnits pow(const MooseUnits &, int)
const Real _T_c2k
Conversion of temperature from Celsius to Kelvin.
static const std::string k
Definition: NS.h:130
virtual Real cv_from_p_T(Real pressure, Real temperature) const override