Notes on tokamak equilibrium

Youjun Hu1
Institute of Plasma Physics, Chinese Academy of Sciences
Email: yjhu@ipp.cas.cn

Note: This document has been written using GNU TE Xmacs [14].
Abstract. This document discusses the free boundary tokamak equilibrium fitting problem, fixed-boundary equilibrium problem, and magnetic coordinates.
 1 Introduction
 2 Axisymmetric magnetic field
 3 Non-axisymmetric magnetic perturbations
 4 Plasma current density in terms of Ψ and g
 5 Constraint of force-balance on magnetic field
 6 Free-boundary fitting problem
 7 Semi-free bounday equilibrium problem
 8 Magnetic control
 9 Fixed boundary equilibrium and choices of coordinates
 10 Curvilinear coordinate system
 11 Covariant/contravariant representation of equilibrium magnetic field
 12 Magnetic surface coordinates (ψ,𝜃,ϕ)
 13 Constructing magnetic surface coordinate system from discrete Ψ(R,Z) data
 14 Constructing model tokamak magnetic field
 15 Magnetic surface averaging
 16 Magnetic coordinates (ψ,𝜃,ζ) with general toroidal angle ζ
 17 Field-line-following coordinates
 18 Concentric-circular magnetic configuration with a given safety factor profile
 19 Fixed boundary tokamak equilibrium problem
 20 Misc contents
 A mics
 B Computing magnetic field generated by coils
 C About this document
 References

1 Introduction

A routine in tokamak operation is to reconstruct magnetic field under the constraints of MHD force balance and various measurements. This kind of task can be done by various codes, e.g., EFIT. I developed a similar code, heq (github.com/youjunhu/heq). I will discuss details related to this code.

I also discuss the fixed-boundary equilibrium problem, where the boundary magnetic surface is given and one is asked to solve the force-balance equation within that boundray.

Another topic is how to construct spatial coordinates that conform to the shape of the magnetic surfaces and makes field line equation simple by defining suitable poloidal/toroidal angles, based on discrete numerical equilibrium data output by the equilibrium reconstructing codes.

Let us begin with the basics.

2 Axisymmetric magnetic field

Due to the divergence-free condition, i.e., ∇⋅ B = 0, magnetic field can be expressed as the curl of a vector field,

B = ∇ × A,
(1)

where A is called the vector potential of B. (The usefullness of this representation is that, once B is in this form, we do not need to worry about the divergence-free condition.) In cylindrical coordinates (R,ϕ,Z), the above expression is written

    (             )    (                  )     (           )
B =   1∂AZ- − ∂A-ϕ Rˆ +  1-∂(RA-ϕ)− -1∂AR-  ˆZ +  ∂AR- − ∂AZ-  ˆϕ.
      R ∂ϕ    ∂Z         R   ∂R     R  ∂ϕ         ∂Z    ∂R
(2)

We consider axisymmetric magnetic field. The axial symmetry means that, when expressed in the cylindrical coordinate system (R,ϕ,Z), the components of B, namely BR, BZ, and Bϕ, are all independent of ϕ. For this case, it can be proved that an axisymmetric vector potential A suffices for expressing the magnetic field, i.e., all the components of the vector potential A can also be taken independent of ϕ. Using this, Eq. (2) is written

                          (           )
     ∂A-ϕ ˆ  -1∂(RA-ϕ)ˆ    ∂AR-   ∂AZ-  ˆ
B = − ∂Z R + R   ∂R   Z +   ∂Z  −  ∂R   ϕ.
(3)

In tokamak literature, ˆϕ direction is called the toroidal direction, and (R,Z) planes (i.e., ϕ = const planes) are called poloidal planes.

2.1 Poloidal magnetic field

Equation (3) indicates that the two poloidal components of B, namely BR and BZ, are determined by a single component of A, namely Aϕ. This motivates us to define a function Ψ(R,Z):

Ψ (R, Z) ≡ RA ϕ(R,Z ).
(4)

Then Eq. (3) implies the poloidal components, BR and BZ, can be written as

      -1∂-Ψ
BR = −R ∂Z ,
(5)

B  =  1-∂Ψ.
  Z   R ∂R
(6)

(Note that it is the property of being axisymmetric and divergence-free that enables us to express the two components of B, namely BR and BZ, in terms of a single function Ψ(R,Z).) Furthermore, it is ready to prove that Ψ is constant along a magnetic field line, i.e. B ⋅∇Ψ = 0. [Proof:

           (            )
B ⋅∇ Ψ = B ⋅  ∂ΨRˆ+  ∂ΨZˆ
             ∂R     ∂Z
          1-∂Ψ-∂Ψ-  1-∂Ψ-∂Ψ-
      = − R ∂Z ∂R + R ∂R ∂Z
      = 0.                                         (7)
]

We note that Ψ is related to the poloidal magnetic flux, as we will discuss in Sec. 2.7.

Using Eqs. (5) and (6), the poloidal magnetic field Bp is written as

Bp = BRRˆ +BZ ˆZ
       1∂ Ψ     1∂Ψ
   = −R-∂Z-Rˆ+ R-∂R-ˆZ
     1
   = R-∇Ψ × ˆϕ
   = ∇Ψ × ∇ ϕ                                   (8)

2.2 Toroidal magnetic field

Next, let’s examine the toroidal component Bϕ. Equation (3) indicates that Bϕ involves both AR and AZ. This indicates that using the potential form does not enable useful simplification for Bϕ. Therfore we will directly use Bϕ. Define g RBϕ(R,Z) (the reason that we define this quantity will become clear when we discuss the forece balance), then the toroidal magnetic field is written as

            g
Bϕ = Bϕϕˆ=  -ˆϕ = g∇ ϕ.
            R
(9)

2.3 General form of axisymmetric magnetic field

Combining Eqs. (8) and (9), we obtain

B = Bp + B ϕ

  = ∇ Ψ × ∇ϕ + g∇ϕ,                           (10)
which is a general expression of axisymmetric magnetic field. Expression (10) is a famous formula in tokamak physics.

2.4 Gauge transform of Ψ

Let us discuss the gauge transformation of A in the axisymmetric case. As is well known, magnetic field remains the same under the following gauge transformation:

Anew = A +∇f,
(11)

where f is an arbitrary scalar field. Here we require that f be axisymmetric because, as mentioned above, an axisymmetric vector potential suffices for describing an axisymmetric magnetic field. In cylindrical coordinates, f is given by

∇f = -∂fRˆ+ -∂fˆZ + 1-∂fϕˆ.
     ∂R     ∂Z     R ∂ϕ
(12)

Since f is axisymmetric, it follows that all the three components of f are independent of ϕ, i.e., 2f∕∂R∂ϕ = 0, 2f∕∂Z∂ϕ = 0, and 2f∕∂ϕ2 = 0, which implies that ∂f∕∂ϕ is independent of R, Z, and ϕ, i.e., ∂f∕∂ϕ  is actually a spatial constant. Using this, the ϕ component of the gauge transformation (11) is written

Anϕew= A ϕ +-1∂f-
           R ∂ϕ
    = A ϕ + C-,                             (13)
           R
where C is a constant. The requirement of being axial symmetry greatly reduces the degree of freedom of the gauge transformation for Aϕ. Multiplying Eq. (13) with R, we obtain the corresponding gauge transformation for Ψ,
Ψ new = Ψ + C,
(14)

which indicates Ψ is similar to that of electric potential, i.e., adding a constant to it does not make difference. Note that the definition Ψ(R,Z) RAϕ does not imply Ψ(R = 0,Z) = 0 because Aϕ can adopt 1∕R dependence under the gauge transformation (13). If Aϕ is finite at R = 0, then Ψ is zero there. This is the case we encounter in equilibrium reconstruction.

2.5 Contours of Ψ in the poloidal plane

Because Ψ is constant along a magnetic field line and Ψ is independent of ϕ, the projection of a magnetic field line onto (R,Z) plane is a contour of Ψ. Inversely, a contour of Ψ is also projections of a magnetic field line onto the plane. [Proof. A contour of Ψ on (R,Z) plane satisfies

dΨ = 0,
(15)

i.e.,

∂Ψ      ∂Ψ
∂R-dR + ∂Z-dZ = 0.
(16)

   1 ∂Ψ      1∂Ψ
⇒  ----dR + -----dZ = 0.
   R∂R      R ∂Z
(17)

Using Eqs. (5) and (6), the above equation is written

BZdR  − BRdZ = 0,
(18)

i.e.,

dZ-   BZ-
dR =  BR ,
(19)

which is the equation of the projection of a magnetic field line in (R,Z) plane. This proves that contours of Ψ are projections of magnetic field lines in (R,Z) plane.]

Figure 1 shows typical contours of Ψ in a tokamak (CFETR tokamak as an example).


pict

 

Fig. 1: Blue lines are contours of Ψ. The black line is the machine wall.

Points where the poloidal field is zero (i.e., Ψ=0) are called magnetic null points. There are two types of magnetgic null points : O-points and X-points, which can be visually identified by viewing contours of Ψ. Mathematically, O-points and X-points are distinguished by the sign of S defined by

         ∂2Ψ ∂2Ψ   (  ∂2Ψ )2
S(R,Z ) = ∂R2-∂Z2-−  ∂R∂Z--  ,
(20)

where S 0 corresponds to O-points and S < 0 corresponds to X-points.

2.6 Magnetic surfaces

Surfaces of revolution generated by rotating Ψ contours around the axis of symmetry (Z axis) are called magnetic surfaces or flux surfaces. No field line intersects these surfaces. We are only interested in flux surfaces within the machine wall. We note that some Ψ contours may intersect the wall before they can form closed curves. Field lines on the corresponding flux surfaces are called open field lines.

The value of Ψ is constant on a magnetic surface. Meanwhile, the values of Ψ on different magnetic surfaces are usually different. These two properties enable Ψ to be used as labels of magnetic surfaces. In cases that there are multiple magnetic surfaces of the same value of Ψ, the ambiguity can be resolved by specifying which region the flux surfaces lie in, e.g., within or outside the last-closed-flux surface region, near the high-field side or low-field side, in the Scrape-Off Layer or the private flux region (PFR).

PFR:  the area between the X-point and the material divertor., i.e, the region between divertor legs that is unconnected to the plasma.

2.7 Relation of Ψ with the poloidal magnetic flux

Note that Ψ is defined by Ψ = RAϕ, which is just a component of the vector potential A, thereby having no obvious physical meaning. Next, we show that Ψ has a simple relation with the poloidal magnetic flux that can be be measured in experiments.


pict

Fig. 2: The poloidal magnetic flux Ψp(12) between the two magnetic surfaces Ψ1 and Ψ2 is given by Ψp(12) = 2π(Ψ2 Ψ1).

In Fig. 2, there are two magnetic surfaces labeled, respectively, by Ψ = Ψ1 and Ψ = Ψ2. The poloidal magnetic flux through any toroidal ribbons between the two magnetic surfaces is equal to each other (due to the magnetic Gauss theorem). Next, we calculate this poloidal magnetic flux, denoted by Ψp(12). To make the calculation easy, we select a plane perpendicular to the Z axis, as is shown by the dash line in Fig. (2). In this case, only BZ contribute to the poloidal magnetic flux: (the positive direction of the plane is chosen in the direction of ˆZ)

  (12)  ∫ R2
Ψ p  =     Bz (R, Z)2πRdR
       ∫R1R2
     =      1∂-Ψ2πRdR
        R1  R∂R
          ∫ R2 ∂Ψ
     = 2π     ∂R-dR
           R1
     = 2π[Ψ2 − Ψ1].                              (21)
Equation (21) indicates that the difference of Ψ between two magnetic surfaces is equal to the poloidal flux divided by 2π.

In experiments, we measure the poloidal magnetic flux through toroidal loops around the central symmetric axis (discussed in Sec. 2.8). Consider one of the loops that located at point (R,Z), then, using (21), the flux through the loop can be written as

Ψp = 2π[Ψ (R, Z)− Ψ(R = 0,Z)],
(22)

The central symmetric axis (R = 0) is a field line. If Aϕ is finite at R = 0, then Ψ = AϕR is zero there. This is the case we encounter in equilibrium reconstruction. Then this flux is written as

Ψ = 2πΨ (R,Z).
 p
(23)

Due to this relation, Ψ is often called the poloidal magnetic flux per radian (SI unit: web/rad). This relation allows the poloidal flux measurements to be used to constrain the GS equation in the equilibrium reconstrunction (discussed in Sec. 6). Note that the positive normal direction of the surface (where the magnetic flux Ψp is defined) is chosen in the +Z direction.

2.8 Measuring poloidal magnetic flux in experiments

Tokamaks usually have some toroidal wire loops around the central symmetirc axis, called flux loops, which are used to measure the poloidal magnetic flux through the loops. (By measuring the voltage around the loops, we can obtain the time derivative of the flux and, after integrating over time, the flux itself.)

Suppose that the loop is located at (R,Z) and denote the magnetic flux through the loop by Ψp(R,Z,t) (only the poloidal magnetic field contribute to this flux since the loop is in the toroidal direction). Then Faraday’s law gives

     dΨ
𝜀 = −--p-,
      dt
(24)

where 𝜀 is the emf. If the loop is a coil with N turns, the induced voltage V in the coil is N times the emf 𝜀, i.e., V = N𝜀. Using this, Eq. (24) is written as

V = − NdΨp-.
        dt
(25)

Integrating the above equation over time, we obtain

                         ∫
                       1-  t
Ψp(R,Z,t) = Ψp(R,Z,0)− N  0 Vdt.
(26)

The starting time t = 0 can be chosen as when Ψp(R,Z,0) is easy to know (e.g., when there is no plasma). Equation (26) tells us how to calcualte Ψp from the measured loop voltage V .

There are usually many flux loops (e.g. 35 on EAST[32]) at different locations in the poloidal plane (see Fig. 3). They are outside of the plasma region and thus are  called “external magnetic measurements”. The measured poloidal flux, along with the poloidal field measurement by magnetic probes, can be used as constraints in reconstructing the magnetic field within the plasma region. This is discussed in Sec. 6.


pict

Fig. 3: Flux loops (circles) and magnetic probes (blue arows) on EAST tokamak. Arrows indicate the positive normal direction of the probes.

 

2.9 Closed magnetic surfaces

In most part of a tokamak plasma, contours of Ψ in (R,Z) plane are closed before they touch the machine wall. Figure 4 shows some examples of closed flux surfaces.


pict

Fig. 4: Closed magnetic surfaces (blue) and various toroidal surfaces used to define the poloidal magnetic flux. The magnetic flux through the toroidal surface S2 and S3 is equal to each other. Also the magnetic flux through S4 and S5 is equal to each other; the magnetic flux through S0 and S1 is equal to each other.

The innermost magnetic surface reduces to a curve, which is called magnetic axis (in Fig. 4, Ψ0 labels the magnetic axis). Ψ is zero at the magnetic axis since Ψ(R,Z) reach maximum/minimum there. As a result, the poloidal magnetic field is zero there (refer to Eq. (8)).

As is discussed in Sec. 2.7, the poloidal magnetic flux enclosed by a magnetic surface Ψ (the poloidal magnetic flux through the toroidal surfaces S2) is given by

Ψ(paxis) = 2π(Ψ0 − Ψ).
(27)

Here the positive direction of the surface S2 is defined to be in the clockwise direction when an observer looks along the direction of ˆϕ. In practice, we need to pay attention to the positive direction chosen (there can be a sign difference when choosing different positive directions).

Also note, the poloidal magnetic flux enclosed by a closed magnetic surface can have another definitions: the poloidal magnetic flux through the central hole of the magnetic surface, i.e., the poloidal flux through S1 in Fig. 4. In this case, as is discussed in Sec. 2.7, the poloidal magnetic flux is related to Ψ by

Ψp = 2π(Ψ − Ψ(R = 0,Z )) = 2πΨ,
(28)

where the positive direction of the surface S1 is in the clockwise direction.

Also note that, since Bp = Ψ ×∇ϕ, the condition ΨLCFS Ψaxis > 0 means Bp points in the anticlockwise direction (viewed along ϕ direction), and ΨLCFS Ψaxis < 0 means Bp points in the clockwise direction.

 

3 Non-axisymmetric magnetic perturbations

In the above, the magnetic field is assumed to be axisymmetric. With this assumption, the poloidal magnetic field (having two components) can be expressed in terms of a single component of the vector potential A, Aϕ (specifically via Ψ AϕR). This kind of simplification is not achievable if the axisymmetricity assumption is dropped, because other components of the vector potential (namely AR and AZ) will appear in the expression of the poloidal magnetic field. Let us re-examine Eq. (2) for a general magnetic perturbation:

     (              )     (                    )
δB  =  1-∂δAZ-−  ∂δAϕ- ˆR +   1-∂(R-δAϕ)-− 1-∂δAR- Zˆ
      R  ∂ϕ      ∂Z         R   ∂R      R  ∂ϕ
     (∂δAR    ∂δAZ )
   +  -∂Z-- − -∂R-- ϕˆ.                                       (29)
When studying tearing modes and turbulence, most authors narrow the possible perturbations by setting δAR = δAZ = 0, i.e.,
        1∂ δΨ
δBR = − R-∂Z-,
(30)

δBZ  = 1-∂δΨ,
       R ∂R
(31)

δBϕ = 0.
(32)

where δΨ = RδAϕ. Therefore this kind of magnetic perturbation can still be written in the same form of the equilibrium poloidal magnetic field:

δB = ∇ δΨ × ∇ϕ.
(33)

The above approximation is widely used in practice, e.g., in turbulence simulation, where δAϕ is replaced by δA. (Do we miss some magnetic perturbations that is important for plasma transport when using the above specific form?)

The total magnetic field is then written as

B = ∇ (Ψ + δΨ )× ∇ϕ + g∇ϕ.
(34)

**check**Can the projection of the total magnetic field line in the poloidal plane can be traced by tracing the contour of Ψ + δΨ? No. The contours of Ψ + δΨ will not show island structures in the poloidal plane. To show the expected island structures, we need to subtract non-reconnecting poloidal magnetic field from the total poloidal field? **check** The contours of the so-called helical flux will give the expected island structures near the resonant surfaces?**check**

Next, we go back to discuss the 2D case (i.e., assuming axisymmetry).

4 Plasma current density in terms of Ψ and g

When the displacement current term is neglectable (the case we consider here), the conductive current is just another representation of the magnetic field. Specifically, the current density is proportional to the curl of the magnetic field (Ampère’s law):

μ0J = ∇ × B                (            )
       ∂B-ϕˆ   1-∂(RB-ϕ)ˆ    ∂BR-   ∂BZ-  ˆ
   = −  ∂Z R + R   ∂R   Z+    ∂Z −  ∂R   ϕ,               (35)
where μ0 is vacuum magnetic permeability.

4.1 Poloidal current density

Use Eq. (35) and the definition g RBϕ, the poloidal components of the current density, JZ and JR, can be written as

μ0JR = −-1∂g-,
        R ∂Z
(36)

and

μ0JZ =  1-∂g,
        R∂R
(37)

respectively.

4.2 Toroidal current density

Ampere’s law (35) indicates the toroidal current density Jϕ is given by

      ∂BR    ∂BZ
μ0Jϕ =-∂Z- − -∂R-
        1 ∂2Ψ    ∂ ( 1 ∂Ψ)
    = − ----2-− ---  ----- .                      (38)
        R ∂Z    ∂R   R ∂R
Define by
       2        (      )
△ ∗ ≡ ∂-2-+ R-∂-  1--∂- ,
      ∂Z     ∂R   R ∂R
(39)

which is the Laplace operator in cylindrical coordinates for the axisymmertic case, then Eq. (38) is written as

       -1-- ∗
Jϕ = − μ0R△  Ψ.
(40)

(Many authors refer to Eq. (40) as the Grad-Shafranov (GS) equation. No, it is not. It is just Ampere’s law, which has nothing to do with the force-balance. Only after you express Jϕ in terms of the plasma pressure, can Eq. (40) be called the GS equation, as is discussed Sec. 5.3.)

5 Constraint of force-balance on magnetic field

Let us consider what constraint the force balance imposes on the axisymmetric magnetic field discussed above. The MHD momentum equation is given by

  (∂u         )
ρ  -∂t + u ⋅∇u  = ρqE + J × B − ∇ ⋅ℙ
(41)

where ρ, ρq, , J, E, and B are mass density, charge density, thermal pressure tensor, current density, electric field, and magnetic field, respectively. The electric field force ρqE is usually ignored due to either ρq = 0 or E = 0. Further assume that there is no plasma flow (u = 0, the flow effect is discussed in A.4) and the plasma pressure is isotropic, then the steady state momentum equation (force balance equation) is written as

J × B = ∇P,
(42)

where P is the scalar plasma pressure.

Is the force balance (42) always satisfied in a real toakamak discharge? To answer this question, we need to go back to the original momentum equation (41). The imbalance between J × B and P will give rise to the compressional Alfven waves, the time-scale of which, τA, is much shorter than the time-scale τ we are interested in. Therefore, on the time scale τ (and for slow flow with u < Cs, where Cs is the the sound speed), the leading order of the momentum equation is the force balance (42).[26].

5.1 Parallel force balance

Consider the force balance in the direction of B. Dotting the equilibrium equation (42) by B, we obtain

0 = B ⋅∇P,
(43)

which implies that P is constant along a magnetic field line. Since Ψ is also constant along a magnetic field line, P can be expressed in terms of only Ψ on a single magnetic line. Note that this does not necessarily mean P is a single-valued function of Ψ, (i.e. P = P(Ψ)). This is because P still has the freedom of taking different values on different magnetic field lines with the same value of Ψ while still satisfying B ⋅∇P = 0. This situation can appear when there are saddle points (X points) in Ψ contours (refer to Sec. A.13) and P takes different functions of Ψ in islands of Ψ sepearated by a X point. For pressure within a single island of Ψ, P = P(Ψ) can be safely assumed.

On the other hand, if P = P(Ψ), then we obtain

B ⋅∇P = dP-
dΨB ⋅∇Ψ = 0,

i.e., Eq. (43) is satisfied, indicating P = P(Ψ) is a sufficient condition for the force balance in the parallel (to the magnetic field) direction.

5.2 Toroidal force balance

Consider the force balance in the toroidal direction. The ϕ component of Eq. (42) is written

               -1∂P-
JZBR  − JRBZ = R  ∂ϕ.
(44)

Since P = P(Ψ), which implies ∂P∕∂ϕ = 0, equation (44) reduces to

JZBR − JRBZ  = 0
(45)

Using the expressions of the poloidal current density (36) and (37) in the force balance equation (45) yields

∂g      ∂g
∂R-BR + ∂Z-BZ = 0,
(46)

which can be further written

B ⋅∇g = 0.
(47)

According to the same reasoning for the pressure, we conclude that g = g(Ψ) is a sufficient condition for the toroidal force balance. (The function g defined here is usually called the “poloidal current function” in tokamak literature. The reason for this name is discussed in Sec. A.5.)

5.3 Force balance along the major radius

Consider the force balance in  ˆ
R direction. The ˆ
R component of Eq. (42) is written

JϕBZ − JZB ϕ = ∂P
              ∂R
(48)

Using the expressions of the current density and magnetic field [Eqs. (6) and (37)], equation (48) is written

J  1-∂Ψ-− -1--∂g-g-= ∂P-.
 ϕ R ∂R   μ0R ∂R R   ∂R
(49)

Assuming the sufficient condition discussed above, i.e., P and g are a function of only Ψ, i.e., P = P(Ψ) and g = g(Ψ), Eq. (49) is written

  1-∂Ψ-  -1--dg-∂Ψ-g-  dP-∂Ψ-
JϕR ∂R − μ0R dΨ ∂R R = dΨ ∂R ,
(50)

which can be simplified to

      dP     1  dg
Jϕ = R dΨ-+ μ0R-dΨ-g,
(51)

which is the requirement of force-balance along the major radius. On the other hand, we know Jϕ can be expressed in Ψ via Eq. (40). Combining this with Eq. (51) yields

△∗Ψ = − μ R2dP-− -dgg,
         0  dΨ   dΨ
(52)

i.e.,

  2        (      )
-∂Ψ- +R -∂-  1-∂Ψ-  = − μ0R2 dP-− dgg.
∂Z2     ∂R   R ∂R           dΨ   dΨ
(53)

Equation (53) is known as Grad-Shafranov (GS) equation.

[Note that the Z component of the force balance equation is written

JRBϕ JϕBR = ∂P-
∂Z
⇒−-∂g-
∂Z1-
R-g
R -1
RΨ1-
R∂Ψ-
∂Z = μ0dP-
dΨ∂Ψ-
∂Z
⇒−-dg
dΨ∂Ψ-
∂Z1-
Rg-
R 1-
RΨ-1
R∂Ψ-
∂Z = μ0dP
dΨ∂Ψ-
∂Z
⇒−-dg
dΨ1-
R-g
R -1
RΨ1-
R = μ0dP
dΨ
⇒△Ψ = μ0R2dP
dΨ dg
dΨg

which turns out to be identical with the Grad-Shafranov equation. This is not a coincidence. The reason is that the force balance equation has been satisfied in three different directions (namely, ˆ
ϕ, ˆ
R, and B direction) and thus it must be satisfied in all the directions.]

5.4 Axisymmetric equilibrium magnetic field

A general axisymmetric magnetic field (which does not necessarily satisfy the force balance), is given by Eq. (10), i.e.,

B = ∇◟Ψ-×◝◜∇-ϕ◞+  g◟∇◝◜ϕ◞ ,
     poloidal   toroidal
(54)

For the above axisymmetric magnetic field to be consistent with the force balance equation (42), there are additional requirements for Ψ and g. Specifically, Ψ is restricted by the GS equation and g should be a function of only Ψ. Therefore an axisymmetric equilibrium magnetic field is fully determined by two functions, Ψ = Ψ(R,Z) and g = g(Ψ). The Ψ is determined by solving the GS equation with specified RHS source terms and boundary conditions.

The RHS source terms in the GS equation (53) are P(Ψ) and g(Ψ), both of which must be specified before the GS equation can be solved. For most cases, the source terms are nonlinear about Ψ and thus the GS equation is a two-dimensional (in R and Z) nonlinear partial differential equation for Ψ.

For most choices of P(Ψ) and g(Ψ), the GS equation (53) has to be solved numerically. For some particular choices of P and g profiles, analytical solutions are available, one of which is the Solovév equilibrium and is discussed in Appendix A.3.

Note that we solve the GS equation in order to obtain the poloidal magnetic flux Ψ and thus the poloidal magnetic field. The toroidal magnetic field must be specified in some way before we can solve the GS equation. There are several ways of specifying the toroidal magnetic field: (1) given g(Ψ), (2) given j, (3) given the safety factor q(Ψ). There are simple relations between g, j, and q, which allows translation form one to another (discussed later). In transport simulations, jis obtained from current drive models and neoclassical bootstrap current models. Note that the specification of the source terms (P, g, q, and j) usually involve the unknown Ψ (via not only the explicit presence of Ψ, but also the flux-surface averaging which implicit involves Ψ). This indicates that iterations are needed when numerically solving the GS equation.

5.5 Axisymmetric equilibrium current density

Since J = μ01∇× B, the current density J can be inferred from a given magnetic field. The components of J (expressed in terms of g and Ψ) are given by Eqs. (36), (37) and (40) and these expressions can be further simplified by using the equilibrium constraints, such as g = g(Ψ) and Ψ = μ0R2dP-
dΨ dg
dΨg. The simplified J expressions are given in A.11.

On the other hand, in the kinetic equilibrium reconstruction[20], it is the current that is first (partially) specified (e.g., by summing sources of current drive and bootstrap current) and then the current is used as constraints for the GS equation, i.e, constraints for the magnetic field.

5.6 Equilibrium scaling

The GS equation is given by Eq. (53), i.e.,

 ∂2Ψ      ∂ ( 1 ∂Ψ )         dP   dg
---2 +R ---  -----  = − μ0R2---− --g.
∂Z      ∂R   R ∂R           dΨ   dΨ
(55)

If a solution to the GS equation is obtained, the solution can be scaled to obtain a family of solutions. Given an equilibrium with Ψ(R,Z), P(Ψ), g(Ψ), then it is ready to prove that Ψ2 = , P2 = s2P(Ψ), and g2 = ±sg(Ψ) is also a solution to the GS equation, where s is a constant. In this case, both the poloidal and toroidal magnetic fields are increased by a factor of s, and thus the safety factor remains unchanged. Also note that the pressure is increased by s2 factor and thus the value of β (the ratio of the therm pressure to magnetic pressure) remains unchanged. Note that g2 = ±sg(Ψ), which indicates that the direction of the toroidal magnetic field can be reversed without breaking the force balance. Also note that Ψ2 = and s can be negative, which indicates that the direction of the toroidal current can also be reversed without breaking the force balance.

The second kind of scaling is to set Ψ2 = Ψ, P2 = P(Ψ), and g22 = g2(Ψ) + c. It is ready to prove that the scaled expression is still a solution to the GS equation because g2g2= gg. This scaling keep the pressure and the poloidal field unchanged and thus the poloidal beta βp remains unchanged. This scaling scales the toroidal field and thus can be used to generate a family of equilibria with different profiles of safety factor.

Another scaling, which is trivial, is to set Ψ2 = Ψ, P2 = P(Ψ) + c, and g2 = g(Ψ). This scaling can be used to test the effects of the pressure (not the pressure gradient) on various physical processes.

When a numerical equilibrium is obtained, one can use these scaling methods together to generate new equilibria that satisfy particular global conditions. Note that the shape of magnetic surfaces of the scaled equilibrium remains the same as the original one.

The above scaling is made under the constraint that the the GS equation (55), is satisfied. In practice, we may scale Ψ by a factor while fixing g and P. This does not satisfy the GS equation, but allows more flexibility in changing the the safety factor profile. Scaling Ψ by a factor corresponds to scaling the plasma current and the poloidal magnetic field.

6 Free-boundary fitting problem

Ampere’s law in Eq. (40) can be generalized to include discrete toroidal currents:

△ ∗Ψ = − μ0RJ ϕ − μ0R ∑ Iiδ(R − Ri)δ(Z − Zi),              (56)
                     i
where Jϕ is the plasma toroidal current density,  Ii is the toroidal curent in No. i PF coil located at (R = Ri,Z = Zi), δ is Dirac’s delta function. The solution to the above equation is given by
         ∫     ′  ′         ′  ′   ′  ′  N∑c−1
Ψ(R,Z ) =   G(R ,Z ,R,Z)Jϕ(R ,Z )dR dZ  +     G(Ri,Zi,R,Z )Ii,
          Ω                              i=0
(57)

where G is the fundamental solution given by

  G(R ′,Z′,R,Z)
  μ0R ∫ 2π              R′cosϕ′dϕ′
= -4π-    ∘-------′2---------′---′-2----′----′2,            (58)
       0    (Z − Z ) + (R − R cosϕ ) + (R sin ϕ)
which is often called Green’s function in this context. (The Green function is obtained by using a formula similar to the Biot-Savart Law, see 676.)

If all the toroidal currents (plasma current + PF coil curents) are known, then Ψ can be calculated by using Eq. (57). Unfortunately Jϕ is usually unknown. On the other hand, the force-balance indicates that Jϕ can be expressed in terms of Ψ via Eq. (51), i.e.,

      dP     1  dg
Jϕ = R---+ ----g---.
      dΨ   μ0R  dΨ
(59)

Substituting this into Eq. (57) gives an implicit formula for Ψ, which can be iterated (with an initial guess of Ψ(R,Z), and assuming the function forms, P(Ψ) and g(Ψ), as well as the coil currents Ii, are known ). Will the iteration converge? We do not know for sure. Numerical experiments indicate it does in some cases[18]. Let us discuss these cases. We assume that the 1D functions, P(Ψ) and g(Ψ) can be modeled as (following EFIT’s model):

        {
dP-(Ψ-)    ∑NPj=−01 αj(xj − xNp )forx ≤ 1
  dΨ  =   0    for x > 1
(60)

 dg   { ∑NF −1β (xj − xNF )forx ≤ 1
gdΨ-=   0 j=0 forxj> 1
(61)

where

   --        (Ψ − Ψ  )
x ≡ Ψ ≡ ΨN ≡ -----M--,
             ΨB − ΨM
(62)

ΨM and ΨB are values of Ψ at the magnetic axis and LCFS, the coefficients αj and βj are to be determined, Np and NF are integers chosen by users. One feature of expressions (60) and (61) is that they guarantee that dP∕dΨ and gdg∕dΨ are zero at and outside the LCFS, and thus no plasma current there. Also note that expressions (60) and (61) are nonlinear functions of Ψ even for Np = NF = 1. This is because the unknowns, ΨM and ΨB, appear in the denominator of expression (62). Another nonlinearity is related to the fact that the unkonw Ψ determines where is the LCFS and thus determine region where the current desnsity is set to zero. This also gives rise to the name “free-boundary” when referring to this kind of problem.

Choosing an initial guess of Ψ(R,Z) on gridpoints, we can get the values of αj, βj, and Ii by solving a least square problem that minimises the difference between quantities computed and the corresponding quantities measured in actual experiments. (Details are given in Sec. 6.1.)

After the coefficients αj and βj are obtained, Jϕ can be updated by using Eqs. (59)-(62). Then, we use the latest Jϕ and Ii in Eq. (57) to update the values of Ψ on gridpoints. We repeat the above procedure until convergecne in Ψ(R,Z). This is called Picard iteration. (Alternatively, the values of Ψ on the inner gridpoints can be updated by inverting the Laplace operator , see Sec. 6.4. The values of Ψ on the bounary still have to be obtained by using Eq. (57).)

I implemented the above method in a Python code HEQ (https://github.com/youjunhu/heq). The following subsections discuss details in the code: Sec. 6.1 discusses the least square problem. Sec. 6.3 discusses the vertical displacement instability stabilizer. Without the stabilizer, the Picard iteration diverges for many elongated configurations, due to the vertical displacement instability.

6.1 Response matrix Γ

Plugging expressions (60) and (61) into (59), we obtain

             Np−1                  N − 1
J (R ′,Z ′) = R′∑   α (xj − xNp)+ -1-- F∑   β (xj − xNF),          (63)
 ϕ            j=0  j            μ0R′ j=0  j
For notation ease, define the following basis functions:
       { R′(xj − xNp)         for  0 ≤ j < N
bj(x) =    j− Np   NF      ′                p
         (x    − x  )∕(μ0R )  for  Np ≤ j < Np + NF
(64)

and the corresponding expansion coefficients

    {
     αj   for  0 ≤ j < Np
cj =  βj−Np   for  Np ≤ j < Np + NF
(65)

then Eq. (63) is written as

     N∑b−1
Jϕ =     cjbj(x),
     j=0
(66)

where Nb = NP + NF. Plugging expression (66) into Eq. (57), we obtain

                ∫
          N∑b− 1        ′  ′           ′  ′
Ψ (R,Z) =     cj ΩG (R ,Z ,R, Z)bj(x)dR dZ
          j=0
          N∑c− 1   (c)  (c)
        +     G(Rj ,Z j ,R,Z)Ij.                         (67)
          j=0
Collect all the free parameters as a column vector: u = (c0,cNb1,I0,,INc1)T. Denote the size of vector u by N, which is the number of free parameters, i.e., N = Nb + Nc, then the rhs of Eq. (67) can be written as matrix-vector product, Γu. Denote the total number of measurements of the poloidal flux by MFL. Then matrix elements of Γ for i = 0,,MFL 1 are given by:
     ∫      ′ ′  (FL)  (FL)       ′  ′
Γ ij = Ω G(R ,Z ,Ri ,Z i  )bj(x)dR dZ ,
(68)

for j = 0,,Nb 1, and

         (c)    (c)    (FL)  (FL)
Γ ij = G (R j−Nb,Zj−Nb,Ri ,Zi  ),
(69)

for j = Nb,,N 1. Here (Ri(FL),Zi(FL)) is the location where the ith flux measurement is made.

The matrix Γ , which is of shape (M,N), is called “response matrix”. (In least square problems, this matrix is called “design matrix’.) The value of M is equal to number of measurements included (measurements are merged to Γ by row stacking). We will include MFL measurements of the poloidal flux, MB measurements of the poloidal magnetic field, 1 measurement of plasma current, a constraint for the on-axis safety factor. Then M = MFL + MB + 1 + 1. (For EAST, MFL = 35,MB = 38.)

Next, we consider the poloidal field measurement:

Bp (Ri,Zi) = Bp ⋅nˆi = BR cos𝜃pi + BZ sin𝜃pi,
(70)

where (Ri,Zi) is the location of the No. i probe, ˆni is a unit vector denoting the positive normal direction of the No. i magnetic probe, cos𝜃pi = ˆni eR, sin𝜃pi = nˆi eZ.

Bp(Ri,Zi) can be inferred from u via

           N −1   ∫
B (R ,Z ) = ∑b  c   G  (R′,Z′,R  ,Z )b (x)dR ′dZ ′
  p  i i    j=0 j  Ω  B        i  i j
           N −1
            ∑c       (c)  (c)
         +      GB(R j ,Z j ,Ri,Zi)Ij.                       (71)
            j=0

where

GB (R′,Z′,Ri,Zi) = GBR(R ′,Z′,Ri,Zi)cos𝜃pi + GBZ (R′,Z′,Ri,Zi)sin𝜃pi,
(72)

and GBR and GBZ is given by Eq. (681) and (682). The rhs of Eq. (71) indicates that the matrix elements of Γ are given by:

     ∫
             ′  ′            ′  ′
Γ ij = Ω GB (R ,Z ,Ri,Zi)bj(x)dR dZ ,
(73)

for (j = 0,,Nb 1), and

Γ ij = GB (R(c) ,Z(c) ,Ri,Zi),
          j−Nb  j−Nb
(74)

for (j = Nb,,N 1) . I place the magnetic field equations after the flux equations, i.,e the row number i is in the range [MFL,MFL + MB 1].

Next, we consider the constraint of plasma current. The plasma current Ip can be inferred from u via

    ∫       ′  ′  N∑b−1  ∫        ′  ′
Ip =   JϕdR dZ  =     cj  bj(x)dR dZ.
      Ω           j=0    Ω
(75)

The rhs of Eq. (75) indicates that the matrix elements of Γ are given by:

      ∫
Γ ij =   bj(x)dR ′dZ ′,
       Ω
(76)

for (j = 0,,Nb 1), and zero for (j = Nb,,N 1) . This equation is placed after the equations of flux and magnetic field measurement, i.e., its row number is  i = MFL + MB.

Let us consider the constraint of on-axis safety factor value. A formula for computing q value at the magnetic axis is given by [ref. P. M. Bellan’s paper]:

       2
qaxis = e-+21-g(0)--,
      eR axisμ0Jϕaxis
(77)

where

   ∘ --------------
     ( ∂2Ψ∕∂R2 )
e =    ∂2Ψ∕∂Z2-    ,
                axis
(78)

is the elongation at the magnetic axis. Using

Jϕ axis = j=0Nb1c jbj(0)

expression (77) is written as

    2     Nb∑− 1
-eR-axisμ0-     cjbj(0) =-1--.
(e2 + 1)g(0) j=0        qaxis
(79)

In HEQ, this constraint is not included in some cases.

6.2 Algorithm summary

Step 0. Initial guess of Ψ: Ψ(k) with k = 0.

Step 1. Compute elements of response matrix Γ using Ψ(k).

Step 2. Solve linear least-square problem to get (c1,c2,c2,c4,I1,,INc).

Step 3. Update Ψ using the Picard iteration:

        ∫                               N∑c
Ψ (k+1) =  GJ ϕ(R′,Ψ (k),c1,c2,c3,c4)dR′dZ′ +   GIn,
                                        n=1
(80)

or in its discrete form:

        ∑       ( ∑4       )        N∑c
Ψ(ijk+1) =    Gi′j′ij     cnbn,i′j′ dSi′j′ +   G (cn,)ijIn.
        i′,j′       n=1                n=1
(81)

Step 4: k = k + 1 and goto Step 1.

 

In Step 1, we first search for the magnetic axis and boundary surface of Ψ(k) so that we can get the values of Ψ(k) at those locations. These values are needed in computing x = (Ψ(k) ΨM)(ΨB ΨM).

6.3 Vertical Displacement Event (VDE) stabilizer in free-boundary solver[17]

 

To stabilize the vertical displacement instability in the Picard iteration, we add two virtual coils that carry oppositive currents (denoted by Ivc and Ivc), and are up-down symmetric, located at (Rvc,Zvc) and (Rvc,Zvc), respectively. And set the current Ivc by

Ivc = gz--------------BR,vacuum(Rcur,Zcur)--------------
GBR (Rvc,Zvc,Rcur,Zcur) − GBR (Rvc,− Zvc,Rcur,Zcur),

where (Rcur,Zcur) is the location of plasma current center defined by

Rcur = 1-
Ip ΩplRJϕ(R,Z)dRdZ,

Zcur = 1-
Ip ΩplZJϕ(R,Z)dRdZ,

BR,vacuum is the BR generated by all the real PF coils, gz is a positive constant chosen by users. Note that g = 1 corresponds to that the BR generated by the virtual coils exactly cancles the BR generted by all the real coils. Usually we need value larger than 2, i.e., over compensation. The virtual coils locatons, (Rvc,Zvc) and (Rvc,Zvc), are usually chosen near the center of the top/bottom boundary of the computational box.

6.4 Solving by matrix inversion

If we want to invert the finite-difference version of the Laplace operator to solve the GS equation for Ψ, we encounter two issues: (1) the RHS of the GS equation involves 2 unknown functions P(Ψ) and gg(Ψ), in addition to the main unknown function Ψ(R,Z); (2) the boundary condition needs to be given: i.e., the values of Ψ on a rectangular computational boundry need to be provided.

To address issue (1):  function forms of P(Ψ) and gg(Ψ) are chosen by users, often as polymials in ΨN with coefficients that are assumed known (which are later obtained in the least-square method to make the resulting solution approximately match some measurements, as is discussed in the previous section).

To address issue (2): The value of Ψ on the rectangular boundary is updated using the Green’s function method (assume that external coil currents are given), as is discussed in the previous section.

Guess values of Ψ on both the inner gridpoints and boundary points. After this, we can invert to update Ψ within the computational box, and use the Green’s function method to update values of Ψ on the boundary. Then iterate to converge.

Two iterations: one for Ψ values on the inner gridpoints, one over Ψ values on the computational boundary.

External PF coil currents enter the problem via the boundary condition: specifically via its contribution to Ψ on the boundary.

The above procedure is just a minor modification from the pure Green’s function algorithm discussed in Sec. 6.2, i.e., replacing the Green’s function method for the inner gridpoints with the finte-difference Laplace operator inverting.

For reference easy, the finite-difference schemes for the Laplace operator is listed below.

△ ∗Ψ = − μ0RJϕ
(82)

       ∂  (1  ∂ )    ∂2
△∗ = R∂R-  R-∂R-  + ∂Z2-                        (83)
                    2
   = -∂--− 1--∂-+  ∂---                         (84)
     ∂R2   R ∂R    ∂Z2

Method 1: discretize Eq. (83) as

        (                           )
      1   (1 ∂Ψ )       ( 1∂Ψ )
  Ri ΔR-   R-∂R-      −  R-∂R-
                 i+1∕2         i−1∕2
+  Ψi,j+1-−-2Ψi,j +-Ψi,j−1-= − μ0RiJϕi,j,                   (85)
          Δ2Z
which can be further discretized as
       (                                    )
  R -1-  --1---Ψi+1,j −-Ψi,j-−--1---Ψi,j −-Ψi−1,j
   iΔR   Ri+1∕2    ΔR       Ri−1∕2    ΔR
  Ψi,j+1 −-2Ψi,j +-Ψi,j−1
+         Δ2         = − μ0RiJϕi,j,                          (86)
           Z
which can be organized as
i1,j + i,j + i+1,j + i,j1 + i,j+1 = μ0RiJϕi,j,

where b =  1
Δ2R-(  R      R   )
 Ri+i1∕2 + Ri−i1∕2 2
Δ2Z, a =  1
Δ2R- R
Ri−i1∕2, c =  1
Δ2R  R
Ri+i1∕2, d = e = 1
Δ2Z-. Method 2: discetize Eq. (84)

Ψi+1,j −-2Ψij +-Ψi−1,j
       Δ2R 1-
RΨi+1,j −-Ψi−-1,j
     2ΔR + Ψi,j+1-−-2Ψi,j +-Ψi,j−1
        Δ2Z = μ0RiJϕi,j,

which can be organized as

i1,j + i,j + i+1,j + i,j1 + i,j+1 = μ0RiJϕi,j,

where b = Δ22-
 R Δ22-
 Z a = Δ12-
 R + 2R1ΔR-, c = Δ12-
  R 2R1ΔR-, d = e = Δ12-
  Z

My numerical experiments indicate this scheme is more stable than than the first one (for the same grid size, and without the VDE stabilizer, the first scheme blow up while the latter scheme works well).

7 Semi-free bounday equilibrium problem

Semi-free boundary equilibrium problems refer to the cases where the LCFS shape and the value of Ψ on it are given and one is asked to solve the currents in the PF coils. This is similar to the fitting problem discussed above: we consider the control points on the LCFS as virtual flux loops that measure the poloidal flux.

8 Magnetic control

An equilibrium reconstruction code (e.g., rtefit) can be used to “observe” the inner structure of Ψ. PF coil currents can provide actions on Ψ. With the sensors and actuators, we can feedback controll the magnetic configuration (flux map).

For example, consider controlling the shape of LCFS (often called iso-flux control). We choose a target surface. To make sure that the target surface is a magnetic surface, the value of Ψ on it should be made a spatial constant. Dentoe this constant by Ψt. To make sure that there is no closed flux surface outside the target surface, we select the target surface as a surface that is tangential to the first wall (for limiter configuration) or there is a X-point on it (for divertor configuration). Then discretize the target surface by a series of discrete coordinates (Ri,Zi) with i = 1,2,M. The actions (coil current changes) are chosen to minimise the following residual:

   (                          )
M∑         N∑c                    2
   (Δ Ψi −   G (R ′j,Z ′j,Ri,Zi)ΔIj)  ,
 i         j
(87)

where

           (old)
Δ Ψi = Ψt − Ψi ,
(88)

ΔIj = I(jnew)− I(ojld),
(89)

the superscritp (old) indicates values before the control actions, Ψi(old) is obtained by a real-time equilibrium reconstruction code.

This assumes that the plasma current density remains the same when the actions are imposed (i.e., no plasma response is included), so that only the coil current changes contribute to the Ψ change.

If we need to feedback control X points to derised positions, then the above sum can be extended to include the following:

  M∑X (                N∑c                         )2
     (BR (R(iX),Z(iX))+    GBR (R′j,Z′j,R(iX),Z(iX))ΔIj )
   i                   j
     (                                           )2
  M∑X       (X)  (X)   N∑c       ′  ′  (X)  (X)
+    (BZ (Ri  ,Zi  )+    GBZ (Rj,Zj,Ri  ,Zi  )ΔIj ) ,          (90)
   i                   j
where (Ri(X),Zi(X)) are desired poistions of X points.

 

 

 

 

9 Fixed boundary equilibrium and choices of coordinates

Plasma physists love to consider a kind of simplified problem: the fixed boundary equilibrium problem, where the shape of the boundary flux surface is given (the value of Ψ is a constant on this boundary). In dealing with the fixed boundary problem, the curvilinear coordinate system is useful. Specifically, the convenience is that the coordinates can be adjusted to make one of the coordinate surfaces coincide with the given boundary flux surface, so that the boundary condition becomes trivial.

More generally, curvilinear coordinates can be ajusted to make coordinate surfaces coincide with magnetic surfaces (dicussed later). This often simplifies analysis of wave and transport problems, especially when we properly choose the poloidal/toroidal coordinate to make magnetic field lines look like straight lines in terms of these coordinates.

Next section discusses the basic theory of curvilinear coordinates system[4].

In many studies of tokamak plasmas, one need construct a curvilinear coordinate system based on a given magnetic cofiguration in order to make the problem amenable to analytical methods or numerical methods. Specifically, many theories and numerical codes use the curvilinear coordinate systems that are constructed with one coordinate surface coinciding with magnetic surfaces. In these coordinate systems, we need to choose a poloidal coordinate 𝜃 and a toroidal coordinate ζ. As metioned above, a particular choice for 𝜃 and ζ is one that makes the magnetic field lines be straight lines in (𝜃,ζ) plane. These kinds of coordinates are often called magnetic coordinates. That is, “magnetic coordinates  are defined so they conform to the shape of the magnetic surfaces and trivialize the equations for the field lines.”

A further tuned magnetic coordinate system is the so-called field aligned (or filed-line following) coordinate system, in which changing one of the three coordinates with the other two fixed would correspond to following a magnetic field line. The field aligned coordinates are discussed in Sec. 17.

Next, let us discuss some general properties about coordinates transformation.

9.1 Safety factor

A magnetic field line on a closed magnetic surface travel a closed curve in a poloidal plane. For these kinds of field lines, we can define the safety factor q: the number of toroidal loops a magnetic field line travels when it makes one poloidal loop, i.e.

    △ϕ
q ≡ 2π-,
(91)

where ϕ as the change of the toroidal angle when a magnetic field line travels a full poloidal loop. The safety factor can also be understood as the average pitch angle of a magnetic field line in (𝜃,ϕ) plane of a closed magnetic surface.

For open field line region (where a field line touches the wall before its poloidal projection can close itself), the “connection length” is often used to characterize the magnetic field.

Expression of safety factor in terms of magnetic field

The equation of magnetic field lines is given by

Rdϕ-= B-ϕ,
dℓp   Bp
(92)

where dℓp is the line element along the direction of Bp on the poloidal plane. Equation (92) can be arranged in the form

     1-B-ϕ
dϕ = R Bp dℓp,
(93)

which can be integrated over dℓp to give

     ∮  1 Bϕ
△ϕ =    R-Bpdℓp,
(94)

where the line integration is along the poloidal magnetic field (the contour of Ψ on the poloidal plane). Using this, Eq. (91) is written

       ∮
q = -1-  1-Bϕ-dℓp.
    2π   R Bp
(95)

Expression of safety factor in terms of magnetic flux

The safety factor given by Eq. (95) is expressed in terms of the components of the magnetic field. The safety factor can also be expressed in terms of the magnetic flux. Define ΔΨp as the poloidal magnetic flux enclosed by two neighboring magnetic surface, then ΔΨp is given by

Δ Ψp = 2πR ΔxBp
(96)

where Δx is the length of a line segment in the poloidal plane between the two magnetic surfaces, which is perpendicular to the first magnetic surface (so perpendicular to the Bp). Note that Δx, as well as R and Bp, generally depends on the poloidal location whereas ΔΨp is independent of the poloidal location.

Using Eq. (96), the poloidal magnetic field is written as

B  = -1--Δ-Ψp.
 p   2πR Δx
(97)

Substituting Eq. (97) into Eq. (95), we obtain

      ∮               ∮                 ∮
    1--  1-Bϕ-     -1-  1-2πR-ΔxB-ϕ        ΔxB-ϕ-
q = 2π   R Bp dℓp = 2π   R    ΔΨp   dℓp =   Δ Ψp dℓp.
(98)

We know ΔΨp is a constant independent of the poloidal location, so ΔΨp can be taken outside the integration to give

     1  ∮
q = Δ-Ψp  ΔxB ϕdℓp
(99)

It is ready to realise that the integral appearing in Eq. (99) is the toroidal magnetic flux enclosed by the two magnetic surfaces, ΔΨt. Using this, Eq. (99) is written as

    ΔΨ
q = --t-
    ΔΨp
(100)

Equation (100) indicates that the safety factor of a magnetic surface is equal to the differential of the toroidal magnetic flux with respect to the poloidal magnetic flux enclosed by the magnetic surface.

 

Rational surfaces vs. irrational surfaces

If the safety factor of a magnetic surface is a rational number, i.e., q = m∕n, where m and n are integers, then this magnetic surface is called a rational surface, otherwise an irrational surface. A field line on a rational surface with q = m∕n closes itself after it travels n poloidal loops. An example of a field line on a rational surface is shown in Fig. 5.


pict pict

Fig. 5: Left: A magnetic field line (blue) on a rational surface with q = 2.1 = 2110 (magnetic field is from EAST discharge #59954@3.1s). This field line closes itself after traveling 21 toroidal loops (meanwhile, it travels 10 poloidal loops). Right: The intersecting points of the magnetic field line with the ϕ = 0 plane when it is traveling toroidally. The sequence of the intersecting points is indicated by the number labels. The 22nd intersecting point coincides with the 1st point and then the intersecting points repeat themselves.

 

10 Curvilinear coordinate system

10.1 Coordinates transformation

In the Cartesian coordinates, a point is described by its coordinates (x,y,z), which, in the vector form, is written as

r = xˆx+ yˆy + zˆz,
(101)

where r is the location vector of the point; ˆx, ˆy, and ˆz are the basis vectors of the Cartesian coordinates, which are constant, independent of spactial location. The transformation between the Cartesian coordinates system, (x,y,z), and a general coordinates system, (x1,x2,x3), can be expressed as

r = x(x1,x2,x3)ˆx + y(x1,x2,x3)ˆy+ z(x1,x2,x3)ˆz.
(102)

For example, cylindrical coordinates (R,ϕ,Z) can be considered as a general coordinate systems, which are defined by  r = R cosϕˆx + R sinϕˆy + Zˆz.

The transformation function in Eq. (102) can be written as

x = x(x1,x2,x3)
y = y(x1,x2,x3)
z = z(x1,x2,x3)
(103)

10.2 Jacobian

A useful quality characterizing coordinate transformation is the Jacobian determinant (or simply called Jacobian), which, for the transformation in Eq. (103), is defined by

    |           |
    || ∂∂xx1-∂∂xx2 ∂∂xx3-||
𝒥 = || ∂∂xy-∂∂yx- ∂∂xy-||,
    || ∂1z-∂z2 ∂3z-||
      ∂x1 ∂x2 ∂x3
(104)

which can also be written as

     ∂r-- -∂r- -∂r-
𝒥 =  ∂x1 × ∂x2 ⋅∂x3 .
(105)

It is easy to prove that the Jacobian 𝒥 in Eq. (105) can also be written (the derivation is given in my notes on Jacobian)

                    −1
𝒥  = (∇x1 × ∇x2 ⋅∇x3 ) .
(106)

Conventionally, the Jacobian of the transformation from the Cartesian coordinates to a particular coordinate system σ is called the Jacobian of σ, without explitly mentioning that this transformation is with respect to the Cartesian coordinates.

Using the defintion in Eq. (104), the Jacobian 𝒥 of the Cartesian coordinates can be calculated, yielding 1. Likewise, the Jacobian of the cylindrical coordinates (R,ϕ,Z) can be calculated as follows:

    |        |  |                    |
    ||∂∂xR-∂∂xϕ ∂∂xZ||  || ∂R∂cRosϕ-∂Rc∂oϕsϕ ∂R∂cZosϕ-||
𝒥 = ||∂∂yR-∂∂yϕ ∂∂yZ||= || ∂R∂sRinϕ-∂R∂siϕnϕ ∂R∂sZinϕ-||
    ||∂z-∂z ∂z||  ||  ∂Z-    ∂Z-   ∂Z-  ||
    |∂R ∂ϕ ∂Z     |∂R     ∂ϕ    ∂Z
    ||cosϕ − R sinϕ 0||
  = ||sinϕ  R cos ϕ 0||= R
    | 0     0    1|
If the Jacobian of a coordinate system is greater than zero, it is called a right-handed coordinate system. Otherwise it is called a left-handed system.

10.3 Orthogonality relation between two sets of basis vectors

In a curvilinear coordinate system (x1,x2,x3), there are two kinds of basis vectors: xi and r∕∂xi, with i = 1,2,3. These two kinds of basis vectors satisfy the following orthogonality relation:

     ∂r--
∇xi ⋅∂xj = δij,
(107)

where δij is the Kronical delta function. [Proof: Working in a Cartesian coordinate system (x,y,z) with the corresponding basis vectors denoted by (ˆx,ˆy,ˆz), then the left-hand side of Eq. (107) can be written as

          [(    )    (    )    (    )  ] [                                       ]
∇x  ⋅ ∂r-=   ∂xi  ˆx+   ∂xi  ˆy+   ∂xi  ˆz ⋅ -∂x-ˆx+ x-∂ˆx-+ -∂yyˆ+ y ∂-ˆy-+ ∂z-ˆz +z ∂ˆz-
  i  ∂xj     ∂x        ∂y        ∂z       ∂xj     ∂xj   ∂xj     ∂xj   ∂xj     ∂xj
          [( ∂xi)    ( ∂xi)    ( ∂xi)  ] [ ∂x        ∂y        ∂z     ]
        =    ∂x-  ˆx+   ∂y-  ˆy+   ∂z-  ˆz ⋅ ∂xj-ˆx+ 0+  ∂xj ˆy+ 0 + ∂xjˆz+ 0       (108)
           ∂x ∂x    ∂x  ∂y   ∂x  ∂z
        =  --i----+ --i----+ --i----
           ∂x ∂xj   ∂y ∂xj   ∂z ∂xj
        =  ∂xi-                                                               (109)
           ∂xj
        = δij,
where the second equality is due to ˆx∕∂xj = 0,∂ˆy∕∂xj = 0,∂ˆz∕∂xj = 0 since ˆx,ˆy,ˆz are constant vectors independent of spatial location; the chain rule has been used in obtaining Eq. (109)]

[The cylindrical coordinate system (R,ϕ,Z) is an example of general coordinates. As an exercise, we can verify that the cylindrical coordinates have the property given in Eq. (107). In this case, x = x1 cosx2, y = x1 sinx2, z = x3, where x1 R, x2 ϕ, x3 Z.]

It can be proved that xi is a contravariant vector while r∕∂xi is a covariant vector (I do not prove this and do not bother with the meaning of these names, just using this as a naming scheme for easy reference).

The orthogonality relation in Eq. (107) is fundamental to the theory of general coordinates. The orthogonality relation allows one to write the covariant basis vectors in terms of contravariant basis vectors and vice versa. For example, the orthogonality relation tells that r∕∂x1 is orthogonal to x2 and x3, thus, r∕∂x1 can be written as

-∂r-
∂x1 = A∇x2 × ∇x3,
(110)

where A is a unknown variable to be determined. To determine A, dotting Eq. (110) by x1, and using the orthogonality relation again, we obtain

1 = A (∇x2 × ∇x3)⋅∇x1,
(111)

which gives

A = -------1--------
    (∇x2 × ∇x3 )⋅∇x1
 = 𝒥                                         (112)
Thus r∕∂x1 is written, in terms of x1, x2, and x3, as
 ∂r
∂x1-= 𝒥 ∇x2 × ∇x3.
(113)

Similarly, we obtain

-∂r-= 𝒥 ∇x  × ∇x
∂x2       3     1
(114)

and

-∂r-= 𝒥 ∇x1 × ∇x2.
∂x3
(115)

Equations (113)-(115) can be generally written

 ∂r
--- = 𝒥∇xj × ∇xk,
∂xi
(116)

where (i,j,k) represents the cyclic order in the variables (x1,x2,x3). Equation (116) expresses the covariant basis vectors in terms of the contravariant basis vectors. On the other hand, from Eq. (113)-(115), we obtain

∇x  = 𝒥− 1 ∂r-×-∂r-,
   i      ∂xj  ∂xk
(117)

which expresses the contravariant basis vectors in terms of the covariant basis vectors.

10.4 An example: (ψ,𝜃,ζ) coordinates

Suppose (ψ,𝜃,ζ) is an arbitrary general coordinate system. Following Einstein’s notation, contravariant basis vectors are denoted with upper indices as

eψ ≡ ∇ ψ; e𝜃 ≡ ∇𝜃; eζ ≡ ∇ζ.                    (118)
and the covariant basis vectors are denoted with low indices as
     ∂r              ∂r
eψ ≡ --; e𝜃 ≡ ∂∂r𝜃; eζ ≡-.                       (119)
     ∂ψ              ∂ζ
Then the orthogonality relation, Eq. (107), is written as
eα ⋅eβ = δαβ.
(120)

In term of the contravairant basis vectors, A is written

        ψ      𝜃     ζ
A  = Aψe  + A𝜃e + A ζe ,
(121)

where the components are easily obtained by taking scalar product with eψ,e𝜃,andeζ, yielding Aψ = A eψ, A𝜃 = A e𝜃, and Aζ = A eζ. Similarly, in term of the covariant basis vectors, A is written

A  = Aψeψ + A𝜃e𝜃 + A ζeζ,
(122)

where Aψ = A eψ, A𝜃 = A e𝜃, and Aζ = A eζ.

Using the above notation, the relation in Eq. (116) is written as

        𝜃   ζ
eψ = 𝒥 e × e
(123)

e𝜃 = 𝒥eζ × eψ
(124)

eζ = 𝒥eψ × e𝜃
(125)

where  𝒥 = [(ψ ×∇𝜃) ⋅∇ζ]1. Similarly, the relation in Eq. (117) is written as

eψ = 𝒥 −1e𝜃 × eζ
(126)

 𝜃    − 1
e  = 𝒥  eζ × eψ
(127)

 ζ    − 1
e  = 𝒥  eψ × e𝜃
(128)

10.5 Gradient and directional derivative in general coordinates (ψ,𝜃,ζ)

The gradient of a scalar function f(ψ,𝜃,ζ) is readily calculated from the chain rule,

      ∂f      ∂f     ∂f
∇f =  --∇ ψ + --∇ 𝜃+ ---∇ζ.
      ∂ψ      ∂𝜃     ∂ ζ
(129)

Note that the gradient of a scalar function is in the covariant representation. The inverse form of this expression is obtained by dotting the above equation respectively by the three contravariant basis vectors, yielding

∂f-= (𝒥 ∇𝜃 ×∇ ζ)⋅∇f =  ∂r-⋅∇f
∂ψ                     ∂ψ
(130)

∂f-= (𝒥 ∇ζ ×∇ ψ)⋅∇f  = ∂r-⋅∇f
∂𝜃                     ∂𝜃
(131)

∂f-= (𝒥 ∇ψ × ∇𝜃)⋅∇f  = ∂r-⋅∇f
∂ζ                     ∂ζ
(132)

Using Eq. (129), the directional derivative in the direction of ψ is written as

∇ ψ ⋅∇f = |∇ ψ|2∂f-+ (∇𝜃 ⋅∇ψ)∂f-+ (∇ ζ ⋅∇ ψ)∂f.
               ∂ψ            ∂𝜃           ∂ζ
(133)

10.6 Divergence operator in general coordinates (ψ,𝜃,ζ)

To calculate the divergence of a vector, it is desired that the vector should be in the contravariant form because we can make use of the fact:

∇ ⋅(∇ α× ∇ β) = 0,
(134)

for any scalar quantities α and β. Therefore we write vector A as

     (ψ)            (𝜃)             (ζ)
A = A   𝒥∇ 𝜃× ∇ ζ + A 𝒥 ∇ ζ × ∇ ψ+ A  𝒥∇ ψ × ∇𝜃,
(135)

where A(ψ) = A ⋅∇ψ, A(𝜃) = A ⋅∇𝜃, A(ζ) = A ⋅∇ζ.   Then the divergence of A is readily calculated as

∇  ⋅A  = (∇ 𝜃× ∇ ζ)⋅∇ (A (ψ)𝒥 )+ (∇ ζ × ∇ ψ)⋅∇ (A(𝜃)𝒥 )+ (∇ψ × ∇𝜃) ⋅∇(A(ζ)𝒥 ) (136)
        1 ( ∂A(ψ)𝒥   ∂A (𝜃)𝒥   ∂A (ζ)𝒥 )
      = 𝒥-  --∂ψ---+ --∂𝜃---+ --∂ζ--- ,                               (137)
where the second equality is obtained by using Eqs. (130), (131), and (132).

10.7 Laplacian operator in general coordinates (ψ,𝜃,ζ)

The Laplacian operator is defined by 2 ≡∇⋅∇. Then 2f is written as (f is an arbitrary function)

∇2f = ∇ ⋅∇f
         ( ∂f      ∂f     ∂f   )
    = ∇ ⋅ ∂-ψ∇ ψ+  ∂𝜃∇ 𝜃+ ∂ζ-∇ζ  .                  (138)
To proceed, we can use the divergence formula (137) to express the divergence in the above expression. However, the vector in the above (blue term) is not in the covariant form desired by the divergence formula (137). If we want to directly use the formula (137), we need to transform the vector (blue term in expression (138)) to the covariant form. This process seems to be a little complicated. Therefore, I choose not to use this method. Instead, I try to simplify expression (138) by using basic vector identities:
  2     ( ∂f)         ( ∂f)         (∂f )
∇ f = ∇   ∂ψ- ⋅∇ ψ+ ∇   ∂𝜃- ⋅∇ 𝜃+ ∇  -∂ζ  ⋅∇ζ
        ∂f       ∂f      ∂f
      + --∇2 ψ + --∇2 𝜃+ ---∇2ζ.                          (139)
        ∂ψ       ∂𝜃      ∂ζ
Using the gradient formula, the above expression is further written as
∇2f = ∂2f-|∇ ψ|2 +-∂2f-∇ ψ⋅∇ 𝜃+ -∂2f-∇ ψ⋅∇ ζ
      ∂ψ2        ∂ψ ∂𝜃         ∂ψ ∂ζ
         ∂2f          ∂2f    2   ∂2f
      + ∂𝜃∂ψ-∇𝜃 ⋅∇ ψ + ∂𝜃2|∇𝜃| + ∂𝜃∂ζ-∇𝜃 ⋅∇ζ
         ∂2f           ∂2f          ∂2f
      + -----∇ζ ⋅∇ψ + ----∇ ζ ⋅∇ 𝜃+---2|∇ ζ|2
        ∂ζ∂ψ          ∂ζ∂𝜃         ∂ ζ
      + ∂f-∇2ψ + ∂f∇2 𝜃+ ∂f-∇2ζ,                         (140)
        ∂ψ       ∂𝜃      ∂ζ
and can be simplified as
        2           2              2
∇2f =  ∂-f2|∇ψ |2 + 2-∂-f-∇ ψ⋅∇ 𝜃+ 2-∂-f-∇ ψ⋅∇ ζ
       ∂ψ         ∂ ψ∂𝜃          ∂ ψ∂ζ
      + ∂2f|∇ 𝜃|2 + 2-∂2f-∇𝜃 ⋅∇ζ
        ∂𝜃2        ∂𝜃∂ ζ
        ∂2f    2
      + ∂ζ2|∇ ζ|
        ∂f       ∂f      ∂f
      + ---∇2ψ + --∇2 𝜃+ ---∇2ζ.                          (141)
        ∂ψ       ∂𝜃       ∂ζ
Assume (ψ,𝜃,ζ) are field-line following coordinates with r∕∂𝜃 along the field line direction, then neglect all the parallel derivatives, i.e., derivative over 𝜃, then the above expression is reduced to
∇2f = ∂2f|∇ ψ|2 + 2 ∂2f-∇ ψ ⋅∇ζ + ∂2f|∇ζ|2
      ∂ψ2         ∂ψ∂ζ          ∂ζ2
       ∂f-  2   ∂f- 2
      +∂ ψ∇ ψ + ∂ ζ∇ ζ.                                (142)
This approximation reduces the Laplacian operator from being three-dimensional to being two-dimensional. This approximation is often called the high-n approximation, where n is the toroidal mode number (mode number along ζ direction).

10.8 Curl operator in general coordinates (ψ,𝜃,ζ)

To take the curl of a vector, it should be in the covariant representation since we can make use of the fact that ∇×∇α = 0. Thus the curl of A is written as

∇ × A = ∇ × (A1∇ψ + A2∇ 𝜃+ A3∇ ζ)
      = ∇A1 × ∇ ψ+ ∇A2  × ∇𝜃+ ∇A3  × ∇ζ
        ( ∂A      ∂A    )        ( ∂A       ∂A    )        ( ∂A       ∂A    )
      =   --1∇ 𝜃+ ---1∇ζ  × ∇ ψ+   ---2∇ψ + ---2∇ζ  × ∇ 𝜃+   --3∇ ψ+  --3∇ 𝜃  ×∇ ζ
          ∂(𝜃       ∂ζ )             ∂ψ(      ∂ζ  )           ∂ψ  (    ∂𝜃    )
      = 1-  ∂A2-− ∂A1- 𝒥 ∇ ψ× ∇ 𝜃+ -1  ∂A1-− ∂A3-  𝒥∇ ζ × ∇ ψ + 1  ∂A3-− ∂A2- 𝒥 ∇𝜃 ×(1∇4ζ3.)
        𝒥   ∂ ψ    ∂𝜃              𝒥    ∂ζ    ∂ψ               𝒥   ∂𝜃    ∂ ζ
Note that taking the curl of a vector in the covariant form leaves the vector in the contravariant form.

10.9 Metric tensor for general coordinate system

Consider a general coordinate system (ψ,𝜃,ζ). I define the metric tensor as the transformation matrix between the covariant basis vectors and the contravariant ones. Equations (116) and (117) express the relation between the two sets of basis vectors using cross product. Next, let us express the relation in matrix from. To obtain the metric matrix, we write the contrariant basis vectors in terms of the covariant ones, such as

      1            2             3
∇ψ = a 𝒥 ∇𝜃× ∇ ζ + a 𝒥 ∇ζ × ∇ψ + a 𝒥∇ ψ × ∇𝜃.
(144)

Taking the scalar product respectively with ψ, 𝜃, and ζ, Eq. (144) is written as

 1      2
a = |∇ψ |,
(145)

a2 = ∇ ψ⋅∇ 𝜃,
(146)

 3
a = ∇ ψ⋅∇ ζ.
(147)

Similarly, we write

∇ 𝜃 = b1𝒥∇ 𝜃× ∇ ζ + b2𝒥∇ ζ × ∇ ψ + b3𝒥 ∇ψ × ∇ 𝜃,
(148)

Taking the scalar product with ψ, 𝜃, and ζ, respectively, the above becomes

b1 = ∇ 𝜃⋅∇ ψ
(149)

 2      2
b = |∇𝜃| ,
(150)

b3 = ∇ 𝜃⋅∇ ζ.
(151)

The same situation applies for the ζ basis vector,

∇ ζ = c1∇𝜃 × ∇ζ𝒥 + c2∇ζ × ∇ψ 𝒥 + c3∇ ψ × ∇𝜃𝒥 ,
(152)

Taking the scalar product with ψ, 𝜃, and ζ, respectively, the above equation becomes

 1
c = ∇ ζ ⋅∇ ψ
(153)

c2 = ∇ ζ ⋅∇ 𝜃
(154)

c3 = |∇ ζ|2
(155)

Summarizing the above results in matrix form, we obtain

(     )   (                      ) (           )
  ∇ ψ        |∇ ψ|2 ∇ ψ⋅∇ 𝜃 ∇ ψ ⋅∇ζ    ∇𝜃 ×∇ ζ𝒥
(  ∇𝜃 ) = ( ∇𝜃 ⋅∇ψ  |∇𝜃|2  ∇𝜃 ⋅∇ ζ) ( ∇ ζ × ∇ ψ𝒥 )
   ∇ζ       ∇ζ ⋅∇ψ ∇ ζ ⋅∇ 𝜃 |∇ ζ|2     ∇ ψ × ∇𝜃𝒥
(156)

Similarly, to convert contravariant basis vector to covariant one, we write

∇𝜃 × ∇ζ𝒥 = d1∇ ψ+ d2∇ 𝜃+ d3∇ ζ
(157)

Taking the scalar product respectively with 𝜃 ×∇ζ𝒥 , ζ ×∇ψ𝒥 , and ψ ×∇𝜃𝒥 , the above equation becomes

d1 = |∇ 𝜃× ∇ ζ|2𝒥 2
(158)

d2 = (∇ 𝜃× ∇ ζ𝒥)⋅(∇ ζ × ∇ ψ𝒥)
(159)

d3 = (∇ 𝜃× ∇ ζ𝒥)⋅(∇ ψ× ∇ 𝜃𝒥)
(160)

For the second contravariant basis vector

∇ϕ × ∇ψ 𝒥 = e1∇ ψ + e2∇ 𝜃+ e3∇ ζ
(161)

                          2
e1 = (∇ ζ × ∇ ψ)⋅(∇ 𝜃× ∇ ζ)𝒥
(162)

e2 = (∇ ζ × ∇ ψ)⋅(∇ ζ × ∇ψ )𝒥 2
(163)

e3 = (∇ ζ × ∇ ψ)⋅(∇ ψ× ∇ 𝜃)𝒥 2
(164)

For the third contravariant basis vector

∇ψ × ∇𝜃𝒥  = f1∇ ψ + f2∇ 𝜃+ f3∇ ζ
(165)

f1 = (∇ψ × ∇𝜃)⋅(∇ 𝜃× ∇ ζ)𝒥 2
(166)

f2 = (∇ ψ × ∇𝜃)⋅(∇ ζ × ∇ψ )𝒥 2
(167)

f3 = (∇ ψ × ∇𝜃)⋅(∇ ψ× ∇ 𝜃)𝒥 2
(168)

Summarizing these results, we obtain

(          )      (    )
  ∇𝜃 × ∇ζ𝒥          ∇ψ
( ∇ζ × ∇ψ𝒥 )  = M ( ∇ 𝜃) ,
  ∇ψ × ∇𝜃𝒥          ∇ ζ
(169)

where

M = (               2 2                           2                      2)
(      |∇𝜃 × ∇ζ| 𝒥     2 (∇𝜃 × ∇ζ)⋅(∇ ζ × ∇ψ )𝒥 2 (∇𝜃 ×∇ ζ)⋅(∇ψ × ∇ 𝜃)𝒥 2)
  (∇ζ × ∇ψ )⋅(∇𝜃 ×∇ ζ)𝒥2 (∇ ζ × ∇ ψ)⋅(∇ ζ × ∇ ψ)𝒥2 (∇ ζ × ∇ ψ)⋅(∇ ψ× ∇ 𝜃)𝒥2
  (∇ ψ× ∇ 𝜃)⋅(∇𝜃× ∇ ζ)𝒥  (∇ ψ × ∇𝜃)⋅(∇ ζ × ∇ ψ)𝒥 (∇ ψ × ∇𝜃)⋅(∇ ψ× ∇ 𝜃)𝒥,

This matrix and the matrix in Eqs. (156) should be the inverse of each other. It is ready to prove this by directly calculating the product of the two matrix.

Special case: metric tensor for (ψ,𝜃,ϕ) coordinate system

Suppose that (ψ,𝜃,ϕ) are arbitrary general coordinates except that ϕ is the usual toroidal angle in cylindrical coordinates. Then ϕ = 1∕Rˆϕ is perpendicular to both ψ and 𝜃. Using this, Eq. (156) is simplified to

( ∇ψ )   (  |∇ ψ|2 ∇ ψ ⋅∇𝜃  0  ) ( ∇ 𝜃× ∇ ϕ𝒥 )
( ∇𝜃 ) = ( ∇ ψ⋅∇ 𝜃 |∇ 𝜃|2   0  ) ( ∇ ϕ× ∇ ψ𝒥 )
  ∇ϕ          0      0    1∕R2    ∇ ψ× ∇ 𝜃𝒥
(170)

Similarly, Eq. (169) is simplified to

(  ∇𝜃× ∇ ϕ𝒥 )   (   |∇𝜃|2𝒥2∕R2   − ∇ 𝜃⋅∇ ψ𝒥 2∕R2 0 ) ( ∇ ψ)
( ∇ ϕ× ∇ ψ𝒥 ) = ( − ∇ψ ⋅∇ 𝜃𝒥2∕R2   |∇ ψ|2𝒥 2∕R2   0 ) ( ∇ 𝜃)
  ∇ ψ × ∇𝜃𝒥              0             0       R2     ∇ ϕ
(171)

[Note that the matrix in Eqs. (170) and (171) should be the inverse of each other. The product of the two matrix,

(                                 ) (                    )
    |∇ 𝜃|2𝒥 2∕R2  − ∇ 𝜃⋅∇ψ 𝒥2∕R2  0      |∇ ψ|2 ∇ ψ⋅∇ 𝜃  0
( − ∇ ψ ⋅∇𝜃𝒥 2∕R2   𝒥R22|∇ψ |2     0 ) ( ∇ψ ⋅∇𝜃  |∇𝜃|2   0  ) ,
        0              0       R2        0      0   1∕R2
(172)

can be calculated to give

(       )
  A  0 0
(  0 A 0 )
   0 0 1,

where

A = |∇𝜃|2|∇ψ|2𝒥2∕R2 (𝜃 ⋅∇ψ)2𝒥2.

By using the definition of the Jacobian in Eq. (106), it is easy to verify that A = 1, i.e.,

                         2
|∇𝜃|2|∇ ψ|2 − (∇𝜃 ⋅∇ ψ)2 = R-,
                        𝒥2
(173)

]

11 Covariant/contravariant representation of equilibrium magnetic field

The axisymmetric equilibrium magnetic field is given by Eq. (54), i.e.,

B = ∇ Ψ × ∇ϕ + g∇ϕ.
(174)

In a general coordinate system (ψ,𝜃,ϕ) (not necessarily magnetic surface coordinates), the above expression can be written as

B  = − Ψψ∇ ϕ× ∇ ψ − Ψ𝜃∇ϕ × ∇𝜃 + g∇ϕ,
(175)

where the subscripts denote the partial derivatives with the corresponding subscripts. Note that Eq. (175) is a mixed representation, which involves both covariant and contravariant basis vectors. Equation (175) can be converted to the contravariant form by using the metric tensor, giving

                               𝒥
B = − Ψψ∇ ϕ ×∇ ψ − Ψ𝜃∇ϕ × ∇𝜃 + g-2∇ ψ × ∇𝜃.
                               R
(176)

Similarly, Eq. (175) can also be transformed to the covariant form, giving

    (                        )      (                          )
B =  Ψ  𝒥-∇ ψ ⋅∇𝜃 + Ψ 𝒥-|∇ 𝜃|2  ∇ψ +  − Ψ -𝒥-|∇ ψ|2 − Ψ-𝒥-∇𝜃 ⋅∇ψ  ∇ 𝜃+ g∇ ϕ.
       ψR2           𝜃R2                ψR2         𝜃R2
(177)

For the convenience of notation, define

hαβ = 𝒥-∇ α⋅∇ β,
      R2
(178)

then Eq. (177) is written as

B  = (Ψψh ψ𝜃 + Ψ𝜃h𝜃𝜃)∇ ψ + (− Ψψhψψ − Ψ𝜃hψ𝜃)∇𝜃 + g∇ ϕ.
(179)

12 Magnetic surface coordinates (ψ,𝜃,ϕ)

A coordinate system (ψ,𝜃,ϕ), where ϕ is the usual cylindrical toroidal angle, is called a magnetic surface coordinate system if Ψ is a function of only ψ, i.e., ∂Ψ∕∂𝜃 = 0 (we also have ∂Ψ∕∂ϕ = 0 since we are considering axially symmetrical case). In terms of (ψ,𝜃,ϕ) coordinates, the contravariant form of the magnetic field, Eq. (176), is written as

                   𝒥
B = − Ψ ′∇ ϕ× ∇ ψ +g-2∇ ψ ×∇ 𝜃,
                   R
(180)

where Ψ′≡ dΨ∕dψ. The covariant form of the magnetic field, Eq. (177), is written as

    (            )      (           )
B =   Ψ′ 𝒥-∇ ψ ⋅∇𝜃 ∇ψ +  − Ψ′ 𝒥-|∇ ψ|2 ∇ 𝜃+ g∇ ϕ.
        R2                   R2
(181)

12.1 Local safety factor

The local safety factor ˆq is defined by

   B ⋅∇ ϕ
ˆq =------,
   B ⋅∇ 𝜃
(182)

which characterizes the local pitch angle of a magnetic field line in (𝜃,ϕ) plane of a magnetic surface. Substituting the contravariant representation of the magnetic field, Eq. (180), into the above equation, the local safety factor is written

ˆq(ψ,𝜃) = − g2-𝒥′.
          R  Ψ
(183)

Note that the expression ˆq in Eq. (183) depends on the Jacobian 𝒥 . This is because the definition of ˆq depends on the definition of 𝜃, which in turn depends on the the Jacobian 𝒥 .

In terms of ˆq , the contravariant form of the magnetic field, Eq. (180), is written

       ′
B = − Ψ (∇ϕ × ∇ψ + ˆq∇ψ × ∇ 𝜃).
(184)

and the parallel differential operator B0 ⋅∇ is written as

                                             (         )
B0 ⋅∇ = − Ψ′(∇ ϕ× ∇ ψ + ˆq∇ ψ × ∇𝜃)⋅∇ = − Ψ′𝒥 −1 -∂-+ ˆq-∂- .
                                              ∂ 𝜃   ∂ϕ
(185)

If ˆq happens to be independent of 𝜃 (i.e., field lines are straight in (𝜃,ϕ) plane), then the above operator becomes a constant coefficient differential oprator (after divided by 𝒥1). This simplification is useful because different poloidal harmonics are decoupled in this case. We will discuss this issue futher in Sec. 16.

12.2 Global safety factor

The global safety factor defined in Eq. (95) is actually the poloidal average of the local safety factor, i.e.,

          ∫ 2π
q(ψ) ≡ -1-    ˆqd𝜃                              (186)
       2π  0
        -1-g-∫ 2π 𝒥--
     = −2π Ψ′  0  R2d𝜃.                        (187)
Note that q and ˆq defined this way can be negative, which depends on the choice of the positive direction of ϕ and 𝜃 coordinates (note that the safety factor given in G-eqdsk file is always positive, i.e. it is the absolute value of the safety factor defined here).

Next, let us transform the 𝜃 integration in expression (187) to a curve integral in the poloidal plane. Using the relation dℓp and d𝜃 [Eq. (195)], expression (187) is further written

             ∮
q(ψ) = − 1-g′  sign(𝒥 )-dℓp--
        2πΨ        ∮  R|∇ψ |
    = − 1-g-sign(𝒥)   -dℓp--.                     (188)
        2π sign(Ψ ′)   R |∇ Ψ|
Expression (188) is used in the GTAW code to numerically calculate the value of q on magnetic surfaces (as a benchmarking of the q profile specified in the G-eqdsk file). Expression (188) can also be considered as a relation between q and g. In the equilibrium problem where q is given (fixed-q equilibrium), we can use expression (188) to obtain the corresponding g (which explicitly appears in the GS equation):
        ( ∮ --dℓp--)−1 sign(Ψ′)
g = − 2πq   R |∇ Ψ|    sign(𝒥 ).
(189)

We note that expression (189) involves magnetic surface averaging, which is unknown before we know Ψ. Therefore iteration is usually needed in solving the fixed-q equilibrium (i.e., we guess the unknown Ψ, so that the magnetic surface averaging in expression (189) can be performed, yielding the values of g.)

Using Bp = |∇Ψ|∕R and Bϕ = g∕R,  the absolute value of q in expression (188) is written

        ∮
|q| =-1-g  --dℓp-.                           (190)
    2π    R |∇ Ψ|
     1 ∮  1|Bϕ|
  = 2π-  R--Bp-dℓp                          (191)
which is the familiar formula we see in textbooks.

12.3 Relation between Jacobian and poloidal angle 𝜃

Given the definition of a magnetic surface coordinate system (ψ,𝜃,ϕ), the Jacobian of this system is fully determined. On the other hand, given the definition of ψ, ϕ, and the Jacobian, the definition of 𝜃 is fully determined (can have some trivial shifting freedoms). Next, let us discuss how to calculate 𝜃 in this case. In (ψ,𝜃,ϕ) coordinates, a line element is written

dl =-∂rdψ + ∂rd𝜃 + ∂rdϕ
    ∂ψ      ∂𝜃     ∂ϕ
(192)

The line element that lies on a magnetic surface (i.e., = 0) and in a poloidal plane (i.e., = 0) is then written

     ∂r-
dℓp = ∂ 𝜃d𝜃
   = 𝒥 ∇ϕ × ∇ ψd𝜃.                          (193)
We use the convention that dℓp and d𝜃 take the same sign, i.e.,
dℓp = |𝒥 ∇ϕ × ∇ψ |d𝜃.
(194)

Using the fact that ψ and ϕ are orthogonal and ϕ = ˆϕ∕R, the above equation is written as

       R
d𝜃 = ------dlp
     |𝒥 ∇ ψ|
(195)

Given |𝒥∇ψ|, Eq. (195) can be integrated to determine the 𝜃 coordinate of points on a magnetic surface.

—–

-  ∫ 𝜃       ∫ 𝜃 g--𝒥
δ = 0 ˆqd𝜃 = − 0  R2Ψ ′d𝜃
(196)

12.4 Calculating poloidal angle

Once |𝒥∇ψ| is known, the value of 𝜃 of a point can be obtained by integrating expression (195), i.e.,

           ∫ xi,j   R
𝜃i,j = 𝜃ref,j +     -----dlp,
            xref,j |𝒥 ∇ψ |
(197)

where the curve integration is along the contour Ψ = Ψj, xref,j is a reference point on the contour, where value of the poloidal angle is chosen as 𝜃ref,j. The choice of the positive direction of 𝜃 is up to users. Depending on the positive direction chosen, the sign of the Jacobian of the constructed coordinates can have a sign difference from the 𝒥 appearing in Eq. (197). Denote the Jacobian of the constructed coordinates by 𝒥′, then

𝒥′ = ± 𝒥
(198)

This sign can be determined after the radial coordinate and the positive direction of the poloidal angle are chosen. In GTAW code, I choose the positive direction of 𝜃 to be in anticlockwise direction when observers look along the direction of ˆϕ. To achieve this, the line integration in Eq. (197) should be along the anticlockwise direction. (I use the determination of the direction matrix, a well known method in graphic theory, to determine the direction from a given set of discrete points on a magnetic surface.)

Normalized poloidal angle

The span of 𝜃 defined by Eq. (197) is usually not 2π in one poloidal loop. This poloidal angle can be scaled by s(ψ) to define a new poloidal coordinate 𝜃, whose span is 2π in one poloidal loop, where s(ψ) is a magnetic surface function given by

s(ψ) = ∮--2π----.
        |𝒥R∇ψ|dlp
(199)

Then 𝜃 is written as

-
𝜃i,j = s(ψj)𝜃i,j
          (       ∫ xi,j        )
   = s(ψj) 𝜃ref,j +     --R---dlp
                   xref,j|𝒥∇ ψ|
     -          ∫ xi,j --R---
   = 𝜃ref,j + s(ψj) x    |𝒥 ∇ψ |dlp,                     (200)
                  ref,j
where 𝜃ref,j = s(ψj)𝜃ref,j. Sine we have modified the definition of the poloidal angle, the Jacobian of the new coordinates (ψ,𝜃) is different from that of (ψ,𝜃,ϕ). The Jacobian 𝒥new of the new coordinates (ψ,𝜃) is written as
       ------1-------
𝒥new ≡ (∇ ψ × ∇𝜃)⋅∇ ϕ
               1
    =  {∇ψ-×-∇[s(ψ)𝜃]}⋅∇-ϕ-

    =  -1--------1-------
       s(ψ )(∇ψ × ∇𝜃)⋅∇ ϕ
    =  -1--𝒥′
       s(ψ )
        -1--
    = ± s(ψ)𝒥                                   (201)
The Jacobian 𝒥 can be set to various forms to achieve various poloidal coordinates, which will be discussed in the next section. After the Jacobian and the radial coordinate ψ is chosen, all the quantities on the right-hand side of Eq. (200) are known and the integration can be performed to obtain the value of 𝜃i,j of each point on each flux surface.

[The reference points xref,j and the values of poloidal angle at these points can be chosen by users. One choice of the reference points xref,j are those points on the horizontal ray in the midplane that starts from the magnetic axis and points to the low filed side of the device and 𝜃ref,j at these points is chosen as zero (this is my choice in the GTAW code). In the TEK code, the reference points are chosen at the high-field side of the midplane and 𝜃ref,j = π at the reference points.]

Jacobian for equal-arc-length poloidal angle

If the Jacobian 𝒥 is chosen to be of the following form

      R
𝒥 = ---- .
    |∇ ψ|
(202)

Then 𝜃i,j in Eq. (200) is written

                 ∫
𝜃   = 𝜃   + ∮2π--  xi,jdl.
 i,j    ref,j    dlp  xref,j p
(203)

and the Jacobian of new coordinates (ψ,𝜃), 𝒥new, which is given by Eq. (201), now takes the form

        ∮ dl  R      ∮ dl  R  dΨ
𝒥new = ±---p-----= ± ---p--------.
         2π  |∇ ψ|     2π  |∇ Ψ|dψ
(204)

Equation (203) indicates a set of poloidal points with equal arc intervals corresponds to a set of uniform 𝜃i points. Therefore this choice of the Jacobian is called the equal-arc-length Jacobian. Note that Eq. (203) does not involve the radial coordinate ψ. Therefore the values of 𝜃 of points on any magnetic surface can be determined before the radial coordinate is chosen.

Jacobian for equal-volume poloidal angle (Hamada coordinate)

The volume element in (ψ,𝜃,ϕ) coordinates is given by dV = |𝒥|d𝜃dϕdψ. If we choose a Jacobian that is independent of 𝜃, then uniform 𝜃 grids will correspond to grids with uniform volume interval. In this case, 𝒥 is written as

𝒥 = h (ψ ),
(205)

where h(ψ) is a function independent of 𝜃. Then 𝜃i,j in Eq. (200) is written

-    -        2π    ∫ xi,j  R
𝜃i,j = 𝜃ref,j + ∮-R--dl      |∇ψ|dlp
             |∇ψ| p  xref,j
(206)

and the Jacobian of the new coordinates (ψ,𝜃), 𝒥new,  is given by Eq. (201), which now takes the following form:

         1 ∮   R
𝒥new = ± 2π-  |∇-ψ|dlp.
(207)

Note that both 𝜃i,j and 𝒥new are independent of the function h(ψ) introduced in Eq. (205). (h(ψ) is eliminated by the normalization procedure specified in Sec. 12.4 due to the fact that h(ψ) is constant on a magnetic surface.) The equal-volume poloidal angle is also called Hamada poloidal angle.

The equal-volume poloidal angle is useful in achieving loading balance for parallel particle simulations. Assume that markers are loaded uniform in space and the poloidal angle is domain decomposed and assigned to different MPI process. Then the equal-volume poloidal angle can make marker number in each MPI process be equal to each other and thus work loading to each process be equal. (**check**If the domain decomposition is also applied to the radial direction, to achieve loading balance, then the radial coordinate ψ should be chosen in a way that makes (R∕ψ)dlp be independent of ψ, so that 𝒥new in Eq. (207) is constant in space.**)

Jacobian of Boozer’s poloidal angle

If the Jacobian 𝒥 is chosen to be of the Boozer form:

         h(ψ)
𝒥(ψ,𝜃) = -B2-.
(208)

then the poloidal angle in Eq. (200) is written as

                    ∫ xi,j  2
𝜃i,j = 𝜃ref,j + ∮-B22πR--      B-R-dlp.
              |∇-ψ|dlp xref,j |∇ ψ|
(209)

The final Jacobian is given by

        ∮  2
          B|∇-Rψ|dlp 1
𝒥new = ±---2π---B2-.
(210)

The usefullness of Boozer poloidal angle will be further discussed in Sec. 16.8 after we introduce a gneralized toroidal angle.

 

Jacobian for PEST poloidal angle (straight-field-line poloidal angle)

If the Jacobian 𝒥 is chosen to be of the following form

𝒥 (ψ,𝜃) = R2,

then Eq. (183) implies that the local safety factor, ˆq (ψ,𝜃) = g∕Ψ, is a magnetic surface function, i.e., the magnetic field lines are straight in (ψ,𝜃) plane. Then the poloidal angle in Eq. (200) is written

                     ∫ xi,j
𝜃i,j = 𝜃ref,j + ∮-2π---      --1--dlp,
              R1|∇-ψ|dlp xref,j R|∇ψ |
(211)

The Jacobian 𝒥new given by Eq. (201) now takes the form

          ∮
         2  R|1∇ψ|dlp
𝒥new = ±R  ---2π----.
(212)

Let us denote an arbitrary poloidal angle by 𝜃 and the above straight-field-line poloidal angle by 𝜗, then it is ready to find the following relation between 𝜃 and 𝜗:

            ∫ 𝜃
𝜗 = 𝜗ref,j + 1    qˆd𝜃,
           q 𝜃ref,j
(213)

where ˆq is the local safety factor corresponding to the arbitrary poloidal angle 𝜃, i.e., ˆq = B⋅∇ϕ∕(B⋅∇𝜃). [Proof: Using d𝜃 = |𝒥R∇ψ-|dlp, the poloidal angle 𝜗 given in Eq. (211) is written as

                    ∫ x
𝜗 = 𝜗   + ∮---2π---    i,j--1---dl
     ref,j    R|1∇ψ|dlp  xref,jR |∇ ψ| p
                2π      ∫ xi,j   1   |𝒥 ∇ψ |
  = 𝜗ref,j + ∮--1--|𝒥∇ψ|--      -----------d𝜃
            R|∇ψ|--R--d𝜃 xref,j R|∇ψ |  R
          --2π---∫ xi,j|𝒥-|
  = 𝜗ref,j + ∮ |𝒥|d𝜃 x   R2 d𝜃.                            (214)
            R2     ref,j
Using ˆq = g-
R2𝒥-
Ψ′, where 𝒥 is the Jacobian of (ψ,𝜃,ϕ) coordinates, then the above 𝜗 is reduced to expression (213).]

Note that Boozer poloidal angle is very close to the poloidal angel disccused here because the two Jacobians are very similar:

𝒥  = -12-∼ R2.
     B
(215)

Comparison between different types of poloidal angle

 

All Jacobians introduced above can be written in a general form:

         i
𝒥  = --R-j-k,
     |∇ ψ| B
(216)

The choice of (i = 2,j = k = 0) gives the PEST coordinate, (i = j = 0,k = 2) give the Boozer coordinate, (i = j = 1,k = 0) gives the equal-arc coordinate, (i = j = k = 0) gives the Hammada coordinate.

 

Figure 6 compares the equal-arc-poloidal angle and the straight-line poloidal angle, which shows that the resolution of the straight-line poloidal angle is not good near the low-field-side midplane. Since ballooning modes take larger amplitude near the low-field-side midplane, better resolution is desired there. This is one reason that I often avoid using the straight-line poloidal angle in my numerical codes.


pict pict

Fig. 6: The equal-arc poloidal angle (left) and the straight-line poloidal angle (right) for EAST equilibrium #38300@3.9s. The blue lines correspond to the equal-𝜃 lines, with uniform 𝜃 interval between neighbour lines. The red lines correspond to the magnetic surfaces, which start from ∘ Ψ--
    t = 0.01714 (the innermost magnetic surface) and end at ∘ Ψ--
    t = 0.9851 (the boundary magnetic surface), and are equally spaced in ∘ ---
  Ψt.

Verification of Jacobian

After the magnetic coordinates are constructed, we can evaluate the Jacobian 𝒥new by using directly the definition of the Jacobian, i.e.,

       ------1-------
𝒥new = (∇ψ × ∇ 𝜃) ⋅∇ϕ ,
(217)

which can be further written as

𝒥new = R (R 𝜃Zψ − RψZ𝜃),
(218)

where the partial differential can be evaluated by using numerical differential schemes. The results obtained by this way should agree with results obtained from the analytical form of the Jacobian. This consistency check provide a verification for the correctness of the theory derivation and numerical implementation. In evaluating the Jacobian by using the analytical form, we may need to evaluate ψ, which finally reduces to evaluating Ψ. The value of |∇Ψ| is obtained numerically based on the numerical data of Ψ given in cylindrical coordinate grids. Then the cubic spline interpolating formula is used to obtain the value of |∇Ψ| at desired points. (𝒥new calculated by the second method (i.e. using analytic form) is used in the GTAW code; the first methods are also implemented in the code for the benchmark purpose.) In the following sections, for notation ease, the Jacobiban of the constructed coordinate system will be denoted by 𝒥 , rather than 𝒥new.

Radial coordinate

The radial coordinate ψ can be chosen to be various surface function, e.g., volume, poloidal or toroidal magnetic flux within a magnetic surface. The frequently used radial coordinates include Ψ, and √ Ψ-, where Ψ is defined by

--  Ψ-−-Ψ0-
Ψ = Ψa − Ψ0,
(219)

where Ψ0 and Ψa are the values of Ψ at the magnetic axis and LCFS, respectively. Other choices of the radial coordinates: the toroidal magnetic flux and its square root, Ψt, and ∘ ---
  Ψt, where Ψt and Ψt are defined by

dΨt
dΨ- = 2πq,Ψt(0) = 0
(220)

and

Ψ-=  -Ψt-,
 t   Ψt(1)
(221)

respectively, where Ψt(0) and Ψt(1) are the values of Ψt at the magnetic axis and LCFS, respectively.

If ψ =   ---
∘ Ψt, then

dΨ   dΨ dΨ     1 dΨ     1  dΨ dΨ-    1
---= -----t = ------t= ------t--t-= ---Ψt(1)2ψ
dψ   dΨtdψ    2πq dψ   2πq dΨtdψ    2πq
(222)

The cylindrical coordinates (R,ϕ,Z) is a right-hand system, with the positive direction of Z pointing vertically up. In GTAW code, the positive direction of 𝜃 is chosen in the anticlockwise direction when observers look along the direction of ˆ
ϕ. Then the definition 𝒥1 = ψ ×∇𝜃 ⋅∇ϕ indicates that (1) 𝒥 is negative if ψ points from the magnetic axis to LCFS; (2) 𝒥 is positive if ψ points from the LCFS to the magnetic axis. This can be used to determine the sign of Jacobian after using the analytical formula to obtain the absolute value of Jacobian.

If ψ = Ψ or ψ = √ --
  Ψ, ψ points from the magnetic axis to LCFS.

The volume between magnetic surfaces can also be used as a radial coordinate. The differential volume element is written as

d3V = 𝒥 dψd𝜃dϕ.
(223)

Integrating over the toroidal angle, we obtain

 2
d V = 2π𝒥dψd 𝜃
(224)

Further integrating over the poloidal angle, we obtain

 1         ∮
d V = 2πdψ   𝒥 d𝜃,
(225)

i.e.,

d1V      ∮
----= 2π   𝒥 d𝜃.
 dψ
(226)

In codes I wrote, I stick to using Ψ as the radial coordinate when doing computation, and transform to other radial coordinates when presenting the results if needed.

 

13 Constructing magnetic surface coordinate system from discrete Ψ(R,Z) data

Given an axisymmetric tokamak equilibrium in (R,ϕ,Z) coordinates (e.g., 2D data Ψ(R,Z) on a rectangular grids (R,Z) in G-file), we can construct a magnetic surface coordinates (ψ,𝜃,ϕ) by the following two steps. (1) Find out a series of magnetic surfaces on (R,Z) plane and select radial coordinates for each magnetic surface (e.g. the poloidal flux within each magnetic surface). (2) Specify the Jacobian or some property that we want the poloidal angle to have. Then calculate the poloidal angle of each point on each flux surface (on the ϕ = const plane) by using Eq. (195) (if the Jacobian is specified) or some method specified by us to achieve some property we prefer for the poloidal angle (if a Jacobian is not directly specified). Then we obtain the magnetic surface coordinates system (ψ,𝜃,ϕ).

13.1 Finding magnetic surfaces

Two-dimensional data Ψ(R,Z) on a rectangular grids (R,Z) is read from the G_EQDSK file (G-file) of EFIT code. Based on the 2D array data, I use 2D cubic spline interpolation to construct a interpolating function Ψ = Ψ(R,Z). To construct a magnetic surface coordinate system, I need to find the contours of Ψ, i.e., magnetic surfaces. The values of Ψ on the magnetic axis, Ψ0, and the value of Ψ on the last closed flux surface (LCFS), Ψb, are given in G-file. Using these two values, I construct a 1D array “psival” with value of elements changing uniform from Ψ0 to Ψb. Then I try to find the contours of Ψ with contour level value ranging from Ψ0 to Ψb. This is done in the following way: construct a series of straight line (in the poloidal plane) that starts from the location of the magnetic axis and ends at one of the points on the LCFS. Combine the straight line equation, Z = Z(R), with the interpolating function Ψ(R,Z), we obtain a one variable function h = Ψ(R,Z(R)). Then finding the location where Ψ is equal to a specified value Ψi, is reduced to finding the root of the equation Ψ(R,Z(R)) Ψi = 0. Since this is a one variable equation, the root can be easily found by using simple root finding scheme, such as bisection method (bisection method is used in GTAW code). After finding the roots for each value in the array “psival” on each straight lines, the process of finding the contours of Ψ is finished. The contours of Ψ found this way are plotted in Fig. 7.

 


pict

Fig. 7: Verification of the numerical code that calculates the contours of the poloidal flux Ψ. The bold line in the figure indicates the LCFS. The contour lines (solid lines) given by the gnuplot program agrees well with the results I calculate by using interpolation and root-finding method (the two sets of contours are indistinguishable in this scale). My code only calculate the contour lines within the LCFS, while those given by gnuplot contains additional contour lines below the X point and on the left top in the figure. Eqdisk file of the equilibrium was provided by Dr. Guoqiang Li (filename: g013606.07104).

 

In the above, we mentioned that the point of magnetic axis and points on the LCFS are needed to construct the straight lines. In G-file, points on LCFS are given explicitly in an array. The location of magnetic axis is also explicitly given in G-file. It is obvious that some of the straight lines Z = Z(R) that pass through the location of magnetic axis and points on the LCFS will have very large or even infinite slope. On these lines, finding the accurate root of the equation Ψ(R,Z(R)) Ψi = 0 is difficult or even impossible. The way to avoid this situation is obvious: switch to use function R = R(Z) instead of Z = Z(R) when the slope of Z = Z(R) is large (the switch condition I used is |dZ∕dR| > 1).

In constructing the flux surface coordinate with desired Jacobian, we will need the absolute value of the gradient of Ψ, |∇Ψ|, on some specified spatial points. To achieve this, we need to construct a interpolating function for |∇Ψ|. The |∇Ψ| can be written as

       ∘ ----------------
         (∂ Ψ)2   (∂ Ψ)2
|∇Ψ | =   ---   +  ---  ,
          ∂R       ∂Z
(227)

By using the center difference scheme to evaluate the partial derivatives with respect to R and Z in the above equation (using one side difference scheme for the points on the rectangular boundary), we can obtain an 2D array for the value of |∇Ψ| on the rectangular (R,Z) grids. Using this 2D array, we can construct an interpolating function for Ψ by using the cubic spline interpolation scheme.


pict pict

Fig. 8: Grid points (the intersecting points of two curves in the figure) corresponding to uniform poloidal flux and uniform poloidal arc length for EAST equilibrium shot 13606 at 7.1s (left) (G-file name: g013606.07104) and shot 38300 at 3.9s (right) (G-file name: g038300.03900).


pict

Fig. 9: |∇Ψ| as a function of the poloidal angle. The different lines corresponds to the values of |∇Ψ| on different magnetic surfaces. The stars correspond to the values on the boundary magnetic surface while the plus signs correspond to the value on the innermost magnetic surface (the magnetic surface adjacent to the magnetic axis). The equilibrium is for EAST shot 38300 at 3.9s.


pict pict

Fig. 10: The Poloidal magnetic field Bp = |∇Ψ|∕R (left) and toroidal magnetic field Bϕ = g∕R (right) as a function of the poloidal angle. The different lines corresponds to the values on different magnetic surfaces. The stars correspond to the values on the boundary magnetic surface while the plus signs correspond to the value on the innermost magnetic surface (the magnetic surface adjacent to the magnetic axis). The equilibrium is for EAST shot 38300 at 3.9s.

 

 


pict

Fig. 11: Equal-arc Jacobian as a function of the poloidal angle on different magnetic surfaces. The dotted line corresponds to the values of Jacobian on the boundary magnetic surface. The equilibrium is for EAST shot 38300 at 3.9s.


pict

Fig. 12: |∇Ψ| as a function of the poloidal angle. The different lines corresponds to values of |∇Ψ| on different magnetic surfaces. The stars correspond to the values of |∇Ψ| on the boundary magnetic surface while the plus signs correspond to the value on the innermost magnetic surface (the magnetic surface adjacent to the magnetic axis). The equilibrium is a Solovev equilibrium.

 


pict

Fig. 13: Jacobian on different magnetic surfaces as a function of the poloidal angle. The equilibrium is a Solovev equilibrium and the Jacobian is an equal-arc Jacobian. The stars correspond to the values of Jacobian on the boundary magnetic surface while the plus signs correspond to the value on the innermost magnetic surface (the magnetic surface adjacent to the magnetic axis).

 

13.2 Expression of metric elements of magnetic coordinates (ψ,𝜃,ϕ)

Metric elements of the (ψ,𝜃,ϕ) coordinates, e.g., ψ ⋅∇𝜃, are often needed in practical calculations. Next, we express these metric elements in terms of the cylindrical coordinates (R,Z) and their partial derivatives with respect to ψ and 𝜃. Note that, in this case, the coordinate system is (ψ,𝜃,ϕ) while R and Z are functions of ψ and 𝜃, i.e.,

R = R (ψ,𝜃),
(228)

Z = R (ψ,𝜃).
(229)

Then R and Z are written as

      ˆ
∇R  = R = Rψ∇ ψ + R𝜃∇ 𝜃,
(230)

∇Z  = ˆZ = Zψ∇ ψ + Z𝜃∇𝜃,
(231)

wehre Rψ ∂R∕∂ψ, etc. Equations (230) and (231) can be solved to give

           1
∇ψ =  R-Z--−-Z-R--(Z 𝜃Rˆ − R 𝜃ˆZ),
       ψ 𝜃    ψ 𝜃
(232)

     -----1------    ˆ     ˆ
∇𝜃 = ZψR 𝜃 − R ψZ𝜃(ZψR − R ψZ).
(233)

Using the above expressions, the Jacobian of (ψ,𝜃,ϕ) coordinates, 𝒥 , is written as

  −1
𝒥    = ∇ψ × ∇𝜃 ⋅∇ϕ
     = −-------1-------(Z  R ˆϕ − R Z  ˆϕ)× ϕˆ
        (RψZ 𝜃 − ZψR 𝜃)2 𝜃 ψ     𝜃 ψ     R
               1
     = −(Z𝜃R-ψ −-R-𝜃Z-ψ)R,                                (234)
i.e.,
𝒥 = R (R 𝜃Zψ − R ψZ𝜃).
(235)

Using this, Expressions (232) and (233) are written as

        R
∇ ψ = − 𝒥 (Z 𝜃Rˆ− R 𝜃ˆZ)
(236)

and

∇𝜃 = R-(ZψRˆ− R ψˆZ).
     𝒥
(237)

Then the elements of the metric matrix are written as

        R2
|∇ψ|2 = 𝒥2(Z2𝜃 + R2𝜃),
(238)

|∇ 𝜃|2 = R2-(Z2 +R2 ),
       𝒥 2  ψ    ψ
(239)

and

            2
∇ψ ⋅∇ 𝜃 = − R-(Z 𝜃Z ψ + R 𝜃Rψ).
           𝒥2
(240)

Equations (238), (239), and (240) are the expressions of the metric elements in terms of R, Rψ, R𝜃, Zψ, and Z𝜃. [Combining the above results, we obtain

∇ψ ⋅∇ 𝜃    Z Z  + R R
-----2-= − -𝜃--ψ2---𝜃2-ψ.
 |∇ ψ|         Z𝜃 + R 𝜃
(241)

Equation (240) is used in GTAW code. Using the above results, hαβ = 𝒥-
R2α ⋅∇β are written as

       𝒥         1
hψ ψ =--2|∇ψ|2 = -(Z2𝜃 + R2𝜃)
      R          𝒥
(242)

      𝒥         1
h𝜃𝜃 = -2|∇ 𝜃|2 = -(Z2ψ + R2ψ ),
      R         𝒥
(243)

      𝒥             1
hψ𝜃 = R2-∇ψ ⋅∇ 𝜃 = − 𝒥-(Z 𝜃Z ψ + R 𝜃Rψ)
(244)

As a side product of the above results, we can calculate the arc length in the poloidal plane along a constant ψ surface, dℓp, which is expressed as

     ∘ ------------
dℓp =  (dR)2 + (dZ)2
     ∘ -------------2---------------2
   =   (Rψdψ + R𝜃d𝜃) + (Zψdψ + Z𝜃d𝜃) .
Note that = 0 since we are considering the arc length along a constant ψ surface in (R,Z) plane. Then the above expression is reduced to
      ∘------2--------2
dℓp = ∘(R-𝜃d𝜃)- +(Z𝜃d𝜃)
    =  R2 + Z2d𝜃
         𝜃   𝜃
    = |𝒥-∇-ψ|d𝜃,                                (245)
        R
which agrees with Eq. (195).]

14 Constructing model tokamak magnetic field

In some cases (e.g., turbulence simulation), model tokamak magnetic field, which is not an exact solution to the GS equation, is often used. In the model, the safety factor profile q(ψ), toroidal field function g(ψ), and the magnetic surface shape (R(ψ,𝜃),Z(ψ,𝜃)) are given. To use this model in a simulation, we need to calculate its poloidal magnetic field, which is determined by the poloidal magnetic flux function Ψ. To determine Ψ, we need to use Eq. (187), i.e.,

         1 g ∫ 2π 𝒥
q(ψ) = −2π-Ψ′     R2d𝜃,
               0
(246)

and re-organize the formula as

              ∫
dΨ-= − -1-g(ψ-)  2π-𝒥-d𝜃,
dψ     2π q(ψ ) 0  R2
(247)

which can be integrated to obtain Ψ and thus the poloidal magnetic field Bp = Ψ ×∇ϕ, where 𝒥 = [(ψ ×∇𝜃) ⋅∇ϕ]1. The toroidal magnetic field can be obtained from g(ψ) by Bϕ = g∕R. In most papers, g(ψ) is chosen to be a constant.

A typical magnetic surface shape used in simulations is the Miller shape, which is given by

                          −1
R (r,𝜃) = R0 (r)+ r cos[𝜃+ (sin δ(r))sin𝜃]
Z (r,𝜃) = κ(r)rsin 𝜃
(248)

where r = ψ is the radial coordinate, R0(r), δ(r), and κr(r) are the Shafronov shift, triangularity, and elongation profiles, which can be arbitrarily specified. For the special case of R0 being a constant, δ(r) = 0, and κ(r) = 1, this shape reduces to a concentric-circular magnetic field. An example of calculating the poloidal field of the model field is given in Sec. 18. This kind of model field can be called theoretical physicists’ tokamak. Computational physicists often use this model for code benchmarking purpose. The famous DIII-D cyclone base case is an example, which was extensively used for benchmarking gyrokinetic simulation of ion temperature driven turbulence.

15 Magnetic surface averaging

15.1 Definition

The magnetic surface average of a physical quantity G(ψ,𝜃,ϕ) is defined by

           ( ∫ ∫ ∫ Gd3V  )
⟨G ⟩ ≡ ΔliΨm→0  ∫-∫ ∫ΔΨ-3--- ,
                 Δ Ψ d V
(249)

where the volume integration is over a small volume between two adjacent flux surfaces with Ψ differing by Ψ. [This formula (with finite ΔΨ) is used in TEK code to calculate the radial heat flux.]

The above 3D volume integration can also be written as a 2D surface integration. The differential volume element is given by d3V = |𝒥|dψd𝜃dϕ, where 𝒥 is the Jacobian of (ψ,𝜃,ϕ) coordinates. Using this, equation (249) is written as

          ( ∫ ∫ ∫             )
⟨G⟩ = lim    -∫ ∫-Δ∫Ψ-G|𝒥-|dψd𝜃dϕ
     Δ Ψ→0       ΔΨ |𝒥 |dψd 𝜃dϕ
      ∫ ∫ G|𝒥|d𝜃dϕ
   =  ∫-∫--------,                                 (250)
          |𝒥 |d𝜃dϕ
which is a 2D averaging over a magnetic surface and thus is called magnetic surface average. Note that the surface averaging of any n0 harmonic is zero (n is the toroidal mode number). Therefore the magnetic surface average contains only the contribution from the n = 0 component, i.e., axisymmetric component. (On the other hand, m0 poloidal harmonics of G can contribute to the surface average since the Jacobian has a poloidal angle dependence.) Using this and noting that 𝒥 is axisymmetric, then expression (250) is written as
      ∫
      -G0(ψ,𝜃)|𝒥|d𝜃-
⟨G⟩ =    ∫ |𝒥 |d𝜃    ,
(251)

where G0(𝜃) is defined by the following Fourier expansion:

     +∑∞
G =      Gn(ψ,𝜃)exp(− inϕ).
    n=−∞
(252)

_________________________________________________________________________________________________________________________

“Zonal” and “mean” components

Gis sometimes called the “zonal” component of G if the radial wavelength of Gis much smaller than the equilibrium scale length. If the radial wavelength of Gis comparable to the equilibrium scale length, Gis usually called “mean” component in tokamak literature. For example, mean flows are of system space scale and thus are easy to be observed in experiments. On the other hand, the “zonal” flow, which usually refers to the turbulence generated secondary flow, is of much smaller radial scale (the radial wavelength of zonal flow is of several Larmor radius) and thus is difficult to observe in experiments.

_________________________________________________________________________________________________________________________

Sometimes, we do not want the Jacobian to explicitly appear in the formula. This can be achieved by writing the differential volume element as

 3        -dΨ--
d V = Rd ϕ|∇ Ψ|dlp.
(253)

Using Bp = |∇Ψ|∕R, the volume element is further written as

 3      dΨ
d V = dϕB--dlp
          p
(254)

Using this, the averaging defined in Eq. (249) is written as

           ∫ ∫ ∫
           ----Δ-Ψ Gd-ϕdBΨpdlp
⟨G ⟩ = ΔlΨim→0 ∫ ∫ ∫  dϕdΨdlp
      ∫ ∫   1   ΔΨ   Bp
      ---G-Bpdϕdlp
    =  ∫ ∫B1 dϕdlp .                              (255)
            p
If G is axisymmetric, then the above equation is written as
      ∮
      --GB1p-dlp
⟨G ⟩ = ∮ 1-dlp .
         Bp
(256)

(Equation (256) is used in the GTAW code to calculate the magnetic surface averaging.) Using Eq. (195) and Bp = |∇Ψ|∕R, equation (256) can also be written as

     ∫
      02π G|𝒥|d𝜃
⟨G ⟩ =-∫2π|𝒥-|d𝜃-.
       0
(257)

Using the expression of the volume element = |𝒥|d𝜃dϕdψ, the volume within a magnetic surface is written

       ∫      ∫               ∫ ψ ∫ 2π
V (ψ) =  dτ =   |𝒥|d𝜃dϕdψ = 2π ψ   0  |𝒥 |d𝜃dψ.
                                0
(258)

Using this, the differential of V with respect to ψ is written as

 ′   dV     ∫ 2π
V ≡  dψ-= 2π    |𝒥|d𝜃.
             0
(259)

Using this, Eq. (257) is written as

G= 2π-
V ′ 02πG|𝒥|d𝜃

15.2 Flux Surface Functions—to be deleted

Next, examine the meaning of the following volume integral

       ∫
D(ψ) ≡   B ⋅∇ 𝜃dτ,
        V
(260)

where the volume V = V (ψ) is the volume within the magnetic surface labeled by ψ. Using ∇⋅ B = 0, the quantity D can be further written as

     ∫
D  =   ∇ ⋅(𝜃B )dτ.
      V
(261)

Note that 𝜃 is not a single-value function of the spacial points. In order to evaluate the integration in Eq. (261), we need to select one branch of 𝜃, which can be chosen to be 0 𝜃 < 2π. Note that function 𝜃 = 𝜃(R,Z) is not continuous in the vicinity of the contour of 𝜃 = 0. Next, we want to use the Gauss’s theorem to convert the above volume integration to surface integration. Noting the discontinuity of the integrand 𝜃B in the vicinity of the contour of 𝜃 = 0, the volume should be cut along the contour, thus, generating two surfaces. Denote these two surfaces by S1 and S2, then equation (261) is written as

    ∫           ∫          ∫
D =    𝜃B ⋅dS +    𝜃B ⋅dS+     𝜃B ⋅dS,
     S1          S2         S3
where the direction of surface S1 is in the negative direction of 𝜃, the direction of S2 is in the positive direction of 𝜃, and the surface S3 is the toroidal magnetic surface ψ = ψ0. The surface integration through S3 is obviously zero since B lies in this surface. Therefore, we have
     ∫          ∫
D  =    𝜃B ⋅dS+    𝜃B ⋅dS + 0
     ∫S1        ∫S2

   =  S1 0B ⋅dS+ S2 2πB ⋅dS
       ∫
   = 2π   B ⋅dS.                                  (262)
        S2
Eq. (262) indicates that D is 2π times the magnetic flux through the S2 surface. Thus, the poloidal flux through S2 is written as
      1     1 ∫
Ψp = --D  = ---  B ⋅∇ 𝜃dτ.
     2π     2π V
(263)

Using the expression of the volume element = |𝒥|d𝜃dϕdψ, Ψp can be further written in terms of flux surface averaged quantities.

      1 ∫
Ψp = 2π-  B ⋅∇ 𝜃|𝒥 |d𝜃dϕd ψ
     ∫ ψ V ∫ 2π
   =    dψ     B ⋅∇𝜃|𝒥|d𝜃
     ∫0    ∫0
       ψ     2π  ′
   =  0 dψ  0  Ψ ∇ψ × ∇ϕ ⋅∇ 𝜃|𝒥 |d𝜃
             ∫ ψ   ∫ 2π
   = − sign(𝒥)    dψ    Ψ ′(ψ)d𝜃
              0∫    0
   = − 2π sign(𝒥) ψ Ψ′(ψ )dψ
                0
   = − 2π sign(𝒥)[Ψ(ψ)− Ψ(0)].                        (264)
Note that the sign of the Jacobian appears in Eq. (264), which is due to the positive direction of surface S2 is determined by the positive direction of 𝜃, which in turn is determined by the sign of the Jacobian (In my code, however, the positive direction of 𝜃 is chosen by me and the sign of the Jacobian is determined by the positive direction of 𝜃). We can verify the sign of Eq. (264) is exactly consistent with that in Eq. (27).

Similarly, the toroidal flux within a flux surface is written as

     1 ∫
Ψt =---   B ⋅∇ ϕdτ,
    2π  V
(265)

the poloidal current within a flux surface is written as

         ∫
K(ψ) = 1--  J ⋅∇𝜃dτ,
       2π  V
(266)

and toroidal current within a flux surface is written as

         ∫
I(ψ) =-1-   J⋅∇ ϕdτ.
      2π  V
(267)

(**check**)The toroidal magnetic flux is written as

       ∫
Ψt =-1-  B ⋅∇ ϕ|𝒥 |d𝜃dϕdψ
    2∫π    ∫
      ψ     2π -1-
  =  0 dψ  0  gR2 |𝒥 |d𝜃
    ∫ ψ[ V ′⟨ 1 ⟩ ]
  =     g---  -2-  dψ.                         (268)
     0   2π   R
Ψt= g  ′
V--
2π⟨   ⟩
  1--
  R2

dΨ
--t
dV = g1
---
2π⟨  1 ⟩
  -2-
  R

   dΨ    g  1  ⟨ 1 ⟩
⇒  ---= ------- --2 .
   dV   2πq 2π  R
(269)

Next, calculate the derivative of the toroidal flux with respect to the poloidal flux.

dΨt-  Ψt′
dΨp = Ψp′
            ′  ⟨   ⟩
    = − -gV2-′- -12 ,                         (270)
        (2π) Ψ   R
Comparing this result with Eq. (470) indicates that it is equal to the safety factor, i.e.,
dΨt-
dΨp = q(ψ).
(271)

By using the contravariant representation of current density (502), the poloidal current within a magnetic surface is written as

          ∫
K(ψ) = -1-  J⋅∇ 𝜃𝒥 d𝜃dϕd ψ
       2π∫
     = 1-- (− g′)∇ϕ × ∇ ψ⋅∇ 𝜃𝒥d𝜃dψ
       μ0
        -1-∫  ′
     = −μ0   g d𝜃dψ
           ∫ ψ
     = − 2π   g′dψ
        μ0  0
     = − 2π-[g(ψ)− g(0)].                             (272)
        μ0
Note that the poloidal current is proportional to g, which explains why g is sometimes called poloidal current function in tokamak literature.
[(          )    (            ) ]
   Ψ′ 𝒥-|∇ ψ|2  +   Ψ′ 𝒥-∇ ψ ⋅∇ 𝜃
     R2       ψ      R2        𝜃ψ ×∇𝜃 g′∇ϕ ×∇ψ,

The toroidal current is written as

          ∫
Iϕ(ψ) =-1-  J ⋅∇ϕ 𝒥d𝜃dϕdψ
       2π       [                               ]
           1  ∫  (  ′ 𝒥    2)    ( ′ 𝒥        )
     = − 2πμ--    Ψ R2-|∇ψ|    +  Ψ R2-∇ψ ⋅∇ 𝜃   ∇ ψ × ∇𝜃⋅∇ ϕ𝒥 d𝜃dϕdψ
            0 [(          )  ψ (            ) ]𝜃
         1--∫     ′ 𝒥    2       ′ 𝒥-
     = − μ0     Ψ R2 |∇ ψ|  ψ +  Ψ R2 ∇ψ ⋅∇ 𝜃 𝜃 d𝜃dψ
            ∫ [(          ) ]
     = − 1--    Ψ ′ 𝒥-|∇ ψ|2   d𝜃dψ
         μ0       R2       ψ
            ∫ 2π  ∫ ψ   (          )
     = − 1--    d𝜃   dψ  Ψ ′ 𝒥-|∇ ψ|2
         μ0  0     0       R2       ψ
         1  ∫ 2π  (  ′ 𝒥    2   )
     = − μ0-    d𝜃 Ψ R2-|∇ ψ| − 0  .                                   (273)
             0
The last equality is due to ψ = 0 at ψ = 0. By using the flux surface average operator, Eq. (273) is written
           ′ ′⟨     2⟩
Iϕ(ψ) = − V-Ψ-  |∇-ψ|- .
         2πμ0    R2
(274)

Next, calculate another useful surface-averaged quantity,

          ⟨   [(          )    (            ) ]⟩
            g2-  1Ψ′ 𝒥-|∇ψ |2  +  1Ψ ′∇ ψ⋅∇ 𝜃 𝒥
-⟨J-⋅B⟩--  --𝒥---g--R2------ψ----g---------R2-𝜃---
⟨B⋅∇ ϕ⟩ =                μ0⟨g∕R2⟩
          2π∫ 2π     [(1   𝒥     )    (1          𝒥) ]
          V′ 0  d𝜃g2  gΨ ′R2 |∇ ψ|2 ψ + gΨ ′∇ ψ ⋅∇𝜃R2  𝜃
        = -----------------------−2-------------------
                    [(      μ0g⟨R)  ⟩ (            ) ]
          2π′g2∫ 2π d𝜃  1Ψ ′ 𝒥2|∇ ψ|2 +  1Ψ ′∇ ψ ⋅∇𝜃-𝒥2
        = V----0------g--R--------ψ---g---------R---𝜃-
                            μ0g⟨R −2⟩
          2π ∫ 2π   [(1  ′ 𝒥    2) ]
          V′g 0  d𝜃  gΨ  R2|∇ ψ|  ψ
        = ---------μ-⟨R−2⟩---------
             ∫     [0(           ) ]
          2Vπ′g 02π d𝜃  1gΨ ′ 𝒥R2|∇ ψ|2
        = -----------------------ψ-                           (275)
                   μ0⟨R−2⟩
The differential with respect to ψ and the integration with respect to 𝜃 can be interchanged, yielding
          2π [ 1  (∫2π   𝒥     ) ]
 ⟨J ⋅B⟩    V′g  gΨ′  0 d𝜃 R2|∇ ψ|2  ψ
⟨B-⋅∇ϕ⟩-= ---------μ-⟨R−2⟩---------
             [      0⟨    2⟩]
          V1′g  1gΨ′V′ |∇Rψ2|
        = ----------−2------ψ
                μ0⟨R[ ⟩′ ′⟨     2⟩]
        = ----g----- Ψ-V-  |∇ψ|-                     (276)
          μ0V ′⟨R−2⟩   g     R2    ψ

 

16 Magnetic coordinates (ψ,𝜃,ζ) with general toroidal angle ζ

16.1 General toroidal angle ζ

In Sec. 12.1, we introduced the local safety factor ˆq (ψ,𝜃). Equation (183) indicates that if the Jacobian is chosen to be of the particular form 𝒥 = h(ψ)R2, then the local safety factor is independent of 𝜃, i.e., magnetic line is straight in (𝜃,ϕ) plane. On the other hand, if we want to make field line straight in (𝜃,ϕ) plane, the Jacobian must be chosen to be of the specific form 𝒥 = h(ψ)R2. We note that, as mentioned in Sec. 12.3, the poloidal angle is fully determined by the choice of the Jacobian. The specific choice of 𝒥 = α(ψ)R2 is usually too restrictive for achieve a desired poloidal resolution (for example, the equal-arc poloidal angle can not be achieved by this choice of Jacobian). Is there any way that we can make the field line straight in a coordinate system at the same time ensure that the Jacobian can be freely adjusted to obtain desired poloidal angle? The answer is yes. The obvious way to achieve this is to define a new toroidal angle ζ that generalizes the usual toroidal angle ϕ. Define a new toroidal angle ζ by[10]

ζ = ϕ− q(ψ)δ(ψ,𝜃),
(277)

where δ = δ(ψ,𝜃) is a unknown function to be determined by the constraint of field line being straight in (𝜃,ζ) plane. Using Eq. (184), the new local safety factor in (ψ,𝜃,ζ) coordinates is written as

ˆqnew ≡ B-⋅∇-ζ
      B ⋅∇ 𝜃
    = (∇-ϕ×-∇-ψ+-ˆq∇-ψ-×∇-𝜃)⋅∇-ζ
      (∇ ϕ× ∇ ψ+ ˆq∇ ψ ×∇ 𝜃)⋅∇ 𝜃
      ∇-ϕ×-∇-ψ-⋅∇ζ-+qˆ∇-ψ-×-∇𝜃-⋅∇ζ
    =        (∇ϕ × ∇ψ )⋅∇𝜃
      ∇ ϕ× ∇ ψ ⋅∇(− qδ)+ ˆq∇ ψ ×∇ 𝜃⋅∇ ϕ
    = -------------------------------
               (∇ϕ × ∇ψ )⋅∇𝜃
    = − q∂δ+ ˆq.                                       (278)
         ∂𝜃
To make the new local safety factor be independent of 𝜃, the right-hand side of Eq. (278) should be independent of 𝜃, i.e.,
   ∂δ
− q---+qˆ= c(ψ ),
   ∂𝜃
(279)

where c(ψ) can be an arbitrary function of ψ. A convenient choice for c(ψ) is c(ψ) = q, i.e., making the new local safety factor be equal to the original global safety factor, i.e., ˆq new = q. In this case, equation (279) is written as

∂δ   ˆq
---= -− 1,
∂𝜃   q
(280)

which, on a magnetic surface labed by ψ, can be integrated over 𝜃 to give

                              ∫ 𝜃
δ(ψ,𝜃) = δ(ψ,𝜃ref)− (𝜃− 𝜃ref)+ 1    ˆqd𝜃,
                            q  𝜃ref
(281)

where 𝜃ref is an starting poloidal angle arbitrarily chosen for the integration, and δ(ψ,𝜃ref) is the constant of integration. In the following, both 𝜃ref and δ(ψ,𝜃ref) will be chosen to be zero. Then the above equations is written

          ∫ 𝜃
δ = − 𝜃 + 1  qˆd𝜃.
         q 0
(282)

Substituting the above expression into the definition of ζ (Eq. 277), we obtain

           ∫ 𝜃
ζ = ϕ + q𝜃−   ˆqd𝜃,
            0
(283)

which is the formula for calculating the general toroidal angle. If 𝜃 is a straight-field line poloidal angle, then ζ in Eq. (283) reduces to the usual toroidal angle ϕ.

In summary, magnetic field line is straight in (𝜃,ζ) plane with slope being q if ζ is defined by Eq. (283). In this method, we make the field line straight by defining a new toroidal angle, instead of requiring the Jacobian to take particular forms. Thus, the freedom of choosing the form of the Jacobian is still available to be used later to choose a good poloidal angle coordinate. Note that the Jacobian of the new coordinates (ψ,𝜃,ζ) is equal to that of (ψ,𝜃,ϕ). [Proof:

𝒥 −ne1w = ∇ψ × ∇ 𝜃⋅∇ ζ
     = ∇ψ × ∇ 𝜃⋅∇ (ϕ − qδ)
     = ∇ψ × ∇ 𝜃⋅∇ ϕ− ∇ ψ× ∇ 𝜃⋅∇ (qδ)

     = ∇ψ × ∇ 𝜃⋅∇ ϕ− 0
     = 𝒥− 1.
] Also note that δ(ψ,𝜃) defined by Eq. (282) is a periodic function of 𝜃. [Proof: Equation (282) implies that
             1∫ 𝜃+2π
δ(ψ,𝜃+ 2π) = -      ˆqd𝜃− (𝜃− 𝜃ref)− 2π
             q∫0                      ∫
          =  1  𝜃ˆqd𝜃 − (𝜃 − 𝜃 )− 2π + 1 𝜃+2πqˆd𝜃
             q 0           ref       q  𝜃
                         1∫ 𝜃+2π
          = δ(ψ,𝜃)− 2π + q      ˆqd𝜃
                           𝜃
          = δ(ψ,𝜃).                                        (284)
]

[In numerical implementation, the term 0𝜃B-⋅∇ϕ
B ⋅∇𝜃d𝜃 appearing in δ is computed by using

∫ 𝜃           ∫ 𝜃         ∫ 𝜃
   B-⋅∇-ϕd𝜃 =    -g-𝒥-d𝜃 =    g--1 -R--dlp
 0 B ⋅∇ 𝜃      0 R2 Ψ′     0  R2Ψ ′|∇ ψ|
              ∫ 𝜃 g 1
            =    R-|∇-Ψ|dlp
              ∫0 𝜃
            =    1-Bϕdℓp.                               (285)
               0 R Bp

For later use, from Eq. (282), we obtain

            (   )∫ 𝜃             ∫ 𝜃
∂(δq) = −-d- -g′    -𝒥2d𝜃− -g′ ∂-   𝒥-2d𝜃− dq-𝜃.           (286)
 ∂ψ      dψ  Ψ    0 R      Ψ  ∂ψ  0 R      dψ
This formula is used in GTAW code, where the derivative (g∕Ψ)∕∂ψ is calculated numerically by using the central difference scheme.]

 

16.2 Contravariant form of magnetic field in (ψ,𝜃,ζ) coordinates

Recall that the contravariant form of the magnetic field in (ψ,𝜃,ϕ) coordinates is given by Eq. (184), i.e.,

       ′
B = − Ψ (∇ϕ × ∇ψ + ˆq∇ψ × ∇ 𝜃).
(287)

Next, let us derive the corresponding form in (ψ,𝜃,ζ) coordinates. Using the definition of ζ, equation (287) is written as

       ′                ′
B = − Ψ ∇ (ζ + qδ)× ∇ψ − Ψ ˆq∇ψ × ∇ 𝜃
  = − Ψ ′∇ ζ × ∇ ψ − Ψ ′∇ (qδ) × ∇ψ − Ψ′ˆq∇ψ × ∇𝜃
       ′           ′∂-δ           ′
  = − Ψ ∇ ζ × ∇ ψ − Ψ q∂ 𝜃∇𝜃 × ∇ψ − Ψ ˆq∇ψ × ∇𝜃           (288)
Using Eq. (280), the above equation is simplified as
B  = − Ψ′(∇ζ × ∇ψ + q∇ψ × ∇ 𝜃).                    (289)
Equation (289) is the contravariant form of the magnetic field in (ψ,𝜃,ζ) coordinates.

The expression of the magnetic field in Eq. (289) can be rewritten in terms of the flux function Ψp and Ψt discussed in Sec. 15.2. Equation (289) is

B = ∇ Ψ × ∇ ζ + q∇ 𝜃× ∇ Ψ,
(290)

which, by using Eq. (264), i.e., Ψ = Ψp(2π), is rewritten as

B = -1-(∇ζ ×∇ Ψ + q∇ Ψ × ∇ 𝜃),
    2π         p      p
(291)

which, by using Eq. (271), i.e., q = t∕dΨp, is further written as

     1
B = 2π(∇ ζ × ∇ Ψp + ∇ Ψt × ∇𝜃).
(292)

16.3 Relation between the partial derivatives in (ψ,𝜃,ϕ) and (ψ,𝜃,ζ) coordinates

Noting the simple fact that

 d      d
---=  ------,
dx    d(x + c)
(293)

where c is a constant, we conclude that

(   )     (    )
  ∂f-       ∂f-
  ∂ζ  ψ,𝜃 =  ∂ϕ  ψ,𝜃 ,
(294)

(since ϕ = ζ + q(ψ)δ(ψ,𝜃), where the part q(ψ)δ(ψ,𝜃) acts as a constant when we hold ψ and 𝜃 constant), i.e., the symmetry property with respect to the new toroidal angle ζ is identical with the one with respect to the old toroidal angle ϕ. On the other hand, generally,

(    )     (   )
  ∂f-       -∂f
  ∂ψ  𝜃,ζ ⁄=  ∂ ψ  𝜃,ϕ
(295)

and

(   )     (    )
  ∂f-       ∂f-
  ∂𝜃 ψ,ζ ⁄=  ∂𝜃  ψ,ϕ .
(296)

In the special case that f is axisymmetric (i.e., f is independent of ϕ in (ψ,𝜃,ϕ) coordinates), then two sides of Eqs. (295) and (296) are equal to each other. Note that the partial derivatives ∂∕∂ψ and ∂∕∂𝜃 in Sec. 16.1 and 16.2 are taken in (ψ,𝜃,ϕ) coordinates. Because the quantities involved in Sec. 16.1 and 16.2 are axisymmetric, these partial derivatives are equal to their counterparts in (ψ,𝜃,ζ) coordinates.

16.4 Steps to construct a straight-line magnetic coordinate system

In Sec. 13, we have provided the steps to construct the magnetic surface coordinate system (ψ,𝜃,ϕ). Only one additional step is needed to construct the straight-line flux coordinate system (ψ,𝜃,ζ). The additional step is to calculate the generalized toroidal angle ζ according to Eq. (277), where δ is obtained from Eq. (282). Also note that the Jacobian of (ψ,𝜃,ζ) coordinates happens to be equal to that of (ψ,𝜃,ϕ) coordinates.

16.5 Form of operator B ⋅∇ in (ψ,𝜃,ζ) coordinates

The usefulness of the contravariant form [Eq. (289] of the magnetic field lies in that it allows a simple form of B ⋅∇ operator in a coordinate system. (The operator B0 ⋅∇ is usually called magnetic differential operator.) In (ψ,𝜃,ζ) coordinate system, by using the contravariant form Eq. (289), the operator is written as

            ′                       ′
B ⋅∇f  = − Ψ (∇ζ ×( ∇ψ )⋅∇f(ψ),𝜃,ζ)− Ψ q(∇ψ × ∇ 𝜃)⋅∇f(ψ,𝜃,ζ)
            ′ −1  ∂--  -∂-
       = − Ψ 𝒥    ∂𝜃 + q∂ ζ f.                                  (297)
Next, consider the solution of the following magnetic differential equation:
B ⋅∇f = h.
(298)

where h = h(ψ,𝜃,ζ) is some known function. Using Eq. (297), the magnetic differential equation is written as

( ∂        ∂)       1
  --+ q(ψ)--- f = − -′𝒥h(ψ,𝜃,ζ).
  ∂𝜃      ∂ζ        Ψ
(299)

Note that the coefficients before the two partial derivatives of the above equation are all independent of 𝜃 and ζ. This indicates that different Fourier harmonics in 𝜃 and ζ are decoupled. As a result of this fact, if f is Fourier expanded as

          ∑
f(ψ,𝜃,ζ) =   fmn(ψ)ei(m𝜃−nζ),
          m,n
(300)

(note that, following the convention adopted in tokamak literature[10], the Fourier harmonics are chosen to be ei(m𝜃), instead of ei(m𝜃+)), and the right-hand side is expanded as

                ∑
− 1′𝒥 h(ψ, 𝜃,ζ) =    γmn(ψ)ei(m𝜃−nζ),
  Ψ             m,n
(301)

then Eq. (299) can be readily solved to give

         γ
fmn = ----mn--.
      i[m − nq]
(302)

The usefulness of the straight line magnetic coordinates (ψ,𝜃,ζ) lies in that, as mentioned previously, it makes the coefficients before the two partial derivatives both independent of 𝜃 and ζ, thus, allowing a simple solution to the magnetic differential equation.

16.6 Resonant surface of a perturbation

Equation (302) indicates that, for the differential equation (298), there is a resonant response to a perturbation ei(m𝜃) on a magnetic surface with m nq = 0. Therefore, the magnetic surface with q = m∕n is called the “resonant surface” for the perturbation ei(m𝜃).

The phase change of the perturbation ei(m𝜃) along a magnetic field is given by mΔ𝜃 nΔζ, which can be written as Δ𝜃(mnq). Since mnq = 0 on a resonant surface, this indicates that there is no phase change along a magnetic field line on a resonant surface, i.e., the parallel wavenumber k is zero on a resonant surface.

16.7 Helical angle used in tearing mode theory

Next, we discuss a special poloidal angle, which is useful in describling a perturnbation of single harmonic (m,n). This poloidal angle is defined by

χ = 𝜃−  nζ,
        m
(303)

where (m,n) are the mode numbers of the perturbation. The poloidal angle χ is often called helical angle and is special in that its definition is associated with a perturbation (the mode numbers of the perturbation appear in the definition) while the definition of the poloidal angles discussed previously only involve the equilibrium quantities.

The poloidal angle χ is designed to make 3D perturbations of the form f(ψ,m𝜃 ) reduce to 2D perturbations, i.e.,

  |
∂f||
∂ζ|ψ,χ = 0.
(304)

It is ready to verify that the Jacobian of coordinates (ψ,χ,ζ) is equal to that of coordinates (ψ,𝜃,ζ) [proof: (𝒥′)1 = ψ ×∇χ ⋅∇ζ = ψ ×∇(𝜃 nζ∕m) ⋅∇ζ = ψ ×∇𝜃 ⋅∇ζ = 𝒥1].

The component of B along χ direction (i.e., the covariant component) is written

 (χ)
B   ≡ B ⋅∇ χ
    = − Ψ′(∇ ζ × ∇ ψ + q∇ ψ × ∇𝜃)⋅∇ (𝜃− nζ∕m )
    = − Ψ′(∇ ζ × ∇ ψ ⋅∇𝜃)+ Ψ ′ n(q∇ψ × ∇ 𝜃⋅∇ ζ)
                           m
    = − Ψ′𝒥−1 + Ψ′ n-q𝒥−1
            ( nq  m)
    = Ψ ′𝒥 −1  --− 1  .                                   (305)
              m
At the resonant surface q = m∕n, equation (305) implies B(χ) = 0. The direction χ defines the reconnecting component of the magnetic field?

On the other hand, the component of B along 𝜃 direction is written

 (𝜃)
B   ≡ B ⋅∇𝜃
    = − Ψ ′(∇ ζ × ∇ ψ+ q∇ ψ× ∇ 𝜃)⋅∇ 𝜃
    = − Ψ ′∇ ζ × ∇ ψ⋅∇ 𝜃
         ′ −1
    = − Ψ 𝒥  .                                      (306)
Using (306) and (305), the relation between B(𝜃) and B(χ) is written as
          (    nq)
B (χ) = B (𝜃) 1 − m- .
(307)

16.8 Covariant form of magnetic field in (ψ,𝜃,ζ) coordinate system

In the above, we have obtained the covariant form of the magnetic field in (ψ,𝜃,ϕ) coordinates (i.e., Eq. (181)). Next, we derive the corresponding form in (ψ,𝜃,ζ) coordinate. In order to do this, we need to express the ϕ basis vector in terms of ψ, 𝜃, and ζ basis vectors. Using the definition of the generalized toroidal angle, we obtain

g∇ ϕ = g∇ (ζ + qδ)
    = g∇ ζ + gq∇ δ+ gδ∇q
               (             )
    = g∇ ζ + gq ∂δ-∇ψ + ∂δ-∇𝜃  + gδq′∇ ψ
      (         ∂ψ)     ∂𝜃
          ∂δ-     ′        ∂δ-
    =   gq∂ψ + gδq  ∇ ψ+ gq∂𝜃 ∇𝜃 + g∇ ζ
        ∂(qδ)        ∂δ
    = g -∂ψ-∇ ψ + gq ∂𝜃∇ 𝜃+ g∇ζ.                        (308)
Using Eq. (308), the covariant form of the magnetic field, Eq. (181), is written as
     (                    )      (                )
       ′ 𝒥-          ∂(qδ)          ∂δ-   ′ 𝒥-   2
B =   Ψ R2 ∇ψ ⋅∇𝜃 + g ∂ψ   ∇ ψ +  gq∂𝜃 − Ψ R2|∇ψ |  ∇𝜃 + g∇ζ.
(309)

This expression can be further simplified by using equation (280) to eliminate ∂δ∕∂𝜃, which gives

     (                    )      (                    )
B  =  Ψ′ 𝒥-∇ψ ⋅∇ 𝜃+ g∂(qδ) ∇ ψ +  − g2− gqR2-− Ψ ′|∇ψ |2  𝒥-∇ 𝜃+ g∇ ζ
        R2            ∂ψ            Ψ′     𝒥            R2
     ( ′ 𝒥           ∂(qδ))      (  g2 + |∇ Ψ|2   R2 ) 𝒥
   =  Ψ R2-∇ψ ⋅∇ 𝜃+ g-∂ψ-- ∇ ψ +  − ---Ψ-′---− gq-𝒥-  R2∇ 𝜃+ g∇ ζ.   (310)
Using B2 = (|∇Ψ|2 + g2)∕R2, the above equation is written as
    (                    )      (              )
      ′-𝒥-          ∂(qδ)          B2R2-    R2-  𝒥--
B =  Ψ R2 ∇ψ ⋅∇ 𝜃+ g ∂ψ   ∇ ψ +  −  Ψ ′ − gq 𝒥   R2∇ 𝜃+ g∇ ζ
    (   𝒥           ∂(qδ))      (  B2      )
  =  Ψ′R2-∇ψ ⋅∇ 𝜃+ g-∂ψ-- ∇ ψ +  − Ψ′ 𝒥 − gq ∇ 𝜃+ g∇ζ.           (311)
Equation (311) is the covariant form of the magnetic field in (ψ,𝜃,ζ) coordinate system. For the particular choice of the radial coordinate ψ = Ψ and the Jacobian 𝒥 = h(ψ)∕B2 (i.e., Boozer’s Jacobian, discussed in Sec. 16.9), equation (311) reduces to
    (                    )
B =   −-𝒥2∇ψ ⋅∇ 𝜃+ g∂(qδ) ∇ ψ + I(ψ )∇ 𝜃+ g(ψ)∇ ζ,
       R             ∂ψ
(312)

with I(ψ) = h(ψ) gq. The magnetic field expression in Eq. (312) frequently appears in tokamak literature[30]. In this form, the coefficients before both 𝜃 and ζ depends on only the radial coordinate. In terms of I(ψ), the Jabobian can also be written as

𝒥  = gq+-I.
      B2
(313)

16.9 Form of operator (B ×∇ψ∕B2) ⋅∇ in (ψ,𝜃,ζ) coordinates

In solving the MHD eigenmode equations in toroidal geometries, besides the B ⋅∇ operator, we will also encounter another surface operator (B×∇ψ∕B2) ⋅∇. Next, we derive the form of the this operator in (ψ,𝜃,ζ) coordinate system. Using the covariant form of the equilibrium magnetic field [Eq.  (311)], we obtain

             (          )
B-×-∇-ψ   -1-   B2-                 -g-
  B2    = B2  − Ψ ′ 𝒥 − gq ∇ 𝜃× ∇ ψ+ B2 ∇ ζ × ∇ ψ.
(314)

Using this, the (B ×∇ψ∕B2) ⋅∇ operator is written as

                (         )
B-×-∇-ψ      -1- B2-         − 1 ∂- -g-  −1 ∂-
  B2    ⋅∇ = B2   Ψ′ 𝒥 + gq 𝒥   ∂ζ + B2 𝒥  ∂𝜃             (315)
             ( 1    𝒥 −1 ) ∂     𝒥−1 ∂
           =  --′ + g-2-q  ---+g --2---,                  (316)
              Ψ      B     ∂ζ    B   ∂𝜃
which is the form of the operator in (ψ,𝜃,ζ) coordinate system.

Examining Eq. (316), we find that the coefficients before the two partial derivatives will be independent of 𝜃 and ζ if the Jacobian 𝒥 is chosen to be of the form 𝒥 = h(ψ)∕B2, where h is some magnetic surface function. It is obvious that the independence of the coefficients on 𝜃 and ζ will be advantageous to some applications. The coordinate system (ψ,𝜃,ζ) with the particular choice of 𝒥 = h(ψ)∕B2 is called the Boozer coordinates. The usefulness of the new toroidal angle ζ is highlighted in Boozer’s choice of the Jacobian, which makes both B ⋅∇ and (B ×∇ψ∕B2) ⋅∇ be a constant-coefficient differential operator. For other choices of the Jacobian, only the B⋅∇ operator is a constant-coefficient differential operator.

16.10 Radial differential operator

In solving the MHD eigenmode equations in toroidal geometry, we also need the radial differential operator ψ ⋅∇. Next, we derive the form of the operator in (ψ,𝜃,ζ) coordinates. Using

f = ∂f-
∂ψψ + ∂f-
∂ 𝜃𝜃 + ∂f-
∂ζζ,

the radial differential operator is written as

∇ ψ ⋅∇f = |∇ ψ|2∂f-+ (∇𝜃 ⋅∇ ψ)∂f-+ (∇ζ ⋅∇ψ )∂f-
               ∂ψ           ∂ 𝜃           ∂ζ
              2∂f-          ∂f-                     ∂f-
        = |∇ ψ| ∂ψ + (∇𝜃 ⋅∇ ψ)∂ 𝜃 + {∇ [ϕ − qδ(ψ,𝜃)]⋅∇ ψ}∂ζ
               ∂f           ∂f            ∂f
        = |∇ ψ|2∂ψ-+ (∇𝜃 ⋅∇ ψ)∂-𝜃 − ∇ [qδ]⋅∇ ψ∂ζ

        = |∇ ψ|2∂f-+ (∇𝜃 ⋅∇ ψ)∂f-− [q∇δ +δ∇q ]⋅∇ψ ∂f-
               ∂ψ           ∂ 𝜃  [ (            ∂ζ)        ]
        = |∇ ψ|2∂f-+ (∇𝜃 ⋅∇ ψ)∂f-−  q  ∂δ-∇ψ + ∂δ∇ 𝜃  + δq′∇ ψ ⋅∇ ψ∂f-
               ∂ψ           ∂ 𝜃      ∂ψ      ∂𝜃                  ∂ζ
              2∂f           ∂f   [∂ (qδ)    2   ∂δ       ] ∂f
        = |∇ ψ| ∂ψ-+ (∇𝜃 ⋅∇ ψ)∂-𝜃 − -∂-ψ-|∇ψ| + q∂𝜃-∇𝜃 ⋅∇ψ  ∂ζ,        (317)
where ()∕∂ψ and q∂δ∕∂𝜃 are given respectively by Eqs. (286) and (280). Using the above formula, ψ ⋅∇ζ is written as
            [∂(qδ)        ∂δ       ]
∇ ψ ⋅∇ζ = −  -----|∇ ψ|2 + q--∇ 𝜃⋅∇ ψ .
              ∂ψ          ∂𝜃
(318)

This formula is used in GTAW code.

17 Field-line-following coordinates

17.1 Definition of the field-line-following coordinates (ψ,𝜃,α)

In (ψ,𝜃,ζ) coordinates, a magnetic field line is straight in (𝜃,ζ) plane with slope being q. Then the equation for a magnetic field line is written as

ζ = q𝜃 + α,
(319)

where α is a constant in (𝜃,ζ) plane and can be used to label magnetic field lines on a magnetic surface. This motivates us to use α, i.e.,

α ≡ ζ − q𝜃,
(320)

to replace ζ. Then the magnetic field in Eq. (289) is written as

B = Ψ ′∇ ψ × ∇α,
(321)

which is called the Clebsch form. The direction

∂r|ψ,α = 𝒥∇ α× ∇ ψ,
∂𝜃
(322)

is parallel (or anti-parallel) to the magnetic field direction. Due to this fact, (ψ,𝜃,α) coordinates are usually called “field-line-following coordinates” or “field-aligned coordinates” [26].

Equation (321) implies that

B ⋅∇α = 0,
(323)

and

B ⋅∇ψ = 0,
(324)

i.e., both α and ψ are constant along a magnetic field line. Taking scalar product of Eq. (321) with 𝜃, we obtain

          Ψ ′
B ⋅∇ 𝜃 = − 𝒥-,
(325)

which is nonzero, i.e., only 𝜃 among (ψ,𝜃,α) is changing along a magnetic field line. (Here 𝒥 = (ψ ×∇𝜃 ⋅∇α)1 is the Jacobian of the coordinate system (ψ,𝜃,α), which happens to be equal to the Jacobian of (ψ,𝜃,ζ) coordinates.)

Using Eq. (321), the magnetic differential operator B ⋅∇ in the new coordinate system (ψ,𝜃,α) is written

         Ψ ′∂
B ⋅∇f  = −-- --f,
          𝒥 ∂𝜃
(326)

which is just a partial derivative over 𝜃, as is expected, since only 𝜃 is changing along a magnetic field line.

By the way, note that (B ⋅∇α)(B ⋅∇𝜃) = 0, i.e., the magnetic field lines are straight with zero slope on (𝜃,α) plane.

Using Eqs. (320) and (283), α can be written as

       ∫
         𝜃
α = ϕ − 0 ˆqd𝜃,                            (327)
where ˆq = B ⋅∇ϕ∕B ⋅∇𝜃 is the local safety factor. (If we choose the straight-field-line 𝜃, then α is written as α = ϕq𝜃.) Define δ = 0𝜃ˆq d𝜃, which is called tor_shift in TEK code, then α = ϕδ. In TEK, I choose 𝜃 [π,π) with 𝜃 = π corresponding to the high-field-side midplane, and 𝜃 is increasing along the counter-clockwise direction viewed along ϕ.  The 𝜃 cut, i.e., 𝜃 = ±π is far away from the low-field-side where ballooning modes often have larger amplitude. The (x,y) grid near the 𝜃 cut is highly twisted in real space and interplation is needed in mapping physical quantity from the grid at 𝜃 = π plane to that at 𝜃 = +π. Numerical errors more likely appear there. So we prefer that the 𝜃 cut is located in less important area (area where mode amplitude is small).

It is widely believed that turbulence responsible for energy transport in tokamak plasmas usually has kk, where k and k are the parallel and perpendicular wavenumbers, respectively. Due to this elongated structure along the parallel direction, less grids can be used in the parallel direction than that in the perpendicular direction in turbulence simulation. In this case, the field-aligned coordinates (ψ,𝜃,α) provide suitable coordinates to be used, where less gridpoints can be used for 𝜃 coordinate in simulations and even some ∂∕∂𝜃 derivatives can be neglected (high-n approximation), which simplifies the equations that need to be solved. There is another reason why almost all gyrokinetic codes use field-aligned coordinates: the  stability of numerical algorthims is improved when we use coarse grids in the parallel direction because the parallel Courant condition (for explicit schemes) Δt ΔL∕v can be more easily satisfied (especially for the cases with kinetic electrons), where ΔL is the parallel grid spacing, which is larger when coarse grids are used in the parallel direction. This is also mentioned in Ref. [23] and it seems to be right from my experiences of testing several algorithm but a strict test is needed to verify this. This can also be understood in the following way: the coarse parallel grid automatically filters out physically irrelevant but numerically problematic high-k modes, permitting much longer time steps for explicit time stepping, in both particle and fluid codes[12].

17.2 Some discussions

The fact B ⋅∇α = 0 implies that α is constant along a magnetic field line. At first glance, a magnetic line on an irrational surface seems to sample all the points on the surface. This seems to indicate that α is a flux surface label for irrational surface. However, α must be a non-flux-surface-function so that it can provide a suitable toroidal coordinate. I had once been confused by this conflict for a long time. The key point to resolve this confusion is to realize that it is wrong to say there is only one magnetic line on an irrational surface, i.e. it is wrong to say a magnetic line on an irrational surface samples all the points on the surface. There are still infinite number of magnetic field lines that can not be connected with each other on an irrational surface. Then the fact B ⋅∇α = 0 does not imply that α must be the same on these different magnetic field lines. In fact, although B ⋅∇α = 0, the gradient of α on a flux-surface along the perpendicular (to B) direction is nonzero, i.e., B ×∇Ψ ⋅∇α0. [Proof:

B × ∇ Ψ ⋅∇α = ∇Ψ × ∇ α⋅B
               2
            = B                                 (328)
which is obviously nonzero.] This indicates that α is not constant on a flux-surface.

In (ψ,𝜃,ϕ) coordinates, ϕ is perpendicular to ψ. However, in field-line-following coordinates (ψ,𝜃,α), α is not perpendicular to ψ. Therefore α is not along the binormal direction B ×∇ψ.

17.3 Expression of α, ψ ⋅∇α, and α ⋅∇𝜃

The generalized toroidal angle α is defined by Eq. (327), i.e., α = ϕ δ, where δ = 0𝜃ˆq d𝜃. The gradient of α is then written as

∇ α = ∇ ϕ− ∇ δ
      ˆ    -       -
   =  ϕ-− ∂δ∇ ψ − ∂δ∇ 𝜃.                       (329)
      R   ∂ψ      ∂𝜃
Then
            ∂δ        ∂δ
∇ ψ ⋅∇α = − --|∇ψ |2 − --∇ ψ⋅∇ 𝜃
            ∂ψ        ∂𝜃
(330)

            -           -
∇α ⋅∇ 𝜃 = − ∂δ∇ ψ ⋅∇𝜃 − ∂δ|∇𝜃|2
           ∂ψ          ∂𝜃
(331)

Another method of computing the above quantities: Using Eqs. (236) and (237), expression (329) is written as

           -                  -
      ˆϕ-  ∂δ-R-   ˆ     ˆ   ∂-δR-   ˆ      ˆ
∇ α = R + ∂ψ 𝒥 (Z 𝜃R − R𝜃Z)− ∂ 𝜃𝒥 (ZψR − Rψ Z)
      ˆϕ   ( ∂δR      ∂δR    )    ( ∂δ R      ∂δR    )
   =  --+  -----Z𝜃 − ----Zψ  Rˆ+   ----R ψ −-----R 𝜃 ˆZ.        (332)
      R    ∂ψ 𝒥      ∂𝜃𝒥           ∂𝜃𝒥      ∂ ψ𝒥
(Note that δ∕∂ψ is discontinuous across the 𝜃 cut.) Then
         (                )  [    (  -         -    )     (  -         -    )  ]
             R-  ˆ   R-  ˆ    ϕˆ    ∂δ-R-     ∂δR-    ˆ     ∂δR-     ∂-δR-    ˆ
∇ψ ⋅∇ α =  − 𝒥 Z 𝜃R + 𝒥 R𝜃Z ⋅ R  +  ∂ψ 𝒥 Z𝜃 − ∂𝜃𝒥 Zψ  R +   ∂𝜃𝒥 R ψ − ∂ψ 𝒥 R𝜃 Z
               (  -         -    )        (  -        -     )
       = − R-Z𝜃  ∂δ-R-Z𝜃 − ∂δR-Zψ  + R-R 𝜃  ∂δR-Rψ − ∂δ-R-R𝜃  .             (333)
           𝒥     ∂ψ 𝒥      ∂𝜃𝒥       𝒥      ∂𝜃𝒥      ∂ψ 𝒥
         [    (  -         -    )     (  -         -    )   ] (               )
∇α ⋅∇ 𝜃 = ϕˆ +  ∂δ-R-Z −  ∂δR-Z   ˆR +   ∂δR-R  − ∂-δR-R   ˆZ. ⋅  R-Z Rˆ−  RR  ˆZ
          R     ∂ψ 𝒥  𝜃   ∂𝜃𝒥  ψ        ∂𝜃𝒥   ψ  ∂ψ 𝒥  𝜃        𝒥  ψ     𝒥  ψ
         (  -        -     )        ( -         -     )
       =   ∂δ-RZ 𝜃 − ∂δ-R-Zψ R-Zψ −  ∂δ-R-Rψ − ∂δ-R-R𝜃  R-Rψ.               (334)
           ∂ψ 𝒥     ∂𝜃 𝒥     𝒥       ∂𝜃 𝒥      ∂ψ 𝒥     𝒥
The figures below plot the spatial variation of some quantities.

pict pict

pict pict

 

pict pict

Fig. 14: The value of 𝜃, α and their gradients on an annulus on the poloidal plane (R,Z). Note that 𝜃 is single-valued while ∂α∕∂R and α are multi-valued and thus there is a jump near the branch cut when a single branch is chosen.


pict

pict pict

pict pict

 

Fig. 15: The same as Fig. 14, but gradients are computed in cylindrical coordinates. The results agrees with those of Fig. 14, which provides the confidence in the correctness of the numerical implementation.

 

17.4 Field-aligned coordinates in GEM[7] and GENE[13] codes

In GEM[7] and GENE[13] codes, the field-aligned coordinates (x,y,z) are defined by

x = r− r0,
(335)

     r0
y = α q-,
      0
(336)

z = 𝜃q0R0,
(337)

where r is an arbitrary flux surface label with length dimension, which is often chosen in GEM to be the minor radius of a magnetic surface in the midplane. Here r0 and R0 are constant quantities of length dimension, r0 is the minor radius of a reference magnetic surface (usually corresponding to the center of the radial simulation box), R0 is the major radius of the magnetic axis, q0 is the safety factor value on the r = r0 surface. The constant length q0R0 introduced in the definition of z is to make z approximately correspond to the length along the field line in the large-aspect ratio limit. The constant length r0∕q0 introduced in the definition of y is to make y corresponds to the arc-length in the poloidal plane traced by a field line when its usual toroidal angle increment Δϕ is α. This explanation makes y look like a poloidal coordinate whereas y is actually a toroidal coordinate.

Next, let us calculate the wave number along the y direction, ky, for a mode with toroidal wave number n. The wavelength along the y direction, λy, is given by

    2π-r0
λy = n q0.
(338)

Then the wavenumber ky is written as

     2π   nq
ky = --=  --0.
     λy   r0
(339)

On the other hand, the poloidal wavenumber k𝜃 is given by

    2π-   --2π---  m-
k𝜃 = λ 𝜃 ≈ 2πr0∕m = r0.
(340)

where m is the poloidal mode number of the mode in (ψ,𝜃,ϕ) coordinates. If the mode has the property k0, i.e., m nq0, then k𝜃 is equal to the ky. The motivation of introducing the constant length r0∕q0 in the definition of y is to make ky k𝜃 for a mode with k0.

Some authors call ky or k𝜃 by the name “binormal wavenumber”, which is not an appropriate name in my opinion. Some authors call y the binormal direction, which is also an inappropriate name since neither y nor r∕∂y is along the binormal direction B0 ×∇ψ.

17.5 Visualization of gridpoints in field aligned coordinate system

In this section, I try to visualize gridpoints in the field aligned coordinates. The directions of the covariant basis vectors of (ψ,𝜃,α) coordinates are as follows:

∂r
∂α-|ψ,𝜃 −→ usualtoroidaldirection,ϕˆ,
(341)

∂r-|ψ,α −→ (parallel or antiparallelto)field linedirection
∂𝜃
(342)

∂r|   −→ combination ofthe usualradialand toroidaldirection
∂ψ 𝜃,α
(343)

Here r∕∂ψ|𝜃,α is a combination of the usual radial and toroidal direction, which needs some clarification. Note that, ϕ is related to α by Eq. (327), i.e.,

       ∫ 𝜃B ⋅∇ ϕ
ϕ = α +   ------d𝜃 ≈ α+ q(ψ)𝜃,
        0 B ⋅∇ 𝜃
(344)

(where the second equality becomes exact if 𝜃 is the straight-field-line poloidal angle defined in Sec. 12.4.), which indicates that, for q(ψ)0 and 𝜃0, the usual toroidal angle ϕ is changing when changing ψ and holding 𝜃 and α fixed. Figure 16b shows how the usual toroidal angle ϕ changes when we change ψ and hold 𝜃 and α fixed.


pict pict

pict pict

Fig. 16: (a): A 𝜃 contour on ϕ = 0 plane. Here 𝜃 = 9×2π∕63.  This is the direction of r∕∂ψ|𝜃,ϕ. (b): ψ coordinate lines in (ψ,𝜃,α) coordinates ( r∕∂ψ|𝜃,α are the tangent lines to these curves) on the isosurface of 𝜃 = 9 × 2π∕63. Here different lines correspond to different values of α. (c): α coordinate lines (r∕∂α|ψ,𝜃 are tangent lines to these curves), which are along the usual toroidal direction ˆϕ. (d): Grid on the isosurface of 𝜃 = 9×2π∕63, where the red lines are α coordinate lines while the blue lines are ψ coordinate lines. Magnetic field from EAST discharge #59954@3.03s.

The relation ϕ α + q(ψ)𝜃 given by Eq. (344) indicates that the toroidal shift along r∕∂ψ|α,𝜃 for a radial change form ψ1 to ψ2 is given by (q(ψ2) q(ψ2))𝜃, which is larger on 𝜃 isosurface with larger value of 𝜃. An example for this is shown in Fig. 17 for 𝜃 = 19 × 2π∕63, where r∕∂ψ|α,𝜃 has larger toroidal shift than that in Fig. 16 for 𝜃 = 9 × 2π∕63.


pict pict

pict pict

Fig. 17: (a) 𝜃 = 19 × 2π∕63 contour on ϕ = 0 plane, (b) r∕∂ψ curves, (c) r∕∂α curves on isosurface of 𝜃 = 19×2π∕63. r∕∂α lines are identical with r∕∂ϕ lines. (d): Grid on the isosurface of 𝜃 = 19 × 2π∕63, which are the combinations of r∕∂ψ curves and r∕∂α curves.

 

The r∕∂ψ|𝜃,α curves can be understood from another perspective. Examine a family of magnetic field lines that start from 𝜃 = 0 and ϕ = ϕ1 but different radial coordinates. These starting points all have the same value of α, which is equal to ϕ1. When following these field lines to another isosurfce of 𝜃, the intersecting points of these field lines with the 𝜃 isosurface will trace out a r∕∂ψ|𝜃,α line with α = ϕ1. Examine another family of magnetic field lines similar to the above but with the starting toroidal angle ϕ = ϕ2. They will trace out another r∕∂ψ|𝜃,α line (with α = ϕ2) on the 𝜃 isosurface. Continue the process, we finally get those curves in Fig. 16b and Fig. 17b.

Radial wavenumber in field-aligned coordinates (ψ,𝜃,α)

For a harmonic in (ψ,𝜃,ϕ) coordinates given by A(ψ,𝜃,ϕ) = exp(ikψψ + im𝜃 + inϕ), the radial wave number is kψ. Let us calculate the corresponding radial wavenumber kψ in the new coordinates (ψ,𝜃,α), which is defined by

           |
k⋆ = ∂phase||   ,
 ψ     ∂ψ  |𝜃,α
(345)

where the phase is given by phase = kψψ + m𝜃 + . Then the above expression is written as

                     |
k ⋆=  ∂(kψ-ψ+-m-𝜃+-nϕ-)||
 ψ          ∂ψ       |𝜃,α
            ∂ϕ||
   = kψ + n ∂ψ||                                 (346)
               𝜃,α
Using  Using ϕ α + q(ψ)𝜃, the above expression is written as
k⋆ψ = kψ + nq′𝜃,                           (347)
where q= dq∕dψ. This result indicates that, compared with the radial wavenumber in coordinate system (ψ,𝜃,ϕ), the radial wavenumber in the new coordinate system (ψ,𝜃,α) has an increment n𝜃q. For nonzero magnetic shear (q0) and nonzero poloidal location (𝜃0), the increment n𝜃qcan be large for modes with toroidal mode number n 1. Then we need to use more radial grid number (compared what is needed in (ψ,𝜃,ϕ) coordinates) to resolve the radial variation. This is one of disadvantage of using field-aligned coordinates. If the saving associated with using less parallel grid number out-weights the cost associated with using more radial grid number, we obtain a net saving in using the field-aligned coordinates.

Let us examine how many ψ grid points are needed to resolve the ψ dependence in (ψ,𝜃,α) coordinates on the high-field side (𝜃 = π). Assume kψ 0, then kψ at 𝜃 = π is given by kψ = nπq. The corresponding wave-length is given by λψ = 2π∕kψ. The grid spacing Δψ should be less than half of this wave-length (sampling theorem). Then the grid number should satisfy that

 ⋆   L ψ    Lψ      ′
Nψ = Δ-ψ ≥ λ⋆∕2-= nq Lψ,
            ψ
(348)

where Lψ is the radial width of the computational domain.

The number of Fourier harmonics that need to be included is given by

        k⋆       ′
Nk ⋆ψ = --ψ---= nq-Lψ.
       2π∕Lψ     2
(349)

For DIII-D cyclone base case, choose the radial coordinate ψ as r. At the radial location ψ = r0 = 0.24m, q0 = 1.4, ŝ0 = 0.78, then q0 = s0q0∕r0 = 4.5m1. Then Nr = n× 0.45 for the radial width Lr = 0.10m.

 

Figure 18 plots r∕∂ψ|𝜃,α lines on the 𝜃 = 0,2π isosurfaces, which are chosen to be on the low-field-side midplane. On 𝜃 = 0 surface, r∕∂ψ|𝜃,α lines are identical to r∕∂ψ|𝜃,ϕ lines. On 𝜃 = 2π surface, each r∕∂ψ|𝜃,α line has large ϕ shift. In old version of my code, 𝜃 = 0,2π surfaces are chosen as the 𝜃 cuts (in the new version 𝜃 = [π,π]). A connection condition for the perturbations is needed between these two surfaces. This connection condition is discussed in Sec. 17.5.


pict pict

pict

Fig. 18: (a) 𝜃 = 0 contour (blue line) in ϕ = 0 plane; (b) a series of r∕∂ψ|𝜃,α curves (with αj = j2π∕20, j = 0,1,2,,20) on 𝜃 = 0 isosurface, (c) a single r∕∂ψ|𝜃,α curve (with α = 0) on 𝜃 = 2π isosurface. This curve finish about 4 torodial loops because (qmax qmin)2π = (5.56 1.79) × 2π 4 × 2π. The radial range is ψ = 0.2 0.9, where ψ is the normalized poloidal magnetic flux. Magnetic field from EAST discharge #59954@3.03s (gfile g059954.003030 provided by Hao BaoLong).

Periodic conditions of physical quantity along 𝜃 and α in field-line-following coordinates (ψ,𝜃,α)

Since (ψ,𝜃,ϕ) and (ψ,𝜃 + 2π,ϕ) correspond to the same spatial point, a real space continuous quantity f expressed in terms of coordinates (ψ,𝜃,ϕ), i.e., f = f(ψ,𝜃,ϕ), must satisfy the following periodic conditions along 𝜃:

f(ψ,𝜃 +2π,ϕ ) = f(ψ,𝜃,ϕ).
(350)

Since (ψ,𝜃,ϕ) and (ψ,𝜃,ϕ + 2π) correspond to the same spatial point, f must satisfy the following periodic conditions along ϕ:

f(ψ,𝜃,ϕ +2π ) = f(ψ,𝜃,ϕ).
(351)

Since (ψ,𝜃,α) and (ψ,𝜃,α + 2π) correspond to the same spatial point, a real space continuous quantity g expressed in terms of field-line-following coordinates (ψ,𝜃,α), i.e., g = g(ψ,𝜃,α), must satisfy the following periodic condition along α:

g(ψ,𝜃,α +2π ) = g(ψ,𝜃,α).
(352)

However, generally there is no periodic condition along 𝜃,

g(ψ,𝜃+ 2π,α ) ⁄= g(ψ,𝜃,α),
(353)

because P1 = (ψ,𝜃,α) and P2 = (ψ,𝜃 + 2π,α) are generally not the same spatial point. In fact, equation (327) implies, for point P1, its toroidal angle ϕ1 is given by

        ∫ 𝜃B ⋅∇ ϕ
ϕ1 = α +   B-⋅∇-𝜃d𝜃,
         0
(354)

while for point P2, its toroidal angle ϕ2 is given by

        ∫ 𝜃+2π B ⋅∇ϕ
ϕ2 = α +       ------d𝜃 = ϕ1 + 2πq,
          0    B ⋅∇𝜃
(355)

i.e., ϕ1 and ϕ2 are different by 2πq. From this, we know that (ψ,𝜃,α) and (ψ,𝜃 + 2π,α 2πq) correspond to the same spatial point. Therefore we have the following periodic condition:

g(ψ,𝜃,α) = g(ψ, 𝜃+ 2π,α− 2πq),
(356)

or equivalently

g(ψ,𝜃 + 2π,α) = g(ψ,𝜃,α+ 2πq).
(357)

Numerical implementation of periodic condition (356)

For the fully kinetic ion module of GEM code that I am developing, 𝜃 is chosen in the range [0 : 2π]. The condition (357) imposes the following boundary condition:

g(ψ,2π,α) = g(ψ,0,α + 2πq).
(358)

If α is on a grid, α + 2πq is usually not on a grid. Therefore, to get the value of g(ψ,0+ 2πq), an interpolation of the discrete date over the generalized toroidal angle α (or equivalently ϕ) is needed, as is shown in Fig. 19.

 

 


pict

Fig. 19: Twenty magnetic field lines (on ψ = 0.2 magnetic surface) starting at different toroidal angle (blue points) on the midplane (𝜃 = 0) go a full poloidal loop (i.e., Δ𝜃 = 2π), arriving at a toroidal angle (red points) which are different from their respective starting toroidal angle. The field values on the red points can be obtained by interpolating the field values on the blue points. The safety factor of the magnetic surface q = 1.79. Magnetic field from EAST discharge #59954@3.03s.

 

α contours on a magnetic surface

Figure 20 compares a small number of ϕ contours and α contours on a magnetic surface.


pict pict

Fig. 20: Comparison between a series of ϕ contours (left) and a series of α contours (right) on a magnetic surface. Here contour levels are ϕj = αj = (j 1)2π∕4(10 1) with j = 1,2,,10, i.e., only 14 of the full torus. Every ϕ and α contour start from the lower-field-side midplane and go one poloidal loop.  Magnetic field from EAST discharge #59954@3.03s.

As is shown in the left panel of Fig. 20, with ϕ fixed, an 𝜃 curve reaches its starting point when 𝜃 changes from zero to 2π. However, as shown in the right panel of Fig. 20, with α fixed, an 𝜃 curve (i.e. a magnetic field line) does not necessarily reach its starting point when 𝜃 changes from zero to 2π. There is a toroidal shift, 2πq, between the starting point and ending point. Therefore there is generally no periodic condition along 𝜃 since q is not always an integer. A mixed periodic condition involves both 𝜃 and α is given in (356).

In field-line-following coordinates (ψ,𝜃,α), a toroidal harmonic of a physical perturbation can be written as

δA (ψ,𝜃,α) = δA0(ψ)cos(m′𝜃+ nα + α0)
(359)

where n is the toroidal mode number, m, which is not necessary an integer, is introduced to describe the variation along a field line. The periodic condition given by Eq. (356) requires that

cos(m ′𝜃+ n α+ α0) = cos[m′(𝜃 + 2π)+ n(α− 2πq) +α0 ],
(360)

To satisfy the above condition, we can choose

m′2π− n2πq = N 2π,
(361)

where N is an arbitrary integer, i.e.,

  ′
m  = N + nq.
(362)

We are interested in perturbation with a slow variation along the field line direction (i.e., along r∕∂𝜃|ψ,α) and thus we want the value of mto be small. One of the possible small values given by expression (362) is to choose N = n × NINT((qmax + qmin)2), so that mis given by

                     ( q   + q   )
m ′(ψ ) = nq− n × NINT  -max---min- ,
                           2
(363)

where NINT is a function that return the nearest integer of its argument, qmax and qmin is the maximal and minimal value of the safety factor in the radial region in which we are interested. [In the past, I choose m(ψ) = nq NINT(nq). However, m(ψ) in this case is not a continuous function of ψ and thus is not physical.] This form is used to set the initial density perturbation in the fully kinetic code I am developing. Note that min Eq. (363) depends on the radial coordinate ψ through q(ψ). Also note that mhere is different from the poloidal mode number m in (ψ,𝜃,ϕ) coordinate system. It is ready to show that the perturbation given by Eq. (359) with m′∼ 1 and n 1 has large poloidal mode number m when expressed in (ψ,𝜃,ϕ) coordinates. [Proof: Expression (359) can be written as

δA = δA0 (ψ )cos[m′𝜃+ n(ϕ − δ(ψ,𝜃))+ α0]
(364)

Assume that 𝜃 is the straight-field-line poloidal angle in (ψ,𝜃,ϕ) coordinate system, then δ(ψ,𝜃) = q𝜃 and the above equation is written as

δA = δA0(ψ)cos[(m ′ − nq )𝜃 + nϕ+ α0],
(365)

which indicates the poloidal mode number m in (ψ,𝜃,ϕ) coordinates is given by m = m′−nq. For the case with m′∼ 1 and n 1, m is much larger than one.]

Since α contours on a magnetic surface are magnetic field lines, they span out the 3D shape of magnetic surface when there are many α contours on a magnetic surface, as is shown by the right-panel of Fig. 21.


pict pict

Fig. 21: Comparison between a series of ϕ contours(left) and a series of α contours (left) on a magnetic surface. The α contours correspond to magnetic field lines. Here the α values of adjacent α contours differ by = 2π∕20 and each α contour goes one full poloidal loop. Magnetic field from EAST discharge #59954@3.03s.

 

 

α contours in a toroidal annulus

Figure 22 compares the ϕ coordinate surface of (ψ,𝜃,ϕ) coordinates with the α coordinate surface of (ψ,𝜃,α) coordinates.


pict pict

Fig. 22: Comparison between isosurface of ϕ = 2π∕8 (projection of magnetic field lines onto ϕ = 2π∕8 plane) and isosurface of α = 2π∕8. The α isosurface is made of a family of contours of α = 2π∕8, which are all magnetic field lines. These field lines are traced by starting from a series of points on the low-field-side midplane (𝜃 = 0) at different radial locations and the field lines are followed by one poloidal loop. The radial range is given by ψN [0.4 : 0.5], where ψN is the normalized poloidal magnetic flux. Magnetic field from EAST discharge #59954@3.03s.

 

 


pict pict

Fig. 23: The same plot as in Fig. 22 but with a larger radial range. ψN [0.4 : 0.7], where ψN is the normalized poloidal magnetic flux.


pict pict

pict pict

 

Fig. 24: Values of 𝜃 and δ 0𝜃qˆ d𝜃 on an annulus in the poloidal plane (R,Z). Upper panel: using magnetic coordinates. Lower panel: comparison with the results computed in cylindricall coordinates. Both 𝜃 and δ are discontinuous at the 𝜃 cut, 𝜃 = ±π, which is chosen on the high-field-side.

 

 


pict

 

pict

Fig. 25: Upper pannel: 2D grid (ψ,𝜃) of resolution (27,33) for a fixed value of α. Lower pannel: 3D grid (ψ,α,𝜃) of resolution (27,4,33) for a toroidal wedge of 2π∕40. The blue lines are field lines. The 3D grid is generated by rotating the 2D grid toroidally. Only 3 field-lines are shown for both cases.

 

 

The above grid is often called “flux-tube”, since it is created by following field lines, and it looks like a tube if the field lines are very near to each other (e.g., when we choose a very narrow radial and toroidal region to start from). Since no magnetic field line passes through the sides of the tube, the flux through any cross section of the tube is equal. The term “flux tube” is often used in astrophysics.

 

17.6 Field-line-following mesh in gyrokinetic turbulence simulation codes

Most gyrokinetic simulation codes use field-line-following coordinates in constructing spatial mesh. The mesh is conceptually generated by the following three steps: (1) selecting some initial points; (2) tracing out magnetic-field-lines passing through these points; (3) choose the intersecting points of these field-lines with a series of chosen surfaces as the final grid-points. The initial points and the chosen surfaces differ among various codes and thus the resulting grid differs. Next, let us discuss some examples.

Mesh in GENE, GYRO, and GEM codes

Given the definition of (ψ,𝜃) coordinates, choose toroidally symmetrical points (can be a toroidal wedge) in 𝜃 = 0 plane (𝜃 = 0 plane is usually chosen to be the low-field-side midplane). Then trace out the magnetic-field-lines passing through these points for one poloidal circuit (usually chosen in the range 𝜃 [π,π]) and record the intersection points of these field-lines with various 𝜃 = const planes. Note that the gridpoints in 𝜃 = π plane usually do not coincide those in 𝜃 = +π plane due to the toroidal shift arising when the safety factor is irrational. Interpolation can be used to map physical variables defined on gridpoints in 𝜃 = π plane to those in 𝜃 = +π plane.

Mesh in GTC and GTS codes[28]

Given the definition of (ψ,𝜃) coordinates, 2D grid-points can be chosen on ϕ = 0 plane based on (ψ,𝜃) coordinates. Then trace out the magnetic-field-lines starting from these points for one toroidal circuit and record the intersection points of these field-lines with ϕj = jΔϕ planes, where j = 1,2,,Nt 1, Δϕ = 2π∕(Nt 1). It is obvious that the resulting mesh are not toroidally symmetrical. And also the grids on ϕ = 0 plane differ from those on ϕ = 2π plane. Interpolation can be used to mapping physical variables defined on grid-points of ϕ = 0 to those of ϕ = 2π plane. In this case, the number of “toroidal grid-points” Nt (i.e., the number of poloidal planes) is actually the number of grid-points in the parallel direction within one toroidal circuit.

Mesh in XGC1 code ***check**

XGC1 can handle the region outside of the LCFS. Here we only discuss the region inside the LCFS. At each radial gridpoint on ϕ = 0 plane, follow the magnetic field line starting form this point for one poloidal loop and record the intersection points of this field-line with ϕj = jΔϕ planes, where j = 1,2,,Nt, Δϕ = 2π∕Nt. For the case q > 1, one magnetic-field-line will have more than one intersection points on some poloidal planes. Repeat tracing the field line for each radial location. Then project (toroidally) all the intersection points on different poloidal planes to a single poloidal plane and rotate (toroidally) these 2D grids to define a 3D grid that are toroidally symmetrical.

17.7 Numerical verification of the field-aligned coordinates

The generalized toroidal angle α is numerically calculated in my code. To verify B ⋅∇α = 0 along a magnetic field-line, figure 26 plots the values of α along a magnetic field line, which indicates that α is constant. This indicates the numerical implementation of the field-aligned coordinates is correct.


pict pict

Fig. 26: Left: Projection of a field line on the poloidal plane. Right: the value of Δ and α along the magnetic field line. Here α is defined by α = ϕΔ, where ϕ is the usual cylindrical toroidal angle and Δ = 0𝜃B⋅∇-ϕ
B⋅∇ 𝜃d𝜃.

 

Binormal wavenumber

Let us introduce the binormal wavenumber, which is frequently used in presenting turbulence simulation results. Define the binormal direction s by

s = B-×-∇-Ψ-
|B × ∇ Ψ|,

which is a unit vector lying on a magnetic surface and perpendicular to B. The binormal wavenumber of a mode is defined by

kbn = s⋅∇p,
(366)

where p is the phase of the mode. Consider a mode given by exp(ikψψ + im𝜃 inζ), then the phase p = kψψ + m𝜃 . Then kbn is written as

kbn = B-×-∇-Ψ-⋅∇ (kψ ψ+ m 𝜃− nζ)
      |B × ∇ Ψ|
      B-×-∇-Ψ-
   =  |B × ∇ Ψ| ⋅∇ (m 𝜃 − n ζ),                       (367)
where the radial phase kψψ does not appear since B ×∇Ψ ⋅∇ψ = 0. The above expression can be further written as
kbn =----1--- [mB  × ∇Ψ ⋅∇ 𝜃− nB × ∇Ψ ⋅∇ ζ]
     |B × ∇Ψ |
     ----1---
   = |B × ∇Ψ |[mB  ⋅∇Ψ × ∇ 𝜃− nB ⋅∇Ψ × ∇ ζ]
        nB⋅   [m                   ]
   = |B-×-∇Ψ-| n-∇Ψ × ∇ 𝜃− ∇ Ψ × ∇ ζ .                  (368)
Equation (368) is the general expression of the binormal wavenumber. On the resonant surface of the mode, i.e., q(ψ) = m∕n, then the above expression is written as
       nB ⋅
kbn = |B-×∇-Ψ|[q∇Ψ × ∇𝜃 − ∇Ψ × ∇ ζ].
(369)

Using Eq. (289), i.e., B = (ζ ×∇Ψ + qΨ ×∇𝜃), the above expression is written as

       − nB⋅
kbn = |B-×-∇-Ψ|B

   = − n-B---
        |∇Ψ |
Using Bp = |∇Ψ|∕R, the above equation is written
kbn = − n-B--
        RBp
(370)

which indicates the binormal wavenumber generally depends on the poloidal angle. For large aspect-ratio tokamak, we have Bϕ B, q Bϕr∕(BpR). Then Eq. (370) is written

       nq
kbn ≈ − --,
       r
(371)

which indicates the binormal wavenumber are approximately independent of the poloidal angle. Since m = nq on a resonant surface, the above equation is written |kbn|≈ m∕r, which is the usual poloidal wave number. Due to this relation, the binormal wavenumber kbn is often called the poloidal wavenumber and denoted by k𝜃 in papers on tokamak turbulence. In the GENE code, y coordinate is defined by y = αr0∕q0. Then the ky of a mode of toroidal mode number n is given by ky = 2π∕λy where λy = λαr0∕q0 and λα = 2π∕n. Then ky is written as ky = nq0∕r0, which is similar to the binormal defined above. For this reason, ky of GENE code is also called binormal wave-vector, which is in fact not reasonable because neither r∕∂y or y is along the binormal direction.

 

18 Concentric-circular magnetic configuration with a given safety factor profile

Assume magnetic surfaces of a magnetic configuration are known and given by

R (r,𝜃) = R0 + rcos𝜃,
(372)

Z(r,𝜃) = rsin 𝜃,
(373)

where (r,𝜃) are two parameters and r is magnetic surface label (i.e., ∂Ψ∕∂𝜃|r = 0). The above parametric equations specify a series of concentric-circular magnetic surfaces.

Assume the toroidal field function g(r) = RBϕ is given. Then the toroidal magnetic field is determined by Bϕ = g∕R. Further assume the safety factor profile q(r) is given, then the magnetic field is fully determined. Next, let us derive the explicit form of the poloidal magnetic field Bp, which is given by

                1--
Bp = ∇ Ψ × ∇ ϕ = 2π∇ Ψp × ∇ ϕ,
(374)

which involves the poloidal magnetic flux Ψp. Therefore our task is to express Ψp in terms of q and g. Using q(r) = t∕dΨp, we obtain

p = 1
qt,

Integrate the above equation over r, we obtain

∫ r      ∫ r1
   dΨp =    -dΨt,
 0        0 q
(375)

which an be written as

              ∫ r 1   (∫ r∫ π        )
Ψp(r)− Ψp(0) =    ----d        Bϕrdrd𝜃  ,
               0 q(r)   0  − π
(376)

where use has been made of Ψt = 0r ππBϕrdrd𝜃. Using Bϕ = g∕R and R = R0 + r cos𝜃, the above equation is written

              ∫       ( ∫  ∫                 )
                r -1--    r  π ----g-----
Ψp (r)− Ψp(0) = 0  q(r)d   0  −π R0 + r cos𝜃 rdrd𝜃
(377)

Using maxima (an open-source computer algebra system), the above integration over 𝜃 can be performed analytically, giving

∫ π     1            2π
    ----------d𝜃 = ∘--2---2.
 −π R0 + r cos𝜃      R 0 − r
(378)

Using this, equation (377) is written as

                      (              )
              ∫ r 1    ∫ r   2πgr
Ψp(r)− Ψp(0) =    q(r)d      ∘--2---2dr  ,
               0        0   R 0 − r
(379)

which can be simplified as

              ∫ r 1    2πgr
Ψp(r) − Ψp(0) =    q(r)-∘--2---2dr.
               0       R0 − r
(380)

This is what we want—the expression of the poloidal magnetic flux in terms of q and g. [Another way of obtaining Eq. (380) is to use Eq. (187), i.e.,

dΨ     g ∫ 2π 𝒥
--p= − -     -2d𝜃,
dr     q  0  R
(381)

where 𝒥 is the Jacobian of the (r,𝜃,ϕ) coordinates and is given by 𝒥 = R(R𝜃Zr RrZ𝜃) = Rr. Then Eq. (381) is simplified as

       ∫ 2π        ∫ 2π
dΨp-= g     rd𝜃 = g     ----r-----d𝜃 = g r∘-2π---,
dr    q 0   R     q  0  R0 + r cos𝜃    q    R20 − r2
(382)

which, after being integrated over r, gives Eq. (380).]

Using Eq. (380), the poloidal magnetic field in Eq. (374) is written as

                (                  )
      ∇r×-∇-ϕ-∂-- ∫ r-1----2πgr---
Bp =    2π    ∂r   0 q(r) ∘R2-−-r2dr
                            0
   = ∇r × ∇ ϕ-1--∘--gr---.                            (383)
             q(r)  R20 − r2
[Using the formulas r = R𝒥-(Z𝜃RˆR𝜃ˆZ) and 𝒥 = R(R𝜃Zr RrZ𝜃), where 𝒥 is the Jacobian of the (r,𝜃,ϕ) coordinates, we obtain 𝒥 = Rr and r = cos𝜃Rˆ + sin𝜃ˆZ, ϕ = ˆϕ∕R. Then Eq. (383) is written as
     cos𝜃ˆZ-−-sin-𝜃ˆR -1-----gr---
Bp =       R       q(r)∘R2--−-r2
                          0
(384)

This is the explicit form of the poloidal magnetic field in terms of g and q. The magnitude of Bp is written as

          1       1     gr
Bp = ----------------∘--2---2-
     (R0 + rcos𝜃)q(r)  R 0 − r
(385)

Note that both Bp and Bϕ depend on the poloidal angle 𝜃.]

I use Eq. (380) to compute the 2D data of Ψ (Ψ = Ψp2π) on the poloidal plane when creating a numerical G-eqdsk file for the above magnetic configuration (Fortran code is at /home/yj/project_new/circular_configuration_with_q_given).

Assume that the poloidal plasma current is zero, then g(r) = RBϕ is a constant independent of r. This is always assumed by the authors who use concentric-circular configuration but is seldom explicitly mentioned.

In analytical work, 1∕R dependence on (r,𝜃) is often approximated as

1
--
R =     1
----------
R0 + r cos𝜃 =  1
---
R0    1
---------
1+ 𝜀 cos𝜃  1
---
R0(1 𝜀cos𝜃),

where 𝜀 = r∕R0 is the local inverse aspect ratio.

18.1 Is the above B divergence-free?

Since the above field is derived from the general form given by Eq. (10), it is guaranteed that the field is divergence-free. In case of any doubt, let us directly verify this. Write B as

B = B (1)𝒥∇ 𝜃× ∇ ϕ+ B (2)𝒥∇ ϕ× ∇r + B (3)𝒥∇r × ∇ 𝜃,
(386)

where 𝒥 is the Jacobian of (r,𝜃,ϕ) coordinates; B(1), B(2), and B(3) are given by

B(1) = B ⋅∇r
(387)

B(2) = B ⋅∇𝜃
(388)

 (3)
B   = B ⋅∇ϕ
(389)

Use Bp given by (383), then B(1), B(2), and B(3) are written as

B(1) = 0,
(390)

B (2) = − 1-1--∘--g0r--,
        𝒥 q(r)  R20 − r2
(391)

and

      B
B(3) =--ϕ,
       R
(392)

respectively. Then, by using the divergence formula in (r,𝜃,ϕ) coordinates, ∇⋅ B is written as

         (                          )
∇ ⋅B = 1-  ∂B-(1)𝒥-+ ∂B-(2)𝒥-+ ∂B-(3)𝒥-
       𝒥     ∂r       ∂𝜃       ∂ϕ
       1 (    ∂B (2)𝒥    )
     = 𝒥-  0+ --∂𝜃---+ 0
            (              )
     = 1--∂- − -1--∘--g0r----
       𝒥 ∂𝜃    q(r)  R20 − r2
     = 0                                              (393)
i.e., B in this case is indeed divergence-free.

18.2 Is the above B a solution to the GS equation?

The answer is no. It is ready to verify that the poloidal magnetic flux function Ψ = Ψp2π given by Eq. (380) is not a solution to the GS equation (621) even if the plasma pressure in the GS equation is set to zero. The above expression is a solution to the GS equation in the limit of infinite aspect ratio and zero plasma pressure. The finite aspect ratio and plasma pressure requires the magnetic surfaces to have the Shafranov shift in order to satisfy the GS equation (see Sec. A.17).

18.3 Explicit expression for the generalized toroidal angle

For the above magnetic field, the toroidal shift involved in the definition of the generalized toroidal angle can be expressed in simple analytical form. The toroidal shift is given by

-  ∫ 𝜃
δ = 0 ˆqd𝜃,
(394)

where the local safety factor qˆ can be written as

      g 𝒥
ˆq = −--02--′.
     R  Ψ
(395)

Using 𝒥 = Rr and

 ′   -1----g0r----
Ψ  = q(r) ∘R2-−-r2
            0
(396)

The local safety factor ˆq in Eq. (395) is written as

    ∘ --2---2 1
ˆq = q R 0 − r R .
(397)

Using this, expression (394) is written

-   ∘ -------∫ 𝜃1
δ = q R20 − r2    --d𝜃
              0 R
(398)

Assume 𝜃 (π,π), then the integration 0𝜃1∕Rd𝜃 can be analytically performed (using maxima), yielding

                 (             )
                  ---sin𝜃(R0−r)--
∫ 𝜃 1     2arctan  (cos𝜃+1)√R20−r2
   R-d𝜃 = -------∘R2--− r2-------.
 0                  0
(399)

Then expression (398) is written

-          (             (  ))
δ = 2q arctan ∘(R02−-r)-tan  𝜃    ,
               R0 − r2    2
(400)

where use has been made of sin𝜃∕(cos𝜃 + 1) = tan(𝜃∕2). Using this, the generalized toroidal angle can be written as

       -
α = ϕ− δ       (                 )
                 (R0 − r)    (𝜃)
  = ϕ− 2qarctan  ∘R2-−-r2-tan  2    .                 (401)
                    0
The results given by the formula (400) are compared with the results from my code that assumes a general numerical configuration. The results from the two methods agree with each other, as is shown in Fig. 27, which provides confidence in both the analytical formula and the numerical code.

pict

Fig. 27: The results of δ = 0𝜃qˆ d𝜃 computed by using formula (400) and the numerical code agree with each other. The different lines correspond to values of δ on different magnetic surfaces. In the numerical code, two kinds of poloidal angles can be selected: one is the equal-volume poloidal angle, and another is the equal-arch-length angle. Make sure that the latter is selected when doing the comparison because the the poloidal angle 𝜃 appearing in the analytical formula is the equal-arc-length poloidal angle.

In passing, we note that the straight-field-line poloidal angle 𝜃f can also be considered to be defined by

α = ϕ − q𝜃f,
(402)

i.,e,

               -
     1         δ
𝜃f = q(ϕ − α ) = q.
(403)

Then using Eq. (401), 𝜃f is written as

           (                 )
              (R0 − r)    (𝜃 )
𝜃f = 2 arctan ∘--2---2-tan  2    ,
               R0 − r
(404)

which agrees with Eq. (A2) in Gorler’s paper[13].

18.4 Metric elements

Let ψ = r and define hψR = ψ Rˆ, hαR = αˆR, etc. Explicit expressions for these elements can be written as

hψR = ∇ψ ⋅ ˆR
    = ∇r ⋅ ˆR
       R-   ˆ      ˆ  ˆ
    = −𝒥 (Z𝜃R − R 𝜃Z )⋅R
       R
    = −𝒥-Z 𝜃
    = cos 𝜃                                     (405)
hψZ = ∇ψ ⋅ ˆZ
          ˆ
    = ∇r ⋅Z
    = − R(Z𝜃Rˆ− R 𝜃ˆZ)⋅ ˆZ
        𝒥
    = R-R𝜃
      𝒥
    = sin𝜃
 ψϕ       ˆ
h   = ∇ψ ⋅ϕ
    = 0
h𝜃R = ∇ 𝜃⋅ ˆR
    = R-(ZψRˆ− R ψˆZ)⋅Rˆ
      𝒥
    = R-Z
      𝒥  ψ
        1
    = − r sin 𝜃
h 𝜃Z = ∇ 𝜃⋅ ˆZ
      R-    ˆ     ˆ   ˆ
    = 𝒥 (ZψR − R ψZ)⋅Z
        R-
    = − 𝒥 Rψ
      1
    = r cos𝜃
h𝜃ϕ = ∇𝜃 ⋅ ˆϕ

    = 0
h αR = ∇ α ⋅ ˆR
      [ ˆ   (  -        -     )    (  -         -     )  ]
    =   ϕ-+  -∂δR-Z𝜃 − ∂δR-Zψ  Rˆ+   ∂δ-RR ψ − ∂δR-R 𝜃 ˆZ  ⋅ ˆR
        R    ∂ψ 𝒥      ∂𝜃𝒥           ∂𝜃𝒥       ∂ψ𝒥
       ∂δ R     ∂δ R
    =  ∂ψ𝒥-Z 𝜃 − ∂𝜃-𝒥 Z ψ
        -           -
    =  ∂δ-Rr cos𝜃 − ∂δ-R sin𝜃
       ∂ψ𝒥         ∂𝜃𝒥
        ∂δ-      ∂-δ1
    = − ∂ψ cos𝜃+ ∂ 𝜃r sin𝜃
        ∂δ        1
    = − ---cos 𝜃+ ˆq-sin𝜃
        ∂r        r
hαZ = ∇[ α ⋅ ˆZ                                           ]
       ˆϕ   ( ∂δR      ∂δ R   )    ( ∂δ R      ∂δ R   )
   =   R-+  ∂-ψ𝒥-Z 𝜃 − ∂𝜃𝒥-Z ψ ˆR +  ∂𝜃-𝒥-Rψ − ∂ψ-𝒥 R 𝜃 Zˆ ⋅ ˆZ
       -         -
      ∂δR-     ∂-δR-
   =  ∂𝜃𝒥 R ψ − ∂ψ 𝒥 R𝜃
        1       ∂δ
   = − ˆq- cos𝜃 − ---sin𝜃
        r       ∂r
      1
hαϕ = R-.
(406)

Using expression (400), dδ∕dr can be evaluated analytically, yielding

 -            (             ( ) )                            (  )    [        ]
dδ = 2dqarctan  (∘R0-−-r)-tan  𝜃    + 2q---(-----1-------)--tan  𝜃  -d  (∘R0-−-r)-
dr    dr          R20 − r2    2             (√R0−r)-  ( 𝜃) 2     2  dr    R20 − r2
                                      1+    R20−r2 tan 2
              (             ( ) )
   = 2dqarctan  (∘R0-−-r)-tan  𝜃
      dr          R20 − r2    2
                1             ( 𝜃)       − R0
   + 2q---(----------(--))2-tan  2  (R--+r)∘R2--−-r2
       1+   (√RR02−−rr)2 tan 𝜃2             0       0
              0
where use has been made of
d
---
dxarctan(x) =   1
----2-
1+ x

(I did not remember this formula and I use SymPy to obtain this.) These expressions are used to benchmark the numerical code that assume general flux surface shapes. The results show that the code gives correct result when concentric circular flux surfaces are used.

 

Taking the 𝜃 derivative of δ, equation (400) is written as (using Sympy)

∂δ      ( tan2(𝜃)   1)       1
--=  2qA   -----2-+  -  -2---2(𝜃)----
∂𝜃           2      2  A tan  2  + 1
(407)

where

A = ∘(R0-− r)
      R20 − r2
(408)

Equation (397) should be equal to qˆ given by Eq. (397). This was verified numerically.

 

Taking the r derivative of Eq. (380), we obtain

dΨp=  -1-∘-2πg0r--
dr    q(r)  R20 − r2
(409)

i.e.,

dΨ-= -1--∘--g0r---.
dr   q(r)  R20 − r2
(410)

dψ-=  ----1------1--∘--g0r--.
 dr   Ψ(a)− Ψ(0)q(r)  R20 − r2
(411)

 

 


pict pict

 

Fig. 28: δ∕∂𝜃 and δ∕∂ψ. Numerical and analytical results are plotted, which are so close to each other that they can not be distinguished by eyes. δ∕∂𝜃 is equal to the local safety factor ˆq. Note that δ∕∂ψ is discontinuous at the 𝜃 cut, which in this case is on the high-field-side.

18.5 Safety factor profile

The magnetic shear for a concentric-circular configuration is defined by

ˆs = dq r,
   dr q
(412)

where r is the minor radius of a magnetic surface. The above expression can be re-arranged as

 dr   dq
ˆsr =  q
(413)

Integrating the above equation over r and assuming ŝ is a constant, we obtain

 ∫       ∫
   r dr    r dq
ˆs r0 r =  r0 q ,
(414)

Performing the integration, the above equation is written as

ˆs(ln r− ln r ) = ln q− ln q ,
          0           0
(415)

where q0 = q(r0). Equation (415) can be finally written as

     ( r )ˆs
q = q0 r-  .
        0
(416)

This is a profile with a constant magnetic shear s. In Ben’s toroidal ITG simulation, the following q profile is used:

q = q0 + (r − r0)q′(r0),
(417)

with q(r0) = ŝq0∕r0. This is a linear profile over r, with the values of q and the shear at r = r0 being q0 and ŝ, respectively.

19 Fixed boundary tokamak equilibrium problem

The fixed boundary equilibrium problem (also called the “inverse equilibrium problem” by some authors) refers to the case where the shape of a boundary magnetic surface is given and one is asked to solve the equilibrium within this magnetic surface. To make it convenient to deal with the shape of the boundary, one usually uses a general coordinates system which has one coordinate surface coinciding with the given magnetic surface. This makes it trivial to deal with the irregular boundary. To obtain the equilibrium, one needs to solve the GS equation in the general coordinate system.

19.1 Toroidal elliptic operator in general coordinates

Next we derive the form of the GS equation in a general coordinate system. The main task is to derive the form of the toroidal elliptic operator in the general coordinate system. The toroidal elliptic operator takes the form

            (  1   )
△ ∗Ψ ≡ R2∇ ⋅  -2∇ Ψ
              R
(418)

For an arbitrary general coordinate system (ψ,𝜃,ϕ) (the (ψ,𝜃,ϕ) coordinate system here is an arbitrary general coordinate system except that ϕ is perpendicular to both ψ and 𝜃), the toroidal elliptic operator is written

        2 {[          ]    [         ]   [              ]   [           ]  }
△ ⋆Ψ = R--  Ψ ψ 𝒥2|∇ ψ|2  +  Ψ𝜃 𝒥2-|∇ 𝜃|2 +  Ψψ 𝒥2(∇ ψ⋅∇ 𝜃)  +  Ψ𝜃 𝒥-2∇𝜃 ⋅∇ψ   ,
       𝒥       R       ψ      R       𝜃      R           𝜃     R         ψ
(419)

where the subscripts denotes partial derivatives, 𝒥 is the Jacobian of the coordinate system (ψ,𝜃,ϕ). [Next, we provide the proof of Eq. (419). The gradient of Ψ is written as (note that Ψ is independent of ϕ)

∇ Ψ = ∂Ψ∇ ψ + ∂Ψ-∇𝜃
      ∂ψ      ∂𝜃
(420)

Using this expression and the divergence formula (137), the elliptic operator in Eq. (418) is written

            (                   )
△ ∗Ψ = R2 ∇ ⋅ -1-∂Ψ-∇ψ + -1-∂Ψ-∇𝜃
             R2 ∂ψ      R2 ∂𝜃
        2 1-∂-(  -1-∂Ψ-           -1-∂Ψ-      )
    = R  𝒥 ∂ψ  𝒥 R2 ∂ψ ∇ψ ⋅∇ ψ+ 𝒥 R2 ∂𝜃 ∇𝜃 ⋅∇ ψ
         1 ∂  (   1 ∂Ψ            1 ∂Ψ       )
    + R2 ----- 𝒥 -2---∇ ψ ⋅∇𝜃 +𝒥 --2---∇𝜃 ⋅∇𝜃
         𝒥[ ∂(𝜃    R  ∂ψ)    (     R  ∂𝜃  )    (            )    (         ) ]
       R2-    -𝒥-    2        -𝒥-                𝒥--              -𝒥-   2
    =  𝒥    ΨψR2 |∇ψ|  ψ +  Ψ𝜃R2 ∇ ψ⋅∇ 𝜃 ψ +  Ψψ R2∇ ψ⋅∇ 𝜃 𝜃 +  Ψ𝜃R2 |∇ 𝜃| (𝜃42,1)
which is Eq. (419).]

Using Eq. (419), the GS equation (53) is written

   [(          )    (          )   (            )    (             ) ]
R2-     𝒥--   2         𝒥--   2        𝒥--               -𝒥-                 2 dP- dg-
𝒥    Ψ ψR2|∇ ψ|  ψ +  Ψ𝜃R2|∇𝜃|  𝜃 +  Ψ𝜃R2 ∇ψ ⋅∇𝜃  ψ +  ΨψR2 ∇ψ ⋅∇ 𝜃 𝜃 =  − μ0R dΨ− dΨ g,
(422)

which is the form of the GS equation in (ψ,𝜃,ϕ) coordinate system.

19.2 Finite difference form of toroidal elliptic operator in general coordinate system

The toroidal elliptic operator in Eq. (419) can be written

  ∗    R2-  ψψ         𝜃𝜃        ψ𝜃        ψ𝜃
△  Ψ = 𝒥  [(h  Ψψ)ψ + (h  Ψ𝜃)𝜃 + (h Ψ𝜃)ψ + (h Ψψ)𝜃],
(423)

where h is defined by Eq. (178), i.e.,

hαβ = 𝒥-∇ α⋅∇ β.
      R2
(424)

Next, we derive the finite difference form of the toroidal elliptic operator. The finite difference form of the term (hψψΨψ)ψ is written

  ψψ          1 [ ψψ    ( Ψi,j+1 − Ψi,j)    ψψ   ( Ψi,j − Ψi,j−1) ]
(h  Ψψ)ψ|i,j = δψ hi,j+1∕2  ----δψ------ − hi,j− 1∕2  ----δψ-----
               ψψ                   ψψ
           = H i,j+1∕2(Ψi,j+1 − Ψi,j)− H i,j− 1∕2(Ψi,j − Ψi,j−1),          (425)
where
 ψψ   -hψψ-
H   = (δψ)2.
(426)

The finite difference form of (h𝜃𝜃Ψ𝜃)𝜃 is written

              [       (           )          (           )]
(h𝜃𝜃Ψ ) |  = 1- h 𝜃𝜃      Ψi+1,j −-Ψi,j − h𝜃𝜃     Ψi,j-−-Ψi−1,j
    𝜃 𝜃i,j   δ𝜃   i+1∕2,j      δ𝜃         i−1∕2,j      δ𝜃
          = H 𝜃𝜃    (Ψi+1,j − Ψi,j)− H𝜃𝜃    (Ψi,j − Ψi−1,j),             (427)
             i+1∕2,j               i−1∕2,j
where
       h𝜃𝜃
H 𝜃𝜃 =----2.
      (δ𝜃)
(428)

The finite difference form of (hψ𝜃Ψ𝜃)ψ is written as

                [       (                    )         (                    )]
(Ψ hψ𝜃) ||  = -1- hψ𝜃     Ψi+1,j+1∕2 −-Ψi−1,j+1∕2 − hψ𝜃      Ψi+1,j−-1∕2 −-Ψi−1,j−1∕2  .
  𝜃    ψ i,j  δψ   i,j+1∕2          2δ𝜃             i,j−1∕2          2δ𝜃
(429)

Approximating the value of Ψ at the grid centers by the average of the value of Ψ at the neighbor grid points, Eq. (429) is written as

(Ψ𝜃hψ𝜃)ψ|i,j = H ψ𝜃  (Ψi+1,j+Ψi+1,j+1− Ψi−1,j− Ψi−1,j+1)− H ψ𝜃  (Ψi+1,j− 1+ Ψi+1,j− Ψi−1,j−1− Ψi− 1,j).
              i,j+1∕2                                 i,j−1∕2
(430)

where

  ψ𝜃   -hψ𝜃--
H    = 4δψd𝜃.
(431)

Similarly, the finite difference form of (hψ𝜃Ψψ)𝜃 is written as

               [       (                    )         (                    )]
(Ψ hψ𝜃)|  =  1- hψ𝜃     Ψi+1∕2,j+1 −-Ψi+1∕2,j−1 − hψ𝜃      Ψi−-1∕2,j+1 −-Ψi−1∕2,j−1
  ψ    𝜃i,j   δ𝜃   i+1∕2,j         2δψ             i−1∕2,j          2δψ
          = H ψ𝜃   (Ψi+1,j+1 + Ψi,j+1 − Ψi+1,j−1 − Ψi,j−1) − H ψ𝜃 (Ψi,j+1 + Ψi−1,j+1 − Ψi,j−1 − Ψi− 1,(j−4312).)
              i+1∕2,j                                    i−1∕2,j
Using the above results, the finite difference form of the operator 𝒥△Ψ∕R2 is written as
 𝒥     ||
R2-△∗Ψ ||  = (h ψ𝜃Ψ 𝜃)ψ + (h ψψΨψ)ψ + (h𝜃𝜃Ψ𝜃)𝜃 + (h ψ𝜃Ψ ψ)𝜃
       i,j
          = Hψiψ,j+1∕2(Ψi,j+1 − Ψi,j) − Hψiψ,j−1∕2(Ψi,j − Ψi,j−1)
          + H𝜃𝜃    (Ψ     − Ψ ) − H𝜃𝜃   (Ψ   − Ψ   )
             i+1∕2,j i+1,j    i,j    i−1∕2,j i,j    i−1,j
          + Hψi𝜃,j+1∕2(Ψi+1,j + Ψi+1,j+1 − Ψi− 1,j − Ψi−1,j+1)− Hiψ,j𝜃−1∕2(Ψi+1,j−1 + Ψi+1,j − Ψi− 1,j−1 − Ψi−1,j)
             ψ𝜃                                        ψ𝜃
          + Hi+1∕2,j(Ψi+1,j+1 +Ψi,j+1 − Ψi+1,j− 1 − Ψi,j−1)− Hi−1∕2,j(Ψi,j+1 + Ψi− 1,j+1 − Ψi− 1,j−1 − Ψi,j−1)
          = Ψi,j(− Hiψ,jψ+1∕2 − H ψi,ψj− 1∕2 − H 𝜃i+𝜃1∕2,j − H 𝜃i𝜃−1∕2,j)
                     ψ𝜃       ψ𝜃              ψψ       ψ𝜃       ψ𝜃
          + Ψi− 1,j−1(H i,j−1∕2 +H i−1∕2,j) +Ψi,j−1(H i,j− 1∕2 − H i+1∕2,j +H i−1∕2,j)
          + Ψi+1,j− 1(− H ψ𝜃   − H ψ𝜃   )+ Ψi−1,j(H𝜃i𝜃−1∕2,j − Hψ 𝜃  + H ψ𝜃   )
                   𝜃𝜃 i,j−1∕2ψ𝜃  i+1∕2,jψ𝜃                 iψ,j𝜃+1∕2   i,jψ−𝜃1∕2
          + Ψi+1,j(H i+1∕2,j + Hi,j+1∕2 − Hi,j−1∕2)+ Ψi− 1,j+1(− Hi,j+1∕2 − Hi−1∕2,j)
          + Ψ    (H ψψ    + Hψ𝜃    − Hψ𝜃    )+ Ψ     (H ψ𝜃   + H ψ𝜃   )
             i,j+1  i,j+1∕2    i+1∕2,j   i−1∕2,j    i+1,j+1   i,j+1∕2    i+1∕2,j
The coefficients are given by
       𝒥         1
hψψ = --2|∇ ψ|2 =--(R2𝜃 + Z2𝜃),
      R         𝒥
(433)

h𝜃𝜃 = 𝒥2|∇ 𝜃|2 = 1(R2ψ + Z2ψ ),
      R         𝒥
(434)

and

 ψ𝜃   𝒥--          -1
h   = R2∇ ψ ⋅∇𝜃 = −𝒥 (R𝜃R ψ + Z 𝜃Z ψ),
(435)

where the Jacobian

𝒥 = R (R 𝜃Zψ − R ψZ𝜃).
(436)

The partial derivatives, R𝜃, Rψ, Z𝜃, and Zψ, appearing in Eqs. (433)-(436) are calculated by using the central difference scheme. The values of hψψ, h𝜃𝜃, hψ𝜃 and 𝒥 at the middle points are approximated by the linear average of their values at the neighbor grid points.

19.3 Special treatment at coordinate origin, wrong! to be deleted

Ψ ≈ a00 + a10R + a01Z + a11RZ + a20R2 + a02Z2.
(437)

           ∘ --
R = R0 + b11 ψ cos𝜃
(438)

            --
Z = Z0 + c11∘ ψ sin 𝜃
(439)

            (       ∘ --   )        ∘ --        (       ∘ --    )  ∘ --         (       ∘ --   )2      (  ∘ --   )2
Ψ ≈ a00 + a10  R0 + b11 ψcos𝜃  + a01c11  ψsin 𝜃+ a11 R0 + b11  ψ cos𝜃 c11 ψ sin 𝜃+ a20 R0 + b11  ψ cos𝜃   + a02 c11  ψ sin𝜃
                     ∘ --           ∘ --             ∘--            ∘ --  ∘ --                                       ∘ --
  = a00 + a10R0 + a10b11  ψcos𝜃 + a01c11  ψsin 𝜃+ a11R0c11 ψ sin 𝜃+ 1a11b11 ψc11  ψ sin2𝜃 +2a20R20 + a20(b11)2ψ cos2𝜃 + 2a20R0b11 ψ cos𝜃 + a02(c11)2ψ sin2𝜃
          ∘ --       ∘ --                                     2
  = d0 + d1 ψcos𝜃+ d2  ψ sin𝜃 + d3ψsin 2𝜃+ d4ψ cos2𝜃 + d5ψ sin2 𝜃
Ψ = d0 + d1∘ --
  ψcos𝜃 + d2∘ --
  ψsin𝜃

R = R  +b11∘ ψcos𝜃 + b12∘ ψ-cos2𝜃 + b21( ∘ψ-)2cos𝜃+ b22(∘ ψ)2 cos2𝜃
     0
(440)

          11∘ --       12∘ --       21(∘ --)2       22 (∘ -)2
Z = Z0 + c   ψ sin𝜃 + c   ψ sin2𝜃 + c    ψ   sin 𝜃+ c     ψ  sin2𝜃
(441)

19.4 Pressure and toroidal field function profile

The function p(Ψ) and g(Ψ) in the GS equation are free functions which must be specified by users before solving the GS equation. Next, we discuss one way to specify the free functions. Following Ref. [16],  we take P(Ψ) and g(Ψ) to be of the forms

                     --
P(Ψ) = P0 − (P0 − Pb)ˆp(Ψ),
(442)

1 2     1  2      --
2g (Ψ) = 2 g0(1 − γ ˆg(Ψ )),
(443)

with ˆp and ĝ chosen to be of polynomial form:

ˆp(Ψ) = Ψ-α,
(444)

  --  --β
ˆg(Ψ) = Ψ ,
(445)

where

Ψ-≡ Ψ-−-Ψa-,
    Ψb − Ψa
(446)

with Ψb the value of Ψ on the boundary, Ψa the value of Ψ on the magnetic axis, α, β, γ, P0, Pb, and g0 are free parameters. Using the profiles of P and g given by Eqs. (442) and (443), we obtain

                     --
dP-(Ψ-)= − 1-(P0 − Pb)αΨα−1
  dΨ      Δ
(447)

where Δ = Ψb Ψa, and

  dg     1   1  -β−1
g ---= − -g20γ--βΨ   .
  dΨ     2   Δ
(448)

Then the term on the r.h.s (nonlinear source term) of the GS equation is written

                      [            --  ]          --
− μ0R2dP- − dgg = μ0R2  1-(P0 − Pb)α Ψα−1 +  1g20γ 1-βΨβ−1.
       dΨ   dΨ          Δ                  2   Δ
(449)

The value of parameters P0, Pb, and g0 in Eqs. (442) and (443), and the value of α and β in Eqs. (444) and (445) can be chosen arbitrarily. The parameter γ is used to set the value of the total toroidal current. The toroidal current density is given by Eq. (579), i.e.,

J  = RdP- + 1-dg-g-,
 ϕ    dΨ    μ0dΨ R
(450)

which can be integrated over the poloidal cross section within the boundary magnetic surface to give the total toroidal current,

    ∫
I =    J dS
 ϕ      ϕ
    ∫  (  dP-  1--dgg-)
  =     R dΨ + μ0dΨ R   dRdZ
    ∫  [ (   1)           --    1  1   1   --]
  =     R  −--  (P0 − Pb)ˆp′(Ψ) −-----g20γ--ˆg′(Ψ)  dRdZ          (451)
            Δ                  μ0R 2   Δ
Using
       -1
dRdZ = R 𝒥 dψd𝜃,
(452)

Eq. (451) is written as

      [(    )                               ]
    ∫     -1           ′--   -1--1  2 1- ′--
Iϕ =      −Δ   (P0 − Pb)ˆp(Ψ)− μ0R22 g0γ Δ ˆg(Ψ) 𝒥 dψd𝜃,
(453)

from which we solve for γ, giving

    − ΔIϕ − (P0 − Pb)∫[pˆ′(Ψ)]𝒥 dψd𝜃
γ = -----1-2-∫ [-1-′--]---------.
        2μ0g0   R2ˆg (Ψ) 𝒥dψd 𝜃
(454)

If the total toroidal current Iϕ is given, Eq. (454) can be used to determine the value of γ.

19.5 Boundary magnetic surface and initial coordinates

In the fixed boundary equilibrium problem, the shape of the boundary magnetic surface (it is also the boundary of the computational region) is given while the shape of the inner flux surface is to be solved. A simple analytical expression for a D-shaped magnetic surface takes the form

R = R0 + acos(𝜃 +Δ sin𝜃),
(455)

Z = κa sin𝜃,
(456)

with 𝜃 changing from 0 to 2π. According to the definition in Eqs. (521), (522), and (524) we can readily verify that the parameters a, R0, κ appearing in Eqs. (455) and (456) are indeed the minor radius, major radius, and ellipticity, respectively. According to the definition of triangularity Eq. (523), the triangularity δ for the magnetic surface defined by Eqs. (455) and (456) is written as

δ = sin Δ.
(457)

Another common expression for the shape of a magnetic surface was given by Miller[822], which is written as

R = R0 + acos[𝜃+ arcsin(Δ sin𝜃)],
(458)

Z = κa sin𝜃.
(459)

Note that Miller’s formula is only slightly different from the formula (455). For Miller’s formula, it is easy to prove that the triangularity δ is equal to Δ (instead of δ = sinΔ as given in Eq. (457)).

In the iterative metric method[11] for solving the fixed boundary equilibrium problem, we need to provide an initial guess of the shape of the inner flux surface (this initial guess is used to construct a initial generalized coordinates system). A common guess of the inner flux surfaces is given by

R = ψα(RLCFS − R0)+ R0,
(460)

Z = ψαZLCFS,
(461)

where α is a parameter, ψ is a label parameter of flux surface. If the shape of the LCFS is given by Eqs. (455) and (456), then Eqs. (460) and (461) are written as

R = R0 + ψ αacos(𝜃 + Δ sin𝜃),
(462)

Z = ψaκa sin 𝜃.
(463)

Fig. 29 plots the shape given by Eqs. (462) and (463) for a =0.4, R0 = 1.7, κ = 1.7, Δ = arcsin(0.6), and α = 1 with ψ varying from zero to one.


pict pict

Fig. 29: Shape of flux surface given by Eqs. (462) and (463). Left figure: points with the same value of ψ are connected to show ψ coordinate surface; Right figure: dot plot. Parameters are a =0.4m, R0 = 1.7m, κ = 1.7, Δ = arcsin(0.6), α = 1 with ψ varying from zero (center) to one (boundary). The shape parameters of LCFS are chosen according to the parameters of EAST tokamak.

19.6 Fixed boundary equilibrium numerical code

The tokamak equilibrium problem where the shape of the LCFS is given is called fixed boundary equilibrium problem. I wrote a numerical code that uses the iterative metric method[11] to solve this kind of equilibrium problem. Figure 30 describes the steps involved in the iterative metric method.


pict pict

pict pict

pict

Fig. 30: Upper left figure plots the initial coordinate surfaces. After solving the GS equation to obtain the location of the magnetic axis, I shift the origin point of the initial coordinate system to the location of the magnetic axis (upper right figure). Then, reshape the coordinate surface so that the coordinate surfaces ψ = const lies on magnetic surfaces (middle left figure). Recalculate the radial coordinate ψ that is consistent with the Jacobian constraint and interpolate flux surface to uniform ψ coordinates (middle right figure). Recalculate the poloidal coordinate 𝜃 that is consistent with the Jacobian constraint and interpolate poloidal points on every flux surface to uniform 𝜃 coordinates (bottom left figure).

19.7 Benchmark of the code

To benchmark the numerical code, I set the profile of P and g according to Eqs. (531) and (532) with the parameters c2 = 0, c1 = B0(κ02 + 1)(R02κ0q0), κ0 = 1.5, and q0 = 1.5. The comparison of the analytic and numerical results are shown in Fig. 31.


pict

Fig. 31: Agreement between the magnetic surfaces (contours of Ψ) given by the Solovev analytic formula and those calculated by the numerical code. The two sets of magnetic surfaces are indistinguishable at this scale. The boundary magnetic surface is selected by the requirement that Ψ = 0.11022 in the Solovev formula (537). Parameters: κ0 = 1.5, q0 = 1.5.

Note that the parameter c0 in the Solovev equilibrium seems to be not needed in the numerical calculation. In fact this impression is wrong: the c0 parameter is actually needed in determining the boundary magnetic surface of the numerical equilibrium (in the case considered here c0 is chosen as c0 = B0(R02κ0q0)).

19.8 Low-beta equilibrium vs. high-beta equilibrium

With the pressure increasing, the magnetic axis usually shifts to the low-field-side of the device, as is shown in Fig. 32.


pict pict

Fig. 32: Comparison of two equilibria obtained with P0 = 104 Pasca (left) and P0 = 105 Pasca (right), respectively, where P0 is the pressure at the magnetic axis. All the other parameters are the same for the two equilibria, α = 1.0, β = 1.0, Pb = 101 Pasca, g0 = 1.0Tm, Iϕ = 500kA, and the LCFS is given by miller’s formulas (458) and (459) with R0 = 1.7, a = 0.45, κ = 1.7, and δ = 0.6.

 

 

 

19.9 Analytical form of Jacobian (need cleaning up)

Consider the Jacobian of the form

     ( R )m
𝒥 = μ  ---   ψn,
       R0
(464)

where m and n are arbitrary integers which can be appropriately chosen by users, μ0 and R0 are constants included for normalization. In the iterative metric method of solving fixed boundary equilibrium problem, we first construct a coordinates transformation (𝜃,ψ) (R(𝜃,ψ),Z(𝜃,ψ)) (this transformation is arbitrary except for that surface ψ = 1 coincides with the last closed flux surface), then solve the GS equation in (𝜃,ψ) coordinate system to get the value of Ψ at grid points, and finally adjust the value of (R(𝜃,ψ),Z(𝜃,ψ)) to make surface ψ = const lies on a magnetic surface. It is obvious the Jacobian of the final transformation we obtained usually does not satisfy the constraint given by Eq. (464) since we do not use any information of Eq. (464) in the above steps. Now comes the question: how to make the transformation obtained above satisfy the constraint Eq. (464) through adjusting the values of 𝜃? To make the constraint Eq. (464) satisfied, 𝜃 and ψ should satisfy the relation

          [R (𝜃,ψ )]m
𝒥 (𝜃,ψ) = μ -------  ψn,
             R0
(465)

which

 

 

Using Eq. (), we obtain

0𝜃d𝜃 = 0𝜃d𝜃-𝒥-
ψn1-
μ(   )
  R0-
  Rm

    ∫ 𝜃   𝒥 1 (R0 )m
𝜃 =    d𝜃ψn-μ- -R-
     0
(466)

normalized to 2π, the normalized 𝜃 is written as

       ∫𝜃d𝜃-𝒥n 1(R0 )m       ∫𝜃d𝜃𝒥 (1-)m
𝜃 = 2π∫-02π--ψ𝒥-μ1-(RR0)m-= 2π∫-02π-----R(1)m-
       0  d𝜃ψnμ  R         0  d𝜃𝒥  R
(467)

 

19.10 Grad-Shafranov equation with prescribed safety factor profile (to be finished)

In the GS equation, g(Ψ) is one of the two free functions which can be prescribed by users. In some cases, we want to specify the safety factor profile q(Ψ), instead of g(Ψ), in solving the GS equation. Next, we derive the form of the GS equation that contains q(Ψ), rather than g(Ψ), as a free function. The safety factor defined in Eq. (187) can be written

             ∫ 2π
q(ψ) = − 1-g′    𝒥-2d𝜃                             (468)
        2πΨ  ∫0  R
        1--g -20πR-−2𝒥d𝜃-∫ 2π
    = − 2πΨ ′  ∫2π𝒥 d𝜃   0  𝒥d𝜃
               0  ∫ 2π
    = − 1--g ⟨R −2⟩    𝒥d𝜃                          (469)
        2πΨ ′      0
              -V-′-⟨R−2⟩
    = − sgn(𝒥 )(2π)2 Ψ ′ g.                         (470)
Equation (470) gives the relation between the safety factor q and the toroidal field function g. This relation can be used in the GS equation to eliminate g in favor of q, which gives
           -(2π)2-- ′
g = − sgn(𝒥 )V ′⟨R−2⟩Ψ q.
(471)

                 [           ]
  -dg    -(2π)2-- --(2π-)2--  ′
⇒ dΨ g = V′⟨R −2⟩q V ′⟨R −2⟩qΨ  ψ.
(472)

Note that this expression involves the flux surface average, which depends on the flux surface shape and the shape is unknown before Ψ is determined.

Multiplying Eq. (604) by R2 gives

  [                                 ]
1  (   𝒥      )    (   𝒥         )        dp       dg
𝒥-   Ψ′R2|∇ψ |2   +  Ψ ′R2(∇ψ ⋅∇ 𝜃)   + μ0dΨ-+ R −2dΨ-g = 0.
                ψ                  𝜃
(473)

Surface-averaging the above equation, we obtain

       [                                ]
2π∫     (  ′ 𝒥    2)    ( ′ 𝒥         )       dp     −2 dg
V′-  d𝜃  Ψ R2-|∇ψ|    +  Ψ R2-(∇ψ ⋅∇𝜃)    + μ0dΨ-+ ⟨R  ⟩dΨ-g = 0,
                    ψ                  𝜃
(474)

   2π ∫    (   𝒥      )      dp        dg
⇒  -′- d𝜃  Ψ′--2|∇ ψ|2   +μ0 ---+ ⟨R −2⟩--g = 0,
   V         R        ψ     dΨ        dΨ
(475)

   2π[   ∫   (  |∇ψ |2) ]      dp        dg
⇒  -′-Ψ ′  d𝜃 𝒥 ---2-    + μ0---+ ⟨R −2⟩--g = 0,
   V              R     ψ    dΨ         dΨ
(476)

     [     ⟨     ⟩ ]
   1--  ′ ′ |∇ψ-|2        -dp     −2 dg-
⇒  V′ V Ψ     R2    ψ + μ0dΨ + ⟨R  ⟩dΨg = 0.
(477)

   [    ⟨     2⟩]
⇒   V′Ψ′  |∇-ψ2|-    + μ0V′ dp-+ ⟨R−2⟩V′ dg-g = 0,
           R     ψ       dΨ          dΨ
(478)

Substitute Eq. (472) into the above equation to eliminate gdg∕dΨ, we obtain

  [    ⟨      ⟩ ]                  [       ]
     ′ ′ |∇ψ|2          ′dp-       4 --qΨ-′--
⇒  V Ψ    R2     ψ + μ0V dΨ + q(2π) V ′⟨R− 2⟩ ψ = 0,
(479)

Eq. (479) agrees with Eq. (5.55) in Ref. [16].

     ⟨     ⟩     [  ⟨      ⟩]                   [        ]          [       ]
⇒ V ′ |∇ψ-|2  Ψ′′+  V′  |∇-ψ|2    Ψ′+μ V ′ dp+q (2π)4 ---q----Ψ ′′+q (2π)4  ---q----  Ψ′ = 0
        R2             R2    ψ     0   dΨ         V′⟨R −2⟩            V′⟨R−2⟩ ψ
(480)

              {                                              }
    ′′     1   [  ′⟨|∇ψ |2⟩ ]   ′      4[   q    ]   ′     ′ dp
⇒  Ψ  = −V-′D   V   --R2-    Ψ  +q(2π)  V-′⟨R-−2⟩  Ψ + μ0V  dΨ-
                            ψ                    ψ
(481)

where

    ⟨|∇ ψ|2⟩    (2π )4 ( q )2
D =  ---2-  + ---−2  --′
       R      ⟨R   ⟩ V
(482)

The GS equation is

△ ⋆Ψ = − μ R2 dp-− g dg
         0   dΨ     dΨ
(483)

                          4 [     ′  ]
⇒  △ ⋆Ψ = − μ0R2-dp−  q(2π)-----qΨ----
               dΨ    V′⟨R −2⟩ V ′⟨R −2⟩ ψ
(484)

                         4 { [       ]      [        ]  }
⇒ △ ⋆Ψ = − μ0R2-dp− q(2π)---  ---q----  Ψ′ + ---q---- Ψ′′
              dΨ    V′⟨R −2⟩   V ′⟨R−2⟩ ψ      V ′⟨R− 2⟩
(485)

Using Eq. (481) to eliminate Ψ′′ in the above equation, the coefficients before (μ0dp∕dΨ) is written as

                { [       ]       }
B = R2 − -q(2π)4--  ---q---- -1--V′
         V′⟨R −2⟩   V′⟨R−2⟩  V′D
    1 {  2    ( q )2 (2π)4 }
  = D-  R D −  V-′  ⟨R−-2⟩2  .                        (486)
Substituting the expression of D into the above equation, we obtain
       {   ⟨     ⟩           (   )   (   )       }
B = -1  R2  |∇ψ-|2  + R2 (2π)4-  q--2 −  q--2-(2π)4
    D         R2        ⟨R −2⟩  V′      V′  ⟨R −2⟩2
     1 { 2 ⟨|∇ψ |2⟩   ( q )2 (2π)4 (  2    1  ) }
  = D-  R   --R2-  +  V-′  ⟨R−-2⟩ R  − ⟨R−2⟩   ,             (487)
which is equal to the expression (5.58) in Ref. [16]. The coefficient before Ψis written as
A =       4
-q(′2π)−2-
V ⟨R   ⟩{[        ]   [        ]     [(   ⟨    2⟩ )         [        ] ]}
   -′-q−2-- −   -′-q−2----1′-   V ′ |∇ψ2|     + q(2π)4  -′-q−2--
   V ⟨R   ⟩ ψ    V ⟨R   ⟩ V  D         R     ψ          V ⟨R   ⟩ ψ

Define

α = ⟨     ⟩
 |∇ψ-|2
   R2,

β =    q
V-′⟨R−-2⟩-.

A = (2π)4β{                           }
 βψ − β--1-[(V′α)ψ + q(2π)4βψ ]
       V ′D

      D                1   ′          4
=⇒ −-(2π)4β-A = Dβψ − βV-′[(V α)ψ +q(2π) βψ]
(488)

= ⇒ ---D----A = D β − β-1[V′′α + V ′α  + q(2π )4β ]
    − β(2π)4       ψ    V ′         ψ         ψ
(489)

Using

D = α + (2π )4⟨R− 2⟩β2
(490)

Eq. () is written as

                                                                    ]
=⇒  ---D---A = αβ  + (2π)4⟨R −2⟩β2β  − β-1-V′′α − β-1V ′α  − β 1-q(2π )4β
    − β(2π)4     ψ               ψ    V ′       V ′   ψ    V′      ψ
(491)

       D                 4  −2  2      1  ′′           1     4  ]
=⇒  −-β(2π-)4A = α βψ + (2π) ⟨R  ⟩β βψ − β V′V α − βαψ − βV-′q(2π) βψ
(492)

   A                                1
−-β(2π)4D = αβψ + (2π )4⟨R− 2⟩β2βψ − βV-′V ′′α − β αψ − β2⟨R −2⟩(2π)4βψ
(493)

       A               1   ′′
= ⇒ −-β(2π)4-D = αβψ − βV′V  α− βα ψ
(494)

                   (   )
=⇒  ---A---D  = − β2 α-   − β 1-V ′′α
    − β(2π)4          β  ψ    V′
(495)

      A            (α )       1   α
=⇒  − β(2π)4D = − β2 β   − β2V-′V ′′β-
                       ψ
(496)

                   [               ]
      A             (α )     1   α
=⇒ −-β(2π)4D = − β2  -β   + V-′V ′′β-
                        ψ
(497)

                      [(  )           ]
    ---A----      2-1-   α-    ′   ′′α-
= ⇒ − β(2π)4 D = − β V ′  β  ψV  + V β
(498)

       A            1 (α   )
=⇒  − β(2π)4D = − β2V-′ β-V′
                            ψ
(499)

           4 (        )3   [⟨     2⟩   −2    ]
=⇒  A = (2π)- ----q---   1--  |∇-ψ|-  ⟨R--⟩V ′2
         D    V ′⟨R −2⟩   V′    R2      q      ψ
(500)

But the expression of A is slightly different from that given in Ref. [16] [Eq. (5.57)]. Using the above coefficients, the GS equation with the q-profile held fixed is written as

(          )
  Δ⋆ − A-∂-  Ψ = − B μ0 dp.
        ∂ψ            dΨ
(501)

 

20 Misc contents

20.1 Expression of current density

Let us derive the contravariant expression for the current density. Using

μ0J = ∇× B,

along with magnetic field expression (181) and the curl formula (143), we obtain

       [                               ]
         ( ′ 𝒥     2)    (  ′ 𝒥       )              ′
μ0J = −   Ψ R2-|∇ ψ|   +   Ψ R2∇ ψ ⋅∇𝜃    ∇ψ × ∇ 𝜃− g∇ ϕ × ∇ψ,     (502)
                     ψ                 𝜃
which is the contravariant form of the current density vector. Next, for later use, calculate the parallel current. By using Eqs. (181) and (502), the parallel current density is written as
          [(          )    (            ) ]                  (           )
μ0J⋅B = −    Ψ′ 𝒥-|∇ ψ|2  +  Ψ ′ 𝒥-∇ ψ⋅∇ 𝜃   g∇ψ × ∇𝜃 ⋅∇ϕ − g′ − Ψ′ 𝒥-|∇ψ |2 ∇ϕ × ∇ψ ⋅∇ 𝜃
               R2       ψ      R2        𝜃                        R2
          [(   𝒥      )    (   𝒥        ) ]               𝒥
      = −    Ψ′-2|∇ ψ|2   +  Ψ ′-2∇ ψ⋅∇ 𝜃    g𝒥−1 + g′𝒥 −1Ψ′-2-|∇ ψ|2
               R{       ψ      R         𝜃                R       }
                 1 (   𝒥      )    1 (  𝒥        )    g′   𝒥
      = − g2𝒥− 1 g  Ψ ′R2|∇ψ |2   + g  Ψ′R2-∇ψ ⋅∇𝜃   − g2Ψ ′R2-|∇ψ|2
                [              ψ                 ] 𝜃
           2 − 1 (Ψ-′𝒥--   2)    ( Ψ′𝒥--      )
      = − g 𝒥      g R2|∇ψ |   +   g R2 ∇ψ ⋅∇𝜃    .                               (503)
                              ψ                 𝜃

20.2 Cylindrical tokamak

For a large aspect-ratio, circular cross section tokamak, the R on a magnetic surface is nearly constant, R R0. The poloidal angle dependence of the magnetic field can be neglected, i.e., Bϕ(r,𝜃) Bϕ(r), and Bp(r,𝜃) Bp(r), where r is the minor radius of the relavent magnetic surface. Using these, the safety factor in Eq.  (95) is approximated to

      ∮                      ∮
   -1-   1B-ϕ      1-B-ϕ(r)-1-        -1-Bϕ(r)1--     -r-Bϕ(r)
q = 2π   R Bpdℓp ≈ 2πBp (r)R0    dℓp = 2π Bp(r)R02πr = R0 Bp(r),
(504)

 

 

20.3 Coils system of EAST tokamak

Poloidal field (PF) coils

EAST has 14 superconducting poloidal field (PF) coils (only 12 of them are independently powered). The layout is shown in Fig. 33.


pict

Fig. 33: Coils system of EAST tokamak. Coils PF1 to PF6 are Central Solenoide (CS) coils with 140 turns/coil. Both PF11 and PF12 have 64 turns, Both PF13 and PF14 have 32 turns. PF7 and PF9 are adjacent to each other and connected in series and thus are considered as one independent coil, with total turns being 248. The same situation applies for PF8 and PF10.  Maximum current per turn in PF coils is 14.5kA. Locations of PF coils are from Refs. [26][9]. The inner green D-shaped structure corresponds to the vaccum vessel wall and the outer red dashed D-shape corresponds to the TF-coils. Note that PF1-14 coils are all located outside of the TF-coils. The small blue circles are “flux loops” measuring the poloidal magnetic flux. Red coils are RMP copper coils, which generate 3D magnetic perturbations.

All the PF coils can be considered as shaping coils since they all have effects in shaping the plasmas. In practice, they are further classified according to their main roles. PF1 to PF6 form a solenoid in the center of the torus and thus called Central Solenoide (CS) coils. Their main role is to induce electric field to drive current in the plasma and heat the plasma. As a result, they are often called “Ohm heating coils”. PF13 and PF14 are mainly used to control (slow) vertical plasma displacement and thus are often called “vertical field coils” or “position control coils”. PF11 and PF12 are used to triangularize the plasma and thus is called “shaping coils”. In order to squeeze the plasma to form desied triangularity, their currents need to be in the opposite direction of plamsa current (since two opposite currents repel each other). PF7+PF9 and PF8+PF10 are often called (by EAST operators) as “big coils” or “divertor coils” since they have the largest number of turns and current and are used to elongate the plasma to diverter configurations.

Besides the 16 superconducting PF coils outside vaccum vessel, EAST has two small copper coils within the vaccum vessel (2turn/coil), which are connected in anti-series and thus have opposite currents. They are closer to the plasma (than other PF coils) and are used to control fast plasma displacements, specifically VDEs (vertical displacement events). They are often called “fast control coils”.

 

Toroidal magnetic Field (TF) coils and vacuum toroidal magnetic field

Using Ampere’s circuital law

∮
  B ⋅dl = μ0I,
(505)

along the toroidal direction and assuming perfect toroidal symmetry, we obtain

2πRB ϕ = μ0I,
(506)

i.e.,

     μ0I-
Bϕ = 2πR .
(507)

Neglecting the poloidal current contributed by the plasma, the poloidal current is determined solely by the current in the TF coils. The EAST tokamak has 16 groups of TF coils with 132turns/coil (I got to know the number of turns from ZhaoLiang Wang: φ × R = 12 × 11 = 132). Denote the current in a single turn by Is, then Eq. (507) is written

     μ × 16× 132 × I              I
Bϕ = -0------------s-= 4.224 × 10−4-s
           2πR                    R
(508)

Using this formula, the strength of the toroidal magnetic field at R = 1.8m for Is = 104A is calculated to be Bϕ = 2.34T. This was one of the two scenarios often used in EAST experiments (another scenario is Is = 8 × 103A). (The limit of the current in a single turn of the TF coils is 14.5kA (from B. J. Xiao’s paper [31]).

Note that the exact equilibrium toroidal magnetic field Bϕ is given by Bϕ = g(Ψ)∕R. Compare this with Eq. (507), we know that the approximation made to obtain Eq. (508) is equivalent to g(Ψ) μ0ITF2π, i.e. assuming g is a constant. The poloidal plasma current density jpol is related to g by jpol = g(Ψ)Bp∕μ0. The constant g corresponds to zero plasma poloidal current, which is consistent to the assumption used to obtain Eq. (508).

Let us estimate the safety factor value near the plasma edge using the total plasma current and the current in a single turn of TF coils Is. For divertor magnetic configuration, the plasma edge is at the saperatrix, where q →∞. To get a characteristic safety factor value that is finite, one often chooses the edge to be the magnetic surface that encloses 95% of the poloidal magnetic flux. Denote this surface by S95 and the value of q at this surface by q95, which is given by

     Bϕ,axis-a---
q95 ≈  Bp   Raxis,
(509)

where a is the minor radius of the surface S95, and Raxis the major radius of the magnetic axis, Bϕ,axis is the the magnitude of toroidal magnetic field at the magnetic axis, and Bp is the average poloidal magnetic field on the surface, Bp μ0Ip(2πa). Using Eq. (508), Eq. (509) is written as

     4.224× 10−4Is2πa2
q95 ≈-----μ0Ip----R2---,
                    axis
(510)

For EAST, tipically Raxis = 1.85m and a = 0.45m. Using this, we obtain

        I
q95 ≈ 125-s.
        Ip
(511)

RMP coils of EAST

The so-called resonant magnetic perturbation (RMP) coils are 3D coils that are used to suppress or mitigate edge localized modes. The shape and location of RMP coils of EAST tokamak are plotted in Fig. 34.

 


pict pict

Fig. 34: Location of the RMP coils on EAST tokamak in 3D view (left) and poloidal view (right).

 

20.4 Comparison of major tokamaks in the world

The size of EAST is similar to that of DIII-D tokamak. The main parameters are summarized in Table. 1. A significant difference between EAST and DIII-D is that DIII-D has a larger minor radius, which makes DIII-D able to operate with a larger toroidal current than that EAST can do for the same current density. Another significant difference between EAST and DIII-D is that the coils of EAST are supper-conducting while the coils of DIII-D are not. The supper-conducting coils enable EAST to operate at longer pulse.









EAST DIII-D[21] KSTAR[19] SPARCWEST JET







Major radius R0 1.85m 1.67m 1.8m 1.85m 2.5m 2.96m







minor radius a 0.45m 0.67m 0.5m 0.57m 0.5m 0.9m







elongation







Plasma volume 20m3







No. of TF coils, turns, current 16, 130, 14.5kA24, 6, 126kA16, 56, 35.2kA







Bt at R0 3.26T 2.17T 3.5T 12.2T 3.7T 3.45T







CS coil module×turn×current 6×120×14.5kA







No. of independent PF coils 6+6 ?+18







Available solenoid magnetic flux 12Vs 10.5Vs 17Vs







Maximum plasma current 1.0MA 3.0MA 2MA 8.7MA 1MA 5MA







Pulse length 400s 10s 300s







superconducting? Yes No Yes Yes No







 

Table 1: Comparison of main parameters of EAST, DIII-D, JET, and ITER tokamaks. The Bt of EAST is calculated at R = 1.85m by using Eq. (508) with Is = 14.5kA (the maximal current allowed). The currents listed in the table are maximum plasma current whereas typical plasma currents for EAST are 0.5MA and for DIII-D are 2MA or less.







ITER[1] CFETR(old version)CFETR (new) BEST





Major radius R0 6.2m 5.7m 7.2m 3.6m





minor radius a 2.0m 1.6m 2.2m





elongation





No. of TF coils, turns, current 18, 134, 68kA 16, 132, 67.5kA 16, ?, ? 16, 152, 45.6kA





Bt at R0 5.29T 5.00T 6.5T





CS coil module×turn×current





No. of independent PF coils





Available solenoid magnetic flux





Maximum plasma current 15MA 10MA 14MA





Pulse length 400s





superconducting? Yes Yes Yes Yes





 

Table 2: Continued from Table 1.

 

 







ASDEX-U HL-2M NSTXMAST





Major radius R 0 1.65m 1.78m 0.85m 0.9m





minor radius a 0.7m 0.65m 0.68m 0.6m





elongation





No. of TF coils, turns, current 16,?,? 20,7,190kA





Bt at R0 2.99T 0.3T 0.55T





CS coil module×turn×current 1,?,?





No. of independent PF coils 1+16





Available solenoid magnetic flux 14Vs





typical plasma current 1.6MA 2.5MA





Pulse length 5s





superconducting? No No No





 

Table 3: Continued from Table 2.

DIII-D has 24 groups of TF coils with 6turns/coil, i.e., total turns are 24 × 6 = 144, with a maximum current of Is = 126kA in a single turn[21]. Using formula (507), the toroidal filed at R = 1.67m can be calculated, giving 2.17T.

DIII-D is special in that its poloidal field (PF) coils are located inside of the TF-coils, which makes the PF-coils more close to the plasma and thus more efficient in shaping the plasma. However, this nested structure is difficult to assemble. In superconducting tokamaks (e.g., EAST, KSTAR, ITER), PF coils are all placed outside of the TF-coils.

I noticed that HL-2M also has the PF coils located within the TF-coils, similar to DIII-D. This remind me that this layout may apply to all non-superconducting tokamaks (to be confirmed, No, non-superconducting tokamak ASDEX-U has PF coils outside of TF coils).

KSTAR has 16 TF coils and 14 PF coils. Both of the TF and PF coil system use internally cooled superconductors. The nominal current in TF coils is 35.2kAturn with 56turnscoil and all coils connected in series[25]. Using these information and formula (507), the toroidal filed at R = 1.8m can be calculated, giving 3.5T. The PF coil system consists of 8 Central Solenoide (CS) coils and 6 outer PF coils and can provide 17 V-sec.

ITER has 18 TF coils with number of turns in one coil being 134 and current per turn 68kA[5]. Using these information and formula (507), the toroidal filed at R = 6.2m can be calculated, giving 5.29T

 

20.5 Miller’s formula for shaped flux surfaces

According to Refs. [822], Miller’s formula for a series of shaped flux surfaces is given by

R = R0(r)+ rcos{𝜃+ arcsin[δ(r)sin𝜃]},
(512)

Z = κ(r)rsin 𝜃,
(513)

where κ(r) and δ(r) are elongation and triangularity profile, R0(r) is the Shafranov shift profile, which is given by

                 ′[    ( )2]
R0(r) = R0 (a)− aR0-1 −  r-   ,
                2       a
(514)

where R0is a constant, R0(a) is the major radius of the center of the boundary flux surface. The triangularity profile is

        (r)2
δ(r) = δ0--  ,
         a
(515)

and the elongation profile is

                  (r)4
κ(r) = κ0 − 0.3+ 0.3-  .
                   a
(516)

The nominal ITER parameters are κ0 = 1.8, δ0 = 0.5 and R0= 0.16. I wrote a code to plot the shapes of the flux surface (/home/yj/project/miller_flux_surface). An example of the results is given in Fig. 35.



Fig. 35: Flux-surfaces given by Eqs. (512) and (513) with r∕a varying from 0.1 to 1.0 (corresponding boundary surface). Other parameters are R0(a)∕a = 3, κ0 = 1.8, δ0 = 0.5, R0= 0.16.

 

 

20.6 Double transport barriers pressure profile

An analytic expression for the pressure profile of double (inner and external) transport barriers is given by

         (        ( − (ψ − ψ )) )   (       ( − (ψ − ψ )))
P (ψ) = ai 1+ tanh  -------i-   +ae  1+ tanh  -------e-   − c
                       wi                        we
(517)

where ψ is the normalized poloidal flux, wi and we are the width of the inner and external barriers,  ψi and ψe are the locations of the barriers, ai and ae is the height of the barriers, c is a constant to ensure P(ψ) = 0 at ψ = 1.


pict

Fig. 36: Pressure profile of double (inner and external) transport barriers given by Eq. (517) with ai = 1, bi = 0.2, ψi = 0.36, ψe = 0.96, wi = 0.2, we = 0.04, c = 0.

 


pict

Fig. 37: Equilibrium pressure profile for EAST discharge #38300 at 3.9s (reconstructed by EFIT code, gfile name: g038300.03900), which shows a boundary transport barrier.

20.7 Ballooning transformation

To construct a periodic function about 𝜃, we introduces a function z(𝜃) which is defined over −∞ < 𝜃 < and vanishes sufficiently fast as |𝜃|→∞ so that the following infinite summation converge:

 ∞∑
    z(𝜃 +2πl).
l=− ∞
(518)

If we use the above sum to define a function

       ∞∑  -
z(𝜃) =     z(𝜃 +2πl),
      l=− ∞
(519)

then it is obvious that

z(𝜃 +2π ) = z(𝜃),
(520)

i.e., z(𝜃) is a periodic function about 𝜃 with period of 2π.

If we use the right-hand-side of Eq. (519) to represent z(𝜃), then we do not need to worry about the periodic property of z(𝜃) (the periodic property is guaranteed by the representation)

A mics

A.1 Shape parameters of a closed magnetic surface

Let us introduce parameters characterizing the shape of a magnetic surface in the poloidal plane. The “midplane” is defined as the plane that passes through the magnetic axis and is perpendicular to the symmetric axis (Z axis). For a up-down symmetric (about the midplane) magnetic surface, its shape can be roughly characterized by four parameters, namely, the R coordinate of the innermost and outermost points in the midplane, Rin and Rout; the (R,Z) coordinators of the highest point of the magnetic surface, (Rtop,Ztop). These four parameters are indicated in Fig. 38.


pict

Fig. 38: Four parameters characterizing the shape of a flux surface: the R coordinate of the innermost and outermost points in the middle-plane, Rin and Rout; the (R,Z) coordinators of the highest point of the flux surface, (Rtop,Ztop).

In terms of these four parameters, we can define the major radius of a magnetic surface

     Rin-+Rout
R0 =     2    ,
(521)

(which is the R coordinate of the geometric center of the magnetic surface), the minor radius of a magnetic surface

    Rout − Rin
a = ----2----,
(522)

the triangularity of a magnetic surface

    R  − R
δt =--0---top,
        a
(523)

and, the ellipticity (elongation) of a magnetic surface

κ = Ztop.
     a
(524)

Usually, we specify the value of R0, a, δt, and κ, instead of (Rin,Rout,Rtop,Ztop), to characterize the shape of a magnetic surface. The value of the triangularity δt is usually positive in traditional tokamak operations, but negative triangularity is achievable and potentially useful, which is under active investigation.

Besides, using a and R0, we can define another useful parameter 𝜀 a∕R0, which is called the inverse aspect ratio. Note that the major radius R0 of the LCFS is usually different from Raxis (the R coordinate of the magnetic axis). Usually we have Raxis > R0 due to the so-called Shafranov shift.

 

A.2 Ψ is a covariant component of A in cylindrical coordinates

We note that Ψ AϕR is the covariant toroidal component of A in cylindrical coordinates (R,ϕ,Z). The proof is as follows. Note that the covariant form of A should be expressed in terms of the contravariant basis vector (R, ϕ, and Z), i.e.,

A = A1 ∇R + A2∇ ϕ+ A3 ∇Z.
(525)

where A2 is the covariant toroidal component of A. To obtain A2, we take scalar product of Eq. (525) with r∕∂ϕ and use the orthogonality relation (107), which gives

   ∂r-
A ⋅∂ϕ = A2.
(526)

In cylindrical coordinates (R,ϕ,Z), the position vector is written as

            ˆ       ˆ   ˆ
r(R, Z,ϕ) = R R(ϕ)+ Z Z+ 0ϕ
(527)

where ˆR, ˆZ, and ˆϕ are unit vectors along r∕∂R, r∕∂Z, and r∕∂ϕ, respectively, i.e.

     ∂r ||∂r||−1      ∂r ||∂r||−1     ∂r ||∂r||−1
Rˆ=  ---||--||  ,Zˆ= --- ||--||  , ˆϕ =---||--||
     ∂R  ∂R        ∂Z  ∂Z         ∂ϕ  ∂ϕ
(528)

Using this, we obtain

∂r-   ˆ
∂ϕ = Rϕ,
(529)

Use Eq. (529) in Eq. (526) giving

A2 = AϕR,
(530)

with Aϕ defined by Aϕ = A ˆϕ. Equation (530) indicates that Ψ = AϕR is the covariant toroidal component of the vector potential.

A.3 Solovév equilibrium

For most choices of P(Ψ) and g(Ψ), the GS equation (53) has to be solved numerically. For the specific choice of P and g profiles given by

dP-= − c1,
dΨ     μ0
(531)

g dg-= − c2R20,
  dΨ
(532)

where c1, c2, and R0 are constants, there is an analytical solution, which is given by[16]

    1                 1
Ψ = -(c2R20 + c0R2)Z2 +-(c1 − c0)(R2 − R20)2,
    2                 8
(533)

where c0 is an constant. [Proof: By direct substitution, we can verify Ψ of this form is indeed a solution to the GS equation (53).] A useful choice for tokamak application is to set c0 = B0(R02κ0q0), c1 = B0(κ02 + 1)(R02κ0q0), and c2 = 0. Then Eq. (533) is written

            [        2         ]
Ψ = ---B20--  R2Z2 + κ0(R2 − R20)2 .
    2R 0κ0q0         4
(534)

For this case, the toroidal field function g is a constant. (For the Solovev equilibrium (534), I found numerically that the value of the safety factor at the magnetic axis (R = R0,Z = 0) is equal to q0g∕(R0B0). This result should be able to be proved analytically. I will do this later. In calculating the safety factor, we also need the expression of |∇Ψ|, which is given analytically by

       ∘ (---)----(---)--
          ∂-Ψ  2   ∂-Ψ  2
|∇Ψ | =   ∂R    +  ∂Z
         B    ∘ -------------------------------
     = ---20--  [2RZ2 + κ20(R2 − R20)R ]2 + (2R2Z )2.           (535)
       2R 0κ0q0
)

 

Define Ψ0 = B0R02, and Ψ = Ψ∕Ψ0, then Eq. (534) is written as

--    1  [--2-2  κ2 --2    ]
Ψ = ----- R Z  + -0(R  − 1)2  ,                    (536)
    2κ0q0         4
where R = R∕R0, Z = Z∕R0. From Eq. (536), we obtain
        ∘ ---------2---------
Z-= ± 1-  2κ0q0Ψ-− κ0(R2 − 1)2.
      R            4
(537)

Given the value of κ0, q0, for each value of Ψ, we can plot a magnetic surface on (R,Z) plane. An example of the nested magnetic surfaces is shown in Fig. 39.


pict

Fig. 39: Flux surfaces of Solovév equilibrium for κ0 = 1.5 and q0 = 1.5, with Ψ varying from zero (center) to 0.123 (edge). The value of Ψ on the edge is determined by the requirement that the minimum of R is equal to zero. (To prevent “divided by zero” that appears in Eq. (537) when R = 0, the value of Ψ on the edge is shifted to 0.123 𝜀 when plotting the above figure, where 𝜀 is a small number, 𝜀 = 103 in this case.)

Equation (534) can be solved to give explicit form of the contour of Ψ in (R,Z) plane:

        ∘ -----------------------
      1   2R2κ q     κ2
Z = ± --  --0-0-0Ψ − -0(R2 − R20)2.
      R     B0       4
(538)

The minor radius of a magnetic surface of the Solovev equilibrium can be calculated by using Eq. (538), which gives

      ∘-----√----
Rin =  R20 −  AΨ,
(539)

      ∘ -----√----
Rout =  R20 +  A Ψ,
(540)

and thus

                ∘ ---------- ∘ ----------
                  R2 + √A-Ψ −  R2 − √A-Ψ
a = Rout −-Rin =---0-------------0------.
        2                   2
(541)

where A = 8R02q0(B0κ0). In my code of constructing Solovev magnetic surface, the value of a is specified by users, and then Eq. (541) is solved numerically to obtain the value of Ψ of the flux surface. Note that the case Ψ = 0 corresponds to Rin = Rout = R0, i.e., the magnetic axis, while the case Ψ = R02B0κ0(8q0) corresponds to Rin = 0. Therefore, the reasonable value of Ψ of a magnetic surface should be in the range 0 Ψ < R02B0κ0(8q0). This range is used as the interval bracketing a root in the bisection root finder.

Using Eq. (541), the inverse aspect ratio of a magnetic surface labeled by Ψ can be approximated as[16]

    ∘ --------
       2q0Ψ
𝜀 ≈   κ0R2B0-.
         0
(542)

Therefore, the value of Ψ of a magnetic surface with the inverse aspect ratio 𝜀 is approximately given by

     2   2
Ψ = 𝜀-κ0R0B0-.
       2q0
(543)

A.4 Plasma rotation

In deriving the Grad-Shafranov equation, we have assumed that there is no plasma flow. Next, let us examine whether this assumption is justified for plasmas in EAST tokamak.

The complete momentum equation is given by

   [∂U          ]
ρm  -∂t + U ⋅∇U  = ρqE + J ×B − ∇ ⋅ℙ,
(544)

where ρqE term can be usually neglected due to either ρq 0 or E 0, is a pressure tensor, which is different from the scalar pressure considered in this note. The equilibrium with pressure tensor can be important for neutral beam heating plasma, where pressure contributed by NBI fast ions can be a tensor. With plasma flow and scalar pressure and neglecting electric force term, the steady state momentum equation is written

ρmU ⋅∇U  = J× B − ∇P,
(545)

where the term on the left-hand side is the contribution of plasma flow to the force balance. Let us estimate the magnitude of this term. Macroscopic flows in tokamak are usually along the toroidal direction (the poloidal flow is usually heavily damped). The toroidal flow usually has the same toroidal angular frequency on a magnetic surface, i.e., the flow can be written as

U = R ωT(ψ)eϕ,
(546)

where ωT = ωT(ψ) is the toroidal angular frequency of the flow, which can have radial variation. Using this expression, the left-hand side of Eq. (545) is written as

ρmU ⋅∇U  = ρmR ωTeϕ ⋅∇(RωT eϕ)
                  1 ∂
         = ρmR ωTR-∂-ϕ(RωTeϕ)
                  2
         = − ρmR ω TeR,                           (547)
which is just the centripetal force. For typical EAST plasma, the rotation frequency fT = ωT2π is less than 10kHz. For fT = 10kHz, R = 1.8m and ρm = 1.3 × 107 kg ∕m3 [Mass density of EAST#38300@3.9s, ρm = nDmD = 4 × 1019m3 × 2 × 1.6726 × 1027 kg = 1.3 × 107 kg ∕m3], the above fore is about 9.23 × 102 newton. On the other hand, the pressure gradient force in Eq. (545) is about 4 × 104 newton, which is one order larger than the force contributed by the rotation. [Pressure gradient force is estimated by using P P0∕a, where P0 is the thermal pressure at the magnetic axis and a is the minor radius of plasma. For typical EAST plasmas (EAST#38300@3.9s), P0 2 × 104 Pa, a = 0.45m. Then P P0∕a = 4 × 104N∕m3.]  This indicates the rotation has little influence on the force balance. In other words, the EAST tokamak equilibrium can be well described by the static equilibrium without rotation.

A.5 Poloidal plasma current

As is discussed in Sec. (), to satisfy the force balance, g RBϕ must be a magnetic surface function, i.e., g = g(Ψ). Using this, expression (36) and (37) are written

         1 dg ∂Ψ   dg
μ0JR = − R-dΨ-∂Z-= dΨ-BR,
(548)

and

        1dg ∂Ψ    dg
μ0JZ = R-dΨ-∂R-=  dΨBz,
(549)

respectively. The above two equations imply that

JR-=  BR-,
JZ    BZ
(550)

which implies that the projections of B lines and J lines in the poloidal plane are identical to each other. This indicates that the J surfaces coincide with the magnetic surfaces.

The poloidal plasma current density is usually small (compared with the toroidal plasma current density) but is important for some cases of interest and thus could not be safely neglected. Many model equilibria (e.g., Solovev equilibria, DIII-D cyclone base cases) frequently used in simulations assume that g is a spatial constant, i.e., neglecting the poloidal plasmas current. The conclusions drawn from these simulations could be misleading.

Using this and ∇⋅ J = 0, and following the same steps in Sec. 2.7, we obtain

I   = 1-2π[g(Ψ ) − g(Ψ )],
 pol  μ0      2     1
(551)

where Ipol is the poloidal current enclosed by the two magnetic surfaces, the positive direction of Ipol is chosen to be in the clockwise direction when observers look along ˆϕ. Equation (551) indicates that the difference of g between two magnetic surface is proportional to the poloidal current. For this reason, g is usually call the “poloidal current function”.

In the above, we see that the relation of g with the poloidal electric current is similar to that of Ψ with the poloidal magnetic flux. This similarity is due to the following differential relations:

{
  B = ∇ × A
  Ψ = RA ϕ

{
 μ0J = ∇ × B
 g = RB ϕ

The poloidal plasma current density Jp can be further written as

Jp ≡ JR ˆR( + JZˆZ          )
     1--  1-∂g-ˆ   1-∂g-ˆ
  =  μ0  −R ∂Z R + R ∂R Z  .
     1
  =  μ-∇g × ∇ϕ                                   (552)
      0
Using g = g(Ψ), Eq. (552) can also be written as
Jp =-1-dg-∇Ψ × ∇ϕ
    μ0 dΨ
    -1-dg-
  = μ0 dΨ Bp.                               (553)

A.6 Plasma beta

Plasma β is is the ratio of thermal pressure to magnetic pressure, i.e.,

        p
β = B2-∕(2μ-).
           0
(554)

Since pressure in tokamak plasmas is not uniform, volume averaged pressure is used to define the beta. The toroidal beta βt and the poloidal beta βp are defined, respectively, by

       ⟨p⟩
βt =--2------,
    B t0∕(2μ0)
(555)

     --⟨p⟩---
βp = B2a∕(2μ0),
(556)

where is the volume average, Bt0 is the vacuum toroidal magnetic field at the magnetic axis (or geometrical center of the plasma), Ba = μ0Ip∕l is the flux surface averaged poloidal magnetic fied, l = dl is the length of the poloidal perimeter of the boundary flux surface. Then βp can be written as

      2 ⟨p⟩
βp = 2l μ-I2.
        0 p
(557)

An alternative defintion of βp use the LCFS cross-sectional average of p rather than the volume average p (Wesson tokamaks). This definition is adopted in many codes, including HEQ code I developed

 

 

 

A.7 Beta limit

Beta can be considered as a quantity characterizing the efficiency of the magnetic field of tokamaks in confining plasmas.

In tokamaks, the toroidal magnetic field is dominant and thus the the toroidal beta βt (not βp) is the usual way to characterize the the efficiency of the magnetic field in confining plasmas. (Why do we need βp? The short answer is that βp is proportional to an important current, the bootstrap current, which is important for tokamak steady state operation.)

Tokamak experiments have found that it is easier to achieve higher βt in low Bt plasmas than in higher Bt plasmas, which indicates that the efficiency of the magnetic field in confining plasma is a decreasing function of the magnitude of the magnetic field.

Beta limit means there is a limit for the value of beta beyond which the plasma will encounter a serious disruption. Early calculation of the beta limit on JET shows that the maximal βt obtained is proportional to Ip(106aBt0), where all quantities are in SI units.  This scaling relation βt max = CTIp(106aBt0) is often called Troyon scaling, where the coefficient CT was determined numerically by Troyon to 0.028. Often CT is expressed in percent, in which case CT = 2.8. This motivates us to define

βN = 108aBt0 βt.
          Ip
(558)

which is called “normalized beta”. The normalized beta βN is an operational parameter indicating how close the plasma is to reach destabilizing major MHD activities. Its typical value is of order unit. As mentioned above, βN calculated by Troyon is 2.8. Empirical evaluation from the data of different tokamaks raises this value slightly to 3.5, although significantly higher values, e.g., βN = 7.2, have been achieved in the low aspect ratio tokamak NSTX[24].

The value of βN indicates how close one is to the onset of deleterious instability . The ability to increase the value of βN can be considered as the ability of controlling the major MHD instabilities, and thus can be used to characterize how well a tokamak device is operated. One goal of EAST tokamak during 2015-2016 is to sustain a plasma with βN 2 for at least 10 seconds.

(check** The tearing mode, specifically the neoclassical tearing mode (NTM) is expected to set the beta limit in a reactor.)

(**check: Tokamak experiments have found that it is easier to achieve high βN in large Ip plasmas than in small Ip plasmas. However, experiments found it is easier to achieve high βp in small Ip plasmas than in large Ip plasmas. Examining the expression of βN and βp given by Eqs. (557) and Eq. (), respectively, we recognize that pressure limit should have a scaling of p⟩∝ Ipα with 1 < α < 2. )

 

βp is the ratio of the pressure to the squre of plasma current, and thus characterizes the efficiency of the plasma current in confining the plasma. Is there a limit for βp?

 

A.8 Why bigger tokamaks with larger plasma current are better for fusion

As is mentioned in Sec. A.6, the beta limit study on JET tokamak shows that the maximal βt obtained is proportional to Ip∕aBt0. This means the maximal plasmas pressure obtained is proportional to Ip∕a, i.e.,

⟨p⟩ ∝ Ip
      a
(559)

The total plasma energy is given by E ≈⟨p2πRπa2, where R is the major radius of the device. Using Eq. (559), we obtain

E ∝ IpaR.
(560)

Since fusion power is proportional to the plasma energy, the above relation indicates, to obtain larger fusion power, we need bigger tokamaks with larger plasma current.

The reason why larger plasma current is desired can also be appreciated by examining an empirical scaling of the the energy confinement time τE given by

     I2
τE ∝ T ,
(561)

which is proportional to I2.

Another fundamental reason for building larger tokamaks is that the energy confinement time τE a2∕χ increases with the machine size, where χ is the heat diffusitivity. In addition, the heat diffusitivity χ decreases with increasing machine size if the diffusitivity satisfies the gyro-Bohm scaling, which is given by

       √m--T3∕2
χGB =  ---i2-i2--,
        aB qi
(562)

which is inverse proportional to the machine size a. However, if the diffusitivity satisfies the Bohm scaling, which is given by

      T
χB = ----,
     |q|B
(563)

then, the diffusitivity is independent of the machine size. The Bohm diffusitivity χB is a∕ρs times larger than the gyro-Bohm diffusitivity χGB, where ρs is the gyro-radius. Heat diffusitivity scaling in the low confinement operation (L mode) in present-day tokamaks is observed to be Bohm or worse than Bohm.

 

 

A.9 Density limit

The maximum density that can be obtained in stable plasma operations (without disruption) is empirically given by

ne ≈ 1.5nG,
(564)

where nG is the Greenwalt density, which is given by

         I
nG = 1014--p2
        πa
(565)

where Ip is the plasma current, a is the minor radius, all physical quantities are in SI units. The 1.5nG gives the density limit that can be achieved for a tokamak operation scenario with plasma current Ip and plasma minor radius a. The Greenwalt density limit is an empirical one, which, like other empirical limits, can be exceeded in practice. Equation (565) indicates that the Greenwalt density is proportional to the current density. Therefore the ability to operate in large plasma current density means the ability to operate with high plasma density.

Note that neither the pressure limit nor the density limit is determined by the force-balance constraints. They are determined by the stability of the equilibrium. On the other hand, since the stability of the equilibrium is determined by the equilibrium itself, the pressure and density limit is determined by the equilibrium.

 

A.10 Normalized internal inductance

The self-inductance of a current loop is defined as the ratio of the magnetic flux Φ traversing the loop and its current I:

    Φ-
L = I ,
(566)

where

   ∫
Φ =   B ⋅dS.
     S
(567)

It can be proved that L is independent of the current I in the loop, i.e., L is fully determined by the shape of the loop.

On the other hand, the energy contained in the magnetic field produced by the loop current is given by

     ∫   B2
W  =    2μ0 dV,
      V0
(568)

where the volume includes all space where B is not negligible. It can be proved that (to be proved) W, L, and I are related to each other by:

     1
W =  2LI2,
(569)

i.e.,

    2W
L = -2-,
    I
(570)

which can be considered an equivalent definition of the self-inductance.

The internal inductance Li of tokamak plasma is defined in such a way that W only includes the magnetic energy within the plasma. Specifically, Li is defined by

     2Wi    2 ∫  B2𝜃
Li ≡ -I2-=  I2   2μ0 dV
               P
(571)

where the integration over the plasma volume P and only the poloidal field B𝜃 appears in the integration since plasma current produces only the poloidal magnetic field.

The normalized internal inductance li is defined as

     Li
li ≡ μ-R∕2,
     0
(572)

where R is the surface averaged major radius. Using Eq. (571), expression (572) is written as

            ∫
    --1---2-   B2𝜃      -2V--- 2
li = μ0R∕2 I2 P 2μ0 dV = I2μ20R-⟨B𝜃⟩,
(573)

which is the definition of li used in the ITER design. Using the defintion of R, i.e.,

--  ∫
R = -∫RdS-=  -V--,
       dS    2πA
(574)

where A is the cross section of boundary flux surface, expression (573) is written as

    -4πA-   2
li = μ20I2⟨B 𝜃⟩.
(575)

Another way of defining the normalized internal inductance is

    ⟨B2𝜃⟩-
li = ⟨B2𝜃⟩s,
(576)

where s is the surface average over the plasma boundary. Using Ampere’s law, we obtain

               ( μ0I)2
⟨B2𝜃⟩S ≈ ⟨B 𝜃⟩2S =   -l-   .
(577)

Using this Eq. (576) is written as

     l2
li = -2-2⟨B2𝜃⟩
    μ0I
(578)

For circular cross section, l2 = 4πA. Then the above expression is written as

li = -4πA
μ20I2B𝜃2,

which agrees with Eq. (575).

The normalized internal inductance reflects the peakness of the current density profile in the toroidal plasma: smaller value of li corresponds to broader current profile.

A.11 Relation of plasma current density to pressure gradient

Due to the force balance condition, the plasma current is related to the plasma pressure gradient:

Jϕ = R dP-+--1--dg-g.                         (579)
      dΨ   μ0R dΨ
The parallel (to the magnetic field) current density is written as
J∥ ≡ J-⋅B-
      B
   = JϕB-ϕ +-Jp ⋅Bp
     (     B       )
      R dP+  -1-dgg  g-+ 1-dg(∇-Ψ)2
   = ---dΨ---μ0R-dΨ---R---μ0dΨ--R---
                [(  B)2  (   )2]
     gddPΨ + 1μ0 ddgΨ  gR- +  ∇ΨR-
   = -----------B-------------
     gdP + 1-dgB2
   = -dΨ---μ0dΨ---.
           B
   = gdP-1-+ -1-dgB.                                 (580)
      dΨ B   μ0 dΨ
For later use, define
    J
σ ≡ -∥
    B
  = gdP--12 +-1-dg.                          (581)
     dΨ B    μ0 dΨ
Equation (581) is used in GTAW code to calculate J∕B (actually calculated is μ0J∕B)[15]. Note that the expression for J∕B in Eq. (581) is not a magnetic surface function. Define σps as
σps ≡ σ − ⟨σ⟩
       dP [ 1   ⟨ 1 ⟩ ]
   = g dΨ- B2-−   B2-                          (582)
       ps
   ≡  J∥-,                                     (583)
      B
where Jps = gddPΨ[     ⟨   ⟩]
 1B-− B B12 is called Pfirsch-Schluter (PS) current. In cylindrical geometry, due to the poloidal symmetry, the Pfiersch-Schluter current is zero. In toroidal geometry, due to the poloidal asymmetry, the PS current is generally nonzero. Thus, this quantity characterizes a toroidal effect.

Another useful quantity is μ0J B, which is written as

μ ⟨J⋅B ⟩ = μ gdP-+-dg⟨B2⟩,                      (584)
 0         0 dΨ   dΨ
where is flux surface averaging operator.

A.12 Vacuum magnetic field (not finished)

In the vacuum region that is between the plasma and the first wall, there is no current, i.e.,

∇ × B = 0.
(585)

Next, let us examine what constraint this condition imposes on the magnetic field. Using expression  (10), the above equation is written as

∇ × (∇Ψ × ∇ϕ )+ ∇g × ∇ϕ = 0,
(586)

It is not obvious how to draw useful information from the above equation.

In the above, we use the vector potential approach. Next, let us try the scalar potential approach:

B = ∇ Φ,
(587)

then the constraint ∇⋅ B = 0 is written as

∇2Φ = 0.
(588)

A.13 Discussion about the poloidal current function, check!

 

[check***As discussed in Sec. (), the force balance equation of axisymmetric plasma requires that B ⋅∇g = 0. From this and the fact B ⋅∇Ψ = 0, we conclude that g is a function of Ψ, i.e., g = g(Ψ). However, this reasoning is not rigorous. Note the concept of a function requires that a function can not be a one-to-more map. This means that g = g(Ψ) indicates that the values of g must be equal on two different magnetic field lines that have the same value of Ψ. However, the two equations B⋅∇g = 0 and B⋅∇Ψ = 0 do not require this constraint. To examine whether this constraint removes some equilibria from all the possible ones, we consider a system with an X point. Inside one of the magnetic islands, we use

g = Ψ 2∕(B0R30),
(589)

and inside the another, we use

g = Ψ 3∕(B20R50),
(590)

Then solve the two GS equations respectively within the boundary of the two islands. It is easy to obtain two magnetic surfaces that have the same value of Ψ respectively inside the two islands. Equations (589) and (590) indicate that the values of g on the two magnetic surfaces are different from each other. It is obvious the resulting equilibrium that contain the two islands can not be recovered by directly solving a single GS equation with a given function g(Ψ).**check]

Note that, on both an irrational surface and a rational surface, there are infinite number of magnetic field lines that are not connected with each other (it is wrong to say there is only one magnetic field line on a irrational surface). Consider a field f that satisfies B⋅∇f = 0, the value f is a constant along any one of the magnetic field lines. Now comes the question: whether the values of f on different field lines are equal to each other? To answer this question, we can choose a direction different from B on the magnetic surface and examine whether Ψ is constant or not along this direction, i.e, whether k ⋅∇f equals zero or not, where k is the chosen direction. For axsiymmetric magnetic surfaces, it is ready to see that k = ˆϕ is a direction in the magnetic surface and it is usually not identical with B∕B. Then we obtain

                1 ∂f
k ⋅∇f = ˆϕ ⋅∇f = R-∂ϕ-.
(591)

If f is independent of ϕ, then k ⋅∇Ψ = 0. Then the fact that B ⋅∇f = 0 and the fact that B and k are two different directions on the magnetic surface, indicates that f is constant on the surface, i.e., the values of f on different field lines are equal to each other. If f is non-axisymmetric, then we know the values of f on different magnetic field lines on the same magnetic surface are not equal to each other. This is the case for the α coordinates discussed in Sec. ().

This reasoning is for the case of axsiymmetric magnetic surfaces. It is ready to do the same reasoning for non-axisymmetrica magnetic surface after we find a convenient direction k on the magnetic surface.

 

A.14 tmp  check!

(In practice, I choose the positive direction of 𝜃 and ϕ along the direction of toroidal and poloidal magnetic field (i.e., B ⋅∇ϕ and B ⋅∇𝜃 are always positive in (ψ,𝜃,ϕ) coordinates system). Then, the qlocal defined by Eq. (182) is always positive. It follows that qglobal should be also positive. Next, let us examine whether this property is correctly preserved by Eq. (188). Case 1: The radial coordinate ψ is chosen as Ψ′≡ dΨ∕dψ > 0. Then the factor before the integration in Eq. (188) is negative. We can further verify that 𝒥 is always negative for either the case that Ψ is pointing inward or outward. Therefore the .r.h.s. of Eq. (188) is always positive for this case. Case 2: The radial coordinate ψ is chosen as Ψ′≡ dΨ∕dψ < 0. Then the factor before the integration in Eq. (188) is positive. We can further verify that 𝒥 is always positive for either the case that Ψ is pointing inward or outward. The above two cases include all possibilities. Therefore, the positivity of qglobal is always guaranteed)

 

a magnetic surface forms a central hole around Z axis. Using Gauss’s theorem in the volume within the central hole, and noting that no magnetic field line point-intersects a magnetic surface, we know that the magnetic flux through any cross section of the hole is equal to each other. Next we calculate this magnetic flux. To make the calculation easy, we select a plane cross section perpendicular to the Z axis, as is shown by the dash line in Fig. (). In this case, only BZ contribute to the magnetic flux, which is written (the positive direction of the cross section is chosen in the direction of ˆeZ)

     ∫
       Rc
Ψp1 = 0  Bz(R,Zc )2πRdR
     ∫ Rc 1∂Ψ
   =     -----2πRdR
      0∫ RR ∂R
   = 2π   c ∂Ψ-dR
        0   ∂R
   = 2π[Ψ(Rc,Zc)− Ψ(0,Zc)].
Note that the axisymmetry requires that the axis of symmetry, Z axis, must be a magnetic field line. Since B ⋅∇Ψ = 0, it follows that the value of Ψ on the Z axis is a constant (denoted by Ψa below). Further note that the value of Ψ is constant on a magnetic surface. Thus, Ψp1 in Eq. (21) is written
Ψp1 = 2π(Ψ − Ψa).
(592)

be generalized to any revolution surface that is generated by rotating a curve segment on the poloidal plane around Z axis. For instance, a curve on the poloidal plane that connects the magnetic axis and a point on a flux surface can form a toroidal surface (e.g., surface S2 in Fig. 53). The magnetic flux through the toroidal surface S2 is given by

i.e.

Ψ − Ψ = Ψp1,
    a   2π
(593)

which indicates that the difference of Ψ between the Z axis and a magnetic surface is the poloidal magnetic flux per radian through the central hole, Ψp12π.

 

The magnetic surface forms a central hole around Z axis. The magnetic flux through any cross section of the central hole is equal to each other and is given by Ψp = 2π(Ψb Ψa), where Ψa and Ψb are the value of Ψ at the Z axis and the magnetic surface, respectively.

The conclusion in Eq. (592) can be generalized to any revolution surface that is generated by rotating a curve on the poloidal plane about Z axis. For instance, a curve on the poloidal plane that connects the magnetic axis and a point on a flux surface can form a toroidal surface (e.g., surface S2 in Fig. 53).

Also note the difference between Ψp and Ψp1 defined in Sec. 2.7: Ψp1 is the magnetic flux through the central hole of a torus and thus includes the flux in the center transformer, and Ψp is the magnetic flux through the ribbon between the magnetic axis and the magnetic surface.

A.15 Radial coordinate to be deleted

We know that the toroidal flux ψt, safety factor q, and the Ψ in the GS equation are related by the following equations:

dψ  = 2πqdΨ
  t
(594)

          ∫ Ψ
=⇒  ψt = 2π 0 qdΨ
(595)

Define:

   ∘ ψ--
ρ ≡  --t
      π
(596)

(In the Toray_ga code, the radial coordinate ρ is defined as

    ∘ -----
ρ ≡   -ψt-,
      πBt0
(597)

where Bt0 is a constant factor.ρ defined this way is of length dimension, which is an effective geometry radius obtained by approximating the flux surface as circular.)

 

I use Eq. (596) to define ρ. Then we have

      2
ψt = πρ
(598)

    dψ
=⇒  --t = 2πρ
     dρ
(599)

    dψ dψ
=⇒  --t---= 2πρ
    dψ dρ
(600)

       dψ-
=⇒  2πqdρ = 2πρ
(601)

    dψ    ρ
= ⇒ ---=  -
    dρ    q
(602)

Eq. (602) is used to transform between ψ and ρ.

=     1
∘------2--
  Φ∕πR 0B01
-
2  1
-----2
πB0R 0= 1
-
ρ1
-
2   1
-----2
πB0R 02πqdψ = 1
-
ρ  1
----2
B0R 0qdψ

=     2
ρB0R0-
  q(πa2)

 


pict

Fig. 40: to be delted, Isosurface of α = 2π∕8. The surface is made of a family of contours of α = 2π∕8, which are all magnetic field lines. These field lines are traced by starting from a series of points on the low-field-side midplane (𝜃 = 0) at different radial locations and the field lines are followed by a complete poloidal loop. Magnetic field from EAST discharge #59954@3.03s.

 

A.16 Toroidal elliptic operator in magnetic surface coordinate system

If (ψ,𝜃,ϕ) are magnetic surface coordinates, i.e., ∂Ψ∕∂𝜃 = 0, then the toroidal elliptic operator in Eq. (419) is reduced to

          [(          )    (             ) ]
  ⋆    R2-     𝒥--    2        -𝒥-
△  Ψ = 𝒥     ΨψR2 |∇ ψ|  ψ +  ΨψR2 ∇ψ ⋅∇ 𝜃 𝜃 ,
(603)

and the GS equation, Eq. (422), is reduced to

R2 [(   𝒥      )    (   𝒥        )  ]        dP    dg
---  Ψψ -2|∇ψ |2   +  Ψ ψ-2-∇ψ ⋅∇𝜃    = − μ0R2---−  --g(Ψ).
𝒥       R        ψ      R          𝜃         dΨ    dΨ
(604)

A.17 Grad-Shafranov equation in (r,𝜃,ϕ) coordinates

Definition of (r,𝜃,ϕ) coordinates

Define (r,𝜃,ϕ) coordinates by

R = R0 + rcos𝜃,
(605)

Z = rsin 𝜃,
(606)

where (R,ϕ,Z) are the cylindrical coordinates and R0 is a constant. The above transformation is shown graphically in Fig. 41.


pict

Fig. 41: The relation between coordinates (r,𝜃) and (R,Z).

The Jacobian of (r,𝜃,ϕ) coordinates can be calculated using the definition. Using x = R cosϕ, y = R sinϕ, and z = Z, the Jacobian (with respect to the Cartesian coordinates (x,y,z)) is written as

    |        |  |                   |
    ||∂∂xr ∂∂x𝜃 ∂∂xϕ||  ||∂R∂corsϕ ∂Rc∂o𝜃sϕ-∂R∂coϕsϕ||
𝒥 = ||∂y ∂y ∂y||= ||∂R-sinϕ ∂Rsinϕ-∂R-sinϕ||
    ||∂∂rz ∂∂𝜃z ∂∂ϕz||  ||  ∂∂rZ-    ∂∂Z𝜃-   ∂∂ϕZ- ||
    |∂r ∂𝜃 ∂ϕ      ∂r     ∂𝜃    ∂|ϕ
    ||cos𝜃cosϕ − rsin𝜃cosϕ − R sin ϕ||
  = ||cos𝜃sinϕ − rsin𝜃sinϕ R cosϕ ||
    |  sin𝜃     r cos 𝜃      0   |
  = sin 𝜃(− Rr sin𝜃 cos2ϕ − Rrsin𝜃sin2ϕ)
  + rcos𝜃(− R sin2 ϕcos𝜃− R cos2ϕcos𝜃)
           2        2
  = − Rrsin 𝜃− Rr cos𝜃
  = − Rr.                                             (607)
Toroidal elliptic operator ΔΨ in (r,𝜃,ϕ) coordinate system

Next, we transform the GS equation from (R,Z) coordinates to (r,𝜃) coordinates. Using the relations R = R0 + r cos𝜃 and Z = r sin𝜃, we have

    ∘--------------   ∂r   Z
r =  (R − R0)2 + Z2 ⇒ ---= --= sin𝜃
                      ∂Z    r
(608)

      -------Z-------        ∂𝜃-  r−-Z-Zr-
sin 𝜃 = ∘ (R-−-R-)2 +-Z2-⇒ cos𝜃 ∂Z =  r2   .
              0
(609)

   ∂𝜃     r− ZZ-    1− sin2 𝜃   cos2𝜃
⇒  ∂Z-= r(R-−-Rr) = -R-−-R--=  R-− R--
               0          0         0
(610)

∂ sin𝜃   r − ZZ-   1− sin2𝜃   cos2𝜃
------= ---2-r-=  --------= -----
  ∂Z       r         r        r
(611)

The GS equation in (R,Z) coordinates is given by

 2         (     )
∂-Ψ2 + R ∂- -1∂-Ψ  = − μ0R2dP-− -dgg(Ψ).
∂Z      ∂R  R ∂R           dΨ   dΨ
(612)

The term ∂Ψ∕∂Z is written as

∂ Ψ   ∂Ψ ∂r   ∂Ψ ∂ 𝜃
--- = ------+ ------
∂Z    ∂r ∂Z    ∂𝜃∂Z  2
    = ∂Ψ-sin 𝜃+ ∂Ψ--cos-𝜃.                       (613)
      ∂r       ∂ 𝜃R − R0
Using Eq. (613), 2Ψ∕∂Z2 is written as
∂2Ψ    ∂ ( ∂Ψ     )   ∂  (∂Ψ  cos2 𝜃 )
--2-= ---  ---sin 𝜃 +  --- ----------
∂Z    ∂Z   ∂r(   )    ∂Z  ∂ 𝜃R − R0         (    )         (       )
    = sin 𝜃 ∂-  ∂Ψ- + ∂Ψ--∂-(sin𝜃)+  cos2𝜃--∂-  ∂Ψ- +  ∂Ψ-∂-  -cos2-𝜃-
          ∂Z   ∂r    ∂r ∂Z         R− R0 ∂Z   ∂𝜃     ∂𝜃∂Z   R − R0
          (∂2Ψ        ∂2Ψ  cos2 𝜃)   ∂Ψ cos2𝜃   cos2𝜃 ( ∂2Ψ        ∂2Ψ cos2𝜃 )
    = sin 𝜃 -∂r2 sin𝜃+ ∂r∂𝜃R-−-R0- + -∂r--r-- + R-−-R0- ∂𝜃∂r-sin𝜃 + ∂𝜃2-R-− R0-
                            2
    − ∂Ψ----1--2 cos𝜃sin 𝜃 cos-𝜃-                                          (614)
      ∂ 𝜃R − R0          R − R0
         ∘ --------------
-∂r = -∂-  (R − R0)2 + Z2 = R-−-R0-= cos𝜃
∂R    ∂R                     r
(615)

sin𝜃 = ∘------Z--------
  (R − R0)2 + Z2.

cos𝜃∂𝜃
---
∂R = ZR − R
---3-0-
  r

∂𝜃-= − Z-.
∂R     r2
(616)

cos𝜃 =     R − R0
∘--------2----2-
  (R − R0 ) +Z

 ∂        r− R−R0(R − R0)   1− cos2𝜃   sin2𝜃
---cos𝜃 = -----r-2--------= -------- = -----
∂R              r               r        r
(617)

     (     )        [  (               )]
R-∂-  1-∂Ψ-  = R ∂-- 1-  ∂Ψ-∂r-+ ∂Ψ-∂𝜃-
 ∂R   R ∂R       ∂R [R ( ∂r ∂R   ∂𝜃 ∂R )]
             = R ∂-- 1-  ∂Ψ-cos𝜃 − ∂Ψ-Z-
                 ∂R  R   ∂r       ∂𝜃 r2
                ∂ ( ∂Ψ       ∂Ψ Z )     (∂Ψ        ∂Ψ Z )(   1 )
             = ∂R-  ∂r-cos𝜃− -∂𝜃r2  + R  -∂r cos𝜃 − ∂𝜃-r2  − R2-
               (  2        2     )                   (  2         2     )           (   )     (               )
             =   ∂-Ψ2-∂r + ∂-Ψ--∂𝜃  cos𝜃+ ∂Ψ--∂-cos𝜃−   ∂-Ψ--∂r-+ ∂-Ψ2-∂𝜃- -Z2 − ∂Ψ--∂-  Z2  − 1- ∂Ψ-cos𝜃 − ∂Ψ-Z2
               ( ∂r ∂R    ∂r∂𝜃∂R )       ∂r ∂R     (   ∂𝜃∂r ∂R   ∂𝜃  ∂R)  r    ∂𝜃 ∂R   r     R(   ∂r       ∂𝜃 r)
                 ∂2Ψ-      ∂2Ψ--Z        ∂-Ψsin2𝜃    ∂2Ψ--      ∂2Ψ-Z-  Z-  ∂Ψ-  1-       -1  ∂Ψ-      ∂-Ψ-Z
             =   ∂r2 cos𝜃 − ∂r∂𝜃r2 cos𝜃+  ∂r  r  −   ∂𝜃∂r cos 𝜃− ∂𝜃2 r2  r2 + ∂𝜃Z r32cos𝜃− R   ∂r cos𝜃−  ∂𝜃r2
               ∂2Ψ        ∂2Ψ sin2 𝜃    ∂2Ψ Z       ∂ Ψsin2𝜃   ∂Ψ  1
             = --2-cos2𝜃+ ---2--2--− 2------2 cos𝜃+-------- + --Z -32cos𝜃                                  (618)
               ∂r(        ∂ 𝜃  r    ) ∂r∂𝜃 r        ∂r  r     ∂𝜃  r
             − 1-  ∂Ψ-cos𝜃− ∂Ψ-1 sin𝜃                                                                       (619)
               R   ∂r       ∂ 𝜃r
Summing the the right-hand-side of Eq. (614) and the expression on line (618) yields
∂2Ψ-  ∂Ψ-1   1-∂2Ψ-
∂r2 +  ∂rr + r2∂ 𝜃2 .
(620)

Using these, the GS equation is written as

∂2Ψ-
 ∂r2+∂Ψ-
∂r1
r+-1
r2∂2Ψ-
 ∂𝜃2----1-----
R0 + rcos𝜃(                  )
  ∂Ψ-      ∂Ψ-1
  ∂r cos𝜃− ∂𝜃 r sin𝜃 = μ0(R0+r cos𝜃)2dP-
dΨdg-
dΨg(Ψ),

which can be arranged in the form

(               )              (                   )
 1 ∂---∂-  1--∂2     -----1----  ∂Ψ-      ∂-Ψ1                      2dP-  dg-
 r ∂rr∂r + r2∂𝜃2  Ψ− R0 + rcos𝜃  ∂r cos𝜃−  ∂𝜃r sin 𝜃 = − μ0(R0+r cos 𝜃)dΨ − dΨg(Ψ),
(621)

which agrees with Eq. (3.6.2) in Wessson’s book[29], where f is defined by f = RBϕ∕μ0, which is different from g RBϕ by a 1∕μ0 factor.

A.18 Large aspect ratio expansion

Consider the case that the boundary flux surface is circular with radius r = a and the center of the cirle at (R = R0,Z = 0). Consider the case 𝜀 = r∕R0 0. Expanding Ψ in the small parameter 𝜀,

Ψ = Ψ0 + Ψ1
(622)

where Ψ0 O(𝜀0), Ψ1 O(𝜀1). Substituting Eq. (622) into Eq. (621), we obtain

1
r∂--
∂rr∂Ψ0-
 ∂r+1
r∂--
∂rr∂Ψ1-
 ∂r+-1
r2∂2Ψ0
 ∂𝜃2+-1
r2∂2Ψ1
∂𝜃2----1-----
R0 + rcos𝜃(                   )
 ∂-Ψ0      ∂-Ψ01
  ∂r cos𝜃−  ∂𝜃 r sin𝜃-----1----
R0 + rcos𝜃(                    )
  ∂Ψ1-      ∂Ψ1-1
   ∂r cos𝜃−  ∂𝜃 r sin𝜃 = μ0(R0+r cos𝜃)2P(Ψ 0+Ψ1)g(Ψ0+Ψ1)g(Ψ0+Ψ1)

Multiplying the above equation by R02, we obtain

 21 ∂  ∂Ψ0   2 1∂  ∂Ψ1    21 ∂2Ψ0   2 1∂2Ψ1      R20     (∂Ψ0       ∂Ψ0 1    )      R20    ( ∂Ψ1       ∂Ψ1 1    )        2          2 ′          2′
R0r ∂rr-∂r +R 0 r∂rr-∂r-+R 0r2∂-𝜃2 +R 0r2-∂𝜃2 −R0-+-rcos𝜃-∂r-cos𝜃− -∂𝜃-r sin𝜃 − R0-+-rcos𝜃 ∂r--cos𝜃 − -∂𝜃-r sin 𝜃 = − μ0R 0(R0+r cos𝜃) P (Ψ0+ Ψ1)−
(623)

Further assume the following orderings (why?)

  ∂ Ψ
R0--- ∼ O(𝜀−1)Ψ,
   ∂r
(624)

and

∂Ψ
---∼ O (𝜀0)Ψ.
∂𝜃
(625)

Using these orderings, the order of the terms in Eq. (623) can be estimated as

 21-∂- ∂Ψ0-  Ψ0-     −2
R0r∂r r∂r  ∼ 𝜀2 ∼ O(𝜀  )
(626)

  1 ∂  ∂Ψ    Ψ
R20----r--1-∼ -12-∼ O(𝜀−1)
  r∂r  ∂r    𝜀
(627)

  1 ∂2Ψ     1
R20-2---02 ∼ -2Ψ0 ∼ O(𝜀−2)
  r  ∂𝜃    𝜀
(628)

  21-∂2Ψ1   Ψ1-     −1
R 0r2 ∂𝜃2 ∼ 𝜀2 ∼ O(𝜀  )
(629)

    R            r
------0--- ≈ 1− ---cos𝜃
R0 + rcos𝜃      R0
(630)

  ∂ Ψ        Ψ
R0---0cos𝜃 ∼ -0∼ O (𝜀−1)
   ∂r        𝜀
(631)

   ∂Ψ01       Ψ0-     −1
R0 ∂𝜃 r sin 𝜃 ∼ 𝜀 ∼ O (𝜀  )
(632)

   ∂Ψ        Ψ
R0 --1-cos 𝜃 ∼-1-= O (𝜀0)
    ∂r        𝜀
(633)

  ∂ Ψ 1       Ψ
R0---1-sin𝜃 ∼ -1-= O(𝜀0)
   ∂𝜃 r       𝜀
(634)

The leading order (𝜀2 order) balance is given by the following equation:

  21-∂- ∂Ψ0-   21-∂2Ψ0        4 ′       2 ′
R 0r∂r r∂r + R 0r2 ∂𝜃2 = − μ0R 0P (Ψ0) − R0g(Ψ0)g(Ψ0),
(635)

It is reasonable to assume that Ψ0 is independent of 𝜃 since Ψ0 corresponds to the limit a∕R 0. (The limit a∕R 0 can have two cases, one is r 0, another is R →∞. In the former case, Ψ must be independent of 𝜃 since Ψ should be single-valued. The latter case corresponds to a cylinder, for which it is reasonable (really?) to assume that Ψ0 is independent of 𝜃.) Then Eq. (635) is written

1∂-r∂Ψ0-= − μ R2P ′(Ψ )− g′(Ψ )g(Ψ ).
r∂r  ∂r      0 0    0      0    0
(636)

(My remarks: The leading order equation (636) does not corresponds strictly to a cylinder equilibrium because the magnetic field B = Ψ0 ×∇ϕ + gϕ depends on 𝜃.) The next order (𝜀1 order) equation is

R021
r-∂-
∂rr∂-Ψ1
 ∂r+R021-
r2∂2Ψ1
∂ 𝜃2R0∂Ψ0-
 ∂rcos𝜃 = μ0R022R 0r cos𝜃P(Ψ0)μ0R04P′′(Ψ 0)Ψ1R02[g(Ψ 0)g(Ψ0)]Ψ1

  1 ∂  ∂Ψ1     1 ∂2Ψ1                                                         ∂Ψ0
R20r ∂rr-∂r +R20 r2-∂𝜃2-+{μ0R40P′′(Ψ0)+R20[g′(Ψ0)g(Ψ0)]′}Ψ1 = − μ0R202R0rcos𝜃P ′(Ψ0)+R0 ∂r-cos𝜃
(637)

  1 ∂  ∂Ψ      1 ∂2Ψ   d                           dr                             ∂Ψ
R20- --r--1+R20 2---21+ --{μ0R40P ′(Ψ0)+R20g′(Ψ0)g(Ψ0)}---Ψ1 = − μ0R202R0rcos𝜃P′(Ψ0)+R0 --0cos𝜃
  r ∂r  ∂r     r ∂𝜃    dr                         dΨ0                             ∂r
(638)

It is obvious that the simple poloidal dependence of cos𝜃 will satisfy the above equation. Therefore, we consider Ψ1 of the form

         dΨ (r)
Ψ1 = Δ(r)--0---cos𝜃,
           dr
(639)

where Δ(r) is a new function to be determined. Substitute this into the Eq. (), we obtain an equation for Δ(r),

  1 d (  dΨ dΔ      d2Ψ )     1  dΨ (r)  d                           dr  dΨ (r)                      dΨ
R20- --  r--0---+ rΔ ---02  − R20 2-Δ--0--+ --{μ0R40P ′(Ψ0)+R20g′(Ψ0)g(Ψ0)}---Δ --0---= − μ0R202R0rP ′(Ψ0)+R0 --0-
  r dr   dr  dr      dr       r    dr    dr                         dΨ0    dr                        dr
(640)

      (        )        (    2   )
R201 d-  rdΨ0dΔ- +R201 d-  rΔd-Ψ0  − R20 1-Δ dΨ0(r)+-d{μ0R40P′(Ψ0)+R20g′(Ψ0)g(Ψ0)}Δ = − μ0R202R0rP ′(Ψ0)+R0 dΨ0
  r dr   dr  dr     r dr     dr2      r2    dr    dr                                                 dr
(641)

      (        )          (      )
 21 d-   dΨ0dΔ-      21-d   d2Ψ0     2d2Ψ0dΔ-   2-1  dΨ0(r) -d     4 ′      2 ′                 2      ′       dΨ0-
R0r dr  rdr  dr + ΔR 0rdr  r dr2  +R 0dr2  dr − R0r2Δ  dr  +dr{μ0R 0P (Ψ0)+R 0g(Ψ0)g(Ψ0)}Δ  = − μ0R02R0rP (Ψ0)+R0  dr
(642)

  1 d (  dΨ dΔ )      [1 d (  d2Ψ )   1 dΨ (r)]    d2Ψ dΔ   d                                                 dΨ
R20- --  r--0--- + ΔR20 - --  r--20  − -2--0--- +R20--20---+ --{μ0R40P′(Ψ0)+R20g′(Ψ0)g(Ψ0)}Δ = − μ0R202R0rP′(Ψ0)+R0--0-
  r dr   dr  dr        r dr   dr      r   dr       dr  dr   dr                                                 dr
(643)

Using the identity

d
dr[1 d (  dΨ0)]
 r dr r dr-- = 1
r d
dr( d2Ψ0 )
 r-dr2 1
r2dΨ0(r)
-dr---,

equation () is written as

 21 d (  dΨ0dΔ )     2d [ 1 d ( dΨ0) ]   2d2Ψ0dΔ   d     4  ′     2 ′                  2     ′       dΨ0
R0r dr  rdr--dr + ΔR 0dr  rdr  r-dr-  +R 0dr2-dr-+ dr{μ0R0P (Ψ0)+R0g (Ψ0)g(Ψ0)}Δ = − μ0R 02R0rP (Ψ0)+R0-dr-
(644)

Using the leading order equation (), we know that the second and fourth term on the l.h.s of the above equation cancel each other, giving

   1 d ( dΨ  dΔ)      d2Ψ dΔ                        dΨ
R20---  r--0---- + R20--20---= − μ0R202R0rP ′(Ψ0)+ R0 --0-
   rdr    dr dr       dr  dr                        dr
(645)

       (        )
⇒  1-d  rdΨ0-dΔ- +  d2Ψ0-dΔ-= − μ 2R rP′(Ψ )+ -1-dΨ0-
   rdr    dr dr     dr2 dr      0  0     0   R0 dr
(646)

Using the identity

       [ (    )     ]      (        )
1-dr-d     dΨ0- 2 dΔ    1d-   dΨ0dΔ-    d2Ψ0 dΔ-
rdΨ0dr  r  dr    dr  =  rdr  r dr dr  +  dr2 dr ,
(647)

equation (646) is written

       [            ]
1 dr d   ( dΨ0)2 dΔ              ′      1 dΨ0
rdΨ--dr r  -dr-  dr- = − μ02R0rP (Ψ0)+ R---dr ,
   0                                     0
(648)

   1 d [ ( dΨ )2 dΔ]           dP    1 ( dΨ )2
⇒  ---  r  --0-  --- = − μ02R0r---+ ---  --0-  ,
   rdr     dr    dr            dr   R0   dr
(649)

Using

B  =  1-dΨ0-
 𝜃0   R0 dr
(650)

equation (649) is written

1 d [    dΔ ]        1  dP   B2
r dr rB2𝜃0-dr  = − μ02R-rdr-+ -R𝜃0.
                      0        0
(651)

     [       ]      (                  )
⇒  d- rB2𝜃0dΔ- = -r- − 2μ0rdP-(Ψ0) + B2𝜃0 ,
   dr      dr    R0          dr
(652)

which agrees with equation (3.6.7) in Wessson’s book[29].

A.19 (s,α) parameters

The normalized pressure gradient, α, which appears frequently in tokamak literature, is defined by[3]

            1   dp
α = − R0q2 B2∕2μ-dr ,
           0   0
(653)

which can be further written

          dp
α = − R0q2--,
          dr
(654)

where p = p∕(B022μ0). Equation (654) can be further written as

     1  2dp
α = − 𝜀aq dr,
(655)

where 𝜀a = a∕R0, r = r∕a, and a is the minor radius of the boundary flux surface. (Why is there a q2 factor in the definition of α?)

The global magnetic shear s is defined by

   r dq
s =- --,
   q dr
(656)

which can be written

   -
s = r dq.
   q dr
(657)

In the case of large aspect ratio and circular flux surface, the leading order equation of the Grad-Shafranov equation in (r,𝜃) coordinates is written

1 d-rdΨ-= − μ0R0Jϕ(r),
r dr dr
(658)

which gives concentric circular flux surfaces centered at (R = R0,Z = 0). Assume that Jϕ is uniform distributed, i.e., |Jϕ| = I∕(πa2), where I is the total current within the flux surface r = a. Further assume the current is in the opposite direction of ϕ, then Jϕ = I∕(πa2). Using this, Eq. (658) can be solved to give

     μ0I    2
Ψ = 4πa2R0r  .
(659)

Then it follows that the normalized radial coordinate ρ (Ψ Ψ0)(Ψb Ψ0) relates to r by r = √-
 ρ  (I check this numerically for the case of EAST discharge #38300). Sine in my code, the radial coordinate is Ψ, I need to transform the derivative with respect to r to one with respect to Ψ, which gives

     1 2dp     1 2-dp-    1 2dp -1--    1 2 dp-1--
α = − 𝜀q dr = − 𝜀q d√ρ = − 𝜀q dρ 2√ρ = − 𝜀q dΨ 2√ρ(Ψb − Ψ0).
(660)

    rdq   √ρ dq  1             1 dq
s = qdr = -q-dΨ-2√ρ-(Ψb − Ψ0) = 2qdΨ-(Ψb − Ψ0).
(661)

The necessary condition for the existence of TAEs with frequency near the upper tip of the gap is given by[3]

α < − s2 + 𝜀,
(662)

which is used in my paper on Alfvén eigenmodes on EAST tokamak[15]. Equations (660) and (661) are used in the GTAW code to calculate s and α.

B Computing magnetic field generated by coils

Magnetic field (e.g., equilibrium poloidal field, RMP field, ripple field) and vector potential generated by coils can be calculated in the following way.

B.1 Magnetic field

The Biot-Savart law for a zero-thinkness wire is given by

       μ0-∫  dl(r′)×-(r−-r′)
B (r) = 4π  I   |r− r′|3   ,                      (663)
where dl(r) is a line element along the wire (the freedom of choosing which one of the two possible directions along the wire is up to users), I is the current in the wire (I is positive if the current in the same direction of dl, otherwise, negative).

B.2 Magnetic vector potential

Given a current source J(r,t), the vector potential can be calculated using

        μ  ∫ J (r′,t′)
A(r,t) = -0-  -----′-d3r′,
        4π  Ω |r − r |
(664)

where

 ′     |r-−-r′|
t = t−   c   ,
(665)

is called the retarded time. For a steady-state source, J(r,t) = J(r). Then Eq. (664) is simplified as

      μ0 ∫   J(r′)
A(r) = 4π   |r-−-r′|d3r′.
          Ω
(666)

For a current flowing in a thin wire, the above equation is written as

       μ  ∫  J(r′)
A (r) =-0-  -----′dS (r′)dl(r′),
       4π   |r− r |
(667)

where dS is a surface element perpendicular to the wire and dl is a line element along the wire. Using J(r)dS(r) = I(r), the above eqaution is written as

          ∫
       μ0-  -I(r′)-    ′
A (r) = 4π   |r− r′| dl(r)
       μ0 ∫  I(r′)    ′
     = 4π-  |r−-r′|dl(r ).                       (668)
In cylindrical coordinates, the toroidal component of A, Aϕ A eϕ(r), is written as
        μ ∫  I(r′)
Aϕ(r) =--0   ----′-dl(r′)⋅eϕ(r).
       4π    |r− r |
(669)

(Aϕ is needed in several applications. In solving the free-boundy equilibrium problem, we need to calculate Aϕ generated by the PF coils. In studying the effects of RMP on particles, we need to calculate Pϕ, the canonical toroidal angular momentum, whose defintion involves Aϕ. Then we need to calculate Aϕ generated by the RMP coils.)

B.3 For wires along toroidal direction

For a curve along the toroidal direction, the line element dl in terms of the cylindrical basis is written as dl= Rˆeϕ. Using Cartesian coordinate basis vectors, dlis written as

dl′ = R ′dϕ′(− sinϕ′ˆex + cosϕ′ˆey),
(670)

and

 ′   ′    ′ˆ    ′    ′ˆ     ′ˆ
r = R cosϕ ex + R sin ϕey + Z ez
(671)

where a global Cartesian coordinates with x axis in ϕ = 0 plane is assumed.

Let us consider a full toroidal coil at (R,Z)with current I (a filamentary current loop). Since the problem is symmetric, the magnetic field/potential is independent of ϕ. For calculation ease, we select ϕ = 0 plane and calculate A and B values in this plane. Then

eϕ(r) = ˆey,
(672)

r = Rˆex + 0ˆey + Zˆez,
(673)

Using these, we obtain

  ′         ′  ′    ′
dl ⋅eϕ(r) = R dϕ cosϕ.
(674)

and Eq. (669) is written as

                μ0I∫ 2π              R ′cosϕ ′dϕ′
A ϕ(R, Z,ϕ = 0) = 4π     ∘-------′2--------′----′2-----′---′2-.
                     0    (Z − Z ) + (R − R cosϕ) + (R sinϕ )
(675)

Sine Aϕ is axsymmetric, the above formula applies to all values of ϕ. Multiply Aϕ by R and set I = 1, we get Green’s function of Ψ:

  G(R ′,Z′,R,Z )

= RA ϕ∫
  μ0-  2π -------------RR-′cosϕ-′dϕ′-------------
= 4π  0  ∘ (Z-− Z-′)2 +-(R-−-R′cosϕ′)2-+-(R-′sinϕ′)2
     ∫ 2π              ′    ′ ′
= μ0-    ∘---------RR--cosϕ-dϕ-----------.                 (676)
  4π  0    (Z − Z ′)2 + R2+R ′2 − 2RR ′cosϕ′
This expression can be directly used in numerical codes to compute the Green function table. One can also write the above integration to the elipitic integrals and use library to compute these inegreals. Let us write the above expresion in this form. Define 𝜃 = (π ϕ)2, then cosϕ= cos(π 2𝜃) = cos(2𝜃) = 2sin2𝜃 1. Using this Eq. (676) is written as
  G (R ′,Z ′,R,Z )
  μ0 ∫ −π∕2         − 2RR ′(2sin2 𝜃− 1)d𝜃
= 4π-      ∘------------------------------------
      π∕2    (Z − Z′)2 + R2+R ′2 − 2RR ′(2sin2𝜃 − 1)
  μ  ∫ π∕2          4RR ′(2sin2 𝜃− 1)d𝜃
= --0     ∘------------------------------------
  4π  0     (Z − Z ′)2 + R2+R ′2 − 2RR ′(2 sin2𝜃 − 1)
     ∫ π∕2           ′    2
= μ0-     ∘-------4RR-(2sin--𝜃−-1)d𝜃---------                (677)
  4π  0     (Z − Z ′)2 + (R + R′)2 − 4RR ′sin2𝜃
Define
            4RR ′
k2 = ------′2--------′2-
     (Z − Z ) + (R + R )
(678)

Then

  G (R ′,Z ′,R,Z )
     ∫ π∕2            ′   2
= μ0-     ∘-------4RR-(2sin--𝜃−∘1)d𝜃--------
  4π  0     (Z − Z ′)2 + (R + R′)2 1 − k2sin2𝜃
     √----∫ π∕2     2
= μ0- RR ′     k(∘2sin--𝜃−-1)d𝜃
  2π      [0      1− k2sin2𝜃                       ]
  μ0 √RR-  ∫ π∕2   2 − k2       ∫ π∕2 2− 2k2sin2𝜃
= 2π---k--      ∘-----2---2-d𝜃 −     ∘------2--2- d𝜃
     √--- [ 0     1− k sin 𝜃     0     1 − k sin 𝜃   ]
  μ0--RR-- ∫ π∕2---2-−-k2---      ∫ π∕2∘ -----2--2-
= 2π   k    0   ∘1-−-k2sin2𝜃d𝜃 − 2 0    1 − k sin 𝜃d𝜃
     √----
= μ0--RR-′[(2 − k2)K (k)− 2E(k)].                                (679)
  2π   k
where
E(k) = 0π∕2∘ ----2---2-
  1− k sin 𝜃d𝜃,

K(k) = 0π∕2      1
∘---------2-
  1 − k2sin 𝜃d𝜃

are the eliptic integrals of the first and second kind.

Similarly, we can calculate the magnetic field:

           ∮
B (r) = μ0I  dl′ ×-(r-−-r′),                      (680)
        4π     |r− r′|3
where the cross product is written as
             |                            |
             ||     ˆex        eˆy       ˆez  ||
dl′ × (r− r′) = ||− R′dϕ′sinϕ ′ R′dϕ′cos ϕ′ 0 ||
             |R − R ′cosϕ ′ − R′sin ϕ′ Z − Z ′|
           = ˆexR ′dϕ ′cosϕ′(Z − Z ′) +eˆyR ′dϕ ′sinϕ′(Z − Z ′)
                ( ′2     ′    ′)   ′
           + ˆez  R  − RR  cosϕ  dϕ
The ˆeR(r) and ˆeZ(r) components of the above result are written as
ˆeR dl′× (r r) = R(Z Z)cosϕ

ˆeZ dl′× (r r) = (  ′2     ′    ′)
 R   − RR cosϕ

Using these in Eq. (680), BR(r) and BZ(r) are written as

         ∫ 2π               ′     ′     ′
BR  = μ0I     (-----------R-(Z-−-Z-)csoϕ-----------)--dϕ′,
      4π  0    ∘ (Z-−-Z-′)2 +-(R-−-R′cosϕ′)2-+(R-′sinϕ′)2 3
      μ0I∫ 2π -------------R′2 −-RR-′cosϕ′------------  ′
BZ  = 4π  0   (∘ ------′2--------′----′2-----′---′-2)3 dϕ,
                 (Z − Z ) + (R − R cosϕ)  +(R sinϕ )
Dropping I in the above expressions gives the corresponding Green’s function:
      ′  ′        μ0∫ π           R′(Z − Z ′)cosϕ′            ′
GBR (R ,Z ,R, Z) = 2π 0  (∘------------------------------)3dϕ ,    (681)
                           (Z − Z ′)2 + R2+R ′2 − 2RR ′cosϕ′
                    ∫ π             2
G   (R′,Z ′,R, Z) =-μ0    (---------R′-−-RR-′cosϕ′--------)-dϕ′,    (682)
  BZ             2π  0   ∘ ------′2----2---′2------′----′ 3
                           (Z − Z ) + R +R  − 2RR  cosϕ

One can also try to write the above formula to eliplicity integral form. The ressult is not compact as the above formula. So I directly use Eqs. (681) and (682) in HEQ code. Alternatively, one can directly take the finite difference of G to get GBR and GBZ in a numerical code.

 

B.4 For wires in poloial plane

For a curve in the poloidal plane, the line element dl in terms of the cylindrical basis is written as dl = dRˆeR(ϕ) + dZˆez. Using Cartesian coordinate basis vectors, dl is written as

dl = dR cosϕˆex +dR sin ϕˆey + dZ ˆez.
(683)

Using Eq. (683) and (), we obtain

            |                     |
            ||   ˆex     ˆey     ˆez  ||
dl× (r − r′) = ||dR cosϕ dR sinϕ dZ   ||.
            |(x − x ′) (y − y′) (z − z′)|
(684)

C About this document

This document initially contains notes I took when learning tokamak equilibrium theory. As a result of the on-going learning, the document is evolving. I enjoy seeing the continuous improvement of this document over a long time scale (10 years). Most of the content is elementary but I still found I got something totally wrong in the first version. Let me know if you spot something specious.

This document was written by using TeXmacs[27], a structured wysiwyw (what you see is what you want) editor for scientists. The HTML version is generated by first converting the TeXmacs file to TeX format and then using htlatex to convert the TeX to HTML.

References

[1]    R Aymar, P Barabaschi, and Y Shimomura. The ITER design. Plasma Physics and Controlled Fusion, 44(5):519–565, apr 2002.

[2]    M. A. Beer, S. C. Cowley, and G. W. Hammett. Field-aligned coordinates for nonlinear simulations of tokamak turbulence. Phys. Plasmas (1994-present), 2(7):2687–2700, 1995.

[3]    H. L. Berk, J. W. Van Dam, D. Borba, J. Candy, G. T. A. Huysmans, and S. Sharapov. More on core localized toroidal alfvén eigenmodes. Phys. Plasmas, 2(9):3401–3406, 1995.

[4]    Allen H. Boozer. Physics of magnetically confined plasmas. Rev. Mod. Phys., 76:1071–1141, Jan 2005.

[5]    R. Gallix, C. Jong, J. Knaster, N. Mitchell C. Sborchia, Y. Fu. Design and specifications of the iter tf coils. IEEE TRANSACTIONS ON APPLIED SUPERCONDUCTIVITY,, 18(2):463, 2008.

[6]    Yang Chen and Scott E. Parker. A delta-f particle method for gyrokinetic simulations with kinetic electrons and electromagnetic perturbations. Journal of Computational Physics, 189(2):463–475, 2003.

[7]    Yang Chen and Scott E. Parker. Electromagnetic gyrokinetic δf particle-in-cell turbulence simulation with realistic equilibrium profiles and geometry. Journal of Computational Physics, 220(2):839–855, 2007.

[8]    Yang Chen, Scott E. Parker, J. Lang, and G.-Y. Fu. Linear gyrokinetic simulation of high-n toroidal alfvén eigenmodes in a burning plasma. Phys. Plasmas, 17(10):102504, 2010.

[9]    Fu Peng, Gao Ge Chen Yuan-Yang, Bao Xiao-Hua. Plasma shape optimization for east tokamak using orthogonal method. Chinese Physics B, 28(1):15201, 2019.

[10]    C.Z Cheng and M.S Chance. Nova: a nonvariational code for solving the mhd stability of axisymmetric toroidal plasmas. J. of Comput. Phys., 71(1):124–146, 1987.

[11]    J DeLucia, S.C Jardin, and A.M.M Todd. An iterative metric method for solving the inverse tokamak equilibrium problem. Journal of Computational Physics, 37(2):183–204, 1980.

[12]    A. M. Dimits. Fluid simulations of tokamak turbulence in quasiballooning coordinates. Phys. Rev. E, 48:4070–4079, Nov 1993.

[13]    T. Görler, N. Tronko, W. A. Hornsby, A. Bottino, R. Kleiber, C. Norscini, V. Grandgirard, F. Jenko, and E. Sonnendrücker. Intercode comparison of gyrokinetic global electromagnetic modes. Physics of Plasmas, 23(7):72503, 2016.

[14]    J. van der Hoeven et al. GNU TeXmacs. https://www.texmacs.org, 1998.

[15]    Youjun Hu, Guoqiang Li, N. N. Gorelenkov, Huishan Cai, Wenjun Yang, Deng Zhou, and Qilong Ren. Numerical study of alfvén eigenmodes in the experimental advanced superconducting tokamak. Phys. Plasmas, 21(5):0, 2014.

[16]    Stephen C. Jardin. Computational methods in plasma physics. CRC Press, 2010.

[17]    Young Mu Jeon. Development of a Free-boundary Tokamak Equilibrium Solver for Advanced Study of Tokamak Equilibria. Journal of the Korean Physical Society, 67(5):843–853, 09 2015.

[18]    L.L. Lao, H. St. John, R.D. Stambaugh, A.G. Kellman, and W. Pfeiffer. Reconstruction of current profile parameters and plasma shapes in tokamaks. Nucl. Fusion, 25(11):1611, 1985.

[19]    G.S. Lee, M. Kwon, C.J. Doh, B.G. Hong, K. Kim, M.H. Cho, W. Namkung, C.S. Chang, Y.C. Kim, J.Y. Kim, H.G. Jhang, D.K. Lee, K.I. You, J.H. Han, M.C. Kyum, J.W. Choi, J. Hong, W.C. Kim, B.C. Kim, J.H. Choi, S.H. Seo, H.K. Na, H.G. Lee, S.G. Lee, S.J. Yoo, B.J. Lee, Y.S. Jung, J.G. Bak, H.L. Yang, S.Y. Cho, K.H. Im, N.I. Hur, I.K. Yoo, J.W. Sa, K.H. Hong, G.H. Kim, B.J. Yoo, H.C. Ri, Y.K. Oh, Y.S. Kim, C.H. Choi, D.L. Kim, Y.M. Park, K.W. Cho, T.H. Ha, S.M. Hwang, Y.J. Kim, S. Baang, S.I. Lee, H.Y. Chang, W. Choe, S.G. Jeong, S.S. Oh, H.J. Lee, B.H. Oh, B.H. Choi, C.K. Hwang, S.R. In, S.H. Jeong, I.S. Ko, Y.S. Bae, H.S. Kang, J.B. Kim, H.J. Ahn, D.S. Kim, C.H. Choi, J.H. Lee, Y.W. Lee, Y.S. Hwang, S.H. Hong, K.-H. Chung, D.-I. Choi, and KSTAR Team. Design and construction of the KSTAR tokamak. Nuclear Fusion, 41(10):1515–1523, oct 2001.

[20]    G Q Li, Q L Ren, J P Qian, L L Lao, S Y Ding, Y J Chen, Z X Liu, B Lu, and Q Zang. Kinetic equilibrium reconstruction on east tokamak. Plasma Phys. Controlled Fusion, 55(12):125008, 2013.

[21]    J.L. Luxon. A design retrospective of the DIII-D tokamak. Nuclear Fusion, 42(5):614–633, may 2002.

[22]    R. L. Miller, M. S. Chu, J. M. Greene, Y. R. Lin-Liu, and R. E. Waltz. Noncircular, finite aspect ratio, local equilibrium model. Phys. Plasmas, 5(4):973–978, 1998.

[23]    M. Ottaviani. An alternative approach to field-aligned coordinates for plasma turbulence simulations. Physics Letters A, 375(15):1677–1685, 2011.

[24]    S.A. Sabbagh, A.C. Sontag, J.M. Bialek, D.A. Gates, A.H. Glasser, J.E. Menard, W. Zhu, M.G. Bell, R.E. Bell, A. Bondeson, C.E. Bush, J.D. Callen, M.S. Chu, C.C. Hegna, S.M. Kaye, L.L. Lao, B.P. LeBlanc, Y.Q. Liu, R. Maingi, D. Mueller, K.C. Shaing, D. Stutman, K. Tritz, and C. Zhang. Resistive wall stabilized operation in rotating high beta nstx plasmas. Nucl. Fusion, 46(5):635, 2006.

[25]    I. Song, C. Choi, and M. Cho. Quench protection system for the superconducting coil of the kstar tokamak. IEEE Transactions on Applied Superconductivity, 17(1):1–6, March 2007.

[26]    Youwen Sun. Tokamak geometry and equilibrium. http://theory.ipp.ac.cn/~yj/other/TOKAMAK_geometry_and_equilibrium_Youwen_Sun_201208.pdf, 2012. [Online; Institute of Plasma Physics, Chinese Academy of Sciences].

[27]    Joris van der Hoeven. Gnu texmacs, a structured wysiwyw (what you see is what you want) editor for scientists. http://www.texmacs.org/, 2007. [Online].

[28]    W. X. Wang, Z. Lin, W. M. Tang, W. W. Lee, S. Ethier, J. L. V. Lewandowski, G. Rewoldt, T. S. Hahm, and J. Manickam. Gyro-kinetic simulation of global turbulent transport properties in tokamak experiments. Physics of Plasmas, 13(9):92505, 2006.

[29]    John Wesson. Tokamaks. Oxford University Press, 2004.

[30]    R. B. White and M. S. Chance. Hamiltonian guiding center drift orbit calculation for plasmas of arbitrary cross section. The Physics of Fluids, 27(10):2455–2467, 1984.

[31]    B J Xiao, D A Humphreys, and M L Walker. East plasma control system. Fusion Engineering and Design, 83:181, 2008.

[32]    B. J. Xiao. The first diverted plasma on east tokamak. 34th EPS Conference on Plasma Phys, 2007.