www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
IdealGasFluidProperties Class Reference

Ideal gas fluid properties. More...

#include <IdealGasFluidProperties.h>

Inheritance diagram for IdealGasFluidProperties:
[legend]

Public Member Functions

 IdealGasFluidProperties (const InputParameters &parameters)
 
virtual ~IdealGasFluidProperties ()
 
virtual Real pressure (Real v, Real u) const override
 Pressure as a function of specific internal energy and specific volume. More...
 
virtual Real temperature (Real v, Real u) const override
 Temperature as a function of specific internal energy and specific volume. More...
 
virtual Real c (Real v, Real u) const override
 Sound speed. More...
 
virtual Real cp (Real v=0., Real u=0.) const override
 Specific heat. More...
 
virtual Real cv (Real v=0., Real u=0.) const override
 Isochoric specific heat. More...
 
virtual Real gamma (Real v=0., Real u=0.) const override
 Compute the ratio of specific heats. More...
 
virtual Real mu (Real v, Real u) const override
 Dynamic viscosity [Pa s]. More...
 
virtual Real k (Real v, Real u) const override
 Thermal conductivity [W / m K]. More...
 
virtual Real s (Real v, Real u) const override
 Specific entropy [ J / kg K ]. More...
 
virtual void s_from_h_p (Real h, Real p, Real &s, Real &ds_dh, Real &ds_dp) const override
 Specific entropy from enthalpy and pressure. More...
 
virtual void dp_duv (Real v, Real u, Real &dp_dv, Real &dp_du, Real &dT_dv, Real &dT_du) const override
 The derivative of pressure wrt specific volume and specific internal energy. More...
 
virtual void rho_e_ps (Real pressure, Real entropy, Real &rho, Real &e) const override
 Compute internal energy and density from specific entropy and pressure. More...
 
virtual void rho_e_dps (Real pressure, Real entropy, Real &rho, Real &drho_dp, Real &drho_ds, Real &e, Real &de_dp, Real &de_ds) const override
 
virtual Real beta (Real p, Real T) const override
 Thermal expansion coefficient. More...
 
virtual void rho_e (Real pressure, Real temperature, Real &rho, Real &e) const override
 Computes density and internal energy from pressure and temperature. More...
 
virtual Real rho (Real pressure, Real temperature) const override
 Computes density from pressure and temperature. More...
 
virtual void rho_dpT (Real pressure, Real temperature, Real &rho, Real &drho_dp, Real &drho_dT) const override
 Computes density from pressure and temperature and its derivatives w.r.t pressure and temperature. More...
 
virtual void e_dpT (Real pressure, Real temperature, Real &e, Real &de_dp, Real &de_dT) const
 
virtual Real e (Real pressure, Real rho) const override
 Computes internal energy from pressure and density. More...
 
virtual void e_dprho (Real pressure, Real rho, Real &e, Real &de_dp, Real &de_drho) const override
 Computes internal energy and its derivatives of internal energy w.r.t. pressure and density. More...
 
virtual Real h (Real pressure, Real temperature) const override
 Computes specific enthalpy. More...
 
virtual void h_dpT (Real pressure, Real temperature, Real &h, Real &dh_dp, Real &dh_dT) const override
 Compute enthalpy and its derivatives. More...
 
virtual Real p_from_h_s (Real h, Real s) const override
 Pressure as a function of specific enthalpy and specific entropy. More...
 
virtual Real dpdh_from_h_s (Real h, Real s) const override
 Derivative of pressure wrt specific enthalpy. More...
 
virtual Real dpds_from_h_s (Real h, Real s) const override
 Derivative of pressure wrt specific entropy. More...
 
virtual Real g (Real v, Real e) const override
 Gibbs free energy. More...
 
virtual void execute () final
 
virtual void initialize () final
 
virtual void finalize () final
 

Protected Attributes

Real _gamma
 
Real _R
 
Real _cv
 
Real _cp
 
Real _beta
 
Real _mu
 
Real _k
 

Detailed Description

Ideal gas fluid properties.

Definition at line 21 of file IdealGasFluidProperties.h.

Constructor & Destructor Documentation

IdealGasFluidProperties::IdealGasFluidProperties ( const InputParameters &  parameters)

Definition at line 24 of file IdealGasFluidProperties.C.

25  : SinglePhaseFluidProperties(parameters),
26  _gamma(getParam<Real>("gamma")),
27  _R(getParam<Real>("R")),
28  _beta(getParam<Real>("beta")),
29  _mu(getParam<Real>("mu")),
30  _k(getParam<Real>("k"))
31 {
32  _cp = _gamma * _R / (_gamma - 1.0);
33  _cv = _cp / _gamma;
34 }
SinglePhaseFluidProperties(const InputParameters &parameters)
IdealGasFluidProperties::~IdealGasFluidProperties ( )
virtual

Definition at line 36 of file IdealGasFluidProperties.C.

36 {}

Member Function Documentation

Real IdealGasFluidProperties::beta ( Real  p,
Real  T 
) const
overridevirtual

Thermal expansion coefficient.

Implements SinglePhaseFluidProperties.

Definition at line 114 of file IdealGasFluidProperties.C.

Real IdealGasFluidProperties::c ( Real  v,
Real  u 
) const
overridevirtual

Sound speed.

Implements SinglePhaseFluidProperties.

Definition at line 56 of file IdealGasFluidProperties.C.

Referenced by NSMachAux::computeValue(), and NSInitialCondition::value().

57 {
58  Real temp = temperature(v, u);
59  // The std::max function serves as a hard limiter, which will guarantee non-negative speed of
60  // sound when resolving strongly nonlinear waves
61  return std::sqrt(std::max(1.0e-8, _gamma * _R * temp));
62 }
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
Real IdealGasFluidProperties::cp ( Real  v = 0.,
Real  u = 0. 
) const
overridevirtual
Real IdealGasFluidProperties::cv ( Real  v = 0.,
Real  u = 0. 
) const
overridevirtual
void IdealGasFluidProperties::dp_duv ( Real  v,
Real  u,
Real &  dp_dv,
Real &  dp_du,
Real &  dT_dv,
Real &  dT_du 
) const
overridevirtual

The derivative of pressure wrt specific volume and specific internal energy.

Implements SinglePhaseFluidProperties.

Definition at line 93 of file IdealGasFluidProperties.C.

95 {
96  dp_dv = -(_gamma - 1.0) * u / v / v;
97  dp_du = (_gamma - 1.0) / v;
98  dT_dv = 0.0;
99  dT_du = 1.0 / _cv;
100 }
Real IdealGasFluidProperties::dpdh_from_h_s ( Real  h,
Real  s 
) const
overridevirtual

Derivative of pressure wrt specific enthalpy.

Implements SinglePhaseFluidProperties.

Definition at line 193 of file IdealGasFluidProperties.C.

194 {
195  mooseError(name(), ": dpdh_from_h_s() not implemented.");
196 }
Real IdealGasFluidProperties::dpds_from_h_s ( Real  h,
Real  s 
) const
overridevirtual

Derivative of pressure wrt specific entropy.

Implements SinglePhaseFluidProperties.

Definition at line 198 of file IdealGasFluidProperties.C.

199 {
200  mooseError(name(), ": dpds_from_h_s() not implemented.");
201 }
Real IdealGasFluidProperties::e ( Real  pressure,
Real  rho 
) const
overridevirtual

Computes internal energy from pressure and density.

Implements SinglePhaseFluidProperties.

Definition at line 156 of file IdealGasFluidProperties.C.

Referenced by c(), e_dprho(), h(), and pressure().

157 {
158  return pressure / (_gamma - 1.0) / rho;
159 }
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::e_dprho ( Real  pressure,
Real  rho,
Real &  e,
Real &  de_dp,
Real &  de_drho 
) const
overridevirtual

Computes internal energy and its derivatives of internal energy w.r.t. pressure and density.

Implements SinglePhaseFluidProperties.

Definition at line 162 of file IdealGasFluidProperties.C.

164 {
165  e = this->e(pressure, rho);
166  de_dp = 1.0 / (_gamma - 1.0) / rho;
167  de_drho = -pressure / (_gamma - 1.0) / rho / rho;
168 }
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::e_dpT ( Real  pressure,
Real  temperature,
Real &  e,
Real &  de_dp,
Real &  de_dT 
) const
virtual

Definition at line 148 of file IdealGasFluidProperties.C.

149 {
150  e = temperature * _cv;
151  de_dp = 0.0;
152  de_dT = _cv;
153 }
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual void FluidProperties::execute ( )
inlinefinalvirtualinherited

Definition at line 25 of file FluidProperties.h.

25 {}
virtual void FluidProperties::finalize ( )
inlinefinalvirtualinherited

Definition at line 27 of file FluidProperties.h.

27 {}
Real IdealGasFluidProperties::g ( Real  v,
Real  e 
) const
overridevirtual

Gibbs free energy.

Implements SinglePhaseFluidProperties.

Definition at line 204 of file IdealGasFluidProperties.C.

205 {
206  // g(p,T) for SGEOS is given by Equation (37) in the following reference:
207  //
208  // Ray A. Berry, Richard Saurel, Olivier LeMetayer
209  // The discrete equation method (DEM) for fully compressible, two-phase flows in
210  // ducts of spatially varying cross-section
211  // Nuclear Engineering and Design 240 (2010) p. 3797-3818
212  //
213  const Real p = pressure(v, e);
214  const Real T = temperature(v, e);
215 
216  return _gamma * _cv * T - _cv * T * std::log(std::pow(T, _gamma) / std::pow(p, _gamma - 1.0));
217 }
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
Real IdealGasFluidProperties::gamma ( Real  v = 0.,
Real  u = 0. 
) const
overridevirtual
Real IdealGasFluidProperties::h ( Real  p,
Real  T 
) const
overridevirtual

Computes specific enthalpy.

Implements SinglePhaseFluidProperties.

Definition at line 171 of file IdealGasFluidProperties.C.

Referenced by h_dpT().

172 {
173  Real rho = this->rho(pressure, temperature);
174  Real e = temperature * _cv;
175  return e + pressure / rho;
176 }
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::h_dpT ( Real  pressure,
Real  temperature,
Real &  h,
Real &  dh_dp,
Real &  dh_dT 
) const
overridevirtual

Compute enthalpy and its derivatives.

Implements SinglePhaseFluidProperties.

Definition at line 179 of file IdealGasFluidProperties.C.

181 {
182  h = this->h(pressure, temperature);
183  Real rho = this->rho(pressure, temperature);
184  dh_dp = 0.0;
185  dh_dT = _cv + pressure / rho / temperature;
186 }
virtual Real h(Real pressure, Real temperature) const override
Computes specific enthalpy.
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
virtual void FluidProperties::initialize ( )
inlinefinalvirtualinherited

Definition at line 26 of file FluidProperties.h.

26 {}
Real IdealGasFluidProperties::k ( Real  v,
Real  u 
) const
overridevirtual

Thermal conductivity [W / m K].

Implements SinglePhaseFluidProperties.

Definition at line 72 of file IdealGasFluidProperties.C.

Real IdealGasFluidProperties::mu ( Real  v,
Real  u 
) const
overridevirtual

Dynamic viscosity [Pa s].

Implements SinglePhaseFluidProperties.

Definition at line 70 of file IdealGasFluidProperties.C.

Real IdealGasFluidProperties::p_from_h_s ( Real  h,
Real  s 
) const
overridevirtual

Pressure as a function of specific enthalpy and specific entropy.

Implements SinglePhaseFluidProperties.

Definition at line 188 of file IdealGasFluidProperties.C.

189 {
190  mooseError(name(), ": p_from_h_s() not implemented.");
191 }
Real IdealGasFluidProperties::pressure ( Real  v,
Real  u 
) const
overridevirtual

Pressure as a function of specific internal energy and specific volume.

Implements SinglePhaseFluidProperties.

Definition at line 39 of file IdealGasFluidProperties.C.

Referenced by NSPressureAux::computeValue(), and g().

40 {
41  if (v == 0.0)
42  mooseError(name(), ": Invalid value of specific volume detected (v = ", v, ").");
43 
44  // The std::max function serves as a hard limiter, which will guarantee non-negative pressure
45  // when resolving strongly nonlinear waves
46  return std::max(1.0e-8, (_gamma - 1.0) * u / v);
47 }
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
Real IdealGasFluidProperties::rho ( Real  pressure,
Real  temperature 
) const
overridevirtual

Computes density from pressure and temperature.

Implements SinglePhaseFluidProperties.

Definition at line 124 of file IdealGasFluidProperties.C.

Referenced by e(), e_dprho(), h(), h_dpT(), rho_e(), NSWeakStagnationBaseBC::staticValues(), and NSInitialCondition::value().

125 {
126  if ((_gamma - 1.0) * pressure == 0.0)
127  mooseError(name(),
128  ": Invalid gamma or pressure detected in rho(pressure = ",
129  pressure,
130  ", gamma = ",
131  _gamma,
132  ")");
133 
134  return pressure / (_gamma - 1.0) / _cv / temperature;
135 }
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::rho_dpT ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  drho_dp,
Real &  drho_dT 
) const
overridevirtual

Computes density from pressure and temperature and its derivatives w.r.t pressure and temperature.

Implements SinglePhaseFluidProperties.

Definition at line 138 of file IdealGasFluidProperties.C.

140 {
141  Real temp2 = temperature * temperature;
142  rho = pressure / (_gamma - 1.0) / _cv / temperature;
143  drho_dp = 1.0 / (_gamma - 1.0) / _cv / temperature;
144  drho_dT = -pressure / (_gamma - 1.0) / _cv / temp2;
145 }
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::rho_e ( Real  pressure,
Real  temperature,
Real &  rho,
Real &  e 
) const
overridevirtual

Computes density and internal energy from pressure and temperature.

Implements SinglePhaseFluidProperties.

Definition at line 117 of file IdealGasFluidProperties.C.

118 {
119  rho = this->rho(pressure, temperature);
120  e = temperature * _cv;
121 }
virtual Real rho(Real pressure, Real temperature) const override
Computes density from pressure and temperature.
virtual Real e(Real pressure, Real rho) const override
Computes internal energy from pressure and density.
virtual Real temperature(Real v, Real u) const override
Temperature as a function of specific internal energy and specific volume.
virtual Real pressure(Real v, Real u) const override
Pressure as a function of specific internal energy and specific volume.
void IdealGasFluidProperties::rho_e_dps ( Real  pressure,
Real  entropy,
Real &  rho,
Real &  drho_dp,
Real &  drho_ds,
Real &  e,
Real &  de_dp,
Real &  de_ds 
) const
overridevirtual

Implements SinglePhaseFluidProperties.

Definition at line 109 of file IdealGasFluidProperties.C.

110 {
111  mooseError(name(), ": rho_e_dps() not implemented.");
112 }
void IdealGasFluidProperties::rho_e_ps ( Real  pressure,
Real  entropy,
Real &  rho,
Real &  e 
) const
overridevirtual

Compute internal energy and density from specific entropy and pressure.

Implements SinglePhaseFluidProperties.

Definition at line 103 of file IdealGasFluidProperties.C.

104 {
105  mooseError(name(), ": rho_e_ps() not implemented.");
106 }
Real IdealGasFluidProperties::s ( Real  v,
Real  u 
) const
overridevirtual

Specific entropy [ J / kg K ].

Implements SinglePhaseFluidProperties.

Definition at line 74 of file IdealGasFluidProperties.C.

74 { mooseError(name(), ": s() not implemented."); }
void IdealGasFluidProperties::s_from_h_p ( Real  h,
Real  p,
Real &  s,
Real &  ds_dh,
Real &  ds_dp 
) const
overridevirtual

Specific entropy from enthalpy and pressure.

Implements SinglePhaseFluidProperties.

Definition at line 77 of file IdealGasFluidProperties.C.

78 {
79  const Real aux = p * std::pow(h / (_gamma * _cv), -_gamma / (_gamma - 1));
80  if (aux <= 0.0)
81  mooseError(name(), ": Non-positive argument in the ln() function.");
82 
83  const Real daux_dh = p * std::pow(h / (_gamma * _cv), -_gamma / (_gamma - 1) - 1) *
84  (-_gamma / (_gamma - 1)) / (_gamma * _cv);
85  const Real daux_dp = std::pow(h / (_gamma * _cv), -_gamma / (_gamma - 1));
86 
87  s = -(_gamma - 1) * _cv * std::log(aux);
88  ds_dh = -(_gamma - 1) * _cv / aux * daux_dh;
89  ds_dp = -(_gamma - 1) * _cv / aux * daux_dp;
90 }
virtual Real h(Real pressure, Real temperature) const override
Computes specific enthalpy.
virtual Real s(Real v, Real u) const override
Specific entropy [ J / kg K ].
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Real IdealGasFluidProperties::temperature ( Real  v,
Real  u 
) const
overridevirtual

Temperature as a function of specific internal energy and specific volume.

Implements SinglePhaseFluidProperties.

Definition at line 50 of file IdealGasFluidProperties.C.

Referenced by c(), NSTemperatureAux::computeValue(), g(), h_dpT(), rho(), and rho_dpT().

51 {
52  return u / _cv;
53 }

Member Data Documentation

Real IdealGasFluidProperties::_beta
protected

Definition at line 79 of file IdealGasFluidProperties.h.

Referenced by beta().

Real IdealGasFluidProperties::_cp
protected

Definition at line 77 of file IdealGasFluidProperties.h.

Referenced by cp(), and IdealGasFluidProperties().

Real IdealGasFluidProperties::_cv
protected
Real IdealGasFluidProperties::_gamma
protected
Real IdealGasFluidProperties::_k
protected

Definition at line 81 of file IdealGasFluidProperties.h.

Referenced by k().

Real IdealGasFluidProperties::_mu
protected

Definition at line 80 of file IdealGasFluidProperties.h.

Referenced by mu().

Real IdealGasFluidProperties::_R
protected

Definition at line 75 of file IdealGasFluidProperties.h.

Referenced by c(), and IdealGasFluidProperties().


The documentation for this class was generated from the following files: