Skip to content

Commit

Permalink
Add support for T(p,h) in a few gas FPs by adding it
Browse files Browse the repository at this point in the history
as a Newton inversion of h(p,T) in HelmhotzFP refs idaholab#29620
  • Loading branch information
GiudGiud committed Dec 26, 2024
1 parent c60b342 commit 7c38ef4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class HelmholtzFluidProperties : public SinglePhaseFluidProperties
virtual Real h_from_p_T(Real pressure, Real temperature) const override;
virtual void h_from_p_T(Real p, Real T, Real & h, Real & dh_dp, Real & dh_dT) const override;

virtual Real T_from_p_h(Real pressure, Real enthalpy) const override;

/**
* Pressure as a function of density and temperature
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,24 @@ HelmholtzFluidProperties::h_from_p_T(
molarMass();
}

Real
HelmholtzFluidProperties::T_from_p_h(Real pressure, Real enthalpy) const
{
auto lambda = [&](Real pressure, Real current_T, Real & new_h, Real & dh_dp, Real & dh_dT)
{ h_from_p_T(pressure, current_T, new_h, dh_dp, dh_dT); };
Real T = FluidPropertiesUtils::NewtonSolve(
pressure, enthalpy, _T_initial_guess, _tolerance, lambda, name() + "::T_from_p_h")
.first;
// check for nans
if (std::isnan(T))
mooseError("Conversion from enthalpy (h = ",
enthalpy,
") and pressure (p = ",
pressure,
") to temperature failed to converge.");
return T;
}

Real
HelmholtzFluidProperties::p_from_rho_T(Real density, Real temperature) const
{
Expand Down

0 comments on commit 7c38ef4

Please sign in to comment.