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 Numerical methods of reconstructing equilibrium magnetic field
 7 Fixed boundary equilibrium and choices of coordinates
 8 Curvilinear coordinate system
 9 Covariant/contravariant representation of equilibrium magnetic field
 10 Magnetic surface coordinates (ψ,𝜃,ϕ)
 11 Constructing magnetic surface coordinate system from discrete Ψ(R,Z) data
 12 Constructing model tokamak magnetic field
 13 Magnetic surface averaging
 14 Magnetic coordinates (ψ,𝜃,ζ) with general toroidal angle ζ
 15 Field-line-following coordinates
 16 Concentric-circular magnetic configuration with a given safety factor profile
 17 Fixed boundary tokamak equilibrium problem
 18 Misc contents
 A
 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 called heq (github.com/youjunhu/heq).

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, 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 nature of magnetic field, 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. In cylindrical coordinates (R,ϕ,Z), the above expression is written

    ( 1∂A     ∂A  )    ( 1 ∂(RA  )   1∂A  )     (∂A     ∂A  )
B =   ----Z − ---ϕ Rˆ +  -------ϕ-− -----R  ˆZ +  ---R − --Z-  ˆϕ.
      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)

      1 ∂Ψ
BZ =  ----.
      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 ⋅  ∂RRˆ+  ∂ZZˆ

      = − 1-∂Ψ-∂Ψ-+ 1-∂Ψ-∂Ψ-
          R ∂Z ∂R   R ∂R ∂Z
      = 0.                                         (7)
]

The function Ψ is usually called the “poloidal flux function” in tokamak literature because Ψ can be 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
     1R ∂Z     R ∂R
   = --∇Ψ × ˆϕ
     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, which means 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

            g
Bϕ = Bϕϕˆ=  Rˆϕ = g∇ ϕ.
(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 the vector potential 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 Ψ has the same gauge transformation as the electric potential, i.e., adding a constant. 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). However, we are usually interested in the situation where Aϕ is finite at R = 0 (and axisymmetry indicates that Aϕ(R = 0,Z) is a spatial constant). In this case, Ψ is zero at R = 0. This is the case we encounter in equilibrium reconstruction, where magnetic flux measurements are used to constrain the numerically reconstructed Ψ.

2.5 Contours of Ψ in the poloidal plane

Because Ψ is constant along a magnetic field line and Ψ is independent of ϕ, it follows that the projection of a magnetic field line onto (R,Z) plane is a contour of Ψ. On the other hand,  are contours of Ψ on (R,Z) plane also the projections of magnetic field lines onto the plane? Yes, they are. [Proof. A contour of Ψ on (R,Z) plane satisfies

dΨ = 0,
(15)

i.e.,

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

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

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

BZdR  − BRdZ = 0,
(18)

i.e.,

dZ    BZ
dR-=  B--,
       R
(19)

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

2.6 Magnetic surfaces

For axial symmetry system, magnetic surfaces can be defined in a trivial way. The axial symmetry of tokamak magnetic field allows us to introduce a surface of revolution that is generated by rotating the projection of a magnetic field line on (R,Z) plane around the axis of symmetry, Z axis. The unique property of this revolution surface is that no field line point-intersects it and a field line with one point on it will have the whole field line on it. This revolution surface can be called a magnetic surface. For instance, consider an arbitrary magnetic field line, whose projection on the poloidal plane is shown in Fig. 1. A magnetic surface is generated by rotating the projection line around the Z axis (some people disagree with this defintion since they only consider toroidal surfaces that are closed within a tokamak vessell as magnetic surfaces.)


pict

Fig. 1: A magnetic surface in tokamak is a revolution surface generated by rotating the projection of a magnetic field line in the poloidal plane [(R,Z) plane] around the Z axis. The projection is not necessarily a closed curve in the poloidal plane, as is shown in this figure.

The value of Ψ is constant on a magnetic surface (since Ψ is constant along a magnetic field line and Ψ is independent of ϕ). On the other hand, the value of Ψ is usually different on different magnetic surfaces. The above two facts enable Ψ to be used as labels of magnetic surfaces.

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 try to find the physical meaning of Ψ, i.e., some simple algebraic relation of Ψ with some quantity that can be measured in experiments.


pict

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

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

     ∫
       R2
Ψp =  R1 Bz (R, Z)2πRdR
     ∫ R2 1∂ Ψ
   =     -----2πRdR
      R1∫ R ∂R
         R2 ∂Ψ-
   = 2π  R1 ∂R dR
   = 2π[Ψ2 − Ψ1].                               (20)
Equation (20) provides a simple physical meaning for Ψ, i.e., the difference of 2πΨ between two magnetic surfaces is equal to the poloidal magnetic flux enclosed by the two magnetic surfaces. Noting that we are considering the axisymmetric case, the physical meaning of Ψ can also be stated as: the difference of Ψ between two magnetic surfaces is equal to the poloidal magnetic flux per radian. Due to this relation, Ψ is usually called the “poloidal magnetic flux function” in tokamak literature. Note that it is the difference of Ψ between two locations that determines the the physical quantities Ψp, which is consistent with the fact that gauge transformation (14) dose not change the values of physical quantities.

2.8 Measurement of poloidal magnetic flux

By measuring the voltage around a toroidal wire loop, we can obtain the time derivative of the poloidal magnetic flux though the loop and, after integrating over time, the poloidal magnetic flux itself.

Suppose that the loop is located at (R,Z) and denote the magnetic flux through the loop by Ψpol(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Ψpol,
      dt
(21)

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. (21) is written as

V = − N dΨpol.
         dt
(22)

Integrating the above equation over time, we obtain

                          1 ∫ t
Ψpol(R,Z,t) = Ψpol(R,Z, 0)−--   V dt.
                          N  0
(23)

The starting time t = 0 can be chosen at a time when no plasma is present and thus the initial value, Ψpol(R,Z,0), is easy to obtain.

As discussed in Sec. 2.7 ,the relation between Ψ and Ψpol is given by

Ψpol(R,Z,t) = 2π[Ψ(R,Z,t)− Ψ(R = 0,Z,t)],
(24)

where Ψ(R = 0,Z,t), as discussed above, is zero. Then Eq. (24) is written as

           1--
Ψ(R,Z,t) = 2πΨpol(R,Z,t),
(25)

which tells us how to obtain Ψ form the measured Ψpol(R,Z,t), which in trun is inferred from the measured voltage V , as is given by Eq. (23).

Note that the positive normal direction of the surface (where the magnetic flux Ψpol is defined) is chosen in the Z direction.

The above toroidal loop of wire used to measure poloidal magnetic flux is often called “flux loop” by tokamak operators. There are usually many flux loops (e.g. 35 on EAST[31], 41 on DIII-D) at different locations in the poloidal plane (see Fig. 3). The measured value of poloidal flux can be used as constraints in reconstructing magnetic configuration by, e.g. EFIT. With the feedback control (by adjusting the current in the poloidal field coils), these measurement, along with the poloidal field measurement by magnetic probes, can be used to control the shape of the last-closed-flux-surface (LCFS), the distance of the LCFS from the first wall, and the X-point location. This is often called iso-flux control, gap control, or X-point control.


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 Ψ on (R,Z) plane are closed curves. As discussed above, the contours of Ψ are the projection of magnetic lines on the poloidal plane. Closed contours of Ψ implies closed magnetic surfaces, as shown in Fig 4.


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). Because the magnetic axis is the point of maximum/minimum of Ψ(R,Z), the value of Ψ is zero at the magnetic axis. As a result, the poloidal component of the equilibrium magnetic field is zero on magnetic axis (refer to Eq. (8)), i.e., the magnetic field has only toroidal component there.

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

Ψp = 2π(Ψ0 − Ψ ),
(26)

where Ψ0 is the value of Ψ at the magnetic axis. 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 two different definitions, one of which is the the poloidal magnetic flux through the surface S2 in Fig. 4, the other one is the poloidal magnetic flux through the central hole of the magnetic surface, i.e., the poloidal flux through S1 in Fig. 4. In the latter case, as is discussed in Sec. 2.8, the poloidal magnetic flux is related to Ψ by

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

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

Also note that, since the poloidal magnetic field can be written as 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.

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. 5.


pict

Fig. 5: 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    ,
(28)

(which is the R coordinate of the geometric center of the magnetic surface), the minor radius of a magnetic surface

    Rout − Rin
a = ----2----,
(29)

the triangularity of a magnetic surface

    R  − R
δt =--0---top,
        a
(30)

and, the ellipticity (elongation) of a magnetic surface

   Ztop
κ =  a .
(31)

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.

The four shape parameters for the typical Last-Closed-Flux-Surface (LCFS) of EAST tokamak are: major radius R0 = 1.85m (can reach 1.9m), minor radius a = 0.45m, ellipticity κ = 1.8 (can be in the range from 1.5 to 2.0), triangularity δt = 0.6 (can be in the range from 0.3 to 0.6). 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.

2.10 Safety factor

Magnetic field lines on closed magnetic surfaces travel closed curves in a poloidal plane. For these field lines, we can define the safety factor q, which is the number of toroidal loops a magnetic field line travels when it makes one poloidal loop, i.e.

q ≡ △ϕ-,
    2π
(32)

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
(33)

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

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

which can be integrated over dℓp to give

     ∮  1 B
△ϕ =    ---ϕdℓp,
        R Bp
(35)

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

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

Expression of safety factor in terms of magnetic flux

The safety factor given by Eq. (36) 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
(37)

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. (37), the poloidal magnetic field is written as

     -1--Δ-Ψp
Bp = 2πR Δx  .
(38)

Substituting Eq. (38) into Eq. (36), we obtain

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

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

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

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

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

Equation (41) 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. 6.


pict pict

Fig. 6: 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.

 

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 can not be achieved 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:

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

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

δBϕ = 0.
(45)

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

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

The above approximation is widely used in practice, e.g., tearing mode theory; 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∇ϕ.
(47)

**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. I will discuss this in Sec. (), where I will show that contours of the so-called helical flux will give the expected island structures near the resonant surfaces.**can be worng, I have not checked this.

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 can be written in terms of the magnetic field as (Ampère’s law):

                                    (           )
μ J = ∇ ×B  = − ∂B-ϕˆR + 1-∂(RB-ϕ)ˆZ + ∂BR- − ∂BZ-  ˆϕ.
 0              ∂Z     R   ∂R         ∂Z    ∂R
(48)

4.1 Poloidal current density

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

μ J  = −-1∂g-,
 0 R    R ∂Z
(49)

and

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

respectively.

4.2 Toroidal current density

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

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

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

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

(Many authors call Eq. (53) the Grad-Shafranov equation. This is incorrect. This is just Ampere’s law, which has nothing to do with the force-balance.)

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 − ∇ ⋅ℙ
(54)

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.2) and the plasma pressure is isotropic, then the steady state momentum equation (force balance equation) is written as

J × B = ∇P,
(55)

where P is the scalar plasma pressure.

Is the force balance (55) always satisfied in a real toakamak discharge? To answer this question, we need to go back to the original momentum equation (54). 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 (55). (to be sure, I need to think about this again). This reasoning is from Youwen Sun[25].

5.1 Parallel force balance

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

0 = B ⋅∇P,
(56)

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.10) 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. (56) 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. (55) is written

J  B  − J B  = -1∂P-.
  Z R    R  Z  R  ∂ϕ
(57)

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

JZBR − JRBZ  = 0
(58)

Using the expressions of the poloidal current density (49) and (50) in the force balance equation (58) yields

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

which can be further written

B ⋅∇g = 0.
(60)

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.3.)

5.3 Force balance along the major radius

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

              ∂P
JϕBZ − JZB ϕ =---
              ∂R
(61)

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

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

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

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

which can be simplified to

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

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

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

i.e.,

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

Equation (66) 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
(67)

For the above axisymmetric magnetic field to be consistent with the force balance equation (55), 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 (66) 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 (66) 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.1.

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. (49), (50) and (53) 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.8.

On the other hand, in the kinetic equilibrium reconstruction[19], 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. (66), i.e.,

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

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 (68), 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 Numerical methods of reconstructing equilibrium magnetic field

6.1 By using integral form and Picard iteration

Given all the toroidal currents, Ψ can be calculated using a formula similar to the Biot-Savart Law (see (667)):

         ∫     ′  ′         ′  ′   ′  ′  N∑c−1
Ψ(R,Z ) =   G(R ,Z ;R,Z)Jϕ(R ,Z )dR dZ  +     G(Ri,Zi;R,Z )Ii,
          Ω                              i=0
(69)

where Jϕ is the plasma toroidal current density, Ii is the toroidal curent in No. i PF coil located at (R = Ri,Z = Zi), G is a function given by

      ′ ′
  G(R ,∫Z ,R,Z )
  μ0R-  2π--------------R′cosϕ′dϕ′-------------
=  4π  0  ∘ (Z − Z′)2 + (R− R ′cosϕ ′)2 + (R′sin ϕ′)2.          (70)
On the other hand, the force-balance indicates that Jϕ can be expressed in terms of Ψ via Eq. (64), i.e.,
      dP     1  dg
Jϕ = R dΨ-+ μ-R-gdΨ-.
             0
(71)

Substituting this into Eq. (69) gives an implicit formula for Ψ, which can be iterated (assuuming an initial guess of Ψ(R,Z) on the rhs and assuming the function forms, P(Ψ) and g(Ψ), are known). Will the iteration turn out to converge? We do not know for sure, and numerical experiments indicate it does in some cases[17]. Let us discuss these cases. The 1D functions, P(Ψ) and g(Ψ), are modeled as polynomials in Ψ with coefficients αn and β0 to be determined:

dP (Ψ )
------= α0 + α1x+ α2x2 − (α0 + α1 + α2)x3,
  dΨ
(72)

  dg
g--- = β0(1 − x),
 dΨ
(73)

where x = Ψ = (Ψ ΨM)(ΨB ΨM), ΨM and ΨB are values of Ψ at the magnetic axis and LCFS (values of ΨM and ΨB are figured out from Ψ(R,Z)).

Choosing an initial guess of Ψ(R,Z) on gridpoints, we can get the values of αn, β0, and Ii by solving a least square problem that minimises the difference between quantities computed (from Ψ and Ii) and the corresponding quantities measured in actual experiments. After this, the rhs of Eq. (69) is fully known, and we can use this equation to update Ψ(R,Z). Then, using the latest Ψ, we solve the least square problem again. Then we obtain new Ψ using Eq. (69) again. We repeat the above procedure until convergecne in Ψ(R,Z). This is called Picard iteration.

I use the above method in developing a numerical code called HEQ. The following subsection discusses the least square problem in details.

  dg
gdxΔ-= β0(1− x),
(74)

∫ x   dg     ∫ x
 0  gdxΔ-dx = 0 β0(1 − x )dx,
(75)

∫ g(x)     ∫ x
     gdg =    Δβ0(1− x)dx,
 g(0)       0
(76)

g2 g(x)      ∫ x
-2 |g(0) = Δ β0 (1− x)dx,
             0
(77)

             (      )
g2−  g20-= Δ β  x − x2
2    2      0     2
(78)

6.2 Response matrix Γ

Plugging expressions (72) and (73) into (71), and organizing the result according to the coefficients (α0120), we obtain

Jϕ(R′,Z′) = R′[α0 + α1x +α2x2 − (α0 + α1 + α2)x3]+-1-β0(1− x)
                                               μ0R ′
               ′    3       ′    3       ′ 2   3      1−-x-
         = α0R (1− x )+ α1R (x− x )+ α2R (x  − x ) +β0 μ0R′ ,     (79)
For notation ease, define
(
|| b0(x) = R′(1− x3)
{ b1(x) = R′(x− x3)
|| b2(x) = R′(x2 − x3)
( b3(x) = (1− x)∕(μ0R ′)(
|| c0 = α0
{ c1 = α1
|| c2 = α2
( c3 = β0

then Eq. (79) is written as

     3
    ∑
Jϕ =   cjbj(x).
    j=0
(80)

Plugging expression (80) into Eq. (69), we obtain

              ∫
         ∑3          ′ ′            ′  ′
Ψ(R,Z ) =   cj Ω G(R ,Z ,R,Z)bj(x)dR dZ
         j=0
         Nc∑−1    (c)  (c)
       +     G (Rj ,Zj ,R,Z )Ij.                         (81)
          j=0
Define the free parameters as a column vector u = (c0,c1,c2,c3,I0,,INc1)T, and N = 4 + Nc, i.e., the size of vector u, i.e., the number of free parameters. Then, at a given (R,Z), the rhs of Eq. (81) can be written as matrix-vector product, Γu. Denote the total number of measurements of the poloidal flux by MΨ. Then matrix elements of Γ for (i = 0,,MΨ 1) are given by:
     ∫
Γ ij =  G(R ′,Z′,R(iFL),Z (FiL))bj(x)dR′dZ′,
      Ω
(82)

for (j = 0,,3), and

Γ ij = G (R(jc)−4,Z(jc)−4,R(iFL),Z(iFL)),
(83)

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

The matrix Γ is called “response matrix”, which is of shape (M,N), The value of M is equal to number of measurements included (measurements are merged to Γ by row stacking). We will include MΨ measurements of the poloidal flux, MB measurements of the poloidal magnetic field, and 1 measurement of plasma current. Then M = MΨ + MB + 1. (For EAST, MΨ = 35,MB = 38.)

 

Next, we consider the poloidal field measurement:

Bp (Ri,Zi) = Bp ⋅nˆi = BR ˆni,R + BZ ˆni,Z,
(84)

where ˆni is the positive normal direction of the No. i magnetic probe, ˆni,R = ˆni eR, ˆni,Z = ˆni eZ. On the other hand, Bp(Ri,Zi) can be inferred from Ψ via

           ∑3   ∫                             Nc∑−1
Bp(Ri,Zi) =   cj   GB (R ′,Z ′,Ri,Zi)bj(x)dR′dZ′ +    GBIj.
           j=0   Ω                             j=0
(85)

where

GB (R′,Z′,Ri,Zi) = GBR(R ′,Z ′,Ri,Zi)nˆi,R + GBZ (R′,Z′,Ri,Zi)ˆni,Z,
(86)

and GBR and GBZ is given by Eq. (671) and (672). The rhs of Eq. (85) indicates that the matrix elements of Γ for (i = MΨ,,MΨ + MB 1) are given by:

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

for (j = 0,,3), and

          (c)  (c)
Γ ij = GB (Rj−4,Zj−4,Ri,Zi),
(88)

for (j = 4,,N 1) .

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

    ∫             3   ∫
Ip =   JϕdR′dZ′ = ∑ cj   bj(x)dR ′dZ′.
     Ω           j=0   Ω
(89)

The rhs of Eq. (89) indicates that the matrix elements of Γ for i = MΨ + MB + 1 are given by:

      ∫
Γ  =    b (x)dR ′dZ ′,
  ij    Ω j
(90)

for (j = 0,,3), and zero for (j = 4,,n 1) .

6.3 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
(91)

or in its discrete form:

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

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).

 

A formula for computing q value at the magnetic axis [ref. P. M. Bellan’s paper]:

qaxis = e1∕2 + e−1∕2
---R-------
     axis Bϕaxis
μ-J----
 0 ϕaxis,

where

   (         )
     ∂2Ψ∕∂R2-
e =  ∂2Ψ∕∂Z2  axis.
(93)

Jϕ axis = j=03c jbj(x) = c0b0(0) + c3b3(0) = c0Raxis + c3---1---
μ0Raxis

q   = √-e+-1---g(0)- ,
 axis    eR2axisμ0J ϕaxis
(94)

√eR2   μ0 (             1  )     1
----axis--- c0Raxis + c3------ =  ----
(e+ 1)g(0)            μ0Raxis    qaxis
(95)

 

6.4 Solving by inverting the Laplace operator–to be deleted

If we want to invert the Laplace operator of the GS equation to solve for Ψ, we encounter two issues: (1) the RHS of the GS equation involves functions of Ψ, where both the functions and Ψ are unknown; (2) the values of Ψ on a given boundy should be prescribed, which in turn invovles two issues: (a) how to choose the shape of the bounday? (b) how to know the value of Ψ on the boundary? The answer to isssues (a) and (b) is that we can choose any boundy we like (e.g., rectangular region) and guess the values of Ψ on it (which will be updated in iterations discussed later). The answer to issue (1) is that the function forms are chosen by users, usually as polymials in Ψ, e.g. [17]

where x = (Ψ ΨM)(ΨB ΨM), ΨM and ΨB are values of Ψ at the magnetic axis and LCFS (but the locations of the axis and LCFS are unknown), the free parameters αn and βn are assumed known (which will be later adjusted in the least-square method to make the resulting solution approximately match some measurements and constraints imposed). To make the RHS fully known, we need to guess values of Ψ in the inner region. Then inverting   to get new Ψ. The values we obtained via inerting usually differ from what we used in the RHS, so we need to interate until convergence. We call this interation as the first-level iteration.

After the first-level iteration coverges, we can calculate Jϕ through Eq. (64) or Eq. (53). After this, all the current (current in the plasma, and current in the external coils, which are assumed to be known and will be adjusted in the least-square method) perpendicular to the poloidal plane is known, we can calculate the value of Ψ on the boundary, Ψb, by using the Green’s function method. If Ψb calculated this way differs from the initial guess of the value of Ψ on the boundary, we need to iterate: use the Ψb calculated as a new guess value of Ψ on the boundary and repeat the above procedures until convergence. We call this iteration as the second-level iteration.[?].

The thrid level iteration is to iterate over the free parameters αn, βn, the PF coil currents, to make the solution match match some measurements and constraints imposed in the least square sence. This iteration is an optimization problem.

 

 

7 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. 15.

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

8 Curvilinear coordinate system

8.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,
(96)

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.
(97)

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. (97) can be written as

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

8.2 Jacobian

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

    |           |
    || ∂∂xx-∂∂xx- ∂∂xx-||
𝒥 = || ∂1y-∂y2 ∂3y-||,
    || ∂x∂1z-∂∂xz2 ∂x∂3z-||
      ∂x1 ∂x2 ∂x3
(99)

which can also be written as

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

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

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

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. (99), 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.

8.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 ⋅∂x--= δij,
       j
(102)

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. (102) can be written as

     ∂r   [( ∂xi)    ( ∂xi)    ( ∂xi)  ] [ ∂x      ∂ˆx    ∂y     ∂ ˆy   ∂z      ∂ˆz ]
∇xi ⋅∂x-=    ∂x-  ˆx+   ∂y-  ˆy+   ∂z-  ˆz ⋅ ∂x--ˆx+ x∂x--+ ∂x-yˆ+ y∂x--+ ∂x-ˆz +z ∂x--
       j  [(    )    (    )    (    )  ] [   j       j    j       j   ] j       j
        =    ∂xi  ˆx+   ∂xi  ˆy+   ∂xi  ˆz ⋅ -∂x-ˆx+ 0+  ∂y-ˆy+ 0 + ∂z-ˆz+ 0        (103)
             ∂x        ∂y        ∂z       ∂xj        ∂xj       ∂xj
           ∂xi∂x--  ∂xi-∂y-  ∂xi-∂z-
        =  ∂x ∂xj + ∂y ∂xj + ∂z ∂xj
           ∂xi
        =  ∂x--                                                               (104)
             j
        = δ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. (104)]

[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. (102). 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. (102) 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
----= A∇x2 × ∇x3,
∂x1
(105)

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

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

which gives

           1
A = (∇x--×-∇x--)⋅∇x--
       2     3     1
 = 𝒥                                         (107)
Thus r∕∂x1 is written, in terms of x1, x2, and x3, as
 ∂r
∂x--= 𝒥 ∇x2 × ∇x3.
  1
(108)

Similarly, we obtain

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

and

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

Equations (108)-(110) can be generally written

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

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

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

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

8.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ζ ≡ ∇ζ.                    (113)
and the covariant basis vectors are denoted with low indices as
     ∂r              ∂r
eψ ≡ --; e𝜃 ≡ ∂∂r𝜃; eζ ≡-.                       (114)
     ∂ψ              ∂ζ
Then the orthogonality relation, Eq. (102), is written as
eα ⋅eβ = δαβ.
(115)

In term of the contravairant basis vectors, A is written

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

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ζ,
(117)

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

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

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

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

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

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

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

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

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

8.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 =  --∇ ψ + --∇ 𝜃+ ---∇ζ.
      ∂ψ      ∂𝜃     ∂ ζ
(124)

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
∂ψ                     ∂ψ
(125)

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

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

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

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

8.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,
(129)

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

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

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

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

8.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   )
    = ∇ ⋅ ∂-ψ∇ ψ+  ∂𝜃∇ 𝜃+ ∂ζ-∇ζ  .                  (133)
To proceed, we can use the divergence formula (132) 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 (132). If we want to directly use the formula (132), we need to transform the vector (blue term in expression (133)) 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 (133) by using basic vector identities:
  2     ( ∂f)         ( ∂f)         (∂f )
∇ f = ∇   ∂ψ- ⋅∇ ψ+ ∇   ∂𝜃- ⋅∇ 𝜃+ ∇  -∂ζ  ⋅∇ζ
        ∂f       ∂f      ∂f
      + --∇2 ψ + --∇2 𝜃+ ---∇2ζ.                          (134)
        ∂ψ       ∂𝜃      ∂ζ
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ζ,                         (135)
        ∂ψ       ∂𝜃      ∂ζ
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ζ.                          (136)
        ∂ψ       ∂𝜃       ∂ζ
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
      +∂ ψ∇ ψ + ∂ ζ∇ ζ.                                (137)
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).

8.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∇3ζ8.)
        𝒥   ∂ ψ    ∂𝜃              𝒥    ∂ζ    ∂ψ               𝒥   ∂𝜃    ∂ ζ
Note that taking the curl of a vector in the covariant form leaves the vector in the contravariant form.

8.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 (111) and (112) 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 𝒥∇ ψ × ∇𝜃.
(139)

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

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

a2 = ∇ ψ⋅∇ 𝜃,
(141)

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

Similarly, we write

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

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

b1 = ∇ 𝜃⋅∇ ψ
(144)

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

b3 = ∇ 𝜃⋅∇ ζ.
(146)

The same situation applies for the ζ basis vector,

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

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

 1
c = ∇ ζ ⋅∇ ψ
(148)

c2 = ∇ ζ ⋅∇ 𝜃
(149)

c3 = |∇ ζ|2
(150)

Summarizing the above results in matrix form, we obtain

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

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

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

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

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

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

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

For the second contravariant basis vector

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

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

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

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

For the third contravariant basis vector

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

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

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

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

Summarizing these results, we obtain

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

where

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

This matrix and the matrix in Eqs. (151) 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. (151) is simplified to

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

Similarly, Eq. (164) is simplified to

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

[Note that the matrix in Eqs. (165) and (166) 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
(167)

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. (101), it is easy to verify that A = 1, i.e.,

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

]

9 Covariant/contravariant representation of equilibrium magnetic field

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

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

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

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

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

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

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

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

For the convenience of notation, define

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

then Eq. (172) is written as

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

10 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. (171), is written as

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

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

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

10.1 Local safety factor

The local safety factor ˆq is defined by

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

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. (175), into the above equation, the local safety factor is written

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

Note that the expression ˆq in Eq. (178) 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. (175), is written

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

and the parallel differential operator B0 ⋅∇ is written as

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

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. 14.

10.2 Global safety factor

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

          ∫ 2π
q(ψ) ≡ -1-    ˆqd𝜃                              (181)
       2π  0
        -1-g-∫ 2π 𝒥--
     = −2π Ψ′  0  R2d𝜃.                        (182)
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 (182) to a curve integral in the poloidal plane. Using the relation dℓp and d𝜃 [Eq. (190)], expression (182) is further written

             ∮
q(ψ) = − 1-g′  sign(𝒥 )-dℓp--
        2πΨ        ∮  R|∇ψ |
    = − 1-g-sign(𝒥)   -dℓp--.                     (183)
        2π sign(Ψ ′)   R |∇ Ψ|
Expression (183) 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 (183) 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 (183) to obtain the corresponding g (which explicitly appears in the GS equation):
        ( ∮ --dℓp--)−1 sign(Ψ′)
g = − 2πq   R |∇ Ψ|    sign(𝒥 ).
(184)

We note that expression (184) 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 (184) can be performed, yielding the values of g.)

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

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

10.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ϕ
    ∂ψ      ∂𝜃     ∂ϕ
(187)

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𝜃.                          (188)
We use the convention that dℓp and d𝜃 take the same sign, i.e.,
dℓp = |𝒥 ∇ϕ × ∇ψ |d𝜃.
(189)

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

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

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

—–

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

10.4 Calculating poloidal angle

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

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

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. (192). Denote the Jacobian of the constructed coordinates by 𝒥′, then

𝒥′ = ± 𝒥
(193)

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. (192) 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. (192) 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
(194)

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,                     (195)
                  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(ψ)𝒥                                   (196)
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. (195) 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
𝒥 = ---- .
    |∇ ψ|
(197)

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

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

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

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

Equation (198) 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. (198) 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 (ψ ),
(200)

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

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

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

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

Note that both 𝜃i,j and 𝒥new are independent of the function h(ψ) introduced in Eq. (200). (h(ψ) is eliminated by the normalization procedure specified in Sec. 10.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. (202) is constant in space.**)

Jacobian of Boozer’s poloidal angle

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

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

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

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

The final Jacobian is given by

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

The usefullness of Boozer poloidal angle will be further discussed in Sec. 14.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. (178) 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. (195) is written

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

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

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

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
(208)

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. (206) 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𝜃.                            (209)
            R2     ref,j
Using ˆq = g-
R2𝒥-
Ψ′, where 𝒥 is the Jacobian of (ψ,𝜃,ϕ) coordinates, then the above 𝜗 is reduced to expression (208).]

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

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

Comparison between different types of poloidal angle

 

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

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

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 7 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. 7: 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 = (∇ψ × ∇ 𝜃) ⋅∇ϕ ,
(212)

which can be further written as

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

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,
(214)

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
(215)

and

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

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
(217)

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ϕ.
(218)

Integrating over the toroidal angle, we obtain

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

Further integrating over the poloidal angle, we obtain

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

i.e.,

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

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.

 

11 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. (190) (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 (ψ,𝜃,ϕ).

11.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. 8.

 


pict

Fig. 8: 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
(222)

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. 9: 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. 10: |∇Ψ| 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. 11: 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. 12: 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. 13: |∇Ψ| 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. 14: 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).

 

11.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 (ψ,𝜃),
(223)

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

Then R and Z are written as

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

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

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

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

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

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,                                (229)
i.e.,
𝒥 = R (R 𝜃Zψ − R ψZ𝜃).
(230)

Using this, Expressions (227) and (228) are written as

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

and

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

Then the elements of the metric matrix are written as

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

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

and

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

Equations (233), (234), and (235) 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 𝜃
(236)

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

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

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

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

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𝜃,                                (240)
        R
which agrees with Eq. (190).]

12 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. (182), i.e.,

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

and re-organize the formula as

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

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 𝜃
(243)

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. 16. 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.

13 Magnetic surface averaging

13.1 Definition

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

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

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 (244) is written as

          ( ∫ ∫ ∫             )
⟨G⟩ = lim    -∫ ∫-Δ∫Ψ-G|𝒥-|dψd𝜃dϕ
     Δ Ψ→0       ΔΨ |𝒥 |dψd 𝜃dϕ
      ∫ ∫ G|𝒥|d𝜃dϕ
   =  ∫-∫--------,                                 (245)
          |𝒥 |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 (245) is written as
      ∫
      -G0(ψ,𝜃)|𝒥|d𝜃-
⟨G⟩ =    ∫ |𝒥 |d𝜃    ,
(246)

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

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

_________________________________________________________________________________________________________________________

“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.
(248)

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

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

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

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

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

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

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
(253)

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

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

Using this, Eq. (252) is written as

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

13.2 Flux Surface Functions—to be deleted

Next, examine the meaning of the following volume integral

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

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
(256)

Note that 𝜃 is not a single-value function of the spacial points. In order to evaluate the integration in Eq. (256), 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 (256) 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.                                  (257)
        S2
Eq. (257) 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
(258)

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)].                        (259)
Note that the sign of the Jacobian appears in Eq. (259), 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. (259) is exactly consistent with that in Eq. (26).

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

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

the poloidal current within a flux surface is written as

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

and toroidal current within a flux surface is written as

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

(**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ψ.                         (263)
     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
(264)

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

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

By using the contravariant representation of current density (497), 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)].                             (267)
        μ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  .                                   (268)
             0
The last equality is due to ψ = 0 at ψ = 0. By using the flux surface average operator, Eq. (268) is written
           ′ ′⟨     2⟩
Iϕ(ψ) = − V-Ψ-  |∇-ψ|- .
         2πμ0    R2
(269)

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
        = -----------------------ψ-                           (270)
                   μ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-  |∇ψ|-                     (271)
          μ0V ′⟨R−2⟩   g     R2    ψ

 

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

14.1 General toroidal angle ζ

In Sec. 10.1, we introduced the local safety factor ˆq (ψ,𝜃). Equation (178) 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. 10.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(ψ)δ(ψ,𝜃),
(272)

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

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

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 (274) is written as

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

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

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

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
(277)

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

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

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

In summary, magnetic field line is straight in (𝜃,ζ) plane with slope being q if ζ is defined by Eq. (278). 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. (277) is a periodic function of 𝜃. [Proof: Equation (277) 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𝜃
                           𝜃
          = δ(ψ,𝜃).                                        (279)
]

[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.                               (280)
               0 R Bp

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

            (   )∫ 𝜃             ∫ 𝜃
∂(δq) = −-d- -g′    -𝒥2d𝜃− -g′ ∂-   𝒥-2d𝜃− dq-𝜃.           (281)
 ∂ψ      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.]

 

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

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

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

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

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

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

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

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

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

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

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

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

Noting the simple fact that

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

where c is a constant, we conclude that

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

(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
  ∂ψ  𝜃,ζ ⁄=  ∂ ψ  𝜃,ϕ
(290)

and

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

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

14.4 Steps to construct a straight-line magnetic coordinate system

In Sec. 11, 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. (272), where δ is obtained from Eq. (277). Also note that the Jacobian of (ψ,𝜃,ζ) coordinates happens to be equal to that of (ψ,𝜃,ϕ) coordinates.

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

The usefulness of the contravariant form [Eq. (284] 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. (284), the operator is written as

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

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

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

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
(295)

(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
(296)

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

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

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.

14.6 Resonant surface of a perturbation

Equation (297) indicates that, for the differential equation (293), 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.

14.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
(298)

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.
(299)

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  .                                   (300)
              m
At the resonant surface q = m∕n, equation (300) 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
    = − Ψ 𝒥  .                                      (301)
Using (301) and (300), the relation between B(𝜃) and B(χ) is written as
          (    nq)
B (χ) = B (𝜃) 1 − m- .
(302)

14.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. (176)). 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∇ζ.                        (303)
Using Eq. (303), the covariant form of the magnetic field, Eq. (176), is written as
     (                    )      (                )
       ′ 𝒥-          ∂(qδ)          ∂δ-   ′ 𝒥-   2
B =   Ψ R2 ∇ψ ⋅∇𝜃 + g ∂ψ   ∇ ψ +  gq∂𝜃 − Ψ R2|∇ψ |  ∇𝜃 + g∇ζ.
(304)

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

     (                    )      (                    )
B  =  Ψ′ 𝒥-∇ψ ⋅∇ 𝜃+ g∂(qδ) ∇ ψ +  − g2− gqR2-− Ψ ′|∇ψ |2  𝒥-∇ 𝜃+ g∇ ζ
        R2            ∂ψ            Ψ′     𝒥            R2
     ( ′ 𝒥           ∂(qδ))      (  g2 + |∇ Ψ|2   R2 ) 𝒥
   =  Ψ R2-∇ψ ⋅∇ 𝜃+ g-∂ψ-- ∇ ψ +  − ---Ψ-′---− gq-𝒥-  R2∇ 𝜃+ g∇ ζ.   (305)
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∇ζ.           (306)
Equation (306) 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. 14.9), equation (306) reduces to
    (                    )
B =   −-𝒥2∇ψ ⋅∇ 𝜃+ g∂(qδ) ∇ ψ + I(ψ )∇ 𝜃+ g(ψ)∇ ζ,
       R             ∂ψ
(307)

with I(ψ) = h(ψ) gq. The magnetic field expression in Eq. (307) frequently appears in tokamak literature[29]. 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
(308)

14.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.  (306)], we obtain

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

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

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

Examining Eq. (311), 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.

14.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∂𝜃-∇𝜃 ⋅∇ψ  ∂ζ,        (312)
where ()∕∂ψ and q∂δ∕∂𝜃 are given respectively by Eqs. (281) and (275). Using the above formula, ψ ⋅∇ζ is written as
            [∂(qδ)        ∂δ       ]
∇ ψ ⋅∇ζ = −  -----|∇ ψ|2 + q--∇ 𝜃⋅∇ ψ .
              ∂ψ          ∂𝜃
(313)

This formula is used in GTAW code.

15 Field-line-following coordinates

15.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𝜃 + α,
(314)

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𝜃,
(315)

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

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

which is called the Clebsch form. The direction

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

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 (316) implies that

B ⋅∇α = 0,
(318)

and

B ⋅∇ψ = 0,
(319)

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

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

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. (316), the magnetic differential operator B ⋅∇ in the new coordinate system (ψ,𝜃,α) is written

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

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. (315) and (278), α can be written as

       ∫
         𝜃
α = ϕ − 0 ˆqd𝜃,                            (322)
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. [22] 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].

15.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                                 (323)
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 ×∇ψ.

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

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

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

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

Another method of computing the above quantities: Using Eqs. (231) and (232), expression (324) is written as

           -                  -
      ˆϕ-  ∂δ-R-   ˆ     ˆ   ∂-δR-   ˆ      ˆ
∇ α = R + ∂ψ 𝒥 (Z 𝜃R − R𝜃Z)− ∂ 𝜃𝒥 (ZψR − Rψ Z)
      ˆϕ   ( ∂δR      ∂δR    )    ( ∂δ R      ∂δR    )
   =  --+  -----Z𝜃 − ----Zψ  Rˆ+   ----R ψ −-----R 𝜃 ˆZ.        (327)
      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𝜃  .             (328)
           𝒥     ∂ψ 𝒥      ∂𝜃𝒥       𝒥      ∂𝜃𝒥      ∂ψ 𝒥
         [    (  -         -    )     (  -         -    )   ] (               )
∇α ⋅∇ 𝜃 = ϕˆ +  ∂δ-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ψ.               (329)
           ∂ψ 𝒥     ∂𝜃 𝒥     𝒥       ∂𝜃 𝒥      ∂ψ 𝒥     𝒥
The figures below plot the spatial variation of some quantities.

pict pict

pict pict

 

pict pict

Fig. 15: 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. 16: The same as Fig. 15, but gradients are computed in cylindrical coordinates. The results agrees with those of Fig. 15, which provides the confidence in the correctness of the numerical implementation.

 

15.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,
(330)

     r0
y = α q-,
      0
(331)

z = 𝜃q0R0,
(332)

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.
(333)

Then the wavenumber ky is written as

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

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

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

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 ×∇ψ.

15.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,ϕˆ,
(336)

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

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

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

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

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


pict pict

pict pict

Fig. 17: (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. (339) 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. 18 for 𝜃 = 19 × 2π∕63, where r∕∂ψ|α,𝜃 has larger toroidal shift than that in Fig. 17 for 𝜃 = 9 × 2π∕63.


pict pict

pict pict

Fig. 18: (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. 17b and Fig. 18b.

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||   ,
 ψ     ∂ψ  |𝜃,α
(340)

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

                     |
k ⋆=  ∂(kψ-ψ+-m-𝜃+-nϕ-)||
 ψ          ∂ψ       |𝜃,α
            ∂ϕ||
   = kψ + n ∂ψ||                                 (341)
               𝜃,α
Using  Using ϕ α + q(ψ)𝜃, the above expression is written as
k⋆ψ = kψ + nq′𝜃,                           (342)
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ψ,
            ψ
(343)

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
(344)

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 19 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. 15.5.


pict pict

pict

Fig. 19: (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(ψ,𝜃,ϕ).
(345)

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

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

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(ψ,𝜃,α).
(347)

However, generally there is no periodic condition along 𝜃,

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

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

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

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

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

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),
(351)

or equivalently

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

Numerical implementation of periodic condition (351)

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

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

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. 20.

 

 


pict

Fig. 20: 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 21 compares a small number of ϕ contours and α contours on a magnetic surface.


pict pict

Fig. 21: 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. 21, with ϕ fixed, an 𝜃 curve reaches its starting point when 𝜃 changes from zero to 2π. However, as shown in the right panel of Fig. 21, 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 (351).

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

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

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. (351) requires that

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

To satisfy the above condition, we can choose

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

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

  ′
m  = N + nq.
(357)

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 (357) is to choose N = n × NINT((qmax + qmin)2), so that mis given by

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

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. (358) 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. (354) with m′∼ 1 and n 1 has large poloidal mode number m when expressed in (ψ,𝜃,ϕ) coordinates. [Proof: Expression (354) can be written as

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

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],
(360)

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. 22.


pict pict

Fig. 22: 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 23 compares the ϕ coordinate surface of (ψ,𝜃,ϕ) coordinates with the α coordinate surface of (ψ,𝜃,α) coordinates.


pict pict

Fig. 23: 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. 24: The same plot as in Fig. 23 but with a larger radial range. ψN [0.4 : 0.7], where ψN is the normalized poloidal magnetic flux.


pict pict

pict pict

 

Fig. 25: 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. 26: 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.

 

15.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[27]

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.

15.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 27 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. 27: 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,
(361)

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 ζ),                       (362)
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-∇Ψ × ∇ 𝜃− ∇ Ψ × ∇ ζ .                  (363)
Equation (363) 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∇Ψ × ∇𝜃 − ∇Ψ × ∇ ζ].
(364)

Using Eq. (284), 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
(365)

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. (365) is written

       nq
kbn ≈ − --,
       r
(366)

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.

 

16 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𝜃,
(367)

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

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 × ∇ ϕ,
(369)

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
(370)

which an be written as

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

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𝜃
(372)

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
(373)

Using this, equation (372) is written as

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

which can be simplified as

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

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

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

where 𝒥 is the Jacobian of the (r,𝜃,ϕ) coordinates and is given by 𝒥 = R(R𝜃Zr RrZ𝜃) = Rr. Then Eq. (376) 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
(377)

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

Using Eq. (375), the poloidal magnetic field in Eq. (369) is written as

                (                  )
      ∇r×-∇-ϕ-∂-- ∫ r-1----2πgr---
Bp =    2π    ∂r   0 q(r) ∘R2-−-r2dr
                            0
   = ∇r × ∇ ϕ-1--∘--gr---.                            (378)
             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. (378) is written as
     cos𝜃ˆZ-−-sin-𝜃ˆR -1-----gr---
Bp =       R       q(r)∘R2--−-r2
                          0
(379)

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
(380)

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

I use Eq. (375) 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.

16.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 × ∇ 𝜃,
(381)

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

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

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

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

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

B(1) = 0,
(385)

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

and

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

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                                              (388)
i.e., B in this case is indeed divergence-free.

16.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. (375) is not a solution to the GS equation (612) 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.14).

16.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𝜃,
(389)

where the local safety factor qˆ can be written as

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

Using 𝒥 = Rr and

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

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

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

Using this, expression (389) is written

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

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
(394)

Then expression (393) is written

-          (             (  ))
δ = 2q arctan ∘(R02−-r)-tan  𝜃    ,
               R0 − r2    2
(395)

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    .                 (396)
                    0
The results given by the formula (395) 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. 28, which provides confidence in both the analytical formula and the numerical code.

pict

Fig. 28: The results of δ = 0𝜃qˆ d𝜃 computed by using formula (395) 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,
(397)

i.,e,

               -
     1         δ
𝜃f = q(ϕ − α ) = q.
(398)

Then using Eq. (396), 𝜃f is written as

           (                 )
              (R0 − r)    (𝜃 )
𝜃f = 2 arctan ∘--2---2-tan  2    ,
               R0 − r
(399)

which agrees with Eq. (A2) in Gorler’s paper[13].

16.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 𝜃                                     (400)
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-.
(401)

Using expression (395), 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 (395) is written as (using Sympy)

∂δ      ( tan2(𝜃)   1)       1
--=  2qA   -----2-+  -  -2---2(𝜃)----
∂𝜃           2      2  A tan  2  + 1
(402)

where

A = ∘(R0-− r)
      R20 − r2
(403)

Equation (392) should be equal to qˆ given by Eq. (392). This was verified numerically.

 

Taking the r derivative of Eq. (375), we obtain

dΨp=  -1-∘-2πg0r--
dr    q(r)  R20 − r2
(404)

i.e.,

dΨ-= -1--∘--g0r---.
dr   q(r)  R20 − r2
(405)

dψ-=  ----1------1--∘--g0r--.
 dr   Ψ(a)− Ψ(0)q(r)  R20 − r2
(406)

 

 


pict pict

 

Fig. 29: δ∕∂𝜃 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.

16.5 Safety factor profile

The magnetic shear for a concentric-circular configuration is defined by

ˆs = dq r,
   dr q
(407)

where r is the minor radius of a magnetic surface. The above expression can be re-arranged as

 dr   dq
ˆsr =  q
(408)

Integrating the above equation over r and assuming ŝ is a constant, we obtain

 ∫       ∫
   r dr    r dq
ˆs r0 r =  r0 q ,
(409)

Performing the integration, the above equation is written as

ˆs(ln r− ln r ) = ln q− ln q ,
          0           0
(410)

where q0 = q(r0). Equation (410) can be finally written as

     ( r )ˆs
q = q0 r-  .
        0
(411)

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),
(412)

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.

17 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.

17.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
(413)

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         ψ
(414)

where the subscripts denotes partial derivatives, 𝒥 is the Jacobian of the coordinate system (ψ,𝜃,ϕ). [Next, we provide the proof of Eq. (414). The gradient of Ψ is written as (note that Ψ is independent of ϕ)

∇ Ψ = ∂Ψ∇ ψ + ∂Ψ-∇𝜃
      ∂ψ      ∂𝜃
(415)

Using this expression and the divergence formula (132), the elliptic operator in Eq. (413) 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 |∇ 𝜃| (𝜃41,6)
which is Eq. (414).]

Using Eq. (414), the GS equation (66) is written

   [(          )    (          )   (            )    (             ) ]
R2-     𝒥--   2         𝒥--   2        𝒥--               -𝒥-                 2 dP- dg-
𝒥    Ψ ψR2|∇ ψ|  ψ +  Ψ𝜃R2|∇𝜃|  𝜃 +  Ψ𝜃R2 ∇ψ ⋅∇𝜃  ψ +  ΨψR2 ∇ψ ⋅∇ 𝜃 𝜃 =  − μ0R dΨ− dΨ g,
(417)

which is the form of the GS equation in (ψ,𝜃,ϕ) coordinate system.

17.2 Finite difference form of toroidal elliptic operator in general coordinate system

The toroidal elliptic operator in Eq. (414) can be written

  ∗    R2-  ψψ         𝜃𝜃        ψ𝜃        ψ𝜃
△  Ψ = 𝒥  [(h  Ψψ)ψ + (h  Ψ𝜃)𝜃 + (h Ψ𝜃)ψ + (h Ψψ)𝜃],
(418)

where h is defined by Eq. (173), i.e.,

hαβ = 𝒥-∇ α⋅∇ β.
      R2
(419)

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),          (420)
where
 ψψ   -hψψ-
H   = (δψ)2.
(421)

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),             (422)
             i+1∕2,j               i−1∕2,j
where
       h𝜃𝜃
H 𝜃𝜃 =----2.
      (δ𝜃)
(423)

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δ𝜃
(424)

Approximating the value of Ψ at the grid centers by the average of the value of Ψ at the neighbor grid points, Eq. (424) 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
(425)

where

  ψ𝜃   -hψ𝜃--
H    = 4δψd𝜃.
(426)

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−4217).)
              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         𝒥
(428)

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

and

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

where the Jacobian

𝒥 = R (R 𝜃Zψ − R ψZ𝜃).
(431)

The partial derivatives, R𝜃, Rψ, Z𝜃, and Zψ, appearing in Eqs. (428)-(431) 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.

17.3 Special treatment at coordinate origin, wrong! to be deleted

Ψ ≈ a00 + a10R + a01Z + a11RZ + a20R2 + a02Z2.
(432)

           ∘ --
R = R0 + b11 ψ cos𝜃
(433)

            --
Z = Z0 + c11∘ ψ sin 𝜃
(434)

            (       ∘ --   )        ∘ --        (       ∘ --    )  ∘ --         (       ∘ --   )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
(435)

          11∘ --       12∘ --       21(∘ --)2       22 (∘ -)2
Z = Z0 + c   ψ sin𝜃 + c   ψ sin2𝜃 + c    ψ   sin 𝜃+ c     ψ  sin2𝜃
(436)

17.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(Ψ),
(437)

1 2     1  2      --
2g (Ψ) = 2 g0(1 − γ ˆg(Ψ )),
(438)

with ˆp and ĝ chosen to be of polynomial form:

ˆp(Ψ) = Ψ-α,
(439)

  --  --β
ˆg(Ψ) = Ψ ,
(440)

where

Ψ-≡ Ψ-−-Ψa-,
    Ψb − Ψa
(441)

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. (437) and (438), we obtain

                     --
dP-(Ψ-)= − 1-(P0 − Pb)αΨα−1
  dΨ      Δ
(442)

where Δ = Ψb Ψa, and

  dg     1   1  -β−1
g ---= − -g20γ--βΨ   .
  dΨ     2   Δ
(443)

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   Δ
(444)

The value of parameters P0, Pb, and g0 in Eqs. (437) and (438), and the value of α and β in Eqs. (439) and (440) 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. (570), i.e.,

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

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          (446)
            Δ                  μ0R 2   Δ
Using
       -1
dRdZ = R 𝒥 dψd𝜃,
(447)

Eq. (446) is written as

      [(    )                               ]
    ∫     -1           ′--   -1--1  2 1- ′--
Iϕ =      −Δ   (P0 − Pb)ˆp(Ψ)− μ0R22 g0γ Δ ˆg(Ψ) 𝒥 dψd𝜃,
(448)

from which we solve for γ, giving

    − ΔIϕ − (P0 − Pb)∫[pˆ′(Ψ)]𝒥 dψd𝜃
γ = -----1-2-∫ [-1-′--]---------.
        2μ0g0   R2ˆg (Ψ) 𝒥dψd 𝜃
(449)

If the total toroidal current Iϕ is given, Eq. (449) can be used to determine the value of γ.

17.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𝜃),
(450)

Z = κa sin𝜃,
(451)

with 𝜃 changing from 0 to 2π. According to the definition in Eqs. (28), (29), and (31) we can readily verify that the parameters a, R0, κ appearing in Eqs. (450) and (451) are indeed the minor radius, major radius, and ellipticity, respectively. According to the definition of triangularity Eq. (30), the triangularity δ for the magnetic surface defined by Eqs. (450) and (451) is written as

δ = sin Δ.
(452)

Another common expression for the shape of a magnetic surface was given by Miller[821], which is written as

R = R0 + acos[𝜃+ arcsin(Δ sin𝜃)],
(453)

Z = κa sin𝜃.
(454)

Note that Miller’s formula is only slightly different from the formula (450). For Miller’s formula, it is easy to prove that the triangularity δ is equal to Δ (instead of δ = sinΔ as given in Eq. (452)).

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,
(455)

Z = ψαZLCFS,
(456)

where α is a parameter, ψ is a label parameter of flux surface. If the shape of the LCFS is given by Eqs. (450) and (451), then Eqs. (455) and (456) are written as

R = R0 + ψ αacos(𝜃 + Δ sin𝜃),
(457)

Z = ψaκa sin 𝜃.
(458)

Fig. 30 plots the shape given by Eqs. (457) and (458) for a =0.4, R0 = 1.7, κ = 1.7, Δ = arcsin(0.6), and α = 1 with ψ varying from zero to one.


pict pict

Fig. 30: Shape of flux surface given by Eqs. (457) and (458). 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.

17.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 31 describes the steps involved in the iterative metric method.


pict pict

pict pict

pict

Fig. 31: 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).

17.7 Benchmark of the code

To benchmark the numerical code, I set the profile of P and g according to Eqs. (533) and (534) 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. 32.


pict

Fig. 32: 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 (542). 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)).

17.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. 33.


pict pict

Fig. 33: 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 (453) and (454) with R0 = 1.7, a = 0.45, κ = 1.7, and δ = 0.6.

 

 

 

17.9 Analytical form of Jacobian (need cleaning up)

Consider the Jacobian of the form

     ( R )m
𝒥 = μ  ---   ψn,
       R0
(459)

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. (459) since we do not use any information of Eq. (459) in the above steps. Now comes the question: how to make the transformation obtained above satisfy the constraint Eq. (459) through adjusting the values of 𝜃? To make the constraint Eq. (459) satisfied, 𝜃 and ψ should satisfy the relation

          [R (𝜃,ψ )]m
𝒥 (𝜃,ψ) = μ -------  ψn,
             R0
(460)

which

 

 

Using Eq. (), we obtain

0𝜃d𝜃 = 0𝜃d𝜃-𝒥-
ψn1-
μ(   )
  R0-
  Rm

    ∫ 𝜃   𝒥 1 (R0 )m
𝜃 =    d𝜃ψn-μ- -R-
     0
(461)

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
(462)

 

17.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. (182) can be written

             ∫ 2π
q(ψ) = − 1-g′    𝒥-2d𝜃                             (463)
        2πΨ  ∫0  R
        1--g -20πR-−2𝒥d𝜃-∫ 2π
    = − 2πΨ ′  ∫2π𝒥 d𝜃   0  𝒥d𝜃
               0  ∫ 2π
    = − 1--g ⟨R −2⟩    𝒥d𝜃                          (464)
        2πΨ ′      0
              -V-′-⟨R−2⟩
    = − sgn(𝒥 )(2π)2 Ψ ′ g.                         (465)
Equation (465) 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.
(466)

                 [           ]
  -dg    -(2π)2-- --(2π-)2--  ′
⇒ dΨ g = V′⟨R −2⟩q V ′⟨R −2⟩qΨ  ψ.
(467)

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. (595) by R2 gives

  [                                 ]
1  (   𝒥      )    (   𝒥         )        dp       dg
𝒥-   Ψ′R2|∇ψ |2   +  Ψ ′R2(∇ψ ⋅∇ 𝜃)   + μ0dΨ-+ R −2dΨ-g = 0.
                ψ                  𝜃
(468)

Surface-averaging the above equation, we obtain

       [                                ]
2π∫     (  ′ 𝒥    2)    ( ′ 𝒥         )       dp     −2 dg
V′-  d𝜃  Ψ R2-|∇ψ|    +  Ψ R2-(∇ψ ⋅∇𝜃)    + μ0dΨ-+ ⟨R  ⟩dΨ-g = 0,
                    ψ                  𝜃
(469)

   2π ∫    (   𝒥      )      dp        dg
⇒  -′- d𝜃  Ψ′--2|∇ ψ|2   +μ0 ---+ ⟨R −2⟩--g = 0,
   V         R        ψ     dΨ        dΨ
(470)

   2π[   ∫   (  |∇ψ |2) ]      dp        dg
⇒  -′-Ψ ′  d𝜃 𝒥 ---2-    + μ0---+ ⟨R −2⟩--g = 0,
   V              R     ψ    dΨ         dΨ
(471)

     [     ⟨     ⟩ ]
   1--  ′ ′ |∇ψ-|2        -dp     −2 dg-
⇒  V′ V Ψ     R2    ψ + μ0dΨ + ⟨R  ⟩dΨg = 0.
(472)

   [    ⟨     2⟩]
⇒   V′Ψ′  |∇-ψ2|-    + μ0V′ dp-+ ⟨R−2⟩V′ dg-g = 0,
           R     ψ       dΨ          dΨ
(473)

Substitute Eq. (467) into the above equation to eliminate gdg∕dΨ, we obtain

  [    ⟨      ⟩ ]                  [       ]
     ′ ′ |∇ψ|2          ′dp-       4 --qΨ-′--
⇒  V Ψ    R2     ψ + μ0V dΨ + q(2π) V ′⟨R− 2⟩ ψ = 0,
(474)

Eq. (474) 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⟩ ψ
(475)

              {                                              }
    ′′     1   [  ′⟨|∇ψ |2⟩ ]   ′      4[   q    ]   ′     ′ dp
⇒  Ψ  = −V-′D   V   --R2-    Ψ  +q(2π)  V-′⟨R-−2⟩  Ψ + μ0V  dΨ-
                            ψ                    ψ
(476)

where

    ⟨|∇ ψ|2⟩    (2π )4 ( q )2
D =  ---2-  + ---−2  --′
       R      ⟨R   ⟩ V
(477)

The GS equation is

△ ⋆Ψ = − μ R2 dp-− g dg
         0   dΨ     dΨ
(478)

                          4 [     ′  ]
⇒  △ ⋆Ψ = − μ0R2-dp−  q(2π)-----qΨ----
               dΨ    V′⟨R −2⟩ V ′⟨R −2⟩ ψ
(479)

                         4 { [       ]      [        ]  }
⇒ △ ⋆Ψ = − μ0R2-dp− q(2π)---  ---q----  Ψ′ + ---q---- Ψ′′
              dΨ    V′⟨R −2⟩   V ′⟨R−2⟩ ψ      V ′⟨R− 2⟩
(480)

Using Eq. (476) 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  .                        (481)
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⟩   ,             (482)
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π) βψ]
(483)

= ⇒ ---D----A = D β − β-1[V′′α + V ′α  + q(2π )4β ]
    − β(2π)4       ψ    V ′         ψ         ψ
(484)

Using

D = α + (2π )4⟨R− 2⟩β2
(485)

Eq. () is written as

                                                                    ]
=⇒  ---D---A = αβ  + (2π)4⟨R −2⟩β2β  − β-1-V′′α − β-1V ′α  − β 1-q(2π )4β
    − β(2π)4     ψ               ψ    V ′       V ′   ψ    V′      ψ
(486)

       D                 4  −2  2      1  ′′           1     4  ]
=⇒  −-β(2π-)4A = α βψ + (2π) ⟨R  ⟩β βψ − β V′V α − βαψ − βV-′q(2π) βψ
(487)

   A                                1
−-β(2π)4D = αβψ + (2π )4⟨R− 2⟩β2βψ − βV-′V ′′α − β αψ − β2⟨R −2⟩(2π)4βψ
(488)

       A               1   ′′
= ⇒ −-β(2π)4-D = αβψ − βV′V  α− βα ψ
(489)

                   (   )
=⇒  ---A---D  = − β2 α-   − β 1-V ′′α
    − β(2π)4          β  ψ    V′
(490)

      A            (α )       1   α
=⇒  − β(2π)4D = − β2 β   − β2V-′V ′′β-
                       ψ
(491)

                   [               ]
      A             (α )     1   α
=⇒ −-β(2π)4D = − β2  -β   + V-′V ′′β-
                        ψ
(492)

                      [(  )           ]
    ---A----      2-1-   α-    ′   ′′α-
= ⇒ − β(2π)4 D = − β V ′  β  ψV  + V β
(493)

       A            1 (α   )
=⇒  − β(2π)4D = − β2V-′ β-V′
                            ψ
(494)

           4 (        )3   [⟨     2⟩   −2    ]
=⇒  A = (2π)- ----q---   1--  |∇-ψ|-  ⟨R--⟩V ′2
         D    V ′⟨R −2⟩   V′    R2      q      ψ
(495)

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Ψ
(496)

 

18 Misc contents

18.1 Expression of current density

Let us derive the contravariant expression for the current density. Using

μ0J = ∇× B,

along with magnetic field expression (176) and the curl formula (138), we obtain

       [                               ]
         ( ′ 𝒥     2)    (  ′ 𝒥       )              ′
μ0J = −   Ψ R2-|∇ ψ|   +   Ψ R2∇ ψ ⋅∇𝜃    ∇ψ × ∇ 𝜃− g∇ ϕ × ∇ψ,     (497)
                     ψ                 𝜃
which is the contravariant form of the current density vector. Next, for later use, calculate the parallel current. By using Eqs. (176) and (497), 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 ∇ψ ⋅∇𝜃    .                               (498)
                              ψ                 𝜃

18.2 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 ,
(499)

where

   ∫
Φ =   B ⋅dS.
     S
(500)

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  =  V02μ0 dV,
(501)

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:

W =  1LI2,
     2
(502)

i.e.,

    2W--
L = I2 ,
(503)

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

              ∫    2
Li ≡ 2Wi-=  2-   B-𝜃dV
      I2    I2 P 2μ0
(504)

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 ≡ μ0R0∕2 ,
(505)

where R0 is the major radius of the device (equal to R of the magnetic axis). Using Eq. (504), expression (505) is written as

      1    2 ∫  B2        2V   ∫  B2dV
li = -------2    -𝜃-dV = -2-2----P--𝜃---,
    μ0R0∕2I   P 2μ0     I μ0R0    V
(506)

which is the definition of li used in the ITER design.

Another way of defining the normalized internal inductance is

    ⟨B2𝜃⟩P-
li = ⟨B2 ⟩S,
      𝜃
(507)

where S is the surface average over the plasma boundary. For circular cross section with minor radius a and assuming B𝜃 is independent of the poloidal angle, then, Ampere’s law gives B𝜃(a) = μ0I∕(2πa). Then B𝜃2S is approximated as

               μ20I2
⟨B2𝜃⟩S ≈ B20(a) = 4π2a2
(508)

Using this and V πa22πR0,  Eq. (507) is written as

    4π2a2        4π2a2R            2V
li =--2-2 ⟨B2𝜃⟩P = --2-2--0⟨B2𝜃⟩P = -2-2--⟨B2𝜃⟩P,
     μ0I          μ0I R0         μ0I R0
(509)

which agrees with the definition in Eq. (506).

The normalized internal inductance reflects the peakness of the current density profile in the toroidal plasma: a small value of li corresponds to a broad current profile.

 

18.3 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.  (36) is approximated to

    1 ∮  1B        1 B  (r) 1 ∮        1 B (r)1        r B (r)
q =---   ---ϕdℓp ≈ ----ϕ-----   dℓp = ----ϕ-----2πr = ----ϕ---,
   2π    R Bp      2πBp (r)R0         2π Bp(r)R0      R0 Bp(r)
(510)

 

 

18.4 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. 34.


pict

Fig. 34: 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. [25][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 toroidal magnetic field of EAST tokamak

Using Ampere’s circuital law

∮
  B ⋅dl = μ0I,
(511)

along the toroidal direction and assuming perfect toroidal symmetry, we obtain

2πRB ϕ = μ0I,
(512)

which gives

     -μ0I        −7 I
Bϕ = 2πR  = 2× 10  R .
(513)

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. (513) is written

     μ × 16× 132 × I              I
Bϕ = -0------------s-= 4.224 × 10−4-s
           2πR                    R
(514)

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 [30]).

Note that the exact equilibrium toroidal magnetic field Bϕ is given by Bϕ = g(Ψ)∕R. Compare this with Eq. (513), we know that the approximation made to obtain Eq. (514) 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. (514).

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,
(515)

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. (514), Eq. (515) is written as

     4.224× 10−4Is2πa2
q95 ≈-----μ0Ip----R2---,
                    axis
(516)

For EAST, tipically Raxis = 1.85m and a = 0.45m. Using this, we obtain

        I
q95 ≈ 125-s.
        Ip
(517)

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. 35.

 


pict pict

Fig. 35: Location of the RMP coils on EAST tokamak in 3D view (left) and poloidal view (right).

 

18.5 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[20] KSTAR[18] 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. (514) 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[20]. Using formula (513), 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[24]. Using these information and formula (513), 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 (513), the toroidal filed at R = 6.2m can be calculated, giving 5.29T

 

18.6 Miller’s formula for shaped flux surfaces

According to Refs. [821], Miller’s formula for a series of shaped flux surfaces is given by

R = R0(r)+ rcos{𝜃+ arcsin[δ(r)sin𝜃]},
(518)

Z = κ(r)rsin 𝜃,
(519)

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
(520)

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
(521)

and the elongation profile is

                  (r)4
κ(r) = κ0 − 0.3+ 0.3-  .
                   a
(522)

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. 36.



Fig. 36: Flux-surfaces given by Eqs. (518) and (519) 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.

 

 

18.7 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
(523)

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. 37: Pressure profile of double (inner and external) transport barriers given by Eq. (523) with ai = 1, bi = 0.2, ψi = 0.36, ψe = 0.96, wi = 0.2, we = 0.04, c = 0.

 


pict

Fig. 38: Equilibrium pressure profile for EAST discharge #38300 at 3.9s (reconstructed by EFIT code, gfile name: g038300.03900), which shows a boundary transport barrier.

18.8 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=− ∞
(524)

If we use the above sum to define a function

       ∞∑  -
z(𝜃) =     z(𝜃 +2πl),
      l=− ∞
(525)

then it is obvious that

z(𝜃 +2π ) = z(𝜃),
(526)

i.e., z(𝜃) is a periodic function about 𝜃 with period of 2π.

If we use the right-hand-side of Eq. (525) 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

[In passing, 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 = A  ∇R + A ∇ ϕ+ A  ∇Z.
      1      2       3
(527)

where A2 is the covariant toroidal component of A. To obtain A2, we take scalar product of Eq. (527) with r∕∂ϕ and use the orthogonality relation (102), which gives

   ∂r
A ⋅---= A2.
   ∂ϕ
(528)

In cylindrical coordinates (R,ϕ,Z), the location vector is written as

r(R, Z,ϕ) = R ˆR(ϕ)+ Z ˆZ+ 0ˆϕ
(529)

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 =  ∂R |∂R|  ,Z = ∂Z  |∂Z |  ,ϕ = ∂ϕ |∂ϕ|
(530)

Using this, we obtain

∂r
---= Rˆϕ,
∂ϕ
(531)

Use Eq. (531) in Eq. (528) giving

A  = A R,
 2    ϕ
(532)

with Aϕ defined by Aϕ = A ˆϕ. Equation (532) indicates that Ψ = AϕR is the covariant toroidal component of the vector potential.]

A.1 Solovév equilibrium

For most choices of P(Ψ) and g(Ψ), the GS equation (66) has to be solved numerically. For the particular choice of P and g profiles given by

dP     c1
dΨ-= − μ-,
        0
(533)

  dg
g ---= − c2R20,
  dΨ
(534)

analytical solution to the GS equation can be found, which is given by[16]

    1                 1
Ψ = -(c2R20 + c0R2)Z2 +-(c1 − c0)(R2 − R20)2,
    2                 8
(535)

where c0, c1, c2, and R0 are arbitrary constants. [Proof: By direct substitution, we can verify Ψ of this form is indeed a solution to the GS equation (66).] A useful choice for tokamak application is to set c0 = B0(R02κ0q0), c1 = B0(κ02 + 1)(R02κ0q0), and c2 = 0. Then Eq. (535) is written

       B    [       κ2         ]
Ψ = ---20--  R2Z2 + -0(R2 − R20)2 ,
    2R 0κ0q0         4
(536)

which can be solved analytically to give the explicit form of the contour of Ψ on (R,Z) plane:

        ∘ -----------------------
      1-  2R20κ0q0    κ20  2    2 2
Z = ± R     B0   Ψ − 4 (R  − R 0),
(537)

which indicates the magnetic surfaces are up-down symmetrical. Using Eq. (533), i.e.,

dP     c1     B0(κ20 + 1)
dΨ-= − μ0-= − μ0R2κ0q0-,
                  0
(538)

the pressure is written

        B  (κ2 + 1)
P = P0 −--0-20----Ψ,
         μ0R0κ0q0
(539)

where P0 is a constant of integration. Note Eq. (536) indicates that that Ψ = 0 at the magnetic axis (R = R0,Z = 0). Therefore, Eq. (539) indicates that P0 is the pressure at the magnetic axis. The toroidal field function g is a constant in this case, which implies there is no poloidal current in this equilibrium. (For the Solovev equilibrium (536), 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.           (540)
       2R 0κ0q0
)

 

Define Ψ0 = B0R02, and Ψ = Ψ∕Ψ0, then Eq. (536) is written as

--    1  [--2-2  κ2 --2    ]
Ψ = 2κ-q- R Z  + -04 (R − 1)2  ,                    (541)
      0 0
where R = R∕R0, Z = Z∕R0. From Eq. (541), we obtain
--    1 ∘ --------κ2---2-----
Z = ± --  2κ0q0Ψ − -0(R  − 1)2.
      R            4
(542)

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. (542) 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.)

The minor radius of a magnetic surface of the Solovev equilibrium can be calculated by using Eq. (537), which gives

      ∘-----√----
Rin =  R20 −  AΨ,
(543)

      ∘ -----√----
Rout =  R20 +  A Ψ,
(544)

and thus

                ∘ ---------- ∘ ----------
                  R2 + √A-Ψ −  R2 − √A-Ψ
a = Rout −-Rin =---0-------------0------.
        2                   2
(545)

where A = 8R02q0(B0κ0). In my code of constructing Solovev magnetic surface, the value of a is specified by users, and then Eq. (545) 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. (545), the inverse aspect ratio of a magnetic surface labeled by Ψ can be approximated as[16]

    ∘ -2q-Ψ---
𝜀 ≈   ---02---.
      κ0R0B0
(546)

Therefore, the value of Ψ of a magnetic surface with the inverse aspect ratio 𝜀 is approximately given by

     2   2
Ψ = 𝜀-κ0R0B0-.
       2q0
(547)

A.2 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- + U ⋅∇U  = ρ E + J ×B − ∇ ⋅ℙ,
 m   ∂t             q
(548)

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,
(549)

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ϕ,
(550)

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. (549) is written as

ρmU ⋅∇U  = ρmR ωTeϕ ⋅∇(RωT eϕ)
                  1 ∂
         = ρmR ωTR-∂-ϕ(RωTeϕ)
                  2
         = − ρmR ω TeR,                           (551)
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. (549) 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.3 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 (49) and (50) are written

         1 dg ∂Ψ   dg
μ0JR = − --------= ---BR,
         R dΨ ∂Z   dΨ
(552)

and

        1dg ∂Ψ    dg
μ0JZ = --------=  --Bz,
       R dΨ ∂R    dΨ
(553)

respectively. The above two equations imply that

J     B
-R-=  -R-,
JZ    BZ
(554)

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

      1
Ipol = μ02π[g(Ψ2) − g(Ψ1)],
(555)

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 (555) 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 × ∇ϕ                                   (556)
      0
Using g = g(Ψ), Eq. (556) can also be written as
Jp =-1-dg-∇Ψ × ∇ϕ
    μ0 dΨ
  = -1-dg-Bp.                               (557)
    μ0 dΨ

A.4 Efficiency of tokamak magnetic field in confining plasma: Plasma beta

To characterize the efficiency of the magnetic field of tokamaks in confining plasmas, define the plasma β, which is the ratio of the thermal pressure to the magnetic pressure, i.e.,

       p
β = B2∕2μ--.
          0
(558)

Since the pressure in tokamak plasmas is not uniform, the volume averaged pressure is usually used to define the beta. In tokamak plasmas, the toroidal beta βt and the poloidal beta βp are defined, respectively, by

      ⟨p⟩
βt = B2-∕2μ-,
      t0   0
(559)

       ⟨p⟩
βp =---2-----,
    ⟨B𝜃⟩s∕2μ0
(560)

where is the volume averaging, s is the surface averaging over the plasma boundary, Bt0 is the vacuum toroidal magnetic field at the magnetic axis (or geometrical center of the plasma). 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 so-called bootstrap current, which is important for tokamak steady state operation. Alternatively, βp can be understood as characterizing the efficiency of the plasma current in confining the plasma. This can be seen by using Ampere’s law to approximately write the average poloidal magnetic field Bpa μ0Ip(2πa). Then βp is written

     ----⟨p⟩-----
βp ≈ μ0I2p∕(8π2a2),
(561)

which is the ratio of the pressure to the plasma current, and thus characterizes the efficiency of the plasma current in confining the plasma.

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.

A.5 Beta limit

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
(562)

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[23].

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 to be 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. (561) and Eq. (), respectively, we recognize that pressure limit should have a scaling of p⟩∝ Ipα with 1 < α < 2. )

A.6 Why bigger tokamaks with larger plasma current are better at fusion?

As is mentioned in Sec. A.4, 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.,

     Ip
⟨p⟩ ∝-a
(563)

The total plasma energy is given by E ≈⟨p2πRπa2, where R is the major radius of the device. Using Eq. (563), we obtain

E ∝ IpaR.
(564)

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

τE ∝ I2,
     T
(565)

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
(566)

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
(567)

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.7 Density limit

The maximum density that can be obtained in stable plasma operations (without disruption) is empirically given by

ne ≈ 1.5nG,
(568)

where nG is the Greenwalt density, which is given by

       14-Ip-
nG = 10 πa2
(569)

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 (569) 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.8 Relation of plasma current density to pressure gradient

Due to the force balance condition, the plasma current is related to the plasma pressure. Using the equilibrium constraint in the R direction, the toroidal current density Jϕ given by Eq. (53) can be written as

Jϕ = R dP-+--1--dg-g.                         (570)
      dΨ   μ0R dΨ
The parallel (to the magnetic field) current density is written as
     J ⋅B
J∥ ≡ -B---
     J B  + J ⋅B
   = -ϕ--ϕ---p---p
     (  dP B  1 dg ) g   1 dg(∇ Ψ)2
     -R-dΨ +-μ0R-dΨg--R-+-μ0dΨ--R---
   =               B
      dP   1-dg [(g-)2  (∇Ψ-)2]
   = gdΨ-+-μ0dΨ---R--+---R----
                B
     gddPΨ + 1μ0 ddgΨB2
   = ------B------.
      dP 1    1 dg
   = gdΨ-B-+ μ--dΨB.                                 (571)
              0
For later use, define
    J∥
σ ≡ B-
     dP  1    1 dg
  = gdΨ-B2-+ μ--dΨ.                          (572)
              0
Equation (572) is used in GTAW code to calculate J∕B (actually calculated is μ0J∕B)[15]. Note that the expression for J∕B in Eq. (572) is not a magnetic surface function. Define σps as
σps ≡ σ − ⟨σ⟩
       dP [ 1   ⟨ 1 ⟩ ]
   = g dΨ- B2-−   B2-                          (573)
       ps
   ≡  J∥-,                                     (574)
      B
where Jps 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⟩,                      (575)
 0         0 dΨ   dΨ
where is flux surface averaging operator.

A.9 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.
(576)

Next, let us examine what constraint this condition imposes on the magnetic field. Using expression  (10), the above equation is written as

∇ × (∇Ψ × ∇ϕ )+ ∇g × ∇ϕ = 0,
(577)

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 = ∇ Φ,
(578)

then the constraint ∇⋅ B = 0 is written as

∇2Φ = 0.
(579)

A.10 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),
(580)

and inside the another, we use

g = Ψ 3∕(B20R50),
(581)

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 (580) and (581) 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-∂ϕ-.
(582)

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.11 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. (177) is always positive. It follows that qglobal should be also positive. Next, let us examine whether this property is correctly preserved by Eq. (183). Case 1: The radial coordinate ψ is chosen as Ψ′≡ dΨ∕dψ > 0. Then the factor before the integration in Eq. (183) 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. (183) 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. (183) 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. 1. 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. (20) is written
Ψp1 = 2π(Ψ − Ψa).
(583)

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. 66). The magnetic flux through the toroidal surface S2 is given by

i.e.

Ψ − Ψ = Ψp1,
    a   2π
(584)

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. (583) 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. 66).

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.12 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
(585)

          ∫ Ψ
=⇒  ψt = 2π 0 qdΨ
(586)

Define:

   ∘ ψ--
ρ ≡  --t
      π
(587)

(In the Toray_ga code, the radial coordinate ρ is defined as

    ∘ -----
ρ ≡   -ψt-,
      πBt0
(588)

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. (587) to define ρ. Then we have

      2
ψt = πρ
(589)

    dψ
=⇒  --t = 2πρ
     dρ
(590)

    dψ dψ
=⇒  --t---= 2πρ
    dψ dρ
(591)

       dψ-
=⇒  2πqdρ = 2πρ
(592)

    dψ    ρ
= ⇒ ---=  -
    dρ    q
(593)

Eq. (593) 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.13 Toroidal elliptic operator in magnetic surface coordinate system

If (ψ,𝜃,ϕ) are magnetic surface coordinates, i.e., ∂Ψ∕∂𝜃 = 0, then the toroidal elliptic operator in Eq. (414) is reduced to

          [(          )    (             ) ]
  ⋆    R2-     𝒥--    2        -𝒥-
△  Ψ = 𝒥     ΨψR2 |∇ ψ|  ψ +  ΨψR2 ∇ψ ⋅∇ 𝜃 𝜃 ,
(594)

and the GS equation, Eq. (417), is reduced to

R2 [(   𝒥      )    (   𝒥        )  ]        dP    dg
---  Ψψ -2|∇ψ |2   +  Ψ ψ-2-∇ψ ⋅∇𝜃    = − μ0R2---−  --g(Ψ).
𝒥       R        ψ      R          𝜃         dΨ    dΨ
(595)

A.14 Grad-Shafranov equation in (r,𝜃,ϕ) coordinates

Definition of (r,𝜃,ϕ) coordinates

Define (r,𝜃,ϕ) coordinates by

R = R0 + rcos𝜃,
(596)

Z = rsin 𝜃,
(597)

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.                                             (598)
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
(599)

      -------Z-------        ∂𝜃-  r−-Z-Zr-
sin 𝜃 = ∘ (R-−-R-)2 +-Z2-⇒ cos𝜃 ∂Z =  r2   .
              0
(600)

   ∂𝜃     r− ZZ-    1− sin2 𝜃   cos2𝜃
⇒  ∂Z-= r(R-−-Rr) = -R-−-R--=  R-− R--
               0          0         0
(601)

∂ sin𝜃   r − ZZ-   1− sin2𝜃   cos2𝜃
------= ---2-r-=  --------= -----
  ∂Z       r         r        r
(602)

The GS equation in (R,Z) coordinates is given by

 2         (     )
∂-Ψ2 + R ∂- -1∂-Ψ  = − μ0R2dP-− -dgg(Ψ).
∂Z      ∂R  R ∂R           dΨ   dΨ
(603)

The term ∂Ψ∕∂Z is written as

∂ Ψ   ∂Ψ ∂r   ∂Ψ ∂ 𝜃
--- = ------+ ------
∂Z    ∂r ∂Z    ∂𝜃∂Z  2
    = ∂Ψ-sin 𝜃+ ∂Ψ--cos-𝜃.                       (604)
      ∂r       ∂ 𝜃R − R0
Using Eq. (604), 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-𝜃-                                          (605)
      ∂ 𝜃R − R0          R − R0
         ∘ --------------
-∂r = -∂-  (R − R0)2 + Z2 = R-−-R0-= cos𝜃
∂R    ∂R                     r
(606)

sin𝜃 = ∘------Z--------
  (R − R0)2 + Z2.

cos𝜃∂𝜃
---
∂R = ZR − R
---3-0-
  r

∂𝜃-= − Z-.
∂R     r2
(607)

cos𝜃 =     R − R0
∘--------2----2-
  (R − R0 ) +Z

 ∂        r− R−R0(R − R0)   1− cos2𝜃   sin2𝜃
---cos𝜃 = -----r-2--------= -------- = -----
∂R              r               r        r
(608)

     (     )        [  (               )]
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𝜃                                  (609)
               ∂r(        ∂ 𝜃  r    ) ∂r∂𝜃 r        ∂r  r     ∂𝜃  r
             − 1-  ∂Ψ-cos𝜃− ∂Ψ-1 sin𝜃                                                                       (610)
               R   ∂r       ∂ 𝜃r
Summing the the right-hand-side of Eq. (605) and the expression on line (609) yields
∂2Ψ-  ∂Ψ-1   1-∂2Ψ-
∂r2 +  ∂rr + r2∂ 𝜃2 .
(611)

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(Ψ),
(612)

which agrees with Eq. (3.6.2) in Wessson’s book[28], where f is defined by f = RBϕ∕μ0, which is different from g RBϕ by a 1∕μ0 factor.

A.15 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
(613)

where Ψ0 O(𝜀0), Ψ1 O(𝜀1). Substituting Eq. (613) into Eq. (612), 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)−
(614)

Further assume the following orderings (why?)

  ∂ Ψ
R0--- ∼ O(𝜀−1)Ψ,
   ∂r
(615)

and

∂Ψ
---∼ O (𝜀0)Ψ.
∂𝜃
(616)

Using these orderings, the order of the terms in Eq. (614) can be estimated as

 21-∂- ∂Ψ0-  Ψ0-     −2
R0r∂r r∂r  ∼ 𝜀2 ∼ O(𝜀  )
(617)

  1 ∂  ∂Ψ    Ψ
R20----r--1-∼ -12-∼ O(𝜀−1)
  r∂r  ∂r    𝜀
(618)

  1 ∂2Ψ     1
R20-2---02 ∼ -2Ψ0 ∼ O(𝜀−2)
  r  ∂𝜃    𝜀
(619)

  21-∂2Ψ1   Ψ1-     −1
R 0r2 ∂𝜃2 ∼ 𝜀2 ∼ O(𝜀  )
(620)

    R            r
------0--- ≈ 1− ---cos𝜃
R0 + rcos𝜃      R0
(621)

  ∂ Ψ        Ψ
R0---0cos𝜃 ∼ -0∼ O (𝜀−1)
   ∂r        𝜀
(622)

   ∂Ψ01       Ψ0-     −1
R0 ∂𝜃 r sin 𝜃 ∼ 𝜀 ∼ O (𝜀  )
(623)

   ∂Ψ        Ψ
R0 --1-cos 𝜃 ∼-1-= O (𝜀0)
    ∂r        𝜀
(624)

  ∂ Ψ 1       Ψ
R0---1-sin𝜃 ∼ -1-= O(𝜀0)
   ∂𝜃 r       𝜀
(625)

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),
(626)

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. (626) is written

1∂-r∂Ψ0-= − μ R2P ′(Ψ )− g′(Ψ )g(Ψ ).
r∂r  ∂r      0 0    0      0    0
(627)

(My remarks: The leading order equation (627) 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𝜃
(628)

  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
(629)

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
(630)

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
(631)

      (        )        (    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
(632)

      (        )          (      )
 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
(633)

  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
(634)

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-
(635)

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
(636)

       (        )
⇒  1-d  rdΨ0-dΔ- +  d2Ψ0-dΔ-= − μ 2R rP′(Ψ )+ -1-dΨ0-
   rdr    dr dr     dr2 dr      0  0     0   R0 dr
(637)

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 ,
(638)

equation (637) is written

       [            ]
1 dr d   ( dΨ0)2 dΔ              ′      1 dΨ0
rdΨ--dr r  -dr-  dr- = − μ02R0rP (Ψ0)+ R---dr ,
   0                                     0
(639)

   1 d [ ( dΨ )2 dΔ]           dP    1 ( dΨ )2
⇒  ---  r  --0-  --- = − μ02R0r---+ ---  --0-  ,
   rdr     dr    dr            dr   R0   dr
(640)

Using

B  =  1-dΨ0-
 𝜃0   R0 dr
(641)

equation (640) is written

1 d [    dΔ ]        1  dP   B2
r dr rB2𝜃0-dr  = − μ02R-rdr-+ -R𝜃0.
                      0        0
(642)

     [       ]      (                  )
⇒  d- rB2𝜃0dΔ- = -r- − 2μ0rdP-(Ψ0) + B2𝜃0 ,
   dr      dr    R0          dr
(643)

which agrees with equation (3.6.7) in Wessson’s book[28].

A.16 (s,α) parameters

The normalized pressure gradient, α, which appears frequently in tokamak literature, is defined by[3]

            1   dp
α = − R0q2 B2∕2μ-dr ,
           0   0
(644)

which can be further written

          dp
α = − R0q2--,
          dr
(645)

where p = p∕(B022μ0). Equation (645) can be further written as

     1  2dp
α = − 𝜀aq dr,
(646)

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
(647)

which can be written

   -
s = r dq.
   q dr
(648)

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
(649)

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. (649) can be solved to give

     μ0I    2
Ψ = 4πa2R0r  .
(650)

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).
(651)

    rdq   √ρ dq  1             1 dq
s = qdr = -q-dΨ-2√ρ-(Ψb − Ψ0) = 2qdΨ-(Ψb − Ψ0).
(652)

The necessary condition for the existence of TAEs with frequency near the upper tip of the gap is given by[3]

α < − s2 + 𝜀,
(653)

which is used in my paper on Alfvén eigenmodes on EAST tokamak[15]. Equations (651) and (652) 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   ,                      (654)
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 |
(655)

where

 ′     |r-−-r′|
t = t−   c   ,
(656)

is called the retarded time. For a steady-state source, J(r,t) = J(r). Then Eq. (655) is simplified as

      μ0 ∫   J(r′)
A(r) = 4π   |r-−-r′|d3r′.
          Ω
(657)

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 |
(658)

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 ).                       (659)
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 |
(660)

(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),
(661)

and

 ′   ′    ′ˆ    ′    ′ˆ     ′ˆ
r = R cosϕ ex + R sin ϕey + Z ez
(662)

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,
(663)

r = Rˆex + 0ˆey + Zˆez,
(664)

Using these, we obtain

  ′         ′  ′    ′
dl ⋅eϕ(r) = R dϕ cosϕ.
(665)

and Eq. (660) is written as

                μ0I∫ 2π              R ′cosϕ ′dϕ′
A ϕ(R, Z,ϕ = 0) = 4π     ∘-------′2--------′----′2-----′---′2-.
                     0    (Z − Z ) + (R − R cosϕ) + (R sinϕ )
(666)

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ϕ-----------.                 (667)
  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 write the above expresion in this form. Define 𝜃 = (π ϕ)2, then cosϕ= cos(π 2𝜃) = cos(2𝜃) = 2sin2𝜃 1. Using this Eq. (667) 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𝜃---------                (668)
  4π  0     (Z − Z ′)2 + (R + R′)2 − 4RR ′sin2𝜃
Define
            4RR ′
k2 = ------′2--------′2-
     (Z − Z ) + (R + R )
(669)

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)]
  2π   k
where
E(k) = 0π∕2∘ -----2--2-
  1 − k sin 𝜃d𝜃

K(k) = 0π∕2      1
∘-----------
  1− k2 sin2𝜃d𝜃,

are the eliptic integrals of the first and second kind.

 

 

Similarly, we can calculate the magnetic field:

       μ0I ∮ dl′ × (r − r′)
B (r) =-4π   --|r−-r′|3--,                       (670)
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)sinϕ

ˆeZ dl′× (r r) = (  ′2     ′    ′)
 R   − RR cosϕ

Using these in Eq. (670), BR(r) and BZ(r) are written as

         ∫ 2π               ′      ′    ′
BR  = μ0I     (------------R-(Z-−-Z-)sin-ϕ-----------)--dϕ′,
      4π  0    ∘ (Z-−-Z-′)2 +-(R-−-R′cosϕ′)2-+(R-′sinϕ′)2 3
      μ0I∫ 2π              R′2 − RR ′cosϕ′
BZ  = 4π-     (∘-----------------------------------)3-dϕ′,
          0      (Z − Z ′)2 + (R − R′cosϕ′)2 +(R ′sinϕ′)2
Dropping I in the above expressions gives the corresponding Green’s function:
                    ∫ 2π               ′     ′     ′
GBR (R′,Z′,R, Z) = μ0-    (-----------R-(Z-−-Z-)sin-ϕ-----------)-dϕ ′ (671)
                  4π 0    ∘ (Z-−-Z′)2 +-(R-− R-′cosϕ′)2 +-(R′sinϕ′)2-3
                    ∫
      ′  ′        μ0- 2π--------------R′2 −-RR-′cosϕ-′-----------   ′
GBZ (R ,Z,R, Z) = 4π 0  ( ∘ -----′-2--------′----′2----′----′2)3dϕ   (672)
                            (Z − Z ) + (R − R cosϕ) + (R sinϕ )

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.
(673)

Using Eq. (673) and (), we obtain

            |                     |
            ||   ˆex     ˆey     ˆez  ||
dl× (r − r′) = ||dR cosϕ dR sinϕ dZ   ||.
            |(x − x ′) (y − y′) (z − z′)|
(674)

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[26], 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]    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.

[18]    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.

[19]    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.

[20]    J.L. Luxon. A design retrospective of the DIII-D tokamak. Nuclear Fusion, 42(5):614–633, may 2002.

[21]    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.

[22]    M. Ottaviani. An alternative approach to field-aligned coordinates for plasma turbulence simulations. Physics Letters A, 375(15):1677–1685, 2011.

[23]    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.

[24]    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.

[25]    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].

[26]    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].

[27]    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.

[28]    John Wesson. Tokamaks. Oxford University Press, 2004.

[29]    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.

[30]    B J Xiao, D A Humphreys, and M L Walker. East plasma control system. Fusion Engineering and Design, 83:181, 2008.

[31]    B. J. Xiao. The first diverted plasma on east tokamak. 34th EPS Conference on Plasma Phys, 2007.