Axisymmetric Tokamak (Toroidal)
ElectromagneticFields.AxisymmetricTokamakToroidal — Module
Axisymmetric tokamak equilibrium in (r,θ,ϕ) coordinates with covariant components of the vector potential given by
\[A (r, \theta, \phi) = \frac{B_0 R_0}{2} \, \bigg( \frac{Z}{R} \cos (\theta) - \ln \bigg( \frac{R}{R_0} \bigg) \sin (\theta) , \, - r \, \bigg[ \frac{Z}{R} \sin (\theta) + \ln \bigg( \frac{R}{R_0} \bigg) \cos (\theta) \bigg] , \, + \frac{r^2}{q_0 R_0} \bigg)^T ,\]
resulting in the magnetic field with covariant components
\[B (r, \theta, \phi) = \frac{B_0}{q_0} \, \bigg( 0 , \, \frac{r^2}{R}, \, q_0 R_0 \bigg)^T ,\]
where $R = R_0 + r \cos \theta$ and $Z = r \sin \theta$.
Parameters:
R₀: position of magnetic axisB₀: B-field at magnetic axisq₀: safety factor at magnetic axis
Constructing the Field
using CairoMakie
using ElectromagneticFields
equ = AxisymmetricTokamakToroidal.init()Axisymmetric Tokamak Equilibrium in Toroidal Coordinates with
R₀ = 1.0
B₀ = 1.0
q₀ = 2.0Plotting
The coordinates $(r, \theta, \phi)$ are the natural ones for this field — the flux surfaces are the surfaces of constant $r$. For the plot the poloidal plane is sampled in $(R,Z)$ and mapped to $(r,\theta)$ first, so the result is directly comparable with the cartesian and cylindrical versions of the same equilibrium:
plot_equilibrium(equ)Evaluating the Field
AxisymmetricTokamakToroidal.@code()The chart maps $(r, \theta, \phi)$ to the cartesian coordinates, and to_cartesian and from_cartesian move between the two:
t = 0.0
ξ = [0.5, π/4, 0.0]
x = to_cartesian(t, ξ)3-element Vector{Float64}:
1.3535533905932737
0.0
0.35355339059327373roundtrip = from_cartesian(t, x) ≈ ξ
roundtriptrueBecause the toroidal chart is left-handed, the determinant of its Jacobian is minus the Jacobian determinant J:
using LinearAlgebra
signed = det(DF(t, ξ)) ≈ orientation() * J(t, ξ)
orientation(), signed(-1, true)