Skip to content

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

Open
bigfooted wants to merge 4 commits into
developfrom
feature_CANTERA_compressible
Open

bigfooted wants to merge 4 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.


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])))
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")
bigfooted and others added 3 commits October 31, 2026 11:26
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>
…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>
…Cases repository

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bigfooted
bigfooted force-pushed the feature_CANTERA_compressible branch from d2e97dc to 82d1f67 Compare October 31, 2026 10:36
…ike the other Cantera tests

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

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.

2 participants