SPEC = the Stepped-Pressure Equilibrium Code.

  1. All relevant publications and presentations are given on the MRxMHD website.
  2. There is also a brief description of SPEC on the Princeton Plasma Physics Laboratory Theory Department website.
  3. An overview of the algorithm is given in a Flow Chart.
  4. Please direct questions/suggestions to Stuart Hudson, shudson@pppl.gov, subject=spec.
  5. A detailed description of all subroutines etc. is given below.

subroutine description
global (input) Defines input namelists and global variables, and opens some output files.
manual (documentation) Code development schedule.
preset (initialization) Allocates and initializes internal arrays.
rzaxis (coordinate axis) Specifies position of coordinate axis; ${\bf x}_a(\zeta) \equiv \int {\bf x}_1(\theta,\zeta) dl \, / \int dl$.
packxi (“packing”) Packs, and unpacks, geometrical degrees of freedom; ${\bf \xi} \leftrightarrow \{ R_{i,l},Z_{i,l} \}$.
volume Calculates volume of each region; ${\cal V}_i \equiv \int dv$.
coords (geometry) Calculates coordinates, ${\bf x}(s,\theta,\zeta) \equiv R \, {\bf e}_R + Z \, {\bf e}_Z$, and metrics, using FFTs.
metrix (metrics) Calculates the metric quantities, $\sqrt g \, g^{\mu\nu}$, which are required for the energy and helicity integrals.
ma00aa (integrals) Calculates volume integrals of Chebyshev-polynomials and metric elements.
matrix (build matrices) Constructs matrices that represent the Beltrami linear system.
mp00ac (solver) Solves Beltrami/vacuum (linear) system, given matrices.
ma02aa (solver/driver) Constructs Beltrami field in given volume consistent with constraints.
packab (“packing”) Packs, and unpacks, Beltrami field solution vector; ${\bf a}\equiv\{A_{\theta,e,i,l}, A_{\zeta,e,i,l}, etc.\}$.
tr00ab (transform) Calculates transform, \( \iota \hspace{-0.35em}\)-\( = \dot \theta ( 1 + \lambda_\theta) + \lambda_\zeta \), given ${\bf B}|_{\cal I}$.
curent (currents) Computes the plasma current, $I \equiv \int B_\theta \, d\theta$, and the “linking” current, $G \equiv \int B_\zeta \, d\zeta$.
df00ab Evaluates volume integrals, and their derivatives w.r.t. interface geometry, using “packed” format.
lforce (“local” force) Computes $B^2$, and the spectral condensation constraints if required, on the interfaces, ${\cal I}_i$.
brcast (parallel) Broadcasts Beltrami fields, profiles, . . .
dforce (“global” force) Given “position”, ${\bf \xi}$, computes ${\bf F}({\bf \xi})$ and $\nabla_{\bf \xi}{\bf F}$.
newton (force-driver) Solves ${\bf F}({\bf \xi})=0$, where ${\bf F} \equiv \{ [[p+B^2/2]]_{i,l}, I_{i,l} \}$ and ${\bf \xi} \equiv \{ R_{i,l},Z_{i,l} \}$.
casing (free-boundary) Constructs magnetic field at external location produced by internal plasma currents.
bnorml (free-boundary) Computes ${\bf B}_{Plasma} \cdot {\bf e}_\theta \times {\bf e}_\zeta \;$ on the computational boundary, $\partial {\cal D}$.
jo00aa (diagnostic) Measures error in Beltrami equation, $\nabla \times {\bf B} - \mu {\bf B}$.
pp00aa (diagnostic) Constructs Poincaré plot and “approximate” rotational-transform (driver).
pp00ab (diagnostic) Follows magnetic fieldline using NAG ode-integration routine, D02BJF.
bfield (diagnostic) Returns the magnetic field field line equations, $d{\bf x}/d\phi = {\bf B}/B^\phi$.
stzxyz (diagnostic) Calculates coordinates, ${\bf x}(s,\theta,\zeta) \equiv R \, {\bf e}_R + Z \, {\bf e}_Z$, and metrics, at given $(s,\theta,\zeta)$.
sc00aa (diagnostic) Returns “covariant” magnetic field, ${\bf B} = B_s \nabla s + B_\theta \nabla \theta + B_\zeta \nabla \zeta$, on ${\cal I}$.
hesian (diagnostic) Computes eigenvalues and eigenvectors of derivative matrix, $\nabla_{\bf \xi}{\bf F}$.
ra00aa (output) Writes vector potential to .ext.sp.A .
numrec (numerics) Some miscellaneous numerical routines.
xspech (main) Main program.
hdfint (output) Writes all the output information to ext.sp.h5.