betaFeedback

WorksPhysics and Astronomy

Physics-regularized neural network of the ideal-MHD solution operator in Wendelstein 7-X configurations

Abstract

The computational cost of constructing 3D magnetohydrodynamic (MHD) equilibria is one of the limiting factors in stellarator research and design. Although data-driven approaches have been proposed to provide fast 3D MHD equilibria, the accuracy with which equilibrium properties are reconstructed is unknown. In this work, we describe an artificial neural network (NN) that quickly approximates the ideal-MHD solution operator in Wendelstein 7-X (W7-X) configurations. This model fulfils equilibrium symmetries by construction. The MHD force residual regularizes the solution of the NN to satisfy the ideal-MHD equations. The model predicts the equilibrium solution with high accuracy, and it faithfully reconstructs global equilibrium quantities and proxy functions used in stellarator optimization. We also optimize W7-X magnetic configurations, where desiderable configurations can be found in terms of fast particle confinement. This work demonstrates with which accuracy NN models can approximate the 3D ideal-MHD solution operator and reconstruct equilibrium properties of interest, and it suggests how they might be used to optimize stellarator magnetic configurations.

Introduction

The computational cost of constructing 3D magnetohydrodynamic (MHD) equilibria is one major limiting factor in stellarator theory, experimentation and design. Depending on the desired resolution and accuracy of the solution, such computations require up to O(10)O(10) CPUh [1, 2].

Fast and accurate equilibrium reconstructions are crucial to interpret experimental results in magnetically confined devices. At Wendelstein 7-X (W7-X), the Bayesian framework MINERVA [94] [3] reconstructs the plasma state (e. g., ion and electron temperature). For each forward evaluation of the simulation model, a free-boundary ideal-MHD equilibrium has to be constructed. For each reconstructed state (i. e., a single timestamp), between O(103)O(10^{3}) and O(106)O(10^{6}) forward evaluations are required [4, 5]. Due to the computational cost of constructing free-boundary ideal-MHD equilibria, a self-consistent Bayesian inversion of a single plasma state has been attempted only once [4] and is not part of the standard data evaluation procedure.

W7-X is currently the largest stellarator experiment in operation. Its scientific mission is to assess the stellarator line on the path towards a fusion reactor [6]. The configuration space of W7-X provides a large experimental test bed, however, only nine reference configurations are mainly investigated [7]. Experimental time is limited, and priorities must be established to fit financial and human resources. Flight simulators provide a parallel and cheaper path to explore and exploit current and future experiments [8, 9]. In a stellarator, 3D MHD equilibria bound the accuracy and cost of simulation.

Differentiable and less expensive MHD equilibrium solutions would allow a more extensive exploration of the stellarator optimization space, in which the number of degrees of freedom is usually large ∼O(102)\sim\mathcal{O}(10^{2}) [10, 11]. The computational cost of the objective function, which is largely dominated by deriving ideal-MHD equilibria, limits the extent to which we can explore the optimization space. According to recent works, each optimization run requires up to O(103)\mathcal{O}(10^{3}) function evaluations [10, 12, 13].

Data-driven approaches (e.g., artificial neural networks (NNs)) can provide fast 3D ideal-MHD equilibria [14–19]. When benchmarked against equilibria from non-linear codes (e.g., the variational moments equilibrium code (VMEC)), the geometry of the flux surfaces is in excellent agreement. However, it is unclear how equilibrium properties (e.g., plasma stability) can be faithfully reproduced by the NN model. Furthermore, it is unclear how well the NN equilibria satisfy the MHD equations. To make use of such NN models in downstream tasks (e.g., Bayesian inference, optimization), it is necessary to investigate how well NNs capture equilibrium properties.

The ideal-MHD equilibrium problem is a system of Partial Differential Equations (PDEs). In general, initial and boundary conditions, as well as input parameters define the PDE problem. The solution operator maps these variable terms to the corresponding PDE solution.

In this paper, we extend [19] by learning the solution operator of the ideal-MHD equilibrium problem in the subspace of W7-X magnetic configurations with a deep operator network (DeepONet) [20]. A DeepONet is a NN macro-architecture with two pathways: a branch network to encode the PDE problem inputs, and a trunk network to represent the domain of solution function. Here, the NN model maps an externally applied field (defined by the currents in the coil system) and a plasma state (defined by the pressure and toroidal current profiles) to an approximation of the ideal-MHD equilibrium solution. Within the boundary of the training data (i.e., W7-X magnetic configurations), the NN model approximates the solution of unseen equilibrium problems at a fraction of the computational cost currently required by a traditional code. Summarizing the paper’s contributions, we:

  • propose a DeepONet like architecture to represent the solution operator of the ideal-MHD equilibrium problem (see Section 3);

  • train the model to approximate the solution of ideal-MHD equilibrium problem obtained from a non-linear code (e.g., VMEC), while the ideal-MHD force residual regularizes the model’s solution (see § 4);

  • investigate how well the model’s solution satisfies the ideal-MHD equations, and propose a strategy to improve the solution at inference time by approximating an equivalent fixed-boundary equilibrium solution (see § 5.3);

  • investigate to which degree equilibrium properties of interest are faithfully reproduced, in the context of ideal-MHD stability (e.g., magnetic well), neoclassical transport (e.g., the effective ripple), and fast particle confinement (e.g., extrema of the magnetic field strength along a field line) (see § 5.4 to § 5.6);

  • show the use of the model in the a posteriori optimization of W7-X magnetic configurations (see § 5.7);

Ideal-MHD equilibria

The ideal-MHD force balance

The equilibrium magnetic field under the ideal-MHD model is characterized by the force balance equation, Ampere’s and Gauss’s law:

F⃗=−J⃗×B⃗+∇⃗p=0,(1)\vec{F} = -\vec{J} \times\vec{B} + \vec{\nabla}p = 0, \tag*{(1)}
∇⃗×B⃗=μ0J⃗,(2)\vec{\nabla} \times\vec{B} = \mu_0 \vec{J}, \tag*{(2)}
∇⃗⋅B⃗=0,(3)\vec{\nabla} \cdot\vec{B} = 0, \tag*{(3)}

where B⃗\vec{B} is the magnetic field, J⃗\vec{J} is the current density, pp is the plasma pressure, and μ0\mu_0 is the permeability of free space.

In this work, we assume that a set of nested toroidal flux surfaces exists, and that the pressure is a flux function. Let x⃗∗=(R,ϕ,Z)\vec{x}^{*} = (R, \phi, Z) be a cylindrical coordinate system where RR is the major radius, ϕ\phi is the cylindrical toroidal angle, and ZZ is the height above mid-plane. α⃗=(s,θ,φ)\vec{\alpha} = (s, \theta, \varphi) is a flux coordinate system where s=ψψedges = \frac{\psi}{\psi_{\mathrm{edge}}} is a radial-like coordinate, θ\theta is a poloidal-like angle, and φ\varphi is a toroidal-like angle (in this work, φ=ϕ\varphi= \phi). 2πψ2\pi\psi is the toroidal flux enclosed by a flux surface, and Φedge=2πψedge\Phi_{\mathrm{edge}} = 2\pi\psi_{\mathrm{edge}} is the toroidal flux enclosed by the plasma boundary (i. e., s=1s = 1). In the inverse equilibrium formulation [21], α⃗\vec{\alpha} describes the independent variables of the computational grid, and the flux surfaces locations are described by the coordinate transformation f:α⃗→x⃗∗f : \vec{\alpha} \to\vec{x}^{*}.

Because magnetic fields are divergence free (∇⃗⋅B⃗=0)(\vec{\nabla} \cdot\vec{B} = 0) and flux surfaces are assumed to be nested (B⃗⋅∇⃗s=Bs=0)(\vec{B} \cdot\vec{\nabla}s = B^{s} = 0), the magnetic field can be written in contravariant form following [22]:

B⃗=∇⃗φ×∇⃗χ+∇⃗ψ×∇⃗θ∗=Bθe⃗θ+Bφe⃗φ,(4)\vec{B} = \vec{\nabla}\varphi\times\vec{\nabla}\chi+ \vec{\nabla}\psi\times\vec{\nabla}\theta^{*} = B^{\theta}\vec{e}_{\theta} + B^{\varphi}\vec{e}_{\varphi}, \tag*{(4)}

where 2πχ2\pi\chi is the poloidal flux, θ∗=θ+λ(s,θ,φ)\theta^{*} = \theta+ \lambda(s,\theta,\varphi) is the poloidal angle for which the magnetic field lines are straight in (s,θ∗,φ)(s,\theta^{*},\varphi), and λ\lambda is a periodic function of θ\theta and φ\varphi with zero average. e⃗i=∂x⃗∗∂αi\vec{e}_{i} = \frac{\partial\vec{x}^{*}}{\partial\alpha_{i}} are the covariant basis vectors, and e⃗i=∇⃗αi\vec{e}^{i} = \vec{\nabla}\alpha_{i} are the contravariant basis vectors.

The contravariant components of the magnetic field (Bi=B⃗⋅e⃗i)(B^{i} = \vec{B} \cdot\vec{e}^{i}) are then:

Bθ=1gΦ′(ι−∂λ∂φ),(5)B^{\theta} = \frac{1}{\sqrt{g}}\Phi^{\prime}\left(\iota- \frac{\partial\lambda}{\partial\varphi}\right), \tag*{(5)}
Bφ=1gΦ′(1+∂λ∂θ),(6)B^{\varphi} = \frac{1}{\sqrt{g}}\Phi^{\prime}\left(1 + \frac{\partial\lambda}{\partial\theta}\right), \tag*{(6)}

where ι\iota is the rotational transform, the prime denotes ∂/∂s\partial/\partial s, and g=(e⃗s⋅e⃗θ×e⃗φ)=(∇⃗s⋅∇⃗θ×∇⃗φ)−1\sqrt{g} = (\vec{e}_{s} \cdot\vec{e}_{\theta} \times\vec{e}_{\varphi}) = (\vec{\nabla}s \cdot\vec{\nabla}\theta\times\vec{\nabla}\varphi)^{-1} is the Jacobian of the coordinate transformation ff.

The covariant representation of B⃗\vec{B} (Bi=B⃗⋅e⃗i)(B_{i} = \vec{B} \cdot\vec{e}_{i}) can be obtained from equations (5) and (6) and the metric tensor gij=e⃗i⋅e⃗j=∂x⃗∗∂αi⋅∂x⃗∗∂αjg_{ij} = \vec{e}_{i} \cdot\vec{e}_{j} = \frac{\partial\vec{x}^{*}}{\partial\alpha_{i}} \cdot\frac{\partial\vec{x}^{*}}{\partial\alpha_{j}} as follows:

Bs=Bθgθs+Bφgφs,(7)B_{s} = B^{\theta}g_{\theta s} + B^{\varphi}g_{\varphi s}, \tag*{(7)}
Bθ=Bθgθθ+Bφgφθ,(8)B_{\theta} = B^{\theta}g_{\theta\theta} + B^{\varphi}g_{\varphi\theta}, \tag*{(8)}
Bφ=Bθgθφ+Bφgφφ.(9)B_{\varphi} = B^{\theta}g_{\theta\varphi} + B^{\varphi}g_{\varphi\varphi}. \tag*{(9)}

The contravariant components of the current density (Ji=J⃗⋅e⃗i=1μ0(∇⃗×B⃗)⋅e⃗i)(J^{i} = \vec{J} \cdot\vec{e}^{i} = \frac{1}{\mu_{0}}(\vec{\nabla} \times\vec{B}) \cdot\vec{e}^{i}) are:

Js=1μ0g(∂Bφ∂θ−∂Bθ∂φ),(10)J^{s} = \frac{1}{\mu_{0}\sqrt{g}}\left(\frac{\partial B_{\varphi}}{\partial\theta} - \frac{\partial B_{\theta}}{\partial\varphi}\right), \tag*{(10)}
Jθ=1μ0g(∂Bs∂φ−∂Bφ∂s),(11)J^{\theta} = \frac{1}{\mu_{0}\sqrt{g}}\left(\frac{\partial B_{s}}{\partial\varphi} - \frac{\partial B_{\varphi}}{\partial s}\right), \tag*{(11)}
Jφ=1μ0g(∂Bθ∂s−∂Bs∂θ).(12)J^{\varphi} = \frac{1}{\mu_{0}\sqrt{g}}\left(\frac{\partial B_{\theta}}{\partial s} - \frac{\partial B_{s}}{\partial\theta}\right). \tag*{(12)}

Finally, inserting equations (5), (6) and (10) to (12) in equation (1), the covariant form of the MHD force residual is given by:

F⃗=Fs∇⃗s+Fββ⃗,(13)\vec{F} = F_{s}\vec{\nabla}s + F_{\beta}\vec{\beta}, \tag*{(13)}
Fs=1μ0(Bθ∂Bθ∂s−Bθ∂Bs∂θ−Bφ∂Bs∂φ+Bφ∂Bφ∂s)+p′,(14)F_{s} = \frac{1}{\mu_{0}}\left(B^{\theta}\frac{\partial B_{\theta}}{\partial s} - B^{\theta}\frac{\partial B_{s}}{\partial\theta} - B^{\varphi}\frac{\partial B_{s}}{\partial\varphi} + B^{\varphi}\frac{\partial B_{\varphi}}{\partial s}\right) + p', \tag*{(14)}
Fβ=Js=1μ0g(∂Bφ∂θ−∂Bθ∂φ),(15)F_{\beta} = J^{s} = \frac{1}{\mu_{0}\sqrt{g}}\left(\frac{\partial B_{\varphi}}{\partial\theta} - \frac{\partial B_{\theta}}{\partial\varphi}\right), \tag*{(15)}

where β⃗=g(Bφ∇⃗θ−Bθ∇⃗φ)\vec{\beta} = \sqrt{g}(B^{\varphi}\vec{\nabla}\theta- B^{\theta}\vec{\nabla}\varphi).

If we define x⃗=(R,λ,Z)\vec{x} = (R,\lambda,Z), the MHD force residual can be then computed from the mapping x⃗(s,θ,φ)\vec{x}(s,\theta,\varphi), and the p(s)p(s) and ι(s)\iota(s) flux functions (see § 9.3).

Fixed- and free-boundary equilibria

The ideal-MHD problem admits two kinds of boundary conditions: fixed- and free-boundary conditions. In the fixed-boundary case, the shape (RR and ZZ) of the outermost flux surface (i. e., s=1s = 1) is fixed. In the free-boundary case, the shape of the outermost flux surface is determined by the continuity of the total pressure B2/2μ0+pB^2/2\mu_0 + p and by the vanishing of the normal component of the vacuum field at the plasma-vacuum interface (thus enforcing the s=1s = 1 surface to be a flux surface).

Multiple quantities parametrize the equilibrium problem: Φedge∈R\Phi_{\mathrm{edge}} \in\mathbb{R} defines the total toroidal flux enclosed by the plasma, p:[0,1]→Rp : [0, 1] \to\mathbb{R} defines the pressure profile, and ι:[0,1]→R\iota: [0, 1] \to\mathbb{R} defines the rotational transform profile. The toroidal current profile Itor:[0,1]→RI_{\mathrm{tor}} : [0, 1] \to\mathbb{R} can be also specified in place of the iota profile: since Itor(s)=∫0s∫02πJφg ds′ dθI_{\mathrm{tor}}(s) = \int_0^s \int_0^{2\pi} J^\varphi\sqrt{g}\,\mathrm{d}s'\,\mathrm{d}\theta, and JφJ^\varphi linearly depends on ι\iota, the rotational transform profile consistent with a given toroidal current profile can be computed by solving a linear algebraic equation.

In case of free-boundary equilibria, a vacuum field, which is usually generated by a set of external coils, can be provided. A reference field generated by each coil is commonly precomputed on the cylindrical grid, and the total vacuum field is given as the superposition of each coil field B⃗v=∑i=1NciiB⃗i0\vec{B}_v = \sum_{i=1}^{N_c} i_i \vec{B}^{0}_i, where B⃗i0\vec{B}^{0}_i is the reference field generated by each coil given a reference current Ii0I_i^0, NcN_c is the number of independent coils, and ii=Ii/Ii0i_i = I_i/I_i^0 is the current ratio between the actual and reference coil current. The set of current ratios i⃗∈RNc\vec{i} \in\mathbb{R}^{N_c} additionally parametrizes the equilibrium problem.

In this work, since in equilibrium reconstruction routines the plasma boundary is not known a priori, we are only interested in free-boundary equilibria. In addition, no diagnostics to probe the iota profile are installed at W7-X, whereas continuous Rogowski coils measure the net toroidal current. Therefore, the toroidal current profile is specified instead of the iota profile.

The ideal-MHD solution operator

In this work, a set of scalar parameters (i⃗\vec{i} and Φedge\Phi_{\mathrm{edge}}) and plasma profiles (pp and ItorI_{\mathrm{tor}}), represented by one-dimensional functions of the radial coordinate ss, define a instance of the ideal-MHD equilibrium problem. The equilibrium solution is represented by the mapping (s,θ,φ)↦x⃗(s,θ,φ)(s,\theta,\varphi) \mapsto\vec{x}(s,\theta,\varphi) (where x⃗=(R,λ,Z)\vec{x} = (R,\lambda,Z)) and by the one-dimensional function s↦ι(s)s \mapsto\iota(s).

Let us define the solution operator as the operator that maps the set of scalar parameters and plasma profiles to the MHD solution:

O(i⃗,Φedge,p(s),Itor(s))(s,θ,φ)=[x⃗(s,θ,φ),ι(s)]T,(16)\mathcal{O}(\vec{i},\Phi_{\mathrm{edge}},p(s),I_{\mathrm{tor}}(s))(s,\theta,\varphi) = [\vec{x}(s,\theta,\varphi),\iota(s)]^{T}, \tag*{(16)}

where i⃗∈RNc\vec{i} \in\mathbb{R}^{N_c}, Φedge∈R\Phi_{\mathrm{edge}} \in\mathbb{R}, {p,Itor,ι}:[0,1]→R\{p,I_{\mathrm{tor}},\iota\} : [0,1] \to\mathbb{R} are one-dimensional functions defined on the radial plasma domain, and x⃗:[0,1]×[0,2π]×[0,2π]→R3\vec{x} : [0,1] \times[0,2\pi] \times[0,2\pi] \to\mathbb{R}^{3} is the mapping between flux coordinates and (R,λ,Z)(R,\lambda,Z).

NN to approximate non-linear operators

NNs can approximate non-linear continuous functions [23–27], discontinuous functions [28, 29], and non-linear continuous operators [30–32]. In this work, we propose a NN model to learn the non-linear ideal-MHD operator. A set of free parameters Θ∈RN\Theta\in\mathbb{R}^{N} (i. e., trainable weights) parametrizes the NN model:

NN(i⃗,Φedge,p(s),Itor(s);Θ)(s,θ,φ)=[x⃗(s,θ,φ),ι~(s)]T,(17)\mathrm{NN}(\vec{i},\Phi_{\mathrm{edge}},p(s),I_{\mathrm{tor}}(s);\Theta)(s,\theta,\varphi) = [\vec{x}(s,\theta,\varphi),\tilde{\iota}(s)]^{T}, \tag*{(17)}

where x⃗(s,θ,φ)\vec{x}(s,\theta,\varphi) and ι~(s)\tilde{\iota}(s) compose the equilibrium solution provided by the NN model.

Three sources of error characterize the accuracy of a NN: approximation, optimization and generalization errors [33]. The approximation error describes how well a NN represents the target function or operator, the optimization error describes how well the NN training procedure minimizes the training loss (i. e., empirical risk), and the generalization error describes how well the NN generalizes to unseen data.

The approximation theorem in [30] shows how any NN with a specific structure and enough capacity (i. e., number of free parameters) guarantees a small approximation error. However, no guarantees are given on the optimization and generalization errors. Also, from a practical standpoint, estimating the required number of free parameters to meet "enough capacity" is difficult. Fulfilling known symmetries of the solution by construction should ease the training process (i. e., it should reduce the optimization error), and the addition of a physics constraint loss should improve generalization (i.e., it should reduce the generalization error). The next section will introduce them separately.

Imposing symmetries in the NN model

In a learning algorithm, the available computational budget is divided into three baskets: the capacity (i.e., size) of the model sets the approximation error, the length of the training affects the optimization error, and the size of the data set impacts the generalization error.

The space of possible functions that the model can represent is large. The training process is essentially a “search” in this space. An inductive bias “allows a learning algorithm to prioritize one solution over another, independent of the observed data” [34]. An inductive bias encodes the solution’s prior knowledge (e.g., a solution’s symmetry); it allows budget to be relocated from the capacity basket to the other two baskets, thus, reducing the optimization and generalization errors.

The equilibrium solution should satisfy multiple symmetries. Let us define (X1,X2,X3)=(R,λ,Z)(X^1, X^2, X^3) = (R, \lambda, Z). Each quantity XjX^j (with j∈{1,2,3}j \in\{1,2,3\}) should be a periodic function of the poloidal and toroidal angles:

Xj(s,θ,φ)=Xj(s,θ+2π,φ),(18)X^j(s,\theta,\varphi) = X^j(s,\theta+2\pi,\varphi), \tag*{(18)}
Xj(s,θ,φ)=Xj(s,θ,φ+2π/Nfp),(19)X^j(s,\theta,\varphi) = X^j(s,\theta,\varphi+2\pi/N_{\mathrm{fp}}), \tag*{(19)}

where NfpN_{\mathrm{fp}} is the number of toroidal field period.

Moreover, if stellarator symmetry is assumed (which is the case for most experimental devices, including W7-X), the solution should satisfy the following relationships [35]:

R(s,θ,φ)=R(s,−θ,−φ),(20)R(s,\theta,\varphi) = R(s,-\theta,-\varphi), \tag*{(20)}
λ(s,θ,φ)=−λ(s,−θ,−φ),(21)\lambda(s,\theta,\varphi) = -\lambda(s,-\theta,-\varphi), \tag*{(21)}
Z(s,θ,φ)=−Z(s,−θ,−φ).(22)Z(s,\theta,\varphi) = -Z(s,-\theta,-\varphi). \tag*{(22)}

For example, the periodicity of XjX^j and stellarator symmetry can be imposed if the solution is expanded in Fourier series along the poloidal and toroidal directions:

R(s,θ,φ)=∑mnRmn(s)cos⁡(mθ−Nfpnφ),(23)R(s,\theta,\varphi) = \sum_{mn} R_{mn}(s)\cos(m\theta-N_{\mathrm{fp}}n\varphi), \tag*{(23)}
λ(s,θ,φ)=∑mnλmn(s)sin⁡(mθ−Nfpnφ),(24)\lambda(s,\theta,\varphi) = \sum_{mn} \lambda_{mn}(s)\sin(m\theta-N_{\mathrm{fp}}n\varphi), \tag*{(24)}
Z(s,θ,φ)=∑mnZmn(s)sin⁡(mθ−Nfpnφ),(25)Z(s,\theta,\varphi) = \sum_{mn} Z_{mn}(s)\sin(m\theta-N_{\mathrm{fp}}n\varphi), \tag*{(25)}

where XmnjX^j_{mn} are the associated Fourier coefficients, mm is the poloidal mode number, and nn is the toroidal mode number. Since λ\lambda is a periodic function with zero average, λ00=0\lambda_{00}=0.

At the magnetic axis (s=0s=0), the flux surface geometry must be regular (i.e., infinitely differentiable). If it is expanded in Fourier series, the Fourier coefficients XmnjX^j_{mn} must have the form [36]:

Xmnj=sm∑k∈N∪{0}Xkmnjsk.(26)X^j_{mn} = \sqrt{s^m}\sum_{k\in\mathbb{N}\cup\{0\}} X^j_{kmn}s^k. \tag*{(26)}

Section 3.2 introduces how the NN model inherently satisfies this property.

DeepONet-like architecture

Figure 1 shows the NN macro architecture. The plasma profiles are observed at a set of equally spaced radial locations, sis_i for i∈{1,…,Ns}i \in\{1,\ldots,N_s\}, also called sensors. In addition to the independent variables (s,θ,φ)(s,\theta,\varphi), the model has two sets of inputs: the set of scalar equilibrium parameters ([i1,…,iNc]T([i_1,\ldots,i_{N_c}]^T and Φedge\Phi_{\mathrm{edge}}) and the plasma profiles ([p(s0),…,p(sNs)]T([p(s_0),\ldots,p(s_{N_s})]^T and [Itor(s0),…,Itor(sNs)]T[I_{\mathrm{tor}}(s_0),\ldots,I_{\mathrm{tor}}(s_{N_s})]^T). Those inputs are concatenated into u⃗=[i1,…,iNc,Φedge,p(s1),…,p(sNs),Itor(s1),…,Itor(sNs)]T\vec{u}=[i_1,\ldots,i_{N_c},\Phi_{\mathrm{edge}},p(s_1),\ldots,p(s_{N_s}),I_{\mathrm{tor}}(s_1),\ldots,I_{\mathrm{tor}}(s_{N_s})]^T. The model represents the MHD equilibrium solution as:

Figure 1. The macro architecture of the NN model to approximate the ideal-MHD solution operator. In case of free-boundary equilibria, a set of parameters (the normalized coil currents [i1,…,iNc]T[i_1,\ldots,i_{N_c}]^T and the toroidal flux enclosed by the plasma Φedge\Phi_{\mathrm{edge}}) and two functions (the pressure p(s)p(s) and toroidal current Itor(s)I_{\mathrm{tor}}(s) plasma profiles) define the ideal-MHD equilibrium problem. The variable uu combines the set of parameters and the plasma profiles values at selected flux surfaces, [s1,…,sNs]T[s_1,\ldots,s_{N_{s}}]^T. The solution is represented by the set of flux surface coordinates (R,Z)(R,Z), the renormalization parameter λ\lambda, and the iota profile ι\iota. The solution domain spans the radial ss, poloidal θ\theta, and toroidal φ\varphi directions. The quantities Xj∈{R,λ,Z}X^j \in\{R,\lambda,Z\} are expanded in Fourier series along the poloidal and toroidal directions. A trunk network constructs a set of non-linear “basis” functions of ss, which radially expand the XjX^j Fourier coefficients and iota. A branch network parametrizes the set of trunk basis coefficients as a function of uu.

Xj(u⃗)(s,θ,φ)=∑mnXmnj(u⃗)(s)Fmn(θ,φ),(27)X^j(\vec{u})(s,\theta,\varphi)=\sum_{mn}X^j_{mn}(\vec{u})(s)\mathcal{F}_{mn}(\theta,\varphi), \tag*{(27)}
Xmnj(u⃗)(s)=sm∑l=1LXlmnj(u⃗)Tlmnj(s),(28)X^j_{mn}(\vec{u})(s)=\sqrt{s^m}\sum_{l=1}^{L}X^j_{lmn}(\vec{u})\mathcal{T}^j_{lmn}(s), \tag*{(28)}
ι(u⃗)(s)=∑l=1Lιl(u⃗)Tl(s),(29)\iota(\vec{u})(s)=\sum_{l=1}^{L}\iota_l(\vec{u})\mathcal{T}_l(s), \tag*{(29)}

where Xj∈{R,λ,Z}X^j\in\{R,\lambda,Z\}, Fmn(θ,φ)=cos⁡(mθ−Nfpnφ)\mathcal{F}_{mn}(\theta,\varphi)=\cos(m\theta-N_{\mathrm{fp}}n\varphi) in case of RR and Fmn(θ,φ)=sin⁡(mθ−Nfpnφ)\mathcal{F}_{mn}(\theta,\varphi)=\sin(m\theta-N_{\mathrm{fp}}n\varphi) in case of λ\lambda or ZZ. The Fourier terms Fmn(θ,φ)\mathcal{F}_{mn}(\theta,\varphi) expand each XjX^j, where XmnjX^j_{mn} represent the Fourier coefficients.

Up to m=8m=8 poloidal and ∣n∣=11\lvert n\rvert=11 toroidal modes represent each XjX^j. For W7-X, previous works showed that up to 6 modes are sufficient to represent the geometry of the flux surfaces [17–19]. However, using VMEC equilibria with up to m=11m=11 and ∣n∣=12\lvert n\rvert=12 as a “high-fidelity” reference, a Fourier resolution scan revealed that up to m=8m=8 and ∣n∣=11\lvert n\rvert=11 modes are required to represent the equilibrium field with a field error below 1% (see § 9.1).

For each Fourier coefficients and for iota, a “trunk” network parametrizes a set of non-linear functions of ss, [T1mnj(s),…,TLmnj(s)]T∈RL[\mathcal{T}^j_{1mn}(s),\ldots,\mathcal{T}^j_{Lmn}(s)]^{T}\in\mathbb{R}^{L} and [T1(s),…,TL(s)]T∈RL[\mathcal{T}_1(s),\ldots,\mathcal{T}_L(s)]^{T}\in\mathbb{R}^{L}, respectively. A “branch” network outputs a set of scalar coefficients as a function of uu, [X1mnj,…,XLmnj]T∈RL[X^j_{1mn},\ldots,X^j_{Lmn}]^{T}\in\mathbb{R}^{L} and [ι1,…,ιL]T∈RL[\iota_1,\ldots,\iota_L]^{T}\in\mathbb{R}^{L}. Finally, the iota and the Fourier coefficients are obtained as a linear combination of trunk network functions, which are weighted by the branch network coefficients.

Iota highly depends on the toroidal current [37]. To let the model exploit this dependency, the toroidal current profile substitutes the last trunk network function in the expansion of the iota profile: TL(s)=Itor(s)\mathcal{T}_L(s)=I_{\mathrm{tor}}(s).

The trunk network expands the radial coordinate ss into a set of “basis” functions, independent for each Fourier coefficient XmnjX^j_{mn} and iota ι\iota. We inappropriately refer to them as a set of basis functions on the interval [0,1][0,1] since these functions are not guaranteed to form a basis (a set of orthogonal functions). To obey the required form needed to represent XjX^j (see § 3.1), each function Tlmnj\mathcal{T}^j_{lmn} is multiplied by a sm\sqrt{s^m} factor, and the two first trunk network functions are the constant and identity functions, respectively: T1mnj(s)=T1(s)=1\mathcal{T}^j_{1mn}(s)=\mathcal{T}_1(s)=1 and T2mnj(s)=T2(s)=s\mathcal{T}^j_{2mn}(s)=\mathcal{T}_2(s)=s. Imposing the identity function as one of the trunk network functions effectively bypasses the trunk network layers, and it preserves the model ability to build simple functions (e.g., the identity function). This construction is known as a “skip connection” in machine learning [38]. A multilayer perceptron (MLP) parametrizes the trunk network. Please refer to § 9.2 for a detailed description of the trunk network architecture.

The branch network maps the scalar parameters and the plasma profiles of the equilibrium problem to the set of coefficients associated to the trunk functions. The one-dimensional plasma profiles are observed at a set of sensors [s1,…,sNs]T[s_1,\ldots,s_{N_s}]^{T}. A set of one-dimensional convolutional layers extract high-level features from the plasma profiles into a compressed latent representation, which is then concatenated to the set of scalar parameters. Finally, a MLP outputs the coefficients associated to the trunk functions. Please refer to § 9.2 for a detailed description of the branch network architecture.

The model can represent a global ideal-MHD solution (i.e., a solution that is defined everywhere in the plasma volume) and fulfils the required symmetries and regularity condition at the magnetic axis by construction. Because of the Fourier expansion along the poloidal and toroidal directions, the periodic boundary conditions and stellarator symmetry are satisfied. The required radial form of each Fourier coefficients is satisfied due to the sm\sqrt{s^m} factor and the trunk network skip connection.

Training

The model is trained in a supervised-learning fashion: VMEC provides the ground-truth ideal-MHD equilibria. To restrict the space in which to approximate the ideal-MHD solution operator, only W7-X configurations are considered.

Data set

The boundaries of the training data limit the application of any data-driven method. In this work, the training data are sampled from a multivariate distribution that approximates the experimental distribution (table 1). The coil current ratios define the vacuum magnetic configuration, the plasma volume determines the total toroidal flux at the edge. One-dimensional Gaussian processes (GPs) on the [0,1][0,1] interval represent the normalized pressure and toroidal current profiles. The volume averaged plasma beta informs the scale of the pressure profile, and the total integrated toroidal current defines the scale of the current profile. See [19, Section 2.2] for a more in depth description of the methodology.

Vacuum configuration The current ratios between the W7-X coils define the vacuum magnetic configuration. Two symmetric sets of coils compose each half toroidal field period: five non-planar coils, two planar (tilted) coils, and one control coil constitute each set. Defining I1I_1 as the current flowing in the first non-planar coil, ii=IiI1i_i = \frac{I_i}{I_1} for i∈{1,…,Nc}i \in\{1,\ldots,N_c\} are the coil current ratios. In the data set, the current of the first non-planar coil is held fixed at I1=13 068 AI_1 = 13\,068\ \mathrm{A} (current value to obtain Baxis(φ=0)≃2.52 TB_{\mathrm{axis}}(\varphi= 0) \simeq2.52\ \mathrm{T} in case of the standard configuration), and the current in the control coil is null. The coil current ratios are uniformly sampled to cover a broad configuration space around the nine reference W7-X configurations [7].

Plasma volume For a given magnetic field strength, Φedge\Phi_{\mathrm{edge}} sets the plasma volume:

Φedge=∫01∫02πB⋅∇φg ds dθ≃Baπ2≃BVpR,\Phi_{\mathrm{edge}} = \int_{0}^{1}\int_{0}^{2\pi} \mathbf{B}\cdot\nabla\varphi\sqrt{g}\,ds\,d\theta\simeq B a \pi^2 \simeq\frac{B V_p}{R},

where aa is the effective minor radius, RR the major radius, and VpV_p the plasma volume. The plasma volume is sampled from a normal distribution with mean 30 m330\ \mathrm{m}^3 and standard variation 3 m33\ \mathrm{m}^3 [39]. Once a plasma volume has been sampled, a linear fit estimates Φedge\Phi_{\mathrm{edge}}.

QuantityDistributionUnitReferences
Magnetic Configuration
Non-planar coil currents i[2...5]i_{[2...5]}U(0.6,1.2)U(0.6, 1.2)-[7, 17–19]
Planar coil currents i[A,B]i_{[A,B]}U(−0.8,0.8)U(-0.8, 0.8)-[7, 17–19]
Plasma Parameters
Plasma volume VpV_pN(30,3.0)N(30, 3.0)m3^3[39]
Plasma beta β\betaU(0,5)U(0, 5)%[40]
Total toroidal current ItorI_{tor}U(−20,20)U(-20, 20)kA[39]
Pressure Profile GP
Covariance function scale factor σf\sigma_fU(0.1,5.0)U(0.1, 5.0)-[19]
Core length scale lcorel_{core}U(0.1,1.0)U(0.1, 1.0)-[19]
Edge length scale ledgel_{edge}U(0.1,2.0)U(0.1, 2.0)-[19]
Core-edge transition location s0s_0U(0.1,1.0)U(0.1, 1.0)-[19]
Core-edge transition width sws_wU(0.1,0.3)U(0.1, 0.3)-[19]
Toroidal Current Profile GP
Covariance function scale factor σf\sigma_fU(1.0,5.0)U(1.0, 5.0)-[19]
Core length scale lcorel_{core}U(0.1,1.0)U(0.1, 1.0)-[19]
Edge length scale ledgel_{edge}U(0.5,1.0)U(0.5, 1.0)-[19]
Core-edge transition location s0s_0U(0.001,0.8)U(0.001, 0.8)-[19]
Core-edge transition width sws_wU(0.1,0.5)U(0.1, 0.5)-[19]

Table 1. Distributions from which the training data have been sampled. U(a,b)U(a,b) represents a uniform distribution on the [a,b][a,b] interval, and N(μ,σ)N(\mu,\sigma) represents a normal distribution with μ\mu mean and σ\sigma standard variation. One-dimensional GPs with a non-stationary covariance function model the plasma profiles. The GP covariance function scale factor σf\sigma_f, core length scale lcorel_{core}, edge length scale ledgel_{edge}, core-edge transition location s0s_0, and core-edge transition width sws_w parametrize each GP [19, Section 2.2]. The references from which the distribution parameters have been informed are listed.

Plasma beta For a given magnetic field strength and pressure profile shape, the pressure on axis sets the volume averaged plasma beta: ⟨β⟩=2μ0⟨p/B2⟩Vol=2μ0p0⟨p‾/B2⟩Vol\langle\beta\rangle= 2\mu_0\langle p/B^2\rangle_{\mathrm{Vol}} = 2\mu_0p_0\langle\overline{p}/B^2\rangle_{\mathrm{Vol}}, where p0p_0 is the pressure on axis and p‾=p/p0\overline{p}=p/p_0 is the normalized pressure profile. In previous operational campaigns, W7-X has reached a maximum ⟨β⟩\langle\beta\rangle of roughly 1%. However, W7-X has been optimized for higher plasma beta (up to ⟨β⟩≃5\langle\beta\rangle\simeq5% [6]). Therefore, the volume averaged plasma beta is sampled from a uniform distribution between 0% and 5%. Once a plasma beta has been sampled, a linear fit estimates p0p_0.

Net toroidal current The plasma bootstrap current and the externally induced current (e.g., via electron cyclotron current drive (ECCD)) mainly define the net toroidal current. The net toroidal current should be minimized for the robust operation of an island divertor. In W7-X operations, two current-free scenarios are envisioned [39]: a scenario in which the bootstrap current is minimized via the magnetic configuration, and a scenario in which the bootstrap current is balanced by a strong ECCD current. During the first operational campaign, the measured bootstrap current ranged between −7-7 kA and 17 kA [41]. Therefore, the total toroidal current is sampled from a uniform distribution between −20-20 kA and 20 kA.

Pressure profile shape For electrons and ions, the gradient of the density and temperature (p∝nTp \propto nT) profiles can be substantially different in the core and edge regions. To account for such difference, a GP with a non-stationary covariance function models the pressure profile. The GP is parametrized by a set of hyper-parameters (HPs) [19, Section 2.2]: the covariance function scale factor σf\sigma_f, the core length scale lcorel_{core}, the edge length scale ledgel_{edge}, the transition location s0s_0, and the transition width sws_w. In W7-X, the pressure profile is generally flat, however, high-performance operations are correlated with a peaked density profile [42]. To account for both, flat and peaked profiles are included in the data set. Profiles with a non-physical positive pressure gradient (i.e., ∇p>0\nabla p > 0) are discarded.

Toroidal current profile shape In W7-X, the toroidal current has two main contributions: the ECCD induced current and the bootstrap current. The bootstrap current density is generally flat across the plasma volume, however, the ECCD current density is peaked at the deposition location. To capture both shapes, a GP with a non-stationary covariance function is used to model the toroidal current profile.

14 281 equilibria have been sampled in the data set, but equilibria for which VMEC was not able to minimize the MHD variational forces up to a tolerance of 1×10−7 N H m−11 \times10^{-7}\ \mathrm{N\,H\,m^{-1}} were discarded2. The data set thus contains 9857 equilibria. Figure 2a to Figure 2c show the histograms of a subset equilibrium properties for all converged equilibria: the volume averaged beta ⟨β⟩\langle\beta\rangle, the pressure peaking factor p0/⟨p⟩p_0/\langle p\rangle, and the peak toroidal current density max⁡s∣jtor(s)∣\max_s |j_{\mathrm{tor}}(s)|. The ⟨β⟩\langle\beta\rangle distribution is not uniform due to the not converged equilibria at high beta (Figure 2a). Nevertheless, the data set holds both flat (i.e., small peaking factor) and peaked (i.e., large peaking factor) pressure profiles (Figure 2b).

Figure 2. Histograms of the volume averaged beta (a), the pressure peaking factor (b), and the peak toroidal current density (c) for all converged equilibria in the data set.

The data set has been split into a training set (80%), a validation set (10%), and a test set (10%). The training set has been used to train the model, the validation set has been used to assess the best model HPs, and the test set has been used to assess the model performance on held-out data.

To improve the training procedure, the model inputs have been normalized with the mean and standard deviation computed on 20% of the training data.

Loss function

Three terms form the model loss function: a data term, a gradient term, and a physics-based regularization term. The data term biases the model to provide equilibria that are close to the ground truth (computed by VMEC), the gradient term regularizes the model equilibria to exhibit the same radial derivatives as the ground truth, and the physics-based term regularizes the model equilibria to satisfy the ideal-MHD equations.

Data loss

The model equilibrium solution is globally defined in the whole plasma volume. However, to numerically compute a residual measure against the ground truth, an equally spaced grid is adopted: Ns=99N_s = 99 flux surfaces, Nθ=32N_\theta= 32 poloidal locations, and Nφ=36N_\varphi= 36 toroidal locations compose the loss grid. The iota profile, being a flux surface quantity, is evaluated only at the radial grid locations. On each equilibrium, the data loss term is:

Ld=∑j=13αXj∑i=1Ns∑t=1Nθ∑z=1Nφ[X~j(si,θt,φz)−Xj(si,θt,φz)]2+αι∑i=1Ns[ι~(si)−ι(si)]2,(30)L_d = \sum_{j=1}^{3}\alpha_{X_j}\sum_{i=1}^{N_s}\sum_{t=1}^{N_\theta}\sum_{z=1}^{N_\varphi}\left[\widetilde{X}^{j}(s_i,\theta_t,\varphi_z)-X^{j}(s_i,\theta_t,\varphi_z)\right]^2+\alpha_{\iota}\sum_{i=1}^{N_s}\left[\widetilde{\iota}(s_i)-\iota(s_i)\right]^2, \tag*{(30)}

where X~j\widetilde{X}^{j} and ι~\widetilde{\iota} are the model outputs, and αXj\alpha_{X_j} and αι\alpha_{\iota} are the set of coefficients that weight the data loss terms.

Gradient loss

An equilibrium solution is fully defined by the mapping Xj(s,θ,φ)X^{j}(s,\theta,\varphi) for j∈{1,2,3}j \in\{1,2,3\} and by ι(s)\iota(s). However, many equilibrium properties depend also on equilibrium first and second radial, poloidal and toroidal derivatives. For example, the flux surface Jacobian g\sqrt{g}, which is the local linear approximation of the coordinate transformation (s,θ,φ)→(R,ϕ,Z)(s,\theta,\varphi) \to(R,\phi,Z), is:

g=R(∂R∂θ∂Z∂s−∂R∂s∂Z∂θ).(31)\sqrt{g}=R\left(\frac{\partial R}{\partial\theta}\frac{\partial Z}{\partial s}-\frac{\partial R}{\partial s}\frac{\partial Z}{\partial\theta}\right). \tag*{(31)}

To faithfully reconstruct the equilibrium properties, the gradients of the equilibrium solution need to match the gradients of the ground truth. Due to the Fourier expansion of the solution in the poloidal and toroidal directions, the poloidal and toroidal derivatives are already constrained by the Fourier coefficients: for example, ∂R∂θ=∂∂θ[∑mnRmncos⁡(mθ−Nfpnφ)]=−∑mnmRmnsin⁡(mθ−Nfpnφ)\frac{\partial R}{\partial\theta}=\frac{\partial}{\partial\theta}\left[\sum_{mn}R_{mn}\cos(m\theta-N_{\mathrm{fp}}n\varphi)\right]=-\sum_{mn}mR_{mn}\sin(m\theta-N_{\mathrm{fp}}n\varphi). A similar relationship holds for any poloidal and toroidal derivatives of (R,λ,Z)(R,\lambda,Z).

However, the radial derivatives of the equilibrium solution are not guaranteed to match those of the ground truth. The radial derivatives depend on the learnt trunk network functions, which are derived during training to minimize a L2L^2 residual with the ground truth on a finite-spacing radial grid. Even if the L2L^2 residual vanishes, numerical artefacts (e.g., numerical oscillations) are known to occur [43]. Therefore, the radial derivatives of the model solution can substantially differ from the ground truth.

To ameliorate these phenomena, a gradient term regularizes the radial derivatives of the model equilibrium:

Lg=∑j=13αXj∑i=1Ns∑t=1Nθ∑z=1Nφ[∂X~j∂s(si,θt,φz)−∂Xj∂s(si,θt,φz)]2+αι∑i=1Ns[∂ι~∂s(si)−∂ι∂s(si)]2,(32)L_g=\sum_{j=1}^{3}\alpha_{X_j}\sum_{i=1}^{N_s}\sum_{t=1}^{N_\theta}\sum_{z=1}^{N_\varphi}\left[\frac{\partial\widetilde{X}^{j}}{\partial s}(s_i,\theta_t,\varphi_z)-\frac{\partial X^{j}}{\partial s}(s_i,\theta_t,\varphi_z)\right]^2+\alpha_{\iota}\sum_{i=1}^{N_s}\left[\frac{\partial\widetilde{\iota}}{\partial s}(s_i)-\frac{\partial\iota}{\partial s}(s_i)\right]^2, \tag*{(32)}

where αXj\alpha_{X_j} and αι\alpha_{\iota} are a set of coefficients that weight the gradient loss terms. The radial derivatives are approximated with a central finite difference scheme for both the model and ground truth solutions.

Physics regularization

The ideal-MHD equilibrium problem exhibits a high condition number [44]. In the framework of MHD equilibria, the condition number is defined as ratio between the largest and the smallest eigenvalue of the MHD force residual linearized around an equilibrium solution. Due to the presence of second-order radial derivatives in the residual, the condition number scales with the square of the number of radial grid locations [44], namely, P∼Ns2 O(104)\mathcal{P}\sim N_s^2\ \mathcal{O}(10^4) in this work.

A high condition number means that the MHD force residual is highly sensitive to the equilibrium solution: small deviations of the solution away from the ground truth may lead to a large MHD residual. Even if the model equilibria are close (in the L2L^2 sense) to the ground truth equilibria, they are not guaranteed to well minimize the residual.

The MHD force residual in the loss function regularizes the model to provide equilibria that better satisfy the ideal-MHD equations. For an equilibrium solution, ∥F⃗∥2=0\|\vec{F}\|_2=0 everywhere in the domain. The volume-averaged residual norm can be computed as:

⟨∥F⃗∥2⟩Vol=∫01∫02π∫02π∥F⃗∥2g ds dθ dφ,(33)\langle\lVert\vec{F} \rVert_2 \rangle_{\mathrm{Vol}} = \int_0^1 \int_0^{2\pi} \int_0^{2\pi} \lVert\vec{F} \rVert_2 \sqrt{g}\,ds\,d\theta\,d\varphi, \tag*{(33)}

where ⟨A⟩Vol=∫01∫02π∫02πAg ds dθ dφ\langle A \rangle_{\mathrm{Vol}} = \int_0^1 \int_0^{2\pi} \int_0^{2\pi} A\sqrt{g}\,ds\,d\theta\,d\varphi denotes a volume-averaged operator. In this work, a proxy for the MHD force residual is used instead. VMEC (the code that provides the ground truth equilibria) does not directly minimize the force residual, instead, it minimizes the total energy of the system (i. e., it uses a variational approach). It has been shown that equilibria computed by VMEC only poorly minimize the ideal-MHD force residual [2]. Therefore, adding the full ⟨∥F⃗∥22⟩Vol\langle\lVert\vec{F} \rVert_2^2 \rangle_{\mathrm{Vol}} as regularization term may cause instabilities in the training procedure. The volume averaged radial force balance assuming a vanishing helical component (Fβ=0F_\beta= 0) is used instead. This quantity is also used in VMEC to determine the goodness of a converged solution. Let us firstly define

f∗=μ0(2π)2⟨Fs∣Fβ=0⟩Fs,(34)f_* = \frac{\mu_0}{(2\pi)^2}\langle F_s \mid_{F_\beta=0} \rangle_{\mathrm{Fs}}, \tag*{(34)}

where ⟨A⟩Fs=∫02π∫02πAg dθ dφ\langle A \rangle_{\mathrm{Fs}} = \int_0^{2\pi} \int_0^{2\pi} A\sqrt{g}\,d\theta\,d\varphi is a flux surface averaged operator. Then, the model is regularized with the following term:

LMHD=αMHD∫smin⁡1f∗2 ds,(35)L_{\mathrm{MHD}} = \alpha_{\mathrm{MHD}} \int_{s_{\min}}^1 f_*^2\,ds, \tag*{(35)}

where smin⁡=0.02s_{\min}=0.02 to avoid the sensitivity of the MHD force residual at the magnetic axis. Please refer to § 10.1 for the derivation of f∗f_*.

Training stages

Three subsequent training stages compose the training procedure. In every training stage, early stopping is employed during training [45], and the best model accordingly to the validation loss is used as a warm start for the next stage.

Data stage At the beginning of the training, only the data loss LdL_d is used. A set of flux surfaces randomly sampled across all equilibria in the training set compose each batch (i. e., individual flux surfaces from different equilibria are randomly shuffled into the same batch).

Gradient stage In this stage, the gradient loss LgL_g is included in the overall loss. To compute the radial derivatives of the solution, the flux surfaces of the same equilibrium are aggregated together in the same batch. However, multiple equilibria are still randomly shuffled into each batch.

Physics regularization stage Finally, the physics regularization term LMHDL_{\mathrm{MHD}} is included in the loss function. As in the gradient stage, and to compute f∗f_*, the flux surfaces of the same equilibrium are aggregated together in the same batch. Still, multiple equilibria form each batch.

During the physics regularization stage, a curriculum learning approach is used [46]. The high condition number limits the convergence rate and imposes a superior bound on the learning rate (i. e., the step size): even if the model commits a finite, but small error on the equilibrium solution, the regularization term might lead to a diverging loss.

To mitigate this issue, the model is gradually regularized, starting with well-predicted equilibria. At every batch, the physics regularization term is included into the loss function only for the subset of equilibria where the mean-squared error (mse) on (R,Z)(R,Z) (the key quantities affecting the MHD residual) is below a given threshold. When the regularization term has not decreased in the previous 50 epochs, the threshold is progressively increased by a factor of 10. More formally, the physics regularization term for the generic batch B\mathcal{B} at the kk-th step is:

LMHD,Bk=1∣B∣∑i=1∣B∣wikLMHD,i,(36)L_{\mathrm{MHD},\mathcal{B}}^k = \frac{1}{\lvert\mathcal{B} \rvert}\sum_{i=1}^{\lvert\mathcal{B} \rvert} w_i^k L_{\mathrm{MHD},i}, \tag*{(36)}
wik=H(Lk−L(R,Z),i),(37)w_i^k = H\left(L^k - L_{(R,Z),i}\right), \tag*{(37)}

where LMHD,iL_{\mathrm{MHD},i} is the physics regularization term for the ii-th equilibrium in the batch, H(⋅)H(\cdot) is the Heaviside function, LkL^{k} is the loss threshold value at the kk-th step, L(R,Z),iL_{(R,Z),i} is the mse on (R,Z)(R,Z) for the ii-th equilibrium. The loss threshold is progressively increased, i.e., Lk=10kL0L^{k}=10^{k}L^{0}. An initial threshold of L0=3×10−7 m2L^{0}=3\times10^{-7}\,\mathrm{m}^{2} is used. At the fourth step, the physics regularization term is computed on all the equilibria in the batch, namely, L4=+∞L^{4}=+\infty.

HPHyper-parameters

Due to the computational cost of the whole training procedure (≃8\simeq8 days on a single NVIDIA Tesla-V100 graphical processing unit (GPU)), a simplified scenario is used to identify the best model HPs. Given a fixed budget of ≃6\simeq6 M free parameters, HP grid search is performed for the depth and width of both trunk and branch networks. In addition, only half of the training data is used. The optimum HPs combination is chosen based on the loss on the validation set in the data stage.

The trunk and branch networks are then proportionally upscaled to reach ≃40\simeq40 M free parameters. Tables 7 and 8 summarize the HPs of the final model.

The AdamW [47, 48] optimizer is used to train the model. In each stage, due to the different loss function, the learning rate, the learning rate scheduler, and the L2L_{2} regularization term are derived with a limited grid search. The loss on the validation set is used to inform the search. In addition, early stopping [45] is employed during training. Tables 9 to 11 report the HPs used in each training stage.

Results

In the following chapter, the model’s accuracy is evaluated by how well it predicts the equilibrium problem solution and reconstructs equilibrium properties of interest (which are not explicitly included in the loss function) across many physics domains (table 2): flux surface geometry (section 5.1); iota profile, shear profile and magnetic field structure (section 5.2); MHD force residual (section 5.3); ideal-MHD stability (section 5.4); neoclassical transport (section 5.5); fast particle confinement (section 5.6).

The root-mean-square error (rmse) and mean absolute percentage error (mape) summarize the error on the test set. Given a quantity of interest y∈RKy\in\mathbb{R}^{K} (e.g., the magnetic well), the rmse evaluates the average residual between the ground truth and predicted values for that quantity. If Y={y∈RK}\mathcal{Y}=\{y\in\mathbb{R}^{K}\} is the set of true values, and Y^={y^∈RK}\hat{\mathcal{Y}}=\{\hat{y}\in\mathbb{R}^{K}\} is the set of related model predictions, the rmse on yy is:

rmse⁡y=1K∣Y∣∑i=1∣Y∣∑k=1K(y^ik−yik)2(38)\operatorname{rmse}_{y}=\sqrt{\frac{1}{K\lvert\mathcal{Y}\rvert}\sum_{i=1}^{\lvert\mathcal{Y}\rvert}\sum_{k=1}^{K}\left(\hat{y}_{i}^{k}-y_{i}^{k}\right)^{2}} \tag*{(38)}

Given a quantity of interest y∈RKy\in\mathbb{R}^{K}, the mape measures the average relative deviation of ground truth with respect to predicted values for that quantity. Using the same notation as for the rmse, the mape on yy is:

mape⁡y=1K∣Y∣∑i=1∣Y∣∑k=1K∣y^ik−yikyik∣.(39)\operatorname{mape}_{y}=\frac{1}{K\lvert\mathcal{Y}\rvert}\sum_{i=1}^{\lvert\mathcal{Y}\rvert}\sum_{k=1}^{K}\left\lvert\frac{\hat{y}_{i}^{k}-y_{i}^{k}}{y_{i}^{k}}\right\rvert. \tag*{(39)}

To further investigate the model accuracy, and to validate its use in downstream applications, section 5.7 shows a posteriori optimization of W7-X coil currents to search for ideal-MHD unstable and improved fast particle confinement configurations. In this task, the model replaces a traditional non-linear ideal-MHD code (e.g., VMEC) in constructing free-boundary equilibria.

The results of the model on the test set are now presented. Because of the adopted finite differences scheme, numerical noise affects quantities that rely on the radial derivative of (R,λ,Z)(R,\lambda,Z) at the magnetic axis and on the nearest flux surface; those values are invalid. A note is present in the caption of all affected figures.

Flux Surface Geometry

The geometry of the flux surfaces (R,λ,Z)(R,\lambda,Z) and ι\iota represent the solution of the ideal-MHD equilibrium problem: they fully describe the equilibrium magnetic field and its properties. Therefore, the accuracy with which the model predicts (R,λ,Z)(R, \lambda, Z) and ι\iota bounds the accuracy with which it reconstructs equilibrium properties.

The flux surface geometry is predicted with an exceptional accuracy (Figure 3). The flux surface error between the ground truth and the model prediction is evaluated as:

Ground truth and predicted flux surfaces geometry

Figure 3. The ground truth (solid) and predicted (dashed) flux surfaces geometry, (R,Z)(R, Z), for the median predicted equilibrium. Four toroidal locations at φ=0∘\varphi= 0^\circ (pink), φ=18∘\varphi= 18^\circ (orange), φ=36∘\varphi= 36^\circ (green), and φ=54∘\varphi= 54^\circ (red) are shown. For each toroidal location, ten flux surfaces equally spaced in ρ=s\rho= \sqrt{s} are shown. The model approximates the geometry of the flux surfaces with high accuracy: the average distance from the ground truth solution is below 1 mm. To highlight the model prediction, the region in which the flux surfaces have the largest curvature is zoomed in. Indeed, the two curves overlap each other.

ϵFs=⟨∥[ΔRi,ΔZi]T∥2⟩i,(40)\epsilon_{\mathrm{Fs}} = \left\langle\left\lVert[\Delta R_i, \Delta Z_i]^T \right\rVert_2 \right\rangle_i, \tag*{(40)}

where ΔRi\Delta R_i and ΔZi\Delta Z_i are the differences in flux surfaces relative to the ground truth, and the brackets denote the mean across all equilibria and grid locations. In other words, ϵFs\epsilon_{\mathrm{Fs}} represents the average absolute distance (ΔR)2+(ΔZ)2\sqrt{(\Delta R)^2 + (\Delta Z)^2} across all equilibria and grid locations. The model achieves ϵFs=616\epsilon_{\mathrm{Fs}} = 616 µm. Similarly, the model successfully predicts the angle renormalization parameter λ\lambda, achieving rmseλ=2.41\mathrm{rmse}_{\lambda} = 2.41 mrad.

Low-beta equilibria are better regressed than high-beta equilibria (Figure 4). As expected from the distribution of the volume averaged beta in the training data set (see Figure 2a), the flux surface error increases towards the boundary of the training set (i. e., where the plasma beta increases). No clear patterns are visible in terms of the net toroidal current enclosed by the plasma. The flux surface error does not considerably change when the physics regularization is applied (see Table 3).

Figure 4. Distribution of the flux surface error ϵFs\epsilon_{\mathrm{Fs}} as a function of the equilibrium volume averaged beta ⟨β⟩\langle\beta\rangle and the net toroidal current enclosed by the plasma ItorI_{\mathrm{tor}} in the test set.

NNNNregularized_{\mathrm{regularized}}VMEC
rmsesFs_{\mathrm{Fs}} [mm]6.08×10−16.08 \times10^{-1}6.16×10−16.16 \times10^{-1}-
mapeι_{\iota}9.24×10−49.24 \times10^{-4}9.31×10−49.31 \times10^{-4}-
εf∗\varepsilon_{f^*} [N H m−1^{-1}]7.27×10−27.27 \times10^{-2}1.97×10−21.97 \times10^{-2}2.43×10−52.43 \times10^{-5}

Table 3. Comparison between the not-regularized and regularized model in minimizing the MHD force residual proxy across all equilibria in the test set. NN denotes a model that has not be regularized with the MHD force residual (i. e., trained only in the data and gradient stages), NNregularized_{\mathrm{regularized}} denotes the model that has been regularized (i. e., trained also in the physics regularization stage), and VMEC denotes the value for the ground truth equilibria.

As the plasma beta increases, the plasma column moves outwards. This effect is called the Shafranov shift, and it is usually measured as Δ/a\Delta/a, where Δ=Raxis(β)−Raxis(0)\Delta= R_{\mathrm{axis}}(\beta) - R_{\mathrm{axis}}(0) and aa is the effective minor radius. The Shafranov shift defines the equilibrium beta limit (Δ/a≈0.5\Delta/a \approx0.5) [49], and it causes an outward movement of the last closed flux surface (LCFS), which affects the edge magnetic field topology. In W7-X, the minimization of the Shafranov shift was an optimization criterion [50]. Nevertheless, a Shafranov shift of Δ≈5\Delta\approx5 cm has been observed in high-β\beta operations [51].

The model faithfully predicts this finite-beta effect (Figure 5): the axis location at φ=0\varphi= 0 is resolved with a relative error of mapeRaxis<0.01%\mathrm{mape}_{R_{\mathrm{axis}}} < 0.01\%. A two-dimensional histogram visualizes the distribution of ground truth and predicted values. The color-bar indicates the counts in each two-dimensional histogram bins. To guide the eye, a red dashed line indicates the case of perfect regression: the more the density of points lies on the line, the more the model provides accurate equilibrium properties. The coefficient of determination R2R^2 captures the reconstruction quality.

Reconstruction of the location of the magnetic axis

Figure 5. Reconstruction of the location of the magnetic axis at Raxis(φ=0)R_{\mathrm{axis}}(\varphi= 0) across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction.

Magnetics

ι\iota- sets the location of the resonant surfaces in the plasma volume. It also defines the island chain and magnetic edge topology, which affects how the W7-X island divertor operates. Although equilibria with the assumption of nested flux surfaces cannot resolve islands, VMEC equilibria are an important requirement in the investigation of plasma phenomena involving resonant surfaces [52–54].

The model effectively predicts the ι\iota profile (Figure 6a). A relative error of mape⁡ι<0.1%\operatorname{mape}_{\iota} < 0.1\% is achieved. In case of the median regressed equilibrium, the predicted and ground truth ι\iota profiles overlap (Figure 6b).

The magnetic shear is the radial derivative of ι\iota:

ι′=dιdψ=∂ι∂s∂s∂ψ=1ψedge∂ι∂s(41)\iota' = \frac{d\iota}{d\psi} = \frac{\partial\iota}{\partial s}\frac{\partial s}{\partial\psi} = \frac{1}{\psi_{\mathrm{edge}}}\frac{\partial\iota}{\partial s} \tag*{(41)}
Reconstruction of the iota profile

(a)

True and predicted iota profile

(b)

Figure 6. (a) Reconstruction of the iota profile ι\iota across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction. (b) The true (solid pink) and predicted (dashed green) iota profile for the median regressed equilibrium in the test set.

where 2πψ(s)=Φedges2\pi\psi(s) = \Phi_{\mathrm{edges}} is the toroidal flux. It represents the change of direction of the magnetic field lines from one flux surface to another. The magnetic shear influences multiple properties of the equilibrium: it affects MHD stability [55, 56], it is inversely proportional to the island width (i. e., large islands are present at low shear) [55], and a low shear leads to long connection lengths allowing efficient divertor operation [57].

The model qualitatively reconstructs the shear profile (Figure 7a). Figure 7b shows that the ground truth and predicted shear profile only partially overlap. Across all equilibria in the test set, the relative error on the magnetic shear is high mape⁡ι′=84.4%\operatorname{mape}_{\iota'} = 84.4\%.

Reconstruction of the local magnetic shear and the true and predicted magnetic shear profile

Figure 7. (a) Reconstruction of the local magnetic shear ι′\iota' across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction. (b) The true (solid pink) and predicted (dashed green) magnetic shear profile for the median regressed equilibrium in the set.

However, the model captures the average magnetic shear ι∗′\iota'_{*} (Figure 8): mape⁡ι∗′=8.16%\operatorname{mape}_{\iota'_{*}} = 8.16\%, where the average magnetic shear is the shear of the least squares linear fit of the iota profile.

Reconstruction of the average magnetic shear across all equilibria

Figure 8. Reconstruction of the average magnetic shear across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction. The average magnetic shear is defined as the shear of the least squares linear fit of the iota profile [58].

The structure of the magnetic field plays a crucial role in many physics aspects: neoclassical and turbulence transport, confinement of energetic particles, plasma instabilities, and deposition of electron cyclotron resonance heating (ECRH) heating power.

The model correctly reconstructs the magnetic field structure (Figure 9). The model achieves a rmse⁡B=23.6\operatorname{rmse}_{B} = 23.6 mT on all equilibria in the test set. When compared with an average W7-X field of B0=2.5B_{0} = 2.5 T, this value represents a relative error below 1%.

Error on the magnetic field strength as a function of radial location

Figure 9. The error on the magnetic field strength as a function of the radial location, averaged across all grid points on the flux surface. The solid line represents the mean across all equilibria in the test set, and the shaded regions represent the 95 % and 5 % quantiles. To guide the eye, two reference values are shown: 25 mT (dashed black) represents a 1 % error (W7-X has a field of 2.5 T on average on axis), and 10 mT (dashed red) represents the expected accuracy needed on the magnetic field strength for equilibrium reconstruction routines [59]. Numerical noise in the finite difference scheme invalidates the values on the magnetic axis (see § 5).

However, the magnetic field strength error differs along the radial profile (Figure 9). On average, the field strength error is below 10 mT for a considerable fraction of the plasma volume, up to s≃0.3s \simeq0.3 (i. e., ρ≃0.55\rho\simeq0.55). The accuracy of the magnetic field strength in the core region is sufficient to navigate the magnetic configuration space of W7-X to obtain fast particle optimized configurations (see § 5.7.2). Moreover, an accuracy of 10 mT is expected to be enough to perform equilibrium reconstruction routines [59].

The model introduces artificial field ripples in the equilibrium solution (Figure 10): at the plasma edge, and also to a less extent close to the magnetic axis, the predicted BB field is not as smooth as the ground truth solution. The flux surface geometry Jacobian g\sqrt{g} and the metric tensor elements gijg_{ij} mainly define the magnetic field BB (§ 2.1). These quantities are highly sensitive to the radial derivative of the flux surface coordinates (R,λ,Z)(R,\lambda,Z). High frequency components in the learned trunk network basis functions might be the cause of such field ripples.

Figure 10. True (left) and predicted (right) BB magnetic field strength structure at two radial locations: s=0.06s = 0.06 (top, close to the magnetic axis) and s=0.75s = 0.75 (bottom, close to the plasma boundary). The median predicted equilibrium in the test set is shown.

Ideal-MHD loss

A high condition number, which has several negative implications, characterizes the ideal-MHD equilibrium problem (see § 4.2.3).

Firstly, a high condition number limits the rate of convergence. During the physics regularization training stage, the weights of the NN model are adjusted to minimize the MHD force residual for the equilibria in the training set. The condition number sets the convergence rate of this gradient descent method. To accelerate the descent, non-linear MHD codes adopt a preconditioning matrix, which decreases the condition number of the problem [44]. In this work, this technique is not available: in general, preconditioning algorithms require an approximation of the Hessian matrix, which is impractical due to the large number of free parameters of the NN model.

Secondly, a high condition number implies that the MHD force residual is highly sensitive to the equilibrium solution. For example, if we define x⃗0\vec{x}_0 to be that solution that satisfies the MHD force residual FMHD(x⃗0)=0F_{\mathrm{MHD}}(\vec{x}_0)=0 and κ\kappa as the condition number, then FMHD(x⃗0+ϵ⃗)≃κ∥ϵ⃗∥2≫1F_{\mathrm{MHD}}(\vec{x}_0+\vec{\epsilon})\simeq\kappa\lVert\vec{\epsilon}\rVert_2\gg1, where ϵ⃗\vec{\epsilon} is a small displacement to the equilibrium solution. Even if the model provides a good approximation of the equilibrium solution, the MHD force residual is not guaranteed to be null.

To quantify how well the equilibria satisfy the MHD equations, two measures are adopted. The proxy and full MHD force residuals:

εf∗=μ0(2π)2⟨Fs|Fβ=0⟩Vol=∫smin⁡1f∗ ds,(42)\varepsilon_{f_*}=\frac{\mu_0}{(2\pi)^2}\left\langle F_s\middle|_{F_\beta=0}\right\rangle_{\mathrm{Vol}}=\int_{s_{\min}}^1 f_*\,\mathrm{d}s, \tag*{(42)}
εF=μ0(2π)2⟨∥F⃗∥2⟩Vol=μ0(2π)2∫smin⁡1∫02π∫02π∥F⃗∥2g ds dθ dφ.(43)\varepsilon_F=\frac{\mu_0}{(2\pi)^2}\left\langle\lVert\vec{F}\rVert_2\right\rangle_{\mathrm{Vol}}=\frac{\mu_0}{(2\pi)^2}\int_{s_{\min}}^1\int_0^{2\pi}\int_0^{2\pi}\lVert\vec{F}\rVert_2\sqrt{g}\,\mathrm{d}s\,\mathrm{d}\theta\,\mathrm{d}\varphi. \tag*{(43)}

And their normalized versions:

ηf∗=∫smin⁡1f∗ ds∫smin⁡1∫02π∫02π∥∇p∥22g ds dθ dφ(44)\eta_{f_*} = \frac{\int_{s_{\min}}^{1} f_*\,\mathrm{d}s}{\int_{s_{\min}}^{1}\int_{0}^{2\pi}\int_{0}^{2\pi}\lVert\nabla p\rVert_2^2\sqrt{g}\,\mathrm{d}s\,\mathrm{d}\theta\,\mathrm{d}\varphi} \tag*{(44)}
ηF=∫smin⁡1∫02π∫02π∥F⃗∥2g ds dθ dφ∫smin⁡1∫02π∫02π∥∇p∥22g ds dθ dφ(45)\eta_F = \frac{\int_{s_{\min}}^{1}\int_{0}^{2\pi}\int_{0}^{2\pi}\lVert\vec{F}\rVert_2\sqrt{g}\,\mathrm{d}s\,\mathrm{d}\theta\,\mathrm{d}\varphi}{\int_{s_{\min}}^{1}\int_{0}^{2\pi}\int_{0}^{2\pi}\lVert\nabla p\rVert_2^2\sqrt{g}\,\mathrm{d}s\,\mathrm{d}\theta\,\mathrm{d}\varphi} \tag*{(45)}

The model trained with the physics regularization term better satisfies the ideal-MHD force residual compared with a model that has not been regularized (Table 3). Both models show similar flux surface and iota errors, however, the physics regularized model shows a reduced ideal-MHD force proxy residual. However, this number is still three orders of magnitude higher than the value of ground truth equilibria from VMEC.

Even though the model provides the solution of the ideal-MHD equilibrium problem (the geometry of the flux surfaces and the iota profile) with high accuracy, the ideal-MHD force residual is poorly satisfied. In case of the median predicted equilibrium (at ⟨β⟩=1.39%\langle\beta\rangle= 1.39\%), the normalized MHD force proxy residual is ηf∗=23.3%\eta_{f_*} = 23.3\% (Figure 11). For comparison, the ground truth equilibrium has a normalized residual of 3.04×10−2%3.04 \times10^{-2}\%.

True (solid pink) and predicted (dashed green) normalized MHD force proxy residual for the median regressed equilibrium

Figure 11. True (solid pink) and predicted (dashed green) normalized MHD force proxy residual for the median regressed equilibrium. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5).

Fine-tuning at inference time

Let us call a single-pass equilibrium an equilibrium solution provided by the model with a single forward pass.

Single-pass equilibria poorly satisfy the ideal-MHD equations (§ 5.3). However, without access to the ground truth solution, equilibria can be improved at inference time. The original free-boundary equilibrium problem is cast into an equivalent fixed-boundary one: the plasma boundary of the single-pass free-boundary equilibrium defines the boundary condition on (R,Z)(R, Z) for the equivalent fixed-boundary equilibrium. The error on (R,Z)(R, Z) of the single-pass equilibrium is below 1 mm (§ 5.1), therefore, the plasma boundary can be safely assumed to be close to the correct.

The solution of the equivalent fixed-boundary equilibrium problem is approximated by minimizing the MHD force residual at inference time. The loss function has three terms: the full MHD force residual, a distance between the model and the fixed boundary (Rb,Zb)(R_b, Z_b) derived from the single-pass equilibrium, and the satisfaction of the required toroidal current profile Itor(s)I_{\mathrm{tor}}(s). The loss function is then:

L=αMHDLMHD+αbLb+αILI,(46)L = \alpha_{\mathrm{MHD}} L_{\mathrm{MHD}} + \alpha_b L_b + \alpha_I L_I, \tag*{(46)}
LMHD=μ02(2π)4∫smin⁡1⟨∥F~∥2⟩FS ds,(47)L_{\mathrm{MHD}} = \frac{\mu_0^2}{(2\pi)^4} \int_{s_{\min}}^1 \langle\lVert\widetilde{\mathbf{F}} \rVert^2 \rangle_{\mathrm{FS}} \, ds, \tag*{(47)}
Lb=⟨(ΔRib)2⟩i+⟨(ΔZib)2⟩i,(48)L_b = \left\langle(\Delta R_i^b)^2 \right\rangle_i + \left\langle(\Delta Z_i^b)^2 \right\rangle_i, \tag*{(48)}
LI=μ02∫smin⁡1(I~tor−Itor)2 ds,(49)L_I = \mu_0^2 \int_{s_{\min}}^1 (\widetilde{I}_{\mathrm{tor}} - I_{\mathrm{tor}})^2 \, ds, \tag*{(49)}

where αMHD=1×10−3\alpha_{\mathrm{MHD}} = 1 \times10^{-3}, αb=0.2495\alpha_b = 0.2495, αI=0.5\alpha_I = 0.5, and smin⁡=0.02s_{\min} = 0.02. The single-pass equilibrium is used as initial guess for the minimization problem. The AdamW algorithm minimizes the loss function. The initial learning rate is set to 10−410^{-4}, and it is decreased to 10−610^{-6} at 10410^4 steps with an exponential decay. The training is halted after 2×1042 \times10^4 steps. The branch network, apart from the bias of the last layer, is frozen. For a complete description of the HPs, see § 9.2. We call this optimization at the inference step fine-tuning.

In terms of the full MHD force residual, the model can provide better-than-ground-truth equilibria (Table 4 and Figure 12a and Figure 12b). As an example, we consider a W7-X standard configuration at ⟨β⟩=2%\langle\beta\rangle= 2\%, which is not included in the training data. Both the single-pass and fine-tuned equilibrium show low flux surface errors, however, the fine-tuned equilibrium satisfies the ideal-MHD equations much better than the single-pass equilibrium: the normalized error is only ηf∗≃1%\eta_{f^*} \simeq1\%. Surprisingly, the fine-tuned equilibrium minimizes the full MHD force residual better than the ground truth equilibrium computed by VMEC.

NNNNregularized_{\mathrm{regularized}}NNfine−tuned_{\mathrm{fine-tuned}}VMEC
rmseFs\mathrm{rmse}_{F_s} [mm]3.11×10−43.11 \times10^{-4}3.21×10−43.21 \times10^{-4}3.63×10−33.63 \times10^{-3}-
εf∗\varepsilon_{f_*} [N H m−1^{-1}]4.90×10−24.90 \times10^{-2}1.18×10−21.18 \times10^{-2}8.11×10−48.11 \times10^{-4}9.86×10−69.86 \times10^{-6}
εF\varepsilon_F [N H m−1^{-1}]8.83×10−18.83 \times10^{-1}8.28×10−18.28 \times10^{-1}1.24×10−21.24 \times10^{-2}5.43×10−25.43 \times10^{-2}
ηf∗\eta_{f_*}7.17×10−17.17 \times10^{-1}1.73×10−11.73 \times10^{-1}1.19×10−21.19 \times10^{-2}1.44×10−41.44 \times10^{-4}
ηF\eta_F3.51×1003.51 \times10^{0}3.29×1003.29 \times10^{0}4.92×10−24.92 \times10^{-2}2.16×10−12.16 \times10^{-1}

Table 4. Table 4: Comparison between the fine-tuned, not-regularized and regularized (single-pass) model in minimizing the MHD force residual in case of a W7-X standard configuration at ⟨β⟩=2%\langle\beta\rangle= 2\%, which is not part of the training data. εf∗\varepsilon_{f_*} and εF\varepsilon_F denote the proxy and full MHD force residuals, ηf∗\eta_{f_*} and ηF\eta_F denote the proxy and full normalized MHD force residuals. Please refer to § 5.3 for the definition of these quantities. NN denotes a model that has not be regularized with the MHD force residual (i. e., trained only in the data and gradient stages), NNregularized_{\mathrm{regularized}} denotes the model that has been regularized with MHD force residual (i. e., the single-pass model), and NNfine−tuned_{\mathrm{fine-tuned}} denotes the fine-tuned model. VMEC denotes the value for the ground truth equilibrium. For each quantity, the best value is highlighted in bold.

Comparison of normalized proxy and full MHD force residuals for the VMEC, single-pass, and fine-tuned models

Figure 12. Figure 12: The comparison between the single-pass and fine-tuned model in minimizing the proxy and full MHD force residuals. (a) The normalized MHD force residual proxy for the single-pass (dashed green), fine-tuned (solid green), and ground truth equilibrium (solid pink). A W7-X standard configuration at ⟨β⟩=2%\langle\beta\rangle= 2\% equilibrium, which was not part of the training data, is shown here. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5). (b) The normalized full MHD force residual for the single-pass (dashed green), fine-tuned (solid green), and ground truth equilibrium (solid pink). A W7-X standard configuration at ⟨β⟩=2%\langle\beta\rangle= 2\% equilibrium, which was not part of the training data, is shown here. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5).

In addition, the fine-tuning procedure also improves the reconstruction of the magnetic field strength: the average error is below 10 mT for the entire plasma volume (Figure 13).

Plot of magnetic field strength error as a function of radial profile $s$, with dashed green single-pass and solid green fine-tuned curves

Figure 13. The magnetic field strength error as a function of the radial profile, averaged across a flux surface, in case of a W7-X standard configuration at ⟨β⟩=2%\langle\beta\rangle= 2\% equilibrium, which was not part of the training data. The single-pass (dashed green), and fine-tuned (solid green) equilibria are shown. Numerical noise in the finite difference scheme invalidates the values on the magnetic axis (see § 5).

The fine-tuning procedure is currently computationally expensive: on a single GPU, the fine-tuning procedure reaches the MHD force residual of the VMEC ground truth equilibrium after 4807 iterations (i. e., gradient update step) and 3610 s, whereas VMEC converges after 13 783 iterations and 127 s (on 20 central processing unit (CPU) cores). Both the fine-tuning procedure and VMEC use a gradient descent method, however, even if the model requires fewer iterations to achieve the same MHD force residual, the model runtime is longer: the network and loss function are described in python, while VMEC is written in FORTRAN (thus resulting in compiled code).

The fine-tuning procedure simply shows how the single-pass model predictions can be improved in a self-supervised fashion (i. e., without the use of a ground truth equilibrium). The reduction of the fine-tuning runtime (e. g., just-in-time compilation of both the network and loss function) and the improvement of the fine-tuning convergence (e. g., higher learning rate) are left for future investigations.

Ideal-MHD stability

The magnetic well WW [60, 61] represents a fast proxy for ideal-MHD stability [58, 62]. The configuration is taken to be stable if [63]:

p′W<0(50)p'W < 0 \tag*{(50)}

Therefore, for a standard pressure profile with p′<0p' < 0, a positive WW is favourable for stability. In the literature, multiple definitions can be found. When considering vacuum configurations, the magnetic well can be expressed as the second radial derivative of the plasma volume:

Wvacuum(s)=d2Vpdψ2=d2Vpds2ds2dψ2=1ψedge2d2Vpds2,(51)W_{\mathrm{vacuum}}(s) = \frac{d^{2}V_{p}}{d\psi^{2}} = \frac{d^{2}V_{p}}{ds^{2}}\frac{d s^{2}}{d\psi^{2}} = \frac{1}{\psi_{\mathrm{edge}}^{2}}\frac{d^{2}V_{p}}{ds^{2}}, \tag*{(51)}

where Vp(s)V_{p}(s) is the plasma volume within the flux surface labelled ss:

Vp(s)=∫0s∫02π∫02π∣g∣ ds′ dθ dφ.(52)V_p(s)=\int_{0}^{s}\int_{0}^{2\pi}\int_{0}^{2\pi}\sqrt{|g|}\,ds'\,d\theta\,d\varphi. \tag*{(52)}

When a finite plasma pressure is introduced, the expression is modified into [60]:

W(s)=Vp⟨B2⟩ddVp(2μ0p+⟨B2⟩).(53)W(s)=\frac{V_p}{\langle B^2\rangle}\frac{d}{dV_p}\left(2\mu_0p+\langle B^2\rangle\right). \tag*{(53)}

Moreover, the magnetic well term as defined in the Mercier stability criterion is [63, 64]:

DW(s)=dpds(d2Vpds2−dpds∫02π∫02π∣g∣ dθ dφB2)∫02π∫02π∣g∣ dθ dφB2∣∇s∣2,(54)D_W(s)=\frac{dp}{ds}\left(\frac{d^2V_p}{ds^2}-\frac{dp}{ds}\int_{0}^{2\pi}\int_{0}^{2\pi}\frac{\sqrt{|g|}\,d\theta\,d\varphi}{B^2}\right)\int_{0}^{2\pi}\int_{0}^{2\pi}\sqrt{|g|}\,d\theta\,d\varphi\frac{B^2}{|\nabla s|^2}, \tag*{(54)}

where the s2ι2π2\frac{s^2}{\iota^2\pi^2} prefactor common to all Mercier terms has been omitted, as employed in VMEC. The model only qualitatively reconstructs the local magnetic well (Figure 14a to Figure 14c); it correctly provides the trend of the profile, however, it introduces artificial wiggles: because the magnetic well depends on the solution’s second radial derivatives, the magnetic well is particularly sensitive to the solution’s radial dependency. The relative error for all three expression of the magnetic well is high (see Table 2).

Flux Surfaces Geometry
Flux Surface Error ϵFs\epsilon_{\mathrm{Fs}} [mm]6.16×10−16.16 \times10^{-1}
RaxisR_{\mathrm{axis}} rmse [mm]5.84×10−15.84 \times10^{-1}
λ\lambda rmse [mrad]3.90×1003.90 \times10^{0}
Magnetics
Iota mape9.31×10−49.31 \times10^{-4}
Shear mape8.44×10−18.44 \times10^{-1}
Mean Shear mape8.16×10−28.16 \times10^{-2}
Magnetic Field rmse [mT]2.36×1012.36 \times10^{1}
Volume Averaged Plasma Beta mape1.37×10−31.37 \times10^{-3}
Ideal-MHD Force Balance
MHD force residual proxy ϵf∗\epsilon_{f_*} (VMEC) [N H m−1^{-1}]1.97×10−21.97 \times10^{-2} (2.43×10−52.43 \times10^{-5})
Normalized MHD force residual proxy ηf∗\eta_{f_*} (VMEC)5.01×10−15.01 \times10^{-1} (5.29×10−45.29 \times10^{-4})
Ideal-MHD Stability
Vacuum Magnetic Well Depth W‾vacuum\overline{W}_{\mathrm{vacuum}} mape3.43×10−23.43 \times10^{-2}
Finite-⟨β⟩\langle\beta\rangle Magnetic Well Depth W‾\overline{W} mape2.61×10−12.61 \times10^{-1}
Vacuum Magnetic Well WvacuumW_{\mathrm{vacuum}}5.12×10−15.12 \times10^{-1}
Finite-⟨β⟩\langle\beta\rangle Magnetic Well WW mape1.93×1001.93 \times10^{0}
Mercier Well DWD_W mape1.12×1001.12 \times10^{0}
Neoclassical Transport
Effective Ripple ϵeff\epsilon_{\mathrm{eff}} (s≤0.33s \le0.33) mape5.46×10−15.46 \times10^{-1}
Effective Ripple Proxy ϵ^eff\hat{\epsilon}_{\mathrm{eff}} mape1.33×10−11.33 \times10^{-1}
Fast particle confinement
Standard deviation of the maxima of BB σBmax⁡\sigma_{B_{\max}} rmse [mT]9.43×1009.43 \times10^{0}
Standard deviation of the minima of BB σBmin⁡\sigma_{B_{\min}} rmse [mT]6.57×1006.57 \times10^{0}

Table 2. Model error metrics on the test set across multiple equilibrium properties (which are not explicitly included in the loss function). For the description of each quantity, please see sections 5.1 to 5.6. Each row represents either an error metric (e. g., the flux surface error ϵFs\epsilon_{\mathrm{Fs}}) or an equilibrium property (e. g., the proxy for the radial force balance f∗f_*). In both cases, the table shows the average over the whole test set. In case of an equilibrium property, the bracket indicates the ground truth value as computed by VMEC.

Vacuum magnetic well

(a)

Finite pressure magnetic well

(b)

Magnetic well term in the Mercier criterion

(c)

Figure 14. True (solid pink) and predicted (dashed green) values of the vacuum magnetic well (a), the finite pressure magnetic well (b), and the magnetic well term in the Mercier criterion (??), in case of the median regressed equilibrium. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5).

The MHD force residual regularization aids the model to faithfully reconstruct equilibrium properties. As an example, figure 15 shows the reconstructed local magnetic well by the not-regularized, the regularized (i. e., single-pass), and the fine-tuned models. We again consider the W7-X standard configuration equilibrium at ⟨β⟩=2%\langle\beta\rangle= 2\% previously examined (see § 5.3.1). The amplitude of the radial wiggle decreases from the not-regularized to the regularized models, and it almost vanishes in the fine-tuned model. Since the MHD force residual depends on the equilibrium solution’s second radial derivatives, the MHD force residual regularization also implicitly regularizes the equilibrium solution’s radial derivatives.

Comparison of VMEC, not regularized, regularized, and fine-tuned reconstructions of the local magnetic well

Figure 15. Comparison on how the not-regularized, the regularized (i.e., single-pass), and the fine-tuned model reconstructs the local magnetic well WW. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5)

To assess the MHD stability of an equilibrium, a globally defined magnetic well is usually considered. For example, stellarator optimization frameworks often use the magnetic well depth as a fast proxy for plasma stability [7, 11]:

W‾vacuum=Vp′(s)∣s=0−Vp′(s)∣s=1Vp′(s)∣s=0,(55)\overline{W}_{\mathrm{vacuum}} = \frac{V_p'(s)|_{s=0} - V_p'(s)|_{s=1}}{V_p'(s)|_{s=0}}, \tag*{(55)}

where W‾vacuum\overline{W}_{\mathrm{vacuum}} does not consider finite-⟨β⟩\langle\beta\rangle effects. A magnetic well depth that considers also a finite pressure can be defined as:

W‾=−p∗(s)∣s=0−p∗(s)∣s=1p∗(s)∣s=0,(56)\overline{W} = -\frac{p^*(s)|_{s=0} - p^*(s)|_{s=1}}{p^*(s)|_{s=0}}, \tag*{(56)}

where p∗=2μ0p+⟨B2⟩p^* = 2\mu_0 p + \langle B^2 \rangle is the sum of the fluid and the magnetic pressure. Despite only a qualitative agreement of the local magnetic well, the model faithfully reconstructs the magnetic well depth (Figure 16a and Figure 16b). In case of the vacuum magnetic well depth, the relative error is remarkably low: mape⁡W‾vacuum=3.43%\operatorname{mape}_{\overline{W}_{\mathrm{vacuum}}} = 3.43\%. The accuracy on the magnetic well depth is sufficient to effectively navigate the magnetic configuration space of W7-X in finding precise, negative-well configurations (see § 5.7.1).

Reconstruction of the vacuum and finite pressure magnetic well depth

Figure 16. Reconstruction of the vacuum (a) and finite pressure (b) magnetic well depth across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction. The magnetic well depth is a measure of an average magnetic well value [7].

Neoclassical transport

In a stellarator, one critical transport regime is the so called 1/ν1/\nu regime, where the neoclassical transport increases with decreasing collision frequency. A measure of such transport is the effective ripple coefficient, ϵeff\epsilon_{\mathrm{eff}} [65]. In this work, the drift-kinetic code NEO [66, 67] evaluates the ϵeff\epsilon_{\mathrm{eff}}.

No acceptable agreement is present between the predicted and ground truth ϵeff\epsilon_{\mathrm{eff}} values (Figure 17a). The effective ripple is greatly affected by the local structure of the magnetic field, which the model struggles to smoothly reconstruct (Figure 10). It seems coherent that the artificial field ripples in the model equilibrium solution affect the accuracy on the effective ripple.

True and predicted effective ripple values and reconstruction across all equilibria

Figure 17. (a) True (solid pink) and predicted (dashed green) values of the effective ripple ϵeff\epsilon_{\mathrm{eff}} for the median regressed equilibrium. (b) Reconstruction of the effective ripple ϵeff\epsilon_{\mathrm{eff}} across all equilibria in the test set. The ϵeff\epsilon_{\mathrm{eff}} is computed on 5 equally spaced flux surfaces in the plasma region for s≤0.33s \le0.33 (ρ≤0.57\rho\le0.57). The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction.

A poor, qualitative agreement between the ground truth and predicted ϵeff\epsilon_{\mathrm{eff}} is present only in the core region (Figure 17b). In such region, namely for s≤0.33s \le0.33 (ρ≤0.57\rho\le0.57), the magnetic field strength is reconstructed with an accuracy below 10 mT. However, the ϵeff\epsilon_{\mathrm{eff}} relative error is still high, mape⁡ϵeff=54.6%\operatorname{mape}_{\epsilon_{\mathrm{eff}}} = 54.6\%.

The fine-tuned model can faithfully resolve ϵeff\epsilon_{\mathrm{eff}}. As an example, Figure 18 shows the reconstructed ϵeff\epsilon_{\mathrm{eff}} by the not-regularized, the regularized, and the fine-tuned models in case of the W7-X standard configuration equilibrium at ⟨β⟩=2%\langle\beta\rangle= 2\% previously examined (see section 5.3.1). Both the not-regularized and regularized model fail to smoothly reconstruct ϵeff\epsilon_{\mathrm{eff}}.

Comparison of VMEC, not regularized, regularized, and fine-tuned reconstructions of the effective ripple

Figure 18. Comparison on how the not-regularized, the regularized (i. e., single-pass), and the fine-tuned model reconstructs ϵeff\epsilon_{\mathrm{eff}}. Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see section 5)

Simplified proxies of the neoclassical transport do exist. For example, in case of W7-X magnetic configurations with a low mirror term (b01≃0b_{01} \simeq0), the effective ripple can be approximated as [39]:

ϵeff≃ϵ^eff=−b11κ4/3,(57)\epsilon_{\mathrm{eff}} \simeq\hat{\epsilon}_{\mathrm{eff}} = -b_{11}\kappa^{4/3}, \tag*{(57)}

where bmn=Bmn/B0b_{mn} = B_{mn}/B_0, BmnB_{mn} are the Fourier coefficients of the magnetic field strength BB in Boozer coordinates, B0B_0 is a reference magnetic field value (e. g., B00(s=1)B_{00}(s = 1)), κ=−b10Rreff\kappa= -b_{10}\frac{R}{r_{\mathrm{eff}}} is the toroidal curvature term, RR is the major radius, and reff=ρar_{\mathrm{eff}} = \rho a is the effective radius. The model well reconstructs the epsilon effective proxy ϵ^eff\hat{\epsilon}_{\mathrm{eff}} (figure 19). ϵ^eff\hat{\epsilon}_{\mathrm{eff}} relies on few geometrical quantities and on the leading Fourier components of the magnetic field strength BB, which the model faithfully reconstructs (see sections 5.1 and 5.2). In case of the epsilon effective proxy ϵ^eff\hat{\epsilon}_{\mathrm{eff}}, the model shows a relative error of mape⁡ϵ^eff=13.3%\operatorname{mape}_{\hat{\epsilon}_{\mathrm{eff}}} = 13.3\%, lower than compared with ϵeff\epsilon_{\mathrm{eff}}.

Fast particle confinement

Another critical measure of transport is the confinement of fast α\alpha-particles (energetic ions), which are the products of fusion reactions. Any fusion facility should confine fast particles so that they can heat the bulk plasma during the plasma burn, and to avoid damage to the first wall as a result of their losses. Codes like the symplectic integration methods for particle loss estimation (SIMPLE) compute the loss fraction of test particles, for both trapped and passing particles, when injected with an initial velocity in the plasma volume. The collisionless guiding centers of particle motion are followed in time, till a stopping condition is met or the particle leaves the plasma volume.

Reconstruction of the effective ripple proxy across all equilibria in the test set

Figure 19. Reconstruction of the effective ripple proxy ϵ^eff\hat{\epsilon}_{\mathrm{eff}} across all equilibria in the test set. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction.

However, such computations are expensive. Stellarator optimization frameworks instead use explicit symmetries (e.g., quasi-symmetry), equilibrium properties (e.g., omnigenity) or simpler proxies that correlate with the confinement of fast particles (e.g., Γc\Gamma_c) [62, 68–72].

For example, W7-X is a quasi-isodynamic (QI) stellarator: a quasi-omnigeneous (QO) stellarator with magnetic field strength contours that close poloidally. Omnigeneity means that the bounce-averaged radial drift of locally trapped particles vanishes [73]. For a confining field BB, the conditions of omnigineity are [74]:

  1. the contours of Bmax⁡B_{\max} are straight lines in Boozer coordinates;

  2. the magnetic field strength maxima and minima are the same across all field lines;

  3. equal Boozer angular separation δ\delta along a field line between contours of constant magnetic field strength BB (i.e., bounce points) across all field lines;

Does the model reconstruct these equilibrium properties?

To assess property (1), the standard deviation of the toroidal location of the contours of Bmax⁡B_{\max}, σφBmax⁡\sigma_{\varphi B_{\max}}, is considered. In a QO configuration, the Bmax⁡B_{\max} contours are straight lines in Boozer coordinates. Namely,

σφBmax⁡=0.\sigma_{\varphi B_{\max}} = 0.

The model only qualitatively reconstructs the toroidal variance of the contours of Bmax⁡B_{\max} (Figure 20). The contours of Bmax⁡B_{\max} is a local equilibrium property that is affected by how well the model reconstructs the local magnetic field strength.

Reconstruction of the standard deviation of the toroidal location of the contours of $B_{\max}$

Figure 20. Reconstruction of the standard deviation of the toroidal location of the contours of Bmax⁡B_{\max}, σφBmax⁡\sigma_{\varphi B_{\max}}. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction.

To assess property (2), the standard deviation of the extrema of BB on a flux surface across all field lines are assessed, σBmax⁡\sigma_{B_{\max}} and σBmin⁡\sigma_{B_{\min}}. In a QO configuration, σBmax⁡(s)=σBmin⁡(s)=0\sigma_{B_{\max}}(s) = \sigma_{B_{\min}}(s) = 0 across the whole plasma volume.

The model equilibria correctly reproduce the standard deviation of the extrema of BB (Figure 21a and Figure 21b): rmse⁡σBmax⁡=9.43 mT\operatorname{rmse}_{\sigma_{B_{\max}}} = 9.43\ \mathrm{mT}, and rmse⁡σBmin⁡=6.57 mT\operatorname{rmse}_{\sigma_{B_{\min}}} = 6.57\ \mathrm{mT}.

Two-dimensional histograms comparing the reconstructed and VMEC standard deviations of the maxima and minima of the magnetic field strength

Figure 21. Reconstruction of the standard deviation of the (a) maxima σBmax⁡\sigma_{B_{\max}} and (b) minima σBmin⁡\sigma_{B_{\min}} of the magnetic field strength across all field lines on a flux surface. The standard deviation evaluated on ten equally spaced flux surfaces is considered in these figures. The color-bar indicates the counts in each histogram bin. To guide the eye, a red dashed line indicates the case of perfect reconstruction.

The Boozer angular separation δ(s,B,α)\delta(s, B, \alpha) is the angular distance along the field line α\alpha between the BB contours (see Figure 28). In a QO configuration, the angular separation δ(s,B,α)\delta(s, B, \alpha) should be independent of the field line label α\alpha, namely, ∂δ(s,B,α)∂α∣s,B=0\left.\frac{\partial\delta(s,B,\alpha)}{\partial\alpha}\right|_{s,B} = 0. Numerically, such condition can be verified by observing σδ(s,B)=0\sigma_{\delta}(s, B) = 0.

True and predicted magnetic field strength values in Boozer coordinates

Figure 28. True (left) and predicted (right) values for the magnetic field strength BB in Boozer coordinates along a field line in case of the median predicted equilibrium in the test set. The α=0\alpha= 0 field line at s=0.06s = 0.06 (top) and s=0.75s = 0.75 flux surface (bottom) are depicted. The dashed black horizontal line indicates the average magnetic field strength on the flux surface B0B_0. The red crosses highlight the B0B_0 contours, and the Boozer angular separation δ(s,B0,α)\delta(s, B_0, \alpha) between them is shown just beneath.

The Boozer angular separation δ\delta relates to the bounce-averaged radial drift that trapped particles experience. Therefore, it makes sense to assess it only if a clear BB field well, in which particles can be trapped, exists. Not all W7-X magnetic configurations exhibit such a BB field well: the median regressed equilibrium in the test set is not guaranteed to possess it. Therefore, only to assess property (3), the model is evaluated on a small (58 equilibria) out-of-sample set of high-mirror W7-X configurations. The high-mirror W7-X configuration has been constructed to feature a magnetic-mirror like BB field structure, and it is the closest configuration to QI out of the nine W7-X reference configurations. This test set has been constructed as the main data set (see § 4), however, the coil current ratios have been fixed to generate only high-mirror W7-X configurations. Still, finite-β\beta and toroidal current effects are present in the data set. For completeness, § 10.2 presents the δ\delta reconstruction in case of the median regressed equilibrium in the larger test set.

Even if the predicted magnetic field structure does not perfectly overlap with the ground truth field (Figure 10), the model preserves the Boozer angular separation (Figure 22). However, the reconstruction accuracy is better in the core region (Figure 23).

True and predicted values for the magnetic field strength $B$ in Boozer coordinates along a field line

Figure 22. True (left) and predicted (right) values for the magnetic field strength BB in Boozer coordinates along a field line in case of the median predicted equilibrium in the high-mirror out-of-sample test set. The α=0\alpha= 0 field line at the s=0.06s = 0.06 (top) and at the s=0.75s = 0.75 flux surface (bottom) are depicted. The dashed black horizontal line indicates the average magnetic field strength on the flux surface B0B_0. The red crosses highlight the intersections of the field line with the B0B_0 contours, and the Boozer angular separation δ(s,B0,α)\delta(s, B_0, \alpha) between them is shown just beneath.

Plot of true and predicted values of the standard deviation of Boozer separation angle

Figure 23. True (solid pink) and predicted (dashed green) values of the standard deviation of Boozer separation angle σδ(s,B0)=⟨δ(s,B0,α)2⟩α\sigma_\delta(s, B_0) = \sqrt{\langle\delta(s, B_0, \alpha)^2\rangle_\alpha} for the median regressed equilibrium in the high-mirror out-of-sample test set. Without loss of generality, the contour of the average magnetic field strength B0B_0 on each flux surface is considered.

Optimization in the configuration space of W7-X

The exploration and optimization of the W7-X magnetic configuration space serve to further investigate how faithfully the NN model reproduces equilibrium properties, and to validate its use in downstream tasks. For example, [69, 75, 76] proposed the a posteriori optimization of coil currents to further improve the equilibrium properties, and to recover inevitable errors that occur during the coils manufacturing and placement. Moreover, especially in case of an island divertor that relies on a robust edge magnetic topology, it is desirable to include finite-β\beta effects in the optimization.

A fast, free-boundary ideal-MHD equilibrium model benefits such optimization. In this work, W7-X configurations are targeted due to the limitations of the training data. However, the proposed technique can be applied to any present or future device once a training data set is generated. The optimizations carried out in this work represent toy examples of real-world applications. Indeed, the proposal of new, optimized W7-X configurations is beyond the scope of this paper.

The equilibrium solution provided by the NN is differentiable. The analytic gradient of equilibrium properties (e. g., the magnetic well) with respect to the magnetic configuration and plasma profiles is available at no additional cost via automatic differentiation (AD). In a gradient-based optimization, a single equilibrium evaluation is sufficient in each optimization step (regardless of the number of free parameters). In contrast, when finite-differences approximate the objective function gradient, the number of equilibrium evaluations each step scales linearly with the number of free parameters.

Both magnetic configuration and finite-β\beta effects are included in the optimization. The search space is a subset of the NN model input parameters: the W7-X non-planar i[2,…,5]i_{[2,\ldots,5]} and planar i[A,B]i_{[A,B]} coil current ratios, the toroidal magnetic flux at the edge Φedge\Phi_{\mathrm{edge}}, and the pressure on axis p0p_0. The pressure profile shape is fixed, and it is assumed to be of the form p(s)=p0(1−s)2p(s)=p_0(1-s)^2. Moreover, we assume the toroidal plasma current to vanish (i. e., Itor(s)=0I_{\mathrm{tor}}(s)=0).

To avoid extrapolation, the search space is bounded by the distribution of the input parameters as seen during training. Denoting p⃗=[p1,…,pd]∈Rd\vec{p}=[p_1,\ldots,p_d]\in\mathbb{R}^d the optimization vector, each input parameter pip_i is bounded by [μi−cσi,μi+cσi][\mu_i-c\sigma_i,\mu_i+c\sigma_i], where μi\mu_i and σi\sigma_i are the mean and the standard variation of the distribution of pip_i, respectively. c=3c=\sqrt{3} for the parameters that have been uniformly sampled in the training data, and c=2c=2 for all the others. The configuration with pi=μi ∀ip_i=\mu_i\ \forall i serves as initial guess (i. e., the average configuration seen during training).

The objective function is the weighted sum of the squared residual between the proposed and target equilibrium properties:

f(p⃗)=∑iwi(fi(p⃗)−fi∗)2,(58)f(\vec{p})=\sum_i w_i(f_i(\vec{p})-f_i^*)^2, \tag*{(58)}

where fi∗f_i^* is a target equilibrium property, fi(p⃗)f_i(\vec{p}) is the proposed equilibrium property, and wiw_i is the weight of each residual term. Such form of the objective function is usually employed in stellarator optimization frameworks [77, 78] [62].

A combination of the global tree-structured Parzen estimator (TPE) algorithm from hyperopt [79] and the local limited-memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) [80] algorithm from scipy [81] drives the optimization. Whenever possible, AD computes the analytical Jacobian of the objective function. On the other hand, if the analytical Jacobian is not available, (e.g., an objective function term requires an external software package that breaks the model computational graph), finite differences approximate the Jacobian.

Negative well

Almost all W7-X configurations in the training set feature a positive magnetic well (Figure 24). W7-X was optimized with respect to good MHD stability [6], therefore, in general, a positive magnetic well is to be expected.

Figure 24. The distribution of the vacuum magnetic well depth W‾vacuum\overline{W}_{\mathrm{vacuum}} for all equilibria in the training set.

Can the model generalize to negative well configurations? To search for a negative well configuration, a small, but negative magnetic well depth is targeted: W‾vacuum∗=−0.01\overline{W}_{\mathrm{vacuum}}^{*} = -0.01 and wW‾vacuum=104w_{\overline{W}_{\mathrm{vacuum}}} = 10^4. Finite-β\beta effects deepen the magnetic well, therefore, the search is performed in the limit of vacuum configurations. After 500 iterations of TPE, L-BFGS refines the best configuration.

Although the NN model has rarely seen a negative well configuration during training, it can reliably predict equilibria with a negative well (Table 5). The optimization converged to a configuration for which the model predicts a magnetic well depth of −0.01-0.01. The configuration has been evaluated also with VMEC, which reports a magnetic well depth of −0.009-0.009. Indeed, the vacuum magnetic well (W(ψ)=d2Vp(ψ)dψ2W(\psi) = \frac{\mathrm{d}^2 V_p(\psi)}{\mathrm{d}\psi^2}) is negative (Figure 25).

QuantityValue
i1i_{1}1.000
i2i_{2}1.027
i3i_{3}0.689
i4i_{4}0.614
i5i_{5}0.614
iAi_{A}0.205
iBi_{B}0.263
W‾vacuum∗\overline{W}_{\mathrm{vacuum}}^{*}−0.010-0.010
W‾vacuum\overline{W}_{\mathrm{vacuum}} NN−0.010-0.010
W‾vacuum\overline{W}_{\mathrm{vacuum}} VMEC−0.009-0.009

Table 5. Relative magnitude of the non-planar and planar W7-X coil currents for the negative well configuration. W‾vacuum∗=−0.01\overline{W}_{\mathrm{vacuum}}^{*} = -0.01 is the small, negative magnetic well depth targeted in the optimization. In case of the obtained configuration, the NN model predicts W‾vacuum=−0.010\overline{W}_{\mathrm{vacuum}} = -0.010, and VMEC computes W‾vacuum=−0.009\overline{W}_{\mathrm{vacuum}} = -0.009.

Figure 25. The magnetic well of the obtained W7-X negative well configuration (green) as evaluated by VMEC. For comparison, the magnetic well of the W7-X standard reference configuration (blue) is also shown (the W7-X standard configuration has a positive magnetic well). Numerical noise in the finite difference scheme invalidates the values at s∈[0,0.01]s \in[0, 0.01] (see § 5).

Improved fast particle confinement

A classical stellarator does not confine fast particles as good as a tokamak, therefore, the magnetic geometry has to be optimized to do so. W7-X standard and high-mirror configurations have been optimized to improve fast particle confinement at high-β\beta. Moreover, [69, 75] have also found improved configurations.

Can we use the model to search for a W7-X fast particle optimized configuration? To address this question, we employ a similar objective function to the function used for the min-max configuration in [69], and we investigate whether the optimized configuration shows the same performance in terms of fast particle confinement.

In a perfect QI configuration, the variance of the extrema of the magnetic field strength across all field lines vanishes. As in the case of the min-max configuration, the variance of BB at the bean-shaped cross-section (i. e., φ=0\varphi= 0 or the Bmax⁡B_{\max}-contour) and at the triangular cross-section (i. e., φ=π/Nfp\varphi= \pi/N_{\mathrm{fp}} or the Bmin⁡B_{\min}-contour) is minimized. The flux surface at s=0.015s = 0.015 is targeted (roughly 6 cm from the magnetic axis). The optimization is performed at a fixed Φedge\Phi_{\mathrm{edge}} value. No toroidal current is assumed in the plasma. The objective function is:

f=wB(Var⁡Bmax⁡+Var⁡Bmin⁡)+w⟨β⟩(⟨β⟩−⟨β⟩∗)2+wmr(mr−mr∗)2,(59)f = w_B(\operatorname{Var} B_{\max} + \operatorname{Var} B_{\min}) + w_{\langle\beta\rangle}(\langle\beta\rangle- \langle\beta\rangle^*)^2 + w_{mr}(mr - mr^*)^2, \tag*{(59)}

where Var⁡Bmax⁡\operatorname{Var} B_{\max} and Var⁡Bmin⁡\operatorname{Var} B_{\min} are the variances of the magnetic field strength at the bean-shaped and triangular cross-section, respectively, and

mr=⟨B(θ,φ=0)−B(θ,φ=π/Nfp)B(θ,φ=0)+B(θ,φ=π/Nfp)⟩θ,(60)mr = \left\langle\frac{B(\theta,\varphi=0)-B(\theta,\varphi=\pi/N_{\mathrm{fp}})}{B(\theta,\varphi=0)+B(\theta,\varphi=\pi/N_{\mathrm{fp}})} \right\rangle_\theta, \tag*{(60)}

is a mirror factor to ensure that the extrema of the magnetic field strength are located at the correct angular position (maxima at φ=0\varphi=0 and minima at φ=π/Nfp\varphi=\pi/N_{\mathrm{fp}}). ⟨β⟩∗=2%\langle\beta\rangle^* = 2\% and mr∗=10%mr^* = 10\% (like in the W7-X high-mirror configuration). Finally, wB=102w_B = 10^2, w⟨β⟩=103w_{\langle\beta\rangle} = 10^3, and wmr=102w_{mr} = 10^2. The optimization is carried out for 500 iterations of the TPE algorithm.

SIMPLE [82, 83] assess the fraction of lost particles from the plasma volume. 10410^{4} particles at 60 keV are launched from s=0.06s = 0.06, and their trajectories are followed for 0.1 s, or till they are lost from the computational domain. The optimized configuration is compared against the W7-X standard, high-mirror and min-max configurations. All configurations have been scaled to have the same magnetic field strength on axis B(φ=0)≃2.52B(\varphi= 0) \simeq2.52 T, the same plasma beta ⟨β⟩≃2\langle\beta\rangle\simeq2 %, and the same plasma volume Vp≃30V_{\mathrm{p}} \simeq30 m3^{3}. The optimized configuration confines fast particles better than the standard and high-mirror configurations, and as well as the min-max configuration (Figure 26): the total fraction of lost particles after 0.1 s is only 8.86 % (Table 6).

QuantityValue
i1i_{1}1.000
i2i_{2}0.737
i3i_{3}0.889
i4i_{4}0.776
i5i_{5}0.899
iAi_{A}0.011
iBi_{B}−0.149-0.149
Lost fraction8.86 %

Table 6. Relative magnitude of the non-planar and planar W7-X coil currents for the ⟨β⟩=2\langle\beta\rangle= 2 % fast particle confinement optimized configuration. The total fraction of lost 60 keV fast ions initialized at s=0.06s = 0.06 is reported.

Figure 26. The fraction of lost particles for the W7-X standard, high-mirror, min-max, and optimized configuration at ⟨β⟩=2%\langle\beta\rangle= 2\%.

Discussion and conclusion

We propose a NN model that quickly approximates the ideal-MHD solution operator in a stellarator geometry. The model correctly predicts the equilibrium solution, and it faithfully reconstructs global equilibrium properties and proxy functions that are commonly used in stellarator optimization frameworks. Compared with previous data-driven approaches, the model fulfils equilibrium symmetries by construction. In addition, the MHD force residual regularizes the model to better satisfy the ideal-MHD equations.

The error between the model and the ground truth equilibrium solution is less than 1 mm in case of the flux surface locations. However, mainly due to the high condition number of the equilibrium problem, the model equilibria only poorly minimize the MHD force residual. Yet, the model predictions can be improved at inference time to yield better than ground truth equilibria (i. e., equilibria that minimize the MHD force residual better than the ground truths).

Equilibrium properties that are highly sensitive to the magnetic field structure cannot be precisely reconstructed. The magnetic field depends on first-order derivatives of the equilibrium solution, therefore, even small errors in the equilibrium geometry might lead to large discrepancies in the computed magnetic field. Nevertheless, the magnetic field strength is smoothly reconstructed in the core region, but the model introduces artificial field ripples at the edge. As a consequence, the model fails to meet the required magnetic field accuracy to faithfully compute some quantities of interest (e. g., the effective ripple, which is a measure of neoclassical transport). Still, the accuracy of the model is sufficient to explore and optimize W7-X magnetic configurations, in terms of ideal-MHD stability and fast particle confinement. This result suggests that NN-based surrogate models can be used to find optimized configurations for current and future stellarator devices.

The model has still many limitations. The NN is trained in a supervised learning fashion, therefore, the training data limit the applicability of the model (the model can only approximate W7-X equilibria). Moreover, noise-free plasma profiles are assumed. Finally, the model accuracy on the magnetic field limits its use in tasks that are highly sensitive to it.

This work can be improved along multiple dimensions. The robustness of the model with respect to experimental noise can be investigated and enhanced with established robustness and regularization techniques: injecting noise to the input plasma profiles and training the convolutional layers with dropout. The artificial field ripples introduced by the model can be ameliorated by adding a regularization term on the second-order radial derivative (e. g., ∂2R∂s2\frac{\partial^{2} R}{\partial s^{2}}), or by replacing the learned trunk network functions with an orthonormal set of basis functions (e.g., Legendre polynomials). In addition, the model can be trained on an extended space of stellarator equilibria, relaxing the constraint of W7-X configurations. Finally, equilibrium reconstructions in a stellarator geometry must be demonstrated.

Contrary to a tokamak, the computation of MHD equilibria is a limiting factor in stellarator research and design. Fast, differentiable and accurate three-dimensional MHD equilibrium solutions would reduce the gap between tokamaks and stellarators. In particular, they would enable: real-time equilibrium reconstructions [84, 85], first-principles flight simulators [8], data-driven plasma control [86], and extensive understanding and exploration of the stellarator optimization space.

Author Statement

The contributions to this paper are described using the CRediT taxonomy [87]:

Andrea Merlo Conceptualization, Data Curation, Formal Analysis, Investigation, Methodology, Software, Visualization, Writing - original draft, Writing - review & editing.

Daniel Böckenhoff Methodology, Software, Supervision, Validation, Writing - review & editing. Jonathan Schilling Formal Analysis, Methodology.

Samuel Aaron Lazerson Supervision, Writing – review & editing.

Thomas Sunn Pedersen Conceptualization, Funding acquisition, Supervision.

Acknowledgement

We wish to acknowledge the helpful discussions on the limitations of this work with Ralf Schneider. Furthermore, we are indebted to the communities behind the multiple open-source software packages on which this work depends: hydra [88], hyperopt [79], matplotlib [89], numpy [90], pytorch [91], pytorch lightning [92], scipy [81].

The data sets were generated on the Max Planck computing and data facility (MPCDF) cluster “CO-BRA”, Germany. Financial support by the European Social Fund (ID: ESF/14-BM-A55-0007/19) and the Ministry of Education, Science and Culture of Mecklenburg-Vorpommern, Germany via the project “NEISS” is gratefully acknowledged. This work has been carried out within the framework of the EUROfusion Consortium, funded by the European Union via the Euratom Research and Training Programme (Grant Agreement No 101052200 — EUROfusion). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.

Appendix

Equilibria Fourier scaling

A trade-off must be struck between model capacity and computational complexity. Given the poloidal and toroidal expansions of the equilibrium solution in Fourier series, the number of Fourier modes utilized to represent the solution limits its accuracy: a large number of Fourier modes enhances the model accuracy. On the other hand, it increases the computational complexity of the model, as well as the training and inference times. How many Fourier modes are adequate?

To examine such trade-off, the approximation error on magnetic field strength is investigated. One of the objectives of this study is to investigate the precision with which the model reconstructs equilibrium properties. The magnetic field strength is one of the critical equilibrium properties. Therefore, the Fourier resolution of the equilibrium solution should not be the largest source of error in representing the field strength.

To represent the magnetic field strength with an error of less than 1%, up to m=8m = 8 poloidal and ∣n∣=11|n| = 11 toroidal models are required. Figure 27 shows the magnetic field approximation error when the Fourier resolution is varied, using VMEC equilibria with up to m=11m = 11 and ∣n∣=12|n| = 12 Fourier modes as “high-fidelity” references.

Approximation error on the magnetic field strength for reduced Fourier mode representations

Figure 27. The approximation error on the magnetic field strength when representing the equilibrium solution {R,λ,Z}\{R,\lambda,Z\} with a reduced number of Fourier modes. The equilibrium with up to m=11m=11 poloidal and ∣n∣=12|n|=12 toroidal mode is taken as a reference. The solid line represents the average error across 128 randomly sampled equilibria in the data set, and the shaded region represents the 95 % and 5 % quantiles. W7-X has a mean field ≃2.5\simeq2.5 T, therefore, a field error of 25 mT represents a 1 % error.

Model architecture and HP

The trunk network maps the radial dimension ss into a set of non-linear basis functions, in which the XmnjX_{mn}^{j} Fourier coefficients and tt profile are radially expanded (see § 3.2). Each Fourier coefficient and tt has its own set of basis functions. The input dimension is Nti=1N_{\mathrm{ti}} = 1, and the output dimension is Nto=(NXmnj+Nt)Ntb=4696N_{\mathrm{to}} = (N_{X_{mn}^{j}} + N_{t})N_{\mathrm{tb}} = 4696, where NXmnj=3[(mpol+1)(2ntor+1)−ntor]−2=586N_{X_{mn}^{j}} = 3[(m_{\mathrm{pol}} + 1)(2n_{\mathrm{tor}} + 1) - n_{\mathrm{tor}}] - 2 = 586 is the number of Fourier modes used to represent (R,Λ,Z)(R,\Lambda,Z), mpol=8m_{\mathrm{pol}} = 8 is the highest Fourier poloidal mode, ntor=11n_{\mathrm{tor}} = 11 is the highest Fourier toroidal mode, Nt=1N_t = 1 is the single output needed to represent the iota profile, and Ntb=8N_{\mathrm{tb}} = 8 is the number of trunk basis functions per output.

The trunk network is a MLP network with sigmoid linear unit (SiLU) as non-linear activation functions (table 7). Each layer is initialized accordingly to [93].

The branch network maps the MHD parameters and input plasma profiles into the weighting coefficients of the trunk basis functions (see § 3.2). A profile head extracts high-level features from the input profiles into a latent representation. A set of blocks made of one 1D convolutional and pooling layers composes the profile head. The branch body then processes the concatenation of the profile latent representation with the input scalar parameters. The output dimension is Nbo=(NXmnj+Nt)(Ntb+2)=5870N_{\mathrm{bo}} = (N_{X_{mn}^{j}} + N_t)(N_{\mathrm{tb}} + 2) = 5870, where the “+2” is for the constant and identity functions.

The branch body is a MLP network with SiLU as non-linear activation functions (Table 7). Each layer is initialized accordingly to [93]. The last layer is initialized at the median value of the model outputs evaluated on 20 % of the training data set.

HPvalue
depth4
width2048
trunk basis8
activation functionSiLU

Table 7. HPs of the trunk network. See § 3.2 for details on the model macro-architecture.

The overall training process is divided in three different stages (see § 4.3): data, gradient, and physics regularization stages. During the data stage, the learning rate is decreased accordingly to an exponential decay schedule with γ\gamma as decay constant. During the gradient and physics regularization stages, the learning is kept constant. Only after the first step of the curriculum learning procedure in the physics regularization stage, the learning rate is decreased by a factor of 10. In addition, in every training stage, the norm of the model gradients is clipped. Tables 9 to 11 list the HPs in each training stage. Table 12 lists the HPs for the fine-tuning procedure.

HPvalue
initial learning rate1.0×10−41.0 \times10^{-4}
γ\gamma9.996×10−19.996 \times10^{-1}
L2L^2 regularization1.0×10−11.0 \times10^{-1}
αb\alpha_b2.495×10−12.495 \times10^{-1}
αI\alpha_I5.0×10−15.0 \times10^{-1}
αMHD\alpha_{\mathrm{MHD}}1.0×10−31.0 \times10^{-3}
gradient clip1.0×10−21.0 \times10^{-2}

Table 12. HPs for the fine-tuning procedure.

HPvalue
Profile Head
depth2
convolution kernel size5
convolution stride2
convolution padding0
filters16
pooling kernel size3
pooling stride2
pooling padding0
Body
depth5
width2048
activation functionSiLU

Table 8. HPs of the branch network. See § 3.2 for details on the model macro-architecture.

HPvalue
batch size128
initial learning rate8.0×10−48.0 \times10^{-4}
γ\gamma9.9×10−19.9 \times10^{-1}
L2L^2 regularization6.0×10−26.0 \times10^{-2}
αR\alpha_R2.5×10−12.5 \times10^{-1}
αZ\alpha_Z2.5×10−12.5 \times10^{-1}
αλ\alpha_\lambda2.5×10−12.5 \times10^{-1}
αt\alpha_t2.5×10−12.5 \times10^{-1}
patience epochs150
gradient clip1.0×10−21.0 \times10^{-2}

Table 9. HPs for the data training stage.

Derivation of MHD force residual

This section shows how the MHD force residual can be derived once the mapping x⃗=(R,λ,Z)\vec{x} = (R,\lambda,Z), as well as the p(s)p(s) and −ι(s)-\iota(s) profiles, are known. As an example, FβF_\beta is derived; FsF_s can be derived in a similar manner.

Let us recall that:

Fβ=Js=1μ0g(∂Bφ∂θ−∂Bθ∂φ),(61)F_\beta= J^s = \frac{1}{\mu_0\sqrt{g}}\left(\frac{\partial B_\varphi}{\partial\theta}-\frac{\partial B_\theta}{\partial\varphi}\right), \tag*{(61)}

where g\sqrt{g} is the Jacobian of the 3D coordinate transformation f:(s,θ,φ)→(R,ϕ,Z)f:(s,\theta,\varphi)\to(R,\phi,Z), and it is expressed as g=(e⃗s⋅e⃗θ×e⃗φ)\sqrt{g}=(\vec{e}_s\cdot\vec{e}_\theta\times\vec{e}_\varphi). Recalling the definition of the covariant basis vectors (see § 2.1), the choice of φ=ϕ\varphi=\phi effectively yields a 2D Jacobian:

g=R(∂R∂θ∂Z∂s−∂R∂s∂Z∂θ).(62)\sqrt{g}=R\left(\frac{\partial R}{\partial\theta}\frac{\partial Z}{\partial s}-\frac{\partial R}{\partial s}\frac{\partial Z}{\partial\theta}\right). \tag*{(62)}

The covariant magnetic field components (see equations (8) and (9)) are connected to the contravariant magnetic field components (see equations (5) and (6)) through the covariant metric tensor elements:

gij=e⃗i⋅e⃗j=∂R∂αi∂R∂αj+R2∂ϕ∂αi∂ϕ∂αj+∂Z∂αi∂Z∂αj.(63)g_{ij}=\vec{e}_i\cdot\vec{e}_j=\frac{\partial R}{\partial\alpha_i}\frac{\partial R}{\partial\alpha_j}+R^2\frac{\partial\phi}{\partial\alpha_i}\frac{\partial\phi}{\partial\alpha_j}+\frac{\partial Z}{\partial\alpha_i}\frac{\partial Z}{\partial\alpha_j}. \tag*{(63)}

Appendix

HPvalue
batch size32
initial learning rate1.0×10−51.0 \times10^{-5}
γ\gamma1
L2L^2 regularization6.0×10−26.0 \times10^{-2}
αR\alpha_R2.4×10−12.4 \times10^{-1}
αZ\alpha_Z2.4×10−12.4 \times10^{-1}
αλ\alpha_\lambda2.4×10−12.4 \times10^{-1}
αt\alpha_t2.4×10−12.4 \times10^{-1}
αRs\alpha_{R_s}1.0×10−21.0 \times10^{-2}
αZs\alpha_{Z_s}1.0×10−21.0 \times10^{-2}
αλs\alpha_{\lambda_s}1.0×10−21.0 \times10^{-2}
αt′\alpha_{t'}1.0×10−21.0 \times10^{-2}
patience epochs150
gradient clip1.0×10−21.0 \times10^{-2}

Table 10. HPs for the gradient training stage.

HPvalue
batch size32
initial learning rate1.0×10−61.0 \times10^{-6}
γ\gamma1
L2L^2 regularization6.0×10−26.0 \times10^{-2}
αR\alpha_R2.4×10−12.4 \times10^{-1}
αZ\alpha_Z2.4×10−12.4 \times10^{-1}
αλ\alpha_\lambda2.4×10−12.4 \times10^{-1}
αt\alpha_t2.399×10−12.399 \times10^{-1}
αRs\alpha_{R_s}1.0×10−21.0 \times10^{-2}
αZs\alpha_{Z_s}1.0×10−21.0 \times10^{-2}
αλs\alpha_{\lambda_s}1.0×10−21.0 \times10^{-2}
αt′\alpha_{t'}1.0×10−21.0 \times10^{-2}
αMHD\alpha_{\mathrm{MHD}}1.0×10−41.0 \times10^{-4}
patience epochs50
gradient clip1.0×10−21.0 \times10^{-2}

Table 11. HPs for the physics regularization training stage.

Finally, the expression for FβF_\beta reads:

Fβ=Φ′μ0g{∂∂θ[1g[(ι−∂λ∂φ)(∂R∂θ∂R∂φ+∂Z∂θ∂Z∂φ)+(1+∂λ∂θ)(∂R∂φ∂R∂φ+R2+∂Z∂φ∂Z∂φ)]]+(64)F_\beta= \frac{\Phi'}{\mu_0\sqrt{g}}\left\{\frac{\partial}{\partial\theta}\left[\frac{1}{\sqrt{g}}\left[\left(\iota-\frac{\partial\lambda}{\partial\varphi}\right)\left(\frac{\partial R}{\partial\theta}\frac{\partial R}{\partial\varphi}+\frac{\partial Z}{\partial\theta}\frac{\partial Z}{\partial\varphi}\right)+\left(1+\frac{\partial\lambda}{\partial\theta}\right)\left(\frac{\partial R}{\partial\varphi}\frac{\partial R}{\partial\varphi}+R^2+\frac{\partial Z}{\partial\varphi}\frac{\partial Z}{\partial\varphi}\right)\right]\right]+\right. \tag*{(64)}
−∂∂φ[1g[(ι−∂λ∂φ)(∂R∂θ∂R∂θ+∂Z∂θ∂Z∂θ)+(1+∂λ∂θ)(∂R∂φ∂R∂θ+∂Z∂φ∂Z∂θ)]]}.(65)\left.-\frac{\partial}{\partial\varphi}\left[\frac{1}{\sqrt{g}}\left[\left(\iota-\frac{\partial\lambda}{\partial\varphi}\right)\left(\frac{\partial R}{\partial\theta}\frac{\partial R}{\partial\theta}+\frac{\partial Z}{\partial\theta}\frac{\partial Z}{\partial\theta}\right)+\left(1+\frac{\partial\lambda}{\partial\theta}\right)\left(\frac{\partial R}{\partial\varphi}\frac{\partial R}{\partial\theta}+\frac{\partial Z}{\partial\varphi}\frac{\partial Z}{\partial\theta}\right)\right]\right]\right\}. \tag*{(65)}

FβF_\beta depends only on x⃗\vec{x}, its first and second derivatives, and ι\iota.

Physics regularization

The proxy of the MHD force residual f∗f_* is derived as follows.

F⃗=−J⃗×B⃗+∇⃗p,(66)\vec{F}=-\vec{J}\times\vec{B}+\vec{\nabla}p, \tag*{(66)}
∇⃗×B⃗=μ0J⃗,(67)\vec{\nabla}\times\vec{B}=\mu_0\vec{J}, \tag*{(67)}
∇⃗⋅B⃗=0.(68)\vec{\nabla}\cdot\vec{B}=0. \tag*{(68)}

The magnetic field can be written in contravariant form as:

B⃗=Bθe⃗θ+Bφe⃗φ,(69)\vec{B}=B^\theta\vec{e}_\theta+B^\varphi\vec{e}_\varphi, \tag*{(69)}
Bθ=1g(χ′−Φ′∂λ∂φ),(70)B^\theta=\frac{1}{\sqrt{g}}\left(\chi'-\Phi'\frac{\partial\lambda}{\partial\varphi}\right), \tag*{(70)}
Bφ=Φ′g(1+∂λ∂θ).(71)B^\varphi=\frac{\Phi'}{\sqrt{g}}\left(1+\frac{\partial\lambda}{\partial\theta}\right). \tag*{(71)}

By substituting the expression of B⃗\vec{B} into F⃗\vec{F}, the covariant form of the MHD force is:

F⃗=Fs∇⃗s+Fββ⃗,(72)\vec{F}=F_s\vec{\nabla}s+F_\beta\vec{\beta}, \tag*{(72)}
Fs=g(JφBθ−JθBφ)+p′,(73)F_s=\sqrt{g}\left(J^\varphi B^\theta-J^\theta B^\varphi\right)+p', \tag*{(73)}
Fβ=Js,(74)F_\beta=J^s, \tag*{(74)}

where β⃗=g(Bφ∇⃗θ−Bθ∇⃗φ)\vec{\beta}=\sqrt{g}\left(B^\varphi\vec{\nabla}\theta-B^\theta\vec{\nabla}\varphi\right).

The contravariant components of the current density, Ji=J⃗⋅∇⃗αi=1μ0(∇⃗×B⃗)⋅∇⃗αiJ^i=\vec{J}\cdot\vec{\nabla}\alpha_i=\frac{1}{\mu_0}\left(\vec{\nabla}\times\vec{B}\right)\cdot\vec{\nabla}\alpha_i, are:

Js=1μ0g(∂Bφ∂θ−∂Bθ∂φ)(75)J^s=\frac{1}{\mu_0\sqrt{g}}\left(\frac{\partial B^\varphi}{\partial\theta}-\frac{\partial B^\theta}{\partial\varphi}\right) \tag*{(75)}
Jθ=1μ0g(∂Bs∂φ−∂Bφ∂s)(76)J^\theta=\frac{1}{\mu_0\sqrt{g}}\left(\frac{\partial B_s}{\partial\varphi}-\frac{\partial B_\varphi}{\partial s}\right) \tag*{(76)}
Jφ=1μ0g(∂Bθ∂s−∂Bs∂θ)(77)J^\varphi=\frac{1}{\mu_0\sqrt{g}}\left(\frac{\partial B_\theta}{\partial s}-\frac{\partial B_s}{\partial\theta}\right) \tag*{(77)}

By substitute the contravariant current density components in the radial force component, it follows that:

Fs=1μ0(Bθ∂Bθ∂s−Bθ∂Bs∂θ−Bφ∂Bs∂φ+Bφ∂Bφ∂s)+p′(78)F_s=\frac{1}{\mu_0}\left(B^\theta\frac{\partial B_\theta}{\partial s}-B^\theta\frac{\partial B_s}{\partial\theta}-B^\varphi\frac{\partial B_s}{\partial\varphi}+B^\varphi\frac{\partial B_\varphi}{\partial s}\right)+p' \tag*{(78)}

Let us define the proxy of the MHD residual as the flux surface averaged force residual norm when Fβ=0F_\beta=0:

f∗=1(2π)2⟨μ0g∥F⃗∥2⟩∣Fβ=0=1(2π)2⟨μ0gFs⟩(79)f_*=\frac{1}{(2\pi)^2}\left\langle\mu_0\sqrt{g}\|\vec{F}\|_2\right\rangle_{|F_\beta=0}=\frac{1}{(2\pi)^2}\left\langle\mu_0\sqrt{g}F_s\right\rangle \tag*{(79)}

where ⟨A⟩=∫02π∫02πA dθdφ\langle A\rangle= \int_{0}^{2\pi}\int_{0}^{2\pi} A\,\mathrm{d}\theta\mathrm{d}\varphi denotes a flux surface average operator (note that the g\sqrt{g} factor is not included in the average operator here).

Substituting the contravariant magnetic field components (see equations (5) and (6)) in equation (79), the following terms result:

⟨gBθ∂Bθ∂s⟩=⟨(χ′−Φ′∂λ∂φ)∂Bθ∂s⟩=χ′∂⟨Bθ⟩∂s+Φ′⟨λ∂Bθ∂s∂φ⟩(80)\left\langle\sqrt{g}B^\theta\frac{\partial B_\theta}{\partial s}\right\rangle= \left\langle\left(\chi' - \Phi'\frac{\partial\lambda}{\partial\varphi}\right)\frac{\partial B_\theta}{\partial s}\right\rangle= \chi'\frac{\partial\langle B_\theta\rangle}{\partial s}+\Phi'\left\langle\lambda\frac{\partial B_\theta}{\partial s\partial\varphi}\right\rangle \tag*{(80)}
⟨gBθ∂Bs∂θ⟩=⟨(χ′−Φ′∂λ∂φ)∂Bs∂θ⟩=χ′⟨∂Bs∂θ⟩+Φ′⟨λ∂Bs∂θ∂φ⟩=Φ′⟨λ∂Bs∂θ∂φ⟩(81)\left\langle\sqrt{g}B^\theta\frac{\partial B_s}{\partial\theta}\right\rangle= \left\langle\left(\chi' - \Phi'\frac{\partial\lambda}{\partial\varphi}\right)\frac{\partial B_s}{\partial\theta}\right\rangle= \chi'\left\langle\frac{\partial B_s}{\partial\theta}\right\rangle+\Phi'\left\langle\lambda\frac{\partial B_s}{\partial\theta\partial\varphi}\right\rangle= \Phi'\left\langle\lambda\frac{\partial B_s}{\partial\theta\partial\varphi}\right\rangle \tag*{(81)}
⟨gBφ∂Bφ∂s⟩=⟨Φ′(1+∂λ∂θ)∂Bφ∂s⟩=Φ′∂⟨Bφ⟩∂s−Φ′⟨λ∂Bφ∂s∂θ⟩(82)\left\langle\sqrt{g}B^\varphi\frac{\partial B_\varphi}{\partial s}\right\rangle= \left\langle\Phi'\left(1+\frac{\partial\lambda}{\partial\theta}\right)\frac{\partial B_\varphi}{\partial s}\right\rangle= \Phi'\frac{\partial\langle B_\varphi\rangle}{\partial s}-\Phi'\left\langle\lambda\frac{\partial B_\varphi}{\partial s\partial\theta}\right\rangle \tag*{(82)}
⟨gBφ∂Bs∂φ⟩=⟨Φ′(1+∂λ∂θ)∂Bs∂φ⟩=Φ′⟨∂Bs∂φ⟩−Φ′⟨λ∂Bs∂φ∂θ⟩=−Φ′⟨λ∂Bs∂φ∂θ⟩.(83)\left\langle\sqrt{g}B^\varphi\frac{\partial B_s}{\partial\varphi}\right\rangle= \left\langle\Phi'\left(1+\frac{\partial\lambda}{\partial\theta}\right)\frac{\partial B_s}{\partial\varphi}\right\rangle= \Phi'\left\langle\frac{\partial B_s}{\partial\varphi}\right\rangle-\Phi'\left\langle\lambda\frac{\partial B_s}{\partial\varphi\partial\theta}\right\rangle= -\Phi'\left\langle\lambda\frac{\partial B_s}{\partial\varphi\partial\theta}\right\rangle. \tag*{(83)}
Equation not extracted
(84)

The ∂λ∂φ\frac{\partial\lambda}{\partial\varphi} and ∂λ∂θ\frac{\partial\lambda}{\partial\theta} terms have been integrated by parts exploiting the fact that λ\lambda and the covariant component of the B field are periodic functions in the poloidal and toroidal directions. The second and fourth terms cancel each other.

In addition, when Fβ=0F_\beta=0 and g≠0\sqrt{g}\ne0, it follows that:

Fβ=Js=1μ0g(∂Bφ∂θ−∂Bθ∂φ)=0→∂Bφ∂θ=∂Bθ∂φ(85)F_\beta=J^s=\frac{1}{\mu_0\sqrt{g}}\left(\frac{\partial B_\varphi}{\partial\theta}-\frac{\partial B_\theta}{\partial\varphi}\right)=0\rightarrow\frac{\partial B_\varphi}{\partial\theta}=\frac{\partial B_\theta}{\partial\varphi} \tag*{(85)}

Therefore, also the second addenda of the first and third terms cancel each other. Then, the MHD force residual proxy is:

(2π)2f∗=⟨μ0gFs⟩=χ′∂⟨Bθ⟩∂s+Φ′∂⟨Bφ⟩∂s+μ0p′⟨g⟩=0(86)(2\pi)^2f_*=\left\langle\mu_0\sqrt{g}F_s\right\rangle=\chi'\frac{\partial\langle B_\theta\rangle}{\partial s}+\Phi'\frac{\partial\langle B_\varphi\rangle}{\partial s}+\mu_0p'\langle\sqrt{g}\rangle=0 \tag*{(86)}

Boozer angular separation on test set

The evaluation of the reconstruction of the Boozer angular separation δ\delta on the test set is shown here. The median regressed equilibrium in the test set does not have a minimum of the magnetic well strength for φ=πNfp\varphi=\frac{\pi}{N_{\mathrm{fp}}}, therefore, the Boozer angular separation δ\delta depicted in Figure 28 does not represent the angular separation between bounce points. Nevertheless, Figure 28 shows how the model smoothly reconstructs the local magnetic field strength close to the magnetic axis, and it introduces artificial field ripples in the edge region.

References

  1. [77]S. P. Hirshman et al. »Transport Optimization and MHD Stability of a Small Aspect Ratio Toroidal Hybrid Stellarator«. In: Physical Review Letters, Vol. 80.3 (Jan. 1998), pages 528–531. DOI: 10.1013/PhysRevLett.80.528.DOI
  2. [78]D. A. Spong et al. »J* Optimization of Small Aspect Ratio Stellarator/Tokamak Hybrid Devices«. In: Physics of Plasmas, Vol. 5.5 (May 1998), pages 1752–1758. DOI: 10.1063/1.872844.DOI
  3. [79]J. Bergstra, D. Yamins and D. Cox. »Making a Science of Model Search: Hyperparameter Optimization in Hundreds of Dimensions for Vision Architectures«. In: International Conference on Machine Learning. Vol. 28. PMLR, Feb. 2013, pages 115–123.
  4. [80]J. Nocedal. »Updating Quasi-Newton Matrices with Limited Storage«. In: Mathematics of Computation, Vol. 35.151 (1980), pages 773–782. DOI: 10.1090/S0025–5718–1980–0572855–7.DOI
  5. [81]P. Virtanen et al. »SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python«. In: Nature Methods, Vol. 17.3 (Mar. 2020), pages 261–272. DOI: 10.1038/s41592–019–0686–2.
  6. [82]C. G. Albert, S. V. Kasilov and W. Kernbichler. »Accelerated Methods for Direct Computation of Fusion Alpha Particle Losses within, Stellarator Optimization«. In: Journal of Plasma Physics, Vol. 86.2 (2020). DOI: 10.1017/S0022377820000203.DOI
  7. [83]C. G. Albert, S. V. Kasilov and W. Kernbichler. »Symplectic Integration with Non-Canonical Quadrature for Guiding-Center Orbits in Magnetic Confinement Devices«. In: Journal of Computational Physics, Vol. 403 (Feb. 2020), page 109065. DOI: 10.1016/j.jcp.2019.109065.DOI
  8. [84]J. R. Ferron et al. »Real Time Equilibrium Reconstruction for Tokamak Discharge Control«. In: Nuclear Fusion, Vol. 38.7 (July 1998), pages 1055–1066. DOI: 10.1088/0029–5515/38/7/308.DOI
  9. [85]X. N. Yue et al. »Fast Equilibrium Reconstruction for Tokamak Discharge Control Based on GPU«. In: Plasma Physics and Controlled Fusion, Vol. 55.8 (June 2013), page 085016. DOI: 10.1088/0741–3335/55/8/085016.DOI
  10. [86]J. Degrave et al. »Magnetic Control of Tokamak Plasmas through Deep Reinforcement Learning«. In: Nature, Vol. 602.7897 (Feb. 2022), pages 414–419. DOI: 10.1038/s41586–021–04301–9.DOI
  11. [87]A. Brand et al. »Beyond Authorship: Attribution, Contribution, Collaboration, and Credit«. In: Learned Publishing, Vol. 28.2 (2015), pages 151–155. DOI: 10.1087/20150211.DOI
  12. [88]O. Yadan. »Hydra«. Meta Research. Oct. 2022.
  13. [89]J. D. Hunter. »Matplotlib: A 2D Graphics Environment«. In: Computing in science & engineering, Vol. 9.03 (2007), pages 90–95. DOI: 10.1109/MCSE.2007.55.DOI
  14. [90]C. R. Harris et al. »Array Programming with NumPy«. In: Nature, Vol. 585.7825 (Sept. 2020), pages 357–362. DOI: 10.1038/s41586–020–2649–2.
  15. [91]A. Paszke et al. »PyTorch: An Imperative Style, High-Performance Deep Learning Library«. In: Advances in Neural Information Processing Systems. Vol. 32. Curran Associates, Inc., 2019.arxiv.org/abs/1912.01703
  16. [92]W. Falcon. »Pytorch Lightning«. In: Vol. 3.6 (2019). DOI: 10.5281/zenodo.3828935.DOI
  17. [93]X. Glorot and Y. Bengio. »Understanding the Difficulty of Training Deep Feedforward Neural Networks«. In: Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics. Vol. 9. JMLR Workshop and Conference Proceedings, Mar. 2010, pages 249–256.
  18. [94]J. Svensson and A. Werner. »Large Scale Bayesian Data Analysis for Nuclear Fusion Experiments«. In: 2007 IEEE International Symposium on Intelligent Signal Processing. Alcala de Henares, Spain: IEEE, 2007, pages 1–6. DOI: 10.1109/WISP.2007.4447579.DOI

Paper details

vlnc:W_9xtz3ass
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents