First principles gyrokinetic analysis of electromagnetic plasma instabilities

A two-fold analysis of electromagnetic core tokamak instabilities in the framework of the gyrokinetic theory is presented. First principle theoretical foundations of the gyrokinetic theory are used to explain and justify the numerical results obtained with the global electromagnetic particle-in-cell code Orb5 whose model is derived from the Lagrangian formalism. The energy conservation law corresponding to the Orb5 model is derived from the Noether theorem and implemented in the code as a diagnostics for energy balance and conservation verification. An additional Noether theorem based diagnostics is implemented in order to analyse destabilising mechanisms for the electrostatic and the electromagnetic Ion Temperature Gradient (ITG) instabilities in the core region of the tokamak. The transition towards the Kinetic Ballooning Modes (KBM) at high electromagnetic $\beta$ is also investigated.


Introduction
Strongly magnetised fusion plasmas represent a paradigmatic example of outof-equilibrium systems, in which turbulence is ubiquitous. This omnipresence originates from the concept of magnetic fusion itself: Bringing the mix of hydrogen isotopes into the confinement mode implies by construction the existence of strong spatial gradients. Typically, a difference of three orders of magnitude for the temperature is present, with ∼ 10 8 K at the centre of the device, where the plasma is hot and relatively dense and with ∼ 10 5 K close to the edge, where the plasma is more rarefied and colder. The strong gradients or space inhomogeneities of the temperature, velocity and current are intrinsic to fusion plasmas, and provide sources of free energy and therefore represent sources for instabilities. The instabilities manifest themselves via the exponentially growing perturbations of the electromagnetic fields. When the critical amount of instabilities has been developed, the system moves to a turbulent state with strongly unpredictable behaviour in space and time. In turn, the transport associated with turbulence is extremely dangerous for the plasma confinement. The understanding of its origins is a subject of numerous investigations [1].
Extensive studies in the framework of different formalisms, from the single fluid MHD model and the multi-fluid approaches to kinetic models, aiming to identify the instability mechanisms, have been carried out over the past decades, both analytically and numerically. A detailed overview of these studies is presented in [2], where the transition between the electrostatic and the electromagnetic regimes is also discussed. In particular, in low β = p/[B 2 /(8π)] plasmas, where p is the kinetic pressure and B 2 /(8π) the magnetic pressure, the ion temperature gradient instability, known as the ITG mode, has almost an electrostatic polarization, and therefore carries almost only electrostatic energy for the coupled drift waves and the ion acoustic waves that gives rise to a collective instability.
In higher pressure plasmas with β > m e /m i , the electromagnetic energy is injected, and the ITG mode couples with the shear Alfvén wave becoming a dispersive oscillation with an electromagnetic polarization. As the plasma pressure increases the inductive electric field from the fluctuating magnetic field δB ⊥ begins to cancel part of the electrostatic component of the parallel electric field. This cancellation reduces the energy transfer rate j E and reduces the growth rate of instability.
There are numerous studies of these weakly electromagnetic ITG modes including [3], [4], [5] and [6] which detail how the ITG modes change with increasing β. At certain intermediate values of β, both the ITG and the kinetic ballooning modes are present with different frequencies and growth rates.
In this paper, we investigate the transition between the low β and finite β regimes in the framework of the gyrokinetic theory, both analytically and numerically.
Strongly magnetized plasma exhibits multi-scaled dynamics: The fast rotation around magnetic field lines, called gyromotion, is at least three orders of magnitude faster than the slow drifts across the magnetic field lines. The gyrokinetic dynamical reduction [7], [8] aims to simplify the dynamical description in which fast gyration is systematically and reversibly eliminated, resulting in considerable simplifications and a gain of computational time.
Nowadays, the gyrokinetic (GK) codes play a significant role in the understanding of the development and the saturation of turbulence and the prediction of the subsequent transport properties [9]. Electrostatic gyrokinetic simulations have been the topic of numerous studies during the last decades [10], [11], [12], so that the properties of the electrostatic instabilities in the framework of the gyrokinetic theory are rather well known. However, global electromagnetic simulations are more recent [13], [14], [15] and some elements related to the GK electromagnetic instability mechanisms still need to be clarified.
In order to provide a better understanding of the global electromagnetic GK simulations, we present an analysis of the instability mechanisms by performing global linear electromagnetic simulations with the particle-in-cell code Orb5. The numerical set-up is similar to the one used for benchmarking the global electromagnetic codes [15]. The Orb5 code is based on the GK Lagrangian model [16], [14] and allows one to use diagnostics tools issued from first principles, exactly corresponding to the theoretical model. This article is organised as follows: In Sec. 2, the field Lagrangian model including all approximations implemented in the code Orb5 is presented. Section 3 provides the derivation of the Orb5 energy invariant through the Noether theorem. In Sec. 4, the diagnostics issued from Noether's method are derived, and their implementation in the code Orb5 is discussed. Finally, in Sec. 5, the analysis of the electromagnetic instability mechanisms is presented.
2 Variational formulation of the Orb5 code model A detailed derivation of the Orb5 model in the framework of the Eulerian variational principle [17] is given in [16], where CGS units are used. In this work, we use the Lagrangian variational formulation accordingly to [18], since the Lagrangian formulation of the gyrokinetic field theory lends itself to a discretisation by finite element methods. We notice that the choice of formalism, Eulerian or Lagrangian, does not affect the final expressions for the gyrokinetic Maxwell-Vlasov equations.
The Lagrangian action functional for the code Orb5 depends on the fluctuating electromagnetic potentials (φ 1 , A 1 ) and on the coordinates of the Lagrangian particle trajectories Z(z 0 , t) = [X(z 0 , t), p z (z 0 , t), µ(z 0 , t), θ(z 0 , t)], where X are the positions of the gyrocentres, p z their momenta parallel to the magnetic field lines, µ their magnetic moments and θ their gyroangles. These coordinates are labelled by their initial conditions z 0 such that Z(z 0 , 0) = z 0 . The expression of the action is given by [16]: where the particle Lagrangian is given by: the generalized vector potential is defined as: The volume element in the reduced phase space is dz 0 = mB * ,s (z 0 )dX 0 dp z,0 dµ 0 dθ 0 (see Ref. [19] for more detail) where The dynamical distribution function is denoted by f s for each species, and the background distribution function by f C,s . The property of the Vlasov distribution function being conserved along the particles trajectories translates into We assume that the background distribution f C,s is frozen and corresponds to a good approximation of f s at all times. The first and the second terms of the action (1) correspond to the gyrocentre reduction, and the last term is a contribution from the perturbed magnetic field. We notice that only the perpendicular part of the perturbed magnetic field B ⊥ = b × ∇A 1 is implemented.
The background Hamiltonian contains information on the kinetic energy of a charged particle moving in a magnetic field of amplitude B: The first order correction of the Hamiltonian model for the ions is given by where the gyroaveraging operator · is the average over the fast gyroangle θ contained in the fast rotating Larmor vector ρ 0,s measuring the distance between the initial particle position and the guiding-centre position. More precisely, in an orthonormal basis (b 1 ,b 2 ,b) at X, the Larmor vector is given by , and the expression of the gyroaveraging is given by For the electrons, the first order correction to the Hamiltonian only contains the first order Finite Larmor Radius (FLR) correction. It corresponds to the drift-kinetic dynamics, and it is given by In what follows the bracketed quantities are evaluated at the position X + ρ 0,s , all the other quantities are evaluated at the gyrocentre position X.
There exist several nonlinear models in the Orb5 code. The most complete model considers the nonlinear Hamiltonian model H 2 for the ions, including all order FLR corrections in its electrostatic part and up to second order FLR terms in its electromagnetic part. In this work, in addition to the drift-kinetic model for the electrons, we consider the long-wavelength approximation of the nonlinear model for the ions (see Eq. (68) in Ref. [16]), i.e. : The second order Hamiltonian model for the electrons only contains the driftkinetic correction: Before presenting the equations of motion implemented in Orb5, we discuss all necessary approximations included in the gyrokinetic action given by Eq. (1). The first term of the action involves the full distribution function f s , while the second term involving the nonlinear Hamiltonian H 2 contains a "canonical" distribution function f C,s , which is by definition invariant under the unperturbed Hamiltonian dynamics, i.e., it satisfies the condition {f C,s , H 0,s } gc = 0, where the guiding-center Poisson bracket is defined accordingly to Eq. (7) in Ref. [16]. This approximation brings several simplifications to the model. First, it results in the linearisation of the gyrokinetic Poisson and Ampère equations. Second, it simplifies the gyrokinetic Vlasov equation by excluding some nonlinear terms from the gyrocentre characteristics associated with Hamiltonian H 2 .

Gyrokinetic field equation
The equations of motion are derived from We use functional derivatives for evaluating the r.h.s. of this expression explicitly. As a reminder, for a functional L[η] = d n r L (η, ∇η) depending functionally on a scalar field η and its gradient ∇η, the functional derivative is defined as δL/δη acting on the test function χ as: The corresponding quasineutrality equation in the weak form with the test function φ 1 is obtained by calculating the functional derivative We perform the change of variables z = Z(z 0 , t), and the quasineutrality equation becomes where dz = mB ,s dXdp z dµdθ. The Ampère equation obtained from the same variational principle is derived from the computation of δL/δA 1 · A 1 and the change of variables z = Z(z 0 , t):

Nonlinear gyrokinetic Vlasov equation
We now proceed with derivation of the particles dynamics implemented in the Orb5 code. The equations of motion for the particles are obtained by setting to zero the functional derivatives with respect to the phase space coordinates Z = (X, p z , µ, θ): Since in the action functional (1) the nonlinear part of reduced particle dynamics, i.e., Hamiltonian H 2 is only coupled to the non-dynamical part of the distribution function, i.e., f C , H 2 does not contribute to the particle characteristics used for reconstructing the gyrokinetic Vlasov equation. The last term in Eq. (16) vanishes when integrating the Lagrangian in time to get the action integral. However, this term is used later in order to determine the conserved energy of the system by Noether's theorem. As a consequence, the functional derivatives vanish for all test functions Z if and only if the Euler-Lagrange equation for the particles is satisfied: The gyrokinetic Vlasov equation is reconstructed from the linearised gyrocentre characteristics according to the approximations performed on the action functional given by Eq. (1).
where the linearised gyrocentre characteristics depend on the linearised Hamiltonian model: where H s = H 0,s + ǫ δ H 1,s . For the ordering considered above, the equations for the ion characteristics become: while the equations for the electron characteristics contain the first FLR corrections only: We notice that the equations for the unperturbed characteristics for both species coincide:Ẋ 3 Noether theorem for the Orb5 code model In order to derive the expression for the energy, we calculate the time derivative of the Lagrangian density L = L(X, p z , θ, µ, φ, A ): Using the Euler-Lagrange equations given by Eq. (16), we get: For the field equations, we choose the test function φ 1 = ∂φ 1 /∂t and A 1 = ∂A 1 /∂t and we use the corresponding Euler-Lagrange equations in the weak form: Finally, using the fact that the total time derivative of the Vlasov density vanishes, we get the expression for the energy invariant: where Using the same change of variables z = Z(z 0 ; t), as in the Poisson and Ampère equations, we get: The procedure allowing one to get the power balance diagnostics is the following one: First, we directly substitute the expression for Hamiltonians H 0,s , H 1,s given by Eqs. (6)(7)(8)(9) and H 2 given by Eqs. (10)(11). Then we define the unperturbed kinetic energy of the particles: and the remaining terms are referred to as field energy: Next, the nonlinear term containing H 2 in the expression for the energy is rewritten using the corresponding quasineutrality and Ampère equations in the weak form. This is achieved by choosing a particular test function φ 1 = φ 1 and by substituting it in Eq. (14). Similarly, the test function A 1 = A 1 is substituted to the corresponding Ampère equation given by Eq. (15). The quasineutrality equation (14) with φ 1 = φ 1 is written as: The Ampère equation (15) with A 1 = A 1 is written as: Now using Eqs. (29-30) we substitute the expressions for the electrostatic and electromagnetic contributions into Eq. (28) and we get Eq. (31): For clarity, we define a function for each component of E EM : We remark that these expressions are general for all electromagnetic models and is independent from the choice of the nonlinear model, i.e., the second order Hamiltonian H 2 .

Energetically consistent diagnostics for the Orb5 code
The derivation of dynamical invariants via the Noether's method is naturally included in the Lagrangian framework. It gives an opportunity to construct code diagnostics, allowing one to control the quality of the simulations and to get information about the mechanisms triggering the instabilities.
In particle-in-cell codes, the dynamics of particles and fields is computed in two different ways: Particles are advanced along their characteristics without the use of any grid, while fields are evaluated on a grid. Within one calculation cycle, both sides are communicating: Particle are pushed along their renewed characteristics by using the values of the electromagnetic fields evaluated on the grid. Then the new values of the particle positions are deposed on the grid in order to provide the new values for the charge and current density entering into the electromagnetic field equations (14)- (15).
Considering the energy exchange between particles and fields, i.e., independently calculating the time derivatives of E kin and E F , allows one to control the consistency of the algorithm and the quality of the simulation by verifying the energy conservation. Moreover, further application of Noether theorem makes it possible to analytically calculate a simplified expression for the time derivative of the field energy E F , given by the non-perturbed characteristics of the particles only. Such a simplification gives a possibility to access the underlying instability mechanisms through the particle characteristics.
In this section, we provide the detailed derivation of the Orb5 diagnostics developed from the field-particles energy balance equation: where the time derivative of the l.h.s. can be evaluated through the particle characteristics and the r.h.s. from the field contributions evaluated on the grid. Two diagnostics issued from Eq. (36) are defined: First, the power balance diagnostics is defined as the energy balance equation (36), normalised by the field energy E F . Second, the ∆E F diagnostics is defined as the energy balance equation (36) normalised by an electrostatic component of the field energy, i.e., E es .
Using the definition of the kinetic part of the energy E kin , given by Eq. (35), we explicitly calculate the contributions to Eq. (36): The direct implementation of the linear gyrocentre characteristics for X and p z given by Eqs. (20)(21) leads to the cancellation of all nonlinear terms related to the perturbed electromagnetic fields, i.e., the final expression contains only the contributions corresponding to the unperturbed Hamiltonian dynamics given by Eq. (22): whereẊ The geometric contribution ∇ × b to B * s given by Eqs. (4, 3) is expressed by using the projection on the parallel and perpendicular directions, following the calculations given in Appendix B of [16]: where the scalar τ represents the magnetic twist and the vector G is referred to as the magnetic curvature. Since B × (∇ × B) = −∇p in single fluid MHD equilibrium, we rewrite the curvature vector G in order to evidence the pressurelike contributions into the characteristics: We also decompose the geometric magnetic field in the parallel and perpendicular components in the following way: The unperturbed characteristics in the power balance equation are given by: where we have used the divergence free property of magnetic field

The power balance diagnostics
In order to understand and analyse possible sources of plasma deconfinement, one aims to investigate mechanisms, triggering the growth of microinstabilities and turbulent transport. The mechanisms contributing to the development of microinstabilities are directly related to the exponential growth of electromagnetic field fluctuations. Considering that electromagnetic instabilities have an exponential growth: E F =Ē F e γt , we derive the expression for the power balance diagnostics: Therefore, for practical reasons, in numerical simulations, it is useful to consider the power balance equation in the following form (i.e., normalized by the field energy E F ): The power balance diagnostics is suitable for quality verification in linear and nonlinear simulations. In addition to that in the case of the linear simulations, the power balance equation not only gives an indication about the quality of the simulation but also can be used to measure the instantaneous growth rate of instability [16].

∆E F diagnostics
In the case of electrostatic simulations, the power balance diagnostics is sufficient for investigating the stabilizing and destabilizing mechanisms. The situation is slightly different in the case of electromagnetic simulations when E es = E em therefore, E F = 0 and the diagnostics defined by Eq. (42) is not defined. In order to investigate the transition between electrostatic and electromagnetic instabilities, we introduce the following diagnostics: where functions E es and E em are defined accordingly to Eqs. (33)-(34).
This diagnostics allows one to investigate the properties of the electromagnetic simulations from different viewpoints: First, the sign of the function ∆E F determines if the instability is electrostatic (positive) or electromagnetic (negative). Moreover, ∆E F allows one to access all stabilizing/destabilizing mechanisms through Eq. (38) even in the situation with E F = 0. In addition, investigating functional properties of ∆E F as a function of magnetic β, i.e., the zeros and extremum points (minimum for example) gives the possibility to analyse bifurcations and exchanges of stabilizing/destabilizing mechanisms. We provide this analysis for linear electromagnetic simulations in the next section.

Numerical setup
The parameters used in simulations are derived from the Cyclone Base Case (CBC), which is a well established set of parameters for the flux tube (simulations for one magnetic field line) and global studies (simulations covering the full radial range in the small section of the device). First, it has been used [20] for the benchmark of different flux tubes codes and recently for the benchmark of global electromagnetic codes [15]. The original discharge (H-mode shot #81499 taken at t = 4000 ms and minor radius r = 0.5a, where a is the the minor radius) of the DIII-D device which serves as a basis for the CBC has naturally more complex shaped flux surfaces. In our case, the equilibrium magnetic configuration is circular and concentric with the inverse aspect ratio a/R 0 = 0.36 and the safety factor profile: q(r) = 2.52 (r/a) 2 − 0.16 (r/a) + 0.86.
Here a is the minor tokamak radius and R 0 is a major one, r is the local radius of a flux surface. The temperature and density profiles and their normalized logarithmic gradients are given by: which gives us a peaked gradient profile of density and temperature A = (n, T ) centred at r = r 0 with maximal amplitude κ A and characteristic width w A . The macroscopic reference length L ref is fixed to the major radius R 0 in what follows. The values of parameters used for the benchmark are summarized in Table  1. We remark that the profiles for ions and electrons are chosen to be identical.
The nominal reference values issued from the original experimental work [21] are given in Table 2.
In order to reduce the resolution requirement and the computational effort, the ion-electron mass ratio is set to the proton-electron mass ratio, i.e. the  Table 2: Nominal reference and derived reference values based on the low elongation magnetic surfaces case (CBC) [21], Fig.5, discharge #81499, at time t = 4000ms and ρ = 0.5, which after the rescaling of magnetic surfaces shape towards concentric surfaces corresponds to r/a = 0.5.
electrons are considered being twice heavier than in reality. Concerning the spatial resolution, the associated finite-size parameter ρ * = ρ i /a, defined as the ratio between the ion gyroradius ρ i and the minor radius a, is set to 1/180. In fact, considering a hydrogen aspect ratio for ions would need smaller spatial scales by a factor 2.

Electrostatic and electromagnetic instability analysis
Introducing the electromagnetic effects into the gyrokinetic simulations adds significant complexity compared to the electrostatic simulations, and requires a more detailed analysis for the implementation of diagnostics. It has not been remarked in electrostatic simulations that the normalization of the power bal-ance diagnostics (41) on the field energy E F together with using this diagnostics for the growth rate calculation in linear simulations may introduce some inconsistencies. It starts to be evident for the electromagnetic simulations when the amount of magnetic energy is equal to the amount of electrostatic energy, i.e., E F = 0. It is evident that in this case, Eq. (41) cannot be used for measuring the growth rate. However, thanks to a small modification, this diagnostic can be adapted for investigating the behaviour of the instability triggering mechanisms at this transitional point [see Eq. (43)].
The contributions to the growth rate γ arising from the different terms in the unperturbed guiding-center characteristicsẊ| 0 andṗ z | 0 can be separated in the power balance equation and give a clear vision of which type of instability is present in the system: This diagnostics is suitable for both linear and nonlinear electromangetic simulations: Consistently with the choice of magnetic equilibrium effects, we are neglecting the ∇P contribution to the curvature or ∇B drift. Therefore, v ∇P ,s = 0 and v curv,s = µB∇ · b. This gives us the possibility to follow easily the dynamics of the remaining contributions to dE F /dt. Accordingly to the sign, the contributions v ,s , v curv,s and v ∇B,s to the time derivative of the field energy are considered stabilizing when it is negative or destabilizing when it is positive. Following the electromagnetic β scan of the linear electromagnetic simulations, summarized in the Table 3, we focus on the sign of v ,s ,v curv,s and v ∇B,s contributions. In Fig. 1, different cases of the instability triggering mechanisms are presented. We notice that for the case with E F = 0 or close to zero, additional standard linear fit diagnostics for the growth rate is used to avoid numerical errors due to the division by a small number in the denominator of Eq. (41). At the same time, for each value of β, we monitor the value of ∆E F , defined by Eq. (43), as the value of the electromagnetic field energy normalized by the electrostatic energy (see Fig. 2). The change of sign for ∆E F corresponds to the transition from the electrostatic to the electromagnetic regime. In Fig. 1, the dE F /dt diagnostics is presented for different values of β. Figure  1a) represents the electrostatic ITG with β = 0.00001%, ∆E F = 0.99 which is mainly destabilized by curvature contribution with v ∇B,s > 0. Figure 1b): β is increased up to 0.0025%, ∆E F = 0.79, which activates an additional destabilizing mechanism with A 1 v curv,s > 0. Figure 1c): β = 0.06% corresponds to ∆E F = 0.03, i.e., the amount of electrostatic energy is almost equal to the amount of electromagnetic energy in the system: This corresponds to the exchange of the stabilizing and destabilizing mechanisms, i.e., the mode is now destabilized by kinetic effects with v ,s > 0. However, the growth rate and the frequency of the mode exhibit no bifurcation. Figure 1d): β = 0.5% corresponds to the electromagnetic ITG mode with ∆E F = −86.20, destabilized by kinetic effects v ,s > 0. Figure 1e): β = 0.69% with ∆E F = −296.76, a minimal value for the normalized field energy corresponds to the ITG to KBM bifurcation in frequencies and the growth rates. Figure 1f): β = 1.125% ∆E F = −204.89 corresponds to the high frequency KBM mode with v ,s > 0.
In Fig. 2, we perform the β-scan with both energy conservation based diagnostics, the power balance diagnostics given by Eq. (41) and the ∆E F diagnostics. In Fig. 2a), the growth rate of the instabilities as a function of β is calculated according to the power balance diagnostics given by Eq. (41). The minimum corresponds to the bifurcation from ITG to KBM. On Fig. 2b), the corresponding frequencies are presented: the transition between the slow (ITG) and the fast mode (KBM) happens at the value β = 0.65%, which corresponds to the minimum of the power balance diagnostics. Figures 2c) and 2d) represent the ∆E F diagnostics. The functional dependency on β is investigated: On  Fig. 2c), the zero of the ∆E F (β) function corresponds to the transition from the electrostatic ITG to the electromagnetic ITG, which corresponds to the exchange of stabilizing/destabilizing mechanisms, from the curvature drift v curv,s to the kinetic mechanisms driven by v ,s . The minimum of the ∆E F (β) function corresponds to the bifurcation between the ITG and KBM modes, i.e., the minimum of the power balance diagnostics from Fig. 2a). Figure 2d) represents the part of Fig. 2c), with low β, featuring zero of ∆E F (β) function.

Conclusions
In this work, the energy exchange channels leading to destabilisation of the electromagnetic instabilities in global gyrokinetic simulations with Orb5 code have been identified. First, it has been observed through the simulations that with increasing β the contribution of the magnetic curvature in the ITG mode destabilisation decreases together with the mode growth rate. It confirms the results of previous studies, indicating the stabilizing role of the magnetic β on the ITG instability. Second, the implementation of the diagnostics, issued from  Table 3: Data corresponding to analysis of linear electromagnetic simulations provided on Fig. 2.
Noether's method, allows one to investigate the transition from the electrostatic towards the electromagnetic ITG regime. Following the contributions to the energy time variation, the transition from the destabilizing role of curvature drift towards its stabilizing role is identified. The implementation of the energy invariant based diagnostic ∆E F allowed to systematically analyse essential features of the electromagnetic instabilities, for instance, by looking at the zeros of ∆E F corresponding to the ITG instability mechanism exchange and the minimum of that function corresponding to the bifurcation between the ITG and the KBM mode. We observe that the transition of the instabilities generating mechanisms in the framework of the gyrokinetic theory follows the results obtained in previous studies realised in the framework of fluid and kinetic approaches [2]. This transition happens at β = 0.06%, which follows previous theoretical predictions for β > m e /m i ∼ 0.055%. Finally, it has been identified that the mode bifurcation towards the kinetic ballooning mode dominated regime happens at β = 0.65%, i.e., at a β value 10 times higher than the β value at which mixing between the ITG (slow) and KBM (fast) modes occurs together with the destabilizing mechanisms exchange.