---
title: Two-point and interface fluxes
summary: The 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.
section: theory
order: 3
level: 2
keywords: [entropy conservative, entropy stable, Tadmor, Ranocha, Chandrashekar, Roe, HLLC, matrix dissipation, logarithmic mean]
---
<!-- gyre docs: expanded Markdown of theory/two-point-fluxes.md (generated tables, verification numbers and chart data are written out). Base level of this page: L2 Practice; passages at another level are bracketed by 'begin level N' / 'end level N' comments and start with [LN Name]. Built from revision ceb1f4b0be. -->

A two-point flux $\mathbf F^{\#}(\mathbf U_L, \mathbf U_R; \mathbf n)$ is a function of two states
and a direction. Gyre requires it to be **consistent**, $\mathbf F^{\#}(\mathbf U,\mathbf U;\mathbf n) =
\mathbf F(\mathbf U)\cdot\mathbf n$, **symmetric** in its two states, and linear in $\mathbf n$ (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](dgsem.md)) |

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] Entropy conservation: Tadmor's condition**

A two-point flux is entropy conservative when, for every pair of states and every direction,

$$
(\mathbf w_R - \mathbf w_L)^{\mathsf T}\, \mathbf F^{\#}(\mathbf U_L, \mathbf U_R; \mathbf n)
 = (\psi_R - \psi_L)\cdot\mathbf n, \qquad \boldsymbol\psi = \rho\,\mathbf u ,
$$

with $\mathbf w$ the [entropy variables](governing-equations.md). Inserted into the
flux-differencing volume term this makes the element-wise entropy production telescope to
its boundary ([proof sketch](dgsem.md)). 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.

<!-- end level 3 -->

<!-- begin level 4 (Theory) -->
**[L4 Theory] The Ranocha flux**

With arithmetic means $\{\!\{a\}\!\} = \tfrac12(a_L + a_R)$ and logarithmic means
$a^{\ln} = (a_L - a_R)/(\ln a_L - \ln a_R)$,

$$
\begin{aligned}
f_\rho &= \rho^{\ln}\, \{\!\{u_n\}\!\}, \\
\mathbf f_{\rho\mathbf u} &= f_\rho\, \{\!\{\mathbf u\}\!\} + \{\!\{p\}\!\}\,\mathbf n, \\
f_{\rho E} &= f_\rho \left( \tfrac12\, \mathbf u_L\!\cdot\!\mathbf u_R + \frac{1}{(\gamma-1)\,(\rho/p)^{\ln}} \right)
            + \tfrac12\left( p_L\, u_{n,R} + p_R\, u_{n,L} \right),
\end{aligned}
$$

where $u_n = \mathbf u\cdot\mathbf n$. Besides conserving entropy it preserves kinetic energy
(the momentum flux is $f_\rho\{\!\{\mathbf u\}\!\}$ 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.

<!-- end level 4 -->

<!-- begin level 4 (Theory) -->
**[L4 Theory] A logarithmic mean that is safe to differentiate**

The logarithmic mean is $0/0$ when its arguments coincide — which happens on the diagonal of
every flux-differencing sum and wherever the flow is uniform. Gyre evaluates

$$
a^{\ln} = \frac{a + b}{2 + f^2\left(\tfrac23 + f^2\left(\tfrac25 + \tfrac27 f^2\right)\right)}
\quad\text{if } f^2 < 10^{-4}, \qquad
f^2 = \frac{a(a - 2b) + b^2}{a(a + 2b) + b^2},
$$

and the closed form $(b - a)/\ln(b/a)$ otherwise. Automatic differentiation adds a subtlety:
`jnp.where` differentiates *both* branches, and the derivative of the unselected closed form is
`nan` at $a = b$, 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 $\tfrac12$ on the diagonal, and that the function is smooth across the
branch switch.

<!-- end level 4 -->

## 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 $|\lambda|$ 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, $\tfrac12\,\mathbf R\,|\boldsymbol\Lambda|\,\mathbf T\,\mathbf R\T
  (\mathbf w_R - \mathbf w_L)$: 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 $\tfrac12\lambda_{\max}(\mathbf U_R -
  \mathbf U_L)$: every wave is damped with the fastest speed;
* `ec`: the bare two-point flux, used only to *test* entropy conservation.

<!-- begin level 2 (Practice) -->
**[L2 Practice] Which combinations are provably entropy stable**

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 $\le 0$ 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 $\le 0$ 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](shock-capturing.md) 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.

<!-- end level 2 -->

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] Properties verified for every interface flux**

* consistency: $\mathbf F^*(\mathbf U,\mathbf U;\mathbf n) = \mathbf F(\mathbf U)\cdot\mathbf n$;
* conservation: $\mathbf F^*(\mathbf U_L,\mathbf U_R;\mathbf n) = -\mathbf F^*(\mathbf U_R,\mathbf U_L;-\mathbf n)$,
  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 $\min(u_{n,L} - c_L,\ \hat u_n - \hat c) \ge 0$, and Roe
  when the Roe-averaged normal Mach number $\hat u_n/\hat c \ge 1.1$ (hats denote the Roe
  average). Between $1$ and $1.1$ the slow acoustic eigenvalue $\hat u_n - \hat c$ lies
  inside the band $|\lambda| < 0.1\,\hat c$ of Harten's fix, where $|\lambda|$ is replaced
  by $(\lambda^2/\delta + \delta)/2$, 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 ($\gamma = 1.4$, normal along $x$; executed by
  `tests/test_docs_content.py`): left trace $\rho = 1$, $u = 1$, $v = 3$ at normal Mach
  number 2, right trace $\rho = 1.3$, $u = 1.1$, $v = -3$ 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 $6.7\cdot10^{-2}$ for `roe` and $5.4\cdot10^{-2}$ for `hllc`. With
  $v = \pm 1$ 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.

**Table: Entropy rate and conservation defect** (Entropy conservation and stability)

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

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T10:22:32-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [entropy_conservation.json](../data/verification/entropy_conservation.json).

The second table tests the interface fluxes alone. For a pair of states the entropy produced
at a face is $(\mathbf w_R - \mathbf w_L)\T\mathbf F^* - (\psi_R - \psi_L)\cdot\mathbf n$; 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.

**Table: Entropy production of the interface flux alone, random state pairs (Ranocha two-point flux)** (Entropy conservation and stability)

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

Provenance: gyre 0.4.0; revision `39979fcf90` (commit `39979fcf902ad6116eb550b881b4278d4599c8e2`); 2026-11-12T10:22:32-0500; device cpu; quick suite. **Revision check: Same code as this build.** Produced by 39979fcf902ad6116eb550b881b4278d4599c8e2. Every commit between it and the commit this site was built from (ceb1f4b0bed41de53e586df10858079f5a2bcdd8) changes only documentation text, evidence records or bookkeeping: the code is the same. Full record: [entropy_conservation.json](../data/verification/entropy_conservation.json).

<!-- end level 3 -->

<!-- begin level 4 (Theory) -->
**[L4 Theory] Matrix dissipation in entropy variables**

Let $\mathbf A = \partial(\mathbf F\cdot\mathbf n)/\partial\mathbf U$ with eigenvalues
$\boldsymbol\Lambda = \operatorname{diag}(u_n - a,\ u_n,\dots,u_n,\ u_n + a)$ and right
eigenvectors $\mathbf R$. Roe's solver subtracts $\tfrac12\mathbf R|\boldsymbol\Lambda|\mathbf
R^{-1}(\mathbf U_R - \mathbf U_L)$ 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 $\mathbf R\,\mathbf T\,\mathbf R\T = \partial\mathbf U/\partial\mathbf w$ with a positive
diagonal $\mathbf T$. Writing the jump in entropy variables then gives a dissipation

$$
\mathbf D = \mathbf R\,|\boldsymbol\Lambda|\,\mathbf T\,\mathbf R\T\,(\mathbf w_R - \mathbf w_L),
\qquad
(\mathbf w_R - \mathbf w_L)\T\mathbf D
 = \sum_k |\lambda_k|\,T_k\,\big(\mathbf r_k\T(\mathbf w_R - \mathbf w_L)\big)^2 \ \ge\ 0 ,
$$

for any positive mean state at which $\mathbf R$, $\boldsymbol\Lambda$ and $\mathbf T$ are
evaluated. Subtracting $\tfrac12\mathbf D$ 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 $\lambda_{\max}$. For nearby states
$\mathbf w_R - \mathbf w_L \approx (\partial\mathbf w/\partial\mathbf U)(\mathbf U_R - \mathbf U_L)$
and $\mathbf D$ tends to Roe's $|\mathbf A|(\mathbf U_R - \mathbf U_L)$.

Gyre uses the mean state of Winters, Derigs, Gassner and Walch: logarithmic means
$\rho^{\ln}$ and $\beta^{\ln}$ of the density and of $\beta = \rho/(2p)$, the arithmetic mean
of the velocity, $\hat p = \{\!\{\rho\}\!\}/(2\{\!\{\beta\}\!\})$, $\hat a^2 = \gamma\hat p/\rho^{\ln}$,
$\overline{u^2} = 2\abs{\{\!\{\mathbf u\}\!\}}^2 - \{\!\{\abs{\mathbf u}^2\}\!\}$,
$\hat h = \gamma/\big(2\beta^{\ln}(\gamma - 1)\big) + \tfrac12\overline{u^2}$, and

$$
\mathbf r_\pm = \begin{pmatrix} 1 \\ \{\!\{\mathbf u\}\!\} \pm \hat a\,\mathbf n \\ \hat h \pm \hat a\,u_n \end{pmatrix},\quad
\mathbf r_0 = \begin{pmatrix} 1 \\ \{\!\{\mathbf u\}\!\} \\ \tfrac12\overline{u^2} \end{pmatrix},\quad
\mathbf r_{t_k} = \begin{pmatrix} 0 \\ \mathbf t_k \\ \{\!\{\mathbf u\}\!\}\cdot\mathbf t_k \end{pmatrix},
\qquad
\mathbf T = \operatorname{diag}\Big(\frac{\rho^{\ln}}{2\gamma},\ \frac{(\gamma-1)\rho^{\ln}}{\gamma},\ \hat p,\dots,\ \frac{\rho^{\ln}}{2\gamma}\Big).
$$

The tangential waves are summed without constructing tangent vectors, using
$\sum_k \mathbf t_k\mathbf t_k\T = \mathbf I - \mathbf n\mathbf n\T$, so one kernel serves two
and three dimensions. The acoustic eigenvalues carry the same Harten fix as `roe`, which only
increases $|\lambda|$ 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
$|\mathbf A|$, the symmetry of the operator and the stationary contact.

<!-- end level 4 -->

<!-- begin level 3 (Mechanics) -->
**[L3 Mechanics] Why dissipation only at interfaces**

Inside an element the polynomial resolves the solution, and adding dissipation there would cost
accuracy. Jumps at interfaces measure under-resolution: they are $\mathcal O(h^{p+1})$ 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).

<!-- end level 3 -->
