Gyredocs
Depth Practice
API

Gyre/Mathematics & Numerical Methods

Split-form DG spectral elements

In one minuteSpace is discretized by a nodal discontinuous Galerkin spectral element method on Gauss–Lobatto points. Its derivative operator satisfies summation by parts, which lets the volume terms be written as differences of symmetric two-point fluxes and gives discrete conservation and entropy statements on curved meshes.

Written at L2 Practice goes to L4 Theory 1428 words Markdown

The domain is partitioned into curved quadrilateral or hexahedral elements. Each element is the image of the reference cube [−1,1]d[-1,1]^d under a polynomial mapping x(ξ)\mathbf x(\boldsymbol\xi), and the solution is a tensor-product polynomial of degree pp in ξ\boldsymbol\xi, stored by its values at the (p+1)d(p+1)^d Legendre–Gauss–Lobatto (LGL) nodes. Neighbouring elements are coupled only through numerical fluxes on shared faces — the solution may jump across them.

Using the same LGL points for interpolation and quadrature makes three things true at once:

  • the mass matrix is diagonal, M=diag⁡(w0,…,wp)\mathbf M = \operatorname{diag}(w_0,\dots,w_p), so no linear system is needed to evaluate a time derivative;
  • face values are simply nodal values (the end points are nodes), so no interpolation to faces;
  • the derivative matrix D\mathbf D with Dij=ℓj′(ξi)D_{ij} = \ell_j'(\xi_i) satisfies summation by parts (SBP), the discrete integration-by-parts identity below.

The price is that LGL quadrature with p+1p+1 points is exact only to degree 2p−12p-1, one short of what the mass matrix of degree-pp polynomials needs. The split form turns this weakness into a controlled one.

Q=MD,Q+QT=B=diag⁡(−1,0,…,0,+1).\mathbf Q = \mathbf M \mathbf D, \qquad \mathbf Q + \mathbf Q^{\mathsf T} = \mathbf B = \operatorname{diag}(-1, 0, \dots, 0, +1).

For nodal vectors u,v\mathbf u, \mathbf v this is uTMDv+(Du)TMv=upvp−u0v0\mathbf u^{\mathsf T}\mathbf M\mathbf D\mathbf v + (\mathbf D\mathbf u)^{\mathsf T}\mathbf M\mathbf v = u_p v_p - u_0 v_0: integration by parts, exactly, for the discrete inner product. Every stability and conservation property of the scheme is a consequence of this identity; none relies on exact integration. The verification study “Summation-by-parts operators” checks it to round-off for all degrees in use.

PassedSummation-by-parts operators1 of 1 checks passed · 0.29 s · quick suite

Gauss–Lobatto collocation operators: the SBP identity M D + (M D)^T = B, quadrature exactness to degree 2p-1, exact differentiation of degree-p polynomials, skew-symmetry of the flux-differencing matrix M S and consistency of the p-multigrid transfers.

  • largest defect over all identities and degrees6.22e-15expected < 1e-11pass

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

From the strong form to flux differencing#

In reference coordinates a conservation law reads J ∂tU+∑a∂ξaF~a=0J\,\partial_t \mathbf U + \sum_a \partial_{\xi_a} \tilde{\mathbf F}_a = 0 with contravariant fluxes F~a=∑b(Jaba) Fb\tilde{\mathbf F}_a = \sum_b (J a^a_b)\,\mathbf F_b (see curvilinear metrics). The standard strong-form DGSEM applies D\mathbf D to the nodal fluxes and penalises the difference between the numerical flux F∗\mathbf F^* and the interior flux at the two end nodes of each line of nodes.

Gyre replaces the derivative of the nodal flux by a flux-differencing operator. Along one line of nodes in direction aa, at node ii:

Ji ∂tUi+∑m=0pSim  F~a#(Ui,Um)+δi∈∂wi  F∗(U−,U+;n) sJ=0,S=2D−M−1B,J_i\,\partial_t \mathbf U_i + \sum_{m=0}^{p} S_{im}\; \tilde{\mathbf F}^{\#}_a(\mathbf U_i, \mathbf U_m) + \frac{\delta_{i\in\partial}}{w_i}\; \mathbf F^*(\mathbf U^-, \mathbf U^+;\mathbf n)\, s_J = 0, \qquad \mathbf S = 2\mathbf D - \mathbf M^{-1}\mathbf B ,

where F#\mathbf F^{\#} is a symmetric, consistent two-point flux and the contravariant two-point flux uses the average of the metric terms at the two nodes, F~a#(Ui,Um)=∑b12[(Jaba)i+(Jaba)m] Fb#(Ui,Um)\tilde{\mathbf F}^{\#}_a(\mathbf U_i,\mathbf U_m) = \sum_b \tfrac12\big[(Ja^a_b)_i + (Ja^a_b)_m\big]\, \mathbf F^{\#}_b(\mathbf U_i,\mathbf U_m). The last term lifts the interface flux onto the two face nodes with the factor 1/wi1/w_i (sJs_J is the surface Jacobian, n\mathbf n the outward normal).

Two remarks make this concrete:

  • MS=Q−QT\mathbf M\mathbf S = \mathbf Q - \mathbf Q^{\mathsf T} is skew-symmetric and S\mathbf S has a zero diagonal. The interior-flux boundary correction of the strong form has been absorbed into S\mathbf S using consistency, F#(U,U)=F(U)\mathbf F^{\#}(\mathbf U,\mathbf U) = \mathbf F(\mathbf U).
  • With the arithmetic-mean flux F#=12(Fi+Fm)\mathbf F^{\#} = \tfrac12(\mathbf F_i + \mathbf F_m) (option central) the scheme is algebraically identical to the standard strong-form DGSEM on elements whose metric terms are constant along each node line (affine elements). On a curved element it is not: because the metric terms are averaged as well, the volume term is ∑mSim 14[(Ja)i+(Ja)m](Fi+Fm)\sum_m S_{im}\,\tfrac14\big[(Ja)_i + (Ja)_m\big](\mathbf F_i + \mathbf F_m), which differs from the standard ∑mSim 12[(Ja F)i+(Ja F)m]\sum_m S_{im}\,\tfrac12\big[(Ja\,\mathbf F)_i + (Ja\,\mathbf F)_m\big] by −14∑mSim[(Ja)i−(Ja)m](Fi−Fm)-\tfrac14\sum_m S_{im}\big[(Ja)_i - (Ja)_m\big](\mathbf F_i - \mathbf F_m). There central is the metric-split form of Gassner, Winters and Kopriva (2016), which is still conservative and free-stream preserving. Other choices of F#\mathbf F^{\#} correspond to split (skew-symmetric) forms of the nonlinear terms, which is where the name comes from.

Conservation. Multiply the volume term by wiw_i and sum over ii: because MS\mathbf M\mathbf S is skew-symmetric and F#\mathbf F^{\#} is symmetric, ∑i,m(MS)im F#(Ui,Um)=0\sum_{i,m} (MS)_{im}\,\mathbf F^{\#}(\mathbf U_i, \mathbf U_m) = 0. Only the interface fluxes remain, and they cancel between neighbours for any conservative F∗\mathbf F^*.

Entropy. Contract with the entropy variables wi\mathbf w_i instead. Skew-symmetry gives ∑i,m(MS)im wiTFim#=12∑i,m(MS)im (wi−wm)TFim#.\sum_{i,m} (MS)_{im}\, \mathbf w_i^{\mathsf T}\mathbf F^{\#}_{im} = \tfrac12 \sum_{i,m} (MS)_{im}\, (\mathbf w_i - \mathbf w_m)^{\mathsf T}\mathbf F^{\#}_{im} . If the two-point flux satisfies Tadmor’s condition (wi−wm)TFim#=ψi−ψm(\mathbf w_i - \mathbf w_m)^{\mathsf T}\mathbf F^{\#}_{im} = \psi_i - \psi_m, the right-hand side telescopes, by SBP, to boundary values of the entropy potential — exactly the discrete counterpart of ∫wT∂ξF=[ψ]\int \mathbf w^{\mathsf T}\partial_\xi \mathbf F = [\psi]. No quadrature exactness was used, so the statement survives the aliasing of LGL collocation and, with metric averaging and discretely divergence-free metrics, holds on curved elements. With an entropy-conservative interface flux the semi-discrete scheme conserves ∑wJ η\sum w J\,\eta to round-off.

Entropy decay needs a condition on the interface flux. What remains after the telescoping is, per interior face, (w+−w−)TF∗−(ψ+−ψ−)⋅n(\mathbf w^+ - \mathbf w^-)^{\mathsf T}\mathbf F^* - (\psi^+ - \psi^-)\cdot \mathbf n. The total entropy decays if this is non-positive for every pair of states, i.e. if F∗\mathbf F^* is itself entropy stable. The llf flux is: it is the entropy-conservative flux minus 12λ(U+−U−)\tfrac12\lambda(\mathbf U^+ - \mathbf U^-), and (w+−w−)T(U+−U−)≥0(\mathbf w^+ - \mathbf w^-)^{\mathsf T}(\mathbf U^+ - \mathbf U^-) \ge 0 because the entropy is convex. So is es_roe, which subtracts a symmetric positive semi-definite matrix applied to w+−w−\mathbf w^+ - \mathbf w^- and keeps the wave-by-wave dissipation of Roe’s solver. The default roe flux and hllc are not built on the entropy-conservative flux and no such inequality is proven for them; that their entropy rate is negative in the chart below is a measurement on the states of the study. The argument also covers only the inviscid terms on interior or periodic faces, with positive density and pressure; see which combinations are provably entropy stable.

Entropy production rate by flux pairingEntropy conservation and stability

Measured here: with an entropy-conservative volume flux and the dissipation-free interface flux the entropy rate is at most 8.1e-15 in magnitude; with the upwind interface fluxes it lies between -5.5e-02 and -1.8e-02.

Data table
volume flux / interface flux2-D3-D
ranocha / ec5.9781e-153.6880e-15
chandrashekar / ec8.0969e-153.5232e-15
kennedy_gruber / ec5.9810e-040.00119758
central / ec4.5667e-040.00744448
ranocha / llf0.05509530.0543174
ranocha / es_roe0.01834930.0177799
chandrashekar / es_roe0.01834930.0177799
ranocha / roe0.01834870.0178301
ranocha / hllc0.01834480.0178184

gyre 0.4.0 · 39979fcf90 · · cpu · quick suite · record (JSON)Same code as this build

A naive implementation evaluates F#\mathbf F^{\#} for all (p+1)2(p+1)^2 ordered node pairs per line. Since F#\mathbf F^{\#} is symmetric and Sii=0S_{ii} = 0, only the p(p+1)/2p(p+1)/2 unordered pairs are needed. Basis1D.pair_tables() returns index vectors iL, iR and a matrix C so that the flux-differencing sum is one gather, one batched flux evaluation and one small matrix product per direction:

python
f = phys.flux_volume(jnp.take(U, iL, axis=ax), jnp.take(U, iR, axis=ax),
                     0.5 * (jnp.take(Ja[a], iL, axis=ax) + jnp.take(Ja[a], iR, axis=ax)), th)
JR = JR + apply_1d(f, C, ax)          # C[i, q] = S[i, m] for pair q = {i, m}

The same code runs for d=2d = 2 and 33: the array has dd nodal axes and the loop runs over them. For p=3p = 3 this more than halves the cost of the dominant kernel (6 pairs instead of 16).

For smooth solutions the design order of accuracy is p+1p + 1. Gyre’s verification studies show:

  • p+1p+1 for linear-in-effect problems and for steady inviscid manufactured solutions on Cartesian meshes;
  • between pp and p+1p+1 for the strongly nonlinear unsteady isentropic vortex, and somewhat below p+1p+1 on strongly warped coarse meshes — reduced rates of this kind are a known characteristic of Gauss–Lobatto collocation;
  • in viscous, diffusion-dominated flow, reduced rates between pp and p+1p+1 with pressure the slowest variable (see order of accuracy).
Density error after convectionAdvected density wave
Data table
hp = 1p = 2p = 3p = 4
0.1250.02445110.001255255.2276e-052.0736e-06
0.06250.007168471.6201e-043.4487e-066.8806e-08
0.031250.001886122.0333e-052.1592e-072.1334e-09

gyre 0.4.0 · 39979fcf90 · · gpu · NVIDIA GeForce RTX 3060 Ti · quick suite · record (JSON)Same code as this build

    ↑ ↓ moveEnter open[ ] change depthResults show section and depth level