
2
alized stochasticity. This was first done for analytic vac-
uum fields, using perturbative analysis10–12. Later, the
Greene residue method was applied in an optimization
framework to find coils generating vacuum fields with re-
duced chaos13,14. These early works did not consider the
simultaneous goal of having magnetic fields with a high
level of quasi-symmetry. More recently, chaos healing was
attempted in Ref. 15, where a quadratic flux minimizing
(QFM) penalty was added to a coil optimization objec-
tive to favor nested magnetic surfaces further away from
the magnetic axis and optimize away chaotic regions of
the field. However, doing so does not control the quality
of quasi-symmetry on low aspect ratio surfaces.
In this manuscript, we address some of the shortcom-
ings of the previous approaches. Specifically, the main
contributions of this work are: (1) we outline a robust
approach for computing approximations of flux surfaces
even in the presence of island chains and chaos, (2)
based on that surface computation, we present a novel
optimization-based approach to island and chaos heal-
ing, (3) our approach optimizes directly the geometry of
electromagnetic coils, rather than a toroidal boundary
surface, and (4) the algorithm promotes precise quasi-
symmetry on nested magnetic surfaces.
In our previous work (Ref. 1), we outlined a nu-
merical method to optimize stellarator coils for quasi-
axisymmetry under the assumption that over the course
of the optimization, the rotational transform remained
strongly irrational. Despite this strong requirement, we
found precisely quasisymmetric magnetic fields generated
by coils. The procedure in Ref. 1 relies on the solution to
a partial differential equation (PDE) that can be difficult
to solve numerically. In this work, we propose a least-
squares formulation to solve the PDE in a more robust
fashion, resulting in a numerical optimization procedure
that can be used even when nested flux surfaces do not
exist. Our approach is formulated as a bilevel optimiza-
tion problem, where the outer coil optimization problem
is constrained by the solution to a PDE, solved in a least
squares sense in the inner optimization problem. This
is similar in spirit to the work in Ref. 16, where qua-
sisymmetric stellarators were found by solving an outer
optimization problem constrained by the least squares so-
lution to the force balance equations computed using the
DESC code. We also focus on curl-free magnetic fields
as they are an important first step in the development
of stellarator optimization algorithms. Furthermore, vac-
uum fields can serve as suitable initial states in stellarator
optimization approaches in which the plasma pressure is
gradually ramped up17.
II. COMPUTING SURFACES
The goal of this section is to outline a robust numeri-
cal method for computing magnetic surfaces in curl-free
magnetic fields B∈R3. Even though the external mag-
netic fields that we use here are always generated by elec-
tromagnetic coils, our method is not restricted to fields
represented in this manner. We use a finite-dimensional
representation of a toroidal surface Σs: [0,1)2→(x, y, z)
that satisfies nfp-rotational symmetry and stellarator
symmetry. nfp stands for the “number of field periods”
and indicates the the number of times the field repeats
itself after a full toroidal rotation. The unknowns, or sur-
face parameters, in this representation are combined into
a vector s∈Rnswhere nsis the number of parameters
that describe the surface; for details of this representation
see Ref. 1. Given a vacuum magnetic field B, we seek to
compute a magnetic surface in Boozer coordinates Σs(s),
its rotational transform ι, and the constant G, that solve
r(s) = [rx(s), ry(s), rz(s)] = 0, where1
r(s) := GB
kBk− kBk∂Σs
∂ϕ +ι∂Σs
∂θ .(1)
This equation can be derived by equating two differ-
ent representations of the magnetic field, which assume
that it is curl- and divergence-free1,17. Then, with the
dual relations, it can be shown that magnetic surfaces
parametrized in Boozer coordinates satisfy (1). Solutions
to this partial differential equation can only be expected
when ιis strongly irrational. Based on this assumption,
we have presented a pseudospectral approach to solve (1)
in Ref. 1, and used that numerical method in an optimiza-
tion loop to find coils with accurate quasi-symmetry. The
pseudospectral method aimed to find surfaces for which
the residual was exactly zero at a fixed number of col-
location points. We called these surfaces “BoozerExact”
surfaces. However, this numerical method can be brittle
when nested flux surfaces do not exist, e.g. in regions
with chaotic field lines and island chains, which occur
at places where the rotational transform is not strongly
irrational. The approach that we describe now is more
robust and can be used to determine surfaces even in
regions where the pseudospectral method (BoozerExact)
would have difficulty.
Discretizing this partial differential equation, surfaces
are computed by solving the following constrained least
squares minimization problem
min
s
1
2Z1
0Z1/nfp
0
kr(s)k2dϕ dθ
subject to V(Σs)−V0= 0,
(2)
where r(s) : [0,1) ×[0,1/nfp)→R3,
kr(s)k2=rx(s)2+ry(s)2+rz(s)2,(3)
V0is a given target volume, and
V(Σs) = Z1
0Z1/nfp
0
1
3Σs·ndϕ dθ, (4)
where n=∂Σs/∂ϕ ×∂Σs/∂θ. Note that while nis in
the direction of the surface normal, here is not in general
the unit normal. The aim is to solve (1) in a least-squares