Skip to content

Fix temp enthalpy solve failures - #2981

Closed
joshkellyjak wants to merge 9 commits into
feature_CANTERA_PRfrom
fix_temp_enthalpy_solve_failures
Closed

joshkellyjak wants to merge 9 commits into
feature_CANTERA_PRfrom
fix_temp_enthalpy_solve_failures

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 now 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.

joshkellyjak and others added 8 commits October 9, 2026 23:46
…te fixes

Adds the resolved Eq. (14) preferential diffusion flux formulation (model B2 of
Schepers & van Oijen, C&F 280 (2025) 114332) to the flamelet scalar transport,
alongside the existing beta correction, and fixes two defects that left the
existing model inert or wrong.

Model
- PREFERENTIAL_DIFFUSION_METHOD selects BETA_CORRECTION (default, unchanged) or
  SOURCE_TERM.
- PREFERENTIAL_DIFFUSION_MAJOR_SPECIES names the species carrying the resolved
  flux. The manifold variables (Res_<cv>, Y-<sp>, D_<cv>_<sp>, DT_<cv>) are
  composed from the configured controlling variable and species names.
- The Eq. (14) fluxes are a new branch of CScalarFlux_Flamelet, driven by the
  CFD-resolved gradients of the major species and of temperature. Explicit, with
  a stabilising self-diffusion added to the Jacobian alone so the converged
  solution is unchanged.
- The Eq. (16) closure sources are gated on manifold validity only.

Fixes
- nAuxVar was never set, so SetAuxVar_Gradient_* looped zero times and every beta
  gradient stayed zero. The beta term then evaluated grad(beta) - grad(phi) as
  -grad(phi), cancelling the ordinary diffusion of the controlling variables
  rather than correcting it.
- LEAST_SQUARES fell through the auxiliary gradient switch, with the same effect.
- Soret coefficients are zeroed on viscous walls, where the manifold carries no
  quench layer data.
- A collective in the volume output ran behind an "iPoint == 0" test inside the
  per point loop; a rank owning no points would have hung the others. Moved to a
  new per write COutput::PrepareVolumeData hook.
- The cached preferential diffusion source is cleared at off manifold nodes, and
  the Newton non convergence message is rank guarded.

Diagnostics
- FLAME_QUALITY volume group, hull miss deviations, FLAMELET_VERBOSE_MISSES, and
  per location probe history files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…le gradient

The stabilising diffusivity is a bound on the Eq. (14) flux recast as a self
diffusion, |J| <= D_stab |grad phi|, so it has to be divided by the controlling
variable's own gradient. Without that division D_stab sits at the raw coefficient
magnitude everywhere, which damps the update far more than the explicit flux
warrants: on the burner case every stabilised run plateaued near rms[h] = -2.45
whatever the CFL, so the higher ceiling bought no convergence. With the division
restored, CFL 2 reaches -2.530 against -2.528 at CFL 1, and the ceiling moves
from (1, 2) without the term to (2, 3) with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
## Proposed Changes

The implicit compressible solver limits the update of each point with an
under-relaxation factor. To decide how much to limit, it compares the
internal energy before and after the update. This internal energy was
computed wrongly: the kinetic energy was not divided by the density.


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/solvers/CEulerSolver.cpp#L2555-L2556

In cases run with dimensional values the wrong internal energy can
become negative. When it does, the point gets no update at all and stays
frozen. In an air nozzle about a quarter of the points were frozen, so
the case could not converge.

The fix is 5 lines: the kinetic energy is divided by the density, using
the old and the new density.

Almost all compressible implicit regression cases converge a little
differently, so most regression values change. They are updated from the
CI.

This is the first of four PRs that replace #2941, to make the review
easier. The other three build on this one:
- #2943: HLLC on moving grids;
- #2944: Roe-type schemes in 3D;
- #2945: smaller fixes.

## Related Work

- #2830 added the under-relaxation factor.
- #2941 (replaced by this PR and the three that follow).

## PR Checklist

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6

---------

Co-authored-by: rois1995 <rauxa1995@hotmail.it>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: rois1995 <rauxa1995@gmail.com>
Co-authored-by: Josh Kelly <81244680+joshkellyjak@users.noreply.github.com>
…initial guess is selected based on previous valid solution
@joshkellyjak
joshkellyjak changed the base branch from develop to feature_CANTERA_PR October 15, 2026 15:23
@joshkellyjak
joshkellyjak added this pull request to stack #2982 October 15, 2026 15:23
@joshkellyjak
joshkellyjak deleted the fix_temp_enthalpy_solve_failures branch October 15, 2026 15:54
@joshkellyjak
joshkellyjak removed this pull request from stack #2982 October 15, 2026 15:57
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.

2 participants