2.1. Free-Boundary Equilibrium Problem in Tokamak Geometry
In the cylindrical coordinate system (
), the
component is considered negligible due to the assumption of toroidal axisymmetry in tokamaks. The FBE equation, derived from the force balance equation for an air-core tokamak, is written as follows:
where the poloidal flux function
, known as the poloidal magnetic flux per radian, is defined as
from
, and
is the permeability in a vacuum. The right-hand side (RHS) of Equation (
1a) is the toroidal current density, which is dependent on different factors:
in which
p represents the plasma kinetic pressure,
f is the diamagnetic function defined as
,
is the toroidal magnetic field,
and
are the current and cross-section of the external conductor coil
c, and the prime sign represents the derivative with regard to
. The toroidal plasma current density,
, is derived from the well-known Grad–Shafranov (G-S) equation [
14,
15]. It is important to note that currents on possible passive plates and vacuum vessel, induced by plasma vertical excursions and disruptions, can also be treated as having similar current densities to those in the external coils. These induced currents are very important to reduce the growth rate of plasma vertical events (VDEs) due to a loss of control in the vertical position, disruption, and MHD instabilities [
16].
The
is parameterized from [
17] as
where
is the major radius, and
is the normalized
defined as
, where
and
are the
along the plasma axis and at the boundary, respectively. The parameters
and
can be tuned to constrain the specified equilibrium, which are discussed further below, while
, and
are user-defined input constants.
When solving the FBE equation through numerical methods, certain plasma quantities can be prescribed. Two unknowns, i.e.,
and
in Equation (3), can be determined to satisfy two constrained parameters. These parameters could be imposed on plasma quantities, such as
and the poloidal plasma beta (
):
where
(toroidal unit vector) is the poloidal magnetic field. The bracket
denotes the flux-averaging operation [
18] for arbitrary term
A with
in which
D and
V are the 3D plasma area and the volume inside a specified
surface, and
l is a closed flux contour.
Additionally, these two plasma parameters can also be
and
(safety factor) at a specified
, such as
at
. The safety factor
q is defined by
in which
is used.
The continuous flux-averaged plasma quantities above can be estimated by discrete approximates, e.g.,
(similarly for
) in the plasma area based on Equations (3) and (4) or (
6) as
where
is a plasma element.
Similarly,
on closed contour points (
) can be approximated with Equation (
6) as follows:
where
on a given
is calculated from [
18] as
By combining Equations (
7)–(
9), specified
and
values can be determined.
2.2. Numerical Approximations on a Rectangular Grid
The FBE Equation (1) is a 2D partial differential equation (PDE) with a nonlinear source. A typical treatment to solve this continuous PDE is to discretize the 2D operator using a 1D approximation with a known source term. A rectangular computational domain
is constructed as
where
and
are the total number of grid points in the
R and
Z coordinates, respectively.
The 2D derivatives in the Shafranov operator
from Equation (
1b) can be approximated as
Therefore, Equation (1) is rewritten as
where
and
denote
and
, respectively. If the RHS of
is known, then the equation above resembles a set of linear algebraic equations
that can be solved using various methods [
19], such as Jacobi’s Method, the Gauss–Seidel Method, and the Successive Over-Relaxation Method (SOR).
2.3. Initial Guess and Picard Iteration
In order to solve Equation (
12), it is essential to pre-define the RHS of
, which is nonlinear and depends on the solution
. This nonlinearity can only be addressed through an iterative scheme, starting from a guess of
. A typical initial guess of
with a circular plasma current density [
12] is given by
where
, with
,
, and
being the user-defined plasma center coordinates and minor radius for the initial plasma current distribution. The constant
is adjusted to match the total plasma current. An initial guess of
with
250 kA is shown in
Figure 1. In practice,
from a converged solution is typically employed as an initial guess to expedite the iterations.
By utilizing an initial guess of
, the FBE in Equation (
12) can thus be solved by the well-known Picard iteration [
20]. The Picard iteration is very effective for numerically solving the PDE, where the provided initial guess is close to the converged solution. The next iteration’s solution is calculated based on the current iteration in a recursive manner, which is described in detail in the following paragraph. The
(
) on the given grid, except boundary nodes, based on Equation (
12) is expressed as
in which
n represents the
n-
iteration. It can be seen that
, the toroidal plasma current distribution in the
n-
iteration, is determined by
, precisely specifying
and
. With the assumed initial
,
is obtained by solving Equation (
14). In the next iteration,
is updated based on
. Following this recursive iteration, the numerical solutions of
and
are obtained until a given criterion, i.e.,
(typically
), is satisfied. The detailed block diagram for this Picard iteration is depicted in Figure 3.
2.4. Boundary Condition for the Free-Boundary Equilibrium Solver
Equation (
14) determines
in the core region of the grid, where
and
. Dirichlet boundary conditions [
21] are applied at the grid boundaries (
and
).
Figure 2 illustrates the rectangular grid used to discretize the 2D computational domain
for solving the FBE Equation (1), where the spatial coordinates
and
are discretized with uniform step sizes
and
, respectively. The red ’x’s mark the boundary nodes of the mesh, defining the limits of the domain, while the black dots represent the interior nodes. The boundary
is computed using the Green’s function formulation [
22]:
where
is the Green’s function for a unit toroidal current source at
, given by
with
and
being the elliptic integrals of the first and second kinds, respectively:
In a tokamak, the boundary
depends on the induced
by the toroidal plasma current and conductor coil currents:
Here
changes in each Picard iteration, while
may either change or remain constant depending on the computational mode (forward vs. inverse), as discussed in
Section 2.6.
2.5. Identification of Plasma Axis and Boundary
The determination of and in each Picard iteration is crucial since the nonlinear RHS of strongly relies on and . In a tokamak, the plasma boundary is either in contact with the plasma-facing component, e.g., the so-called limited or circular plasma shape, or formed by the saddle point of the poloidal magnetic field as an X-point (diverted plasma shape). Identifying is relatively straightforward because it has the largest absolute value of inside the plasma area. On the other hand, determining for a limited shape is also straightforward, as it is recognized by the existence of a closed contour, based on locating the maximum on the first wall coordinates. However, for a diverted plasma shape with an X-point, where a null magnetic field exists, the plasma boundary is identified by computing .
Both the magnetic axis and X-points are characterized by local minima in
. Therefore, it is necessary to find the possible X-points and magnetic axis by calculating the following term:
along the magnetic axis, the maximum value of
holds the same sign as for
and
, while they are opposite to each other when it is a saddle point (X-point) [
23]. Therefore, the Hessian of
indicates a magnetic axis, and
indicates an X-point. The precise
coordinates for
and the X-points are determined using a new
with small values of (
). Although there may be multiple X-points, it is essential to identify the one that defines the plasma boundary and is closest to the plasma axis, as distinguished by having the maximum
.
2.6. Forward and Inverse Free-Boundary Equilibrium Modes
Within COTES, two computational modes are employed, namely, the forward and inverse modes. In the forward mode, the coil currents are known and remain fixed until a converged
map is achieved. In contrast, the inverse mode treats the external coil currents as unknowns, which can be determined by additional constraints, e.g., the prescribed plasma boundary and X-points. In this inverse COTES approach, potential coil currents are explored by solving the following optimal problem:
where
are the specified boundary points;
is the Green’s function of the unit coil current
on the plasma boundary;
is the error of the poloidal flux function on the prescribed plasma boundary points;
and
are the radial and vertical poloidal magnetic field on the given X-points
, respectively; and
is a Tikhonov parameter for the regularization term [
24] in an ill-posed problem. If an X-point is specified, then
and
at the X-points should be zero. This constraint is added as the second and third summed terms in Equation (
20), with
The external coil currents for the next iteration are updated as
where
is the
c-
coil current from the
−
Picard iteration. It is important to emphasize that the initial
must be close to a real solution; otherwise, the Picard iteration will fail due to the absence of a possible plasma boundary and axis.
The solution to Equation (
20) involves a least-squares regression with an L2 [
25] penalty term, and the optimal coil currents are computed by
In practical exercises, when the value of
is fixed, the Picard iteration often encounters difficulty with convergence. It typically oscillates around a value significantly higher than the stop criterion
. To address this issue, it becomes necessary to reduce the regularization term on coil currents in Equation (
20) by using a sequence of values for
[
12]:
where
The iteration is stopped when , which usually takes less than twenty iterations.
The detailed block diagram for the Picard iteration is illustrated in
Figure 3. The dashed box highlights the process of determining the coil currents within the inverse mode. The diagram illustrates the Picard iteration process in the COTES code for solving the free-boundary equilibrium in the axisymmetric tokamak geometry. The process begins with an initial guess of the current density,
. This initial guess is used to calculate the boundary flux function,
, and the core flux function,
.
The iteration process starts with . In each iteration, the values of and are identified. Then, the parameters and are calculated based on the specified equations. The current density is updated accordingly.
Next, the boundary flux, , and the core flux, , are recalculated using the updated current density. If the inverse mode is selected, the coil currents are updated based on additional constraints.
The iteration continues with n being incremented by one each time. The process checks whether and whether the norm of the difference between the current and previous flux functions is within a specified tolerance . If the convergence criteria are met, the iteration ends; otherwise, it repeats.
2.7. Vertical Position Instability in Forward Mode
In the forward mode of COTES, the Picard iteration exhibits vertical instability, especially in cases where the plasma shape is asymmetric, such as the lower or upper single null (LSN or USN) X-point configuration. In previous work [
12], a traditional approach to tackle this vertical excursion is to add a pair of fictitious feedback coils with currents:
where
is the vertical coordinate of the fictitious feedback coil and
is the target vertical position. This method works like a proportional and derivative (PD) controller, in which
and
are the P and D gains, respectively. However, a notable drawback of this technique is that the introduction of additional feedback coil currents inevitably alters the resulting
map. Furthermore, the determination of
and
typically relies on trial and error.
Another treatment [
11] also relies on adjusting the feedback coil currents to control the radial magnetic field
, which has a significant impact on the vertical instability. The corresponding feedback coil current is defined as follows:
where
is an adjustable variable
;
and
are the radial magnetic fields due to only the external coil currents and unit feedback coil current, respectively; and (
) is the effective barycenter of the plasma current. By this approach, guessing the vertical desired position is not necessary, but additional coil currents can also change the converged
map.
In this work, a sophisticated approach without feedback coil currents was implemented. Instead of adding fictitious feedback coils, the current density
was adjusted by
where
is the plasma current density in the
n-
Picard iteration in
Figure 3 based on
,
is a relaxing factor, and
is an adjusted control parameter. On the other hand,
represents the modified current density used for the
calculation. The advantage is that no extra coil currents are needed to modify the final
map, although it does necessitate an initial guess for
prior to starting the Picard iteration. Similar methods are widely employed in the equilibrium reconstruction codes EFIT [
13], CLISTE [
26], and LIUQE [
27].