The main function of the equilibrium1 module is to provide the normalized magnetic field components as functions of normalized toroidal coordinates. The module follows an abstract design pattern, with specialized implementations for various types of equilibria, ranging from simple slab geometries to numerically prescribed 3D stellarator configurations. Equilibrium initialization is handled through a factory method, as demonstrated in the following example:
use equilibrium_m, only: equilibrium_t
use equilibrium_factory_m, only: create_equilibrium, get_equilibrium_identifier
integer :: id_eq
class(equilibrium_t), allocatable :: equi
! Get equilibrium identifier
id_eq = get_equilibrium_identifier('CIRCULAR_TOROIDAL')
! Initialise equilibrium, where parameters are read from 'params.in' file
call create_equilibrium(equi, id_eq, 'params.in')
After the initialisation several routines providing information on the magnetic geometry are available, e.g.:
by = equi%by(x, y, phi) ! Vertical normalised field component
rho = equi%rho(x, y, phi) ! Normalised flux label
Each equilibrium type has specific characteristics and requires distinct parameters for initialization. As an illustrative example, we provide a more detailed explanation of the CIRCULAR_TOROIDAL equilibrium. This equilibrium describes circular magnetic flux surfaces in toroidal geometry, with a prescribed safety factor profile . The in-plane coordinates and represent the major radius and vertical coordinate, respectively, both normalized to the major radius of the magnetic axis, . The flux label measures the normalized distance to the magnetic axis, defined as . The normalized magnetic field components are given by:
with the geometric poloidal angle.
The equilibrium parameters are provided via the following namelist, which is read from file during initialization as discussed above:
&equi_circular_toroidal_params
rhomin = 0.1 ! Inner limiting flux surface (Can also be zero, to include magnetic axis)
rhomax = 0.2 ! Outer limiting flux surface
! q at center of domain is 3
q_0 = 2.166 ! Safety factor on axis
q_quad_param = 33.333 ! Parameter for quadratic q-profile, q(rho) = q0 + q_quad_param * rho^2
/
We note that the CIRCULAR_TOROIDAL equilibrium also supports the superposition of a helical magnetic field perturbation, which can create magnetic islands. This feature is not discussed in the current context.
For a detailed description of the other equilibrium types, we refer to the source code and provide a brief overview below:
SLAB: A slab geometry, periodic in (\ y ), direction.CIRCULAR: Basically a periodic screw pinch, i.e., a straight cylinder with circular flux surfcaes, periodic in .CIRCULAR_TOROIDAL: See detailed description above.SALPHA: Deprecated. Use CIRCULAR_TOROIDAL instead.CARTHY: A set of analytically prescribed diverted equilibria described in [P.J. McCarthy, Phys. Plasmas 6, 3554, 1999]CERFONS: Another set of analytically prescribed diverted equilibrium described in [A.J. Cerfons and J.P. Freidberg, Phys. Plasmas 17, 032502 (2010)]NUMERICAL: Axisymmetric equilibria, where the poloidal magnetic flux is prescribed on a numerical grid and interpolated via splines. The grid file is in a specialised NetCDF format and can be created using the TorX library. See [T. Body et al., Contrib. Plasma Phys 60, e201900139 (2020)] or [T. Body, Development of Turbulence Simulationsfor the Edge & Divertor and Validation against Experiment, PhD thesis TUM Munich, (2022)].DOMMASCHK: A set of analytically prescribed 3D stellarator configurations (only vacuum fields), described in [W. Dommaschk, Comput. Phys. Commun. 40, 203, (1986)].FLARE: Interfaces with the FLARE library [H. Frerichs, Nucl. Fusion 64, 106034, (2024)] which provides among others description of numerically prescribed stellarator geometries. The FLARE library has to be installed separately and PARALLAX needs to be compiled with -DENABLE_FLARE=ON.It is important to clarify that the term "equilibrium" may be somewhat misleading here. In PARALLAX, the term primarily refers to magnetic field configurations, which do not necessarily represent an equilibrium state, as this depends on additional factors such as the pressure profile. ↩