Mathematical Formulation
Notation: Throughout this section: - Boldface \(\mathbf{\cdot}\) denotes vector quantities in physical space (e.g., \(\mathbf{B}\), \(\mathbf{J}\)) - Quantities without subscripts are continuous (not discretized) - See the Finite Element Discretization page for complete notation conventions including hats for logical domain and subscript \(h\) for discretized quantities
Magnetohydrostatic (MHS) Problem
MRX solves the three-dimensional, static, ideal magnetohydrodynamic equilibrium problem, which seeks a magnetic field \(\mathbf{B}: \Omega \to \mathbb{R}^3\) on a bounded Lipschitz domain \(\Omega \subset \mathbb{R}^3\) such that:
where \(\mathbf{J} = \operatorname{curl}(\mathbf{B})\) is the current density (taking units where vacuum permeability \(\mu_0 = 1\)), and \(p\) denotes the plasma pressure. This is the magnetohydrostatic (MHS) problem.
Boundary Conditions
The boundary conditions used in MRX are guided by the requirements of the variational formulation:
where \(\mathbf{n}\) is the unit vector normal to the boundary \(\partial \Omega\).
Magnetic Relaxation Method
MRX uses a magnetic relaxation approach based on admissible variations of \(\mathbf{B}\) and \(p\). The method ensures certain bounds on the magnetic energy and uses differential geometry to transform between logical and physical domains. The relaxation process allows a magnetic field in a perturbed or non-minimum energy state to evolve to a lower energy equilibrium state.
Key Features
Exactly divergence-free magnetic fields: The divergence constraint \(\operatorname{div} \mathbf{B} = 0\) is enforced exactly at the discrete level through the use of appropriate finite element spaces (2-forms in the DeRham sequence)
No nested flux surface assumption: Unlike traditional codes (VMEC, NSTAB, GVEC, DESC), MRX does not assume nested magnetic flux surfaces exist, making it suitable for studying magnetic islands and chaotic field lines
Differential geometry: The code uses differential geometry to transform between logical coordinates \((r, \theta, \zeta) \in [0,1]^3\) and physical coordinates via a mapping function \(F: [0,1]^3 \to \Omega\)
Differentiability: Built on JAX, the entire computation graph is differentiable, enabling gradient-based optimization and sensitivity analysis