Skip to content

Jeans modes on a static AMR grid ​

IDGroupMilestoneBackendsFigureRegression
SV-10Self-gravityM8 (#81), P5b, P5cCPU, FNLyesselfgravity-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 E+W is no longer exact, and the drift stops converging in Δt;
  • 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 = fft on AMR).

Models and numerics ​

ItemChoiceCode
Equationscompressible Euler, γ=5/3, periodic self-gravitymodels
Solver selectionpoisson_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 solvermultigrid (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 workadded 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 sourceadd_seam_gravity_work, adam_flume_common_object.F90; accumulate_seam_fluxes, adam_flume_cpu_object.F90, adam_flume_fnl_object.F90
Refluxreflux = .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
SpaceWENO5 (weno-u-5) flux splitting on characteristic variables (weno)numerics
TimeSSP 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 z) one level more. The symmetry of the unstable mode survives, because the box is symmetric about the point the oracle reflects through.

ItemValue
Physicsas SV-3 / SV-4: ρ0=1, c=1, γ=5/3, k=2π(1,1), every active face periodic; the stable wave λ=λJ/2 (G=π/2), the unstable mode λ=1.5λJ (G=9π/2), sine-wave with wave_mode = jeans
Gridbase 4n (2-D, 4×4 blocks) or 2n (3-D, 2×2×2 blocks) for n cells per block side, the box at twice the resolution; 4 ghosts
Ranks, backends2; CPU and FNL (the multigrid runs on the host, its coarsest level on cuFFT)
Leg (jeans.sh)CaseBase gridAmplitude, end
sv10: multigrid against FFTjeans2d, uniform, poisson_solver = fft and multigrid32210−6; one period
sv10: unstable modejeansu2d --box, a checkpoint every 5 steps64210−6; t=0.5
sv10: collapsejeansc2d --box, CFL 0.4, 0.2, 0.164210−2; t=0.4
sv10: collapse, per-stage refluxthe same with --reflux-cadence stage64210−2; t=0.4
sv10: refusalsjeans2d --solver multigrid --poisson-bc isolated; jeans2d --box --solver fft322—
sv10-wave: stable wave, 2-Djeans2d --box322, 642, 128210−6; one period
sv10-wave: stable wave, 3-Djeans3d --box163, 32310−6; one period
Regression selfgravity-amr-stagejeansc2d --box --reflux-cadence stage32210−2; 20 steps

Input files ​

FileRole
src/tests/flume/verification/selfgravity/make_jeans.pythe Jeans cases; --box, --solver, --poisson-bc, --reflux-cadence
src/tests/flume/verification/selfgravity/jeans.shlegs sv10 and sv10-wave (FLUME_EXE selects the backend)
src/tests/flume/verification/selfgravity/jeans_oracle.pycompare, wave, growth, symmetry, conservation (with --tol-mass for the per-stage reflux)
src/tests/flume/regression/selfgravity-amr-stage/input.inithe frozen per-stage collapse on the box-refined grid, 322 base, 20 steps
src/tests/flume/regression/amr-periodic-reflux-stage/input.inithe per-stage reflux on a triply periodic octree (no gravity)
src/tests/flume/verification/make_doc_runs.sh, group amrsv10-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_jeansdraws 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"  # FNL

Results ​

SV-10: the wave error on AMR against N, the drift of E + W in the collapse, the collapse density on the composite grid

Left: the L1 error of the stable wave falls at second order across the seams. Middle: in the collapse E and W trade 17 % of |E+W| while E+W drifts by about 10−7; with the end-of-step reflux (solid) the drift falls 2.8 and then 2.2 times per halving of the CFL number, with the per-stage reflux (dashed) 8 times, the SSP-RK3 order. Right: the collapse density at t=0.4 on the composite grid; the refined blocks are the central box.

AssertedBoundCPUFNL (WSL GPU)
on a uniform 322 grid, poisson_solver = multigrid against fft, max|ρmg−ρfft|/(ρ0A) after one period10−63.8⋅10−92.7⋅10−9
stable wave, order of the L1 error, finest pair, 2-D≥1.81.98 (1.97, 1.98)1.98
the same, 3-D (163→323)≥1.82.002.00
unstable mode (base 642), growth rate, relative error10−25.8⋅10−45.8⋅10−4
its mirror symmetry at t=0.510−95.7⋅10−114.7⋅10−11
collapse (amplitude 10−2, base 642, t=0.4), max |momentum|10−143.5⋅10−186.9⋅10−18
its E+W drift at CFL 0.4, 0.2, 0.1, order of the finest pair≥0.88.8⋅10−8, 3.1⋅10−8, 1.4⋅10−8 (1.50, 1.16)the same to 3 digits
the same with reflux_cadence = stage (P5c), order of the finest pair; mass drift≥2.5; 10−143.5⋅10−8, 4.3⋅10−9, 5.4⋅10−10 (2.99, 3.00); 2.2⋅10−16the same to 3 digits; 3.3⋅10−16
isolated boundaries on a periodic grid with the multigrid solver; poisson_solver = fft on AMRrefused, exit 1refusedrefused

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 1.03⋅10−5, 9.8⋅10−6, 9.6⋅10−6 at the three CFL numbers, orders 0.07 and 0.02. That is a spatial leak at the seams, which no Δt removes. With the work the drift is 12 times smaller at CFL 0.4 and converges in Δt.
  • With the end-of-step reflux the drift is first order in Δt, 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 from 1.4⋅10−8 to 5.4⋅10−10.
  • The multigrid's stopping rule needed a round-off floor. With a 10−6 mode on a unit density the source is known to 10−16/10−6=10−10 of itself. The 10−10 relative tolerance was unreachable, and every solve ran to the 200-iteration cap. The solver now stops at max(10−10, 100ϵmax|4πGρ|/max|4πG(ρ−ρ¯)|) and warns if it hits the cap.
  • The AMR wave is more accurate than the uniform one at the same base N. At base 322 the L1 error is 1.9⋅10−3 against 2.1⋅10−3, 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).