Although the basic concept of a stellarator was known since the early days of fusion research, advances in computational technology have enabled the modeling of increasingly complicated devices, leading up to the construction of Wendelstein 7-X, which has recently shown promising results. This recent success has revived interest in the nonlinear 3D MHD modeling of stellarators in order to better understand their performance and operational limits. This study reports on the extension of the JOREK code to 3D geometries and on the first stellarator simulations carried out with it. The first simple simulations shown here address the classic Wendelstein 7-A stellarator using a reduced MHD model previously derived by us. The results demonstrate that stable full MHD equilibria are preserved in the reduced model: the flux surfaces do not move throughout the simulation and closely match the flux surfaces of the full MHD equilibrium. Furthermore, both tearing and ballooning modes were simulated, and the linear growth rates measured in JOREK are in reasonable agreement with the growth rates from the CASTOR3D linear MHD code.

The stellarator, having been proposed by Lyman Spitzer in 1951, is one of the oldest plasma confinement concepts potentially applicable as a fusion power plant. However, early stellarators were plagued with problems stemming from neoclassical transport losses, leading to them being largely phased out in favor of tokamaks by the 1970s.2–4 However, improved mathematical models and increased computational power, which became available by the late 1980s, allowed us to overcome the main challenges faced by the stellarator concept. Moreover, the revival of stellarators brought with it a new strategy for fusion research, where numerical modeling drives the development of future machines, as opposed to the traditional strategy, where smaller-scale machines had to be built and experimented on before advancing to larger-scale machines. The creation of Wendelstein 7-X is one example of the successful application of this new strategy. The advantages are clear: not only is it more cost-effective, but it also allows one to consider a much wider range of potential machine designs in a much shorter amount of time.2 

Most of the computational developments mentioned above focused on the optimization of stellarator equilibria. While there has been work on nonlinear magnetohydrodynamic (MHD) simulations of stellarators since the 1970s,5 this area is not as developed as stellarator optimization. Most early studies applied the straight stellarator approximation by neglecting toroidicity,5–7 and it was not until the 2000s that fully 3D geometries were simulated.8,9 At present, several well-known MHD codes exist, with a few of them, including M3D-C1,10 M3D,8 and MIPS,11 having been extended to stellarators. All three of these codes use full MHD on flux-surface-aligned grids, except for MIPS, which uses a cylindrical grid. NIMROD, another major tokamak code, is still in the process of being extended to stellarators,12 although the tokamak capabilities of NIMROD are already enough to simulate a stellarator with an axisymmetric vacuum vessel.13 Also, the FLUXO nonlinear MHD code14 is applicable to stellarator geometries. However, the stellarator capabilities of these codes have not been used much so far. This study reports on a similar extension of JOREK, one of the leading nonlinear MHD codes for tokamaks,1,15,16 to model stellarators. The work consists of two parts: first, a reduced MHD model compatible with three-dimensional geometries was derived by generalizing the ideas of Breslau et al., Izzo et al., and Strauss;17–19 then, this model is implemented in the JOREK code and tested on a simple stellarator. The first part of the work has already been published in previous studies,20,21 and so this study will present the results of the second part of this effort.

As discussed in our previous studies,20,21 the magnetic field ansatz and equations in stellarator-capable reduced MHD involve a magnetic scalar potential χ, which represents the part of the magnetic field that is generated by the coils. In the tokamak limit, this potential reduces to χ=F0ϕ, where ϕ is the toroidal angle; however, a stellarator-capable code using this model will need to allow arbitrary scalar potentials. Fortunately, it is possible to analytically represent an arbitrary χ: since χ is a magnetic field, it must be divergence-free, so Δχ=0. One then needs to find a general solution to the Laplace equation in the toroidal coordinate system (R,z,ϕ). This was done by Dommaschk,22 who provides his solution as a sum over harmonics, where any particular solution is determined by the coefficients of these harmonics. Naturally, each harmonic individually satisfies the Laplace equation. In order to determine the coefficients for a particular equilibrium, one needs to first calculate the vacuum field on an (R,z,ϕ) grid, which we do using the EXTENDER_P code.23 

Using the Dommaschk potential formulation for χ in conjunction with nonaxisymmetric flux-surface-aligned grids allows one to relatively efficiently simulate stellarators. The steps to run a stellarator simulation can then be summarized as follows:

  1. Calculate an equilibrium for the stellarator in question using the GVEC code.24 

  2. Use the output of GVEC to calculate the contribution to the stellarator's magnetic field from the coils (i.e., the curl-free/vacuum field) with the EXTENDER_P code.

  3. Calculate the coefficients for the Dommaschk representation of the scalar potential from the output of EXTENDER_P.

  4. Build a flux-surface-aligned grid from the geometry data in the GVEC solution and import it into JOREK.

  5. Calculate the initial values for the reduced MHD variables from the GVEC solution.

  6. Evolve the system implicitly in time using the stellarator reduced MHD equations in JOREK.

The GVEC24 code mentioned above is a new fixed-boundary 3D MHD equilibrium solver, which follows the ideas of the well-established VMEC code,25,26 assuming nested flux surfaces and using a constraint minimization of the MHD energy. In contrast to VMEC, the radial discretization is based on nonuniform B-splines of arbitrary order, allowing smooth representation of equilibrium quantities.

The rest of this paper is organized as follows. Section II states the reduced MHD equations that will be used throughout the rest of the paper. The same section also discusses the compatibility of full MHD equilibria with reduced MHD and shows that the error introduced by reduced MHD is small. Section III explains how the coefficients of the Dommaschk representation can be calculated from EXTENDER_P output, while Sec. IV explains how the initial conditions for the reduced MHD variables can be calculated from the GVEC equilibrium. In Sec. V, several simulations of stable equilibria in the Wendelstein 7-A stellarator27 are presented to show that spurious instabilities and problems with maintaining equilibrium do not appear. Finally, Sec. VI shows tearing mode simulations in Wendelstein 7-A and benchmarks the growth rates against the CASTOR3D linear MHD code.28,29 Section VII presents a similar benchmark for ballooning modes in the same device. In addition,  Appendix A briefly discusses the new nonaxisymmetric grid feature in JOREK, which allows the stellarator simulations to have flux surface-aligned grids. In  Appendix B, we show that the linearized ideal version of the model presented in Sec. II has a self-adjoint operator, and thus, ideal perturbations will have real eigenvalues.

Throughout this paper, we will use the reduced MHD model that was derived in Ref. 21. The advantage of reduced MHD is that it allows one to use a larger time step than full MHD by eliminating the shortest timescale in the system; even if implicit time stepping is used, accuracy will deteriorate if the time step is too much larger than the shortest timescale. In the tokamak limit, reduced MHD is well tested and can accurately model tearing and ballooning modes in a wide range of betas and resistivities.30 As discussed in Refs. 20 and 21, the full MHD magnetic field can be written as (no approximations)

(1)

where the first term is the part of the magnetic field generated by the coils, the second is field line bending, and the last term mostly corresponds to field compression but also adds a small correction to field line bending. Since the vacuum field χ must be divergence-free, it can be written in terms of Clebsch potentials: χ=ψv×βv. As discussed in Ref. 20, one can construct a Clebsch-type coordinate system with coordinates (ψv,βv,χ); this coordinate system will be used further in this section. Expression (1) can be seen as just the plasma current-induced magnetic field (whose vector potential is Ψχ+Ωψv, with the βV component removed by a gauge transform) added to the coil field. The full MHD velocity can be written as (no approximations)

(2)

The terms approximately separate the MHD waves, with the first term containing Alfvén waves, the second containing slow magnetosonic waves, and the last one containing fast magnetosonic waves. Here, Bv=|χ|. The reduced model is obtained by setting ζ = 0 and Ω = 0, and dropping the component of current perpendicular to χ in Ohm's law. In addition to that, we perform a further reduction in this paper by setting v=0. The removal of v decreases the accuracy of the model and narrows the range of scenarios where it is valid31,32 (note that the model tested in Ref. 30 has v0.); however, the simplified model without v is still applicable to the cases considered here, as will be seen. The resulting model consists of Eqs. (2.9), (2.13), (2.15), and (2.18) from Ref. 21, with ζ, Ω, and v zeroed out,

(3)
(3a)
(3b)
(3c)
(3d)
(3e)
(3f)
where the ideal gas law p=ρRT applies, and the shorthand P=·(Dρ+Dρ)+Sρ was used. The operators are defined as follows:

In addition, [f,g]=Bv1χ·(f×g) is the Poisson bracket of two scalar functions f and g, and (f,g)=f·g is the inner product of their gradients. In the reduced model, the ansatzes (1) and (2) become

(4)

In Eq. (3), η is the resistivity, μ is a viscosity-like parameter (it is not the same as physical dynamic viscosity, as discussed in Ref. 21), μh is the hyperviscosity, ηh is the hyper-resistivity (artificial dissipation parameters in the Φ and Ψ equations, respectively, that can help with numerical stabilization), D is mass diffusion across field lines, κ and κ are the heat conduction coefficients across and along field lines, respectively, and Sρ and Se are the mass and energy sources, respectively. The Ohmic resistivity ηOhm is a separate parameter, which allows one to neglect part of or all of the resistive contribution to internal energy and simply remove that energy from the system, which can be useful if the resistivity is artificially high.

Finally, there are two auxiliary variables: the normalized current in the χ direction j̃=χ·j/Bv2=χ·×B/(μ0Bv2) and the contravariant χ component of vorticity ω̃=χ·ω=χ·×v, both taken with the opposite sign. The definition equations [Eqs. (3e) and (3f)] can be obtained by taking the dot product of χ with the curl of B and v, respectively, and then using the identity f·×Q=·(f×Q), where f is an arbitrary scalar field and Q is an arbitrary vector field. Instead of simply substituting the definition equations [Eqs. (3e) and (3f)] into the rest of the Eq. (3), j̃ and ω̃ were treated as separate variables, each with their own degrees of freedom on the finite element grid. These degrees of freedom are simultaneously evaluated at each time step with the degrees of freedom for the other variables by using the definition equations [Eqs. (3e) and (3f)] alongside with the rest of Eq. (3). This approach, used in combination with transforming the equations to weak form, allows one to avoid second-order derivatives in Eq. (3), except for the hyperviscosity term in Eq. (3a). Second-order derivatives can have discontinuities, as the finite elements in JOREK presently only have G1 continuity.1 This also means that if one tries to represent χ in the finite element basis instead of using the Dommaschk analytical form, one will not be able to avoid discontinuities in the first term on the RHS of Eq. (3a) even after applying integration by parts. In our experience, having discontinuities in the advective terms can decrease numerical accuracy or may lead to numerical instabilities, which was one of the reasons for the existence of ω̃ as a separate variable. A recent development in JOREK allows one to use basis functions with higher-order Gn continuity, where n is a user-selected parameter.33 This will allow one to eliminate j̃ and ω̃ as separate variables; however, it has not been ported to JOREK3D yet.

It is important to note that the Φ evolution equation [Eq. (3a)] was obtained in Ref. 21 by applying a projection operator to the MHD momentum equation

(5)

and then inserting the ansatzes (4). The viscosity and hyperviscosity terms are separately added after the projection operator is applied (see Ref. 21 for more details). The projection operator that produces Eq. (3a) is

(6)

If the v variable is kept in the reduced model, then the following projection operator produces the v evolution equation (not shown here) when applied to Eq. (5):

(7)

The v evolution equation is not included in the model (3) and was not used in any of the simulations presented in this paper, but it will be considered in the equilibrium error discussion, which comprises the remainder of this section.

A natural question that arises when considering reduced MHD is whether or not the reduction preserves equilibria. In other words, if a particular equilibrium solution to the full MHD equations is known, will it also be a solution to the reduced MHD equilibrium equations? As shown in Refs. 1 and 21, a simple argument involving the Grad–Shafranov equation shows that this is indeed the case in the tokamak limit, where the reduced MHD model (3) reduces to the model that was already used in the tokamak version of JOREK. However, this does not work for a general stellarator, where a full MHD equilibrium does not exactly satisfy the reduced MHD equilibrium equations, and a residual force arises and contributes to Eq. (3a). However, it can be shown that this contribution is small using an ordering argument.

Let L be the length scale perpendicular to χ and L be the length scale along χ. Then, defining λL/L as the ordering parameter, the spatial derivatives must satisfy ||λ||. The terms in the full magnetic field (1) are ordered as follows:

and

where Fv=|ψv|. Identifying L, Bv, and Fv as zeroth-order quantities, L=O(1),Bv=O(1),Fv=O(1), it follows that L=O(λ1),=O(1),=O(λ),Ψ=O(λ), and Ω=O(λ2). Meanwhile, the residual force due to the reduction is fres=pj×B=jf×Bfj×B, where B is the reduced MHD magnetic field (4), Bf is the full magnetic field (1), and j and jf are the curls of the corresponding field divided by μ0. Note that the residual force is just the difference between the full and reduced MHD Lorentz forces. It arises due to the neglect of the last term of (1) in reduced MHD and will be present even in the zero β limit. Inserting the ansatzes, the following expression is obtained for the residual force:

(8)

After some algebra, the reduced MHD current can be written as

(9)

where the Einstein summation convention is used, with k,n{ψv,βv,χ} and i{ψv,βv}. Here, g is the metric tensor of the Clebsch-type coordinate system aligned to χ, which was introduced in Ref. 20, qi represents the actual coordinates: qi{ψv,βv}, and ei are the contravariant basis vectors: ei{ψv,βv}. With this, the first term in the residual force (8) expands to

Since j=O(λ2), it is easy to see that the first two terms above are O(λ4) and the third term is O(λ5).

The second term in the residual force (8) can be expanded as

(10)

Note that Ω×ψv=(Ω/βv)χ+(Ω/χ)eβv/J, where eβv=Jχ×ψv is the covariant basis vector in the βv direction in the Clebsch-type coordinate system aligned to χ, and J=[(ψv×βv)·χ]1=1/Bv2 is the Jacobian. Furthermore, since Bv/χ=, one has (Ω×ψv)ψv=gψvβvBvΩ and (Ω×ψv)βv=gβvβvBvΩ. Thus, the first two terms in (10) are O(λ4) and the third term is O(λ2). However, it is easy to see that the third term in (10) is in the kernel of the projection operator (6), and so this term will not contribute to the residual force in the Φ evolution equation [Eq. (3a)]. On the other hand, the third term in (10) is not in the kernel of the projection operator (7), but its image under the operator, which can be written as Bv3[Ω/βv,Ψ], will be canceled by the image of another term, as will be shown below.

The curl of the last term of the full magnetic field (1) can be written as

(11)

Note that the first term in (11) is O(λ2), and the other two terms are O(λ3). Using (11), the third term in the residual force (8) becomes

(12)

Terms of the order λ4 are not written out explicitly in (12), since there is no need to consider them, as it is already established that there is at least an O(λ4) contribution to equation (3a). As can be seen, the O(λ3) term in (12) will be canceled by the projection operator (6) and as such will not contribute to the Φ evolution equation [Eq. (3a)]; however, it will not be canceled by the projection operator (7). Indeed, its image under the operator (7) will be Bv3[Ψ,Ω/βv]. Note that this image is equal to the negative image of the third term in (10), which was discussed above. These two images will cancel, and thus, the lowest order in which the residual force will contribute to the v evolution equation is λ4.

Finally, the last term in the residual force (8) is clearly of order λ4 or higher, so there is no need to consider it in detail like the other terms. In order to compare the residual force contributions to the other terms in Eq. (3a) and the v evolution equation, some more ordering needs to be done. Consider that the shortest timescale in the reduced system is the Alfvén time τAL/cA, where the parallel length scale is used because the Alfvén wave travels along field lines, and so the time derivative is ordered as |/t|1/τA. As such, /t=O(λ). The Φ and v terms in the velocity ansatz are then ordered as

Assuming that the partial and convective terms in the material derivative are of the same order, |/t||v·|, one has Φ,v=O(λ). After identifying ρ=O(1) and p=O(λ2), it is clear that the lowest-order terms in Eq. (5) are O(λ2), and both projection operators (6) and (7) are O(1). As such, the lowest-order terms in both Eq. (3a) and the v evolution equation are O(λ2). Thus, the residual force contribution to the reduced MHD equations is at least two orders of λ higher than the lowest-order terms. In Sec. V, it will be confirmed with numerical simulations that the residual force is indeed small.

Since χ is a solution of the Laplace equation in a torus, it can be represented as a summation over toroidal harmonics

(13)

where F0ϕ corresponds to a tokamak-like toroidal field, n is the toroidal mode number, m is the poloidal mode number, and each harmonic individually satisfies the Laplace equation: Δχn,m=0. Dommaschk gives a more explicit representation for χ,22 

(14)

where a tilde denotes normalization: χ=F0χ̃,R=R0R̃ and z=R0z̃; the normalization factor R0 is the toroidally averaged radial position of the magnetic axis of the vacuum field. The functions Dn,m and Nn,m are defined as

(15)

and

(16)

The coefficients αi, βi, and γi are defined as

(17)

Although not written out explicitly, it can be seen that the coefficients also depend on n, the toroidal mode number of the D or N function that is being evaluated. The expressions above are only well defined if the following conditions on i and n are met: i0 for αi and αi*,i0 and n > i for βi and βi*, and i > 0 for γi and γi*. Otherwise, the corresponding coefficient and its starred version are zero. Finally, the coefficients an,m,bn,m,cn,m, and dn,m in Eq. (14) are what determine a particular configuration and must be calculated from the EXTENDER_P output.

Note that, since the harmonics χn,m are analytically given, the property that Δχn,m=0 is exactly satisfied. This is an important advantage of using the Dommaschk representation for χ instead of the finite element representation (see  Appendix A), as it guarantees that the divergence-free condition on the magnetic field will be satisfied to machine precision. The second advantage is that χ and its derivatives are smooth.

EXTENDER_P provides the values of the three cylindrical components of the vacuum magnetic field, which will be referred to as BE, on an (R,z,ϕ) grid. Setting χ=BE and considering the ϕ component BE,ϕ=ϕ̂·BE=R1χ/ϕ, one has the following:

(18)

We will make use of the properties [from Ref. 22, Eqs. (10) and (11)] Dn,m|R̃=1=z̃m/m! and Nn,m|R̃=1=0. Evaluating Eq. (18) at R̃=1 gives

(19)

If one also evaluates at z̃=0 and integrates over ϕ, F0 can be calculated

(20)

To calculate the coefficients an,m and bn,m, one must first multiply by either sinnϕ or cosnϕ and then use the orthogonality property of trigonometric functions

(21)

The number of terms M in the summations over m in Eq. (21) that is necessary to accurately represent the magnetic field is usually less than the number of poloidal modes used in the GVEC equilibrium. In practice, it is best to scan through different values of M, starting with the number of poloidal modes and decreasing from there while trying to minimize the error in χ as compared to BE. Note that using higher values of M than necessary can lead to higher errors away from the R̃=1 surface due to overfitting, as the integration in Eqs. (22), (23), (26), and (27), which will be derived shortly, is only over the R̃=1 surface. Figure 1 shows the volume-averaged relative squared error of the Dommaschk potential representation as a function of the number M of poloidal modes kept in a Wendelstein 7-A equilibrium with β=2.3×103% (see Sec. V for more details about this equilibrium).

FIG. 1.

The volume-averaged squared relative error of the Dommaschk potential representation (χBE)2/BE2 as a function of the number of poloidal modes M. The values shown in this plot were calculated using a Python implementation of Dommaschk potentials based on the one written by Paul Huslage for the BOUT++ code.34,35

FIG. 1.

The volume-averaged squared relative error of the Dommaschk potential representation (χBE)2/BE2 as a function of the number of poloidal modes M. The values shown in this plot were calculated using a Python implementation of Dommaschk potentials based on the one written by Paul Huslage for the BOUT++ code.34,35

Close modal

One can convert equations (21) into two linear algebraic systems with triangular matrices by changing the variable to z=z̃/Z and, after multiplying both equations by a Legendre polynomial Pi(z), integrating from −1 to 1. Here, Z is determined as follows. In each poloidal plane at R̃=1,z̃[z̃(ϕ),z̃+(ϕ)], so Z<minϕ{z̃(ϕ),z̃+(ϕ)}. The value of Z is chosen to be slightly smaller than the minimum to avoid using the components of BE close to the boundary, where the output of EXTENDER_P can be less accurate. There is some freedom in choosing the specific value of Z, and it may take some trial and error to find the best value. As an example, Fig. 2 shows a segment of the surface of integration in one field period of the Wendelstein 7-A equilibria as described in Sec. V.

FIG. 2.

The surface of integration for calculating Dommaschk potential coefficients, R = R0, ZzZ, in one field period of Wendelstein 7-A.

FIG. 2.

The surface of integration for calculating Dommaschk potential coefficients, R = R0, ZzZ, in one field period of Wendelstein 7-A.

Close modal

The Legendre polynomials are orthogonal to monomials of a lower order than the polynomial, since a monomial zm can be expanded exactly in the Legendre polynomial basis of the same order m

Using the orthogonality property discussed above, one has, starting with i = M and descending to i = 0, the following linear algebraic system for an,m:

(22)

where zi,Pj(z)=11ziPj(z)dz. Similarly, for the coefficient bn,m, one has the following linear algebraic system:

(23)

As can be seen, both of these systems of equations have triangular matrices.

At this point, the equations for the coefficients cn,m and dn,m have yet to be determined. Consider now the R component of BE: BE,R=R̂·BE=χ/R. One has the following:

(24)

Again, evaluating at R̃=1 and using the properties Dn,m/R̃|R̃=1=0 and Nn,m/R̃|R̃=1=z̃m/m! [also from Ref. 22, Eqs. (10) and (11)], one has the following:

(25)

From here, it is straightforward to follow the same steps as for an,m and bn,m, obtaining the following linear algebraic systems for cn,m:

(26)

and for dn,m:

(27)

Note that there are only M equations in each system for the unknowns cn,1,,cn,M and dn,1,,dn,M because Nn,1 is not defined, and so terms with cn,0 and dn,0 are not included in the sum (14).

The only coefficients for which a system of equations has not yet been obtained are a0,m (there are no b0,m coefficients since sin0=0). These coefficients cannot be obtained from the system (22) since the matrices of this system are singular when n = 0. To get a solvable system, one must use the z component of BE as follows:

(28)

Evaluating at R̃=1 using the properties [from Ref. 22, Eqs. (10) and (11)] Dn,m|R̃=1=z̃m/m! and Nn,m|R̃=1=0 after differentiating by z̃ gives

(29)

Integrating over ϕ leaves only the n = 0 term in the sum, as all others are harmonic,

(30)

To finalize the derivation, we multiply the equation by a Legendre polynomial Pi(z) and integrate from -1 to 1. Starting from i=M1 and descending to i = 0, the system of equations is

(31)

Just as in the case of systems (26) and (27), there are only M equations for the unknowns a0,1,,a0,M. This is because D0,0=1, and so a0,0 is an additive constant in the scalar potential, which has no effect on the vacuum magnetic field.22 

The linear algebraic systems of Eqs. (22), (23), (26), (27), and (28) are solved in a Python script using the NumPy library.36 The solution is then written out to a Fortran namelist file, which can be read by JOREK. When evaluating the Dommaschk potential and its derivatives at any particular point, JOREK will then use the analytical representation (14).

As was mentioned in the Sec. II, although j̃ and Ψ are related by j̃=Δ*Ψ,j̃ is stored as a separate variable in finite element representation for numerical purpose. It makes sense to first calculate the initial condition for j̃ from the GVEC data and then calculate Ψ0 from j̃0 using Eq. (3e) at t = 0,

(32)

Here, the subscript 0 refers to the fact that Ψ0 and j̃0 are the initial values of Ψ and j̃.

The equilibrium magnetic field provided by the GVEC solution will be referred to as BGVEC. Since GVEC works with full MHD, one needs to consider the full MHD ansatz, as given by (21), when working with BGVEC,

Taking the curl of the above equation and dotting it with χ, after some algebra, one has the following:

Using the same ordering as in Sec. II, where Bv=O(1),Ψ=O(λ),Ω=O(λ2) and =O(λ), it can be seen that the first term is O(λ) and the second term is O(λ3). Thus, the second term can be neglected, due to being two orders of λ higher than the first term. This significantly simplifies the calculation, as now one can just set j̃0=jGVECχ/Bv2=χ·×BGVEC/Bv2.

Having determined j̃0, it remains to solve Eq. (32) for Ψ0. First, however, one needs to determine the boundary condition on Ψ. Note that Ψ is not constant on flux surfaces in stellarator geometry, unlike the tokamak situation. When running a fixed boundary simulation, as done in this study, it is usually assumed that the plasma is surrounded by a perfect conductor, so the magnetic field at the boundary does not have a normal component: n·B=0. In the reduced MHD model, this means that Ψ has to satisfy n·(Ψ×χ)=n·χ at all times. This is a nonhomogeneous linear differential equation, which must be solved on the boundary of the torus; the solution to this differential equation then provides a nonhomogeneous Dirichlet boundary condition for Eq. (32). Note that the kernel of the differential operator in the boundary equation is quite large, consisting of all functions f(χ). Using a flux-surface-aligned coordinate system (ψ,θ,ϕ), where ψ is a flux surface label, θ is the GVEC poloidal angle, which, like in VMEC, is constructed for each particular equilibrium in the course of minimization, and ϕ is the geometric toroidal angle, the boundary equation becomes

(33)

where J=[ψ·(θ×ϕ)]1 is the Jacobian. Note that (ψ,θ,ϕ) is not a straight field line coordinate system. However, solving the equation in this form is numerically difficult because one cannot easily separate the kernel and remove it from the solution space. To do so, one must switch to a coordinate system where χ is one of the coordinates. It is best to switch out ϕ for χ, since a stellarator must have a nonvanishing toroidal component to its vacuum field [c.f. the F0ϕ term in Eq. (13)], so χ/ϕ is nonvanishing and the Jacobian of the new coordinates is nowhere singular. The boundary equation in (ψ,θ,χ) coordinates is

(34)

where J=[ψ·(θ×χ)]1 is the new Jacobian. It is easy to solve this equation in JOREK. Due to the JOREK grid for our applications here being flux-surface-aligned, the element local coordinates s and t (see  Appendix A) can be related to the coordinates ψ and θ as ψ=s,θ=2π(t+ibnd_elm)/Nbnd_elm, where ibnd_elm is the zero-based index of the current boundary element, and Nbnd_elm is the total number of boundary elements. Finally, the χ coordinate is given by the Dommaschk representation (14). The solution space in which the solution to Eq. (34) is searched for can now be represented as

(35)

where Ncp is defined in  Appendix A, and χ̃=χ/F0. Excluding the m = 0 mode removes the kernel of the differential operator of Eq. (34) from Vsol, and the equation can then be solved using the standard Fourier–Galerkin method. The solution obtained this way is then projected back onto the JOREK finite element basis and written to the boundary nodes. Finally, Eq. (32) is solved by splitting Ψ0=Ψ0,i+Ψb, where Ψb is the solution to Eq. (34) and thus satisfies the nonhomogeneous Dirichlet boundary condition, while Ψ0,i is an unknown function, which is zero at the boundary. The solution Ψ0,i is then found using the standard JOREK solver with homogeneous Dirichlet boundary conditions. When Ψ is evolved in time, JOREK will solve for the increment δΨ at each time step, which must also be zero at the boundary (and thus can also be obtained using the standard solver with homogeneous Dirichlet boundary conditions), so that the nonhomogeneous boundary condition continues to be satisfied for the total Ψ.

The last step is determining an initial condition for temperature, which is almost trivial. The GVEC solution provides a pressure profile pGVEC, which must be simply converted to JOREK units and divided by the initial density profile ρ0. In all of the stellarator simulations presented in this paper, the initial density is taken to be constant for simplicity, which corresponds to ρ0=1 in JOREK units.

After having derived and implemented the stellarator model, it remains to validate it for stellarators, showing that it does work. However, before proceeding to more complicated cases, a set of initial tests must be performed using stable equilibria to demonstrate that the model is indeed consistent, the error due to the neglect of fourth-order terms in the Lorentz force, which was discussed in Sec. II, is small, and no significant change is observed in the stable cases after simulating them for some time.

The consistency checks were done using four equilibria based on the historic Wendelstein 7-A stellarator27 with different values of β. Note that the β values here and throughout the rest of this paper are volume-averaged. These equilibria were intended to be unstable to the (2,1) tearing mode; however, since Wendelstein 7-A had five field periods, the simulations can be performed with fivefold periodicity, excluding the unstable n = 1 Fourier mode and its mode family. Thus, in the computational setting used in this section, there are no physical instabilities. The equilibria were first calculated with NEMEC,37 and then, GVEC was used to refine them. Poloidal modes m=0,,12 and toroidal modes n=0,5,10,,50, which correspond to Nctor=21 and Ncp=5 in JOREK (see  Appendix A), were used to calculate the equilibrium. All of the equilibria have the same boundary: a rotating ellipse with a minor axis of 0.09131 m and a major axis of 0.1178 m; the major radius of the torus is 1.99 m. The normalized toroidal current profile was also the same for all equilibria,

(36)

where ψtn is the toroidal flux normalized so that ψtn=0 at the axis and ψtn=1 at the boundary. In(ψtn), which represents the toroidal current enclosed by the flux surface ψtn, is normalized by the total toroidal current, which was 17.5 kA in the cases considered, such that In(1)=1. The total toroidal magnetic flux through a poloidal plane was 0.08 Wb. The pressures at the axis were 1, 100, and 500 Pa, and 1 kPa, which correspond to the β-values of 2.3×105%,2.3×103%, 0.011%, and 0.022%, respectively. The pressure profiles are given by

(37)

where p is the pressure in pascals, pa is the pressure at the axis, and pb is the pressure at the boundary. For the β=2.3×105% (pa=1 Pa) case, pb=0.01 Pa, while for the other three cases, pb=1 Pa. When finding the initial conditions from the GVEC equilibrium, Ntor=9 and Np=5 (see  Appendix A) were used for the variables, which correspond to Fourier modes n=0,5,,20. The profile of the rotational transform ι, which was the same for all equilibria considered in this study, is shown in Fig. 3.

FIG. 3.

The ι profile as a function of ψtn. This profile is the same for all configurations considered in this paper.

FIG. 3.

The ι profile as a function of ψtn. This profile is the same for all configurations considered in this paper.

Close modal

All of the simulations were run with a spatially constant resistivity η=1.938109Ωm and viscosity μ=2.90×109kg/(ms). In addition, a hyperviscosity μh=2.90×1012kgm/s was applied. The radial resolution of the finite elements was 41 nodes, and the poloidal resolution was 48 nodes, that is, moving from the axis to the edge, 41 grid nodes will be passed, counting the nodes at the axis and edge, and 48 grid nodes will be passed in one poloidal turn. The first part of the simulation was run using the implicit Euler time-stepping scheme to damp out small oscillations that were present due to the neglect of fourth-order terms in the Lorentz force and different discrete representations in JOREK and GVEC (see Fig. 4). This consisted of 20 time steps of length 6.484×104ms (1 in JOREK units), followed by 20 time steps of length 6.484×103ms (10 in JOREK units), followed by 10 time steps of length 6.484×102ms (100 in JOREK units). For the β=0.022% case, but not for the others, this was followed by another 10 time steps of length 6.484·102ms. In the second part of the simulation, the Crank–Nicolson time-stepping scheme was used,38 and all four cases were simulated for 6.484 ms (10 000 in JOREK units). The β=2.3×105% and β=2.3×103% cases used time steps of length 6.484×102ms in the second part; however, the β=0.011% and β=0.022% required shorter time steps (3.242×102 and 1.621×102ms, respectively) for numerical stability. When evaluating the integrals in the weak form of Eq. (3), the toroidal integration was performed by summing over 40 poloidal planes evenly spread over one period.

FIG. 4.

The total kinetic energy of the plasma in the β=0.022% case during the first 0.144 ms of the simulation (20 time steps of 1 and 20 time steps of 10 JOREK time units) showing the damping out of motion due to the neglect of fourth-order terms in the Lorentz force.

FIG. 4.

The total kinetic energy of the plasma in the β=0.022% case during the first 0.144 ms of the simulation (20 time steps of 1 and 20 time steps of 10 JOREK time units) showing the damping out of motion due to the neglect of fourth-order terms in the Lorentz force.

Close modal

As expected, no large-scale motion was observed in any of the four simulations, confirming in fact that equilibrium is maintained in the reduced MHD model and its implementation. This can be seen in Fig. 5, where the R coordinate of the magnetic axis is plotted as a function of time for each of the four simulations, along with the error bars. The straight line of the same color outside the error bars represents the axis position in the full MHD equilibrium as calculated in GVEC. The difference between the JOREK and GVEC axis positions is due to the magnetic field being approximated by the reduced MHD ansatz. The axis was determined by making an initial guess for its (R, z) position in the ϕ=0 poloidal plane and then tracing the field line at that position for ten toroidal turns, after which the tolerance T=0.1(maxRiminRi)(maxziminzi), where i=1,,10, is calculated. If this tolerance is smaller than the cutoff, which was set to 5×105m, then the axis is considered found: the axis position at ϕ=0 is (Rc,zc)=((maxRi+minRi)/2,(maxzi+minzi)/2). If not, then the field line tracing is restarted at (Rc,zc), and the process is repeated until the tolerance is less than the cutoff. The error in the R-coordinate was estimated as ER=0.1(maxRiminRi) and plotted as error bars in Fig. 5.

FIG. 5.

The R coordinate of the magnetic axis as a function of time for the four different β cases. The axis position in the full MHD equilibrium as calculated in GVEC is shown by the black dot at t = 0.

FIG. 5.

The R coordinate of the magnetic axis as a function of time for the four different β cases. The axis position in the full MHD equilibrium as calculated in GVEC is shown by the black dot at t = 0.

Close modal

To demonstrate that there is no significant motion even away from the axis, the Poincare plots for the β=0.022% case are shown in Fig. 6, both before and after the simulation, along with the flux surfaces of the GVEC equilibrium. As can be seen, the flux surfaces in JOREK coincide with the GVEC flux surfaces, so the error introduced by using the reduced MHD ansatz for the magnetic field has no noticeable effect on the flux surfaces. Moreover, the flux surfaces do not move during the simulation, preserving the stable equilibrium as expected.

FIG. 6.

The Poincare plots (black points) for the β=0.022% case at t = 0 and ϕ=0 (a), at ϕ=0 after the simulation is over (t=7.275ms) (b), and at t = 0 and ϕ=3π/10 (3/4 of the way through one period) (c). The flux surfaces in the full MHD equilibrium as calculated in GVEC are shown by the orange lines.

FIG. 6.

The Poincare plots (black points) for the β=0.022% case at t = 0 and ϕ=0 (a), at ϕ=0 after the simulation is over (t=7.275ms) (b), and at t = 0 and ϕ=3π/10 (3/4 of the way through one period) (c). The flux surfaces in the full MHD equilibrium as calculated in GVEC are shown by the orange lines.

Close modal

Having demonstrated that basic stellarator simulations can be run with the correct equilibrium in the newly implemented model in JOREK, the next step is to simulate instabilities and benchmark them against known results. Tearing modes in the Wendelstein 7-A stellarator were used for this purpose. Three cases at different values of β were considered: 2.3×105%,2.3×104%, and 2.3×103%. For reference, Fig. 7 shows the velocity stream function Φ without the n = 0, 5, 10 Fourier modes, which do not contribute to the tearing mode, on the ϕ=0 poloidal plane during the presaturation (linear) phase of the full-torus simulation (see below). The characteristic (2,1) structure of the mode is clearly visible. The β=2.3×105% and β=2.3×103% are the same equilibria that were used in the previous section, with the β=2.3×104% being a new equilibrium with the same boundary and current profile as the other two and an intermediate value of β. In this new intermediate equilibrium, pa=10 Pa and pb=0.1 Pa. When finding the initial conditions from the GVEC equilibrium, Ntor=5 and Np=5 (see  Appendix A) were used for the variables, which correspond to Fourier modes n = 0, 5, and 10.

FIG. 7.

The velocity stream function Φ without the n = 0, 5, and 10 Fourier modes on the ϕ=0 poloidal plane in the β=2.3×105%,η=1.938×106Ωm case at t = 0.969 ms.

FIG. 7.

The velocity stream function Φ without the n = 0, 5, and 10 Fourier modes on the ϕ=0 poloidal plane in the β=2.3×105%,η=1.938×106Ωm case at t = 0.969 ms.

Close modal

Just as before, the stellarator simulations were run with the implicit Euler time-stepping scheme and fivefold periodicity to damp out oscillations. This consisted of 20 time steps of length 6.484×104ms, followed by 20 time steps of length 6.484×103ms, followed by 5 time steps of length 6.484×102ms. The resistivity was set to η=1.938×106Ωm, and the viscosity was zero. The hyperviscosity was μh=2.90×1015kgm/s for the β=2.3×105%, and the β=2.3×104% cases, and μh=7.25×1015kgm/s for the β=2.3×103% case. The finite element resolution was 41 nodes radially and 48 nodes poloidally, just as before. Both heat conduction and mass diffusion were set to zero. It should be noted that, when using Ntor=5, anisotropic transport cannot be properly modeled, as field lines tend to slightly drift from flux surfaces after many toroidal turns, which leads to parallel transport contributing to perpendicular transport after enough time steps. This problem can be remedied by including more toroidal modes.

In the second part of the simulation, the domain was extended to the full torus, taking now into account all of the n=0,,10 Fourier modes, corresponding to Ntor=21 and Np=1 (see  Appendix A). The Crank–Nicolson scheme was used with time steps of length 1.621×102ms. The toroidal integration in the weak form of equations (3) was performed by summing over 40 poloidal planes evenly spread throughout the full torus. The number of Fourier modes, the number of poloidal planes, and the values of hyperviscosity, resolution, and time step size were chosen after scanning over several values for each parameter and choosing the value at which the growth rate of the tearing mode converged. For the present purposes, convergence is considered to be achieved when halving the time step size or hyperviscosity, or doubling the resolution, the number of modes, or the number of planes leads to a change in the growth rate of less than 1.5%. The convergence test was performed for the β=2.3×103% and β=2.3×105% cases, resulting in all of the parameters converging to the same values, except for hyperviscosity, which converged to μh=7.25×1015kgm/s for the β=2.3×103% case and μh=2.90×1015kg·m/s for the β=2.3×105% case. The β=2.3×104% case was then run using the lower value of hyperviscosity. Figure 8(a) shows the values of the growth rates from JOREK alongside the values calculated in the linear MHD code CASTOR3D.28,29 The maximum deviation between the two codes is 13.2% and occurs at β=2.3×104%.

FIG. 8.

The JOREK and CASTOR3D growth rates at η=1.938×106Ωm and differing betas (a), and at β=2.3×105% and differing resistivities (b).

FIG. 8.

The JOREK and CASTOR3D growth rates at η=1.938×106Ωm and differing betas (a), and at β=2.3×105% and differing resistivities (b).

Close modal

For reference, Fig. 9 shows the magnetic energies of each individual Fourier mode in the β=2.3×105% case, except for modes that belong to the n = 0 mode family (n = 0, 5, 10). The time axis starts slightly before 0.5 ms, as that is where the full-torus simulation begins and the Fourier modes shown are initialized. As expected, the n = 1 Fourier mode drives the instability, with the rest of its mode family (n = 4, 6, and 9) growing with it due to linear mode coupling. Around 2 ms, the n = 1 mode begins to drive the n = 2 mode via nonlinear coupling, which in turn drives the rest of its mode family (n = 3, 7, and 8) via linear coupling. Finally, the mode saturates around 3–3.5 ms. The saturated magnetic island structure is shown in the Poincare plot in Fig. 10. Note that, aside from the dominant (2,1) island chain, there is a secondary (3,2) island chain toward the interior of the plasma, which is nonlinearly excited by the mode.

FIG. 9.

The individual magnetic energies of the Fourier modes n=1,,4,6,,9 in the β=2.3×105%,η=1.938×106Ωm case.

FIG. 9.

The individual magnetic energies of the Fourier modes n=1,,4,6,,9 in the β=2.3×105%,η=1.938×106Ωm case.

Close modal
FIG. 10.

The saturated magnetic island structure in the β=2.3×105%,η=1.938×106Ωm case at t = 4.03 ms.

FIG. 10.

The saturated magnetic island structure in the β=2.3×105%,η=1.938×106Ωm case at t = 4.03 ms.

Close modal

Two more simulations were performed with the β=2.3×105% case, this time using resistivities of η=1.938×107 and η=1.938×105Ωm, while all of the other parameters were kept the same as before. For the η=1.938×107Ωm case, a hyper-resistivity of ηh=9.691×1014Ωm2 (5×1014 in JOREK units) had to be introduced in order for the iterative solver to converge in a reasonable amount of time. However, it was first confirmed that introducing this amount of hyper-resistivity in the η=1.938×106Ωm case, which could be run with or without hyper-resistivity, changes the growth rate by less than 1.5%. Figure 8(b) shows the growth rates for the β=2.3×105% case at different values of resistivity alongside the growth rates calculated by CASTOR3D. The maximum deviation between the two codes is 26.2%, occurring at η=1.938×105Ωm. This is most likely due to the neglect of v by the model used in these simulations, as v can be large within the resistive layer, and the size of the resistive layer increases with resistivity. A similar effect is known to exist for quasi-interchange modes. Neglecting the parallel velocity leads to an overestimation of the quasi-interchange growth rates by a factor of 1+2qs2, where qs is the safety factor of the flux surface where the mode appears.39 In general, the agreement on the growth rates for the (2,1) tearing mode looks convincing, with deviations on the order of 10% from CASTOR3D, which solves the linearized full MHD equations.

A similar benchmark with CASTOR3D for ballooning mode growth rates in Wendelstein 7-A using equilibria with β=0.11% and β=0.21% (corresponding to axis pressures of 5 and 10 kPa) has been performed at resistivities of η=1.938×107Ωm and η=5.814×107Ωm. For reference, the velocity stream function Φ is shown in Fig. 11 during the linear phase of the β=0.21%,η=1.938×107Ωm simulation. These equilibria have the same toroidal current and pressure profiles as the equilibria in Sec. V, with pb set to 1 Pa and 100 Pa, respectively. As before, the simulations were initially run with the implicit Euler scheme to damp out oscillations. This first phase of the simulation consisted of 30 time steps of length 6.484×104ms. In the second part of the simulation, the Crank–Nicolson scheme was used; however, both parts were run with a fivefold periodicity, since ballooning modes can be simulated with just one period.

FIG. 11.

The velocity stream function Φ on the ϕ=0 poloidal plane in the β=0.21%,η=1.938×107Ωm case at t = 0.074 ms.

FIG. 11.

The velocity stream function Φ on the ϕ=0 poloidal plane in the β=0.21%,η=1.938×107Ωm case at t = 0.074 ms.

Close modal

Based on linear ballooning mode theory in the tokamak limit, ballooning mode growth rates are known to diverge as n if there are no background flows present in the initial equilibrium.4 In order to realistically model ballooning modes, one would have to include an equilibrium flow, such as diamagnetic drift, which will stabilize modes with n>nmax.40 However, since we only want to do a benchmark, we do not use equilibrium flows in either JOREK or CASTOR3D, but simply cut off the number of Fourier modes in the JOREK simulations, and then limit the CASTOR3D run to the same number of modes. We chose to keep only the n = 0, 5, 10 modes in the simulations considered here; the highest mode (n = 10) is dominant in this case, as it grows the fastest, and its energy quickly exceeds that of the other modes. We have also tried including the n = 15 and n = 20 modes in case the prediction about increasing growth rates from the tokamak limit is no longer valid for Wendelstein 7-A; however, we found that the highest-n mode is the fastest-growing one in those simulations as well.

Holding the number of modes fixed at Ntor=5, a convergence test was performed for the β=0.21% equilibrium while using a resistivity of η=1.938×107Ωm. The growth rate converged at a finite element resolution of 61 nodes radially and 72 nodes poloidally, time step size of 6.484×104ms, and a hyperviscosity of μh=7.25×1015kgm/s. The other three simulations were then run with these parameters. Both heat conductivity and mass diffusion parameters were set to zero in all four simulations. Figure 12 shows the growth rates measured in the four cases, along with the growth rates calculated in CASTOR3D for the same four cases. The maximum deviation is 6.4% and occurs at β=0.11%,η=1.938×107Ωm, with the other three deviations all being less than 3%.

FIG. 12.

The ballooning mode growth rates as computed by JOREK and CASTOR3D at two different values of β and resistivity.

FIG. 12.

The ballooning mode growth rates as computed by JOREK and CASTOR3D at two different values of β and resistivity.

Close modal

Cutting off the Fourier series without stabilizing the high-n modes could lead to spectral blocking,41 where existing modes couple to higher modes that are not included in the Fourier series, and these coupling contributions are aliased back onto the existing modes, leading to inaccurate results. To check whether our results are affected by this numerical error, we first repeated the CASTOR3D run for the β=0.21%,η=1.938×107Ωm case with the n = 15 mode included and compared the individual growth rate of the n = 10 Fourier mode in this simulation to that in the simulation without the n = 15 mode also included. We found that the n = 10 growth rate changed by less than 0.003%, indicating that the CASTOR3D result is trustworthy. We then took a time step from the n = 0, 5, and 10 JOREK simulation of the β=0.21%,η=1.938×107Ωm case where the ballooning mode had already emerged and was linearly growing, and restarted it with the n = 15 mode also included. We found that the n = 10 growth rate decreased by about 5%–6% (depending on the exact time step at which it was restarted), becoming much closer to the CASTOR3D value. Thus, in JOREK simulations spectral blocking has more of an effect and it accounts for most of the discrepancy between JOREK and CASTOR3D results. Generally, in both codes, the growth rates of the n = 10 dominated mode are only weakly affected by the choice of including or excluding the n = 15 mode in the simulation.

Continuing the work of previous studies,20,21 we implement a stellarator-capable reduced MHD model in JOREK and run several test cases based on the simple geometry of the Wendelstein 7-A stellarator. This paper presents the results, starting with Sec. II, which shows that the reduced model introduces an error into Lorentz force, but the error is negligible. The implementation is discussed in Secs. III and IV. In order to guarantee ·B=0 to machine precision, an analytical representation of the vacuum magnetic field (i.e., the curl-free component), as derived by Dommaschk,22 was used. This representation is compatible with arbitrary vacuum fields in a toroidal device. In order to run a simulation, the GVEC code is used to calculate an equilibrium, which is then used as an initial condition for the JOREK run. The actual Wendelstein 7-A simulations are presented in Secs. V–VII. Stable full MHD equilibria are preserved in the reduced model: the flux surfaces do not move throughout the simulation and closely match the flux surfaces calculated in GVEC, just as one would expect from the ordering argument in Sec. II. Furthermore, both tearing and ballooning modes were simulated, and the linear growth rates measured in JOREK are in decent agreement with the growth rates calculated by the CASTOR3D linear full MHD code.

Already in its current form, JOREK is capable of handling more complicated machines, such as Wendelstein 7-X and LHD. Benchmarks involving instabilities in these advanced devices are in progress, and the results will be reported in a future publication. We also plan to look for pressure-induced islands in high-β simulations to see how well their widths match the theoretical predictions of Cary and Kotschenreuther.42 Studies of scenarios relevant to ongoing experiments are also planned. Of particular interest are the current-driven sawtooth-like crashes observed in Wendelstein 7-X.43 Previous studies, which included both linear fully three-dimensional simulations with CASTOR3D44 and nonlinear simulations in a simplified cylindrical geometry with the TM1 code,45 have found that the corresponding Wendelstein 7-X equilibria are unstable to single and double modes, as well as resistive kink modes, and that the coupling of double-tearing modes with kink modes produces the sawtooth-like crashes. While the family of reduced MHD models used in JOREK, including the models derived in our previous work, cannot accurately reproduce kink modes at higher β,1 similar sawtooth-like crashes have also been simulated in TM1 at zero β.45 Using JOREK will allow us to nonlinearly simulate these modes in a fully three-dimensional geometry.

Another line of work that we intend to pursue is implementing more advanced models for stellarators than the one studied here. The most immediate improvement to the model used here would be to add v; other improvements include implementing separate temperatures for electrons and ions, adding a neutral density, and other model extensions already implemented for the tokamak models.1 Going further, we also intend to implement a full MHD model for stellarators. This will most likely involve extending the full MHD model described in Ref. 46, which uses the standard MHD variables {A,v,ρ,T} and does not involve any ansatzes or projections, to stellarators. This may require that the vector components of v and A are stored in a flux-surface-aligned coordinate system instead of the cylindrical (R,z,ϕ) coordinate system as in Ref. 46. However, implementing the full MHD model with the {Ψ,Ω,Φ,v,ζ,ρ,T} variables, which was derived in Ref. 21 and can be seen as a direct extension of the model used in this study, would also be interesting for comparison purposes. Finally, although we do not expect any issues, it remains to be seen if the model used in this study will hold up for β35%. Further modifications to the model may be needed if future work does not produce satisfactory results for this range of β.

The authors thank Alessandro Zocco and Carolin Nuehrenberg for fruitful discussions, and Michael Drevlak for providing access to his EXTENDER_P code and patiently answering questions about code use.

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.

The authors have no conflicts to disclose.

The data that support the findings of this study are available from the corresponding author upon reasonable request.

The spatial discretization in JOREK is performed via two-dimensional quadrilateral finite elements in the poloidal plane and a toroidal Fourier expansion. The finite element discretization has G1 continuity, meaning that any discretized functions and their first derivatives are continuous across element boundaries, but second derivatives can jump.

In each element, an element-local coordinate system (s,t,ϕ),s,t[0,1] is set up, where (s,t)=(0,0),(0,1),(1,0),(1,1) corresponds to the four vertices of the element, and ϕ is the geometric toroidal angle, identical to the ϕ coordinate of the cylindrical coordinate system (R,z,ϕ). In general, s and t can have arbitrary orientations in the poloidal plane; however, in most configurations without an X-point, s is the radial coordinate and t is the poloidal coordinate. All quantities, including the cylindrical coordinates R and z, are expressed in terms of the element-local coordinates. Expressing R and z in terms of element-local coordinates allows one to adjust the positions of the vertices of an element, which is normally used to build a flux-surface-aligned grid. Previously, R and z could only depend on s and t, but not ϕ;1 however, this constraint was removed as part of the JOREK stellarator effort. Now, the cylindrical coordinates inside a particular element are represented as

(A1)

where i sums over the four vertices of the element, j sums over the degrees of freedom at each vertex, and n sums over the toroidal Fourier modes, with Nctor being an adjustable parameter. In addition, Bij(s,t) are Bezier basis functions, and

where Ncp is the periodicity of the underlying geometry. Allowing R and z to depend on ϕ makes it possible to build a flux-surface-aligned grid in a stellarator configuration. The physical quantities, such as density, temperature, and ψ, are represented in a similar way

(A2)

Note that Ntor and Nctor are distinct parameters; on a flux surface-aligned grid, less modes are needed to reasonably represent the physical quantities than the geometry. The Fourier basis function Zn(ϕ) is defined in a similar way to Znc(ϕ), with the difference that Ncp is replaced by Np; this allows running full-torus simulations without having to add unnecessary modes to the geometry.

If Eq. (3) is linearized and the nonideal terms are dropped, then the operator of the resulting linear equation will be self-adjoint. In the ideal case, Eq. (3) can be linearized as follows:

(B1a)
(B1b)
(B1c)
(B1d)

where a subscript of 0 denotes the equilibrium value of the corresponding quantity, and perturbations do not have any decorations. Now, analogous to the standard textbook derivation, let Φ=ξ/t integrate Eqs. (B1b)–(B1d) over time and insert them back into Eq. (B1a). The following linear equation is obtained as follows:

(B2)

The linear operator L(ξ) is analogous to the force operator F(ξ) of linear full MHD but has a different dimensionality and cannot be interpreted as the force.

To demonstrate self-adjointness, one has to show that for any two scalar functions ξ and η, which satisfy ξ=0 and η=0 on the boundary, one has ηL(ξ)dV=ξL(η)dV. Since L(ξ) can be obtained by applying the projection operator (6) to the negative force operator F(ξ×χ/Bv2), one can use the identity f·×U=·(f×U) and integration by parts to write the following:

(B3)

as in Ref. 21. Here, B0=χ+Ψ0×χ, which allows one to express the magnetic field and pressure perturbations in a familiar way

(B4)

Now identify ξ=ξ×χ/Bv2 and η=η×χ/Bv2, and note that the boundary conditions on ξ and η imply that the vector fields ξ and η satisfy the usual boundary condition for displacement in a plasma surrounded by a wall: ξ·n=η·n=0. Finally, one can apply the self-adjointness property of the force operator F(ξ), which allows us to write

(B5)

This concludes the self-adjointness proof for the linear operator L(ξ).

1.
M.
Hoelzl
,
G.
Huijsmans
,
S.
Pamela
,
M.
Bécoulet
,
E.
Nardon
,
F.
Artola
,
B.
Nkonga
,
C.
Atanasiu
,
V.
Bandaru
,
A.
Bhole
,
D.
Bonfiglio
,
A.
Cathey
,
O.
Czarny
,
A.
Dvornova
,
T.
Fehér
,
A.
Fil
,
E.
Franck
,
S.
Futatani
,
M.
Gruca
,
H.
Guillard
,
J.
Haverkort
,
I.
Holod
,
D.
Hu
,
S.
Kim
,
S.
Korving
,
L.
Kos
,
I.
Krebs
,
L.
Kripner
,
G.
Latu
,
F.
Liu
,
P.
Merkel
,
D.
Meshcheriakov
,
V.
Mitterauer
,
S.
Mochalskyy
,
J.
Morales
,
R.
Nies
,
N.
Nikulsin
,
F.
Orain
,
J.
Pratt
,
R.
Ramasamy
,
P.
Ramet
,
C.
Reux
,
K.
Särkimäki
,
N.
Schwarz
,
P. S.
Verma
,
S.
Smith
,
C.
Sommariva
,
E.
Strumberger
,
D.
van Vugt
,
M.
Verbeek
,
E.
Westerhof
,
F.
Wieschollek
, and
J.
Zielinski
,
Nucl. Fusion
61
,
065001
(
2021
).
2.
A. H.
Boozer
,
Phys. Plasmas
26
,
102504
(
2019
).
3.
4.
J. P.
Freidberg
,
Ideal MHD
(
Cambridge University Press
,
2014
).
5.
6.
M.
Wakatani
,
H.
Shirai
, and
M.
Yamagiwa
,
Nucl. Fusion
24
,
1407
(
1984
).
7.
Y.
Ishii
and
M.
Wakatani
,
Plasma Phys. Controlled Fusion
37
,
867
(
1995
).
8.
H.
Strauss
,
L.
Sugiyama
,
G.
Fu
,
W.
Park
, and
J.
Breslau
,
Nucl. Fusion
44
,
1008
(
2004
).
9.
N.
Mizuguchi
,
Y.
Suzuki
, and
N.
Ohyabu
,
Nucl. Fusion
49
,
095023
(
2009
).
10.
Y.
Zhou
,
N.
Ferraro
,
S.
Jardin
, and
H.
Strauss
,
Nucl. Fusion
61
,
086015
(
2021
).
11.
M.
Sato
,
N.
Nakajima
,
K.
Watanabe
, and
Y.
Todo
,
Nucl. Fusion
57
,
126023
(
2017
).
12.
C. R.
Sovinec
,
C. M.
Guilbault
,
B. S.
Cornille
, and
T. A.
Bechtel
, “
Development of MHD Simulation Capability for Stellarators
,” in
62nd Annual Meeting of the APS-DPP
(
2020
).
13.
M.
Schlutt
,
C.
Hegna
,
C.
Sovinec
,
S.
Knowlton
, and
J.
Hebert
,
Nucl. Fusion
52
,
103023
(
2012
).
14.
F. J.
Hindenlang
,
G. J.
Gassner
,
C.
Altmann
,
A.
Beck
,
M.
Staudenmaier
, and
C.-D.
Munz
,
Computers Fluids
61
,
86
(
2012
).
15.
G.
Huysmans
and
O.
Czarny
,
Nucl. Fusion
47
,
659
(
2007
).
16.
O.
Czarny
and
G.
Huysmans
,
J. Comput. Phys.
227
,
7423
(
2008
).
17.
J.
Breslau
,
N.
Ferraro
, and
S.
Jardin
,
Phys. Plasmas
16
,
092503
(
2009
).
18.
R.
Izzo
,
D.
Monticello
,
J.
DeLucia
,
W.
Park
, and
C.
Ryu
,
Phys. Fluids
28
,
903
(
1985
).
19.
20.
N.
Nikulsin
,
M.
Hoelzl
,
A.
Zocco
,
K.
Lackner
, and
S.
Günter
,
Phys. Plasmas
26
,
102109
(
2019
).
21.
N.
Nikulsin
,
M.
Hoelzl
,
A.
Zocco
,
K.
Lackner
,
S.
Günter
, and
the JOREK Team
,
J. Plasma Phys.
87
,
855870301
(
2021
).
22.
W.
Dommaschk
,
Comput. Phys. Commun.
40
,
203
(
1986
).
23.
M.
Drevlak
,
D.
Monticello
, and
A.
Reiman
,
Nucl. Fusion
45
,
731
(
2005
).
24.
F.
Hindenlang
,
O.
Maj
,
E.
Strumberger
,
M.
Rampp
, and
E.
Sonnendrücker
, “
GVEC: A newly developed 3D ideal MHD Galerkin Variational Equilibrium Code
,” Simons hour talk given for ‘Simons Collaboration on Hidden Symmetries and Fusion Energy' (
2019
).
25.
S. P.
Hirshman
and
J. C.
Whitson
,
Phys. Fluids
26
,
3553
(
1983
).
26.
S.
Hirshman
and
O.
Betancourt
,
J. Comput. Phys.
96
,
99
(
1991
).
27.
W VII-A Team
,
Nucl. Fusion
20
,
1093
(
1980
).
28.
E.
Strumberger
and
S.
Günter
,
Nucl. Fusion
57
,
016032
(
2017
).
29.
E.
Strumberger
and
S.
Günter
,
Nucl. Fusion
59
,
106008
(
2019
).
30.
S. J. P.
Pamela
,
A.
Bhole
,
G. T. A.
Huijsmans
,
B.
Nkonga
,
M.
Hoelzl
,
I.
Krebs
, and
E.
Strumberger
,
Phys. Plasmas
27
,
102510
(
2020
).
31.
S.
Pamela
,
G.
Huysmans
, and
S.
Benkadda
,
Plasma Phys. Controlled Fusion
52
,
075006
(
2010
).
32.
J. M.
Finn
,
A. J.
Cole
, and
D. P.
Brennan
,
Phys. Plasmas
26
,
102505
(
2019
).
33.
S.
Pamela
,
G.
Huijsmans
, and
M.
Hoelzl
,
J. Comput. Phys.
464
,
111101
(
2022
).
34.
B.
Dudson
,
M.
Umansky
,
X.
Xu
,
P.
Snyder
, and
H.
Wilson
,
Comput. Phys. Commun.
180
,
1467
(
2009
).
35.
B. D.
Dudson
,
J.
Madsen
,
J.
Omotani
,
P.
Hill
,
L.
Easy
, and
M.
Løiten
,
Phys. Plasmas
23
,
062303
(
2016
).
36.
C. R.
Harris
,
K. J.
Millman
,
S. J.
van der Walt
,
R.
Gommers
,
P.
Virtanen
,
D.
Cournapeau
,
E.
Wieser
,
J.
Taylor
,
S.
Berg
,
N. J.
Smith
,
R.
Kern
,
M.
Picus
,
S.
Hoyer
,
M. H.
van Kerkwijk
,
M.
Brett
,
A.
Haldane
,
J. F.
del Río
,
M.
Wiebe
,
P.
Peterson
,
P.
Gérard-Marchant
,
K.
Sheppard
,
T.
Reddy
,
W.
Weckesser
,
H.
Abbasi
,
C.
Gohlke
, and
T. E.
Oliphant
,
Nature
585
,
357
(
2020
).
37.
E.
Strumberger
and
M.
Hölzl
, “
User manual: Iterative computation of 3D ideal MHD equilibria and magnetic fields
,” IPP Report No. 5/113 (
2005
).
38.
Time stepping in JOREK involves first linearizing the equations in time around the current time step, and then applying applying an implicit time advance method, such as the Crank–Nicolson scheme. For more details see Ref. 21.
39.
F. L.
Waelbroeck
,
Phys. Fluids B
1
,
499
(
1989
).
40.
G. T. A.
Huysmans
,
S. E.
Sharapov
,
A. B.
Mikhailovskii
, and
W.
Kerner
,
Phys. Plasmas
8
,
4292
(
2001
).
41.
J. P.
Boyd
,
Chebyshev and Fourier Spectral Methods
, Dover Books on Mathematics, 2nd ed. (
Dover Publications
,
2001
).
42.
J. R.
Cary
and
M.
Kotschenreuther
,
Phys. Fluids
28
,
1392
(
1985
).
43.
M.
Zanini
,
H.
Laqua
,
H.
Thomsen
,
T.
Stange
,
C.
Brandt
,
H.
Braune
,
K.
Brunner
,
G.
Fuchert
,
M.
Hirsch
,
J.
Knauer
,
U.
Höfel
,
S.
Marsen
,
E.
Pasch
,
K.
Rahbarnia
,
J.
Schilling
,
Y.
Turkin
,
R. C.
Wolf
,
A.
Zocco
, and
Wendelstein 7-X Team
,
Nucl. Fusion
60
,
106021
(
2020
).
44.
E.
Strumberger
,
S.
Günter
, and
Wendelstein 7-X Team
,
Nucl. Fusion
60
,
106013
(
2020
); available at https://iopscience.iop.org/article/10.1088/1741-4326/aba9ea/meta.
45.
Q.
Yu
,
E.
Strumberger
,
V.
Igochine
,
K.
Lackner
,
H.
Laqua
,
M.
Zanini
,
H.
Braune
,
M.
Hirsch
,
U.
Höfel
,
S.
Marsen
,
T.
Stange
,
R.
Wolf
,
S.
Günter
, and
Wendelstein 7-X Team
,
Nucl. Fusion
60
,
076024
(
2020
).
46.
J.
Haverkort
,
H.
de Blank
,
G.
Huysmans
,
J.
Pratt
, and
B.
Koren
,
J. Comput. Phys.
316
,
281
(
2016
).