Skip to content

t0 elliptic solves on FLAIL ​

CasesIssuesTypeBackendsFigureRegression
rmf-pec-t0, rmf-open-t0, pic-pec-t0, pic-open-t0#84 (E3b, E3c; #105 open)PCPU, FNLnothe four cases (digest + residuals, CPU and FNL)

Case and scope ​

At t=0 PRISM builds the electric field of the initial charge and the magnetic field of the initial current by elliptic solves on FLAIL, with PRISM's own discrete operators (numerics):

  • electric: D(G)ϕ=−ρ/ε, then D←D−εGϕ;
  • magnetic: D(G)Ad=−μJd for each component, then B←B+∇h×A.

These four cases are the first that enter the t0 solves; before them none of the 18 regression cases did. Two face kinds are covered:

  • PEC (E3b): the potential is odd about the faces, Ad even about the faces normal to d and odd about the others;
  • exact/open, PRISM's Neumann (E3c): every ghost layer holds the continuum free-space potential of the source, −∑fdV/(4πr) (FLAIL_BC_FREE_GHOSTS), summed on rank 0 over the gathered source.

What the cases catch:

  • a t0 field that does not satisfy the constraint it was solved for (Gauss's law, ∇⋅B=0);
  • a fall-back to the legacy smoother: the log must report every FLAIL solve;
  • a t0 field that depends on the rank count: the legacy smoother summed the free-space potential over each rank's own blocks.

The PEC electric solve has one exact null mode. PRISM's centred divergence and gradient of order p annihilate the checkerboard χ=(−1)i+j+k, so with PEC faces D(G) is singular on χ and the component of ρ along it is out of reach of any D: ∇⋅D−ρ=−cχ, c=⟨ρ,χ⟩/N. The oracle measures the residual after removing it.

Models and numerics ​

ItemChoiceCode
EquationsMaxwell, SI (rmf-*, 4 rectangular coils carrying their current at t0, time_delay = 0); PIC (pic-*, a plasma box)models; the fields at t0
Spacecentred finite differences of order 6, ngc = 6adam_fdv_operators_library.F90
t0 solveFLAIL; PEC → FLAIL_BC_DIRICHLET (ϕ, tangential A) or FLAIL_BC_NEUMANN (normal A); exact/open → FLAIL_BC_FREE_GHOSTSimpose_pic_fields_time_zero, solve_time_zero, adam_prism_common_object.F90; adam_flail_object.F90; hazards
PIC depositTSC, non-conserving current (the conserving CPU deposit is single-block, single-rank)particle-in-cell
TimeSSP Runge–Kutta (5,4), CFL 0.5; the oracles read the step-0 checkpoint—

Initial and boundary conditions ​

CaseDomain (m)GridFacesSourceSteps
rmf-pec-t0[−0.06,0.06]364 blocks of 163 (643 cells)PEC4 AC coils at t010
rmf-open-t0[−0.06,0.06]364 blocks of 83 (323 cells)Neumannthe same coils, reaching the faces10
pic-pec-t0[−0.02,0.02]38 blocks of 163 (323 cells)PECplasma box, density 2⋅1094
pic-open-t0[−0.02,0.02]364 blocks of 83 (323 cells)Neumannthe same plasma4

Each check.sh runs its case at 1 and 2 ranks. The open cases use 64 blocks so that 2 ranks split them 32/32; pic-pec-t0 has 8 blocks, all on rank 0 at t0, so its rank-count leg checks the empty rank only.

Input files ​

FileRole
src/tests/prism/regression/{rmf,pic}-{pec,open}-t0/input.inithe cases
src/tests/prism/regression/{rmf,pic}-{pec,open}-t0/check.shthe runs at 1 and 2 ranks and the oracle calls (--build; PRISM_EXE, PRISM_PY)
src/tests/prism/regression/t0_elliptic.pythe oracles: gauss, open, divb, same
src/tests/poisson/test_flail_bc.F90 (E3a, mode test-flail-bc-gnu)PRISM's operators applied to FLAIL's solution reproduce the source to 10−15
bash
cd src/tests/prism/regression/pic-pec-t0 && ./check.sh             # CPU
PRISM_EXE=$PWD/../../../../../exe/adam_prism_fnl ./check.sh        # FNL

Results ​

Each case asserts, at 1 and 2 ranks: the run exits 0; the log reports the expected number of FLAIL t0 solve lines (3 for the rmf cases, A only; 4 for the pic cases, ϕ then A); the oracle below on the step-0 checkpoint; then the step-0 fields of the two rank counts agree.

CaseOracleBoundCPUFNL
rmf-pec-t0divb: max |∇⋅B|h/max|B|10−121.9⋅10−152.1⋅10−15
rmf-pec-t0same: B at np 1 against np 2, relative10−1200
rmf-open-t0divb, beyond 3 cells of the faces10−124.7⋅10−163.3⋅10−16
rmf-open-t0same: B10−1200
pic-pec-t0gauss: max |∇⋅D−ρ+cχ|/max|ρ|10−124.4⋅10−165.0⋅10−16
pic-pec-t0checkerboard share c/max|ρ| (reported)—3.3⋅10−51.2⋅10−5
pic-pec-t0same: D, B10−1200
pic-open-t0open: max |∇⋅D−ρ|/max|ρ| beyond 3 cells of the faces10−11 (the CG tolerance)6.6⋅10−135.6⋅10−13
pic-open-t0same: D, B10−1200

Against the legacy smoother FLAIL replaced (measured in #84):

CaseLegacy smootherFLAIL
pic-pec-t03.4⋅10−5max|ρ| of Gauss-law error beyond χ≈10−16
rmf-pec-t0stopped after 11 iterations with max |B| 2.5 times smaller; its B differs from FLAIL's by 1.6 (relative max norm) after 11 iterations, 0.48 after 40, 0.034 after 160reference
rmf-open-t0B at 2 ranks differs from 1 rank by 3.5 (relative)rank-independent
pic-open-t0D and B differ between rank counts by 2⋅10−2; Gauss law 4.6⋅10−16 after 10000 sweepsrank-independent

Related pages: the PIC cases run the conserving deposit with the same t0 solves; refusals holds the refusal of a t0 solve on a refined grid.

Findings ​

  • With PEC faces Gauss's law holds to round-off up to the checkerboard mode, the one component of ρ no D can carry with PRISM's centred operators (3⋅10−5 of max |ρ| on pic-pec-t0).
  • ∇⋅B=0 at t0 follows from ∇h⋅∇h×=0 whatever the solve's accuracy; the rank-count leg is the one that tests the solve.
  • With open faces the operator is nonsingular, and Gauss's law holds to the CG tolerance on the cells that read no field-BC ghost. Nearer the faces the divergence reads ghosts that PRISM's own Neumann field BC rewrote, so the oracles skip 3 cells.
  • The free-space ghosts are summed over the whole domain on rank 0: the t0 field no longer depends on the rank count.