Appearance
Jeans modes under self-gravity
| ID | Group | Milestone | Backends | Figure | Regression |
|---|---|---|---|---|---|
| SV-3, SV-4, SV-5 | Self-gravity | M8 (#81), P3 | CPU, FNL | yes | selfgravity-jeans |
Case and scope
P3 couples the FFT solver to the scheme: [gravity] self_gravity, one Poisson solve per Runge–Kutta stage, applied through the potential path of SV-1. A linear Jeans mode on a uniform gas obeys
What the case catches:
- SV-3, the stable wave: a wrong factor
, a wrong sign of the force, the mean not removed, or a solve that does not use each stage's own density; any of them shifts the frequency, and the L1 error against the exact wave leaves second order; - SV-4, the unstable mode: a wrong growth rate; a broken point symmetry (an exact symmetry of the equations); a leak in the conservation the design promises, exact in the semi-discrete form, so that only the time integration may drift:
must drift at the Runge–Kutta order, and the momentum must stay at round-off; - SV-5, scaling covariance: a wrong dimension of
in the [reference]layer.
Models and numerics
| Item | Choice | Code |
|---|---|---|
| Equations | compressible Euler, ideal gas, | models |
| Gravity | self_gravity = .true., | solve_potential, set_potential, adam_flume_common_object.F90; compute_residuals_weno, adam_flume_cpu_object.F90; solve_potential_gpu, adam_flume_fnl_object.F90 |
| Poisson solver | FFT, periodic (SV-2): FFTW on CPU, cuFFT on FNL | adam_poisson_fft_object.F90, adam_fnl_poisson_fft_object.F90 |
| Potential sources | the face form of SV-1 | add_potential_sources, adam_flume_cpu_object.F90 |
| Space | WENO5 (weno-u-5) flux splitting on characteristic variables (weno) | numerics |
| Time | SSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL 0.4 (collapse: 0.4, 0.2, 0.1) | adam_rk_object.F90 |
| Scaling (SV-5) | [reference] converts | adam_flume_gravity_object.F90; models |
| Executable | the FFT build: exe/adam_flume_cpu_fft (mode flume-cpu-gnu-fft), exe/adam_flume_fnl_fft (mode flume-fnl-nvf-fft) | fobos.d/flume.fobos |
Initial and boundary conditions
| Item | Value |
|---|---|
| State | |
| Mode | sine-wave with wave_mode = jeans: wave_angle 45°, wavelength |
| Grid | the unit square (2-D quadtree, 4×4 blocks, two uniform levels) or the unit cube (3-D octree, 2×2×2 blocks, one level), uniform, 4 ghosts; |
| Boundaries | every active face periodic (2-D: extrapolation on the null |
| Ranks | 2 |
| Leg | Physics | Grid | Amplitude, end | |
|---|---|---|---|---|
SV-3, jeans2d | stable, | |||
SV-3, jeans3d | the same wave in the | |||
SV-4, jeansu2d (linear) | unstable, | |||
SV-4, jeansc2d (collapse) | as jeansu2d, into the nonlinear collapse (the peak density reaches 1.73) | |||
| SV-5 | jeans2d in [reference], against the code-unit run |
Input files
| File | Role |
|---|---|
src/tests/flume/verification/selfgravity/make_jeans.py | writes jeans2d, jeans3d, jeansu2d, jeansc2d (--cells, --cfl, --time-max, --it-save, --amplitude) |
src/tests/flume/verification/selfgravity/jeans.sh | runs the legs sv3-2d, sv3-3d, sv4, sv5 (--np N, --legs LIST, --keep; FLUME_EXE selects the backend) |
src/tests/flume/verification/selfgravity/jeans_oracle.py | wave (SV-3), growth and symmetry (SV-4 linear), conservation (SV-4 collapse) |
src/tests/flume/verification/scaling/reference.sh | SV-5: the dimensional twin against the code-unit run, bitwise (NV-5) |
src/tests/flume/regression/selfgravity-jeans/input.ini | the frozen jeansc2d at |
src/tests/flume/verification/make_doc_runs.sh, group jeans | sv3-2d-{8,16,32}, sv3-3d-{8,16}, sv4-linear, sv4-collapse-{0.4,0.2,0.1} |
src/tests/flume/verification/make_doc_figures.py, fig_selfgravity_jeans | draws the figure (--only selfgravity-jeans) |
bash
cd src/tests/flume/verification/selfgravity && ./jeans.sh --legs "sv3-2d sv3-3d sv4 sv5" # CPU
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl_fft ./jeans.sh --legs "sv3-2d sv3-3d sv4 sv5" # FNLResults

Top left: the stable wave's error falls as
The exact linear solution is
| Leg | Asserted | Bound | CPU | FNL |
|---|---|---|---|---|
| SV-3, 2-D, | L1 error of | 2.00, 2.00 | 2.00, 2.00 | |
| SV-3, 3-D, | 1.99 | 1.99 | ||
| SV-4, growth ( | the fitted | |||
| SV-4, mirror symmetry | defect over the mode amplitude at | |||
| SV-4, collapse, CFL 0.4, 0.2, 0.1 | drift of | 2.99, 2.99 | 2.99, 2.99 (the same drifts) | |
| SV-4, collapse | the largest | |||
| SV-5, scaling covariance | the dimensional run (with | bitwise | bitwise (fields, histories, 14 conversions) | bitwise with nvfortran 26.1 (WSL GPU); nvfortran 25.5 (A30) stops reading the converted input, as NV-5 does: a defect older than P3, #86 |
Related cases: the same modes across 2:1 seams are SV-10, under runtime AMR SV-11; the isolated analogue of the collapse is SV-8; the [reference] layer is scaling covariance (NV-5).
Findings
- The coupling is second order, as P0 designed it (the 7-point Laplacian and the face form): the WENO-5 fluxes cannot lift it. The error after one period is
of the amplitude at . - Only the time integration drifts. In the collapse
and each change by 17 % of the total, yet drifts by at CFL 0.4, and the drift falls as , SSP-RK3's order: the semi-discrete scheme conserves exactly, as the design predicted. Momentum stays at round-off. - The symmetry holds to round-off, not bitwise: the summation orders of WENO and of the FFT are not mirror invariant. The defect relative to the mode is
at the end; it is largest ( ) early, when the amplitude is and round-off is a larger fraction of it. - Cost. CPU (WSL, indicative): a Poisson solve of the
grid takes 0.2 ms; with self-gravity the run takes 31 s against 29 s without (one solve per stage and one per history row). FNL (one A30 per rank): 1.3 ms per solve at , 4.4 ms at , the density and the potential crossing the host each stage. A first version copied the whole device potential every stage, sized to the block capacity (23 270 blocks, 16 in use): 0.73 s per solve, whatever the grid. Only the active blocks cross now; the results are bitwise those of the first version. - CPU and FNL agree to the printed digits on every SV-3 and SV-4 measure; the symmetry defects differ (round-off of different summation orders), both within the bound by a factor 10.
- SV-5 on nvfortran 25.5 fails to read the converted input, as NV-5 does (#86).
- The regression case
selfgravity-jeansfreezesjeansc2dat(4×4 blocks of ) for 20 steps, not the verification's collapse.