Hostname: page-component-74656f9884-j7cmm Total loading time: 0 Render date: 2026-11-06T16:48:23.400Z Has data issue: false hasContentIssue false

The 3-D linear stability CASTOR3D code and its applications

Published online by Cambridge University Press:  15 September 2026

Erika Strumberger
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
Jonas Puchmayr*
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
Mike Dunne
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
Sibylle Günter
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
Florian Hindenlang
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
Gabriella Pautasso
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
the ASDEX Upgrade Team
Affiliation:
Max Planck Institute for Plasma Physics , Boltzmannstr. 2, Garching 85748, Germany
the W7-X Team
Affiliation:
Max Planck Institute for Plasma Physics, Wendelsteinstr. 1, Greifswald 17491, Germany
*
Corresponding author: Jonas Puchmayr, Jonas.Puchmayr@ipp.mpg.de

Abstract

The CASTOR3D code is a linear, extended, magnetohydrodynamic stability code that can be applied to tokamak and stellarator equilibria with and without ideal and resistive complex wall and coil structures in the surrounding vacuum region. The code enables the investigation of the effects of resistivity, parallel viscosity, gyroviscosity, ion drift velocity, ExB-velocity, electron diamagnetic drift, parallel heat conductivity and externally driven flows on growth rate, oscillation frequency and mode structure. This review article describes the three-dimensional (3-D) linear stability CASTOR3D code, its versatile application possibilities (e.g. ideal and resistive modes, vertical stability investigations, edge stability limit studies in presence of magnetic perturbation fields, resistive wall modes, etc.) and interesting effects concerning 3-D plasma configurations (e.g. toroidal mode coupling leading to overstable modes, mode locking, critical rotation threshold for locked modes and non-uniform rotation).

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Figure 1. Figure 1 long description.(a,b) The AUG-type equilibrium with MP coils. The colours of the plasma boundary mark (a) the normal component of the MP perturbation field and (b) the corrugation caused by the MP field. The colours of the MP coils indicate the antipodal coil currents. (c) Two-periodic QA equilibrium (reproduced with permission from Nucl. Fusion vol. 59, 2019, p. 106008 and EUROfusion; copyright EURATOM 2019) and (d) five-periodic W7-X equilibrium with the colours indicating the magnetic field strength B (reproduced with permission from Nucl. Fusion vol. 60, 2020, p. 106013 and EUROfusion; copyright EURATOM 2020). The colour range in (d) corresponds to 2.1 (dark blue) ⩽$\leqslant$B⩽$\leqslant$ 2.9 T (yellow).

Figure 1

Figure 2. The PSL (grey) of AUG with support (yellow) and current (magenta) bridges and MP coils (green) presented in the thin wall approximation.

Figure 2

Figure 3. Cylindrical (R,φ,Z$R,\varphi ,Z$) and magnetic flux coordinates (s,v,u$s,v,u$). The flux surfaces described by s=const.$s= \text{const.}$ lines are shown for a toroidal cross-section of a tokamak plasma.

Figure 3

Figure 4. Schematic representations of (a) a wall triangle, (b) a coil segment (reproduced with permission from Nucl. Fusion vol. 57, 2017, p. 016032 and EUROfusion; copyright EURATOM 2016) and (c) a wall segment.

Figure 4

Figure 5. The CASTOR3D code and its connections to other codes.

Figure 5

Figure 6. Cylindrical (R,φ,Z$R,\varphi ,Z$) and magnetic flux coordinates (s,v,u$s,v,u$). (a) The u$u$- and v$v$-coordinate lines in Boozer coordinates on the last flux surface (s=1$s=1$) of a QA equilibrium (from Strumberger (2025); licensed under a Creative Commons Attribution licence (CC BY)). (b,c) Toroidal cross-sections for a constant v$v$-coordinate. The flux surfaces and poloidal coordinate lines are illustrated for (b) an AUG equilibrium (blue, NEMEC coordinates; green and red, 2-D straight field line coordinates) and (c) a W7-X equilibrium (black, NEMEC coordinates; red, Boozer coordinates). In (b) and (c) the flux surfaces are equidistant in Φ0/Φ0tot$\sqrt {\varPhi _0/\varPhi _0^{tot}}$ with Φ0$\varPhi _0$ being the toroidal flux and Φ0tot$\varPhi _0^{tot}$ being its total value.

Figure 6

Figure 7. The CASTOR3D code structure.

Figure 7

Figure 8. (a) Structure of the matrices 𝘼ext${\unicode{x1D63C}}^{ext}$ and 𝘽ext${\unicode{x1D63D}}^{\,ext}$, respectively. The colours indicate the block-tridiagonal plasma part (red), the vacuum part (blue), the plasma–vacuum interaction (purple, only in matrix 𝘼ext${\unicode{x1D63C}}^{ext}$) and the vacuum–plasma interaction (green, only in matrix 𝘽ext${\unicode{x1D63D}}^{\,ext}$) (figure reproduced from Puchmayr (2023)). (b) Substructure of a block of the plasma part. The grey 8 × 8 submatrix represents the perturbed quantities with f,f~=ρ^,v^s,v^u,v^v,T^,A^s,A^u,A^v$f,\tilde f=\hat \rho , \hat v^s, \hat v^u, \hat v^v, \hat T,\hat A_s, \hat A_u, \hat A_v$. The orange 2 × 2 submatrix results from the two orthogonal parts of the ansatz for the perturbed quantities and the two test functions. The poloidal and toroidal Fourier harmonics yield the yellow Nmn×Nmn$N_{{mn}} \times N_{{mn}}$ submatrix and, finally, the white 2 × 2 submatrix results from the two Hermite polynomials at each grid point (q,q~=1,2$q,\tilde q=1,2$).

Figure 8

Figure 9. Figure 9 long description.(a) Fourier harmonics of the radial displacement for an n=40${n}=40$ ballooning mode in straight field line coordinates. Various colours are used in order to improve the visibility of the individual harmonics. (b,c) Logarithmic amplitude of the Fourier harmonics for an n=20${n}=20$ ballooning mode calculated with (b) the constant and (c) the s$s$-dependent spectrum of poloidal harmonics. In the latter only harmonics in the filled (non-white) area are used for the ansatz (2.30). The dashed white lines indicate the resonant poloidal harmonics. (Figures reproduced from Puchmayr (2023).)

Figure 9

Figure 10. Cosine-type external kink modes of a QA equilibrium. (a) Real parts of the eigenfunction Fourier spectrum for the radial velocity perturbation of the n∗=1${n}^*=1$ mode. (b) Contributions of the toroidal Fourier harmonics (fRe$f_{\text{Re}}$ (solid lines), f~Re$\tilde f_{\text{Re}}$ (symbols)) to the cosine-type mode for various values of the parallel viscosity coefficient μ‖$\mu _{\|}$ (from Strumberger et al. (2025); licensed under a Creative Commons Attribution licence (CC BY)).

Figure 10

Figure 11. Figure 11 long description.Growth rate γ$\gamma$ and absolute value of the oscillation frequency |ω|$|\omega |$ as function of (a) the toroidal mode number n and (b) the scaling parameter αs$\alpha _s$ (see § 2.1.1). The black dashed line represents the ideal growth rate γideal$\gamma _{ideal}$ obtained without taking the diamagnetic drift effects into account. (a) The blue stars mark the absolute value of half of the ion diamagnetic drift frequency |ωi∗|/2${|\omega ^*_i|}/{2}$ (4.2). (From Strumberger et al. (2023); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 11

Figure 12. (a,b) Fourier spectra of the real part of the radial velocity perturbation, and (c,d) mode structures of the n∗=6${n}^*=6$ mode (a,c) without and (b,d) with ion diamagnetic drift effect. In (a) and (b), the solid and dashed lines denote the Fourier spectra of the radial velocity perturbation related with the complex and complex conjugate e$\text{e}$-functions. The largest contributions are marked by their poloidal and toroidal harmonics m/n${m/n}$. In (c) and (d), the vectors characterise the velocity perturbation in the R$R$–Z$Z$-plane at toroidal angle φ=0o$\varphi =0^{\textrm {o}}$ and time t=0$t=0$. (From Strumberger et al. (2023); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 12

Figure 13. Figure 13 long description.Energetic decomposition of the resistive internal perturbations of the considered low-β$\beta$ equilibrium: (a) relative current-density drive as function of the toroidal mode number for resistivities of η=10−7$\eta =10^{-7}$ Ωm (blue) and η=10−6$\eta =10^{-6}$ Ωm (orange). Normalised energy densities corresponding to (b,d) the current-density and (c) the pressure-gradient drives as functions of the square root of the normalised toroidal flux for resistivities of (b) η=10−7$\eta =10^{-7}$ Ωm and (c,d) η=10−6$\eta =10^{-6}$ Ωm. (From Strumberger et al. (2023); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 13

Figure 14. (a) Growth rates and (b) oscillation frequencies as functions of parameter αT$\alpha _T$ for various n-harmonics. The dotted vertical lines mark the αT$\alpha _T$-values for which the considered resistivity value corresponds to the approximated Spitzer resistivity. The stars denote ωi∗$\omega _i^*$. (From Strumberger et al. (2023); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 14

Figure 15. (a) Growth rates of the n∗=1,2,…,8${n}^*=1,2,\ldots ,8$ DTMs as function of Δs$\Delta s$. (b–d) Structures of n∗=1${n}^*=1$ mode types for various ι$\iota$-profiles represented by the radial velocity perturbation (blue = inward to red = outward shift) at the triangular cross-section of W7-X$\text{W7-X}$. (All figures reproduced with permission from Nucl. Fusion vol. 60, 2020, p. 106013 and EUROfusion. Copyright EURATOM 2020.)

Figure 15

Figure 16. Figure 16 long description.(a) Growth rate of the asymmetric-coupled n∗=1$n^*=1$ DTM (type B mode) as function of the resistivity ηa$\eta _a$ (this figure contains data published in Strumberger et al. (2020) with permission of Nucl. Fusion vol. 60, 2020, p. 106013 and EUROfusion; copyright EURATOM 2020). Structures of asymmetric-coupled n∗=1$n^*=1$ DTMs for (b) ηa=6×10−6$\eta _a=6\times10^{-6}$ Ωm and (c) ηa=6×10−5$\eta _a=6\times10^{-5}$ Ωm represented by the radial velocity perturbation (blue = inward to red = outward shift) at a triangular cross-section of W7-X.

Figure 16

Figure 17. (a) Sine- and (b) cosine-type n∗=1${n}^*=1$ mode locations represented by the radial velocity perturbation (blue = inward to red = outward shift) on the plasma boundary of a QA equilibrium. (c) Growth rates and (d) oscillation frequencies of the modes as functions of the externally driven toroidal flow frequency at the magnetic axis. (Reproduced with permission from Nucl. Fusion vol. 59, 2019, p. 106008 and EUROfusion. Copyright EURATOM 2019. In (c) and (d) only the data of the n∗${n}^*$ = 1 mode are reprinted.)

Figure 17

Figure 18. Oscillation of the n∗=1${n}^*=1$ mode with ω<0$\omega \lt 0$ represented by the location of the radial velocity perturbation (blue = inward to red = outward shift). Shown are five equidistant time steps within 1/4 oscillation cycle. (Modified reproduction with permission from Nucl. Fusion vol. 59, 2019, p. 106008 and EUROfusion. Copyright EURATOM 2019.)

Figure 18

Figure 19. Figure 19 long description.(a) Corrugation (normal displacement) of the 3-D equilibrium for the numerical test case. (b) Maximum values of the corrugation on every flux surface as a function of the normalised toroidal flux s. The dashed lines mark the resonant flux surfaces with respect to the Nper=2${N}_{per}=2$ MP field. (From Puchmayr et al. (2023); licensed under a Creative Commons Attribution 4.0 licence (CC BY).)

Figure 19

Figure 20. (a) Fast and (b) slow growing n∗=1${n}^*=1$ modes at the most unstable flux surface. Background: normalised non-axisymmetric component of the parallel equilibrium current density σ3D,N$\sigma _{3D,N}$. Orange/brown lines: normalised perpendicular magnetic perturbation Re(B1,⊥2)$\text{Re}(B^2_{1,\perp })$ of the n∗=1${n}^*=1$ mode, darker colour indicates a larger value of Re(B1,⊥2)$\text{Re}(B^2_{1,\perp })$. (From Puchmayr et al. (2023); licensed under a Creative Commons Attribution 4.0 licence (CC BY).)

Figure 20

Figure 21. Figure 21 long description.(a) Normalised perpendicular magnetic perturbation Re(B1,⊥eiφ)2$\text{Re}(\boldsymbol{B}_{1,\perp }\smash{e^{\text{i}\varphi })^2}$ of the n∗=15${n}^*=15$ mode at φ=0$\varphi =0$ and (b) its envelope E=maxφ{Re(B1,⊥eiφ)2}$E=\max _{\varphi }\{\text{Re}(\boldsymbol{B}_{1,\perp }e^{\text{i}\varphi })^2\}$. (c) Background: normalised non-axisymmetric component of the parallel equilibrium current density σ3D,N$\sigma _{3D,N}$. Orange/brown lines: envelope E$E$ of the n∗=15${n}^*=15$ mode, darker colour indicates a larger value of the envelope. (d) Relative toroidal position of the minimum of the normalised perpendicular magnetic perturbation for different mode numbers n∗${n}^*$ over a full rotation cycle of the mode around the torus ωt∈[0,2πn∗]$\omega t \in [0,2\pi \,n^*]$. The plasma rotation was taken at values above the critical rotation threshold for each n∗${n}^*$. (From Puchmayr et al. (2023); licensed under a creative commons attribution 4.0 licence (CC BY).)

Figure 21

Figure 22. Toroidal cross-sections (a) for the axisymmetric and (b) magnetically perturbed equilibria of the AUG discharges #$\#$40180 (solid, black) and #$\#$40181 (dashed, orange) as well as (c) pressure and safety factor profiles. For visibility, the corrugation in (b) is amplified by a factor of 2.5. (d) Growth rates for a range of equilibria between AUG #$\#$40180 and AUG #$\#$40181 with and without ion diamagnetic drift effects. The numbers annotating the data points refer to the toroidal harmonic n∗${n}^*$ of the most unstable instability. The dotted blue line indicates the empirical stability limit from Suttrop et al. (2018) assuming equal ion and electron pressures. (From Puchmayr et al. (2024); licensed under a Creative Commons Attribution 4.0 licence (CC BY).)

Figure 22

Figure 23. Figure 23 long description.(a) Growth rates as functions of n∗${n}^*$ without (black circles) and with (red circles) taking parallel viscosity into account. (b) Growth rates and oscillation frequencies as functions of n∗${n}^*$ taking parallel and gyroviscosity into account. The results with and without additional ion diamagnetic drift and ExB-velocities are marked by red/green and black/blue circles, respectively. (From Strumberger et al. (2025); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 23

Figure 24. (a,c) Growth rates and (b,d) oscillation frequencies of (a,b) n∗=2${n}^*=2$, 3 and 7 external kink modes, and (c,d) n∗=22${n}^*=22$ and 47 peeling–ballooning modes as functions of the externally driven toroidal flow frequency Ω0ext$\varOmega ^{ext}_{0}$ taking parallel viscosity (μ||=4 kg ms−1$\mu _{||}=4\text{ kg ms}^{-1}$), gyroviscosity, ion diamagnetic drift velocity and ExB-velocity into account. The solutions were obtained solving (a,b) the full eigenvalue problem and (c,d) the reduced eigenvalue problem. (c) The two black stars located in the left- and right-hand corners mark the growth rates of the n∗=2${n}^*=2$ mode. (From Strumberger et al. (2025); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 24

Figure 25. Figure 25 long description.Double tearing modes of an AUG-type equilibrium. (a) Growth rates and (b) oscillation frequencies as functions of the resistivity. (c,d) Real parts of the eigenfunction Fourier spectra of the radial velocity perturbation for (c) an asymmetric- and (d) a symmetric-coupled DTM for η=6×10−7$\eta = 6\times10^{-7}$ Ωm.

Figure 25

Figure 26. Overstable n∗=1↔n∗=9${n}^*=1\leftrightarrow {n}^*=9$ external kink mode of a QA equilibrium: (a) real and (b) imaginary part of the eigenfunction Fourier spectrum for the radial velocity perturbation of the sine-type overstable mode (parallel viscosity: μ||=1.1 kg ms−1$\mu _{||}=1.1\text{ kg ms}^{-1}$). (From Strumberger et al. (2025); licensed under a Creative Commons Attribution licence (CC BY).)

Figure 26

Figure 27. Figure 27 long description.Comparison of the normalised CASTOR3D growth rate (red dots/dashed line) with (a) the analytical growth rate (black line) and (b) the STARWALL growth rate (green dots) as functions of the distance of the resistive wall. The dashed blue vertical line in (a) marks the critical radius rc$r_c$ while in (b) the growth rate as function of the ideal wall distance is indicated by the blue solid line. (From Strumberger et al. (2014a); licensed under a Creative Commons Attribution 3.0 licence (CC BY).)

Figure 27

Figure 28. For the QA equilibrium, (a) growth rates and (b) oscillation frequencies of the n∗=2${n}^*=2$ mode as functions of the wall distance dw$d_w$ are shown. The growth rates are obtained for an ideal closed wall (black), a resistive closed wall (green), and a resistive closed wall in combination with plasma flow (red, Ω0=200000 rad s−1$\varOmega _0=200\,000\text{ rad s}^{-1}$; blue, Ω0=50000 rad s−1$\varOmega _0=50\,000\text{ rad s}^{-1}$). The solid red and blue curves mark the plasma modes while the dashed curves denote the resistive wall modes. (Reproduced with permission from Nucl. Fusion vol. 59, 2019, p. 106008 and EUROfusion. Copyright EURATOM 2019.)

Figure 28

Figure 29. Figure 29 long description.Mode structures of vertical instabilities of (a) an elliptically shaped plasma with high aspect ratio (reproduced with permission from Nucl. Fusion vol. 57, 2017, p. 016032 and EUROfusion; copyright 2016 EURATOM) and (b,c) AUG discharge #$\#$39655. The vectors illustrate the velocity perturbation. The bars indicate the positions of the upper and lower parts of the PSL. (d) Growth rates as functions of the width of the PSL.

Figure 29

Figure 30. (a) Quadratic Hermite polynomials, (b) cubic Hermite polynomials and (c) first derivatives of the cubic Hermite polynomials on an interval sj⩽s⩽sj+1$s_{{j}}\leqslant s \leqslant s_{{j+1}}$.