From 2672406466b37eca5e5290e27513511a34d0a762 Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Thu, 26 Dec 2024 13:43:56 +0100 Subject: [PATCH] Add support for T_from_p_h to stiffened gas FP refs #29620 --- .../StiffenedGasFluidProperties.h | 18 +++++++++++++ .../StiffenedGasFluidProperties.C | 25 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/modules/fluid_properties/include/fluidproperties/StiffenedGasFluidProperties.h b/modules/fluid_properties/include/fluidproperties/StiffenedGasFluidProperties.h index c8794feaffcb..9dedb304c3e6 100644 --- a/modules/fluid_properties/include/fluidproperties/StiffenedGasFluidProperties.h +++ b/modules/fluid_properties/include/fluidproperties/StiffenedGasFluidProperties.h @@ -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; @@ -174,6 +175,23 @@ StiffenedGasFluidProperties::T_from_v_e_template( dT_de = 1.0 / _cv; } +template +CppType +StiffenedGasFluidProperties::T_from_p_h_template(const CppType & /*p*/, const CppType & h) const +{ + return (1.0 / _cv) * (h - _q) / _gamma; +} + +template +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 CppType StiffenedGasFluidProperties::p_from_v_e_template(const CppType & v, const CppType & e) const diff --git a/modules/fluid_properties/src/fluidproperties/StiffenedGasFluidProperties.C b/modules/fluid_properties/src/fluidproperties/StiffenedGasFluidProperties.C index 9eb23428ce4a..5849c1802f08 100644 --- a/modules/fluid_properties/src/fluidproperties/StiffenedGasFluidProperties.C +++ b/modules/fluid_properties/src/fluidproperties/StiffenedGasFluidProperties.C @@ -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 {