Gyredocs
Depth Practice
API

Gyre/Mathematics & Numerical Methods

Boundary conditions

In one minuteBoundary conditions are imposed weakly through the same numerical fluxes as interior faces. Walls use a boundary state rather than a ghost-cell Riemann problem, which keeps force functionals adjoint consistent.

Written at L2 Practice goes to L4 Theory 837 words Markdown

Every boundary face is treated like an interior face whose exterior data are supplied by a boundary function of the interior trace U−\mathbf U^-, the outward normal and the flow parameters. Each boundary function returns three states:

  • UL,UR\mathbf U_L, \mathbf U_R — handed to the interface Riemann flux;
  • Ub\mathbf U_b — the boundary state for viscous fluxes and gradient lifting (or none).
condition inviscid flux viscous treatment
farfield Riemann flux between U−\mathbf U^- and the free stream interior gradient, no lifting
slip_wall, symmetry n⋅F(UΓ)\mathbf n\cdot\mathbf F(\mathbf U_\Gamma), normal momentum removed no viscous flux
slip_wall_mirror Riemann flux against the mirrored state no viscous flux
noslip_adiabatic n⋅F(UΓ)\mathbf n\cdot\mathbf F(\mathbf U_\Gamma), zero velocity u=0\mathbf u = 0 lifted, zero heat flux
noslip_isothermal as above with wall temperature t_wall u=0\mathbf u = 0, T=TwT = T_w lifted
pressure_outlet n⋅F(UΓ)\mathbf n\cdot\mathbf F(\mathbf U_\Gamma) with p=pbackp = p_\text{back} (interior pp if supersonic) interior gradient
total_inlet n⋅F(UΓ)\mathbf n\cdot\mathbf F(\mathbf U_\Gamma) from total pressure/temperature and flow angle, interior static pressure interior gradient

Three conditions read data from the flow parameters: noslip_isothermal the wall temperature t_wall, pressure_outlet the back pressure p_back and total_inlet the total pressure and temperature pt_in, tt_in, all as ratios to the free-stream static values. A condition whose data are missing is rejected with an error that names the boundary group, the condition and the key.

For walls and for the internal-flow inlet/outlet conditions Gyre sets UL=UR=UΓ(U−)\mathbf U_L = \mathbf U_R = \mathbf U_\Gamma(\mathbf U^-). Any consistent numerical flux then returns exactly the physical flux of the boundary state, n⋅F(UΓ)\mathbf n\cdot\mathbf F(\mathbf U_\Gamma), with no dissipation. For a slip wall

UΓ=(ρ,  ρu−(ρu⋅n) n,  ρE),n⋅F(UΓ)=(0,  pΓ n,  0),\mathbf U_\Gamma = \left(\rho,\; \rho\mathbf u - (\rho\mathbf u\cdot\mathbf n)\,\mathbf n,\; \rho E\right), \qquad \mathbf n\cdot\mathbf F(\mathbf U_\Gamma) = (0,\; p_\Gamma\,\mathbf n,\; 0),

so the wall flux is a pure pressure force with pΓ=p(UΓ)p_\Gamma = p(\mathbf U_\Gamma). Following Hartmann and Leicht, a boundary flux of the form n⋅F(UΓ(U−))\mathbf n\cdot\mathbf F(\mathbf U_\Gamma(\mathbf U^-)), combined with functionals evaluated from the same boundary flux, yields an adjoint-consistent discretization: the discrete adjoint is a consistent discretization of the continuous adjoint problem including its boundary conditions. The mirrored-ghost-state alternative is available for comparison but is not adjoint consistent in this sense.

Forces are not recomputed from interpolated pressure. SurfaceOps.face_forces calls the residual kernel with faces=True and integrates the momentum components of the numerical boundary flux — inviscid minus viscous — that the residual itself used. Two consequences:

  1. the force is discretely conservative: summing the surface loads and the far-field momentum flux reproduces the residual sum exactly;
  2. the functional is adjoint consistent, a prerequisite for the superconvergence measured in the output-error study.

The boundary state keeps density and total energy and sets the velocity to zero, UΓ=(ρ,0,ρE)\mathbf U_\Gamma = (\rho, \mathbf 0, \rho E) (adiabatic), or replaces the energy by ρ cvTw\rho\,c_v T_w (isothermal). Velocity (and wall temperature) enter the BR2 lifting as Dirichlet data, W∗=W(UΓ)\mathbf W^* = \mathbf W(\mathbf U_\Gamma); the viscous boundary flux is Fv(UΓ,G+η rf)⋅n\mathbf F_v(\mathbf U_\Gamma, \mathbf G + \eta\,\mathbf r_f)\cdot\mathbf n, with the energy component removed for adiabatic walls (zero heat flux and zero velocity leave no energy transfer). The numerical energy flux through an adiabatic wall is therefore zero by construction, for any state. The cylinder validation checks instead that the wall heat conduction of the converged solution, the flux that is removed, decreases between the two highest polynomial degrees; it vanishes for the exact solution.

Boundary functions are ordinary JAX code of (U−,n,x,θ)(\mathbf U^-, \mathbf n, \mathbf x, \theta). Their dependence on flow parameters (the free-stream state in farfield, the back pressure in pressure_outlet) and on geometry (through n\mathbf n) is therefore differentiated together with everything else. The linearization study verifies JVPs, VJPs and the block preconditioner for every wall type, the mirrored slip wall (slip_wall_mirror) with each interface flux included, for a channel mixing four different conditions and for an inlet/outlet channel (total_inlet, pressure_outlet, symmetry, slip_wall_mirror).

Linearization defectsExact linearization by automatic differentiation
configurationpDOFJVP vs FD (rel.)dot-product (rel.)|B⁻¹ J_ee - I|split residual defect
Euler, slip wall24325.3652e-107.4656e-166.7502e-140
NS, adiabatic wall24323.7139e-107.5418e-151.2397e-140
NS, isothermal wall24323.1571e-101.0274e-131.6348e-140
NS, mixed channel35765.2611e-104.3341e-161.4949e-140
Euler, mirrored slip wall24321.9949e-101.0578e-135.6843e-140
Euler, mirrored slip wall, HLLC flux24325.6037e-107.5694e-142.4869e-140
Euler, mirrored slip wall, LLF flux24321.3770e-101.4703e-151.1713e-140
Euler, inlet/outlet channel23242.1088e-101.2508e-135.3846e-150
Euler, mirrored slip wall, ES-Roe flux24321.8848e-101.3925e-143.8192e-140
NS, adiabatic wall, ES-Roe flux24323.0017e-102.9248e-151.6784e-140

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

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