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. 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 SETH's upwind WENO-JS kernel of the width [weno] scheme names (seth_weno<2S-1>_js, with SETH's descaler for weights = si; one kernel per width, compiled with S a constant, #139 S5, the same results as ADAM's former kernel bit for bit), projected back with the right eigenvectors, and differenced. ngc >= [weno] S is checked. The centred names weno-c-* stop at initialization (they used to run the upwind kernel at that S under a centred name). 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: any runge-kutta-ssp-*; PIC itself runs on the fused path only, see PIC). At every stage the coils' current is evaluated at the stage time stage_time(s), the tableau's abscissa).
The integrator is SELAH's, on both backends, through the library adapter adam_stepper_object (#132 phase 4): the SSP schemes in the Butcher form (every stage on the stepper's own state register), the low-storage ones in the two-register form (every stage on q), Yoshida as SELAH's yoshida-4 splitting of the partitions B (advanced first) and D, seven sub-flows, a residual each, interior cells. The coefficients are ADAM's former ones, bit for bit, except Yoshida's (SELAH's triple-jump weights, exact to the last bit; ADAM's were 16-digit literals). The PML auxiliary fields and the PIC particles keep their own stage storage, advanced in step with the same tableau. On the CPU the SSP update sums the stages in the FNL order, so CPU runs moved at round-off.
Time step. [time] it_max > 0 runs that many steps; otherwise the run ends at time_max, the last step shortened to reach it.
Plasma-frequency cap (PIC models). With [PIC] omega_dt_max (default 0.05). Otherwise CFL or plasma_frequencies). A step in which a particle crosses more than one cell (
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.
Across a 2:1 face the centred operators no longer commute, and the seam injects a [IO] seam_divB_tol monitor and the mitigation are in the hazards.
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, β). Under α every stage reads the peer state of the step's fill: each stage state takes the seam ghosts of q when it opens (#116, #132 rule 1; before, PRISM's stages read stale seam ghosts). A 1:1 same-resolution seam needs β to stay divergence-free (hazards). 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