Skip to content

PRISM

PRISMPlasma Research usIng Simulation Methods — is an electromagnetic and plasma simulation application built on the ADAM framework. It solves the Maxwell equations for computational electromagnetics and, optionally, couples them to charged-particle dynamics via a Particle-in-Cell (PIC) method.

Physical Models

PRISM supports two physical models, selected in the INI file under [physics] physical_model:

ModelINI keyDescription
ElectromagneticelectromagneticSolves the Maxwell equations for D and B with a prescribed current source J
Particle-in-CellPICCouples Maxwell equations to individual charged-particle trajectories; current J and charge density ρ are deposited from particle positions

Governing Equations

PRISM solves the first-order hyperbolic form of the Maxwell equations:

qt+F(q)=S

The conservative state vector is q=(Dx,Dy,Dz,Bx,By,Bz,Jx,Jy,Jz) and the flux components are:

Fx=(0Bz/μBy/μ0Dz/εDy/ε000)Fy=(Bz/μ0Bx/μDz/ε0Dx/ε000)Fz=(By/μBx/μ0Dy/εDx/ε000)

The wave speeds are ±c0=±1/ε0μ0; the current components Jx,y,z have zero flux (source-only variables).

Source Layout

src/app/prism/
├── common/                                      # Shared across all backends
│   ├── adam_prism_parameters.F90                # Physical constants and eigenvector matrices
│   ├── adam_prism_physics_object.F90            # Physical model, variable counts, eigenvectors
│   ├── adam_prism_numerics_object.F90           # Temporal and spatial scheme selection
│   ├── adam_prism_common_object.F90             # prism_common_object base type
│   ├── adam_prism_bc_object.F90                 # Boundary conditions handler
│   ├── adam_prism_ic_object.F90                 # Initial conditions handler
│   ├── adam_prism_rk_bc_object.F90              # RK sub-stepping for boundary conditions
│   ├── adam_prism_io_object.F90                 # I/O handler
│   ├── adam_prism_time_object.F90               # Time integration handler
│   ├── adam_prism_coil_object.F90               # Current-carrying coil sources
│   ├── adam_prism_fWLayer_object.F90            # Far-wave layer (absorbing BC layer)
│   ├── adam_prism_external_fields_object.F90    # Externally prescribed fields
│   ├── adam_prism_pic_object.F90                # Particle-in-Cell configuration
│   ├── adam_prism_particle_injection_object.F90 # Particle injection handler
│   ├── adam_prism_leapfrog_pic_object.F90       # Leapfrog PIC time integrator
│   ├── adam_prism_rk_pic_object.F90             # Runge-Kutta PIC time integrator
│   ├── adam_prism_riemann_library.F90           # Maxwell Riemann solvers (LLF, HLL) and flux routines
│   └── adam_prism_common_library.F90            # Barrel re-export of all common modules
├── cpu/                                         # CPU backend
│   ├── adam_prism_cpu.F90                       # Entry point (program)
│   └── adam_prism_cpu_object.F90                # prism_cpu_object implementation
└── fnl/                                         # OpenACC GPU backend
    ├── adam_prism_fnl.F90                       # Entry point (program)
    ├── adam_prism_fnl_object.F90                # prism_fnl_object implementation
    ├── adam_prism_fnl_kernels.F90               # OpenACC GPU kernels
    ├── adam_prism_fnl_external_fields_kernels.F90 # OpenACC external-fields kernels
    ├── adam_prism_fnl_coil_object.F90           # GPU coil handler
    ├── adam_prism_fnl_fWLayer_object.F90        # GPU far-wave layer handler
    └── adam_prism_fnl_library.F90               # Barrel re-export of all FNL modules

Field Variables

Variable counts are determined at runtime by the physical model and divergence correction settings:

GroupVariablesCountNotes
ConservativeDx,Dy,Dz,Bx,By,Bznv_c = 6Always present
SourceJx,Jy,Jznv_s = 3Always present; zero flux
Divergence cleaningφ (D) and/or ψ (B)nv_cl = 0, 1, 2Optional hyperbolic cleaning scalars
PIC charge densityρnv_pic = 0, 1Present only in PIC model

Total: nv = nv_c + nv_s + nv_cl + nv_pic

Configurationnv
EM, no cleaning9
EM + D or B cleaning10
EM + D and B cleaning11
PIC, no cleaning10
PIC + D or B cleaning11
PIC + D and B cleaning12

Maximum supported: NV_MAX = 11.

Numerical Methods

Temporal Schemes

SchemeINI keyDescription
Runge-KuttaRUNGE_KUTTAExplicit RK (order configurable)
LeapfrogLEAPFROGStaggered-in-time symplectic scheme
Blanes-MoanBLANES_MOANHigh-order splitting method
Commutator-Free MagnusCOMMUTATOR_FREE_MAGNUSCFM exponential integrator

Spatial Schemes

SchemeINI keyDescription
WENOWENOHigh-order weighted essentially non-oscillatory reconstruction
FD centeredFD_CENTEREDFinite-difference centered stencil
FV centeredFV_CENTEREDFinite-volume centered stencil

WENO reconstruction operates on either conservative variables (CONSERVATIVE) or characteristic variables (CHARACTERISTICS), selected via [numerics] reconstruction_variables.

Riemann Solvers (adam_prism_riemann_library)

SolverDescription
LLF (Rusanov)Local Lax-Friedrichs: F=12(FL+FRc0(qRqL))
HLLHarten–Lax–van Leer two-wave solver

Divergence Control

Maxwell's equations require D=ρ and B=0. PRISM offers three strategies configured via [numerics] divergence_correction:

StrategyINI keyDescription
None(absent)No divergence control
PoissonPOISSONElliptic cleaning via a Poisson solve
HyperbolicHYPERBOLICDedner-type hyperbolic cleaning: augments system with scalar φ/ψ advecting divergence errors at speed χc0

Constrained Transport (CT) can additionally be applied to D, B, or both, controlled by [numerics] constrained_transport = D | B | DB | NO.

Source Terms: Coils

The prism_coil_object models current-carrying coils as volumetric current density sources J:

Coil typeDescription
rectangularRectangular loop coil with user-defined dimensions and normal direction
circularCircular loop coil
Current typeDescription
DC_currentConstant (DC) current
AC_currentSinusoidal (AC) current with amplitude, frequency, and initial phase

Coil normals are specified as +x, -x, +y, -y, +z, or -z. Coil J contributions are computed each time step and registered for optional output as auxiliary fields (j_vec_1/2/3, f_Gauss).

Particle-in-Cell (PIC)

When physical_model = PIC, PRISM tracks charged macro-particles alongside the Maxwell field. Each particle carries 8 state variables stored in q_pic(8, particle_number):

IndexVariableDescription
1xPosition x
2yPosition y
3zPosition z
4vxVelocity x
5vyVelocity y
6vzVelocity z
7chargeParticle charge
8massParticle mass

Field values at particle locations are stored in pic_fields(8, particle_number). Particle time integration uses either Leapfrog (LEAPFROG) or Runge-Kutta (RUNGE_KUTTA), configured independently from the field scheme.

Two problem types are supported:

TypeINI keyDescription
PlasmaplasmaEnsemble of charged particles
Single particlesingle_particleSingle test-particle trajectory

prism_common_object Overview

The base type aggregates all framework and PRISM sub-objects:

ADAM framework objects: mpih_object, adam_object, field_object, grid_object, amr_object, ib_object, slices_object, leapfrog_object, blanesmoan_object, cfm_object, rk_object, weno_object, flail_object

PRISM sub-objects: prism_physics_object, prism_numerics_object, prism_io_object, prism_bc_object, prism_ic_object, prism_rk_bc_object, prism_time_object, prism_coil_object, prism_fWLayer_object, prism_external_fields_object, prism_pic_object, prism_particle_injection_object, prism_leapfrog_pic_object, prism_rk_pic_object

Field arrays (all shape (nv, ni, nj, nk, nb)):

ArrayDescription
qConservative field: D, B, J (+ optional cleaning scalars and ρ)
dqResiduals RHS
curlCurl of field components (optional output)
divergenceDivergence of field components (optional output)

PIC arrays: q_pic(8, particle_number), pic_fields(8, particle_number)

Energy diagnostics: energy_D(:), energy_B(:) (time histories), rms_energy_error_D/B

Backends

BackendEntry pointKey typeAccelerator
CPUadam_prism_cpu.F90prism_cpu_objectMPI + OpenMP
FNLadam_prism_fnl.F90prism_fnl_objectMPI + OpenACC (NVIDIA GPU)

The FNL backend adds GPU companion objects (field_fnl_object, rk_fnl_object, weno_fnl_object, etc.) and device-side pointer arrays (q_gpu, dq_gpu, flx_f_gpu, curl_gpu, …). The CPU backend implements all differential operators (curl, divergence, gradient, Laplacian, derivatives 1–4) via procedure pointers, dispatched at initialisation based on scheme_space.

Building

bash
# CPU backend (GNU compiler)
FoBiS.py build -mode prism-gnu

# CPU debug build
FoBiS.py build -mode prism-gnu-debug

# FNL (OpenACC) backend
FoBiS.py build -mode prism-fnl-nvf-oac

Executables are written to exe/adam_prism_cpu and exe/adam_prism_fnl.

Running

bash
mpirun -np <N> exe/adam_prism_cpu [input.ini]
mpirun -np <N> exe/adam_prism_fnl [input.ini]

If no argument is given, input.ini in the working directory is used.

License

PRISM is part of the ADAM framework, released under the GNU Lesser General Public License v3.0 (LGPLv3).

Copyright (C) Andrea Di Mascio, Federico Negro, Giacomo Rossi, Francesco Salvadore, Stefano Zaghi.