Skip to content

Accuracy of runtime AMR ​

IDGroupMilestoneBackendsFigureRegression
AV (av2 to av8)Runtime AMR (M5)M5 (#74)CPU, FNLyesfield-loop-regrid

Case and scope ​

RG proves the regrid machinery. AV asks what a user of runtime AMR wants: is a run whose grid follows the solution about as accurate as the uniform run at its finest level, with fewer cells, and does a regrid keep what the scheme guarantees? Each case compares a tracked run (a regrid every 5 steps) with uniform runs, against bounds fixed in the #74 P4 plan before any run.

What the case catches: a regrid that costs accuracy (a feature that leaves its refined region, a marker that misses a feature, a transfer error), a regrid that breaks conservation, positivity, symmetry or the divergence control, and a regrid that makes the result depend on the number of ranks or on the backend.

Five bounds turned out to rest on false premises, all pre-existing properties of the scheme, of a marker or of the backends that runtime AMR merely exposed; they were reported and replaced, each with its issue, never moved to fit a number (see Findings).

Models and numerics ​

ItemChoiceCode
Euler cases (av2, av3a, av6, av7)WENO5 flux splitting, characteristic variables; av2 runge-kutta-ssp-54, CFL 0.4; av3a and av7 runge-kutta-ssp-33, CFL 0.5compute_residuals_weno, adam_flume_cpu_object.F90; numerics
MHD blast (av3b)ideal MHD, γ=1.4, EGLM (ch=60, α=0.18), weno flux splitting, characteristic, positivity limiter (cell), floors disabled; runge-kutta-ssp-54, CFL 0.4mhd_eglm_face_split_fluxes, adam_flume_mhd_library.F90; limit_positivity, adam_flume_cpu_object.F90; EGLM, positivity limiter
MHD blast on weno-riemann (av3c)HLLD, 6th-order correction with the WENO sensor, characteristic interpolationcompute_residuals_riemann, adam_flume_cpu_object.F90; adam_flume_cpu_mhd_eglm_hlld_kernels.F90; numerics
Field loop (av4)ideal MHD, γ=5/3, GLM (ch=4, α=0.18) or EGLM, WENO5 characteristic, runge-kutta-ssp-54, CFL 0.4GLM, EGLM
Gradient markercentred differences, across the faces between blocks too (#76); spacing delta_fine where max|∇v|> tol, else delta_coarse; acts at initialisation and at the regridsmark_by_gradient, adam_flume_common_object.F90
Löhner markerthe FLASH/PLUTO dimension-sum estimator with an absolute floor (#74 P4); acts at the regridsmark_by_lohner, adam_flume_common_object.F90
Solid marker (av7)blocks crossed by the cylinder surfacemark_by_solid, adam_flume_common_object.F90
Regridevery 5 steps, conservative prolongation, mean restriction, reflux on; no subcycling (D-M5-3)regrid_forest, adam_flume_cpu_object.F90, adam_flume_fnl_object.F90; numerics

At a runtime regrid the markers vote per block (mark_runtime): a block is refined when any marker asks for it, derefined only when every marker agrees, and a block at the base level is never derefined.

Initial and boundary conditions ​

LegCaseTracked runUniform runsFinal time
av2isentropic vortex (V2), periodic quadtree on [0,1]2, 162 cells per blockbase level 1 (N=32) to level 3 (N=128); gradient marker on ρ, tol 0.05N=32, N=128t=0.2
av3aSod (V1) on [0,1], quadtree with y null, 12×4 cells per block; the jump at 0.5 on a block face at every levelbase level 2 (48 cells) to level 4 (192); gradient on ρ (tol 1.0) OR Löhner on ρ (refine_tol 0.5, derefine_tol 0.2)192 cellst=0.2
av3bBalsara–Spicer MHD blast of the blast-limiter golden: ρ=1, p=1000 for r<0.1 around (0.5,0.5) (sampled at the cell centres of N=64), p=0.1 outside, B=100/4π at 45° (ambient β=2.5⋅10−4); periodic quadtree on [0,1]2, 162 cells per blockbase level 2 (N=64) to level 3 (N=128); gradient on p (tol 100) OR Löhner on p (0.5, 0.2)N=128t=0.01
av3cthe av3b blast on weno-riemann (HLLD)as av3bN=128t=0.01
av4field loop (MV-9): A0=10−3, R=0.3, ρ=p=1, v=(2,1,1), on [−1,1]×[−0.5,0.5], periodic quadtree, 4×4 blocks of N/4×N/8 cells; GLM and EGLMN=64 to N=128; gradient on Bx (tol 0.01) OR Löhner on Bx and By (0.3, 0.1, floor 10−4)N=128t=1
av6the av2 tracked vortexon 1, 2 and 3 ranks (1, 2 on FNL: the WSL box has two GPUs, and three ranks sharing them run about 170 times slower)—t=0.2
av7shock over the cylinder (V6), octree with z null, 16×16×4 cells per blockV6's initial AMR (base level 2, solid marker to level 3) and a regrid every 5 steps: solid OR Löhner on ρ (0.6, 0.2)uniform at V6's finest level (level 3); the init-AMR V6 run (no regrid)t=0.25
av8the tracked runs of av2, av3a, av3b, av4 (GLM, EGLM), av7 on both backends—the uniform-fine pair of each—

Every run on 2 ranks unless stated (av6).

Input files ​

FileRole
src/tests/flume/verification/regrid/make_regrid.pyvortex-av, sod-av, blast-av, loop-av, cylinder-av write the inputs
src/tests/flume/verification/regrid/accuracy.shruns the legs (--legs av2,av3a,av3b,av3c,av4,av6,av7,av8, default all but av8; FLUME_EXE selects the backend; av8 compares the work directories of both)
src/tests/flume/verification/regrid/av_oracle.pythe bounds, on top of the V1, V2, V6 and MV-9 oracles
src/tests/flume/verification/conservation/conservation_oracle.pythe av6 rank comparison
src/tests/flume/regression/field-loop-regrid/input.inithe frozen av4 GLM tracked run, 150 steps, 10 regrids
make_doc_figures.py (fig_regrid)the figure, from the CPU work directories av2-tracked and av4-glm-tracked
bash
cd src/tests/flume/verification/regrid && ./accuracy.sh                     # CPU, av2 to av7
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./accuracy.sh              # FNL
./accuracy.sh --legs av8                                                    # CPU against FNL

Results ​

Runtime regridding: tracked vortex and field loop with their blocks

The tracked vortex at t=0.2 with its blocks and its pointwise density error, and the tracked GLM field loop at t=1 with its blocks: the refined blocks follow the vortex core and the loop edge.

The bounds:

LegAsserted
av2L1(ρ) ≤ 1.5× uniform-128 and ≤ 1/8 of uniform-32
av3aL1(ρ) ≤ 1.3× uniform-192; contact and shock on finest cells; null copies within 1e-12
av3bouter shock radius on the four half-axes within 2 finest cells of uniform-128; ρ conserved to 1e-13; ρE and B drift ≤ 1.1× uniform-128's; every regrid admissible
av3cpoint symmetry within 1e-10 on the uniform and the tracked run (#77)
av4E_B(T)/E_B(0) ≥ uniform-128's − 0.5 %; ⟨|B_z|⟩/A0 ≤ 1.2× (GLM; EGLM reported); final max|div B| ≤ 2×; div B at each regrid reported
av6the same regrids; fields within 1e-13
av7bow-shock stand-off within 2 finest cells of uniform at V6's finest level; mirror symmetry 1e-10; positivity (the init-AMR V6 run's stand-off reported)
av8the same regrids; per field, the tracked CPU–FNL difference ≤ 2× the uniform-fine runs' (or ≤ 1e-10)

The measured values (np 2; CPU numbers, FNL the same within the av8 agreement):

LegTracked runReferenceMeasuredRegridsCost (tracked / uniform-fine)
av2L1(ρ) 1.039e-5uniform-128 8.43e-6; uniform-32 1.91e-31.23× fine, 0.005× coarse428 blocks / 64; 58 s / 67 s
av3aL1(ρ) 3.5392e-3uniform-192 3.5420e-30.999× (2.56× before #76); contact and shock on finest cells7144 cells / 192; 32 s / 33 s
av3bshock radius 0.4219–0.4375uniform-128 0.42971 finest cell on each half-axis; ρ drift 5.6e-16, ρE 5.33e-5 against 5.35e-53ends fully refined; 115 s / 122 s
av3csymmetry 3.3e-12 (FNL 2.6e-12)uniform-128 6.1e-12 (FNL 2.6e-12)both within 1e-10; shock radius 0.4297 on every half-axis, 0 finest cells from uniform3128 s / 155 s
av4 GLME_B 0.943937, ⟨|B_z|⟩ 5.75e-4, div B 2.56e-40.943953, 6.86e-4, 2.76e-4⟨|B_z|⟩ 0.84×, div B 0.93×; at the regrids max |div B| changes by ×0.94–1.057840–46 blocks / 64; 237 s / 244 s
av4 EGLME_B 0.943769, ⟨|B_z|⟩ 2.37e-5, div B 2.58e-40.943774, 2.72e-6, 2.72e-4⟨|B_z|⟩ 8.7× (reported, #78), div B 0.95×82242 s / 250 s
av6np 2 and 3 against np 1 (FNL: np 2, two GPUs)—the same 4 regrids, fields bitwise on both backends497 / 55 / 48 s
av7stand-off 0.12000uniform at V6's finest level 0.12000 (init-AMR V6: 0.12195)0 finest cells; mirror symmetry 6.5e-127ends fully refined; 315 s / 389 s
av8FNL against CPU, the six tracked runsthe same pair of uniform-fine runsthe same regrids in every case; Euler: round-off on both runs (tracked 5.7e-14 to 6.9e-12); field loop: 1.4e-11 GLM, 3.0e-10 EGLM (relative to each field's scale, B_z ~1e-6; ~1e-6 before #79); blast: O(1) as on the uniform run (#77); every tracked difference at most 1× the uniform one but av3a's (1.8e-13, round-off)—FNL tracked: av4 60 s (550 s before the bounded copies of #75), av7 973 s

Related cases: the regrid machinery is RG; the point-symmetry loss behind av3b and av3c is the MHD blast on the flux-splitting path; the uniform cases are the isentropic vortex, Sod, the shock over a cylinder, the field loop and the positivity limiter blast; the EGLM seam level of #78 is followed up in EGLM reflux.

Findings ​

  • Accuracy: within the stated factor of the uniform-fine run in every case, and equal to it where the refined region covers the whole feature (av3a, av7).
  • Cost: the savings are modest on these cases, and the reason is visible. The tracked vortex and loop hold half the blocks of the uniform runs, but the time step is set by the finest cells either way (no subcycling, D-M5-3) and the regrids, the 2:1 seams and the reflux cost their share, so the wall time drops by 3 to 19 % (av7 the most); the blast and the cylinder end fully refined, their waves filling the box by the final time.

What runtime AMR exposed (each reported before its bound changed):

  • A jump on a block face was invisible to the gradient marker at initialisation (it read interior cells only): Sod's jump at 0.5 is a face at every level on [0,1], the initial grid stayed coarse, and the error of the first coarse steps persisted, 2.56× uniform-fine whatever the Löhner threshold. The marker now differences across the faces between blocks, reading one ghost layer (the initial AMR refreshes the host ghosts first), and av3a runs on [0,1] again: 0.999× (#76).
  • The Löhner estimator needs an absolute floor on a variable that vanishes in quiet regions: outside the field loop B is GLM residue (~10⁻⁶), the relative filter epsilon filters nothing, and the estimator read E ≈ 0.98 everywhere, refining the whole box. The floor key (default 0, the FLASH/PLUTO form) fixes it (numerics).
  • The MHD blast breaks point symmetry on a uniform grid (0.2 relative at N = 128 from an exactly symmetric initial condition), and does not conserve ρE and B (it drifts 5e-5 on the uniform grid too): the planned symmetry bound was dropped and the conservation bound limited to ρ, with ρE and B bounded against the uniform drift (#77): a grid-scale instability of the flux splitting at low β (the MHD blast on the flux-splitting path); av3c asserts the symmetry on the Riemann-flux path.
  • EGLM loses its B_z advantage across 2:1 seams: ⟨|B_z|⟩/A0 is 2.7e-6 on the uniform grid, 2.4e-5 tracked and 1.9e-4 on a static AMR grid with no regrid at all, so the seams, not the regrid, raise it; the tracked run, whose seams follow the loop, is 8× better than the static one. The EGLM bound on it is reported only (#78).
  • On MHD the two backends did not agree to round-off, with no regrid involved: on the uniform field loop the fluid variables agreed to 1e-13 but B only to ~1e-6, a cancellation in the eigenvector normalisation since fixed (#79, MV-9 --agree), and the uniform blast differs at O(0.1) (#77). The planned av8 bound (1e-10 on every case) tested that, not the regrid; av8 bounds the tracked CPU–FNL difference by the uniform one, case by case.
  • Across 2:1 seams the copies along a null direction differ by ~1e-13, on a static grid too: round-off of the seam ghost fill; av3a bounds it at 1e-12.