Skip to content

P4 Conservation ​

IDGroupTypeBackendsFigureProgram
P4PropertiesPCPU (gfortran, nvfortran, ifx); GPU (A30, tests-nvf-oac)yesselah_test_stepper

Case and scope ​

A conservative finite-volume solver changes the mass only through its boundary fluxes. With a Runge–Kutta step, the step's flux is the weighted sum of the stage fluxes:

mn+1−mn=−Δt∑kbk(Fright−Fleft)k.

An AMR flux register accumulates exactly this sum at coarse–fine faces, using stage_weight(k). The case checks the identity in every Runge–Kutta form. That includes the low-storage ones, whose coefficients are not bk, so their stage_weight is derived from the Butcher form. As a control it repeats the sum with uniform weights 1/s.

Setup ​

ItemValue
Problemut+ux=0, inflow u=1 on the left, outflow on the right, u0=1+12sin⁡2πx
Grid4 blocks of 16 cells, central flux form; FUNDAL arrays
Steps4, every scheme in every form (Butcher, two-register, 2N, Ketcheson)
Bound$
Controlthe same with wk=1/s (reported, not asserted)

Program ​

bash
./exe/selah_test_stepper
SELAH_VV_DIR=exe/vv-data ./exe/selah_test_stepper      # telescoping.dat

Results ​

Telescoping

The conservation defect with stage_weight (coloured) and with uniform weights (grey), largest over 4 steps.

SchemeFormDefect with stage_weightDefect with uniform weights
eulerButcher5.27e-165.27e-16
eulertwo-register5.27e-165.27e-16
ssp-22Butcher3.33e-163.33e-16
ssp-22two-register3.33e-163.33e-16
ssp-33Butcher2.01e-160.03501
ssp-33two-register6.24e-160.03501
ssp-54Butcher2.67e-165.21e-04
ssp-104Butcher6.00e-166.00e-16
ssp-104Ketcheson5.83e-165.83e-16
rk4Butcher5.03e-160.008229
lsrk-33Butcher5.48e-160.009265
lsrk-33Williamson 2N3.19e-160.009265
lsrk-54Butcher5.86e-160.001091
lsrk-54Williamson 2N6.63e-160.001091

Largest over 4 steps of inflow/outflow advection. The weights of euler, ssp-22 and ssp-104 (Ketcheson's bk=1/10) are uniform: for them the two columns agree, as they must.

Findings ​

  • The identity holds to round-off in every form of every scheme.
  • Uniform weights miss by up to 3.5⋅10−2 (ssp-33): a refluxed AMR solver with the wrong weights silently stops conserving. For euler, ssp-22 and ssp-104 the weights are uniform, and both columns agree.
  • The tutorial and the AMR cookbook show the register in use, and a correction at a face with mismatched fluxes restoring conservation to 2⋅10−16.

GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice