https://mooseframework.inl.gov
FluidProperties3EqnMaterial.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 
12 #include "Numerics.h"
13 
14 registerMooseObject("ThermalHydraulicsApp", FluidProperties3EqnMaterial);
15 
18 {
20 
21  params.addRequiredCoupledVar("A", "Cross-sectional area");
22  params.addRequiredCoupledVar("rhoA", "Conserved density");
23  params.addRequiredCoupledVar("rhouA", "Conserved momentum");
24  params.addRequiredCoupledVar("rhoEA", "Conserved total energy");
25 
26  params.addRequiredParam<UserObjectName>("fp", "The name of the user object for fluid properties");
27  params.addClassDescription(
28  "Defines material properties from fluid properties to serve in the 3-equation model");
29 
30  return params;
31 }
32 
35  _area(coupledValue("A")),
36  _rhoA(coupledValue("rhoA")),
37  _rhouA(coupledValue("rhouA")),
38  _rhoEA(coupledValue("rhoEA")),
39 
40  _rho(declareProperty<Real>("rho")),
41  _drho_drhoA(declarePropertyDerivativeTHM<Real>("rho", "rhoA")),
42 
43  _v(declareProperty<Real>("v")),
44  _dv_drhoA(declarePropertyDerivativeTHM<Real>("v", "rhoA")),
45 
46  _vel(declareProperty<Real>("vel")),
47  _dvel_drhoA(declarePropertyDerivativeTHM<Real>("vel", "rhoA")),
48  _dvel_drhouA(declarePropertyDerivativeTHM<Real>("vel", "rhouA")),
49 
50  _e(declareProperty<Real>("e")),
51  _de_drhoA(declarePropertyDerivativeTHM<Real>("e", "rhoA")),
52  _de_drhouA(declarePropertyDerivativeTHM<Real>("e", "rhouA")),
53  _de_drhoEA(declarePropertyDerivativeTHM<Real>("e", "rhoEA")),
54 
55  _p(declareProperty<Real>("p")),
56  _dp_drhoA(declarePropertyDerivativeTHM<Real>("p", "rhoA")),
57  _dp_drhouA(declarePropertyDerivativeTHM<Real>("p", "rhouA")),
58  _dp_drhoEA(declarePropertyDerivativeTHM<Real>("p", "rhoEA")),
59 
60  _T(declareProperty<Real>("T")),
61  _dT_drhoA(declarePropertyDerivativeTHM<Real>("T", "rhoA")),
62  _dT_drhouA(declarePropertyDerivativeTHM<Real>("T", "rhouA")),
63  _dT_drhoEA(declarePropertyDerivativeTHM<Real>("T", "rhoEA")),
64 
65  _h(declareProperty<Real>("h")),
66  _dh_drhoA(declarePropertyDerivativeTHM<Real>("h", "rhoA")),
67  _dh_drhouA(declarePropertyDerivativeTHM<Real>("h", "rhouA")),
68  _dh_drhoEA(declarePropertyDerivativeTHM<Real>("h", "rhoEA")),
69 
70  _H(declareProperty<Real>("H")),
71  _dH_drhoA(declarePropertyDerivativeTHM<Real>("H", "rhoA")),
72  _dH_drhouA(declarePropertyDerivativeTHM<Real>("H", "rhouA")),
73  _dH_drhoEA(declarePropertyDerivativeTHM<Real>("H", "rhoEA")),
74 
75  _c(declareProperty<Real>("c")),
76 
77  _cp(declareProperty<Real>("cp")),
78 
79  _cv(declareProperty<Real>("cv")),
80 
81  _k(declareProperty<Real>("k")),
82 
83  _fp(getUserObject<SinglePhaseFluidProperties>("fp"))
84 {
85 }
86 
87 void
89 {
90  _rho[_qp] = _rhoA[_qp] / _area[_qp];
91  _drho_drhoA[_qp] = 1.0 / _area[_qp];
92 
93  _v[_qp] = 1.0 / _rho[_qp];
95 
98 
99  _e[_qp] = (_rhoEA[_qp] - 0.5 * _rhouA[_qp] * _rhouA[_qp] / _rhoA[_qp]) / _rhoA[_qp];
103 
104  _p[_qp] = _fp.p_from_v_e(_v[_qp], _e[_qp]);
105  Real p, dp_dv, dp_de;
106  _fp.p_from_v_e(_v[_qp], _e[_qp], p, dp_dv, dp_de);
107 
108  _T[_qp] = _fp.T_from_v_e(_v[_qp], _e[_qp]);
109  Real T, dT_dv, dT_de;
110  _fp.T_from_v_e(_v[_qp], _e[_qp], T, dT_dv, dT_de);
111 
112  _dp_drhoA[_qp] = dp_dv * _dv_drhoA[_qp] + dp_de * _de_drhoA[_qp];
113  _dp_drhouA[_qp] = dp_de * _de_drhouA[_qp];
114 
115  _dT_drhoA[_qp] = dT_dv * _dv_drhoA[_qp] + dT_de * _de_drhoA[_qp];
116  _dT_drhouA[_qp] = dT_de * _de_drhouA[_qp];
117 
118  _dp_drhoEA[_qp] = dp_de * _de_drhoEA[_qp];
119  _dT_drhoEA[_qp] = dT_de * _de_drhoEA[_qp];
120 
121  _h[_qp] = _e[_qp] + _p[_qp] / _rho[_qp];
122  const Real dh_de = 1;
123  const Real dh_dp = 1.0 / _rho[_qp];
124  const Real dh_drho = -_p[_qp] / _rho[_qp] / _rho[_qp];
125  _dh_drhoA[_qp] = dh_de * _de_drhoA[_qp] + dh_dp * _dp_drhoA[_qp] + dh_drho * _drho_drhoA[_qp];
126  _dh_drhouA[_qp] = dh_de * _de_drhouA[_qp] + dh_dp * _dp_drhouA[_qp];
127  _dh_drhoEA[_qp] = dh_de * _de_drhoEA[_qp] + dh_dp * _dp_drhoEA[_qp];
128 
129  _H[_qp] = _h[_qp] + 0.5 * _vel[_qp] * _vel[_qp];
133 
134  _c[_qp] = _fp.c_from_v_e(_v[_qp], _e[_qp]);
135  _cp[_qp] = _fp.cp_from_v_e(_v[_qp], _e[_qp]);
136  _cv[_qp] = _fp.cv_from_v_e(_v[_qp], _e[_qp]);
137  _k[_qp] = _fp.k_from_v_e(_v[_qp], _e[_qp]);
138 }
MaterialProperty< Real > & _v
Specific volume.
MaterialProperty< Real > & _dH_drhouA
MaterialProperty< Real > & _dH_drhoEA
MaterialProperty< Real > & _dT_drhouA
MaterialProperty< Real > & _dT_drhoEA
Real de_darhoA(Real arhoA, Real arhouA, Real arhoEA)
Derivative of specific internal energy wrt density of the phase (rhoA or arhoA)
Definition: Numerics.C:181
MaterialProperty< Real > & _drho_drhoA
Real de_darhoEA(Real arhoA)
Derivative of specific internal energy wrt total energy of the phase (rhoEA or arhoEA) ...
Definition: Numerics.C:193
MaterialProperty< Real > & _vel
Velocity.
MaterialProperty< Real > & _de_drhoEA
MaterialProperty< Real > & _H
Specific total (stagnation) enthalpy.
Computes velocity and thermodynamic variables from solution variables for 1-phase flow...
MaterialProperty< Real > & _dT_drhoA
MaterialProperty< Real > & _h
Specific enthalpy.
registerMooseObject("ThermalHydraulicsApp", FluidProperties3EqnMaterial)
Real dv_darhoA(Real area, Real arhoA)
Derivative of specific volume wrt density equation solution variable.
Definition: Numerics.C:141
MaterialProperty< Real > & _dvel_drhoA
MaterialProperty< Real > & _c
Sound speed.
void vel_from_arhoA_arhouA(Real arhoA, Real arhouA, Real &vel, Real &dvel_darhoA, Real &dvel_darhouA)
Computes velocity and its derivatives from alpha*rho*A and alpha*rho*u*A.
Definition: Numerics.C:58
const SinglePhaseFluidProperties & _fp
Fluid properties.
void addRequiredParam(const std::string &name, const std::string &doc_string)
MaterialProperty< Real > & _rho
Density.
MaterialProperty< Real > & _dp_drhoEA
const VariableValue & _area
Cross-sectional area.
MaterialProperty< Real > & _dv_drhoA
MaterialProperty< Real > & _de_drhouA
MaterialProperty< Real > & _cp
Constant-pressure specific heat.
static InputParameters validParams()
MaterialProperty< Real > & _T
Temperature.
MaterialProperty< Real > & _cv
Constant-volume specific heat.
Real de_darhouA(Real arhoA, Real arhouA)
Derivative of specific internal energy wrt momentum of the phase (rhouA or arhouA) ...
Definition: Numerics.C:187
FluidProperties3EqnMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _p
Pressure.
Common class for single phase fluid properties.
MaterialProperty< Real > & _k
Thermal conductivity.
MaterialProperty< Real > & _dH_drhoA
MaterialProperty< Real > & _dp_drhouA
MaterialProperty< Real > & _dh_drhouA
MaterialProperty< Real > & _dh_drhoEA
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
MaterialProperty< Real > & _dp_drhoA
MaterialProperty< Real > & _e
Specific internal energy.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialProperty< Real > & _de_drhoA
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
MaterialProperty< Real > & _dh_drhoA
MaterialProperty< Real > & _dvel_drhouA