www.mooseframework.org
SodiumProperties.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "FluidProperties.h"
13 
19 {
20 
21 public:
23 
25 
31  template <typename T>
32  T k(T temperature) const
33  {
34  if (_k)
35  return _k;
36 
37  const T temperature2 = temperature * temperature;
38  const T temperature3 = temperature2 * temperature;
39  return 124.67 - 0.11381 * temperature + 5.5226e-5 * temperature2 - 1.1842e-8 * temperature3;
40  }
41 
48  template <typename T>
49  T h(T temperature) const
50  {
51  const T temperature2 = temperature * temperature;
52  const T temperature3 = temperature2 * temperature;
53 
54  // Converted from kJ/kg to J/kg.
55  return -365.77e3 + 1.6582e3 * temperature - 4.2395e-1 * temperature2 +
56  1.4847e-4 * temperature3 + 2992.6e3 / temperature;
57  }
58 
65  template <typename T>
67  {
68  if (_cp)
69  return _cp;
70 
71  const T temperature2 = temperature * temperature;
72 
73  // Converted from kJ/kg-K to J/kg-K.
74  return 1.6582e3 - 8.4790e-1 * temperature + 4.4541e-4 * temperature2 - 2992.6e3 / temperature2;
75  }
76 
82  template <typename T>
83  T temperature(T enthalpy) const
84  {
85  // Estimate initial guess from linear part of enthalpy.
86  T temperature = (enthalpy + 365.77e3) / 1.6582e3;
87 
88  // Newton-Raphson for this equation: enthalpy(T) - enthalpy = 0 = residual. This is easy because
89  // dResidual/dT is just dH/dT, which is heat capacity.
90  for (unsigned iteration = 0; iteration < 10; ++iteration)
91  {
92  const T residual = h(temperature) - enthalpy;
93  temperature -= residual / heatCapacity(temperature);
94  if (std::abs(residual / enthalpy) < 1e-6)
95  break;
96  }
97  // If we get here, enthalpy is probably out of bounds. However, due to the nature of the JFNK
98  // calculation, we probably just want to ignore the error and spit out a bogus T so that the
99  // solver keeps rolling.
100  return temperature;
101  }
102 
108  template <typename T>
109  T rho(T temperature) const
110  {
111  const T rhoc = 219.0; // kg/m^3
112  const T f = 275.32;
113  const T g = 511.58;
114  const T Tc = 2503.7; // critical temperature, K
115  mooseAssert(temperature < Tc, "Temperature is greater than critical temperature 2503.7 K ");
116 
117  return rhoc + f * (1.0 - temperature / Tc) + g * std::sqrt(1.0 - temperature / Tc);
118  }
119 
125  template <typename T>
126  T drho_dT(T temperature) const
127  {
128  const T f = 275.32;
129  const T g = 511.58;
130  const T Tc = 2503.7; // critical temperature, K
131  mooseAssert(temperature < Tc, "Temperature is greater than critical temperature 2503.7 K ");
132 
133  return -(f + g * 0.5 / std::sqrt(1.0 - temperature / Tc)) / Tc;
134  }
135 
141  template <typename T>
142  T drho_dh(T enthalpy) const
143  {
144  const T temperature = this->temperature(enthalpy);
146  }
147 
148 private:
150  const Real _k;
151 
153  const Real _cp;
154 };
T h(T temperature) const
Enthalpy of liquid Na (relative to solid Na at STP) in J/kg as a function of temperature From page 4...
const Real _cp
Optional specific heat from input parameters.
T heatCapacity(T temperature) const
Heat capacity of liquid Na in J/kg-K as a function of temperature.
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
SodiumProperties(const InputParameters &parameters)
Real f(Real x)
Test function for Brents method.
T temperature(T enthalpy) const
Inverse solve for temperature from enthalpy.
T k(T temperature) const
Thermal conductivity as a function of temperature.
Properties of liquid sodium from ANL/RE-95/2 report "Thermodynamic and Transport Properties of Sodium...
T drho_dh(T enthalpy) const
Derivative of density w.r.t enthalpy.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _k
Optional thermal conductivity from input parameters.
const InputParameters & parameters() const
static InputParameters validParams()
T drho_dT(T temperature) const
Derivative of density w.r.t temperature.
T rho(T temperature) const
Density as a function of temperature.