LCOV - code coverage report
Current view: top level - src/fluidproperties - StiffenedGasFluidProperties.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #31405 (292dce) with base fef103 Lines: 261 316 82.6 %
Date: 2025-09-04 07:53:14 Functions: 74 82 90.2 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "StiffenedGasFluidProperties.h"
      11             : 
      12             : registerMooseObject("FluidPropertiesApp", StiffenedGasFluidProperties);
      13             : 
      14             : InputParameters
      15         577 : StiffenedGasFluidProperties::validParams()
      16             : {
      17         577 :   InputParameters params = SinglePhaseFluidProperties::validParams();
      18         577 :   params += NaNInterface::validParams();
      19        1154 :   params.addParam<bool>(
      20        1154 :       "allow_nonphysical_states", true, "Allows for non-physical states, e.g., negative density.");
      21        1154 :   params.addRequiredParam<Real>("gamma", "Heat capacity ratio");
      22        1154 :   params.addRequiredParam<Real>("cv", "Constant volume specific heat");
      23        1154 :   params.addRequiredParam<Real>("q", "Parameter defining zero point of internal energy");
      24        1154 :   params.addRequiredParam<Real>("p_inf", "Stiffness parameter");
      25        1154 :   params.addParam<Real>("q_prime", 0, "Parameter");
      26        1154 :   params.addParam<Real>("mu", 1.e-3, "Dynamic viscosity, Pa.s");
      27        1154 :   params.addParam<Real>("k", 0.6, "Thermal conductivity, W/(m-K)");
      28        1154 :   params.addParam<Real>("M", 0, "Molar mass, kg/mol");
      29        1154 :   params.addParam<Real>("T_c", 0, "Critical temperature, K");
      30        1154 :   params.addParam<Real>("rho_c", 0, "Critical density, kg/m3");
      31        1154 :   params.addParam<Real>("e_c", 0, "Internal energy at the critical point, J/kg");
      32         577 :   params.addClassDescription("Fluid properties for a stiffened gas");
      33         577 :   return params;
      34           0 : }
      35             : 
      36         315 : StiffenedGasFluidProperties::StiffenedGasFluidProperties(const InputParameters & parameters)
      37             :   : SinglePhaseFluidProperties(parameters),
      38             :     NaNInterface(this),
      39         315 :     _allow_nonphysical_states(getParam<bool>("allow_nonphysical_states")),
      40         630 :     _gamma(getParam<Real>("gamma")),
      41         630 :     _cv(getParam<Real>("cv")),
      42         630 :     _q(getParam<Real>("q")),
      43         630 :     _q_prime(getParam<Real>("q_prime")),
      44         630 :     _p_inf(getParam<Real>("p_inf")),
      45         630 :     _mu(getParam<Real>("mu")),
      46         630 :     _k(getParam<Real>("k")),
      47         630 :     _molar_mass(getParam<Real>("M")),
      48         630 :     _T_c(getParam<Real>("T_c")),
      49         630 :     _rho_c(getParam<Real>("rho_c")),
      50         945 :     _e_c(getParam<Real>("e_c"))
      51             : {
      52         315 :   if (_cv == 0.0)
      53           0 :     mooseError("cv cannot be zero.");
      54         315 :   _cp = _cv * _gamma;
      55         315 : }
      56             : 
      57         624 : StiffenedGasFluidProperties::~StiffenedGasFluidProperties() {}
      58             : 
      59             : Real
      60        2928 : StiffenedGasFluidProperties::p_from_v_e(Real v, Real e) const
      61             : {
      62        2928 :   return p_from_v_e_template(v, e);
      63             : }
      64             : 
      65             : void
      66          59 : StiffenedGasFluidProperties::p_from_v_e(Real v, Real e, Real & p, Real & dp_dv, Real & dp_de) const
      67             : {
      68          59 :   p_from_v_e_template(v, e, p, dp_dv, dp_de);
      69          59 : }
      70             : 
      71             : ADReal
      72           6 : StiffenedGasFluidProperties::p_from_v_e(const ADReal & v, const ADReal & e) const
      73             : {
      74           6 :   return p_from_v_e_template(v, e);
      75             : }
      76             : 
      77             : void
      78           1 : StiffenedGasFluidProperties::p_from_v_e(
      79             :     const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
      80             : {
      81           1 :   p_from_v_e_template(v, e, p, dp_dv, dp_de);
      82           1 : }
      83             : 
      84             : Real
      85        1052 : StiffenedGasFluidProperties::T_from_v_e(Real v, Real e) const
      86             : {
      87        1052 :   return T_from_v_e_template(v, e);
      88             : }
      89             : 
      90             : void
      91           1 : StiffenedGasFluidProperties::T_from_v_e(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
      92             : {
      93           1 :   T_from_v_e_template(v, e, T, dT_dv, dT_de);
      94           1 : }
      95             : 
      96             : ADReal
      97           6 : StiffenedGasFluidProperties::T_from_v_e(const ADReal & v, const ADReal & e) const
      98             : {
      99           6 :   return T_from_v_e_template(v, e);
     100             : }
     101             : 
     102             : void
     103           1 : StiffenedGasFluidProperties::T_from_v_e(
     104             :     const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
     105             : {
     106           1 :   T_from_v_e_template(v, e, p, dp_dv, dp_de);
     107           1 : }
     108             : 
     109             : Real
     110           6 : StiffenedGasFluidProperties::T_from_p_h(Real v, Real e) const
     111             : {
     112           6 :   return T_from_p_h_template(v, e);
     113             : }
     114             : 
     115             : void
     116           1 : StiffenedGasFluidProperties::T_from_p_h(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
     117             : {
     118             :   T_from_p_h_template(v, e, T, dT_dv, dT_de);
     119           1 : }
     120             : 
     121             : ADReal
     122           0 : StiffenedGasFluidProperties::T_from_p_h(const ADReal & v, const ADReal & e) const
     123             : {
     124           0 :   return T_from_p_h_template(v, e);
     125             : }
     126             : 
     127             : void
     128           0 : StiffenedGasFluidProperties::T_from_p_h(
     129             :     const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
     130             : {
     131           0 :   T_from_p_h_template(v, e, p, dp_dv, dp_de);
     132           0 : }
     133             : 
     134             : Real
     135         441 : StiffenedGasFluidProperties::c_from_v_e(Real v, Real e) const
     136             : {
     137         441 :   if (_allow_nonphysical_states)
     138         441 :     return std::sqrt(_gamma * (p_from_v_e(v, e) + _p_inf) * v);
     139             :   else
     140             :   {
     141           0 :     const Real radicant = _gamma * (p_from_v_e(v, e) + _p_inf) * v;
     142           0 :     if (radicant < 0.)
     143             :     {
     144           0 :       return getNaN();
     145             :     }
     146             :     else
     147             :     {
     148           0 :       return std::sqrt(radicant);
     149             :     }
     150             :   }
     151             : }
     152             : 
     153             : void
     154           0 : StiffenedGasFluidProperties::c_from_v_e(Real v, Real e, Real & c, Real & dc_dv, Real & dc_de) const
     155             : {
     156           0 :   if (_allow_nonphysical_states)
     157             :   {
     158             :     Real p, dp_dv, dp_de;
     159           0 :     p_from_v_e(v, e, p, dp_dv, dp_de);
     160             : 
     161           0 :     c = std::sqrt(_gamma * (p_from_v_e(v, e) + _p_inf) * v);
     162           0 :     const Real dc_dp = 0.5 / c * _gamma * v;
     163           0 :     const Real dc_dv_partial = 0.5 / c * _gamma * (p + _p_inf);
     164             : 
     165           0 :     dc_dv = dc_dv_partial + dc_dp * dp_dv;
     166           0 :     dc_de = dc_dp * dp_de;
     167             :   }
     168             :   else
     169             :   {
     170           0 :     const Real radicant = _gamma * (p_from_v_e(v, e) + _p_inf) * v;
     171           0 :     if (radicant < 0.)
     172             :     {
     173           0 :       c = getNaN();
     174           0 :       dc_dv = getNaN();
     175           0 :       dc_de = getNaN();
     176             :     }
     177             :     else
     178             :     {
     179             :       Real p, dp_dv, dp_de;
     180           0 :       p_from_v_e(v, e, p, dp_dv, dp_de);
     181           0 :       c = std::sqrt(radicant);
     182           0 :       const Real dc_dp = 0.5 / c * _gamma * v;
     183           0 :       const Real dc_dv_partial = 0.5 / c * _gamma * (p + _p_inf);
     184             : 
     185           0 :       dc_dv = dc_dv_partial + dc_dp * dp_dv;
     186           0 :       dc_de = dc_dp * dp_de;
     187             :     }
     188             :   }
     189           0 : }
     190             : 
     191         447 : Real StiffenedGasFluidProperties::cp_from_v_e(Real, Real) const { return _cp; }
     192             : 
     193             : void
     194           1 : StiffenedGasFluidProperties::cp_from_v_e(
     195             :     Real v, Real e, Real & cp, Real & dcp_dv, Real & dcp_de) const
     196             : {
     197           1 :   cp = cp_from_v_e(v, e);
     198           1 :   dcp_dv = 0.0;
     199           1 :   dcp_de = 0.0;
     200           1 : }
     201             : 
     202         444 : Real StiffenedGasFluidProperties::cv_from_v_e(Real, Real) const { return _cv; }
     203             : 
     204             : void
     205           0 : StiffenedGasFluidProperties::cv_from_v_e(
     206             :     Real v, Real e, Real & cv, Real & dcv_dv, Real & dcv_de) const
     207             : {
     208           0 :   cv = cv_from_v_e(v, e);
     209           0 :   dcv_dv = 0.0;
     210           0 :   dcv_de = 0.0;
     211           0 : }
     212             : 
     213         465 : Real StiffenedGasFluidProperties::mu_from_v_e(Real, Real) const { return _mu; }
     214             : 
     215             : void
     216           1 : StiffenedGasFluidProperties::mu_from_v_e(
     217             :     Real v, Real e, Real & mu, Real & dmu_dv, Real & dmu_de) const
     218             : {
     219           1 :   mu = this->mu_from_v_e(v, e);
     220           1 :   dmu_dv = 0.0;
     221           1 :   dmu_de = 0.0;
     222           1 : }
     223             : 
     224         459 : Real StiffenedGasFluidProperties::k_from_v_e(Real, Real) const { return _k; }
     225             : 
     226             : void
     227           0 : StiffenedGasFluidProperties::k_from_v_e(Real v, Real e, Real & k, Real & dk_dv, Real & dk_de) const
     228             : {
     229           0 :   k = k_from_v_e(v, e);
     230           0 :   dk_dv = 0.0;
     231           0 :   dk_de = 0.0;
     232           0 : }
     233             : 
     234             : Real
     235         739 : StiffenedGasFluidProperties::s_from_v_e(Real v, Real e) const
     236             : {
     237         739 :   return s_from_v_e_template(v, e);
     238             : }
     239             : 
     240             : void
     241          29 : StiffenedGasFluidProperties::s_from_v_e(Real v, Real e, Real & s, Real & ds_dv, Real & ds_de) const
     242             : {
     243          29 :   s_from_v_e_template(v, e, s, ds_dv, ds_de);
     244          29 : }
     245             : 
     246             : ADReal
     247           7 : StiffenedGasFluidProperties::s_from_v_e(const ADReal & v, const ADReal & e) const
     248             : {
     249           7 :   return s_from_v_e_template(v, e);
     250             : }
     251             : 
     252             : void
     253           1 : StiffenedGasFluidProperties::s_from_v_e(
     254             :     const ADReal & v, const ADReal & e, ADReal & s, ADReal & ds_dv, ADReal & ds_de) const
     255             : {
     256           1 :   s_from_v_e_template(v, e, s, ds_dv, ds_de);
     257           1 : }
     258             : 
     259             : Real
     260           6 : StiffenedGasFluidProperties::s_from_h_p(Real h, Real p) const
     261             : {
     262           6 :   const Real aux = (p + _p_inf) * std::pow((h - _q) / (_gamma * _cv), -_gamma / (_gamma - 1));
     263           6 :   if (aux <= 0.0)
     264           0 :     return getNaN();
     265             :   else
     266           6 :     return _q_prime - (_gamma - 1) * _cv * std::log(aux);
     267             : }
     268             : 
     269             : void
     270           1 : StiffenedGasFluidProperties::s_from_h_p(Real h, Real p, Real & s, Real & ds_dh, Real & ds_dp) const
     271             : {
     272           1 :   const Real aux = (p + _p_inf) * std::pow((h - _q) / (_gamma * _cv), -_gamma / (_gamma - 1));
     273           1 :   if (aux <= 0.0)
     274             :   {
     275           0 :     s = getNaN();
     276           0 :     ds_dh = getNaN();
     277           0 :     ds_dp = getNaN();
     278             :   }
     279             :   else
     280             :   {
     281           1 :     const Real daux_dh = (p + _p_inf) *
     282           1 :                          std::pow((h - _q) / (_gamma * _cv), -_gamma / (_gamma - 1) - 1) *
     283           1 :                          (-_gamma / (_gamma - 1)) / (_gamma * _cv);
     284           1 :     const Real daux_dp = std::pow((h - _q) / (_gamma * _cv), -_gamma / (_gamma - 1));
     285             : 
     286           1 :     s = _q_prime - (_gamma - 1) * _cv * std::log(aux);
     287           1 :     ds_dh = -(_gamma - 1) * _cv / aux * daux_dh;
     288           1 :     ds_dp = -(_gamma - 1) * _cv / aux * daux_dp;
     289             :   }
     290           1 : }
     291             : 
     292             : Real
     293           6 : StiffenedGasFluidProperties::s_from_p_T(Real p, Real T) const
     294             : {
     295           6 :   return s_from_p_T_template(p, T);
     296             : }
     297             : 
     298             : void
     299           1 : StiffenedGasFluidProperties::s_from_p_T(Real p, Real T, Real & s, Real & ds_dp, Real & ds_dT) const
     300             : {
     301           1 :   s_from_p_T_template(p, T, s, ds_dp, ds_dT);
     302           1 : }
     303             : 
     304             : ADReal
     305           6 : StiffenedGasFluidProperties::s_from_p_T(const ADReal & p, const ADReal & T) const
     306             : {
     307           6 :   return s_from_p_T_template(p, T);
     308             : }
     309             : 
     310             : void
     311           1 : StiffenedGasFluidProperties::s_from_p_T(
     312             :     const ADReal & p, const ADReal & T, ADReal & s, ADReal & ds_dp, ADReal & ds_dT) const
     313             : {
     314           1 :   s_from_p_T_template(p, T, s, ds_dp, ds_dT);
     315           1 : }
     316             : 
     317             : Real
     318         141 : StiffenedGasFluidProperties::rho_from_p_s(Real p, Real s) const
     319             : {
     320         141 :   Real a = (s - _q_prime + _cv * std::log(std::pow(p + _p_inf, _gamma - 1.0))) / _cv;
     321         141 :   Real T = std::pow(std::exp(a), 1.0 / _gamma);
     322         141 :   Real rho = rho_from_p_T(p, T);
     323         141 :   if (!_allow_nonphysical_states && rho <= 0.)
     324           0 :     return getNaN();
     325             :   else
     326             :     return rho;
     327             : }
     328             : 
     329             : void
     330           1 : StiffenedGasFluidProperties::rho_from_p_s(
     331             :     Real p, Real s, Real & rho, Real & drho_dp, Real & drho_ds) const
     332             : {
     333             :   // T(p,s)
     334           1 :   const Real aux = (s - _q_prime + _cv * std::log(std::pow(p + _p_inf, _gamma - 1.0))) / _cv;
     335           1 :   const Real T = std::pow(std::exp(aux), 1 / _gamma);
     336             : 
     337             :   // dT/dp
     338           1 :   const Real dT_dp = 1.0 / _gamma * std::pow(std::exp(aux), 1.0 / _gamma - 1.0) * std::exp(aux) /
     339           1 :                      std::pow(p + _p_inf, _gamma - 1.0) * (_gamma - 1.0) *
     340           1 :                      std::pow(p + _p_inf, _gamma - 2.0);
     341             : 
     342             :   // dT/ds
     343             :   const Real dT_ds =
     344           1 :       1.0 / _gamma * std::pow(std::exp(aux), 1.0 / _gamma - 1.0) * std::exp(aux) / _cv;
     345             : 
     346             :   // Drho/Dp = d/dp[rho(p, T(p,s))] = drho/dp + drho/dT * dT/dp
     347             :   Real drho_dp_partial, drho_dT;
     348           1 :   rho_from_p_T(p, T, rho, drho_dp_partial, drho_dT);
     349           1 :   drho_dp = drho_dp_partial + drho_dT * dT_dp;
     350             : 
     351             :   // Drho/Ds = d/ds[rho(p, T(p,s))] = drho/dT * dT/ds
     352           1 :   drho_ds = drho_dT * dT_ds;
     353           1 : }
     354             : 
     355             : Real
     356           6 : StiffenedGasFluidProperties::e_from_v_h(Real v, Real h) const
     357             : {
     358           6 :   return (h + (_gamma - 1.0) * _q + _gamma * _p_inf * v) / _gamma;
     359             : }
     360             : 
     361             : void
     362           1 : StiffenedGasFluidProperties::e_from_v_h(Real v, Real h, Real & e, Real & de_dv, Real & de_dh) const
     363             : {
     364           1 :   e = (h + (_gamma - 1.0) * _q + _gamma * _p_inf * v) / _gamma;
     365           1 :   de_dv = _p_inf;
     366           1 :   de_dh = 1.0 / _gamma;
     367           1 : }
     368             : 
     369             : Real
     370         318 : StiffenedGasFluidProperties::rho_from_p_T(Real p, Real T) const
     371             : {
     372         318 :   return rho_from_p_T_template(p, T);
     373             : }
     374             : 
     375             : void
     376           3 : StiffenedGasFluidProperties::rho_from_p_T(
     377             :     Real p, Real T, Real & rho, Real & drho_dp, Real & drho_dT) const
     378             : {
     379           3 :   rho_from_p_T_template(p, T, rho, drho_dp, drho_dT);
     380           3 : }
     381             : 
     382             : ADReal
     383           7 : StiffenedGasFluidProperties::rho_from_p_T(const ADReal & p, const ADReal & T) const
     384             : {
     385           7 :   return rho_from_p_T_template(p, T);
     386             : }
     387             : 
     388             : void
     389           1 : StiffenedGasFluidProperties::rho_from_p_T(
     390             :     const ADReal & p, const ADReal & T, ADReal & rho, ADReal & drho_dp, ADReal & drho_dT) const
     391             : {
     392           1 :   rho_from_p_T_template(p, T, rho, drho_dp, drho_dT);
     393           1 : }
     394             : 
     395             : Real
     396         152 : StiffenedGasFluidProperties::e_from_p_rho(Real p, Real rho) const
     397             : {
     398         152 :   return e_from_p_rho_template(p, rho);
     399             : }
     400             : 
     401             : void
     402           1 : StiffenedGasFluidProperties::e_from_p_rho(
     403             :     Real p, Real rho, Real & e, Real & de_dp, Real & de_drho) const
     404             : {
     405           1 :   e_from_p_rho_template(p, rho, e, de_dp, de_drho);
     406           1 : }
     407             : 
     408             : ADReal
     409           7 : StiffenedGasFluidProperties::e_from_p_rho(const ADReal & p, const ADReal & rho) const
     410             : {
     411           7 :   return e_from_p_rho_template(p, rho);
     412             : }
     413             : 
     414             : void
     415           1 : StiffenedGasFluidProperties::e_from_p_rho(
     416             :     const ADReal & p, const ADReal & rho, ADReal & e, ADReal & de_dp, ADReal & de_drho) const
     417             : {
     418           1 :   e_from_p_rho_template(p, rho, e, de_dp, de_drho);
     419           1 : }
     420             : 
     421             : Real
     422        1578 : StiffenedGasFluidProperties::e_from_T_v(Real T, Real v) const
     423             : {
     424        1578 :   return _cv * T + _q + _p_inf * v;
     425             : }
     426             : 
     427             : void
     428          93 : StiffenedGasFluidProperties::e_from_T_v(Real T, Real v, Real & e, Real & de_dT, Real & de_dv) const
     429             : {
     430          93 :   e = _cv * T + _q + _p_inf * v;
     431          93 :   de_dT = _cv;
     432          93 :   de_dv = _p_inf;
     433          93 : }
     434             : 
     435             : Real
     436        1345 : StiffenedGasFluidProperties::p_from_T_v(Real T, Real v) const
     437             : {
     438        1345 :   Real e = e_from_T_v(T, v);
     439        1345 :   return p_from_v_e(v, e);
     440             : }
     441             : 
     442             : void
     443          58 : StiffenedGasFluidProperties::p_from_T_v(Real T, Real v, Real & p, Real & dp_dT, Real & dp_dv) const
     444             : {
     445             :   Real e, de_dT_v, de_dv_T, dp_dv_e, dp_de_v;
     446          58 :   e_from_T_v(T, v, e, de_dT_v, de_dv_T);
     447          58 :   p_from_v_e(v, e, p, dp_dv_e, dp_de_v);
     448          58 :   dp_dT = dp_de_v * de_dT_v;
     449          58 :   dp_dv = dp_dv_e + dp_de_v * de_dv_T;
     450          58 : }
     451             : 
     452             : Real
     453           6 : StiffenedGasFluidProperties::h_from_T_v(Real T, Real /*v*/) const
     454             : {
     455           6 :   return _gamma * _cv * T + _q;
     456             : }
     457             : 
     458             : void
     459          20 : StiffenedGasFluidProperties::h_from_T_v(
     460             :     Real T, Real /*v*/, Real & h, Real & dh_dT, Real & dh_dv) const
     461             : {
     462          20 :   h = _gamma * _cv * T + _q;
     463          20 :   dh_dT = _gamma * _cv;
     464          20 :   dh_dv = 0.0;
     465          20 : }
     466             : 
     467             : Real
     468          22 : StiffenedGasFluidProperties::s_from_T_v(Real T, Real v) const
     469             : {
     470          22 :   Real e = e_from_T_v(T, v);
     471          22 :   return s_from_v_e(v, e);
     472             : }
     473             : 
     474             : void
     475          28 : StiffenedGasFluidProperties::s_from_T_v(Real T, Real v, Real & s, Real & ds_dT, Real & ds_dv) const
     476             : {
     477             :   Real e, de_dT_v, de_dv_T, ds_dv_e, ds_de_v;
     478          28 :   e_from_T_v(T, v, e, de_dT_v, de_dv_T);
     479          28 :   s_from_v_e(v, e, s, ds_dv_e, ds_de_v);
     480          28 :   ds_dT = ds_de_v * de_dT_v;
     481          28 :   ds_dv = ds_dv_e + ds_de_v * de_dv_T;
     482          28 : }
     483             : 
     484          20 : Real StiffenedGasFluidProperties::cv_from_T_v(Real /*T*/, Real /*v*/) const { return _cv; }
     485             : 
     486          45 : Real StiffenedGasFluidProperties::e_spndl_from_v(Real /*v*/) const { return _e_c; }
     487             : 
     488             : void
     489          87 : StiffenedGasFluidProperties::v_e_spndl_from_T(Real /*T*/, Real & v, Real & e) const
     490             : {
     491          87 :   v = 1. / _rho_c;
     492          87 :   e = _e_c;
     493          87 : }
     494             : 
     495             : Real
     496         183 : StiffenedGasFluidProperties::h_from_p_T(Real /*p*/, Real T) const
     497             : {
     498         183 :   return _gamma * _cv * T + _q;
     499             : }
     500             : 
     501             : void
     502           5 : StiffenedGasFluidProperties::h_from_p_T(Real p, Real T, Real & h, Real & dh_dp, Real & dh_dT) const
     503             : {
     504           5 :   h = h_from_p_T(p, T);
     505           5 :   dh_dp = 0.0;
     506           5 :   dh_dT = _gamma * _cv;
     507           5 : }
     508             : 
     509             : Real
     510           7 : StiffenedGasFluidProperties::e_from_p_T(Real p, Real T) const
     511             : {
     512           7 :   return (p + _gamma * _p_inf) / (p + _p_inf) * _cv * T + _q;
     513             : }
     514             : 
     515             : void
     516           1 : StiffenedGasFluidProperties::e_from_p_T(Real p, Real T, Real & e, Real & de_dp, Real & de_dT) const
     517             : {
     518           1 :   e = e_from_p_T(p, T);
     519           1 :   de_dp = (1. - _gamma) * _p_inf / (p + _p_inf) / (p + _p_inf) * _cv * T;
     520           1 :   de_dT = (p + _gamma * _p_inf) / (p + _p_inf) * _cv;
     521           1 : }
     522             : 
     523             : Real
     524         277 : StiffenedGasFluidProperties::p_from_h_s(Real h, Real s) const
     525             : {
     526         277 :   return std::pow((h - _q) / (_gamma * _cv), _gamma / (_gamma - 1.0)) *
     527         277 :              std::exp((_q_prime - s) / ((_gamma - 1.0) * _cv)) -
     528         277 :          _p_inf;
     529             : }
     530             : 
     531             : void
     532           1 : StiffenedGasFluidProperties::p_from_h_s(Real h, Real s, Real & p, Real & dp_dh, Real & dp_ds) const
     533             : {
     534           1 :   p = p_from_h_s(h, s);
     535           1 :   dp_dh = _gamma / (_gamma - 1.0) / (_gamma * _cv) *
     536           1 :           std::pow((h - _q) / (_gamma * _cv), 1.0 / (_gamma - 1.0)) *
     537           1 :           std::exp((_q_prime - s) / ((_gamma - 1.0) * _cv));
     538           1 :   dp_ds = std::pow((h - _q) / (_gamma * _cv), _gamma / (_gamma - 1)) *
     539           1 :           std::exp((_q_prime - s) / ((_gamma - 1) * _cv)) / ((1 - _gamma) * _cv);
     540           1 : }
     541             : 
     542             : Real
     543         434 : StiffenedGasFluidProperties::g_from_v_e(Real v, Real e) const
     544             : {
     545             :   // g(p,T) for SGEOS is given by Equation (37) in the following reference:
     546             :   //
     547             :   // Ray A. Berry, Richard Saurel, Olivier LeMetayer
     548             :   // The discrete equation method (DEM) for fully compressible, two-phase flows in
     549             :   //   ducts of spatially varying cross-section
     550             :   // Nuclear Engineering and Design 240 (2010) p. 3797-3818
     551             :   //
     552         434 :   const Real p = p_from_v_e(v, e);
     553         434 :   const Real T = T_from_v_e(v, e);
     554             : 
     555         434 :   return (_gamma * _cv - _q_prime) * T -
     556         434 :          _cv * T * std::log(std::pow(T, _gamma) / std::pow(p + _p_inf, _gamma - 1.0)) + _q;
     557             : }
     558             : 
     559             : Real
     560           0 : StiffenedGasFluidProperties::c2_from_p_rho(Real pressure, Real rho) const
     561             : {
     562           0 :   return _gamma * (pressure + _p_inf) / rho;
     563             : }
     564             : 
     565             : Real
     566         141 : StiffenedGasFluidProperties::molarMass() const
     567             : {
     568         141 :   return _molar_mass;
     569             : }
     570             : 
     571             : Real
     572          10 : StiffenedGasFluidProperties::criticalTemperature() const
     573             : {
     574          10 :   return _T_c;
     575             : }
     576             : 
     577             : Real
     578          12 : StiffenedGasFluidProperties::criticalDensity() const
     579             : {
     580          12 :   return _rho_c;
     581             : }
     582             : 
     583             : Real
     584           2 : StiffenedGasFluidProperties::criticalInternalEnergy() const
     585             : {
     586           2 :   return _e_c;
     587             : }
     588             : 
     589           1 : Real StiffenedGasFluidProperties::cv_from_p_T(Real /* pressure */, Real /* temperature */) const
     590             : {
     591           1 :   return _cv;
     592             : }
     593             : 
     594             : void
     595           0 : StiffenedGasFluidProperties::cv_from_p_T(
     596             :     Real pressure, Real temperature, Real & cv, Real & dcv_dp, Real & dcv_dT) const
     597             : {
     598           0 :   cv = cv_from_p_T(pressure, temperature);
     599           0 :   dcv_dp = 0.0;
     600           0 :   dcv_dT = 0.0;
     601           0 : }
     602             : 
     603           7 : Real StiffenedGasFluidProperties::cp_from_p_T(Real /* pressure */, Real /* temperature */) const
     604             : {
     605           7 :   return _cp;
     606             : }
     607             : 
     608             : void
     609           1 : StiffenedGasFluidProperties::cp_from_p_T(
     610             :     Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
     611             : {
     612           1 :   cp = cp_from_p_T(pressure, temperature);
     613           1 :   dcp_dp = 0.0;
     614           1 :   dcp_dT = 0.0;
     615           1 : }
     616             : 
     617           7 : Real StiffenedGasFluidProperties::mu_from_p_T(Real /* pressure */, Real /* temperature */) const
     618             : {
     619           7 :   return _mu;
     620             : }
     621             : 
     622             : void
     623           1 : StiffenedGasFluidProperties::mu_from_p_T(
     624             :     Real pressure, Real temperature, Real & mu, Real & dmu_dp, Real & dmu_dT) const
     625             : {
     626           1 :   mu = this->mu_from_p_T(pressure, temperature);
     627           1 :   dmu_dp = 0.0;
     628           1 :   dmu_dT = 0.0;
     629           1 : }
     630             : 
     631           7 : Real StiffenedGasFluidProperties::k_from_p_T(Real /* pressure */, Real /* temperature */) const
     632             : {
     633           7 :   return _k;
     634             : }
     635             : 
     636             : void
     637           1 : StiffenedGasFluidProperties::k_from_p_T(
     638             :     Real pressure, Real temperature, Real & k, Real & dk_dp, Real & dk_dT) const
     639             : {
     640           1 :   k = this->k_from_p_T(pressure, temperature);
     641           1 :   dk_dp = 0.0;
     642           1 :   dk_dT = 0.0;
     643           1 : }
     644             : Real
     645          15 : StiffenedGasFluidProperties::beta_from_p_T(Real /* pressure */, Real temperature) const
     646             : {
     647          15 :   return 1 / temperature;
     648             : }
     649             : void
     650           1 : StiffenedGasFluidProperties::beta_from_p_T(
     651             :     Real pressure, Real temperature, Real & beta, Real & dbeta_dp, Real & dbeta_dT) const
     652             : {
     653           1 :   beta = this->beta_from_p_T(pressure, temperature);
     654           1 :   dbeta_dp = 0.0;
     655           1 :   dbeta_dT = -1 / (temperature * temperature);
     656           1 : }
     657             : 
     658           0 : Real StiffenedGasFluidProperties::pp_sat_from_p_T(Real /*p*/, Real /*T*/) const
     659             : {
     660           0 :   mooseError(__PRETTY_FUNCTION__, " not implemented. Use a real fluid property class!");
     661             : }

Generated by: LCOV version 1.14