Appearance
Gravity from a cell potential
| ID | Group | Milestone | Backends | Figure | Regression |
|---|---|---|---|---|---|
| SV-1 | Self-gravity | M8 (#81), P1 | CPU, FNL | yes | — |
Case and scope
Self-gravity applies gravity through a cell potential add_potential_sources (face gravity
[gravity] potential = linear writes the constant
What the case catches:
- a wrong sign, spacing or face average in the potential sources: the free fall and the hydrostatic ghosts miss their exact values;
- an energy source that is not the telescoping face form: the closed box loses
; - a change of the constant-g path: that path must stay bitwise as before, which the regression suite holds.
Models and numerics
| Item | Choice | Code |
|---|---|---|
| Equations | compressible Euler, ideal gas, iso2d-mhd, box2d-mhd: ideal MHD with EGLM cleaning (glm_ch 3, glm_alpha 0.18, glm_damping_length 1) | models |
| Gravity | [gravity] potential = linear: | set_potential, adam_flume_common_object.F90; load_from_file, adam_flume_gravity_object.F90 |
| Potential sources | face gravity, cell gravity, momentum, energy from the face mass fluxes (second order, no fourth-order correction) | add_potential_sources, adam_flume_cpu_object.F90; add_potential_sources_dev, adam_flume_fnl_kernels.F90 |
| Space | WENO5 (weno-u-5) flux splitting on characteristic variables | numerics |
| Time | SSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL 0.4; the wave2d ladder scales it as GV-9, | adam_rk_object.F90 |
Positivity limiter (box2d-lim, box2d-mhd) | cell, with the face and cell gravity from | limit_positivity, adam_flume_cpu_object.F90; numerics |
| Hydrostatic ghosts | the potential drop | set_boundary_conditions, adam_flume_cpu_object.F90; hydrostatic_ghost, adam_flume_bc_object.F90 |
| FNL backend | the same path on the device | adam_flume_fnl_object.F90 |
Initial and boundary conditions
The cases are those of M7 (gravity/make_atmosphere.py), written with --potential linear. Every case: the unit square, a quadtree of 4×4 blocks (two uniform levels), 4 ghost cells, 2 ranks.
| Case (M7 origin) | State, gravity | Boundaries | Cells per block side, end |
|---|---|---|---|
iso2d (G0) | isothermal atmosphere, | hydrostatic | 8; one step at CFL |
iso2d-mhd (G0) | iso2d with EGLM and | as iso2d | 8; one step |
freefall2d (G1) | uniform | periodic on every face | 8; 50 steps |
box2d (G1) | as freefall2d | wall-inviscid | 8; 200 steps |
box2d-mhd (G1) | box2d with EGLM, | as box2d | 8; 200 steps |
box2d-lim (G1) | box2d with | as box2d | 8; 300 steps |
wave2d (G2a, GV-9) | sine-wave, entropy mode), | periodic on every face | 8, 16, 32 ( |
The figure's closed box is box2d at 16 cells per block side (
Input files
| File | Role |
|---|---|
src/tests/flume/verification/gravity/make_atmosphere.py | writes the M7 cases; --potential linear selects the potential path |
src/tests/flume/verification/selfgravity/check.sh | runs SV-1 (--np N, --legs LIST: iso2d, iso2d-mhd, freefall2d, box2d, box2d-mhd, box2d-lim, wave2d (the ladder), default all; --keep; FLUME_EXE selects the backend) |
src/tests/flume/verification/gravity/atmosphere_oracle.py | the M7 oracles: profile, freefall, energy, wave |
src/tests/flume/verification/make_doc_runs.sh, group selfgravity | sv1-box2d-{uniform,linear}, sv1-wave-{uniform,linear}-{8,16,32}: both paths |
src/tests/flume/verification/make_doc_figures.py, fig_selfgravity_potential | draws the figure (--only selfgravity-potential) |
bash
cd src/tests/flume/verification/selfgravity && ./check.sh # CPU
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./check.sh # FNL
cd .. && ./make_doc_runs.sh <dir> selfgravity # the figure's runs
python3 make_doc_figures.py --out ../../../../docs/public/flume --runs <dir> --only selfgravity-potentialResults

Left: the closed box at
| Case | Asserted | Bound | CPU | FNL |
|---|---|---|---|---|
iso2d, iso2d-mhd | hydrostatic ghosts against the profile, relative | |||
freefall2d | ||||
box2d, box2d-mhd | mass and | |||
box2d-lim | the run completes (limiter acting); drift reported | — | ||
wave2d, 3 resolutions | L1 order of | 2.12, 2.00 | 2.12, 2.00 |
Related cases: the constant-g path of the same cases is verified in the force, the order of the energy source and the stratified atmospheres; the Poisson solver that feeds this path is SV-2.
Findings
- In the closed box the potential path's energy budget closes on
alone. The constant path closes on , which adds the wall term of its fourth-order source: without that term its drifts by . - With the limiter acting, the drift of the potential path (
) is of the size of the constant path's ( ). - The potential path is second order (2.12 in
, 2.00 in ), as its face form without a fourth-order correction must be; the constant path gives 5.0 and 4.6 (GV-9). - The constant-g path is unchanged bitwise: the regression suite (35/35 on CPU and FNL at the time of P1) holds it.