www.mooseframework.org
SimpleFluidProperties.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<SinglePhaseFluidPropertiesPT>();
15  params.addParam<Real>("molar_mass", 1.8E-2, "Constant molar mass of the fluid (kg/mol)");
16  params.addParam<Real>(
17  "thermal_expansion", 2.14E-4, "Constant coefficient of thermal expansion (1/K)");
18  params.addParam<Real>(
19  "cv", 4186.0, "Constant specific heat capacity at constant volume (J/kg/K)");
20  params.addParam<Real>(
21  "cp", 4194.0, "Constant specific heat capacity at constant pressure (J/kg/K)");
22  params.addRangeCheckedParam<Real>(
23  "bulk_modulus", 2.0E9, "bulk_modulus>0", "Constant bulk modulus (Pa)");
24  params.addParam<Real>("thermal_conductivity", 0.6, "Constant thermal conductivity (W/m/K)");
25  params.addParam<Real>("specific_entropy", 300.0, "Constant specific entropy (J/kg/K)");
26  params.addParam<Real>("viscosity", 1.0E-3, "Constant dynamic viscosity (Pa.s)");
27  params.addParam<Real>("density0", 1000.0, "Density at zero pressure and zero temperature");
28  params.addParam<Real>("henry_constant", 0.0, "Henry constant for dissolution in water");
29  params.addParam<Real>("porepressure_coefficient",
30  1.0,
31  "The enthalpy is internal_energy + P / density * "
32  "porepressure_coefficient. Physically this should be 1.0, "
33  "but analytic solutions are simplified when it is zero");
34  params.addClassDescription("Fluid properties for a simple fluid with a constant bulk density");
35  return params;
36 }
37 
38 SimpleFluidProperties::SimpleFluidProperties(const InputParameters & parameters)
39  : SinglePhaseFluidPropertiesPT(parameters),
40  _molar_mass(getParam<Real>("molar_mass")),
41  _thermal_expansion(getParam<Real>("thermal_expansion")),
42  _cv(getParam<Real>("cv")),
43  _cp(getParam<Real>("cp")),
44  _bulk_modulus(getParam<Real>("bulk_modulus")),
45  _thermal_conductivity(getParam<Real>("thermal_conductivity")),
46  _specific_entropy(getParam<Real>("specific_entropy")),
47  _viscosity(getParam<Real>("viscosity")),
48  _density0(getParam<Real>("density0")),
49  _henry_constant(getParam<Real>("henry_constant")),
50  _pp_coeff(getParam<Real>("porepressure_coefficient"))
51 {
52 }
53 
55 
56 std::string
58 {
59  return "simple_fluid";
60 }
61 
62 Real
64 {
65  return _molar_mass;
66 }
67 
68 Real SimpleFluidProperties::beta(Real /*pressure*/, Real /*temperature*/) const
69 {
70  return _thermal_expansion;
71 }
72 
73 Real SimpleFluidProperties::cp(Real /*pressure*/, Real /*temperature*/) const { return _cp; }
74 
75 Real SimpleFluidProperties::cv(Real /*pressure*/, Real /*temperature*/) const { return _cv; }
76 
77 Real
79 {
80  return std::sqrt(_bulk_modulus / rho(pressure, temperature));
81 }
82 
83 Real SimpleFluidProperties::k(Real /*pressure*/, Real /*temperature*/) const
84 {
85  return _thermal_conductivity;
86 }
87 
88 void
90  Real /*pressure*/, Real /*temperature*/, Real & k, Real & dk_dp, Real & dk_dT) const
91 {
93  dk_dp = 0;
94  dk_dT = 0;
95 }
96 
97 Real SimpleFluidProperties::k_from_rho_T(Real /*density*/, Real /*temperature*/) const
98 {
99  return _thermal_conductivity;
100 }
101 
102 Real SimpleFluidProperties::s(Real /*pressure*/, Real /*temperature*/) const
103 {
104  return _specific_entropy;
105 }
106 
107 Real
109 {
110  return _density0 * std::exp(pressure / _bulk_modulus - _thermal_expansion * temperature);
111 }
112 
113 void
115  Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const
116 {
117  rho = this->rho(pressure, temperature);
118  drho_dp = rho / _bulk_modulus;
119  drho_dT = -_thermal_expansion * rho;
120 }
121 
122 Real
123 SimpleFluidProperties::e(Real /*pressure*/, Real temperature) const
124 {
125  return _cv * temperature;
126 }
127 
128 void
130  Real pressure, Real temperature, Real & e, Real & de_dp, Real & de_dT) const
131 {
132  e = this->e(pressure, temperature);
133  de_dp = 0.0;
134  de_dT = _cv;
135 }
136 
137 void
139  Real temperature,
140  Real & rho,
141  Real & drho_dp,
142  Real & drho_dT,
143  Real & e,
144  Real & de_dp,
145  Real & de_dT) const
146 {
147  Real density, ddensity_dp, ddensity_dT;
148  rho_dpT(pressure, temperature, density, ddensity_dp, ddensity_dT);
149  rho = density;
150  drho_dp = ddensity_dp;
151  drho_dT = ddensity_dT;
152 
153  Real energy, denergy_dp, denergy_dT;
154  e_dpT(pressure, temperature, energy, denergy_dp, denergy_dT);
155  e = energy;
156  de_dp = denergy_dp;
157  de_dT = denergy_dT;
158 }
159 
160 Real SimpleFluidProperties::mu(Real /*pressure*/, Real /*temperature*/) const { return _viscosity; }
161 
162 void
164  Real pressure, Real temperature, Real & mu, Real & dmu_dp, Real & dmu_dT) const
165 {
166  mu = this->mu(pressure, temperature);
167  dmu_dp = 0.0;
168  dmu_dT = 0.0;
169 }
170 
171 Real SimpleFluidProperties::mu_from_rho_T(Real /*density*/, Real /*temperature*/) const
172 {
173  return _viscosity;
174 }
175 
176 void
178  Real temperature,
179  Real /*ddensity_dT*/,
180  Real & mu,
181  Real & dmu_drho,
182  Real & dmu_dT) const
183 {
184  mu = this->mu_from_rho_T(density, temperature);
185  dmu_drho = 0.0;
186  dmu_dT = 0.0;
187 }
188 
189 Real
191 {
192  return e(pressure, temperature) + _pp_coeff * pressure / rho(pressure, temperature);
193 }
194 
195 void
197  Real pressure, Real temperature, Real & h, Real & dh_dp, Real & dh_dT) const
198 {
199  h = this->h(pressure, temperature);
200 
201  Real density, ddensity_dp, ddensity_dT;
202  rho_dpT(pressure, temperature, density, ddensity_dp, ddensity_dT);
203 
204  dh_dp = _pp_coeff / density - _pp_coeff * pressure * ddensity_dp / density / density;
205  dh_dT = _cv - _pp_coeff * pressure * ddensity_dT / density / density;
206 }
207 
208 Real SimpleFluidProperties::henryConstant(Real /*temperature*/) const { return _henry_constant; }
209 
210 void
211 SimpleFluidProperties::henryConstant_dT(Real /*temperature*/, Real & Kh, Real & dKh_dT) const
212 {
213  Kh = _henry_constant;
214  dKh_dT = 0.0;
215 }
const Real _thermal_expansion
thermal expansion coefficient
const Real _pp_coeff
Porepressure coefficient: enthalpy = internal_energy + porepressure / density * _pp_coeff.
virtual Real beta(Real pressure, Real temperature) const override
Thermal expansion coefficient (1/K)
virtual Real mu(Real pressure, Real temperature) const override
virtual Real e(Real pressure, Real temperature) const override
Internal energy from pressure and temperature (J/kg)
virtual Real henryConstant(Real temperature) const override
Henry&#39;s law constant for dissolution in water.
virtual Real cp(Real pressure, Real temperature) const override
Isobaric specific heat capacity (J/kg/K)
const Real _cv
specific heat at constant volume
const Real _specific_entropy
specific entropy
const Real _viscosity
viscosity
virtual Real molarMass() const override
Molar mass (kg/mol)
virtual void e_dpT(Real pressure, Real temperature, Real &e, Real &de_dp, Real &de_dT) const override
Internal energy and its derivatives wrt pressure and temperature.
virtual Real k_from_rho_T(Real density, Real temperature) const override
Thermal conductivity (W/m/K)
virtual void k_dpT(Real pressure, Real temperature, Real &k, Real &dk_dp, Real &dk_dT) const override
Thermal conductivity and its derivatives wrt pressure and temperature.
virtual Real rho(Real pressure, Real temperature) const override
Density from pressure and temperature (kg/m^3)
const Real _bulk_modulus
bulk modulus
virtual void rho_e_dpT(Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT, Real &e, Real &de_dp, Real &de_dT) const override
Density and internal energy from pressure and temperature and derivatives wrt pressure and temperatur...
const std::string density
Definition: NS.h:15
const Real _henry_constant
Henry constant.
const std::string temperature
Definition: NS.h:25
const Real _molar_mass
molar mass
virtual Real h(Real p, Real T) const override
Specific enthalpy (J/kg)
const Real _density0
density at zero pressure and temperature
Common class for single phase fluid properties using a pressure and temperature formulation.
InputParameters validParams< SinglePhaseFluidPropertiesPT >()
const Real _thermal_conductivity
thermal conductivity
virtual void rho_dpT(Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT) const override
Density from pressure and temperature and its derivatives wrt pressure and temperature.
virtual Real cv(Real pressure, Real temperature) const override
Isochoric specific heat capacity (J/kg/K)
virtual Real k(Real pressure, Real temperature) const override
Thermal conductivity (W/m/K)
virtual Real mu_from_rho_T(Real density, Real temperature) const override
Dynamic viscosity (Pa s)
virtual Real s(Real pressure, Real temperature) const override
Specific entropy (J/kg/K)
virtual std::string fluidName() const override
Fluid name.
virtual Real c(Real pressure, Real temperature) const override
Speed of sound (m/s)
virtual void henryConstant_dT(Real temperature, Real &Kh, Real &dKh_dT) const override
Henry&#39;s law constant for dissolution in water and derivative wrt temperature.
const std::string pressure
Definition: NS.h:24
virtual void mu_dpT(Real pressure, Real temperature, Real &mu, Real &dmu_dp, Real &dmu_dT) const override
virtual void h_dpT(Real pressure, Real temperature, Real &h, Real &dh_dp, Real &dh_dT) const override
Specific enthalpy and its derivatives.
virtual void mu_drhoT_from_rho_T(Real density, Real temperature, Real ddensity_dT, Real &mu, Real &dmu_drho, Real &dmu_dT) const override
Dynamic viscosity and its derivatives wrt density and temperature.
InputParameters validParams< SimpleFluidProperties >()
SimpleFluidProperties(const InputParameters &parameters)
const Real _cp
specific heat at constant pressure