Documentation of the main branch
These pages follow Mallard's main branch, which is ahead of release 0.8.0: some features they describe come with the next release.
Thermodynamics and transport of mixtures¶
With [physics] gas = "mixture", the gas is a thermally perfect mixture of
the \(N_s\) species of a Cantera YAML mechanism, with temperature-dependent
species properties, mixture-averaged (or constant-Lewis-number) molecular
transport and optional thermal diffusion. This chapter gives the equation of
state, the transport coefficients and diffusive fluxes, and the double-flux
model. Mallard reads the mechanism itself and does not link Cantera; its
thermodynamics and transport reproduce Cantera's
(Cantera;
Kee, Coltrin & Glarborg 2003).
All of it is evaluated in double precision in every build
(src/chemistry/thermo.h, transport.h). Usage:
Thermochemistry.
Species thermodynamics¶
Every species \(k\) has piecewise polynomials over temperature ranges, stored
in the NASA-9 form (src/chemistry/mechanism.h):
with one coefficient set per range. NASA-7 data \((b_0,\dots,b_6)\) are stored as \((0, 0, b_0, \dots, b_6)\), and a constant-\(c_p\) species \((T_0, h_0, s_0, c_{p0})\) as \(a_2 = c_{p0}/R_u\), \(a_7 = (h_0 - c_{p0}T_0)/R_u\), \(a_8 = (s_0 - c_{p0}\ln T_0)/R_u\) (molar quantities). As in Cantera, a NASA-7 range boundary belongs to the range below it and a NASA-9 boundary to the range above, and the outermost polynomials are extrapolated beyond the data. \(h_k\) includes the enthalpy of formation. \(R_u = N_A k_B\) with the exact SI values of \(N_A\) and \(k_B\).
Mixture properties and equation of state¶
With \(Y_k = \rho Y_k/\rho\) from the transported partial densities,
Temperature from the internal energy¶
The conservative variables give \(e = \rho E/\rho - \tfrac12\lvert\mathbf{u}\rvert^2\), and \(T\) solves \(e(T; Y) = e\) by Newton's method from a per-cell seed (the previous temperature of the cell), safeguarded by bisection:
where a Newton iterate outside the current bracket \([T_a, T_b]\), which starts as \([\max(T_\mathrm{min}/2, 1\,\mathrm{K}),\ 2T_\mathrm{max}]\) with \([T_\mathrm{min}, T_\mathrm{max}]\) the range covered by every species' data, is replaced by the bracket's midpoint. Iterations stop when \(\lvert T^{m+1} - T^m\rvert \le 10^{-10} T^m\) (at most 200). Then \(p = \rho R T\).
Frozen surrogates¶
The numerical fluxes see a cell's thermodynamics through two surrogates, the
frozen ratio of specific heats and an energy offset
(Mixture::cell_state, src/physics/mixture.h):
so that eq. \(\eqref{eq:frozen-surrogates}\) holds exactly at the cell state; \(e_0 = 0\) for a calorically perfect gas. The sound speed of the fluxes is the frozen one, \(a = \sqrt{\gamma p/\rho}\). Reconstructed face states carry their own \((\gamma, e_0)\) (chapter 5), and the Riemann solvers use each side's pair (chapter 6).
Transport¶
With [physics] type = "navier_stokes", the mixture is viscous, conducts
heat and diffuses species. The transport data of the mechanism
(Lennard-Jones parameters, dipole moment, polarizability, rotational
relaxation number) give pure-species properties as Cantera's mixture-averaged
model computes them: viscosities and binary diffusion coefficients from the
collision integrals of Monchick & Mason 1961
with Cantera's polar corrections, and conductivities with Parker's rotational
relaxation. As in Cantera, they are fitted once, at start-up, by weighted
least squares (relative error) at 50 temperatures evenly spaced over
\([T_\mathrm{min}, T_\mathrm{max}]\) (src/chemistry/transport.cpp), as
polynomials of degree 4 in \(\ln T\):
In the mixing rules, negative mass fractions (round-off, or overshoots of explicit diffusion) count as zero, and mole fractions below \(10^{-20}\) as \(10^{-20}\), as in Cantera.
Viscosity and conductivity¶
The viscosity follows Wilke's rule (Wilke 1950) and the conductivity the combination rule of Mathur, Tondon & Saxena 1967:
Diffusion coefficients¶
The species diffusion coefficient \(D_k\) depends on [physics] transport:
with \(Le_k\) from lewis (default 1). The mixture-averaged numerator is
\(1 - Y_k\) summed from the other species, which stays accurate where species
\(k\) is nearly pure. For a single-species mechanism, \(D_1 = \mathcal{D}_{11}\).
Diffusive fluxes¶
Species diffuse along mole-fraction gradients with a correction velocity (Kee, Coltrin & Glarborg 2003), so that the diffusive mass fluxes sum to zero and the continuity equation needs no diffusion term:
where the second term is \(\rho Y_k\mathbf{V}^c\) (the normalization by \(\sum_j Y_j\) removes the drift of \(\sum_k Y_k\) from 1) and the last term is present with thermal diffusion only. The energy equation carries the enthalpy they transport (eq. (7) of chapter 1):
There is no Dufour effect, as in Cantera. The face discretization of eqs. \(\eqref{eq:diffusive-fluxes-1}\)-\(\eqref{eq:diffusive-fluxes-2}\) is in chapter 6.
Thermal diffusion (Soret effect)¶
With soret = true (mixture-averaged transport only), the thermal diffusion
coefficients are Cantera's mixture-averaged ones, the model of
Chapman & Cowling 1970 as given by
Zirwes & Kronenburg 2025:
with \(D_k\) the mixture-averaged coefficient of eq. \(\eqref{eq:diffusion-coefficients}\), \(\Phi_{kj}\) Wilke's operator of eq. \(\eqref{eq:viscosity-and-conductivity-1}\), and \(C^{\ast}_{kj}\) the reduced collision integral of Monchick & Mason at \(T^{\ast} = k_B T/\epsilon_{kj}\), fitted as in Cantera by a polynomial of degree 8 in \(\ln T^{\ast}\) over the table rows that bracket the mechanism's range of \(T^{\ast}\) (fitted in the reduced dipole moment for polar pairs). The \(D_k^T\) sum to zero, so the correction velocity of eq. \(\eqref{eq:diffusive-fluxes-1}\) remains that of the Fickian part.
Time-step diffusivity¶
Each cell's effective diffusivity for the viscous time-step limit (chapter 7) is
thermal diffusion couples the species to \(T\) one way and adds no diffusive eigenvalue.
Double flux¶
A conservative scheme for a mixture whose \(\gamma\) varies across a contact
(for example cold hydrogen against hot air) perturbs pressure and velocity
there: the conservative update of \(\rho E\) mixes cells with different
\((\gamma, e_0)\), and eq. \(\eqref{eq:frozen-surrogates}\) then returns a non-uniform pressure. The
double-flux model (Abgrall & Karni 2001;
Billet & Abgrall 2003;
Ma, Lv & Ihme 2017),
[numerics] double_flux = true, removes these oscillations at the cost of
exact energy conservation (src/solver/solver_mixture.cpp,
src/numerics/mixture_flux.h):
- At the start of each time step, every cell freezes its \((\gamma_i^{\ast}, e_{0,i}^{\ast})\) from the true equation of state, eq. \(\eqref{eq:frozen-surrogates}\).
-
Within all the stages of the step, cell pressures come from the frozen pair, \(p_i = (\gamma_i^{\ast} - 1)\left(\rho E_i - \rho_i e_{0,i}^{\ast} - \tfrac12\rho_i\lvert\mathbf{u}_i\rvert^2\right)\), and each face computes two numerical fluxes from the same reconstructed \(\mathbf{W}^L\), \(\mathbf{W}^R\): \(\hat{\mathbf{F}}^{(L)}\) converts both sides to conservative variables with the left cell's frozen pair, and \(\hat{\mathbf{F}}^{(R)}\) with the right cell's. Mass and momentum use their mean, which keeps them conservative; the energy of each cell uses the flux computed with its own pair:
\[ \begin{equation} \hat F_{\rho} = \tfrac12\left(\hat F^{(L)}_{\rho} + \hat F^{(R)}_{\rho}\right), \qquad \hat{\mathbf{F}}_{\rho\mathbf{u}} = \tfrac12\left(\hat{\mathbf{F}}^{(L)}_{\rho\mathbf{u}} + \hat{\mathbf{F}}^{(R)}_{\rho\mathbf{u}}\right), \qquad \hat F_{\rho E}\big\vert_{\text{cell } L} = \hat F^{(L)}_{\rho E}, \quad \hat F_{\rho E}\big\vert_{\text{cell } R} = \hat F^{(R)}_{\rho E}. \label{eq:double-flux} \end{equation} \]Both fluxes estimate their wave speeds with each side's own frozen pair (
riemann::SideThermo), so their mass fluxes agree at a contact for every Riemann solver. With the hybrid flux, each of the two is blended with the central flux computed with the same pair (chapter 6). The species fluxes use the mean mass flux (chapter 6). 3. After the step, \(\rho E\) of each cell is reset to the true equation of state at the pressure the frozen pair gives, keeping \(\rho\), \(\rho\mathbf{u}\) and the composition: \(T = p/(\rho R)\) and \(\rho E = \rho\,e(T; Y) + \tfrac12\rho\lvert\mathbf{u}\rvert^2\).
A contact between gases at uniform pressure and velocity then stays exactly uniform in \(p\) and \(\mathbf{u}\). Double flux cannot be combined with SIMPLER splitting, whose reaction substep within the step would leave the frozen thermodynamics stale (chapter 3).