Skip to content

Conservation across AMR seams ​

IDGroupMilestoneBackendsFigureRegression
V3, RV-4EulerM1 (#35), M3 (#47)CPU, FNLyesamr-periodic-reflux, amr-periodic-reflux-stage

Case and scope ​

A finite-volume update conserves only if every interior face flux leaves one cell and enters its neighbour. At a 2:1 coarse–fine face the two sides compute different fluxes (different stencils, different ghost fills), so the grid leaks mass, momentum and energy unless the Berger–Colella reflux replaces the coarse flux with the restricted fine one. The case is a triply periodic box with one refined octant: nothing crosses the boundary, so the five volume integrals must stay constant to round-off.

What the case catches:

  • a missing or wrong reflux at any of the 6 coarse–fine faces, periodic ones included;
  • a reflux register that does not hold the flux the step used: FLUME accumulates the seam fluxes of every Runge–Kutta stage weighted by its SSP coefficient;
  • a vacuous test: the run without reflux is the negative control and must drift well above round-off, otherwise the case does not exercise the seams;
  • block layouts the 2:1 seams cannot handle, refused at initialization: an odd cell count along a refined axis (#39; a 2:1 child boundary in the middle of a parent cell gave NaN silently), and a count below 2ngc (#66; the outer coarse ghost layers would be restricted from the fine block's own, stale ghosts).

Models and numerics ​

ItemChoiceCode
Equationscompressible Euler, ideal gas, γ=1.4models
Space, wenoWENO5 (weno-u-5) flux splitting on characteristic variablescompute_residuals_weno, adam_flume_cpu_object.F90
Space, weno-riemann (RV-4)WENO5 interpolation (characteristic), HLLC, the 6th-order flux correction with the WENO-weight sensorcompute_residuals_riemann, adam_flume_cpu_object.F90
TimeSSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL 0.5adam_rk_object.F90
AMRgeometric box marker, one more level on the octant; 2:1 ghost restriction and interpolationmark_by_geometry, adam_flume_common_object.F90; boundary conditions
RefluxBerger–Colella, stage fluxes weighted by the SSP coefficientsaccumulate_seam_fluxes, adam_flume_cpu_object.F90; accumulate_coarse_flux, accumulate_fine_flux, adam_flux_register_object.F90; apply_reflux_corrections, adam_forest_object.F90; numerics
Block-cell checksodd counts and counts below 2ngc along a refined axis refusedcheck_amr_block_cells, adam_realm_object.F90
Boundariesperiodic on all six facesboundary conditions
Integralsvolume integrals of the conservative variables, every stepcompute_conservation, adam_flume_cpu_object.F90

Initial and boundary conditions ​

ItemValue
Domain[0,1]3
Gridoctree, one uniform level (8 blocks of 83 cells), then the octant [0,0.5]3 refined once more: 15 blocks, 6 coarse–fine faces (the log must report registered intra-realm AMR seam faces: +6), ngc = 3
Ranks2
Stateuniform flow (ρ,u,v,w,p)=(1,1,1,1,1) with a 1% seeded density and pressure perturbation (s = 0.01), so every seam carries a flux
Initial conditionuniform
Boundariesperiodic on all six faces
Final time20 steps
LegChangeExpected
reflux on—the five integrals constant within 10−13
reflux offreflux = .false.drift of at least 10−10 (negative control)
odd cellsni = 7refused at initialization ([grid].(ni)=+7 is odd: 2:1 refinement)
thin blocksni = 4 (<2ngc)refused at initialization ([grid].(ni)=+4 is less than 2*ngc)

Input files ​

FileRole
src/tests/flume/verification/conservation/amr-periodic.inithe case
src/tests/flume/verification/conservation/check.shV3: the four legs (--np N, --legs LIST: v3-reflux for legs 1 and 2, v3-odd, v3-thin; FLUME_EXE selects the backend)
src/tests/flume/verification/conservation/conservation_oracle.pythe drift of the integrals (--conserved, --leaky); --compare for two runs cell by cell
src/tests/flume/verification/riemann-flux/check.sh --legs conservationRV-4: the reflux on and off legs on weno-riemann
src/tests/flume/verification/make_doc_figures.py (fig_conservation)the figure, from the conservation histories of conservation/
bash
cd src/tests/flume/verification/conservation && ./check.sh               # CPU
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./check.sh              # FNL
cd ../riemann-flux && ./check.sh --legs conservation                     # RV-4, HLLC

Results ​

Conservation across AMR seams

Relative drift of the five volume integrals against time, reflux on (solid) and off (dashed).

RunBoundCPUFNL
reflux on, weno10−13≤6⋅10−152.2⋅10−16
reflux on, weno-riemann HLLC10−1302.2⋅10−16
reflux off≥10−101–2⋅10−51–2⋅10−5
ni = 7refusedrefusedrefused
ni = 4refusedrefusednot run

Related cases: Shock over a cylinder and Multi-realm runs rely on the same reflux; the dissipative fluxes across 2:1 seams are checked in VV-7.

Findings ​

  • With the stage fluxes weighted by the SSP coefficients the register holds the flux the committed step used, and the integrals stay at round-off on 1 and 2 ranks (measured at M1-P5).
  • Without the reflux the integrals drift by 1–2⋅10−5 in 20 steps: the seams carry flux, and the reflux leg is not vacuous.
  • The MHD version (MV-11, mhd/conservation) adds the three components of B and ψ: drift ≤4.7⋅10−14.
  • The two refused layouts were silent before their checks: NaN for the odd count, rank-dependent results for the thin block (measured 0.2 in density between 1 and 2 ranks on the step forest, see Forward-facing step).
  • The ni = 4 leg has no FNL run on record (no FNL work directory).