Appearance
Jeans modes on a static AMR grid
| ID | Group | Milestone | Backends | Figure | Regression |
|---|---|---|---|---|---|
| SV-10 | Self-gravity | M8 (#81), P5b, P5c | CPU, FNL | yes | selfgravity-amr-stage; amr-periodic-reflux-stage (the per-stage reflux, without gravity) |
Case and scope
On an AMR grid three things change in self-gravity:
- the potential comes from the multigrid solver of SV-9;
- the face gravity at the 2:1 faces is that solver's first-order mean-flux gradient;
- the energy exchange needs the seam gravity work carried by the reflux (models).
The Jeans modes of SV-3 and SV-4 check the coupling, now with a 2:1 seam the wave crosses on every side of the refined box.
What the case catches:
- a multigrid coupling that differs from the FFT one on a grid where both apply;
- a loss of order across the seams (the stable wave);
- a broken growth rate or point symmetry of the unstable mode;
- a missing or wrong seam gravity work: the semi-discrete
is no longer exact, and the drift stops converging in ; - with the per-stage reflux (
reflux_cadence = stage, P5c), a drift that does not recover the Runge–Kutta order; - a solver selection that accepts what it cannot solve (isolated boundaries on a periodic grid with the multigrid solver,
poisson_solver = ffton AMR).
Models and numerics
| Item | Choice | Code |
|---|---|---|
| Equations | compressible Euler, | models |
| Solver selection | poisson_solver = auto: the FFT solver on a uniform grid, the multigrid on an AMR grid; fft on AMR is fatal, and so is isolated on a periodic grid (the multigrid's own check; isolated boundaries on AMR are SV-13 and SV-14, #87) | set_potential, adam_flume_common_object.F90; adam_flume_gravity_object.F90 |
| Poisson solver | multigrid (FCG + V-cycle) on the mimetic composite Laplacian, on the host; its coarsest level on the backend's FFT solver (FFTW, or cuFFT on FNL) | adam_poisson_mg_object.F90, adam_fnl_poisson_fft_object.F90 |
| Seam gravity work | added per stage to the flux register's energy entry: the coarse side takes its own seam source back, the fine side adds the exact two-point work less its own source | add_seam_gravity_work, adam_flume_common_object.F90; accumulate_seam_fluxes, adam_flume_cpu_object.F90, adam_flume_fnl_object.F90 |
| Reflux | reflux = .true.; reflux_cadence = step (default, end of step) or stage (P5c: the coarse seam cells corrected at every Runge–Kutta stage) | reflux_stage, adam_flume_cpu_object.F90; adam_flume_numerics_object.F90; numerics |
| Space | WENO5 (weno-u-5) flux splitting on characteristic variables (weno) | numerics |
| Time | SSP Runge–Kutta, 3 stages, CFL 0.4 (collapse: 0.4, 0.2, 0.1) | adam_rk_object.F90 |
Initial and boundary conditions
make_jeans.py --box refines the central box (a quarter of the period from every face; in 3-D also along
| Item | Value |
|---|---|
| Physics | as SV-3 / SV-4: sine-wave with wave_mode = jeans |
| Grid | base |
| Ranks, backends | 2; CPU and FNL (the multigrid runs on the host, its coarsest level on cuFFT) |
Leg (jeans.sh) | Case | Base grid | Amplitude, end |
|---|---|---|---|
sv10: multigrid against FFT | jeans2d, uniform, poisson_solver = fft and multigrid | ||
sv10: unstable mode | jeansu2d --box, a checkpoint every 5 steps | ||
sv10: collapse | jeansc2d --box, CFL 0.4, 0.2, 0.1 | ||
sv10: collapse, per-stage reflux | the same with --reflux-cadence stage | ||
sv10: refusals | jeans2d --solver multigrid --poisson-bc isolated; jeans2d --box --solver fft | — | |
sv10-wave: stable wave, 2-D | jeans2d --box | ||
sv10-wave: stable wave, 3-D | jeans3d --box | ||
Regression selfgravity-amr-stage | jeansc2d --box --reflux-cadence stage |
Input files
| File | Role |
|---|---|
src/tests/flume/verification/selfgravity/make_jeans.py | the Jeans cases; --box, --solver, --poisson-bc, --reflux-cadence |
src/tests/flume/verification/selfgravity/jeans.sh | legs sv10 and sv10-wave (FLUME_EXE selects the backend) |
src/tests/flume/verification/selfgravity/jeans_oracle.py | compare, wave, growth, symmetry, conservation (with --tol-mass for the per-stage reflux) |
src/tests/flume/regression/selfgravity-amr-stage/input.ini | the frozen per-stage collapse on the box-refined grid, |
src/tests/flume/regression/amr-periodic-reflux-stage/input.ini | the per-stage reflux on a triply periodic octree (no gravity) |
src/tests/flume/verification/make_doc_runs.sh, group amr | sv10-2d-{8,16,32}, sv10-uniform-{8,16,32}, sv10-collapse-{0.4,0.2,0.1}, sv10-stage-{0.4,0.2,0.1} |
src/tests/flume/verification/make_doc_figures.py, fig_selfgravity_amr_jeans | draws the figure (--only selfgravity-amr-jeans) |
bash
cd src/tests/flume/verification/selfgravity && ./jeans.sh --legs "sv10 sv10-wave" # CPU
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl_fft ./jeans.sh --legs "sv10 sv10-wave" # FNLResults

Left: the L1 error of the stable wave falls at second order across the seams. Middle: in the collapse
| Asserted | Bound | CPU | FNL (WSL GPU) |
|---|---|---|---|
on a uniform poisson_solver = multigrid against fft, | |||
| stable wave, order of the L1 error, finest pair, 2-D | 1.98 (1.97, 1.98) | 1.98 | |
| the same, 3-D ( | 2.00 | 2.00 | |
| unstable mode (base | |||
| its mirror symmetry at | |||
| collapse (amplitude | |||
| its | the same to 3 digits | ||
the same with reflux_cadence = stage (P5c), order of the finest pair; mass drift | the same to 3 digits; | ||
isolated boundaries on a periodic grid with the multigrid solver; poisson_solver = fft on AMR | refused, exit 1 | refused | refused |
Related cases: the uniform-grid modes are SV-3 to SV-5; the solver is SV-9; the same collapse under runtime AMR is SV-11; conservation across seams without gravity is conservation across AMR seams.
Findings
- The seam gravity work makes the energy exchange exact in space. A run with the work switched off (a temporary ablation build, not a leg) drifts by
, , at the three CFL numbers, orders 0.07 and 0.02. That is a spatial leak at the seams, which no removes. With the work the drift is 12 times smaller at CFL 0.4 and converges in . - With the end-of-step reflux the drift is first order in
, not third. The reflux corrects the coarse cells at the end of the step, and the stages in between advance them with their own seam fluxes. On a uniform grid (SV-4) the order is that of SSP-RK3. The per-stage reflux ( reflux_cadence = stage, P5c) restores it: orders 2.99 and 3.00, and the drift at CFL 0.1 falls fromto . - The multigrid's stopping rule needed a round-off floor. With a
mode on a unit density the source is known to of itself. The relative tolerance was unreachable, and every solve ran to the 200-iteration cap. The solver now stops at and warns if it hits the cap. - The AMR wave is more accurate than the uniform one at the same base N. At base
the L1 error is against , because the box adds resolution. The first-order seam gravity shows in no norm the legs measure. - Isolated boundaries on AMR came with #87: the multigrid's symmetric James step (SV-13), the polytrope on AMR (SV-14).