Skip to content

Commit

Permalink
Add support for T_from_p_h to stiffened gas FP
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Dec 26, 2024
1 parent dc0e9c8 commit 2672406
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class StiffenedGasFluidProperties : public SinglePhaseFluidProperties, public Na
propfuncWithDefinitionOverride(s, p, T);
propfuncWithDefinitionOverride(T, v, e);
propfuncWithDefinitionOverride(p, v, e);
propfuncWithDefinitionOverride(T, p, h);
virtual Real e_from_T_v(Real T, Real v) const override;
virtual void e_from_T_v(Real T, Real v, Real & e, Real & de_dT, Real & de_dv) const override;
virtual Real p_from_T_v(Real T, Real v) const override;
Expand Down Expand Up @@ -174,6 +175,23 @@ StiffenedGasFluidProperties::T_from_v_e_template(
dT_de = 1.0 / _cv;
}

template <typename CppType>
CppType
StiffenedGasFluidProperties::T_from_p_h_template(const CppType & /*p*/, const CppType & h) const
{
return (1.0 / _cv) * (h - _q) / _gamma;
}

template <typename CppType>
void
StiffenedGasFluidProperties::T_from_p_h_template(
const CppType & p, const CppType & h, CppType & T, CppType & dT_dp, CppType & dT_dh) const
{
T = T_from_p_h_template(p, h);
dT_dp = 0;
dT_dh = 1.0 / _cv / _gamma;
}

template <typename CppType>
CppType
StiffenedGasFluidProperties::p_from_v_e_template(const CppType & v, const CppType & e) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,31 @@ StiffenedGasFluidProperties::T_from_v_e(
T_from_v_e_template(v, e, p, dp_dv, dp_de);
}

Real
StiffenedGasFluidProperties::T_from_p_h(Real v, Real e) const
{
return T_from_p_h_template(v, e);
}

void
StiffenedGasFluidProperties::T_from_p_h(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const
{
T_from_p_h_template(v, e, T, dT_dv, dT_de);
}

ADReal
StiffenedGasFluidProperties::T_from_p_h(const ADReal & v, const ADReal & e) const
{
return T_from_p_h_template(v, e);
}

void
StiffenedGasFluidProperties::T_from_p_h(
const ADReal & v, const ADReal & e, ADReal & p, ADReal & dp_dv, ADReal & dp_de) const
{
T_from_p_h_template(v, e, p, dp_dv, dp_de);
}

Real
StiffenedGasFluidProperties::c_from_v_e(Real v, Real e) const
{
Expand Down

0 comments on commit 2672406

Please sign in to comment.