Gyredocs
Depth Practice
API

Gyre/Mathematics & Numerical Methods

Viscous terms — the BR2 scheme

In one minuteViscous fluxes use the second scheme of Bassi and Rebay with lifting operators evaluated on Gauss–Lobatto nodes. The discretization is compact (face neighbours only) and symmetric, which the implicit solver and the adjoint both rely on.

Written at L3 Mechanics goes to L4 Theory 1483 words Markdown

A discontinuous solution has no gradient at element faces, and using only element-interior gradients gives an inconsistent — and unstable — diffusion operator. Gyre uses the BR2 scheme: the gradient is corrected by lifting the solution jumps at faces into the elements.

Let W=(u,T)\mathbf W = (\mathbf u, T) be the gradient variables and G=1J∑a(Jaa) DaW\mathbf G = \tfrac1J \sum_a (J\mathbf a^a)\,\mathbf D_a \mathbf W the element-local (strong, non-conservative) gradient. For each face ff of an element define the face lifting, non-zero only at that face’s nodes:

rf=sJwend J (W∗−W−)⊗n,W∗={12(W−+W+)interior faceWbboundary face.\mathbf r_f = \frac{s_J}{w_\text{end}\, J}\,(\mathbf W^* - \mathbf W^-)\otimes\mathbf n, \qquad \mathbf W^* = \begin{cases} \tfrac12(\mathbf W^- + \mathbf W^+) & \text{interior face} \\ \mathbf W_b & \text{boundary face.} \end{cases}

The scheme then uses two different gradients:

q=G+∑frf⏟volume flux Fv(U,q)qf=G+η rf⏟face flux 12[Fv(U−,qf−)+Fv(U+,qf+)]⋅n\underbrace{\mathbf q = \mathbf G + \sum_f \mathbf r_f}_{\text{volume flux } \mathbf F_v(\mathbf U,\mathbf q)} \qquad\qquad \underbrace{\mathbf q_f = \mathbf G + \eta\,\mathbf r_f}_{\text{face flux } \tfrac12\left[\mathbf F_v(\mathbf U^-, \mathbf q_f^-) + \mathbf F_v(\mathbf U^+, \mathbf q_f^+)\right]\cdot\mathbf n}

and the divergence of the volume flux is taken in weak form with Dw=M−1DTM\mathbf D^w = \mathbf M^{-1} \mathbf D^{\mathsf T}\mathbf M, the adjoint of D\mathbf D in the quadrature inner product. Using only the face’s own lifting in the face flux (rather than the full q\mathbf q, as BR1 does) is what keeps the stencil compact.

Because the LGL mass matrix is diagonal, the lifting relation ∫Krf⋅τ=∫f(W∗−W−) n⋅τ\int_K \mathbf r_f\cdot\boldsymbol\tau = \int_f (\mathbf W^* - \mathbf W^-)\,\mathbf n\cdot\boldsymbol\tau is satisfied pointwise by the formula above — no linear solve. Summing the volume term over the two elements adjacent to a face gives, for a linear flux Fv=Kq\mathbf F_v = \mathbf K\mathbf q,

∑K(K R([W]), G(v))K=−∑f⟨[W], { ⁣{KTG(v)} ⁣}⋅n⟩f,\sum_K (\mathbf K\,\mathbf R([\mathbf W]),\, \mathbf G(\mathbf v))_K = -\sum_f \langle [\mathbf W],\, \{\!\{\mathbf K^{\mathsf T}\mathbf G(\mathbf v)\}\!\}\cdot\mathbf n\rangle_f ,

which is the mirror image of the consistency term −∑f⟨{ ⁣{KG(W)} ⁣}⋅n,[v]⟩f-\sum_f\langle\{\!\{\mathbf K\mathbf G(\mathbf W)\}\!\}\cdot\mathbf n, [\mathbf v]\rangle_f produced by the face flux, and the penalty term η∑f⟨rf([W]),rf([v])⟩\eta\sum_f\langle\mathbf r_f([\mathbf W]),\mathbf r_f([\mathbf v])\rangle is symmetric positive semi-definite. The discrete operator is therefore the symmetric BR2 bilinear form evaluated with LGL quadrature. Symmetry is not cosmetic: it is the discrete statement of adjoint consistency, the property that lets functionals converge faster than the solution and makes the output error estimate sharp.

The requirement that the gradient (D\mathbf D, strong, non-conservative) and divergence (Dw\mathbf D^w, weak) be exact adjoints is why Gyre mixes the two forms rather than using one throughout.

Relative asymmetry and smallest eigenvalueStructure of the BR2 viscous operator
warpboundariespasym. (heat)asym. (stress)min eig (heat)min eig (stress)
0periodic22.7046e-162.0254e-16-5.4470e-166.5560e-16
0periodic32.2839e-162.5421e-161.1123e-16-1.8926e-15
0Dirichlet27.9058e-171.1709e-160.04231560.0252442
0Dirichlet36.5254e-171.4417e-160.02463660.0147011
0.05periodic21.9043e-162.8210e-161.5375e-155.5369e-17
0.05periodic32.3864e-162.9273e-161.1192e-15-5.0847e-16
0.05Dirichlet25.4250e-171.5964e-160.04177770.0247796
0.05Dirichlet31.3399e-161.6369e-160.02425480.0143994

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

The coercivity proofs for BR2 (Brezzi, Manzini, Marini, Pietra and Russo 2000; Arnold, Brezzi, Cockburn and Marini 2002) need η\eta strictly greater than the number of faces of an element; at equality the argument gives only a non-negative, not a coercive, form. Gyre’s default is the customary borderline value η=2d\eta = 2d (4 for quadrilaterals, 6 for hexahedra), which lies on the edge of the proven range, not inside it. The proofs are also for exact integration, whereas Gyre uses Gauss–Lobatto quadrature. No instability has been observed with the default in the tests and studies; the value is an input of the discretization (Discretization(..., eta_br2=...) in Python) for anyone who wants to be inside the proven range. At the finite-volume level p=0p = 0 there is no interior gradient and the lifting alone carries the viscous flux. With η=2\eta = 2 it is the two-point difference along the face normal: exact on uniform spacing, too large by (h1+h2)2/(4h1h2)(h_1 + h_2)^2 / (4 h_1 h_2) between cells of widths h1h_1 and h2h_2. The gradient components tangential to a face, and with them the cross-derivative terms of the stress, are absent. The p=0p = 0 viscous operator is therefore a p-multigrid preconditioner level, not a consistent Navier–Stokes discretization, and cannot be selected as the solution degree of a viscous case.

The residual of an element depends only on itself and its face neighbours. This is verified by inspecting the sparsity of a dense AD Jacobian, and it is what allows the element-diagonal blocks used by the preconditioner to be extracted exactly with the split-argument trick.

PassedStructure of the BR2 viscous operator17 of 17 checks passed · 116.9 s · quick suite

At a quiescent state the energy–energy and momentum–momentum blocks of the weak-form Jacobian are exactly the discrete heat-conduction and viscous-stress operators. Their symmetry (the hallmark of an adjoint-consistent diffusion discretization) and positive semi-definiteness are checked on Cartesian and warped meshes with periodic and Dirichlet boundaries, and the Jacobian sparsity pattern is checked to be compact (face neighbours only), which element-block preconditioning relies on.

  • warp=0.0, periodic, p=2: asymmetry2.70e-16expected < 1e-12pass
  • warp=0.0, periodic, p=2: smallest eigenvalue-5.45e-16expected >= -1e-12pass
  • warp=0.0, periodic, p=3: asymmetry2.54e-16expected < 1e-12pass
  • warp=0.0, periodic, p=3: smallest eigenvalue-1.89e-15expected >= -1e-12pass
  • warp=0.0, Dirichlet, p=2: asymmetry1.17e-16expected < 1e-12pass
  • warp=0.0, Dirichlet, p=2: smallest eigenvalue0.02524expected >= -1e-12pass
  • warp=0.0, Dirichlet, p=3: asymmetry1.44e-16expected < 1e-12pass
  • warp=0.0, Dirichlet, p=3: smallest eigenvalue0.0147expected >= -1e-12pass
  • warp=0.05, periodic, p=2: asymmetry2.82e-16expected < 1e-12pass
  • warp=0.05, periodic, p=2: smallest eigenvalue5.54e-17expected >= -1e-12pass
  • warp=0.05, periodic, p=3: asymmetry2.93e-16expected < 1e-12pass
  • warp=0.05, periodic, p=3: smallest eigenvalue-5.08e-16expected >= -1e-12pass
  • warp=0.05, Dirichlet, p=2: asymmetry1.60e-16expected < 1e-12pass
  • warp=0.05, Dirichlet, p=2: smallest eigenvalue0.02478expected >= -1e-12pass
  • warp=0.05, Dirichlet, p=3: asymmetry1.64e-16expected < 1e-12pass
  • warp=0.05, Dirichlet, p=3: smallest eigenvalue0.0144expected >= -1e-12pass
  • element couplings outside the face-neighbour stencil0expected == 0pass

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

The diffusion operator on its own reaches the design rate: heat conduction in a quiescent gas converges at p+1p+1, and an independent one-dimensional implementation of exactly this formulation converges at p+1p+1 for every degree (study). For the coupled compressible Navier–Stokes system in a diffusion-dominated regime the state converges at a reduced rate between pp and p+1p+1, with pressure the slowest variable. Convection-dominated flows recover approximately p+1p+1. The reduced rate is a measurement; its cause has not been established.

Observed orders on the finest mesh pairManufactured solutions: Navier–Stokes
regimepL2 error (finest)statevelocitypressuretemperature
heat conduction (quiescent)23.0899e-053.600883.64333.600463.05238
heat conduction (quiescent)39.7099e-073.998494.945913.997954.58993
diffusion dominated, Re = 1024.9402e-042.332562.726872.336633.1517
diffusion dominated, Re = 1032.7784e-063.793964.193543.797764.61291
diffusion dominated, no mean flow, Re = 1020.001356971.991322.571811.990472.70647
convection dominated, Re = 100028.6201e-052.8522.994772.841672.95746
convection dominated, Re = 100038.8491e-073.918623.980753.905754.11096

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

Hypothesis. When diffusion dominates, the momentum and energy equations behave like an equal-order discretization of a Stokes-like system, in which the pressure-like variables are controlled only through the velocity divergence and lose one order.

Evidence for.

  • The diffusion operator alone reaches p+1p+1: heat conduction in a quiescent gas, and an independent one-dimensional BR2 model that includes the nonlinear work term.
  • The viscous operator is symmetric to round-off, so the loss is not an adjoint-inconsistency of the implementation.
  • Pressure is the slowest variable and the loss shrinks as convection takes over, which is the pattern the hypothesis predicts.

Evidence against, and what is missing.

  • In the compressible equations solved here pressure is a thermodynamic variable, not a Lagrange multiplier of a divergence constraint. The manufactured solution runs at Mach 0.5, far from the incompressible limit in which the Stokes argument is exact.
  • Nothing in the repository isolates the mechanism. Three other candidates are present in this very discretization and have not been excluded: under-integration of the BR2 form by Gauss–Lobatto quadrature, the penalty sitting exactly on the coercivity bound (see above), and the non-conservative gradient in (u,T)(\mathbf u, T).
  • The studies that would discriminate — the rate against Mach number, Gauss against Gauss–Lobatto quadrature, a sweep of η\eta — have not been run.

Until they are, treat the rates in the table as the fact and the explanation as a conjecture.

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