<<

DESC: An Efficient Equilibrium Code

Daniel Dudt1 Egemen Kolemen1,2 1Princeton University 2Princeton Physics Laboratory

APS DPP November 9, 2020 1 Overview & Motivation

DESC1 is a pseudo-spectral stellarator equilibrium solver that: 1. Uses global spectral methods with Fourier & Zernike basis functions • Properly resolves the magnetic axis • Minimizes the system dimensionality • Gives a global solution (no interpolation between flux surfaces) 2. Solves force balance directly in real space (instead of the energy principle) • Avoids numerical issues at rational surfaces • Allows for perturbations to easily search the equilibrium solution space 3. Is written modern Python with high-level structure • Easy to use and extend the code for individual applications • Designed for stellarator optimization: automatic differentiation, GPUs, etc. 4. Currently solves fixed-boundary equilibria with nested flux surfaces

APS DPP November 9, 2020 1D. W. Dudt, and E. Kolemen, Phys. Plasmas 27 102513 (2020). 2 “Inverse” Equilibrium Problem

• Computation domain is the straight field- line coordinate system (휌, 휗, 휁) • Free variables are the flux surface shapes 푅(휌, 휗, 휁) & 푍(휌, 휗, 휁) • Problem is to find the flux surfaces that satisfy the equilibrium conditions: 푱 × 푩 = 훁푝 훁 × 푩 = 휇0푱 훁 ⋅ 푩 = 0

APS DPP November 9, 2020 3 Fourier-Zernike Basis Set

• Discretize flux surfaces with global Fourier- Zernike2 spectral basis functions:

푚 푛 푅 휌, 휗, 휁 = ෍ 푅푙푚푛풵푙 휌, 휗 ℱ (휁)

푚 푛 Z 휌, 휗, 휁 = ෍ 푍푙푚푛풵푙 휌, 휗 ℱ (휁)

• Inherently satisfies analytic boundary conditions at the magnetic axis

2 • Number of basis functions scales as 푀 푁Τ2 (about half as many terms as other methods) 푀 = 2

APS DPP November 9, 2020 2F. Zernike, Mon. Not. R. Astron. Soc. 94, 377–384 (1934). 4 in Flux Coordinates

• Assume3 nested flux surfaces: 푩 ⋅ 훁휌 = 0, and Gauss’s law: 훁 ⋅ 푩 = 0

휕휌휓 휕휌푅 푩 = 휄풆휗 + 풆휁 휋 푔 풆휌 = 0 휕휌푍 푩 휌, 휗, 휁 = 푩 푅 휌, 휗, 휁 , 푍 휌, 휗, 휁 , 휄(휌) 휕휗푅 풆휗 = 0 • Using Ampere’s Law: 훁 × 푩 = 휇0푱 휕휗푍 휕 퐵 −휕 퐵 휕 퐵 −휕 퐵 휕 퐵 −휕 퐵 휕휁푅 퐽휌 = 휗 휁 휁 휗, 퐽휗 = 휁 휌 휌 휁, 퐽휁 = 휌 휗 휗 휌 휇0 푔 휇0 푔 휇0 푔 풆휁 = 푅 휕 푍 푱 휌, 휗, 휁 = 푱 푅 휌, 휗, 휁 , 푍 휌, 휗, 휁 , 휄(휌) 휁

APS DPP November 9, 2020 3W. D. D’haeseleer et al., Flux Coordinates and Magnetic Field Structure, (Springer-Verlag, 1991). 5 Force Balance Equations

4 • MHD force balance error : 푭 ≡ 푱 × 푩 − 훁푝 = ퟎ 푅 풙 = 푙푚푛 푍푙푚푛 • Substitute in 푩 and 푱: 푭 = 퐹휌훁휌 + 퐹훽휷 휁 휗 휗 휁 ′ spectral transform 퐹휌 = 푔 퐵 퐽 − 퐵 퐽 − 푝 휌 푅 → 푅 휌, 휗, 휁 퐹훽 = 푔퐽 푙푚푛 푍 → 푍(휌, 휗, 휁) 휷 = 퐵휁훁휗 − 퐵휗훁휁 푙푚푛 훁 ⋅ 푩 = 0 훁 × 푩 = 휇0푱 • Form scalar equations: 푓휌 = 퐹휌 훁휌 푓훽 = 퐹훽 휷 푩 휌, 휗, 휁 푱 휌, 휗, 휁 • An equilibrium is a solution to the system of equations 퐉 × 푩 = 훁푝

풇 풙 ≈ ퟎ, solved at a given set of collocation points 푓휌 휌, 휗, 휁 풇 풙 = 푓훽 휌, 휗, 휁

APS DPP November 9, 2020 4S. P. Hirshman and J. C. Whitson, Phys. Fluids 26, 3553–3568 (1983). 6 Convergence: Heliotron 훽 ≈ 2%

dimension ≈ 2 × 105 dimension ≈ 5 × 103

APS DPP November 9, 2020 7 Error: Heliotron 훽 ≈ 2%

푭 훁푝 휌 = 0.5

Δ푅푖 휀푥 = Δ푍푖 2휋 2휋 1 휀퐹 = න න න 푭 2 푔푑휌푑휗푑휁 0 0 0

APS DPP November 9, 2020 8 Equilibrium Perturbations

• 1st–order Taylor expansion about an equilibrium solution: 휕풇 휕풇 풇 풙 + Δ풙, 풄 + Δ풄 = 풇 풙, 풄 + Δ풙 + Δ풄 풄 = 휕풙 휕풄 input parameters: 0 0 • pressure profile −1 휕풇 휕풇 • boundary modes Δ풙 = − Δ퐜 • etc. 휕풙 휕풄

• The new equilibrium solution for any perturbation Δ퐜 is trivial to approximate: 풙∗ = 풙 + Δ풙 휕풇 −1 Jacobian matrix 휕풙 • Can be used to find solution branches in parameter space was already computed to solve equilibrium • Has been extended to 2nd–order approximations

APS DPP November 9, 2020 9 3D Boundary Perturbation

• Perturbing an axisymmetric solution gives an accurate stellarator equilibrium!

APS DPP November 9, 2020 10 Quasi-Symmetric Perturbations

• Define a measure of quasi-symmetry (no Boozer coordinate transform needed!) 품 풙, 풄 ≡ 훁휓 × 훁퐵 ⋅ 훁 푩 ⋅ 훁퐵

• 1st –order Taylor expansion about an equilibrium QS solution: 휕품 휕품 품 풙 + Δ풙, 풄 + Δ풄 = 품 풙, 풄 + Δ풙 + Δ풄 0 0 휕풙 휕풄 −1 휕품 휕풇 휕풇 휕품 = − + Δ풄 휕풙 휕풙 휕풄 휕풄 • Resulting eigenvalue problem: 푮Δ풄 = ퟎ

• Eigenvectors of 푮 corresponding to 휆 = 0 are perturbations that preserve QS

APS DPP November 9, 2020 11 Summary

DESC is a stellarator equilibrium solver with the following advantages: • Properly resolves the magnetic axis • Minimizes the system dimensionality • Gives a global solution (no interpolation between flux surfaces) • Avoids numerical issues at rational surfaces • Allows for perturbations to easily search the equilibrium solution space • Easy to use and extend the code for individual applications • Designed for stellarator optimization: automatic differentiation, GPUs, etc.

APS DPP November 9, 2020 12 Future Development

• Improved performance, user interface, documentation • Quasi-symmetry optimization • Ideal MHD stability calculations • Free-boundary equilibria • Magnetic islands & stochastic regions

Repository: https://github.com/ddudt/DESC Publication: D. W. Dudt, and E. Kolemen, Phys. Plasmas 27 102513 (2020)

APS DPP November 9, 2020 13 References

1D. W. Dudt, and E. Kolemen, Phys. Plasmas 27 102513 (2020). 2F. Zernike, Mon. Not. R. Astron. Soc. 94, 377–384 (1934). 3W. D. D’haeseleer, W. N. G. Hitchon, J. D. Callen, and J. L. Shohet, Flux Coordinates and Magnetic Field Structure, Springer Series in Computational Physics, edited by R. Glowinski, M. Holt, P. Hut, H. B. Keller, J. Killeen, S. A. Orszag, and V. V. Rusanov (Springer-Verlag, 1991). 4S. P. Hirshman and J. C. Whitson, Phys. Fluids 26, 3553–3568 (1983).

APS DPP November 9, 2020 14 Bonus Slides

APS DPP November 9, 2020 15 PEST1 Flux Coordinates

푍 휁 = 휙

푅 휆 휙 휓 휌 = ൗ 휓푎 휃 푍 푅 휗 = 휃 + 휆 휃, 휙

toroidal coordinates: (푅, 휙, 푍) straight field-line coordinates: (휌, 휗, 휁)

APS DPP November 9, 2020 1R. C. Grimm, J. M. Greene, and J. L. Johnson (Academic Press, Inc, New York, 1976) pp. 253–280. 16 Axisymmetric Results: “D-shape” 훽 ≈ 3%

푭 훁푝 휌 = 0.5

APS DPP November 9, 2020 17 Axisymmetric Results: “D-shape” 훽 ≈ 3%

• Accuracy metrics:

Δ푅푖 휀푥 = Δ푍푖

2휋 2휋 1 휀퐹 = න න න 푭 2 푔푑휌푑휗푑휁 0 0 0

APS DPP November 9, 2020 18 Boundary Condition: Magnetic Axis

• An analytic function expanded near the origin of a disc must have a real Fourier series of the form1,2:

푚 2 4 푓 휌, 휗 = ෍ 휌 푎푚,0 + 푎푚,2휌 + 푎푚,4휌 + ⋯ cos 푚휗 푚 푚 2 4 + ෍ 휌 푏푚,0 + 푏푚,2휌 + 푏푚,4휌 + ⋯ sin 푚휗 푚 • The Zernike polynomials inherently satisfy this condition! • Reduces the number of variables by eliminating the unnecessary high- frequency modes near the axis • No additional boundary condition equations need to be solved

1J. P. Boyd and F. Yu, J. Comput. Phys. 230, 1408–1438 (2011). APS DPP November 9, 2020 19 2H. R. Lewis and P. M. Bellan, J. Math. Phys. 31, 2592–2596 (1990). Boundary Condition: Last Closed Flux Surface

• Fixed-boundary surface is given as: 푅푏 = 푅푏(휃, 휙), 푍푏 = 푍푏(휃, 휙)

• Last closed flux surface is evaluated as: 푅ȁ휌=1 = 푅(휗, 휁), 푍ȁ휌=1 = 푍(휗, 휁)

• Introduce 휆(휃, 휙) to convert between coordinates: 휗 = 휃 + 휆(휃, 휙), 휁 = 휙

푅ቚ = ෍ 푅푚푛ℱ(휗, 휁) ⟹ 푅ቚ = ෍ 푅෨푚푛ℱ 휃, 휙 휌=1 푚,푛 휌=1 푚,푛

푍ቚ = ෍ 푍푚푛ℱ(휗, 휁) ⟹ 푍ቚ = ෍ 푍෨푚푛ℱ 휃, 휙 휌=1 푚,푛 휌=1 푚,푛 ෨ 푏 ෨푏 • Boundary condition: σ푙 푅푙푚푛 = 푅푚푛 σ푙 푍푙푚푛 = 푍푚푛

APS DPP November 9, 2020 20 Collocation Nodes

• The computational grid is a finite set of discrete points (휌푖, 휗푖, 휁푖)

• The force balance errors 푓휌(휌, 휗, 휁) & 푓훽(휌, 휗, 휁) are minimized at these nodes • The equilibrium solution is still valid everywhere, and spectral collocation theory predicts global convergence • Great flexibility in choosing the nodes • Control grid refinement • Avoid rational surfaces

APS DPP November 9, 2020 21 Continuation Methods

1. Perturbations to solve for complex equilibria: • vacuum solution → pressure perturbation → finite-β solution • axisymmetric → boundary perturbation → 3D stellarator 2. Perturbations to optimize for quasi-symmetry: • axisymmetric tokamak → boundary perturbation → QA stellarator • non-QS equilibrium → perturb some inputs → more-QS equilibrium

APS DPP November 9, 2020 22 Order of ODE to Solve

Order of Derivatives Variables Equations

0 푅, 푍

1 휕푖푅, 휕푖푍 → 푩 훁 ⋅ 푩 = 0

2 휕푖푗푅, 휕푖푗푍 → 푱 푱 × 푩 = 훁푝

3 휕푖푗푘푅, 휕푖푗푘푍 훁 ⋅ 푱 = 0

• The equilibrium equations are a 2nd-order ODE • Rational surface issues arise at the next higher level with 훁 ⋅ 푱 = 0

APS DPP November 9, 2020 23 Equilibrium Example Inputs

Axisymmetric Non-Axisymmetric “D-shaped” Tokamak high-β Heliotron

푅푏 = 3.51 − cos 휃 + 0.106 cos 2휃 푅푏 = 10 − cos 휃 − 0.3 cos 휃 − 19휙 푍푏 = 1.47 sin 휃 + 0.16 sin 2휃 푍푏 = sin 휃 − 0.3 sin 휃 − 19휙 휄 = 1 − 0.67휌2 휄 = 1.5휌2 + 0.5 2 2 푝 = 1.65 × 103 1 − 휌2 푝 = 3.4 × 103 1 − 휌2 휓푎 = 1 휓푎 = 1

APS DPP November 9, 2020 24 Perturbation Example Inputs

Axisymmetric Non-Axisymmetric

푀 = 6, 푁 = 2

푅푏 = 5 − cos 휃 푅푏 = 5 − cos 휃 − 0.2 cos 휃 − 휙 푍푏 = sin 휃 푍푏 = sin 휃 − 0.2 sin 휃 − 휙 휄 = 1.618 휄 = 1.618 푝 = 0 푝 = 0 휓푎 = 1 휓푎 = 1

APS DPP November 9, 2020 25