Skip to content

Use a temperature guess and report failures in iterative enthalpy inversions - #2983

Open
joshkellyjak wants to merge 2 commits into
feature_CANTERA_PRfrom
fix_temp_enth_solve
Open

joshkellyjak wants to merge 2 commits into
feature_CANTERA_PRfrom
fix_temp_enth_solve

Conversation

@joshkellyjak

Copy link
Copy Markdown
Contributor

Proposed Changes

Fluid models that solve for the temperature from the enthalpy iteratively currently start every solve from a fixed temperature and give the caller no way to tell that it failed. CIncIdealGasPolynomial starts at 300 K and only prints a per-point warning when it fails.

This PR adds CFluidModel::SolveTDState_h(h, Y, T_guess), which takes the starting temperature as an argument and returns whether a valid state was found. The default implementation forwards to SetTDState_h and returns true, so models that compute the temperature directly are unchanged. CIncIdealGasPolynomial inow uses the guess (falling back to the non-dimensional reference temperature) and returns failure instead of printing per-point warnings. The incompressible call sites (SetPrimVar main and fallback paths, ComputeConsistentExtrapolation, RecomputeDensity_time_n) now pass the previous temperature and handle failure explicitly.

Related Work

Replaces the SetTemperatureGuess / GetTemperatureIterationFailed pair proposed in #2713 (Cantera fluid model), which can implement SolveTDState_h instead. Also prepares for a temperature-dependent cp in FLUID_MIXTURE (see the TODO in CFluidScalar::SetTDState_h).

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

…lace cout warnings and set temperature to most recent correct state. Density failed points are now reported in NONPYHSICAL_POINTS
@joshkellyjak
joshkellyjak added this pull request to stack #2984 October 15, 2026 16:25
@joshkellyjak joshkellyjak self-assigned this Oct 15, 2026
@joshkellyjak joshkellyjak changed the title Use previous temperature for initial guess of enthalpy inversion. Rep… Use a temperature guess and report failures in iterative enthalpy inversions Oct 15, 2026
Comment thread SU2_CFD/src/solvers/CIncEulerSolver.cpp Outdated
Comment thread SU2_CFD/include/fluid/CFluidModel.hpp Outdated
Comment thread SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp Outdated
Comment thread SU2_CFD/src/variables/CIncNSVariable.cpp Outdated
Comment thread SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp Outdated
Comment thread SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp
the enthalpy increases with temperature, so a step below the minimum taken from the minimum itself means
the solution is below it, stop and report failure. ---*/
if (temperature + delta < Temperature_Min) {
if (temperature == Temperature_Min) break;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants