The Numerics of VMEC++
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Physics. The day in general physics: instruments, methods and results across the field.
Kai: We're looking at the paper: "The Numerics of VMEC++".
Title and authors: Kai: So we've seen that "The Numerics of VMEC++" is focused on turning a complex equilibrium problem into a solvable numerical framework, specifically focusing on the mechanics of VMEC++.
Mira: The authors are Jonathan Schilling and the team at Proxima Fusion in Munich, and their work centers on making this kind of detailed calculation more efficient.
Lev: It's interesting because they are taking an existing tool and pushing its numerical capabilities to handle more complex, free-boundary problems reliably.
Kai: They aren't just running the code; they are rigorously defining all the mathematical steps, from how they calculate normal derivatives to how the Fourier basis works.
Mira: It’s about providing a detailed roadmap for anyone trying to implement or understand these kinds of plasma equilibrium solvers, which is crucial for validating simulations.
Lev: For someone building real hardware, knowing exactly where the overhead lands in these complex numerical steps matters a lot for performance metrics.
The paper's summary: Kai: In this paper, they summarize how VMEC++ approaches plasma equilibrium by using those Fourier methods to solve the force balance problem iteratively.
Mira: Essentially, they explain the process of computing residual MHD forces in real space, moving them into Fourier space, and then using an accelerated descent method to adjust the flux surface geometry toward force balance.
Lev: They are showing how this whole pipeline is structured so that you can see exactly where the physics meets the numerical discretization.
Kai: They also detail the two modes again: fixed boundary mode for simpler checks versus free boundary mode which allows for plasma shape evolution until force balance is achieved.
Mira: The key implication here is that they are providing a concrete, rigorous way to handle those difficult iterative adjustments in a system where the geometry itself is changing.
Lev: It’s about proving the numerical stability of their approach when you let the boundary move around.
The paper's improvements: Kai: The paper highlights several improvements they've made to the VMEC framework, starting with better constraint handling through spectral condensation.
Mira: That allows for a more economical use of available Fourier coefficients because they fit real space points well while simultaneously condensing them into a spectrally condensed Fourier representation.
Lev: That’s good because it means you don't need an excessive number of high-frequency modes to capture the physics, right?
Kai: Exactly. Then they introduce direct equal-arclength parameterization for flux surfaces, which helps get a unique poloidal angle-like coordinate in asymmetric cases.
Mira: That method reduces the set of Fourier coefficients by one element by assuming x equals y plus that specific condition, so it’s a neat trick for efficiency.
Lev: Reducing the required coefficients by one is tangible overhead savings when you have to compute those large matrices later.
Kai: They also detail computing analytical first and second order derivatives for both the objective function and the constraint, which feed into non-linear optimization algorithms to find better Fourier coefficients.
Mira: And they suggest feeding that optimization routine the value of M minus one, because M can't go lower than one, which guides its path in parameter space more effectively.
Lev: So it’s about making the optimizer smarter by giving it a better understanding of the bounds on its parameters.
Conclusion: Kai: To wrap up, "The Numerics of VMEC++" is about solidifying the implications of using spectral condensation and parameterization tricks to make this equilibrium code more practical.
Mira: They’ve shown a way to handle free boundaries robustly while keeping the computational cost manageable by optimizing how they use Fourier coefficients.
Lev: For me, it means when we move this to real hardware, we need those efficiency gains because the overhead of complex matrix assembly needs to be minimized for actual runs.
Kai: It’s about taking a highly theoretical method and showing exactly how it translates into a usable numerical pipeline for actual plasma geometry determination.
Mira: This paper gives us a solid foundation for understanding how to push these methods further, especially concerning the handling of those tricky geometric details in three dimensions.
Lev: It sets a clear benchmark for what real hardware needs to be able to handle computationally without the solution blows up due to numerical instability.
Jonathan Schilling
Proxima Fusion
physics.plasm-ph, astro-ph.IM
Submitted: 2025-02-05
Updated: 2026-11-18
Code: https://github.com/hbldh/pyefd
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: The Variational Moments Equilibrium Code (VMEC) is a computational tool employed in stellarator physics to determine plasma equilibrium…
Key concepts
- Spectral Condensation
- This technique converts a real-space flux surface representation into Fourier coefficients suitable for VMEC. It efficiently uses available finite Fourier coefficients by fitting real-space points well while condensing them into a spectrally condensed Fourier representation, making the process more economical.
- Equal-Arclength Parameterization
- This method parameterizes flux surfaces using direct equal-arclength parameterization. This is useful for obtaining a unique poloidal angle-like coordinate, especially in asymmetric cases, and it reduces the set of Fourier coefficients needed by assuming $x_{s1}$ equals $y_{c1}$.
- Jacobian Matrix Computation
- The system computes the Jacobian matrix of the curve fitting problem. This matrix is approximately diagonal, which allows for an efficient calculation of its maximum eigenvalue. This helps understand how small changes in free parameters affect the force balance and stability.
- Even-m and Odd-m Decomposition
- Metric elements ($g_{\alpha\beta}$) are decomposed into even-$m$ and odd-$m$ contributions when evaluated at half-grid points. This decomposition is more robust than direct evaluation, especially for handling products of odd modes, ensuring a stable calculation of geometric quantities.
Terminology
Summary
The Variational Moments Equilibrium Code (VMEC) is a computational tool employed in stellarator physics to determine plasma equilibrium, specifically calculating three-dimensional geometry and magnetic field configurations under ideal magnetohydrodynamics (MHD) assumptions, often assuming nested flux surfaces. p. 6 Chapter 1
Introduction
The Variational Moments Equilibrium Code (VMEC) [1] is the main computational workhorse
used in the stellarator community to compute the three-dimensional geometry of and magnetic
field in the plasma. VMEC computes the plasma equilibrium in a stellarator under the assumption of ideal magneto-hydrodynamics (MHD). , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method.Where the paper says it
Where the paper says it
The code operates in two modes: fixed-boundary mode, which solves for a predefined plasma boundary geometry and fixed pressure or rotational transform/current profiles on the flux surfaces; and free-boundary mode, which permits the plasma boundary to evolve until it achieves force balance with an external magnetic field generated by coils. p. 6 The
fixed-boundary mode solves the ideal MHD force balance for a given, fixed, plasma boundary
geometry and fixed radial profiles of pressure and either rotational transform or enclosed toroidal
current on a number of flux surfaces inside the plasma boundary. The free-boundary mode extends the fixed-boundary operation by allowing the plasma boundary to move into force balance
with an external magnetic field produced by coils. The free-boundary mode extends the fixed-boundary operation by allowing the plasma boundary to move into force balance
with an external magnetic field produced by coils. This adds computational complexity and
hence, free-boundary computations are usually a factor of 2 to 10 slower than the corresponding
fixed-boundary computations.Where the paper says it
Where the paper says it
The numerical methodology relies on a comprehensive set of mathematical tools, including normal derivative calculations, solving elliptic partial differential equations (Laplace's and Poisson's equations), Green’s Second Identity, trigonometric identities, series expansions (Binomial and geometric), generating functions, orthogonality of the Fourier basis, forward and inverse Fourier transforms, and methods for handling parity in Fourier transforms.
The toroidal coordinate system is established using a left-handed system where the poloidal coordinate is denoted by theta and the toroidal coordinate by zeta. p. 2 Trapezoidal . 17
3 Toroidal Coordinate System 19
3. , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method. 6 Generating Functions . 7 Orthogonality of the Fourier Basis . 2 Symmetry Properties . 3 Vectorized Formulation of Fourier Series . 4 Normalized Coordinates . 5 Tangential Derivatives . 6 Toroidal Rotation of the Coordinate System . 7 Cartesian Components, Unit Vectors and Surface Normal .Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
A technique called spectral condensation is utilized to convert a real-space flux surface representation into Fourier coefficients suitable for VMEC, leveraging the poloidal freedom to efficiently utilize finite Fourier coefficients. p. 6 , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method. 1 Spectral Width . 2 Curve Fitting . 5 Direct Equal-Arclength Parameterization . 1 Trapezoidal Quadrature .Where the paper says it
Where the paper says it
Where the paper says it
The metric elements g alpha beta are defined based on the geometry; their evaluation on the half-grid is performed by combining even- m and odd- m contributions, with specific interpolation rules applied to manage product terms involving odd modes. The constraint imposed by the toroidal current profile is formulated using covariant magnetic field components. p. 3 9 Constraint of Toroidal Current Profile . 10 Covariant Magnetic Field Components . The VMEC input file then only needs to contain the respective circuit currents and the
total magnetic field produced by all main coils is then computed by linear superposition of the
response tables stored in the mgrid file, weighted by the user-provided circuit currents. Related Publications
In the following, a complete (to the author’s knowledge) list of publications and, where applicable, corresponding internal reports of ORNL (with sometimes additional details in comparison
with the published journal articles) related to the numerical details implemented in VMEC is
provided:
1.Where the paper says it
Where the paper says it
State variables R, Z, and lambda are represented by two-dimensional Fourier series in theta and zeta. p. 6 The
computation is converged when the force residuals for R, Z and λ have decayed below a userprovided threshold. VMEC is designed to allow computation of the ideal MHD equilibrium for both symmetric
and asymmetric two- and three-dimensional configurations, which is configured by selection of
which subset of Fourier harmonics to include in the computation. 7 Jacobian . 8 Metric Elements .Where the paper says it
Where the paper says it
Magnetic field components are defined using contravariant and covariant components based on metric elements. p. 3 9 Constraint of Toroidal Current Profile . 10 Covariant Magnetic Field Components . 9 Constraint of Toroidal Current Profile . 10 Covariant Magnetic Field Components .Where the paper says it
Where the paper says it
The radial discretization involves representing physical quantities at full-grid radial knots or half-way in toroidal flux space, with parity separation for even and odd poloidal harmonics to reduce computational load. p. 6 Starting out from an initial guess for the flux surface geometry, the residual MHD force
components are computed in real space, i. , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method.Where the paper says it
Where the paper says it
The constraint of the toroidal current profile is related to the divergence of B theta, expressed in terms of covariant magnetic field components, leading to an expression involving the metric elements. p. 3 9 Constraint of Toroidal Current Profile . 10 Covariant Magnetic Field Components . , there are seven circuits: all 10 copies of each of the five non-planar coil
type wired in series, respectively, and similar circuits of each 10 copies of the two planar coil
types. The VMEC input file then only needs to contain the respective circuit currents and the
total magnetic field produced by all main coils is then computed by linear superposition of the
response tables stored in the mgrid file, weighted by the user-provided circuit currents. , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method.Where the paper says it
Where the paper says it
Where the paper says it
The final Jacobian on the half-grid is assembled using these interpolated quantities. p. 6 , on a grid in radial, poloidal and toroidal magnetic
flux coordinates, and transformed back into Fourier space. The Fourier coefficients of the forces
are then used to move the flux surface geometry (represented by cylindrical coordinates R
and Z) and stream function λ towards force balance using an accelerated descent method. “Improved Radial Differencing for Three-Dimensional Magnetohydrodynamic Equilibrium
Calculations” [22]. This article introduces regularization factors for the odd-m Fourier
coefficients in order to increase the numerical accuracy of radial derivatives approximated
by finite differences. “Improved Radial Differencing for Three-Dimensional Magnetohydrodynamic Equilibrium
Calculations” [22]. This article introduces regularization factors for the odd-m Fourier
coefficients in order to increase the numerical accuracy of radial derivatives approximated
by finite differences.Where the paper says it
Where the paper says it
Where the paper says it
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Improved constraint handling through spectral condensation allows for more economical use of available Fourier coefficients by fitting real-space points well while simultaneously condensing them into a spectrally condensed Fourier representation.
-
The system can perform direct equal-arclength parameterization of flux surfaces, which is useful for obtaining a unique poloidal angle-like coordinate, especially in asymmetric cases where the method reduces the set of Fourier coefficients by one element by assuming x s 1 equals y c 1.
-
The AI system can compute analytical first and second-order derivatives for both the objective function and the constraint, which are then used by non-linear optimization algorithms to find optimal Fourier coefficients.
-
The optimization routine can be fed with the value of M minus one, as M cannot get lower than 1, incorporating this information to guide its path in parameter space more effectively.
-
The system can utilize a specific method for computing tangential derivatives that involves a complex expression derived from the decomposition of the second-order mixed derivative into terms involving even-m and odd-m Fourier harmonics.
-
The system can compute the Jacobian matrix of the curve fitting problem, which is approximately diagonal, allowing for efficient calculation of its maximum eigenvalue to understand how changes in free parameters affect the force balance.
-
The AI system can compute geometric quantities like R and Z on the full poloidal domain by combining even-parity and odd-parity components using symrzl to yield the general R and Z on the full poloidal domain for asymmetric three-dimensional configurations.
-
The AI system can compute the metric elements g alpha beta at half-grid points by employing a decomposition of metric elements into even-m and odd-m contributions, which is more robust than direct evaluation of the intermediate result.
Abstract
VMEC++ is a Python-friendly, from-scratch reimplementation in C++ of the Variational Moments Equilibrium Code (VMEC), a fixed- and free-boundary ideal-MHD equilibrium solver for stellarators and tokamaks. The first VMEC implementation was written by Steven P. Hirshman and colleagues in the 1980s and 1990s and its latest Fortran incarnation (PARVMEC, https://github.com/ORNL-Fusion/PARVMEC) is widely used in stellarator optimization systems. Our work improves on previous implementations with regard to various critical aspects: special care has been put in providing an idiomatic Python experience, from installation to actual usage; VMEC++ has a zero-crash policy; it supports inputs in the classic INDATA format as well as friendlier JSON files. VMEC++ execution times are typically less than or equal to previous implementations, and time to convergence can be decreased dramatically by leveraging its hot-restart feature: by providing the output of a VMEC++ run as initial state for a subsequent one, VMEC++ is initialized using the previously converged equilibrium. This can dramatically decrease runtimes when running on many similar magnetic configurations as it typically happens in stellarator optimization pipelines. On the flip side, some features of the original Fortran VMEC implementation are not yet available in VMEC++, such as support for non-stellarator-symmetric configurations. This contribution presents the internal numerics of the open-source VMEC++ package publicly for the first time.
Sources
Related papers
- Implementation and verification of a new free boundary module for Resistive Wall Modes simulations with the nonlinear 3D full MHD code SpeCyl
- System Size Dependence of Collisionless Reconnection Rate
- SPECTRE: A robust solver for 3D equilibria with arbitrary topology
- High-quality electron beam generation from laser wakefield accelerators for driving compact free electron lasers
- Deflation Techniques for Stellarator Equilibrium and Optimization
- Rapid Vacuum Response Calculations for Non-axisymmetric Plasma Geometries