Appearance
The polytrope on AMR: static boxes, runtime regrids, Jeans refinement
| ID | Group | Milestone | Type | Backends | Figure | Regression |
|---|---|---|---|---|---|---|
| SV-14 to SV-17, rg7 | Self-gravity | #87 (follow-up) · P3, P4; #88 (follow-up); M9 (#91) | P+C | CPU, FNL | yes | selfgravity-star-amr |
Case and scope
The n = 1 polytrope of SV-7 and SV-8 on AMR grids, under isolated self-gravity by the multigrid's symmetric James step (SV-13). The star is smaller than on the uniform grid (radius 0.3 instead of 0.5), so that the 2:1 seams lie in the atmosphere and not on the stellar surface.
What the case catches:
- SV-14, the star on a static AMR box (#87 P3): the equilibrium with the star refined must have less spurious motion than on the uniform base; the collapse must keep the exact exchange of
and (the per-stage reflux carries the seam gravity work); a regrid that refines a boundary block must stop the run; - SV-15, the collapse under runtime AMR (#88): a prolongation that builds cold, fast cells mid-collapse drives the run non-finite;
conservative-statemust run it to the end; - SV-16, Jeans refinement (#91): a Jeans marker must refine the star before the collapse, so that no regrid happens mid-collapse;
- SV-17, dual energy (#91):
euler-demust keep the cold infall from draining with the default prolongation; - rg7, the Jeans-marker contract: a Jeans marker without self-gravity, or with an inverted hysteresis band, must be refused at initialization.
Models and numerics
| Item | Choice | Code |
|---|---|---|
| Equations, scheme, boundaries | as SV-7, SV-8: Euler, wall-inviscid on every face | models |
| Poisson solver | the multigrid's James step for isolated boundaries, its coarsest level on the FFT solver | adam_poisson_mg_object.F90, adam_poisson_fft_object.F90 |
| Reflux | reflux_cadence = stage: the seam fluxes, and the seam gravity work, reconciled every Runge–Kutta stage | numerics |
| Boundary refinement | a regrid that refines a block on the domain boundary is fatal (the James step needs every leaf on the boundary at the coarsest level) | adam_poisson_mg_object.F90 |
[amr] regrid_prolongation | conservative (default) or conservative-state (below) | refine_conservative, refine_conservative_state, adam_field_object.F90 |
| Jeans marker | [amr_marker_N] mode = 5: refine where the cell spacing exceeds jeans_cells; jeans_cells_derefine > jeans_cells sets the hysteresis band; needs self-gravity | numerics; input |
| Dual energy | physical_model = euler-de, switch 0.05 | DE; models |
The conservative-state prolongation
The opt-in conservative-state (#88) sets the
with linear prolongation, a mixture of whole coarse states with the same weights for every variable; removing the mean makes the children average to the parent.
The default conservative prolongation limits each variable by its own slope (regrid round trip), so its children are not mixtures of whole states; in a collapse that is what builds the cold, fast cells of SV-15. A bound on the children's specific internal energy or entropy, minmod slopes, and one
The single conservative). Hence an option for collapsing flows, not the default. The round-trip identities of conservative-state (exact integral, range) are asserted by rg0 in the regrid round trip.
Initial and boundary conditions
| Item | Value |
|---|---|
| Star | the SV-7 polytrope with radius |
| Box, base | wall-inviscid on every face; 2 ranks |
| SV-14, grid | the box --box: 120 blocks, the star at the |
| SV-14, equilibrium | as SV-7 (atmosphere cell, to |
| SV-14, collapse | as SV-8 (atmosphere reflux_cadence = stage |
| SV-14, refusal | starc --regrid 2 --boundary-box: a runtime marker on |
| SV-15, runtime-AMR collapse | starc --radius 0.3 --reflux-cadence stage --regrid 5: the uniform regrid_prolongation = conservative-state, and the default conservative reported |
| SV-16, Jeans refinement | starc --radius 0.22 --reflux-cadence stage --regrid 5 --jeans 8: 3.5 cells per radius on the base; its Jeans length is amr_iterations = 1), the default prolongation; the same star without the Jeans marker reported |
| SV-17, dual energy | the SV-15 case with the default prolongation, no Jeans marker, and --physical-model euler-de |
| rg7 | the regression sod-x input (Sod) to mode = 5, jeans_cells = 8): as is (no [gravity]), and with jeans_cells_derefine = 4 |
Regression selfgravity-star-amr | starc --radius 0.3 --box --reflux-cadence stage: SV-14's collapse, 120 blocks of |
Input files
| File | Role |
|---|---|
src/tests/flume/verification/selfgravity/make_polytrope.py | writes star and starc; on AMR --radius, --box, --regrid, --prolongation, --boundary-box, --reflux-cadence, --jeans, --physical-model |
src/tests/flume/verification/selfgravity/star.sh | runs the legs sv14, sv15, sv16, sv17 (--np N, --legs LIST, --keep; FLUME_EXE selects the backend) |
src/tests/flume/verification/selfgravity/star_oracle.py, jeans_oracle.py | the drift reductions (equilibrium) and |
src/tests/flume/verification/regrid/check.sh --legs rg7 | rg7, the Jeans-marker refusals |
src/tests/flume/regression/selfgravity-star-amr/input.ini | the frozen SV-14 collapse on AMR, 20 steps (#87 P4) |
src/tests/flume/verification/make_doc_runs.sh, group isolated | sv14-{uniform,box}, sv14-collapse-{0.4,0.2,0.1} |
src/tests/flume/verification/make_doc_runs.sh, group collapse-regrid | sv15-{conservative-state,conservative}, sv16-{jeans,control} and sv17-de, a checkpoint every 2 steps (the conservative and control runs stop by design) |
src/tests/flume/verification/make_doc_figures.py, fig_selfgravity_star_amr, fig_selfgravity_star_regrid | draws the figures (--only selfgravity-star-amr selfgravity-star-regrid) |
bash
cd src/tests/flume/verification/selfgravity && ./star.sh --legs sv14,sv15,sv16,sv17 # CPU (exe/adam_flume_cpu_fft)
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl_fft ./star.sh --legs sv14,sv15,sv16,sv17 # FNL
cd ../regrid && ./check.sh --legs rg7 # the Jeans-marker contractResults
SV-14, the star on a static AMR box:

Top: the star of radius 0.3 on the uniform
| Leg | Asserted | Bound | CPU | FNL |
|---|---|---|---|---|
| SV-14 | the largest central-density drift to | 2.00 | 2.00 | |
| SV-14 | the largest Mach number inside | 2.19 | 2.19 | |
| SV-14 | the largest Mach number in the whole star: 15.2 (uniform: the surface spans 5 cells), 0.36; reduction | reported | 42 | 42 |
| SV-14 | collapse on AMR, drift of | 2.97, 2.97 | 2.97, 2.97 (the same drifts) | |
| SV-14 | the largest | |||
| SV-14 | a regrid that refines a boundary block | refused, exit 1 | refused | refused |
SV-15 to SV-17, the runtime-AMR collapse:

Top row, SV-15: the SV-14 star collapsing on the uniform conservative the coldest cells then keep cooling while an infall reaches Mach 10: conservative-state the smallest conservative and conservative-state, and drifts at the time integration's error between regrids. Bottom row, SV-16: the smaller star refined only by the Löhner marker at step 5 cools to non-finite at step 27; with the Jeans marker the initial AMR refines it before the collapse (120 blocks, 64 on the base), no regrid changes the grid, the coldest cell recovers and the run reaches euler (the red curve of the top row) and with euler-de: the floor lifts the coldest cells to their adiabat in 6 steps, adding
| Leg | Asserted | Bound | CPU | FNL |
|---|---|---|---|---|
| SV-15 | conservative-state: reaches | completes | ||
| SV-15 | conservative-state: mass and momentum drifts | mass | mass | |
| SV-15 | conservative, the default | reported | non-finite at step 64 | non-finite at step 65 |
| SV-16 | Jeans marker: the initial grid refined (blocks at step 0 above the 64 of the base); reaches | completes | 120 blocks at step 0; | 120 blocks at step 0; |
| SV-16 | Jeans marker: mass and momentum drifts | mass | mass | |
| SV-16 | without the Jeans marker | reported | non-finite at step 27 | non-finite at step 33 |
| SV-17 | euler-de: reaches | completes | ||
| SV-17 | euler-de: mass and momentum drifts | mass | mass | |
| SV-17 | the energy the entropy floor added | reported |
rg7, the Jeans-marker contract:
| Input | Expected | CPU | FNL |
|---|---|---|---|
| Jeans marker, no self-gravity | fatal: "needs [gravity].(self_gravity) = .true." | pass | pass |
jeans_cells_derefine = 4 | fatal: "needs 0 < jeans_cells < jeans_cells_derefine" | pass | pass |
Related cases: the uniform-grid star is SV-7, SV-8; the solver on AMR is SV-13; self-gravity through regrids is SV-11; the dual-energy model is DE; the library regrid is the regrid round trip.
Findings
- 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
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 (
) the box's faces lie on the surface; in the light atmosphere the end-of-step reflux run goes non-finite at , the per-stage one reaches (#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). - A runtime-AMR star changes its grid once, and needs
conservative-state(SV-15). One level above thebase can only refine the 8 inner blocks (0.5 wide); two levels would carry the 2:1 balance to the boundary blocks, which is refused; 4-cell blocks are below . The first regrid refines the 8 inner blocks and later regrids keep that grid. With the default prolongation the collapse then drains a cell's internal energy to negative; conservative-state, one range limit for the whole state, runs it to the end. On the CPU it also runs the star of radius 0.25 regridded every 5 steps and of radius 0.3 every 8, on which the default goes non-finite (steps 53 and 48); it fails on the radius-0.22 star regridded every 5 steps and the radius-0.25 star every 8 (3.5 and 4.0 cells per radius on the base), which the non-conservativelinearprolongation runs to the end. - Refine before the collapse: the Jeans criterion (SV-16). A star prolonged mid-collapse is the fragile case; a Jeans marker refines it at the start instead, and the collapse never regrids. With 8 cells per Jeans length the radius-0.22 star regridded every 5 steps, which no conservative prolongation survives, reaches
with the default one, and so do the radius-0.25 star regridded every 8 and the SV-15 star (CPU). For this polytrope the Jeans length does not shrink in the collapse ( at ), so one refinement at the start holds; in an adiabatic collapse , so for any it shortens as the density rises, and the runtime regrids then follow it. - Or carry the entropy: dual energy (SV-17). The coldest cells of the SV-15 collapse sit at
two steps before the default run goes non-finite; euler-delifts them to their adiabat when they drop below it, and the run ends with the default prolongation. On the CPU it also runs the radius-0.25 star regridded every 5 and every 8 steps; the radius-0.22 star (3.5 cells per radius) still needs the Jeans marker. - Three remedies, one per cause:
conservative-statekeeps a mid-collapse regrid from building cold fast cells, the Jeans marker avoids the mid-collapse regrid, dual energy keeps the cold infall from draining.