Dynamics of ideal modes and subsequent ELM crashes in 3D tokamak geometry from external magnetic perturbations

The impact of three-dimensional (3D) tokamak geometry from external magnetic perturbations on edge instabilities has been examined in high confinement mode plasmas with edge localised modes (ELMs) in ASDEX Upgrade. The 3D geometry has been probed using rigidly rotating MP fields. The measured distortions of the plasma boundary are compared to single-fluid ideal magnetohydrodynamic (MHD) equilibria using VMEC and MARS-F applying ideal and resistive MHD, whereas VMEC uses only ideal MHD. Both codes accurately reproduce the measured radial displacements of the edge density and temperature profiles in amplitude, toroidal phase and their dependence on the applied poloidal mode spectrum. The induced 3D geometry distorts the local magnetic shear, which locally reduces the stabilising effect from field-line bending at certain most unstable field lines. Around these field lines, we observe additional stable ideal MHD modes with clear ballooning structure in-between ELMs. After their immediate appearance, they saturate and then grow on timescales of the pedestal pressure recovery. The subsequent ELMs show strongly localised magnetic perturbations of the initial crash and accompanied energetic electrons around the same most unstable field lines. These are strong signatures that filaments at the ELM onset preferentially erupt on these most unstable (‘bad’) field lines with their unfavourable 3D geometry where preceding ballooning modes are observed.


Introduction
The power heat load from edge localised modes (ELMs) onto the first wall in high confinement mode (H-mode) plasmas are a severe threat for the operation of future fusion devices. One method to reduce the ELM size in tokamaks is the application of external magnetic perturbations (MPs) [1]. Under certain circumstances it can even lead to the suppression of ELMs [2]. However, the cost for this method is a loss of density ('density pump out'), pressure and therefore, confinement [1,3].
Comparative investigations [4][5][6][7][8][9] have emphasised the key role of stable ideal magnetohydrodynamic (MHD) modes at the edge (kink-peeling modes) in the suppression and mitigation of ELMs. The external MP field excites these ideal modes, which are driven by the edge pressure gradient and current density. The resulting amplification leads to significant three-dimensional (3D) distortions of the plasma boundary [9][10][11][12][13][14][15][16][17]. ELM suppression and best ELM mitigation, which means strongest 'density pump out' and highest ELM frequency, are observed when the MP-field configuration is optimised to maximise the kink-peeling modes and hence, the largest distortions of the axisymmetric geometry.
3D stability analyses suggest that the induced 3D tokamak geometry may impact the local stability of infinite-n ballooning modes (BMs) [18][19][20] (n is the toroidal mode number) and peeling-BMs [21]. Various mechanisms for the additional destabilisation like pedestal widening [22], 3D corrugation of the plasma boundary [20], distortion of the local magnetic shear [19] have been proposed. The latter one is supported by recent electron cyclotron emission (ECE) measurements of ideal MHD modes located around certain field-line positions in the 3D tokamak geometry combined with infinite-n ballooning stability calculations [23]. The distinct helical position of these ideal MHD modes identifies the distortion of the local magnetic shear as the underlying reason for their local appearance. This distortion locally reduces the stability against field-line bending and therefore, lowers the local stability. In this paper, we further characterise these helically localized ideal MHD modes and show that they are seen in various plasma configurations. We attempt to determine their toroidal mode numbers and demonstrate their ideal ballooning character. Moreover, we show that the subsequent ELM crashes are also influenced by the 3D tokamak geometry.
This paper is arranged into five sections. First, we extende a previous analysis of the 3D geometry [23] by measuring the displacements from a low safety factor (q 95 ≈3.9) scenario (section 2). Furthermore, we include MARS-F in the comparison and benchmarked the toroidal phase. Section 2 further discusses the validity of using single-fluid ideal MHD in describing the toroidal phase, the amplitude and the applied poloidal mode spectrum dependence of the resulting perturbations in the edge electron density (n e ) and electron temperature (T e ) profiles. Then, we demonstrate the influence of the 3D geometry on ideal MHD modes before the ELM and on the initial ELM crash in section 3. We complete this paper with a discussion and conclusion in sections 4 and 5, respectively.

Measuring 3D MHD equilibria
To measure 3D MHD equilibria induced by the external MP field, we rotate an n=2 MP field rigidly implying that the applied poloidal mode spectrum is not changing during the rotation. ASDEX Upgrade is equipped with 2 rows with 8 MP coils each. The rotating n = 2 MP-field component has therefore small variations in amplitude (5%), but a relatively strong n=6 sideband [24]. The intrinsic n=2 error field of ASDEX Upgrade is relatively small (no ellipse in figure 4 in [25]), which is also evident by small sinusoidal perturbations of the global density during the rigid rotation (see for example density time traces in figure 1 in [23] and [17]). The flexible power supply system of the MP coils [26] allows us to employ rigid rotations with varying poloidal mode spectrum. The applied poloidal mode spectrum is configured by the differential phase angle (Δj UL ) between the upper coil set and the lower coil set [27]. Toroidally localised profile diagnostics around the low field side (LFS) midplane are used to measure the rotating radial displacement (ξ r ). These measurements are then compared to predictions from a linear perturbative single-fluid linear ideal and resistive MHD code (MARS-F) [28] and from a nonlinear ideal MHD equilibrium code (VMEC) [29,30]. Details about the implementation and configuration of MARS-F and VMEC (NEMEC version was used) for ASDEX Upgrade can be found in [31,32] and [17], respectively. The same 2D input equilibrium reconstructed by the CLISTE equilibrium code [33] is used for MARS-F and VMEC.
It is important to mention that VMEC requires a sufficiently large radial and spectral resolution to achieve quantitive agreement (see appendix of [17,34]). MARS-F uses a spectral representation for the input of the vacuum field perturbation. To save computational resources, MARS-F usually uses only half of the Fourier spectrum [(m>0, n>0), (m<0, n>0)]. To get realistic values for the displacement, it is therefore necessary to account for the other identical half [(m>0, n<0), (m<0, n<0)] by multiplying the vacuum field perturbation by two. Furthermore, for MARS-F, we only consider the dominant n = 2 component, whereas for VMEC even toroidal mode numbers up to n = 16 are included. To ensure a valid comparison, a careful test of the used input vacuum perturbation has been done for each presented case.
The discharges presented in this paper have almost the identical plasma configuration as presented in [6,7]. They have been conducted about 20 discharges after the boronization. The toroidal magnetic field (B T ) is 1.8 T, the safety factor is q 95 ≈3.9, and the upper triangularity is relatively low (δ up ≈0.12). With respect to previous similar studies of the 3D displacement [17] (B T ≈2.55 T, q 95 ≈5.3), the B T and q 95 are lower. The lower B T allows us to increase the relative field strength of the externally rotating MP field. A rotation frequency of 3Hz during the flat top phase of the plasma current and the heating power has been applied. The electron collisionality (  n e ) in these experiments varies between 0.18 and 0.33. Figure 1 shows measurements from the lithium beam (LIB) diagnostic [35,36] during various rigid rotation phases. A density value of 1.4 10 19 m −3 is used to track the corrugation during the rotation. The corresponding predictions from VMEC, MARS-F using ideal-and resistive-MHD along the LIB are added as red, blue and green solid lines, respectively. For each rigid rotation phase one 3D VMEC and MARS-F equilibria have been calculated. The predicted corrugations are then mapped onto the time base using the phase of the rotating MP field. In general, results from both single-fluid MHD codes are in very good agreement with the density measurements from the LIB, except for the case in figure 1(e) where the amplitude agrees, but the toroidal phase disagrees. In this case, the excitation of the kink modes at the edge is minimised, which also results in the largest normalised beta (β N ). Reasons for the deviation in phase might be due to small aberrations in the experiment like q-profile, shaping, sidebands, intrinsic error field, wall effects etc, which are not appropriately captured by the modelling.
Recent papers [37,38] propose that resistive two-fluid MHD effects cause a misalignment of the density and temperature equilibrium iso-surfaces in the pedestal [38]. To test this hypothesis, we extend the comparison by using a newly developed helium beam (HEB) diagnostic [39,40], which was available in the last discharge of this experimental series (#34852). It is ideal for this purpose, since it simultaneously measures n e and T e around the plasma boundary. To trace the corrugated profiles around the plasma boundary, we use the same density value as before and for T e a value of 110 eV. As seen in figure 1(f), the variations in n e and T e are clearly in phase and have the same amplitude. They also agree with predictions from VMEC and MARS-F (for the sake of clarity only a trace from VMEC is shown in figure 1(f)). Thus, our measurements from ELMy H-modes do not support the hypothesis proposed in [37,38]. Nevertheless, this will be further investigated in ELM suppression plasmas.
To underline the importance of including MHD physics in describing the displacement and its dependence on the applied poloidal mode spectrum, figure 2 compares the measured amplitude of the radial displacement with MHD modelling versus Δj UL using various diagnostics like LIB, HEB, charge exchange recombination spectroscopy (CXRS) [41] with poloidal (CXRS-pol) as well as toroidal view (CXRS-tor) and a new X-mode reflectometry system in the ion cyclotron resonance heating (ICRH) antenna [42]. All the used profile diagnostics have a sufficiently large time resolution to exclude time points during the ELM. The  comparison further includes the attenuation of the MP-field strength due to passive stabilisation loop, which is a copper conductor mounted close to the MP-field coils [17] and additional movements because of the plasma position control system [17]. More details about the evaluation can be found in [17]. The measured displacement is compared to the one from VMEC, MARS-F using ideal-and resistive-MHD and the vacuum field approximation.
Displacements estimated using the vacuum field approximation are not able to reproduce the amplitude and the dependence of the measured displacements on Δj UL . This supports previous findings [10,13,14,17]. The measured amplitude and its dependence on Δj UL of the n=2 radial displacement are correctly predicted by both single-fluid MHD codes. The given range of the calculated displacement is the variation between the last closed flux surface (LCFS) and the flux surface 1 cm inside of the LCFS. The excitation of the kink-peeling modes and the resulting amplification are evident by the Δj UL dependence and the amplitude of the displacement. The amplitudes and their variations are larger in MARS-F than in VMEC. This might be due to the linear perturbed equilibrium approach in MARS-F, whereas VMEC is a nonlinear ideal MHD equilibrium code assuming nested flux surfaces. The consideration of nonlinear effects might be the reason for the better agreement in amplitude between VMEC and the measurements. Resistive and ideal MHD calculations from MARS-F show small differences, which underline that ideal MHD is sufficient to describe the displacement in the pedestal.
There is a shift of −20°in the Δj UL behaviour between MARS-F and VMEC, whereas MARS-F seems to capture the measured Δj UL dependence better than VMEC. But one should keep in mind that one single plasma configuration is compared and large uncertainties of the Δj UL dependence are also associated with systematic uncertainties from the 2D input equilibrium e.g.q-profile, shape, etc. For example, previous comparisons between measurements and VMEC calculations showed a difference of +40° [17] in contrast to the −20°presented here. This discrepancy is also in-line with the range of estimated uncertainties, ±32° [43], between a numerically parametrisation of Δj UL for the optimal ELM mitigation based on maximising the kink-peeling response from MARS-F calculations and experimental Δj UL -scans to measure the change in ELM frequency and size.
The differences between MARS-F and the 3D free boundary VMEC calculations are associated with small changes in the shape, q-profile and/or absolute position of the equilibrium introduced by the free boundary. Comparisons of the applied mode spectrum between MARS-F, a free and a predefined fixed boundary axisymmetric VMEC equilibrium have shown that the amplitudes of the pitch-resonant radial field component from the vacuum perturbation already vary by more than 10 • in the Δj UL dependence. Additional systematic differences, like the treatment of the sheet currents [44,45], might also contribute.
In summary, we conclude that single-fluid ideal MHD (MARS-F and VMEC) describes sufficiently well (i) the amplitude of the displacement at the edge around the LFS, (ii) its toroidal phase and (iii) its dependence on the applied poloidal mode spectrum. One should note that the resulting displacements are dominantly pitch-resonant flux surface deformations, which has been shown by ECE-imaging [24] and soft x-ray measurements [46]. The amplitudes of the displacement in the pedestal are in the range of ≈1 cm. Although the distortions amount to only ≈1% of the major radius, they are still significant considering that a typical pedestal in ASDEX Upgrade extends to 1.5 cm [47]. In the next section, we will demonstrate that the induced 3D geometry influences MHD instabilities in the pedestal.

Impact of the 3D tokamak geometry on MHD instabilities
In the following, we will focus on MHD modes at the edge with relatively low frequencies in ELM-mitigated H-modes. The impact of the 3D geometry on high frequency MHD modes [48] ( f>10 kHz) or broad band turbulence [37] in the pedestal are not discussed.

Pre-ELM ideal MHD modes in 3D geometry
In [23], ideal MHD modes at the edge have been reported which only occur around distinct field lines in the 3D geometry. They primarily appear around the field lines exhibiting zero of the radial displacement. More interestingly, they occur around one specific zero crossing of the radial displacement (the 'suspected' zero crossing), although there are two in each period. The reason for this is that the 3D distortion lowers the magnetic shear around the 'suspected' zero crossing and thus, locally lowers the stability [23]. These helical positions in the 3D geometry are therefore the most unstable ('bad') field lines.
Since this first observation, these modes have been observed in almost every experiment in ASDEX Upgrade exhibiting mitigation of ELMs at low  n e (<0.3) using externally rotating MP fields. In the low q and low B T discharges presented here, they are particularly evident. Figure 3 shows the radiation temperature (T rad ) from ECE channels probing the pedestal during the rigid rotation. The modes are clearly visible in the spectrogram and their position in the 3D geometry is indicated by the corresponding corrugation along the ECE-lines of sight (LOS) in figure 3(a). Their frequency amounts to slightly below 2 kHz. Because of the MP-field rotation direction, they appear around the 'suspected' zero crossing of the radial displacement transitioning from positive to negative values with the tendency to the minimum values. T rad measurements of the neighbouring channel further inside clearly show the signature of the rotating displacement (black in figure 3(b)), which are consistent with synthetic T e data (optically thick, T rad ≈T e ). The synthetic data are based on mapping using the corresponding 3D VMEC equilibrium (red in figure 3(b), details about synthetic ECE data from VMEC are described in [24]). A zoom of the time traces shows that additional MHD modes appear in-between ELMs and disappear during the ELM crashes. The timing of the ELM crashes is indicated by thermoelectric currents in the outer divertor (divertor current, blue line in figure 3(c)). The evolution of the pedestal pressure is indicated by the product of the line integrated edge density measured by a peripheral interferometry channel and pedestal top temperature from ECE (brown in figures 3(c), 4).
Previous ECE measurements have shown that the observed modes have dominantly ideal mode structure and that there is no indication for a tearing-like structure in the pedestal region (see figure 3 in [23]). This is also the case for the ECE measurements presented in this paper (not shown). Since the ECE is only reliable where the plasma is optically thick, we use the HEB diagnostic to confirm the ideal mode structure in the region close to the plasma boundary where the plasma is usually optically thin. Figure 4 shows contour plots of one inter-ELM phase using n e and T e from the HEB diagnostic. These measurements show elliptical perturbations ('fingers' [49]) in n e and T e profiles ( figure 4). The perturbations of n e and T e are in phase and there is no inversion radius seen in the observable area. Additionally, the observed flux surface perturbations from the modes are not accompanied with a sudden increase in the divertor current. This indicates that the perturbations from the mode do not cause a sudden exhaust of particles. These observations point towards a dominantly ideal mode structure.
The magnitude of the ideal modes evolves approximately with the time scale of the pedestal pressure recovery. This is seen in figures 4, 3(c) and later in figure 9(a). Since the time scale of the growth, after their initial appearance, is much slower than expected from ideal MHD time scales (alfvenic time scales are ms), we assume that these ideal MHD modes are nonlinearly stable or saturated.
The observed ideal MHD modes also produce a lobe structure, which is measured by Langmuir probes in the divertor (not shown). These lobes are in addition to the lobe structure from the n=2 MP field [50]. The observations of additional lobes infer strong similarities to the lobe structures from pre-ELM modes primarily observed in the presence of static n=2 MP fields in JET [51,52]. Lobes from rotating ideal MHD modes have been measured [53] and modelled [54]. Their appearance does not necessarily imply additional net transport. As demonstrated in [55] for low confinement mode (L-mode) plasmas, lobe structures from n=2 MPs in the divertor heat flux are caused by local changes in the transport, but the heat flux averaged over a full toroidal rotation remains the same. Thus, we cannot conclude additional transport from the observations of lobes.
To study the poloidal distribution of these ideal modes, we use the extensive set of magnetic probes in ASDEX Upgrade. The spectrograms and the poloidal position of probes measuring the poloidal ( = q q B B t d d , red circles) and radial (Ḃ r , green circles) magnetic field components are shown in figure 5. The 2 kHz modes are clearly seen inḂ r probes around LFS midplane and they are even measured by q B -probes, which are situated further away. The modes occur once for each MP rotation period (333 ms) and their appearance propagates poloidally downwards, which is inline with the movements of the 3D geometry ( figure 5 top, left). No signatures of the 2 kHz modes are seen at the high field side (HFS), neither in the q B -norḂ r -probes. They are also not seen in probes around the plasma top (figure 5), X-point or any other poloidal position, which demonstrates the ballooning structure. These are clear signs that we are dealing with saturated ideal BMs. Some probes that are close to the MP coils pick up a coherent 5 kHz signal. This is from the switching frequencies of the MP-coil power supply system [26] and is not related to a plasma phenomenon. MPs from the ELM crashes are seen as vertical stripes in the probes (magenta circles) [56]. Interestingly, these perturbations are strongest at the position where BMs appear, which will be discussed later.
The determination of the toroidal mode number of these BMs is difficult and associated with relatively large uncertainties. The difficulty is that these BMs are situated around certain field lines at the LFS and appear only in a limited number of toroidally separated probes at the same time. Additionally, they only occur during inter-ELM phases and they last for a few milliseconds/periods due to the relatively low frequency. Nevertheless, we attempt to determine the toroidal mode number of the BMs (n BM ) using the phase delay between selectedḂ r -probes at the LFS midplane (described in [56]). For the low q discharge presented here, the measured toroidal mode number amounts to n BM ≈4 ± 1 (see figure 6). Several inter-ELM phases have been analysed during the discharge and the given uncertainty is the range of observed mode numbers. This implies that the BMs can have even and odd toroidal mode numbers. A further indication of relatively medium/low n BM is that they are also visible in further distant q B probes. This is because the radial decay of a perturbation field from a mode, assuming a cylindrical geometry, is proportional to 1/r m+1 and hence, 1/r nq+1 [48].  Toroidal mode number n versus frequency f during an inter-ELM period of a low q discharge. Based on the phase delay between local magnetic measurements, a n BM of ≈(−)4 is determined from the BMs. The sign accounts for the rotation direction. Negative is in the negative toroidal direction and thus, into the electron diamagnetic direction. Note, n is not a good quantum number for a toroidally localised mode.
Consequently, the field decays faster for modes with larger mode numbers which are then less likely to be detected by further distant probes. The situation is a bit different for the high q, » q 5.3 95 , (and high B T ) cases presented in [17,23]. In these cases, the BMs have smaller toroidal extension. They appear only for 60 −70 ms within the period of the 3 Hz rotation. This is shorter than the 100−120 ms in the low q experiments presented here. This reduces the number of toroidally separated probes, which can be used at the same time. Moreover, they are weakly visible in the magnetics. Therefore, magnetic probes could not be used to determine their toroidal mode number. Analyses using the phase delay between two toroidally separated ECE imaging (ECE-I) arrays (only available at high B T ) and the profile ECE, which is toroidally located inbetween the two arrays, suggest an n BM of ≈9±3 for the high q case. These large uncertainties arise from the oblique LOS and possible misalignments of the ECE-I systems, which lead to additional refraction of the LOS and hence, to uncertain toroidal measurement positions.
From this analysis, we conclude that the measured n BM ranges roughly from 4 to 9 and infer the presence of 'medium'-n BMs [57]. Similar values for n of pre-ELM ideal modes in the presence of external MPs have also been observed in KSTAR [58]. The determined toroidal mode numbers should be viewed with caution. The additional n=2 geometry causes coupling to neighbouring harmonics   2, 4, ..., which is evident by the localisation of the structure with an n=2 envelope. The toroidal mode number is, therefore, not a good quantum number, which will be discussed later.
According to magnetic and ECE-I measurements, these BMs rotate into the electron diamagnetic direction [57] and therefore, into the reversed direction of the slowly rotating 3D geometry. But we also observe cases, where the BMs are not clearly rotating and therefore, are difficult to detect. Figure 7 shows ECE measurements from a discharge with 1 Hz rotation, low q 95 ≈3.6 and high δ up ≈0.28 [7]. This discharge was supposed to achieve ELM suppression. This failed because of a q 95 , which was slightly outside of the q-window for ELM suppression (threshold is approximately around q 95 =3.57 [2]) and/ or insufficient MP-field strength due to the applied rotation (see section3.1 in [17]). However, time traces from ECE in the pedestal at the time of the 'suspected' zero crossing of ξ r show peculiar and irregular jumps of T rad before the ELM crashes ( figure 7(b)). A closer look on the T rad profiles reveals that these jumps are displacements in the pedestal region. This is shown in figures 7(c)-(e), where the T rad profiles at the boundary are clearly displaced. The increase in T rad in the scrape off layer (SOL) is associated with the 'shine-through' effect [59] because of the optically thin SOL plasma (open symbols in figures 7(c)-(e)). Channels probing the pedestal top are optically thick (closed symbols). No or small changes are observed at the pedestal top. Therefore, we have no indication of additional transport due to e.g.tearing modes. From these observations, we infer that the BMs are rotating for a few periods and then they lock before the ELM onset.
Slowing down and braking of modes are known from tearing modes [60] and resistive wall modes [61]. Here, we would like to note that in the presented cases the braking of the mode does not result in a significant braking of the plasma, which has also been reported previously [62][63][64]. We assume that non-axisymmetric sheet currents [44] from the BMs interact with the externally applied error field d d ´ J B BM MP and counteracting eddy currents in the resistive wall. The first one might elucidate the strong anharmonic behaviour in the time traces of the ECE in figure 4 and more convincingly in figure 9(a). Both figures show asymmetries between the increasing and decreasing slopes of the measured BMs, which indicate acceleration and deceleration within one period due to changing signs in the nonaxisymmetric sheet currents [60]. Interactions between the BMs and the resistive wall might explain the slowing down with growing amplitude that is seen in figure 3(c) and even the locking shown in figure 7. The small impact of the mode braking onto the plasma rotation might be due to their small radially and helically extent and/or due to the ideal character of the mode allowing to slip with respect to the plasma [62].
In summary, we observe saturated ideal BMs with 'medium'-n at certain helical positions in the induced 3D geometry. They grow and slow down or even lock with increasing pedestal pressure during its recovery. So far, they are only seen in combination with mitigated ELMs. We did not observe them, at least not rotating ones, during ELM suppression [65]. One should note, the BMs are difficult to detect at a strong level of ELM mitigation with high ELM frequencies. A too high ELM frequency makes it difficult to measure them because of the resulting short inter-ELM phases and their relatively low rotation frequency (2 kHz).

Initial phase of the ELM crashes in 3D geometry
In the previous section, we already indicated that the 3D geometry does not only influence the BMs, but also the following dynamics of the ELM crash (see vertical stripes in figure 5 indicated by magenta circles). The measurements in figure 5 show that these MPs from the ELM crash are largest (darker color) at the field line (ξ r ≈0) where the preceding BMs are observed. This is also the case for the experiments shown in figure 8, where the BMs are slowed down. Panel (a) and (b) show the correspondingḂ r measurements in the LFS midplane, which are toroidally separated by 90°. Because of the rigidly rotating n=2 MP field, the dark vertical stripes of the two probes are in anti-phase, which underlines the influence of the n=2 symmetry on the ELM crash. The MPs from the ELM crashes are strongest around ξ r ≈0 and not at the maximum ξ r where the plasma boundary is closest to the magnetic probes. Hence, the change in intensity cannot be explained by a change in the distance between the plasma boundary and the probes.
Similar asymmetries in the MPs from the ELM crashes have been observed in [66] using a rotating n=1MP field [67]. Recent studies of grassy ELMs in DIII-D during the application of external MPs have reported on toroidallylocalised and phase-locked magnetic perturbations of these ELMs [68].
Signatures of a local ELM crash are also seen in ECE channels probing the SOL. Figure 8(c) shows a time trace from a channel in the gradient region, which illustrates the 1 Hz rotation of the 3D geometry. Interestingly, ECE channels probing the near-SOL ( figure 8(d)) observe bursts in the ECE during the initial phase of the ELM crash ( figure 8(e)). These ECE bursts are strongest and more often when the 'suspected' zero crossing of ξ r crosses the LOS of the ECE. In the presented example, the bursts are particularly strong and reach up to 35 keV. In other discharges with MP fields, they are less strong and range from 'only' 0.5 to 20 keV (sampling rate of 500 kHz is used). The intensity of these bursts seems to increase with decreasing  n e (variation is 0.14-0.3). The observed bursts in the ECE [69,70] are associated with energetic electrons [71] rather than stray radiation from electron cyclotron resonance heating (ECRH) or parametric decay [72] because, firstly, they are always seen in a limited amount of ECE channels probing the near-SOL independent of the value for B T . In discharges with high B T , for example, the frequency of the channels measuring the bursts amounts to around 113−115 GHz, whereas it is around 77−80 GHz at low B T . Hence, their appearance in the ECE spectrum is not correlated to the fixed 140 GHz of the ECRH. Secondly, they are seen, but less intense (≈600 eV), in experiments with rotating MP fields using dominant ICRH and neutral beam injection heating but without ECRH.
Such an intense emission from energetic electrons at the edge has often been reported in axisymmetric tokamak plasmas at the ELM onset e.g. [69][70][71]. ECE measurements at different toroidal locations suggest that the source of the energetic electrons is toroidally/poloidally localised on a helical flux surface [73] (and/or highly anisotropic), but its appearance is randomly distributed for different ELMs. The measurements presented in figure 8(c) indicate that the 3D geometry concentrates the source of the non-thermal electrons to certain helical positions. Possible mechanisms for the local acceleration of these non-thermal electrons, among others, are relativistic electrons forming a free-electron maser [74], parallel electric fields due to magnetic reconnections [75], redistribution towards energetic electrons because of contracting small magnetic islands that form during the reconnection process [76] and/or redistribution by barely trapped electrons interacting with such islands [77].
Although the local electron acceleration due to local reconnection processes might be reasonable, the exact reason is difficult to pin down. Many mechanisms could cause a bump in the distribution function, which would result in such localised ECE bursts. Thus, we can only state that (i) the phase space of the few ECE channels measuring the bursts is most sensitive to perturbations at the edge ρ pol ≈0.9−1.0, which has been calculated by forward modelling of the electron cyclotron transport [59,78] and (ii) the initial phase of the ELM crashes introduces a helically localised perturbation of the phase space preferentially around the most unstable field lines.
Further evidence for a field-line localised eruption of the ELM is provided by its heat flux pattern in the divertor. In ASDEX Upgrade [79], DIII-D [50], JET [80] and MAST [81], it has been observed that the peak heat flux during the ELM crash follow the inter-ELM lobe structure induced by the external MP-field. This has sometimes been interpreted as 'locking' of the ELM to the external MP-field. These observations are also inline with the presented picture that energy and particles are initially released from a distinct field-line region at the onset of the ELMs. In a later stage of the ELM, when the edge pressure profile is flat and the perturbations from the ELM itself add, the distinct asymmetry is lost. However, measurements of the visible camera from MAST have shown that the ELM filaments, including the initial ones, do not originate from a preferred toroidal angle [81].

Relation between BMs and ELM crashes
From the presented measurements, so far, one could infer that the BM evolves with the edge pressure until it develops into an ELM crash. Although both primarily appear around the same helical positions in the 3D geometry, a closer examination shows that the perturbations of the ELM crash do not have the same symmetry in the localisation as the preceding BMs. Figure 9 illustrates time traces from two subsequent ELM cycles using ECE andḂ r measurements of opposite probes in the LFS midplane. The ECE measures growing and braking BMs before both ELM crashes, but only in the latter one a burst of up to 10 keV appears ( figure 9(b)). This is a sign that the eruption occurs only in front of the LOS during the second ELM, although BMs are observed in both.
More evidence is given by measurements of toroidally opposite probes (separated by Δf=180°, figures 9(c), (d)). A time window has been chosen in which the amplitude of the measured MPs from the BMs are maximised. This implies that perturbations at other toroidal positions are smaller and smallest at positions, which are toroidally separated by ±90°f rom these probes. In both probes and both ELM cycles, BMs are seen with approximately the same intensity indicating an n=2 symmetry of the mode amplitude (figures 9(c), (d)). The first ELM crash has stronger signatures in the probe at f=52°(figure 9(c)) compared to the second probe at f=228°( figure 9(d)). The situation is reversed for the second ELM crash, where the perturbations are larger in the second probe ( figure 9(d)). This implies a change in the toroidal symmetry of the MP amplitude between BMs and ELMs. At the time of the BMs, they primarily show an n=2 amplitude envelope because both probes measure approximately the same amplitude. But at the ELM onset, an n = 1 amplitude envelope is mainly seen. Hence, the perturbations at the ELM onset are strongest at one single toroidal position [82]. This suggests that several elliptical flux perturbations from BMs may evolve, but only a few or a single one are then erupting at the ELM onset.
These observations are in agreement with the picture from axisymmetric plasmas that one or a few solitary perturbations [82,83] or initial dominant filaments determine the ELM onset [84]. The development of such solitary perturbations from 'quasi stable' modes has been observed in KSTAR [58,58,64]. The role of the 3D geometry is now that the stability against field-line bending varies on a flux surface, with the effect of concentrating the occurrence of modes to certain helical positions.

Discussion about edge stability in 3D tokamak geometry
We have demonstrated that ideal MHD modes with clear ballooning structure and the subsequent initial ELM eruptions preferentially occur on certain field lines in the 3D geometry induced by external MPs. Linear infinite-n ballooning stability calculations have shown that these helical positions correlate with the local reduction of stability against field-line bending [23,85]. The underlying mechanism for this lower stability is the 3D distortion of the local magnetic shear, which is strongest around one zero crossing of the radial displacements [23,85]. Because of symmetry reasons, one zero crossing within one period is the most unstable field line (the 'bad' field line), whereas the most stable field line (the 'good' field line) is around the other zero crossing. Note, the most (un)stable field lines are not exactly at-but close to -the zero crossing of the radial displacements. Motivated by the ASDEX Upgrade observations [23], previous infinite-n ballooning stability calculations using COBRA and 3D VMEC equilibria of MAST [20] have been re-examined. The same behaviour is observed: the helical positions around the zero crossings of the displacements are either the most stable or most unstable field lines [86]. This indicates that the reduced local stability at one ξ r ≈0 is not limited to ASDEX Upgrade equilibria. Analysis of global kinetic ballooning modes (KBMs) using a 3D VMEC equilibrium of DIII-D from an ELM suppressed case [87], however, shows no impact of the 3D geometry on the KBM stability. But one should note that global KBMs are not necessarily sensitive to changes in the magnetic shear (see [88,89]).
Linear MHD stability calculations will not be sufficient to describe the observed temporal dynamics of the BMs. Many of the observed features show similarities to predictions from nonlinear ballooning theory [90]: (i) the BMs appear suddenly when the pressure is recovered, (ii) then, they saturate and grow on a time scale of the pressure evolution [91], (iii) they show elliptical perturbations of the plasma boundary [49,91] and (iv) several BMs evolve until a single or few filaments erupt [92]. On the one hand, these are indications of a predicted metastability of the ELM [49,91] implying that the ELM crash is a further nonlinear stage of the observed BM. But on the other hand, the observed changes in the toroidal symmetry between BMs and ELM crashes suggest that additional symmetry effects [92] due to, for example, an intrinsic error field and/or additional modes [83,93,94] might play a role. The change in symmetry might also imply that BMs and ELMs are different instabilities. Both are then affected by the lower stability against field-line bending independently of each other.
The observation of 'medium' toroidal mode numbers n BM motivates finite-n ideal MHD stability calculations in 3D geometry [95,96]. One should keep in mind that the phase delay method is used to determine n BM . Thus, we only measured the rotating component of the BMs. The amplitude modulation due to the localisation to certain field-lines is not taken into account by this method. Since we are dealing with BMs with an n=2 envelope, such modes are a composition of several Fourier harmonics with n=n BM ±2,±4, ... (mode families [97,98]). In stability calculations, they would appear as a composition of either = n 2, 4, 6, ... or = n 1, 3, 5, ... Fourier harmonics depending on the symmetry of the most unstable mode. The localisation and amplitude of such a mode are then determined by the amplitude and the relative phases between the Fourier harmonics. A simplified example for a localised dominantly n=6 mode and corresponding Fourier harmonics are shown in figure 10. Figure 10(b) also illustrates that the 3D geometry enables toroidal mode coupling between neighbouring ±2,±4, etc components.
Such a mode family has been observed in nonlinear resistive MHD simulations from JOREK of JET plasmas using an n=2 MP field [99]. A toroidal n=2 localisation of the simulated BMs might be inferred from the divertor footprints in figure 8(c) in [99]. JOREK simulations of the low q, low δ up ASDEX Upgrade plasma configuration presented in section 2 applying an n = 2 MP field (pressure profile and MP-field strength are not exactly the same) show a dominant n = 4 and additional n=2, 6, 8 components (see [100]). This is the same value as measured in figure 6. Additionally, the n=4 component shows ballooning structure and is rotating into the electron diamagnetic direction as observed in the experiment. But so far, no pronounced helical localisation of the dominantly n=4 mode have been seen in these simulations. With stronger MP fields or larger kink-peeling amplitudes in the simulations, the 'medium' toroidal modes become nonlinearly stable, saturate and can even lock. This has also been seen in the experiments. One further difference between the experiments and simulations is that the saturation of the 'medium' toroidal modes avoids the ELM crash in the simulation. In the experiments, however, we observe mode saturation, braking (sometimes even locking) and then, the ELM crash. One possible reason could be that the experimental MP field was not strong enough to suppress the ELM crash. But one should also keep in mind that simulations are initialised with large pressure gradients already above the peeling-ballooning stability limit [99,100], which cannot reproduce the slow pressure evolution throughout the ELM cycle as observed in experiments. This might change the dynamics of the BMs on a millisecond time scale in comparison to the JOREK simulations. Nevertheless, JOREK simulations already show promising agreement with some of the measured characteristics and motivate further nonlinear modelling. Figure 10. Cartoon illustrates a rotating n=6 mode (BM) localised to one ξ r ≈0 of the superposed n=2 structure, which is similar to the experimental observations. (a) Outer boundary displacement induced by an n=2 external MP field (black) and an additionally rotating n=6 mode localised to one toroidal position (blue lines) versus toroidal angle. The different blue lines illustrate the rotation of the BM. (b) Corresponding Fourier spectrum with strong n=2 component and n=6±2,±4 harmonics due to the n=2 envelope of the n=6 mode. Only the rotating n=6 component can be measured using the phase delay method.

Conclusions and outlook
Single-fluid ideal MHD is sufficient to describe the 3D displacements at the plasma boundary. These are caused by stable ideal kink-peeling modes, which are excited by an external MP field. Distortions of the edge electron density and temperature profiles are in phase with the predicted displacements of the flux surfaces.
The induced 3D tokamak geometry strongly influences the properties of edge instabilities. Saturated ideal BMs with 'medium' toroidal mode numbers (n BM ≈4−9) and their accompanied additional harmonics (±2,±4) are localised to field lines, which have the least stability against field-line bending. These most unstable 'bad' field lines are situated around certain zero crossings of the radial displacements. The subsequent ELM onsets show signatures of local eruptions around these field lines. This is evident from strong localised MPs and localised emission from non-thermal electrons at the ELM onset. This is also inline with the observation of a modified heat flux pattern during the initial ELM crash, which is correlated to the externally applied MP-field structure [50,[79][80][81].
The causality between the localised BMs and the following localised initial ELM crashes is topic for further investigations. From the presented data it is not clear if the ELM crash is a further nonlinear stage of the preceding BM or if both are separate instabilities and they are independently influenced by the reduced stability against field-line bending.
A practical application of these results might be that relatively small external MPs with small impact on the confinement can be used to redirect the perturbations from the initial phase of the ELM crash to minimise their impact on the plasma operation like ICRH coupling [101]. Another beneficial application might be that controlled error fields can be used to diagnose certain aspects of the ELM crash in more detail like the acceleration of energetic electrons.
The results presented in this paper might also be relevant for the ELM dynamics in H-mode plasmas in tokamaks with significant intrinsic error field, stellarator-tokamak hybrid concepts and stellarators [102]. As demonstrated in this paper, the observed phenomenology like pre-ELM ideal modes in combination with a local eruption at the ELM onset, is then difficult to detect, because they would 'hide' at certain helical positions. They would only be measured by certain diagnostics. Most unstable field lines are expected and predicted for various stellarator configurations [98,[102][103][104][105]. For example, ideal stability calculations for Wendelstein 7-X predict ideal BMs which are located around certain field lines (figure 10 in [106]).