Appearance
Numerical methods
PRISM discretizes the equations of the physical models by the method of lines: a spatial operator gives the residual [numerics] scheme_space (input).
Space discretization
Centred finite differences (fd_centered)
The state lives at the cell centres. Every derivative is the centred first derivative of order [fdv] fdv_order
with FD1_CC, adam_fdv_operators_library). The residual is evaluated directly from the curls:
plus, with GLM cleaning, ngc >= s is checked at initialization.
The discrete curl and divergence
The curl, the divergence and the gradient are all built from the same one-dimensional stencil, so on a uniform grid the discrete operators commute exactly as their continuous counterparts:
Hence
Centred finite volumes (fv_centered)
The fluxes
On a uniform grid the centred FV derivative reduces to the FD stencil (#84 E3a measured both against the elliptic solver). The FV path carries the face fluxes, so its 2:1 faces are refluxed (#38). The coils' current density is stamped with the operator of the chosen family ([fdv] fdv_scheme), so an FV run evolves an FV-built source.
WENO flux splitting (weno, CPU only)
A global Lax–Friedrichs splitting in characteristic (reconstruction_variables = characteristics) or conservative variables: with the left eigenvectors
each split flux is reconstructed at the faces by the library's upwind WENO ([weno] scheme, weights), projected back with the right eigenvectors, and differenced. ngc >= [weno] S is checked. The FNL backend refuses weno.
Time integration
[numerics] scheme_time = runge_kutta is the only scheme that runs; leapfrog, blanes_moan and commutator_free_magnus are refused at initialization on both backends (#55). The Runge–Kutta scheme is [runge_kutta] scheme (library reference):
| Scheme | CPU | FNL |
|---|---|---|
| SSP 11, 22, 33, 54 | yes | yes |
| low-storage 1, 2, 3 | yes | yes |
| Yoshida (4-stage symplectic) | yes (EM) | refused |
PIC runs, the PML, the charge-conserving current and the staged path (2:1 faces, forests) need an SSP scheme (PIC: SSP-22, 33 or 54). At every stage the coils' current is evaluated at the stage time
Time step. [time] it_max > 0 runs that many steps; otherwise the run ends at time_max, the last step shortened to reach it.
Adaptive mesh refinement
The grid is the library's octree or quadtree of Cartesian blocks (concepts). PRISM refines at initialization only: [initial_conditions] amr_iterations passes each set the initial condition and run the markers of [amr_marker_N]:
- mode 1
primitive-box: refine the blocks inside a box totarget_level; - mode 3 (
AMR_TV): refine on the total variation of the coils' current density.
The other markers do nothing in PRISM (input). [amr] frequency is read and unused: there is no runtime regrid.
At a 2:1 face the coarse ghosts are restricted from the fine cells and the fine ghosts interpolated from the coarse ones (the library's seam machinery, octrees and quadtrees, #46); the stages then run on the staged path of the forest, which needs an SSP scheme.
The 2:1 seam and div(B)
Across a 2:1 face the two sides difference at different resolutions, the composite operator is no longer a tensor product, and
- Monitor.
[IO] seam_divB_tol(off by default) warns, on a run with 2:1 faces, when the maxoutside the absorbing layers exceeds it (a global maximum, not a seam-local one), and [IO] seam_divB_error = .true.stops the run instead (library reference). - Mitigation.
divergence_correction = hyperbolicwithconstrained_transport = BorDBand a dampingdelays the growth; it does not cure it.
The details and the measurements are on the forest page.
Multi-realm runs
A forest manifest glues several PRISM realms through seams. Both backends implement the realm contract of the forest, fast and staged paths and the seam exchange. A seam fills its ghosts once per step (coupling_cadence = end_of_step, α, the default) or at every Runge–Kutta stage (stage_coincident, β). A 1:1 same-resolution seam needs β to stay divergence-free: under α the stages after the first read stale seam ghosts (#31). The divergence diagnostic refills the inter-realm seam on the committed state before it measures. Worked cases: src/tests/prism/regression/rmf-2realm*/; the cadences are explained on the forest page.
t0 elliptic solves
When the initial state has a charge or a current, PRISM solves for the fields they generate before the first step (impose_pic_fields_time_zero), with FLAIL, the library's elliptic solver (#84):
- Electric field (PIC models,
[PIC] electric_field_elliptic_initialization, default on):, then . - Magnetic field (when
at t0: PIC currents, or coils with time_delay <= 0; under PIC alsomagnetic_field_elliptic_initialization):per component, then .
fdv_order composed with itself on each axis, so the corrected field satisfies
- periodic and PEC faces: a direct FFT solve (FFTW on the CPU, cuFFT on FNL);
- zero-ghost (Dirichlet) faces: a preconditioned CG on rank 0, to
; - exact/open faces (Neumann, Silver–Müller): the free-space potential of the whole source in the ghosts, then the same CG.
On a singular problem (no Dirichlet face) the mean of the forcing is removed per component; for fdv_order = 10 (FLAIL accepts 2 to 8).
Mean fields between PEC walls ([PIC] elliptic_initialization_closure). With one axis grounded, the default). isolated sets them to the values of the same sources in open space along
with grounded. Only the mean mode is open: the modes