Appearance
The order of the energy source
| ID | Group | Milestone | Backends | Figure | Regression |
|---|---|---|---|---|---|
| GV-9 (G2a) | External gravity | M7 (#73) | CPU, FNL | yes | — |
Case and scope
The fluxes of a finite-difference scheme are point values of the primitive function
G2a adds the correction
Models and numerics
| Item | Choice | Code |
|---|---|---|
| Equations | compressible Euler, ideal gas, | models |
| Energy source | add_gravity_sources, compute_gravity_correction, compute_gravity_correction_faces, adam_flume_cpu_object.F90; compute_gravity_correction_faces_dev, adam_flume_fnl_kernels.F90 | |
| Block-end faces | the faces | add_gravity_edge_correction, adam_flume_cpu_face_kernels_agnostic.INC (weno), adam_flume_cpu_riemann_face_kernels_agnostic.INC (weno-riemann); add_gravity_edge_correction_dev, adam_flume_fnl_face_kernels_agnostic.INC |
| Ghost cells | one more layer than the WENO stencil, ngc >= S + 1 (with weno-riemann max(S, 2) + 1), fatal otherwise | check_ngc_number, adam_flume_common_object.F90 |
| Limiter | the correction is a high-order cell source, scaled by | add_gravity_limited_correction, adam_flume_cpu_object.F90; numerics |
Space, weno | WENO5 (weno-u-5) flux splitting on characteristic variables | compute_residuals_weno, adam_flume_cpu_object.F90; numerics |
Space, weno-riemann | WENO5 interpolation, HLLC, sixth-order flux correction (flux_correction = 6th, sensor weno) | compute_residuals_riemann, adam_flume_cpu_object.F90; adam_flume_cpu_euler_hllc_kernels.F90; numerics |
| Time | SSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL | adam_rk_object.F90 |
| Boundaries | every face periodic | boundary conditions |
| FNL backend | the same kernels on the device | adam_flume_fnl_object.F90 |
Initial and boundary conditions
| Item | Value |
|---|---|
| Case | wave2d |
| Domain | |
| Grid | quadtree, 4×4 blocks of ngc = 4 |
| Ranks | 2 |
| Initial condition | sine-wave, wave_mode = entropy, wave_angle = 45, wave_amplitude = 0.2, wavelength |
| State | |
| Gravity | |
| Exact solution | the wave advected by |
| Boundaries | every face periodic |
| Final time | |
| Asserted | the weno and on weno-riemann |
Input files
| File | Role |
|---|---|
src/tests/flume/verification/gravity/make_atmosphere.py | writes wave2d (--cells, --cfl, --time-max, --riemann hllc) |
src/tests/flume/verification/gravity/check.sh | runs the ladder on both schemes with the force legs (GV-9, --legs gv9) |
src/tests/flume/verification/gravity/atmosphere_oracle.py | wave: the --min-order 3.5) |
src/tests/flume/verification/make_doc_runs.sh (group gravity) | re-runs wave-{weno,riemann}-{8,16,32} |
src/tests/flume/verification/make_doc_figures.py (fig_gravity_order) | draws the figure |
bash
cd src/tests/flume/verification/gravity
./check.sh --np 2 --cases iso2d # CPU (GV-9 runs with the force legs)
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./check.sh --np 2 --cases iso2d # FNLResults

weno and weno-riemann (HLLC).
The two schemes lie on top of each other,
CPU and FNL agree to every digit shown:
| Scheme | Orders ( | CPU | FNL | |
|---|---|---|---|---|
G1 face form alone (weno, negative control) | — | 2.12, 2.00 | the same | |
weno | 5.01, 4.57 | the same | ||
weno-riemann (HLLC) | 5.00, 4.59 | the same |
At check.sh.
The other GV legs re-run with the correction (CPU and FNL) are tabulated in the gravity force: GV-1 unchanged, GV-3 conserving box2d-lim with 107 984 limited faces, GV-6 and NV-5 bitwise, GV-7
Related cases: the gravity force (the face form and the closed boxes); the second-order potential path of self-gravity runs the same wave in SV-1.
Findings
- The face form alone is second order on a finite-difference scheme; the fourth-order correction restores the order of the scheme (5 in
, 4.6 in ) on both face families. - Conservation. Each face's weights still sum to one over the cells, so
stays conserved exactly with periodic boundaries and across block interfaces. - The invariant at reflecting walls (owner decision:
is the invariant). At a wall the correction of the wall cell reads the face beyond it: the mirrored ghosts give and , and the wall row's mass balance turns the left-over into . The exactly conserved total energy is then , an wall term away from the plain sum. Dropping the correction flux at walls would keep the plain sum but cost the wall cells an energy source error. GV-3 asserts and reports the plain sum (the gravity force). - One more ghost layer. The faces
of the block-end cells lie beyond the block, so gravity takes ngc >= S + 1, fatal otherwise; every gravity input hasngc = 4. - With the positivity limiter the correction is a high-order cell source, scaled by
with the rest of the face form; box2d-limlimits more faces than at G1 (107 984 against 74 304) for that reason.