Skip to content

Positivity limiter ​

IDGroupMilestoneBackendsFigureRegression
PV-1 to PV-5Ideal MHDM3 (#47, M3-P5); PV-5 #50CPU, FNL (PV-1 as a sphere: FNL only)yesblast-limiter, blast3d-limiter, blast-amr-limiter

Case and scope ​

The limiter (positivity_limiter = cell) blends every face flux with the first-order Lax–Friedrichs backbone so that each stage keeps the density and the pressure positive. It must make the hard problems run without floors and leave the smooth ones untouched. All legs run with the floors disabled, on the splitting scheme and on weno-riemann (HLLD for MHD, HLLC for Euler, characteristic interpolation).

A leg passes when the run reaches its final time and no stage meets an inadmissible backbone (the log line positivity limiter: N faces limited, M inadmissible backbones has M=0 at every stage), and no cell has a non-finite high-order flux. The Euler legs, which have no floors to stop a run, also assert a positive density and pressure in the last checkpoint.

What the case catches:

  • loss of positivity on strongly magnetised blasts (PV-1, PV-2) and near vacuum (PV-3);
  • a limiter that acts on smooth flow (PV-4): with the limiter on, smooth runs must be bitwise equal to the runs without it;
  • positivity lost at 2:1 seams (PV-5): the end-of-step reflux and the seam ghost fill must not undo the limiter; the mass must stay constant and the coarse seam flux must equal the mean of the fine ones at every stage.

Models and numerics ​

ItemChoiceCode
Limitercell-based parametrised flux limiter: each face flux blended with the first-order backbone; the relative floor keeps ρ and the internal energy ≥κ times their backbone values, κ=0.1limit_positivity, adam_flume_cpu_object.F90; compute_positivity_factors, compute_backbone_fluxes, blend_positivity_fluxes, adam_flume_cpu_positivity_kernels_agnostic.INC; POSITIVITY_LIMITER_KAPPA, adam_flume_parameters.F90; numerics
MHD backboneLax–Friedrichs flux with the Wu speed (no-cleaning and EGLM variants)mhd_backbone_flux, mhd_eglm_backbone_flux, adam_flume_mhd_riemann_library.F90
EGLM sources under the limitersources taken with the limited arithmetic; unlimited where Λ=1add_eglm_sources_limited, adam_flume_cpu_mhd_eglm_kernels.F90
Seams (PV-5)per-stage seam flux synchronisation; ghost positivity blend of the tricubic seam ghostsseam_sync_fluxes, seam_sync_factors, adam_flume_cpu_object.F90; blend_inadmissible_ghosts, adam_flume_cpu_ghost_kernels_agnostic.INC
Equationsideal MHD with EGLM (PV-1, PV-2, PV-5), γ=1.4; Euler (PV-3), γ=5/3 (LeBlanc) or 1.4models
SpaceWENO5 flux splitting; weno-riemann HLLD (MHD) or HLLC (Euler), characteristic, 6th, weno sensorcompute_residuals_weno, compute_residuals_riemann, adam_flume_cpu_object.F90
TimeMHD: SSP Runge–Kutta 5 stages, CFL 0.4 (the Orszag–Tang setup); Euler: SSP-33, CFL 0.5 (the Sod setup)adam_rk_object.F90
Floorsdisabledmodels
FNL backendthe same limiter on the devicelimit_positivity_dev, seam_sync_fluxes_dev, adam_flume_fnl_object.F90

Initial and boundary conditions ​

LegProblemGridFinal time
PV-1Balsara–Spicer blast: ρ=1, p=0.1 outside, p=1000 for r<0.1 around (0.5,0.5) (cell-centre sampling), |B|=100/4π at 45°, ambient β=2.5⋅10−4; EGLM, ch=60[0,1]2 periodic, the Orszag–Tang grid, 12820.01
PV-1, spherethe same blast as a sphere[0,1]3 periodic, octree 4×4×4 blocks, 6430.01
PV-2Wu & Shu (2018, Example 4.4): p=104 in the disc, B=(1000/4π,0,0), β=2.51⋅10−6; EGLM, ch=40012820.001
PV-3, LeBlancγ=5/3, [0,9], (ρ,u,e)=(1,0,0.1) for x<3, (10−3,0,10−7) beyond400 cells (4 blocks of 100), the Sod grid, extrapolation6
PV-3, double rarefactionγ=1.4, [−1,1], (ρ,u,p)=(7,∓1,0.2)400 cells (h=0.005)0.6
PV-3, planar Sedovγ=1.4, [0,4] shifted by h/2 (a cell centred at x=2), (ρ,u,p)=(1,0,4⋅10−13), p=2.56⋅108 in the centre cell800 cells (h=0.005)0.001
PV-4the isentropic vortex (V2, Euler, 642, 1282) and the 1-D fast wave (EGLM, 16, 32 cells, amplitude 10−7)their verification gridstheirs
PV-5PV-1 at 642 base with [0.25,0.75]2 refined one level (octree): the outer shock crosses the 2:1 seamsamr_box.py0.01

All legs: 2 ranks. Initial conditions: the blasts and the near-vacuum problems use riemann-problem regions (one strip region per cell row for the disc). PV-3 setups as Zhang & Shu (2010) and Guo et al. (arXiv:1402.5618, Examples 8–10).

Input files ​

FileRole
src/tests/flume/verification/mhd/positivity-probe/make_blast.pywrites the blasts (--cells, --eglm, --3d, --b-axis x, --p-in, --b0, --time-max, --glm-ch, --refine-box, --ratio)
src/tests/flume/verification/mhd/positivity/make_vacuum.pywrites the PV-3 inputs from sod/sod-x.ini (--problem leblanc|double-rarefaction|sedov)
src/tests/flume/verification/mhd/positivity/check.shruns the legs (--legs pv1,pv1-3d,pv2,pv3,pv4,pv5; default pv1,pv2,pv3,pv4) and the verdicts
src/tests/flume/verification/make_doc_runs.sh groups blast, vacuumre-run PV-1, PV-2 (4 runs) and PV-3 (6 runs) with checkpoints kept
src/tests/flume/verification/make_doc_figures.py fig_blast, fig_vacuumdraw blast.png, blast-wushu.png and near-vacuum.png (--only blast near-vacuum)
bash
cd src/tests/flume/verification/mhd/positivity
./check.sh                       # PV-1, PV-2, PV-3, PV-4 (about 70 min on the CPU, PV-3 takes 55)
./check.sh --legs pv1-3d         # the blast as a sphere on 64^3 (about 1 h per scheme on the CPU)
./check.sh --legs pv5            # the blast across 2:1 AMR seams (about 14 min per scheme on the CPU, 19 on FNL)

Results ​

Balsara-Spicer blast with the limiter

Balsara–Spicer blast, β=2.5⋅10−4, 1282, t=0.01, EGLM, limiter on: density and magnetic pressure, splitting scheme (top) and weno-riemann HLLD (bottom).

Wu-Shu blast with the limiter

Wu–Shu blast, β=2.51⋅10−6, 1282, t=0.001, the same layout.

Euler near vacuum with the limiter

LeBlanc, the double rarefaction and the planar Sedov blast with the limiter, splitting scheme and weno-riemann HLLC, with the exact solutions of LeBlanc and of the double rarefaction.

ProblemWithout the limiterSplitting + limiterRiemann + limiter
PV-1, Balsara–Spicer blast, β=2.5⋅10−4, 1282, EGLMsplitting fails at step 3; HLLD runspasses, up to 1540 faces limited per stagepasses, up to 280
PV-1 as a sphere, 643 (FNL)not runpasses, up to 51566passes, up to 2976
PV-2, Wu–Shu blast, β=2.51⋅10−6, 1282, EGLMsplitting fails at step 1, HLLD at step 41passes, up to 10333passes, up to 352
PV-3, LeBlanc shock tube, 400 cellsboth runpasses, never limitedpasses, up to 512
PV-3, double rarefaction, 400 cellssplitting runs; HLLC fails at step 79passes, never limitedpasses, up to 1024
PV-3, planar Sedov blast, 800 cellssplitting runs; HLLC fails at step 69passes, never limitedpasses, up to 768
PV-4, isentropic vortex (642, 1282) and fast wave (16, 32 cells, EGLM)—bitwise equal to the run without the limiter—
PV-5, PV-1 at 642 with [0.25,0.75]2 refined 2:1 (issue #50)not run (uniform: splitting fails at step 3)passes; mass to round-off, seam flux mismatch 3.6⋅10−12passes; the same

The face counts include the copies along the null directions (256 per 1-D face). They are those of the CPU; the device ones differ in the splitting blasts (1468 and 10955), whose limited runs are not bitwise reproducible across backends, and agree elsewhere. The 3-D blast was run with the relative floor on the device only.

AssertionBoundCPUFNL
final time reached, inadmissible backbones, non-finite fluxes (every leg)tend, 0, 0passpass
PV-3: final ρ, p positive>0ρ≥9.9⋅10−4, p≥4⋅10−13pass
PV-4: interior of the last checkpoint, limiter on against offbitwisebitwisebitwise
PV-5: relative mass drift10−12round-offround-off
PV-5: forest max|Fcoarse−Ffine| at the end-of-step reflux10−93.6⋅10−12the same

Related cases: EGLM cleaning shows the blast failing without the limiter; quadtree AMR runs the limited blast on a quadtree; the MHD blast symmetry studies the blast under runtime AMR; Sod and Lax are the Euler Riemann problems the HLLC path is checked on.

Findings ​

  • Both schemes reach the final time, but not with the same quality: the density of the splitting scheme carries grid-scale noise around the blast, mild at β=2.5⋅10−4 and plain at β=2.51⋅10−6, where HLLD stays clean. The limiter guarantees positivity, not accuracy: on strongly magnetised blasts weno-riemann with HLLD is the scheme to use.
  • The Euler splitting scheme needs no limiting on any of the three near-vacuum problems at these resolutions: the limiter matters for weno-riemann.
  • On LeBlanc both schemes put the shock ahead of its exact position x=7.96: by 0.33 at 400 cells and by 0.19 at 800 (measured on the splitting scheme). The error converges slowly under refinement, as reported for this problem in the literature, and the limiter does not cause it (the splitting scheme never limits here). On the double rarefaction the velocity is ill-defined where the density nearly vanishes, hence the kink at x=0. On Sedov HLLC reaches a lower centre density than the splitting scheme (4⋅10−3 against 7⋅10−3), and the ambient pressure stays at its initial 4⋅10−13.
  • Sedov on HLLC set the limiter's relative floor. With the absolute floor alone the run stopped at step 10, at every CFL from 0.2 to 0.5: one stage drained the centre cell to ρ=10−13 with its energy kept (the sound speed grew by 106), and the next stage, whose time step is that of the step's first state, had no admissible backbone. With the relative floor (κ=0.1) the limiter acts in 15 stages and the run completes; the smooth cases of PV-4 stay bitwise.
  • The splitting scheme takes 614 steps on PV-2 against 284 for HLLD (779 with the absolute floor alone): its limited states keep low-density cells with large Alfvén speeds, which cost time steps but not admissibility.
  • PV-4 is bitwise because a face whose two cells keep Λ=1 is not touched, and the EGLM sources with Λ=1 take the unlimited arithmetic.
  • Before issue #50 neither scheme reached the end of PV-5. The splitting scheme stopped at step 184: the end-of-step reflux drove coarse cells beside the seam to ρe<0 (it replaced the limited coarse flux with the restricted fine one, a correction no cell factor bounds). HLLD stopped at step 261, after the tricubic seam ghost fill had produced inadmissible fine ghosts. With the ghost positivity blend and the per-stage seam flux synchronisation both schemes reach t=0.01 on the CPU and on FNL; the coarse seam flux is the mean of the fine ones at every stage, so the end-of-step reflux corrects round-off only.