Skip to content

Quadtree 2:1 seams ​

CasesIssuesTypeBackendsFigureRegression
rmf-amr-fd-pulse, quadtree leg#46CCPU, FNLyes—

Case and scope ​

A quadtree ([amr] ratio = 4) refines x and y only: its blocks span the domain along z at every level, so a 2:1 seam is 2:1 in x and y and 1:1 in z. The seam machinery (ghost restriction, coarse–fine interpolation, reflux) handles both trees (#46). Before #46 the coarse cells beside a quadtree seam picked up a spurious z dependence, and quadtree AMR was refused at initialization.

The leg runs the source-free pulse of seam div(B) on the octree of the regression case and on a quadtree, and compares them column by column. The pulse is uniform in x and z, so the seam is the only thing that can perturb it: it generates By and the seam ∇⋅B source of #29 (hazards).

What the case catches: a seam operator that mixes cells of different z on a quadtree, as a z dependence of a z-invariant solution or as a difference from the octree above round-off.

Models and numerics ​

ItemChoiceCode
EquationsMaxwell, SI, no sourcemodels
Spacecentred finite differences of order 6adam_fdv_operators_library.F90
TimeSSP Runge–Kutta (5,4), CFL 0.5; Δt=CFLmin(Δx,Δy,Δz)/(2c), set on both trees by the finest x and y cells, so the two runs take the same stepsnumerics
Seam ghostsfine→coarse restriction (mean of 8 fine cells on an octree, 4 on a quadtree), coarse→fine tricubic fillseam_interpolate_tricubic, adam_seam_interpolation_library.F90; adam_field_object.F90
Refluxfine face flux restricted per axisrestrict_fine_face_to_quadrant, adam_flux_register_object.F90

Initial and boundary conditions ​

ItemOctree (reference)Quadtree
Domain[−0.06,0.06]3 mthe same
Treeratio = 8ratio = 4
Grid8 blocks of 163 at level 1, x<0 refined to level 2; finest Δz=1.875⋅10−3one z layer of blocks, nk = 16: Δz=7.5⋅10−3
2:1 seamx=0, 2:1 in x, y, zx=0, 2:1 in x, y, 1:1 in z
Initial conditionGaussian pulse along +y, sigma = 0.01, B0 = 10the same
BoundariesNeumannthe same
Steps, ranks5, 15, 1

Input files ​

FileRole
src/tests/prism/regression/rmf-amr-fd-pulse/input.inithe octree case; the leg rewrites ratio for the quadtree
src/tests/prism/regression/rmf-amr-fd-pulse/check.shthe quadtree leg is default-on; --keep keeps its checkpoints
src/tests/flume/verification/mhd/quadtree/quadtree_oracle.pyshared with FLUME's MV-15: keys the cells by their (x,y) centre
src/tests/prism/regression/make_doc_figures.pydraws the figure from the --keep work directories
bash
cd src/tests/prism/regression/rmf-amr-fd-pulse && ./check.sh --keep   # CPU
PRISM_EXE=$PWD/../../../../../exe/adam_prism_fnl ./check.sh           # FNL

The oracle asserts, per field:

  • the z spread of every (x,y) column of each run at most 10−13;
  • the quadtree against the octree at the same (x,y) at most 10−13;
  • the quadtree's max |∇⋅D| at most 10−13.

Each field is measured against the largest magnitude of its vector (D, B, J). The pulse carries Dz and Bx, and the seam adds By. The other components are round-off on the octree (Dx, Dy∼3⋅10−18, Bz∼5⋅10−16 against |Bx|=10) and exactly zero on the quadtree: scaled by their own magnitude they would compare round-off with round-off.

Results ​

PRISM pulse across a 2:1 seam, octree against quadtree

Top row: Bx on z=0 (quadtree, blocks outlined: the refined half x<0 and the seam at x=0), and Bx on y=0 for both trees: the octree refines its x<0 blocks in z as well, the quadtree keeps one z layer of blocks. Bottom row: the quadtree against the octree per (x,y) column (relative to each vector's magnitude); By, the field the seam generates; and the divergence histories of the two runs, superposed.

CheckBoundOctreeQuadtree
z spread of a column, max over D and B10−132.6⋅10−16 (FNL 3.6⋅10−16)0
against the octree, per (x,y) column, max over D and B10−13—1.8⋅10−16 (FNL 3.6⋅10−16)
seam max |∇⋅B| at step 5reported12.6500412.65004
max |∇⋅D|10−133.1⋅10−150

CPU values; FNL in parentheses where it differs.

Related pages: FLUME's quadtree AMR (MV-15) runs the same oracle on ideal MHD.

Findings ​

  • The quadtree reproduces the octree to round-off, including the seam's ∇⋅B source to every printed digit. On a z-invariant field the per-axis seam formulas (restriction over 2×2 fine cells, coincident interpolation rows along z) give the same values as the octree's 2×2×2 ones on two identical z layers.
  • The octree's own z spread and its non-zero ∇⋅D are round-off of its z interpolation: its tricubic weights depend on the z sub-position. The quadtree has neither.