Skip to content

2:1 seam div(B): truncation order ​

CasesIssuesTypeBackendsFigureRegression
rmf-amr-fd, rmf-amr-fd-pulse#21, #22, #25, #26, #29 (#99 open)PCPU, FNLnormf-amr-fd, rmf-amr-fd-pulse (digest + residuals, CPU and FNL)

Case and scope ​

On a uniform grid ∇h⋅B stays at round-off (uniform grid). At a 2:1 face the coarse and fine sides difference with stencils of different resolution, the curl and the divergence no longer commute, and the seam injects a ∇⋅B source. The source is truncation-order, O(hp): it converges under refinement and it grows in time at fixed h. Five local fixes were ruled out and the resolution is accept-truncation (hazards, #29).

The two cases pin that state. The historical pointwise criterion "seam div(B) ≤ 1e-13" is retired (#21). The acceptance is now:

  • the identity holds wherever there is no resolution jump (marker-off control, and a grid refined uniformly so that every block face is 1:1);
  • the seam ∇⋅B sits on a pinned baseline, within 5 %: a rise is a regression of the seam fill or the exchange, a drop is an improvement to rebaseline deliberately;
  • the seam source converges under refinement (opt-in leg).

rmf-amr-fd carries the four coils. Its coil filament makes ∇⋅J scale as h−2, so its seam metrics are contaminated by the source and are no order measurement. rmf-amr-fd-pulse is the source-free twin: with J=0 both divergences are conserved, and any signal comes from the seam alone. Its pulse travels along +y, transverse to the seam normal: an x-travelling pulse varies only in x and is blind to the seam.

What the cases catch:

  • a seam fill or a ghost exchange that changes the seam source (baseline legs);
  • a 1:1 block face that leaks (the uniform-refined leg isolates the jump as the only source);
  • a ghost fill that no longer reproduces constants: ∇⋅D of the +y pulse is structurally zero across the seam;
  • an untruthful ∇⋅J diagnostic (#26: unstamped J ghosts and a stamp lagged by one step put it six orders off);
  • an RK scheme the staged forest path cannot split, running instead of refusing (#25).

Models and numerics ​

ItemChoiceCode
EquationsMaxwell, SI; 4 AC coils (rmf-amr-fd) or no source (rmf-amr-fd-pulse)models
Spacecentred finite differences of order 6compute_curl_fd_centered, compute_divergence_fd_centered, adam_fdv_operators_library.F90
TimeSSP Runge–Kutta (5,4), CFL 0.5; SSP (1,1) and runge-kutta-1 in the RK legsadam_rk_object.F90
Seam ghostscoarse→fine tricubic interpolation over the full ghost slab ([amr] seam_ghost_fill, default tricubic), fine→coarse restrictionseam_interpolate_tricubic, adam_seam_interpolation_library.F90; adam_field_object.F90
RK contractthe staged forest path accepts SSP schemes onlystages_per_step_forest, adam_prism_cpu_object.F90
Diagnosticmax |∇⋅D|, |∇⋅B|, |∇⋅J| per step, -divergence_history.datsave_divergence_history, adam_prism_common_object.F90

Initial and boundary conditions ​

ItemValue
Domain[−0.06,0.06]3 m
Gridoctree, 8 blocks of 163 at level 1 (Δx=3.75⋅10−3); the x<0 blocks refined to level 2 (Δx=1.875⋅10−3): one 2:1 plane at x=0; ngc = 3
Initial conditionrmf-amr-fd: vacuum with 4 AC coils. rmf-amr-fd-pulse: Gaussian pulse along +y, r0 = 0, sigma = 0.01, k0 = 0, B0 = 10 (Dz, Bx)
BoundariesNeumann on all six faces (the pulse moves 2.4⋅10−3 m in 5 steps and never reaches them)
Steps, ranks5, 1 rank
Controlmarkers_number = 0 (no seam)
Uniform legbox_xmax = 0.06: the whole domain at level 2, every face 1:1
Convergence legni = 16, 5 steps against ni = 32, 10 steps: the same final time

Input files ​

FileRole
src/tests/prism/regression/rmf-amr-fd/input.ini, check.shthe coil case: control, seam ∇⋅B, seam ∇⋅J
src/tests/prism/regression/rmf-amr-fd-pulse/input.ini, check.shthe pulse: control, uniform, seam, RK legs, quadtree leg (quadtree), --convergence
bash
cd src/tests/prism/regression/rmf-amr-fd && ./check.sh
cd ../rmf-amr-fd-pulse && ./check.sh --convergence
PRISM_EXE=$PWD/../../../../../exe/adam_prism_fnl ./check.sh        # FNL

Results ​

Bounds as coded; the baselines are CPU-pinned and the 5 % band is the cross-backend and cross-compiler allowance.

Case, legAssertsBoundCPUFNL
rmf-amr-fd, controlmax |∇⋅B|≤10−131.96⋅10−191.03⋅10−19
rmf-amr-fd, seammax |∇⋅B|1.555802⋅10−7±5%1.555802⋅10−7 (baseline)1.555801⋅10−7
rmf-amr-fd, seammax |∇⋅J|3.217958⋅10−5, factor 33.22⋅10−52.62⋅10−5
pulse, controlmax |∇⋅D|, max |∇⋅B|≤10−130, 00, 0
pulse, uniform level 2 (1:1 faces)max |∇⋅D|, max |∇⋅B|≤10−130, 00, 0
pulse, seammax |∇⋅D|≤10−133.3⋅10−153.3⋅10−15
pulse, seammax |∇⋅B| (step 5)12.65004±5%12.6500412.65004
pulse, runge-kutta-1non-zero exit with not stage-splittable in the logrefusalrefused, exit 1refused, exit 1
pulse, SSP (1,1)max |∇⋅D|; max |∇⋅B|≤10−13; 11.81251±5%2.3⋅10−15; 11.812513.3⋅10−15; 11.81251
pulse, --convergencepobs=log2⁡(E16/E32) of the seam ∇⋅B at the same time≥0.8E16=12.65, E32=5.700: 1.150E16=12.65, E32=5.700: 1.150

Long-horizon measurement, not a leg: on the pulse at fixed h the seam max |∇⋅B| grows from 6.9 to 1002 in 100 steps while the control stays at 0 and ‖B‖ changes by −3 %. The second-rung ratio of the refinement ladder, at ni = 64, is 1.62, toward the predicted 2.

Related pages: quadtree runs the same seam on a quadtree; inter-realm 2:1 seam reproduces the seam source across a realm boundary; absorbing layers on AMR and the [IO] seam_divB_tol monitor are the guard-rails.

Findings ​

  • The jump is the only source: on the uniformly refined grid, with the same resolution, the same block count and the same ghost exchange, both divergences stay at round-off.
  • ∇⋅D of the +y pulse stays at round-off across the seam: it is ∂Dz/∂z with no z variation, and every partition-of-unity ghost fill preserves it.
  • The seam source converges under refinement (pobs=1.15 on the first rung, 1.62 on the second) and grows without bound in time at fixed h. It is a constraint violation, not an energy instability.
  • The ∇⋅J band is a factor 3, not 5 %: ∇⋅J of the coil filament cancels gradients of order 106 down to 3⋅10−5, and the cross-compiler noise of the coil geometry (10−11 relative on J) leaves a 10−5 absolute floor.
  • A low-storage RK scheme on the seam case stops with the contract message; before #25 it crashed.