Skip to content

[WIP] Cantera detailed chemistry for compressible flows - #2972

Open
bigfooted wants to merge 308 commits into
developfrom
feature_CANTERA_compressible
Open

bigfooted wants to merge 308 commits into
developfrom
feature_CANTERA_compressible

Conversation

@bigfooted

Copy link
Copy Markdown
Contributor

Proposed Changes

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

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

Cristopher-Morales and others added 30 commits October 26, 2024 18:00
Cristopher-Morales and others added 24 commits January 15, 2026 22:59
# Conflicts:
#	SU2_CFD/include/numerics/scalar/scalar_convection.hpp
#	SU2_CFD/include/numerics/scalar/scalar_diffusion.hpp
#	SU2_CFD/include/solvers/CSpeciesFlameletSolver.hpp
#	SU2_CFD/include/variables/CSpeciesVariable.hpp
#	UnitTests/meson.build
Rename the options to CANTERA_*, collect them in CanteraOptions, cap the
transported species at 20 with a clear error, move the species diffusivities
into the flow variables, use single-sided chemical source terms, and tidy
the build scripts, tests and config template.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move the ignition spark into CSolver and use it in all three solvers, split
it out of CIncNSSolver::Preprocessing, make the Cantera solution and molar
masses const, rename GetStateFailed to GetTemperatureIterationFailed, use
size_t for the species count, check duplicate species names in CConfig,
start the temperature iteration from an enthalpy estimate, and name the
limits in the static_assert messages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FLUID_CANTERA is now available for SOLVER= NAVIER_STOKES and RANS, reusing the
general equation of state numerics (general Roe/HLLC, CGeneralAvgGrad_Flow).

- CFluidCantera: rho-e (Newton on temperature, shared with the h iteration),
  P-T, P-rho and rho-T states, frozen-composition derivatives and sound speed.
  New virtual CFluidModel::SetComposition sets the mixture for state calls
  without scalar arguments. Turbulent conductivity is added only in the
  incompressible solver, the compressible numerics add it themselves.
- Enthalpy diffusion (storage, per-point terms and edge flux) and the stored
  mass diffusivities move from CIncNSSolver/CIncNSVariable to
  CFVMFlowSolverBase/CFlowVariable, used by both regimes. The species enthalpy
  flux is added to CGeneralAvgGrad_Flow.
- CNSSolver passes the species composition to the fluid model, MUSCL
  reconstruction uses the node compositions, the chemistry is evaluated at the
  local density and temperature.
- Supersonic inlet/outlet use the equation of state and pass the secondary
  variables for non-ideal fluids.
- CConfig: compressible Cantera requires REF_DIMENSIONALIZATION= DIMENSIONAL,
  ROE or HLLC, and rejects the boundary conditions that assume an ideal gas.

Fixes found on the way:
- CNumerics::HeatFluxDiffusion and its Jacobian were not initialized, so the
  boundary viscous numerics could add an undefined energy flux.
- CFluidModel::Getdmudrho_T/GetdmudT_rho dereferenced a null viscosity model
  for fluid models that compute viscosity themselves.
- For non-ideal fluids, the supersonic inlet used ideal-gas relations, the
  general Roe flux at supersonic inlet/outlet read stale secondary variables,
  and the non-physical reconstruction check used the ideal-gas gamma.

New test case combustion/supersonic_h2_channel: autoignition of lean (phi=0.2)
premixed H2/air at 1200 K, 1 atm, Mach 2.5. Converged solution agrees with a
1D steady reacting-flow reference (reference_1d.py) within 20 K and 1.4% in
pressure downstream of ignition; ignition is 8 mm early on the 1 mm grid and
the gap halves with the grid spacing. The mesh is in the Testcases repository.
Unit test Fluid_Cantera_Compressible checks the state round trips and the
derivatives against finite differences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

names = ["H2", "H", "O", "O2", "OH", "H2O", "HO2", "H2O2", "AR"]
gas = ct.Solution(sys.argv[2] if len(sys.argv) > 2 else "h2o2.yaml")
rows = list(csv.DictReader(open(sys.argv[1])))
bigfooted and others added 2 commits October 12, 2026 13:29
…sfer tests

- CFluidCantera: SetTDState_hs (temperature from h, pressure from the ideal
  gas entropy relation) and SetTDState_Ps (Cantera setState_SP). BC_Riemann
  sets the composition of the boundary node, Riemann markers are allowed.
- LowMachPrimitiveCorrection takes the edge compositions, LOW_MACH_CORR is
  allowed with the compressible Cantera model.
- Isothermal and heat-transfer walls use the temperature derivatives of the
  secondary variables for non-ideal fluids.
- Fix: the flow under-relaxation divided the static energy change by the
  static energy, which is negative with the formation energies of Cantera and
  froze the solution. Non-ideal fluids scale it by rho*cv*T = P*rho/(dP/de).
- Fix: FLUID_CANTERA defaults to INIT_OPTION_INC= OPERATING_PRESSURE like the
  other mixture models; the incompressible slit burner cases ran at 115 and
  137 kPa instead of THERMODYNAMIC_PRESSURE.

New test cases in combustion/channel_heat_transfer (laminar planar channel,
O2/N2, Riemann inlet/outlet):
- isothermal wall, Nu = 7.40-7.61 against 7.541 (Shah & London);
- uniform heat flux, Nu = 8.26-8.31 against 8.235;
- Mach 0.01 with LOW_MACH_CORR, mass flow 0.65% from the incompressible solver;
- conjugate heat transfer with a solid wall, fluid enthalpy drop, wall heat flux
  and heat through the solid agree within 0.3%.
supersonic_h2_channel_mg.cfg runs the supersonic case with two multigrid
levels, equal to the single grid solution within 5e-5 K. Five regression
entries added. The meshes are in the Testcases repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
print(f"mass flow per width inlet {m_in:.6e} outlet {m_out:.6e} kg/(m s)")
print(f"enthalpy flux drop of the fluid {H_in - H_out:.4f} W/m")

rows = list(csv.DictReader(open(a.history)))


def read_tecplot(filename):
lines = open(filename).read().split("\n")

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