Gyre/Mathematics & Numerical Methods
Two-point and interface fluxes
In one minuteThe volume terms use symmetric two-point fluxes that conserve entropy exactly; dissipation is added only at element interfaces through an upwind flux. A discrete entropy inequality is proven for the two interface fluxes built on the entropy-conservative flux (es_roe with matrix dissipation, llf with scalar dissipation); for the classical Roe flux, which is the default, and for HLLC entropy decay is measured, not proven.
A two-point flux is a function of two states and a direction. Gyre requires it to be consistent, , symmetric in its two states, and linear in (so that metric-weighted directions can be passed directly).
| name | entropy conservative | kinetic-energy preserving | use |
|---|---|---|---|
ranocha (default) |
yes | yes, and pressure-equilibrium preserving | production |
chandrashekar |
yes | yes | alternative |
kennedy_gruber |
no | yes | comparison |
central |
no | no | the standard DGSEM on elements with constant metric terms; a metric-split variant of it on curved elements (details) |
A two-point flux is entropy conservative when, for every pair of states and every direction,
with the entropy variables. Inserted into the
flux-differencing volume term this makes the element-wise entropy production telescope to
its boundary (proof sketch). The property is tested pointwise for random admissible
states in 2-D and 3-D (test_entropy_conservation_condition), and the non-conservative fluxes
are tested to violate it, so the test cannot pass vacuously.
With arithmetic means and logarithmic means ,
where . Besides conserving entropy it preserves kinetic energy (the momentum flux is plus a pressure term) and keeps a moving contact with uniform pressure and velocity exactly in equilibrium, which suppresses a known source of spurious pressure oscillations in split-form schemes.
The logarithmic mean is when its arguments coincide — which happens on the diagonal of every flux-differencing sum and wherever the flow is uniform. Gyre evaluates
and the closed form otherwise. Automatic differentiation adds a subtlety:
jnp.where differentiates both branches, and the derivative of the unselected closed form is
nan at , which would poison Jacobians and adjoints even though the value is correct.
The implementation therefore feeds the unselected branch harmless substitute arguments (the
“double-where” idiom). The unit test checks that forward- and reverse-mode derivatives are
finite everywhere, equal on the diagonal, and that the function is smooth across the
branch switch.
Interface fluxes#
At element faces the two traces are genuinely different states and information must be upwinded. Gyre offers
roe(default): Roe’s approximate Riemann solver — the arithmetic mean of the two physical fluxes minus Roe’s matrix dissipation — with Harten’s entropy fix on the acoustic waves (which also makes differentiable through sonic points). It does not use the two-point volume flux;hllc: the classical three-wave HLLC solver. It does not use the two-point volume flux either;es_roe: the two-point volume flux plus Roe-type matrix dissipation applied to the jump of the entropy variables, : each wave is damped with its own speed, as in Roe’s solver, and the flux is entropy stable by construction;llf: the two-point volume flux plus scalar dissipation : every wave is damped with the fastest speed;ec: the bare two-point flux, used only to test entropy conservation.
The statement “the discrete entropy cannot grow” is a theorem only under conditions, and the default configuration does not meet all of them.
| Interface flux | Volume flux ranocha or chandrashekar |
Status |
|---|---|---|
ec |
entropy conserved to round-off | proven, and measured |
llf |
entropy rate for every admissible nodal state | proven (entropy-conservative flux plus a dissipation that is non-negative in entropy variables), and measured |
es_roe |
entropy rate for every admissible nodal state | proven (entropy-conservative flux plus a symmetric positive semi-definite matrix acting on the jump of the entropy variables), and measured |
roe (default) |
entropy rate negative in the measured states | measured only; no proof |
hllc |
entropy rate negative in the measured states | measured only; no proof |
With the volume fluxes kennedy_gruber and central there is no entropy statement for any
interface flux.
What the proof for llf and es_roe covers, and what no proof in Gyre covers:
- It is semi-discrete (exact time integration), for the inviscid terms, on periodic or
interior faces, and it assumes positive density and pressure at every node. Positivity is
not enforced by the scheme; a state that leaves the admissible set ends the argument. (The
steady solver’s line search rejects updates with non-positive density or pressure; a solve
that finds no admissible update ends with the reason
pseudo-time step collapsed.) - Wall and far-field boundary conditions are imposed through the interface flux with a constructed exterior state; they carry no discrete entropy proof.
- The viscous terms (BR2 with gradients of velocity and temperature rather than of the entropy variables) and the shock-capturing viscosity carry no discrete entropy proof.
- The steady solver is an implicit pseudo-time iteration; nothing above bounds its iterates.
So the default configuration (ranocha volume flux, roe interface flux) gives
entropy-conservative volume terms — aliasing inside an element cannot produce entropy of the
wrong sign — and an interface dissipation that removed entropy in every state of the
verification study, but not a proven entropy inequality. Choose surface_flux: llf when the
proven property matters more than the lower dissipation of Roe.
- consistency: ;
- conservation: , so what leaves one element enters its neighbour even though each face is evaluated from both sides;
- full upwinding in supersonic flow, under a condition on the wave-speed estimates, not on the Mach numbers of the two traces. For flow from left to right, HLLC returns the left flux when its left wave speed , and Roe when the Roe-averaged normal Mach number (hats denote the Roe average). Between and the slow acoustic eigenvalue lies inside the band of Harten’s fix, where is replaced by , so the Roe flux differs slightly from the upstream flux there. For nearly equal traces the Roe average is the trace state and the condition is the trace Mach number. For very different traces it is not: the Roe-averaged sound speed contains the jump of the tangential velocity, so two traces that are each supersonic along the normal can have a subsonic Roe average, and then neither flux is the upstream flux. The unit test of this property runs at Mach 2.5 with nearby traces.
An evaluated example (, normal along ; executed by
tests/test_docs_content.py): left trace , , at normal Mach
number 2, right trace , , at normal Mach number 1.5. The
Roe-averaged normal Mach number is 0.711, and the largest component of the difference to
the left flux is for roe and for hllc. With
instead (Roe-averaged normal Mach number 1.36) both return the left flux to
round-off.
Entropy dissipation is not in this list of properties. For llf and es_roe it follows
from the construction; for roe and hllc it is an observation: in the study below the
discrete entropy rate was negative for one perturbed periodic state in 2-D and one in 3-D,
each on a warped mesh. That is evidence for those states, not a guarantee for every state.
| dim | volume flux | interface flux | d/dt ∫ η | |Σ Rw| |
|---|---|---|---|---|
| 2-D | ranocha | ec | -5.9781e-15 | 4.4631e-14 |
| 2-D | chandrashekar | ec | -8.0969e-15 | 4.8850e-14 |
| 2-D | kennedy_gruber | ec | -5.9810e-04 | 4.2411e-14 |
| 2-D | central | ec | -4.5667e-04 | 4.3077e-14 |
| 2-D | ranocha | llf | -0.0550953 | 4.6629e-14 |
| 2-D | ranocha | es_roe | -0.0183493 | 4.4631e-14 |
| 2-D | chandrashekar | es_roe | -0.0183493 | 4.7296e-14 |
| 2-D | ranocha | roe | -0.0183487 | 4.1300e-14 |
| 2-D | ranocha | hllc | -0.0183448 | 4.0856e-14 |
| 3-D | ranocha | ec | -3.6880e-15 | 1.1970e-14 |
| 3-D | chandrashekar | ec | -3.5232e-15 | 1.1685e-14 |
| 3-D | kennedy_gruber | ec | -0.00119758 | 2.6854e-15 |
| 3-D | central | ec | -0.00744448 | 1.8180e-15 |
| 3-D | ranocha | llf | -0.0543174 | 1.1796e-14 |
| 3-D | ranocha | es_roe | -0.0177799 | 1.1602e-14 |
| 3-D | chandrashekar | es_roe | -0.0177799 | 1.2261e-14 |
| 3-D | ranocha | roe | -0.0178301 | 1.3600e-15 |
| 3-D | ranocha | hllc | -0.0178184 | 8.1879e-16 |
gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build
The second table tests the interface fluxes alone. For a pair of states the entropy produced at a face is ; an entropy-stable flux makes it non-positive for every pair, which is the property the proof rests on. The pairs are random and far apart (densities and pressures over a decade, Mach numbers up to about three), far outside what a resolved computation presents to a face.
| dim | interface flux | pairs | largest production | pairs with production > 0 [%] |
|---|---|---|---|---|
| 2-D | llf | 5000 | -0.0571705 | 0 |
| 2-D | es_roe | 5000 | -0.0301779 | 0 |
| 2-D | roe | 5000 | 1365.06 | 18.5 |
| 2-D | hllc | 5000 | -0.0156571 | 0 |
| 3-D | llf | 5000 | -0.228196 | 0 |
| 3-D | es_roe | 5000 | -0.0411714 | 0 |
| 3-D | roe | 5000 | 812.676 | 19.18 |
| 3-D | hllc | 5000 | -0.0401914 | 0 |
gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build
Let with eigenvalues and right eigenvectors . Roe’s solver subtracts from the mean of the two fluxes; nothing guarantees the sign of the entropy this produces. Barth’s observation is that the eigenvectors can be scaled so that with a positive diagonal . Writing the jump in entropy variables then gives a dissipation
for any positive mean state at which , and are
evaluated. Subtracting from an entropy-conservative flux therefore gives a
flux whose entropy production at a face is non-positive: the same argument as for llf, with
a matrix in place of the scalar . For nearby states
and tends to Roe’s .
Gyre uses the mean state of Winters, Derigs, Gassner and Walch: logarithmic means and of the density and of , the arithmetic mean of the velocity, , , , , and
The tangential waves are summed without constructing tangent vectors, using
, so one kernel serves two
and three dimensions. The acoustic eigenvalues carry the same Harten fix as roe, which only
increases and so does not affect the inequality. With this mean state a contact
discontinuity at rest is left exactly alone (no mass flux through it), where llf diffuses
it with the speed of sound; unit tests check the inequality for random pairs, the limit
, the symmetry of the operator and the stationary contact.
Inside an element the polynomial resolves the solution, and adding dissipation there would cost accuracy. Jumps at interfaces measure under-resolution: they are for resolved features and large only where the mesh cannot represent the solution. Interface dissipation proportional to the jump is therefore automatically high-order where the solution is smooth and stabilising where it is not, while the entropy-conservative volume term guarantees that the volume terms — where aliasing errors arise — neither produce nor destroy entropy (given positive density and pressure).