20 "k",
"Thermal conductivity function of temperature and pressure [W/(m-K)]");
22 "Density function of temperature and pressure [kg/m^3]");
24 "mu",
"Dynamic viscosity function of temperature and pressure [Pa-s]");
27 "cp",
"Isobaric specific heat function of temperature and pressure [J/(kg-K)]");
29 "cv", 0,
"cv >= 0",
"Constant isochoric specific heat [J/(kg-K)]");
30 params.
addParam<
Real>(
"e_ref", 0,
"Specific internal energy at the reference temperature");
31 params.
addParam<
Real>(
"T_ref", 0,
"Reference temperature for the specific internal energy");
34 "Size of intervals for integrating cv(T) to compute e(T) from e(T_ref)");
37 "Single-phase fluid properties that allows to provide thermal " 38 "conductivity, density, and viscosity as functions of temperature and pressure.");
46 _cv(getParam<
Real>(
"cv")),
47 _cv_is_constant(_cv != 0),
48 _e_ref(getParam<
Real>(
"e_ref")),
49 _T_ref(getParam<
Real>(
"T_ref")),
50 _integration_dT(getParam<
Real>(
"dT_integration_intervals"))
53 paramError(
"cp",
"The parameter 'cp' may only be specified if 'cv' is unspecified or is zero.");
69 return "TemperaturePressureFunctionFluidProperties";
82 bool conversion_succeeded =
true;
84 if (conversion_succeeded)
103 ") and enthalpy (h = ",
105 ") to temperature failed to converge.");
121 ") and density (rho = ",
123 ") to temperature failed to converge.");
141 bool conversion_succeeded =
true;
143 if (conversion_succeeded)
146 mooseError(
"cp_from_v_e calculation failed. p= ",
p,
" T = ",
T);
152 Real
v, Real e, Real &
cp, Real & dcp_dv, Real & dcp_de)
const 158 dcp_dv = (cp_pert -
cp) /
eps /
v;
160 dcp_de = (cp_pert -
cp) /
eps / e;
173 bool conversion_succeeded =
true;
175 if (conversion_succeeded)
178 mooseError(
"cp_from_v_e calculation failed.");
184 Real
v, Real e, Real &
cv, Real & dcv_dv, Real & dcv_de)
const 197 bool conversion_succeeded =
true;
201 if (!conversion_succeeded)
202 mooseError(
"cp_from_v_e and derivatives calculation failed.");
205 p_T_from_v_e(
v * (1 + 1e-6), e, p0, T0, p1, T1, conversion_succeeded);
206 Real dp_dv = (p1 -
p) / (
v * 1e-6);
207 Real dT_dv = (T1 -
T) / (
v * 1e-6);
208 if (!conversion_succeeded)
209 mooseError(
"cp_from_v_e and derivatives calculation failed.");
212 p_T_from_v_e(
v, e * (1 + 1e-6), p0, T0, p2, T2, conversion_succeeded);
213 Real dp_de = (p2 -
p) / (e * 1e-6);
214 Real dT_de = (T2 -
T) / (e * 1e-6);
215 if (!conversion_succeeded)
216 mooseError(
"cp_from_v_e and derivatives calculation failed.");
218 dcv_dv = dcv_dp * dp_dv + dcv_dT * dT_dv;
219 dcv_de = dcv_dp * dp_de + dcv_dT * dT_de;
235 mooseError(
"Conversion from specific volume (v = ",
237 ") and specific energy (e = ",
239 ") to pressure failed to converge.");
257 bool conversion_succeeded =
true;
259 if (conversion_succeeded)
262 mooseError(
"mu_from_v_e calculation failed.");
280 bool conversion_succeeded =
true;
282 if (conversion_succeeded)
303 drho_dT = grad_function(0);
304 drho_dp = grad_function(1);
317 drho_dT = grad_function(0);
318 drho_dp = grad_function(1);
336 dv_dp = -
v *
v * drho_dp;
337 dv_dT = -
v *
v * drho_dT;
352 Real e, de_dp, de_dT;
395 de_dp = (ep - e) / (
pressure * 1e-8);
420 return -drho_dT /
rho;
461 dcp_dT = grad_function(0);
462 dcp_dp = grad_function(1);
517 dmu_dT = grad_function(0);
518 dmu_dp = grad_function(1);
535 dk_dT = grad_function(0);
536 dk_dp = grad_function(1);
e e e e s T T T T T rho T
virtual Real beta_from_p_T(Real p, Real T) const override
Thermal expansion coefficient from pressure and temperature.
static const std::string cv
const Function * _k_function
function defining thermal conductivity as a function of temperature and pressure
virtual Real mu_from_v_e(Real v, Real e) const override
Dynamic viscosity from specific volume and specific internal energy.
const Function * _cp_function
function defining specific heat as a function of temperature and pressure
static InputParameters validParams()
const Function & getFunction(const std::string &name) const
virtual Real mu_from_p_T(Real p, Real T) const override
Dynamic viscosity from pressure and temperature.
Fluid properties provided as multiple-variable functions of temperature and pressure.
static const std::string temperature
bool _initialized
whether the object is initialized, eg, the functions have been retrieved from the problem ...
DualNumber< Real, DNDerivativeType, true > ADReal
virtual Real e_from_p_rho(Real p, Real rho) const override
Specific internal energy from pressure and density.
virtual const std::string & name() const
virtual Real T_from_p_rho(Real p, Real rho) const
Temperature from pressure and density.
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...
const Real _cv
constant isochoric specific heat
void p_T_from_v_e(const CppType &v, const CppType &e, Real p0, Real T0, CppType &p, CppType &T, bool &conversion_succeeded) const
Determines (p,T) from (v,e) using Newton Solve in 2D Useful for conversion between different sets of ...
virtual Real k_from_p_T(Real p, Real T) const override
Thermal conductivity from pressure and temperature.
bool isParamValid(const std::string &name) const
virtual std::string fluidName() const override
Fluid name.
static const std::string cp
const Real _tolerance
Newton'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
virtual Real T_from_v_e(Real v, Real e) const override
Temperature from specific volume and specific internal energy.
virtual Real cv_from_p_T(Real p, Real T) const override
Isochoric specific heat capacity from pressure and temperature.
void initialSetup() override
Functions are constructed after fluid properties, so we delay the getting of the Function.
static const std::string mu
Common class for single phase fluid properties.
void paramError(const std::string ¶m, Args... args) const
TemperaturePressureFunctionFluidProperties(const InputParameters ¶meters)
virtual Real rho_from_p_T(Real p, Real T) const override
Density from pressure and temperature.
const Real _T_ref
Reference temperature for the reference specific energy.
registerMooseObject("FluidPropertiesApp", TemperaturePressureFunctionFluidProperties)
virtual Real T_from_p_h(Real p, Real h) const override
Temperature from pressure and specific enthalpy.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
const Real _integration_dT
Size of temperature intervals when integrating the specific heat to compute the specific energy...
static const std::string alpha
virtual Real k_from_v_e(Real v, Real e) const override
Thermal conductivity from specific volume and specific internal energy.
const unsigned int _max_newton_its
Maximum number of iterations for the variable conversion newton solves.
static const std::string pressure
virtual Real h_from_p_T(Real p, Real T) const override
Specific enthalpy from pressure and temperature.
const Function * _rho_function
function defining density as a function of temperature and pressure
const Real _p_initial_guess
Initial guess for pressure (or pressure used to compute the initial guess)
IntRange< T > make_range(T beg, T end)
virtual RealGradient gradient(Real t, const Point &p) const
void mooseError(Args &&... args) const
virtual Real cp_from_p_T(Real p, Real T) const override
Isobaric specific heat capacity from pressure and temperature.
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_T(Real p, Real T) const override
Specific internal energy from pressure and temperature.
virtual Real value(Real t, const Point &p) const
virtual Real v_from_p_T(Real p, Real T) const override
Specific volume from pressure and temperature.
const bool _cv_is_constant
whether a constant isochoric specific heat is used
const Function * _mu_function
function defining dynamic viscosity as a function of temperature and pressure
const Real _T_initial_guess
Initial guess for temperature (or temperature used to compute the initial guess)
virtual Real cp_from_v_e(Real v, Real e) const override
Isobaric specific heat from specific volume and specific internal energy.
static const std::string k
const Real _e_ref
Reference specific energy.
static InputParameters validParams()
virtual Real cv_from_v_e(Real v, Real e) const override
Isochoric specific heat from specific volume and specific internal energy.