Skip to content

Self-gravity (M8) ​

Self-gravity (#81) solves ∇2Φ=4πG(ρ−ρ¯) every Runge–Kutta stage and applies gravity through the cell potential. The design (the P0 comment on #81) uses the spatial discretisation of Mullen et al. (2021), with the 7-point Laplacian Lh:

  • face gravity: gd,i+1/2=−(Φi+1−Φi)/Δxd;
  • cell gravity: the mean of the cell's two faces;
  • momentum: ρ times the cell gravity;
  • energy: 12∑d(gd,i+1/2Fd,i+1/2ρ+gd,i−1/2Fd,i−1/2ρ), from the mass fluxes the continuity equation uses.

Summed over the cells, the energy source is ∑iΦi(Fi+1/2−Fi−1/2)/Δx. So E+ρΦ is conserved exactly with a static potential, and E+12ρΦ with a self-consistent one: in the semi-discrete form, given a Poisson solve that is linear and symmetric, Φ=4πGKρ with K=KT. P4 corrected the first claim, which asked for a round-off residual of the Poisson equation (see models). The scheme is second order.

The phases of #81 and the cases that verify them:

PhaseWhat it addsCases
P1the potential path ([gravity] potential = linear)SV-1
P2the FFT Poisson solver, periodicSV-2
P3the coupling, one solve per Runge–Kutta stage ([gravity] self_gravity)SV-3, SV-4, SV-5
P4isolated boundaries (poisson_bc = isolated)SV-6, SV-7, SV-8
P5athe multigrid Poisson solver on AMR gridsSV-9
P5bself-gravity on static AMR grids, the seam gravity work in the refluxSV-10
P5cthe per-stage reflux, self-gravity under runtime AMRSV-10 (reflux_cadence = stage), SV-11
P6the regression cases selfgravity-jeans, selfgravity-amr-stage, selfgravity-star—
#87 P1Dirichlet faces in the multigrid solver, a DST-I coarsest levelSV-12
#87 P2isolated boundaries on AMR, the symmetric James stepSV-13
#87 P3isolated self-gravity on AMR in FLUME: the refusals lifted, a regrid that refines a boundary block fatalSV-14

The figures are regenerated with make_doc_runs.sh <dir> <group> and make_doc_figures.py --only <figure> (src/tests/flume/verification/):

make_doc_runs.sh groupExecutables it needsmake_doc_figures.py --only
selfgravityexe/adam_flume_cpu, exe/test_poisson_fft (mode test-poisson-fft-gnu)selfgravity-potential selfgravity-poisson
jeansexe/adam_flume_cpu_fft (mode flume-cpu-gnu-fft)selfgravity-jeans
isolatedexe/test_poisson_fft, exe/adam_flume_cpu_fftselfgravity-isolated selfgravity-star
amrexe/test_poisson_mg (mode test-poisson-mg-gnu), exe/adam_flume_cpu_fftselfgravity-amr selfgravity-amr-jeans selfgravity-amr-regrid
CaseIDWhat it verifies
Gravity from a cell potentialSV-1the potential path reproduces the constant-g oracles of M7
The FFT Poisson solverSV-2the periodic solver is exact for Lh, second order against the continuum
Jeans modesSV-3 to SV-5the coupling: dispersion relation, growth rate, symmetry, exact E+W exchange, scaling covariance
The isolated solverSV-6zero padding with the lattice Green's function: free-space potential of the mass on the grid
The n = 1 polytropeSV-7, SV-8, SV-14a star in equilibrium and a collapsing one under isolated self-gravity, uniform and on AMR
The multigrid solver on AMR gridsSV-9, SV-12, SV-13the mimetic 2:1 coupling (symmetric and consistent), the FCG solver, Dirichlet faces, isolated boundaries by the symmetric James step
Jeans modes on a static AMR gridSV-10the multigrid coupling, the seam gravity work, the per-stage reflux
Self-gravity under runtime AMRSV-11the solver and Φ follow every regrid; E+W exact between regrids