In (ψ,𝜃,ϕ) coordinates:
ψ is the normalized poloidal magnetic flux, ψ = (Ψ − Ψaxis)∕(Ψlcfs − Ψaxis).
𝜃 ∈ [−π,π) is increasing along the anti-clockwise direction when viewed along ∇ϕ direction with 𝜃 = −π at the high-field-side midplane.
ϕ is the toroidal angle of the right-handed cylindrical coordinates (R,ϕ,Z).
In this convention, the Jacobian of the (ψ,𝜃,ϕ) coordinate system, 𝒥 = (∇ψ ⋅∇𝜃 ×∇ϕ) is negative, i.e., (ψ,𝜃,ϕ) is a left-handed system. The field-line-following coordinate system (ψ,𝜃,α) is also a left-handed system. The coordinate system (x = ψ,y = α,z = 𝜃) is a right-handed system.
I do not need to make connection with GEM’s equilibrium poloidal array because there is no coupling of equilibrium quantities between the code written by me and the original code in GEM. The coupling happens for the perturbed quanties, whose poloidal grids need to be consistent.
The gridpoint number along 𝜃 for perturbations is denoted by mpol2. Its value is not chosen by users. Instead, it is equal to numproc/ntube, i.e., mpol2 is the total number of cells along 𝜃 for MPI parallelation. (numproc and ntube must be chosen in a way that makes numproc/ntube an integer.)
Poloidal grid-points for perturbations are indexed as 0:mpol2-1, with 0 corresponding to 𝜃 = −π and mpol2 corresponding to 𝜃 = π. Field equations are solved at 0 : mpol2 − 1. (The field at mpol2, i.e., 𝜃 = +π, is not identical to that at 𝜃 = −π due to toroidal shift of a magnetic field line when it finish one poloidal loop, and is obtained by toroidally inerpolating the fields at 𝜃 = −π.) No array for this is actually used in the code. The indexes just correspond to gclr of MPI processors.
The equilibrium poloidal gridpoint number, mpol, must be chosen in a way that makes (mpol-1)/mpol2 an integer, which can be larger than 1, i.e., one simulation cell can span several equilibrium cells.
GEM array index system is better than TEK’s because my system is not consistent: sometimes I use 0-based index and sometimes I use 1-based index, sometimes the index ends at n and sometimes ends at n+1. It is important to know accurately the transformation between the two systems.