Skip to content

The n = 1 polytrope: equilibrium and collapse ​

IDGroupMilestoneBackendsFigureRegression
SV-7, SV-8, SV-14Self-gravityM8 (#81), P4; #87, P3, P4CPU, FNLyesselfgravity-star, selfgravity-star-amr

Case and scope ​

An n = 1 polytrope star under the isolated self-gravity of SV-6, centred in a closed box. The n = 1 polytrope is the Lane–Emden equilibrium p=Kρ2 with a closed-form density, so the discrete scheme holds it up to its truncation error, and halving its pressure makes it collapse, bounce and ring.

What the case catches:

  • SV-7, the equilibrium: a potential or a force inconsistent with the pressure gradient. The spurious motion of the discrete scheme around the continuum equilibrium (the drift of the central density, the Mach number inside the star) must shrink with the grid;
  • SV-8, the collapse: a leak in the exact exchange of E and W through the isolated solver. Its symmetry (an even kernel) must give the same exactness as the periodic solver: E+W drifts only at the Runge–Kutta order while E and W exchange, and the momentum stays at round-off;
  • SV-14, the star on AMR (#87 P3): isolated self-gravity by the multigrid's symmetric James step (SV-13) coupled to the scheme. The equilibrium on a grid with the star refined must have less spurious motion than on the uniform base; the collapse must keep the exact exchange (the per-stage reflux carries the seam gravity work); a regrid that refines a boundary block must stop the run (D-87-4).

Models and numerics ​

ItemChoiceCode
Equationscompressible Euler, γ=2 (the adiabatic exponent of p=Kρ2), isolated self-gravity, G=1models
Poisson solverFFT with isolated boundaries (poisson_bc = isolated): zero padding and the lattice Green's function; on AMR (SV-14) the multigrid's James step, its coarsest level on the same FFT solveradam_poisson_mg_object.F90, adam_poisson_fft_object.F90, adam_fnl_poisson_fft_object.F90
Couplingone solve per Runge–Kutta stage, the potential pathsolve_potential, adam_flume_common_object.F90; add_potential_sources, adam_flume_cpu_object.F90
SpaceWENO5 (weno-u-5) flux splitting on characteristic variables (weno)numerics
TimeSSP Runge–Kutta, 3 stages, CFL 0.4 (SV-8: 0.4, 0.2, 0.1)adam_rk_object.F90
Positivity limiterSV-7: cell (its gravity energy correction, M7-G1 option B); SV-8: nonelimit_positivity, adam_flume_cpu_object.F90; numerics
Boundarieswall-inviscid on every face: a closed box, no mass or energy crosses it, so E+W has no boundary termboundary conditions; adam_flume_bc_object.F90
Initial conditionpolytrope: the star and its atmosphereset_initial_conditions, adam_flume_ic_object.F90

Initial and boundary conditions ​

ItemValue
Starpolytrope: n = 1, radius a=1/2, ρc=1, G=1, p=Kρ2 with K=2Ga2/π (the Lane–Emden equilibrium), γ=2; mass 4ρca3/π, mean density 3ρc/π2, free-fall time of the mean density tff=3π/(32Gρ¯)=0.98
Atmosphereisothermal at the central temperature (p1=Kρcρ1) and hydrostatic in the star's field, ρ=ρ1eGM/T(1/r−1/a) outside; inside, ρ1 and p1 added to the star
Box[−1,1]3, an octree, uniform; 8 cells per block side, 4 ghosts; wall-inviscid on every face
Ranks2
SV-7, equilibrium (star)star_pressure_factor 1, atmosphere ρ1=10−4ρc, positivity limiter cell; 323 and 643 (levels 2 and 3) to t=2, CFL 0.4, a checkpoint every 10 steps
SV-8, collapse (starc)star_pressure_factor 0.5, atmosphere ρ1=10−2ρc, no limiter; 323 to t=1.5 at CFL 0.4, 0.2, 0.1
SV-14, the star on AMRa smaller star, radius a=0.3, so that the 2:1 seam of the box [−1/2,1/2]3 lies in the atmosphere, 0.2 off the surface (with a=1/2 the seam cuts the surface at the face centres and the light atmosphere goes non-finite, #88); the box refined once over the 323 base (--box: 120 blocks, the star at the 643 spacing, 9.6 cells per radius)
SV-14, equilibriumas SV-7 (atmosphere 10−4ρc, limiter cell, to t=2), on the AMR grid and on the uniform 323 grid
SV-14, collapseas SV-8 (atmosphere 10−2ρc, no limiter, to t=1.5, CFL 0.4, 0.2, 0.1) on the AMR grid with reflux_cadence = stage
SV-14, refusalstarc --regrid 2 --boundary-box: a runtime marker on [1/2,1]3, at the boundary; the first regrid refines a boundary block
Regression selfgravity-starstar --levels 1: 163 (2×2×2 blocks of 83), atmosphere 10−2ρc, no limiter, 20 steps
Regression selfgravity-star-amrstarc --radius 0.3 --box --reflux-cadence stage: SV-14's collapse, 120 blocks of 83, 20 steps

Input files ​

FileRole
src/tests/flume/verification/selfgravity/make_polytrope.pywrites star and starc (--cells, --levels, --cfl, --time-max, --it-save, --atmosphere, --limiter; on AMR --radius, --box, --regrid, --boundary-box, --reflux-cadence)
src/tests/flume/verification/selfgravity/star.shruns the legs sv7, sv8, sv14 (--np N, --legs LIST, --keep; FLUME_EXE selects the backend)
src/tests/flume/verification/selfgravity/star_oracle.pyconvergence (SV-7): the drifts on two grids and their reduction
src/tests/flume/verification/selfgravity/jeans_oracle.pyconservation (SV-8): E+W against Δt, the momentum
src/tests/flume/regression/selfgravity-star/input.inithe frozen equilibrium at 163, 20 steps
src/tests/flume/regression/selfgravity-star-amr/input.inithe frozen SV-14 collapse on AMR, 20 steps (#87 P4)
src/tests/flume/verification/make_doc_runs.sh, group isolatedsv7-l{2,3}, sv8-collapse-{0.4,0.2,0.1} (a checkpoint every 10 steps); needs exe/adam_flume_cpu_fft and exe/test_poisson_fft
src/tests/flume/verification/make_doc_runs.sh, group isolatedalso sv14-{uniform,box}, sv14-collapse-{0.4,0.2,0.1}
src/tests/flume/verification/make_doc_figures.py, fig_selfgravity_star, fig_selfgravity_star_amrdraws the figures (--only selfgravity-star selfgravity-star-amr)
bash
cd src/tests/flume/verification/selfgravity && ./star.sh                   # CPU (exe/adam_flume_cpu_fft)
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl_fft ./star.sh               # FNL

Results ​

SV-7 and SV-8: the equilibrium star's core and spurious motion at two resolutions; the collapse's energy drift and density

Top: at 323 and 643 the core first expands (the central density falls, by 10 % and 4.5 %) and then recompresses past its initial value within two time units; on the finer grid the swing is smaller and the interior Mach number about half. Bottom left: in the collapse E and W exchange 74 % of |E+W| (their curves coincide) while E+W drifts at the Runge–Kutta order, a factor 8 per halving of the CFL number. Bottom right: the collapsing star at its densest checkpoint, t=1.03, its central density four times the initial one.

The central density is the mean over the cells within one cell of the centre; the Mach numbers are taken inside 0.8a and over the whole star (the cells denser than a tenth of the central density).

LegAssertedBoundCPUFNL
SV-7the largest central-density drift to t=2: 9.91⋅10−2 (323), 5.71⋅10−2 (643); reduction≥1.51.741.73
SV-7the largest Mach number inside 0.8a: 0.154, 0.075; reduction≥1.52.052.06
SV-7the largest Mach number in the whole star (set at its surface): 0.43, 0.29; reductionreported1.501.49
SV-8drift of E+W at CFL 0.4, 0.2, 0.1: 5.97⋅10−7, 8.29⋅10−8, 9.71⋅10−9; order in Δt≥2.52.85, 3.092.85, 3.09 (the same drifts)
SV-8the largest |∫ρu|10−147.3⋅10−186.9⋅10−18

SV-14, the star on AMR (#87 P3):

SV-14: the smaller star on AMR, its core and spurious motion against the uniform grid; the collapse's energy drift; the star on its composite grid

Top: the star of radius 0.3 on the uniform 323 grid (4.8 cells per radius) and with the box refined (9.6): on the AMR grid the core swings half as far and the interior Mach number stays at half. Bottom left: the collapse on the AMR grid, E+W at the Runge–Kutta order while E and W exchange 81 % of |E+W| (their curves coincide). Bottom right: the equilibrium star at t=2 on its composite grid, the radius dashed; the 2:1 seam lies in the atmosphere.

LegAssertedBoundCPUFNL
SV-14the largest central-density drift to t=2: 1.65⋅10−1 (uniform 323), 8.24⋅10−2 (AMR); reduction≥1.52.002.00
SV-14the largest Mach number inside 0.8a: 0.414, 0.189; reduction≥1.52.192.19
SV-14the largest Mach number in the whole star: 15.2 (uniform: the surface spans 5 cells), 0.36; reductionreported4242
SV-14collapse on AMR, drift of E+W at CFL 0.4, 0.2, 0.1: 4.76⋅10−7, 6.07⋅10−8, 7.72⋅10−9; order in Δt≥2.52.97, 2.972.97, 2.97 (the same drifts)
SV-14the largest |∫ρu|; mass drift10−14; 10−142.2⋅10−19; 2.4⋅10−164.3⋅10−19; 2.4⋅10−16
SV-14a regrid that refines a boundary blockrefused, exit 1refusedrefused

Related cases: the periodic analogue of the collapse is SV-4; the solver is SV-6, on AMR SV-13; the limiter's gravity energy correction comes from the force (M7-G1).

Findings ​

  • Only the time integration drifts. In the collapse E and W each change by 74 % of |E+W|, while E+W drifts by 6⋅10−7 at CFL 0.4 and falls as Δt3: the isolated solver conserves as exactly as the periodic one (SV-4), through its symmetry.
  • The positivity limiter breaks the exchange where it acts. Its gravity energy correction (M7-G1, option B) is not part of the flux form. A star in a 10−4 atmosphere needs it at its surface (without it the gas there reaches |u|≈0.4 in ten steps and its pressure goes negative), and with it E+W drifts by 2.8⋅10−3 by t=4 at 323, against 3⋅10−9 without it in a 10−2 atmosphere. SV-8 therefore runs in the heavier atmosphere, without the limiter.
  • A heavy atmosphere is not an equilibrium test. The 10−2 atmosphere holds 22 % of the star's mass, and the star then pulsates with 13 % of its central density at 323; SV-7 uses the light one.
  • The equilibrium converges at about first order, set by the star's surface. The n = 1 surface has a kink in the density (ρs∝a−r, p∝(a−r)2), the light atmosphere needs the limiter there (first order where it acts), and the surface is where the largest Mach number sits (r=0.454, a=0.5): it shrinks only 1.5-fold from 323 to 643. The pulsation it drives sets the core's drift, which shrinks 1.7-fold, and the interior motion 2.1-fold. A star of radius 8 cells pulsates by 10 % of its central density, of 16 cells by 6 %.
  • The bound asserts convergence, not an order. P0 asked for 100 free-fall times; the runs reach 2 (643 took 37 min on the WSL CPU, 20 min on the A30).
  • The regression case selfgravity-star freezes the equilibrium at 163 in the 10−2 atmosphere without the limiter, not SV-7's light-atmosphere setup.
  • Isolated self-gravity on AMR holds the star and keeps the exchange exact (SV-14). Refining the star halves its spurious motion against the uniform base, as a uniform grid of the fine spacing would; the collapse drifts at third order in Δt with the momentum at round-off, as on the uniform grid (SV-8): the James step is symmetric and the per-stage reflux carries the seam gravity work.
  • Keep refinement boundaries off the stellar surface. With the SV-7 star (a=1/2) the box's faces lie on the surface; in the light atmosphere the end-of-step reflux run goes non-finite at t=1.41, the per-stage one reaches t=2 (#88). Production codes keep coarse–fine boundaries out of dense gas for the same reason (Castro refines everything far below the stellar density, Katz et al. 2016; Berger and Colella 1989 on the spurious waves of a resolution jump at a steep gradient).
  • No runtime-AMR star with a changing grid. One level above the 323 base can only refine the 8 inner blocks (0.5 wide), two levels carry the 2:1 balance to the boundary blocks (refused, D-87-4), and 4-cell blocks are below 2ngc; the regrid path is covered by the refusal and, periodic, by SV-11. A coarse star prolonged at its first regrid also drained one cell's internal energy to negative in the collapse (#88).