1 Introduction
Understanding turbulent transport physics in the tokamak edge and scrape-off layer (SOL) is critical to developing a successful fusion reactor. The dynamics in these regions plays a key role in determining the L–H transition, the pedestal height and the heat load to the vessel walls. While the edge is often modelled by Braginskii-type fluid models that have provided valuable results and insights (Xu et al. Reference Xu, Umansky, Dudson and Snyder2008; Tamain et al. Reference Tamain, Ghendrih, Tsitrone, Grandgirard, Garbet, Sarazin, Serre, Ciraolo and Chiavassa2010; Ricci et al. Reference Ricci, Halpern, Jolliet, Loizu, Mosetto, Fasoli, Furno and Theiler2012; Francisquez, Zhu & Rogers Reference Francisquez, Zhu and Rogers2017; Zhu, Francisquez & Rogers Reference Zhu, Francisquez and Rogers2017), a kinetic treatment will inevitably be necessary for reliable quantitative predictions in some cases (Jenko & Dorland Reference Jenko and Dorland2001; Cohen & Xu Reference Cohen and Xu2008). Gyrokinetic theory and direct numerical simulation have become important tools for studying turbulence and transport in fusion plasmas, especially in the core region (Parker, Lee & Santoro Reference Parker, Lee and Santoro1993a; Kotschenreuther, Rewoldt & Tang Reference Kotschenreuther, Rewoldt and Tang1995; Dimits et al. Reference Dimits, Bateman, Beer, Cohen, Dorland, Hammett, Kim, Kinsey, Kotschenreuther and Kritz2000; Dorland et al. Reference Dorland, Jenko, Kotschenreuther and Rogers2000; Jenko Reference Jenko2000; Lin et al. Reference Lin, Hahm, Lee, Tang and White2000; Jost et al. Reference Jost, Tran, Cooper, Villard and Appert2001; Candy & Waltz Reference Candy and Waltz2003; Idomura, Tokuda & Kishimoto Reference Idomura, Tokuda and Kishimoto2003; Watanabe & Sugama Reference Watanabe and Sugama2005; Jolliet et al. Reference Jolliet, Bottino, Angelino, Hatzky, Tran, Mcmillan, Sauter, Appert, Idomura and Villard2007; Idomura et al. Reference Idomura, Ida, Kano, Aiba and Tokuda2008; Peeters et al. Reference Peeters, Camenen, Casson, Hornsby, Snodin, Strintzi and Szepesi2009; Lanti et al. Reference Lanti, Ohana, Tronko, Hayward-Schneider, Bottino, McMillan, Mishchenko, Scheinberg, Biancalani and Angelino2019). In the edge and SOL, gyrokinetic simulations are particularly challenging because the large, intermittent fluctuations in the SOL make assumptions of scale separation between equilibrium and fluctuations not strongly valid. This necessitates a full-$f$ approach that self-consistently evolves the full distribution function, $f$ (as opposed to the $\unicode[STIX]{x1D6FF}f$ approach commonly used in the core, where one assumes $f=F_{0}+\unicode[STIX]{x1D6FF}f$ with a fixed background $F_{0}$ so that only $\unicode[STIX]{x1D6FF}f$ perturbations must be evolved, and the parallel electric field nonlinearity is frequently neglected). Steady progress in gyrokinetic edge/SOL modelling has been made with both particle-in-cell (PIC) (Ku, Chang & Diamond Reference Ku, Chang and Diamond2009; Korpilo et al. Reference Korpilo, Gurchenko, Gusakov, Heikkinen, Janhunen, Kiviniemi, Leerink, Niskala and Perevalov2016; Ku et al. Reference Ku, Hager, Chang, Kwon and Parker2016) and continuum (Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019; Dorf et al. Reference Dorf, Dorr, Hittinger, Cohen and Rognlien2016; Pan et al. Reference Pan, Told, Shi, Hammett and Jenko2018) methods. Another challenge is the magnetic geometry of the edge/SOL region, which requires treatment of open and closed magnetic field-line regions and the resulting plasma interactions with material walls on open field lines. The X-point in a diverted geometry is an additional complication which makes the use of field-aligned coordinates challenging. Currently, only the XGC1 hybrid-Lagrangian PIC code (Ku et al. Reference Ku, Hager, Chang, Kwon and Parker2016) can simulate gyrokinetic turbulence in a three-dimensional diverted geometry with an X-point.
The edge/SOL region also features steep pressure gradients, especially in the H-mode transport barrier and SOL regions, which contributes to the importance of electromagnetic effects. In this regime, the parallel electron dynamics is no longer fast relative to the drift turbulence, so electrons can no longer be treated adiabatically (Scott Reference Scott1997). This leads to coupling of the perpendicular vortex motions and kinetic shear Alfvén waves, which results in field-line bending (Xu et al. Reference Xu, Naulin, Fundamenski, Rasmussen, Nielsen and Wan2010). Including electromagnetic effects in gyrokinetic simulations has proved numerically and computationally challenging, both in the core and in the edge. The so-called Ampère cancellation problem is one of the main numerical issues that has troubled primarily PIC codes (Reynders Reference Reynders1993; Cummings Reference Cummings1994). Various $\unicode[STIX]{x1D6FF}f$ PIC schemes to address the cancellation problem have been developed and there are interesting recent advances in this area (Chen & Parker Reference Chen and Parker2003; Mishchenko, Hatzky & Könies Reference Mishchenko, Hatzky and Könies2004; Hatzky, Könies & Mishchenko Reference Hatzky, Könies and Mishchenko2007; Mishchenko et al. Reference Mishchenko, Könies, Kleiber and Cole2014; Startsev & Lee Reference Startsev and Lee2014; Bao, Lin & Lu Reference Bao, Lin and Lu2018). Meanwhile, some continuum $\unicode[STIX]{x1D6FF}f$ core codes avoided the cancellation problem completely (Rewoldt, Tang & Hastie Reference Rewoldt, Tang and Hastie1987; Kotschenreuther et al. Reference Kotschenreuther, Rewoldt and Tang1995), while others had to address somewhat minor issues resulting from it (Jenko Reference Jenko2000; Candy & Waltz Reference Candy and Waltz2003). With respect to the cancellation problem, one possible reason for the differences might be that, in continuum codes, the fields and particles are discretized on the same grid, whereas in PIC codes the particle positions do not coincide with the field grid. Because particle positions are randomly located relative to the field grid, one might need to be more careful in some way when treating the interaction of the particles and electromagnetic fields.
To this point, all published nonlinear electromagnetic gyrokinetic results have focused on the core region, mostly within the $\unicode[STIX]{x1D6FF}f$ formulation neglecting the $E_{\Vert }$ nonlinearity, although the ORB5 PIC code includes the $E_{\Vert }$ nonlinearity and is effectively full-$f$ (Lanti et al. Reference Lanti, Ohana, Tronko, Hayward-Schneider, Bottino, McMillan, Mishchenko, Scheinberg, Biancalani and Angelino2019). The XGC1 code is also full-$f$ and is focused on both the core and the edge/SOL; it has an option for a gyrokinetic ion/drift-fluid massless electron hybrid model (Hager et al. Reference Hager, Lang, Chang, Ku, Chen, Parker and Adams2017), with a fully kinetic implicit electromagnetic scheme based on Chen & Chacon (Reference Chen and Chacon2015) recently implemented and under further development (Ku et al. Reference Ku, Sturdevant, Hager, Chang, Chacon and Chen2018b). Other gyrokinetic codes working on the SOL are not yet electromagnetic. Thus, to our knowledge, the results presented here are the first nonlinear electromagnetic full-$f$ gyrokinetic turbulence simulations on open field lines.
In this paper we present a numerical scheme for simulating the full-$f$ electromagnetic gyrokinetic system using a continuum approach. We use an energy-conserving discontinuous Galerkin (DG) scheme for the discretization of the gyrokinetic system in phase space, building on the work of Liu & Shu (Reference Liu and Shu2000), Shi (Reference Shi2017), Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017) and Hakim et al. (Reference Hakim, Hammett, Shi and Mandell2019). DG methods are attractive because they are highly local (enabling fairly straightforward parallelization schemes), allow high-order accuracy and enforce local conservation laws (Durran Reference Durran2010). The present target of the scheme is simulating the edge and SOL of tokamaks, although the scheme could in principle be used for whole-device modelling, including the core. Our scheme has been implemented as part of the gyrokinetics solver (Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017, Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019; Bernard et al. Reference Bernard, Shi, Gentle, Hakim, Hammett, Stoltzfus-Dueck and Taylor2019) of the Gkeyll computational plasma framework, which also includes solvers for the Vlasov–Maxwell system (Cagas et al. Reference Cagas, Hakim, Juno and Srinivasan2017; Juno et al. Reference Juno, Hakim, TenBarge, Shi and Dorland2018) and multi-moment fluid equations (Wang et al. Reference Wang, Hakim, Bhattacharjee and Germaschewski2015).
The paper is organized as follows. In § 2, we describe the electromagnetic gyrokinetic system and some of its conservation properties. Section 3 describes the discontinuous Galerkin phase-space discretization of the system, and also presents proofs that the scheme preserves particle and energy conservation. The time-discretization scheme is handled in § 4. In § 5 we present some linear electromagnetic benchmarks that validate the scheme and also demonstrate the avoidance of the cancellation problem. We present nonlinear results showing the first electromagnetic gyrokinetic turbulence simulation on open field lines in § 6, along with comparisons to a corresponding electrostatic simulation. We summarize and address future work in § 7.
2 The electromagnetic gyrokinetic system
2.1 Basic equations
We solve the full-$f$ electromagnetic gyrokinetic (EMGK) equation in the symplectic formulation (Brizard & Hahm Reference Brizard and Hahm2007), which describes the evolution of the gyrocentre distribution function $f_{s}(\boldsymbol{Z},t)=f_{s}(\boldsymbol{R},v_{\Vert },\unicode[STIX]{x1D707},t)$ for each species $s$, where $\boldsymbol{Z}$ is a phase-space coordinate composed of the guiding centre position $\boldsymbol{R}=(x,y,z)$, the parallel velocity $v_{\Vert }$ and the magnetic moment $\unicode[STIX]{x1D707}=m_{s}v_{\bot }^{2}/(2B)$. In terms of the gyrocentre Hamiltonian and the Poisson bracket in gyrocentre coordinates, and also including collisions $C[f_{s}]$ and sources $S_{s}$ (which do not derive from the bracket), the gyrokinetic equation is given byFootnote 1
or equivalently,
where the gyrokinetic Poisson bracket is given by
and we take the gyrocentre Hamiltonian to be
Here, we have taken the long-wavelength (drift-kinetic) limit to neglect gyroaveraging of the electrostatic potential $\unicode[STIX]{x1D719}$, and we have also dropped higher-order terms in the Hamiltonian that appear in e.g. Brizard & Hahm (Reference Brizard and Hahm2007); extensions to include gyroaveraging will be included in later work, but these additions will not change the overall scheme presented here. The nonlinear phase-space characteristics are given by
Here, $B_{\Vert }^{\ast }=\hat{\boldsymbol{b}}\boldsymbol{\cdot }\boldsymbol{B}^{\ast }$ is the parallel component of the effective magnetic field $\boldsymbol{B}^{\ast }=\boldsymbol{B}+(m_{s}v_{\Vert }/q_{s})\unicode[STIX]{x1D735}\times \hat{\boldsymbol{b}}+\unicode[STIX]{x1D6FF}\boldsymbol{B}$, where $\boldsymbol{B}=B\hat{\boldsymbol{b}}$ is the equilibrium magnetic field and $\unicode[STIX]{x1D6FF}\boldsymbol{B}=\unicode[STIX]{x1D735}\times (A_{\Vert }\hat{\boldsymbol{b}})\approx \unicode[STIX]{x1D735}A_{\Vert }\times \hat{\boldsymbol{b}}$ is the perturbed magnetic field (assuming that the equilibrium magnetic field varies on spatial scales longer than perturbations so that $A_{\Vert }\unicode[STIX]{x1D735}\times \hat{\boldsymbol{b}}$ can be neglected). We neglect higher-order parallel compressional fluctuations of the magnetic field, so that $\unicode[STIX]{x1D6FF}\boldsymbol{B}=\unicode[STIX]{x1D6FF}\boldsymbol{B}_{\bot }$. The species charge and mass are $q_{s}$ and $m_{s}$, respectively. In (2.6), note that we have separated $\dot{v}_{\Vert }$ into a term that comes from the Hamiltonian, $\dot{v}_{\Vert }^{H}=\{v_{\Vert },H_{s}\}$, and another term proportional to the inductive component of the parallel electric field, $(q/m)\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$. We use this notation for convenience, and so that the time derivative of the parallel vector potential $A_{\Vert }$ appears explicitly. Further, we will assume a field-aligned coordinate system (e.g. Beer, Cowley & Hammett Reference Beer, Cowley and Hammett1995), and we will take the perpendicular directions to be $x$ and $y$, and the parallel direction to be $z$.
In the absence of collisions $C[f_{s}]$ and sources $S_{s}$, equation (2.1) can be recognized as a Liouville equation, which shows that the distribution function is conserved along the nonlinear characteristics. Liouville’s theorem also shows that phase-space volume is conserved,
where ${\mathcal{J}}=B_{\Vert }^{\ast }$ is the Jacobian of the gyrocentre coordinates, and we will make the approximation $\hat{\boldsymbol{b}}\boldsymbol{\cdot }\unicode[STIX]{x1D735}\times \hat{\boldsymbol{b}}\approx 0$ so that $B_{\Vert }^{\ast }\approx B$.
We can now write the gyrokinetic equation in conservative form,
Here, we have used the symplectic formulation of electromagnetic gyrokinetics, where the parallel velocity is used as an independent variable (as opposed to the Hamiltonian formulation which uses the parallel canonical momentum $p_{\Vert }$ as an independent variable) (Hahm, Lee & Brizard Reference Hahm, Lee and Brizard1988; Brizard & Hahm Reference Brizard and Hahm2007). Notably, in the symplectic formulation, the time derivative of $A_{\Vert }$ appears explicitly in the gyrokinetic equation, equation (2.8), and $A_{\Vert }$ appears in $\boldsymbol{B}^{\ast }$ but not in the Hamiltonian.
The electrostatic potential is determined by the quasi-neutrality condition in the long-wavelength limit, given by
with the guiding centre charge density (neglecting gyroaveraging in the long-wavelength limit)
Here we have defined $\text{d}\boldsymbol{w}=2\unicode[STIX]{x03C0}m_{s}^{-1}\,\text{d}v_{\Vert }\,\text{d}\unicode[STIX]{x1D707}=m_{s}^{-1}\,\text{d}v_{\Vert }\,\text{d}\unicode[STIX]{x1D707}\int \text{d}\unicode[STIX]{x1D6FC}$ as the gyrocentre velocity-space volume element $(\text{d}\boldsymbol{v}=m_{s}^{-1}\,\text{d}v_{\Vert }\,\text{d}\unicode[STIX]{x1D707}\,\text{d}\unicode[STIX]{x1D6FC}{\mathcal{J}})$ with the gyroangle $\unicode[STIX]{x1D6FC}$ integrated away and the Jacobian factored out. The polarization vector is
where $\unicode[STIX]{x1D735}_{\bot }=\unicode[STIX]{x1D735}-\hat{\boldsymbol{b}}(\hat{\boldsymbol{b}}\boldsymbol{\cdot }\unicode[STIX]{x1D735})$ is the gradient perpendicular to the background magnetic field. We use a linearized polarization density $n_{0}$ that we take to be a constant in time, which is consistent with neglecting a second-order $E\times B$ energy term in the Hamiltonian. While the validity of this approximation in the SOL can be questioned due to large density fluctuations, a linearized polarization density is commonly used for computational efficiency (Ku et al. Reference Ku, Chang, Hager, Churchill, Tynan, Cziegler, Greenwald, Hughes, Parker and Adams2018a; Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019). Future work will include the nonlinear polarization density along with the second-order $E\times B$ energy term in the Hamiltonian. The quasi-neutrality condition can then be rewritten as the long-wavelength gyrokinetic Poisson equation,
Even in the long-wavelength limit with no gyroaveraging, the first-order polarization charge density on the left-hand side of (2.12) incorporates some finite Larmor radius (FLR) effects.
The parallel vector potential $A_{\Vert }$ is determined by the parallel Ampère equation,
Note that we can also take the time derivative of this equation to get a generalized Ohm’s law which can be solved directly for $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$, the inductive component of the parallel electric field $E_{\Vert }$ (Reynders Reference Reynders1993; Cummings Reference Cummings1994; Chen & Parker Reference Chen and Parker2001)
Writing the gyrokinetic equation as
where $\unicode[STIX]{x2202}({\mathcal{J}}f_{s})^{\star }/\unicode[STIX]{x2202}t$ denotes all the terms in the gyrokinetic equation (including sources and collisions) except the $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ term, Ohm’s law can be rewritten (after an integration by parts) as
As we will show in § 4, this form allows for the use of an explicit time-stepping scheme in which one can first compute $\unicode[STIX]{x2202}({\mathcal{J}}f_{s})^{\star }/\unicode[STIX]{x2202}t$ (which does not involve $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$), then compute $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ and finally compute $\unicode[STIX]{x2202}({\mathcal{J}}f_{s})/\unicode[STIX]{x2202}t$. Note, however, that in some PIC approaches (Reynders Reference Reynders1993; Chen & Parker Reference Chen and Parker2001), one must expand the right-hand side of (2.16) by inserting the gyrokinetic equation so that the right-hand side involves only moments of $f_{s}$ without time derivatives. In our continuum scheme we can compute $\unicode[STIX]{x2202}({\mathcal{J}}f_{s})^{\star }/\unicode[STIX]{x2202}t$ directly and then perform the integration. Further, note that although we are using the symplectic ($v_{\Vert }$) formulation of EMGK, our Ohm’s law from (2.16) contains two integral terms which must cancel exactly. This is the root of the cancellation problem that appears in Ampère’s law in the Hamiltonian ($p_{\Vert }$) formulation, and in appendix A we show that the same cancellation problem could arise from (2.16) if the integrals are not treated consistently.
To model the effect of collisions we use a conservative Lenard–Bernstein (or Dougherty) collision operator (Lenard & Bernstein Reference Lenard and Bernstein1958; Dougherty Reference Dougherty1964),
where
with $n=\int \text{d}\boldsymbol{w}{\mathcal{J}}f$. This collision operator contains the effect of drag and pitch-angle scattering, and it conserves number, momentum and energy density. Consistent with our present long-wavelength treatment of the gyrokinetic system, finite Larmor radius effects are ignored. For simplicity we restrict ourselves to the case in which the collision frequency $\unicode[STIX]{x1D708}$ is velocity independent, i.e. $\unicode[STIX]{x1D708}\neq \unicode[STIX]{x1D708}(v)$. Further details about this collision operator, including its conservation properties and its discretization, are left to a separate paper (Francisquez et al. Reference Francisquez, Bernard, Mandell, Hammett and Hakim2020). In this work, we include only the effects of like-species collisions, which neglects electron–ion collisions and the resulting resistivity. A conservative scheme for cross-species collisions has also been implemented and will be included in later work. Extensions to a more complete collision operator are in progress.
2.2 Conservation properties
In the absence of collisions and sources, the Hamiltonian structure of the gyrokinetic system guarantees conservation of arbitrary functions of $f$ along the characteristics,
along with corresponding Casimir invariants $\int \text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}G(f)$, where $\text{d}\boldsymbol{R}=\text{d}x\,\text{d}y\,\text{d}z$. Thus, the system has an infinite number of conserved quantities such as the total particle number (or $L_{1}$ norm) $N=\int \text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f$, the $L_{2}$ norm $M=\int \text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f^{2}$ and the kinetic entropy $S=-\int \text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f\ln f$ (Idomura et al. Reference Idomura, Ida, Kano, Aiba and Tokuda2008).
The system also conserves total energy, $W=W_{K}+W_{E}+W_{B}=W_{H}-W_{E}+W_{B}$, where the kinetic particle energy (neglecting the kinetic energy of the $E\times B$ flow) is
the (non-vacuum) electrostatic field energy (equivalent to the kinetic energy associated with the $E\times B$ flow of particles) is
the (perturbed) electromagnetic field energy is
and
(Note that $W_{H}$ is the sum of the particle kinetic energy and twice the potential energy, because every pair of particle interactions is double counted in the raw integral of $q_{s}\unicode[STIX]{x1D719}f_{s}$.)
Assuming the boundary conditions are periodic or that the distribution function vanishes at the boundary so that surface terms vanish, the evolution of these quantities can be calculated as
so that total energy is indeed conserved:
3 The discrete EMGK system
In this section we describe the phase-space discretization of the electromagnetic gyrokinetic system used in Gkeyll.
3.1 Discrete equations
We use an energy-conserving discontinuous Galerkin scheme to discretize the gyrokinetic system in phase space. The scheme generalizes the algorithm of Liu & Shu (Reference Liu and Shu2000) (originally for the two-dimensional incompressible Euler and Navier–Stokes equations) to arbitrary Hamiltonian systems (Hakim et al. Reference Hakim, Hammett, Shi and Mandell2019; Shi Reference Shi2017; Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017). However, unlike the nodal approach used in Shi (Reference Shi2017) and Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017), we use a modal DG scheme.
We start by decomposing the global phase-space domain $\unicode[STIX]{x1D6FA}$ into a structured phase-space mesh ${\mathcal{T}}$ with cells ${\mathcal{K}}_{j}\in {\mathcal{T}},j=1,\ldots ,N$. We then introduce a piecewise-polynomial approximation space for the distribution function $f(\boldsymbol{R},v_{\Vert },\unicode[STIX]{x1D707})$,
where $\boldsymbol{P}^{p}$ is some space of polynomials with maximum degree $p$ (by some measure). That is, $v(z)$ are polynomial functions of $\boldsymbol{z}$ in each cell, and $\boldsymbol{P}^{p}$ is the space of the linear combination of some set of multi-variate polynomials. In this work, we choose $\boldsymbol{P}^{p}$ to be an orthonormalized serendipity polynomial element space (Arnold & Awanou Reference Arnold and Awanou2011). The serendipity basis set has the advantage of using fewer basis functions while giving the same formal convergence order (although it is less accurate) as the Lagrange tensor basis, although note that, for $p=1$, the serendipity basis is equivalent to the Lagrange tensor basis. We can then obtain the discrete weak form of the gyrokinetic equation by multiplying equation (2.8) by any test function $\unicode[STIX]{x1D713}\in {\mathcal{V}}_{h}^{p}$ and integrating (by parts) in each cell
Solving this equation for all test functions $\unicode[STIX]{x1D713}\in {\mathcal{V}}_{h}^{p}$ in all cells ${\mathcal{K}}_{j}\in {\mathcal{T}}$ yields the discretized distribution function $f_{h}\in {\mathcal{V}}_{h}^{p}$, where the subscript $h$ denotes a discrete quantity in ${\mathcal{V}}_{h}^{p}$. In the surface terms, $\text{d}\boldsymbol{s}_{R}$ is the differential element on a configuration-space surface (pointing outward normal to the surface), $\text{d}s_{w}=2\unicode[STIX]{x03C0}m_{s}^{-1}\,\text{d}\unicode[STIX]{x1D707}\,\boldsymbol{n}\boldsymbol{\cdot }(\unicode[STIX]{x2202}\boldsymbol{Z}/\unicode[STIX]{x2202}v_{\Vert })$ is the differential element on a $v_{\Vert }$ surface and the notation $\unicode[STIX]{x1D713}^{-}$ ($\unicode[STIX]{x1D713}^{+}$) indicates that the function $\unicode[STIX]{x1D713}$ is evaluated just inside (outside) the surface $\unicode[STIX]{x2202}{\mathcal{K}}_{j}$. The notation $\widehat{f}=\widehat{f}(f^{+},f^{-})$ indicates a ‘numerical flux’, which takes a single value at the cell surface and in general can depend on the solution on both sides of the surface since the solution is discontinuous at the surface. Here, we choose to use standard upwind fluxes, which depend on the local value of the phase-space characteristic flow normal to the surface evaluated at each Gaussian quadrature point on the surface. Denoting the flow as $\unicode[STIX]{x1D736}_{h}$, the upwind flux can be expressed as
where $\boldsymbol{n}=\text{d}\boldsymbol{s}/|\text{d}\boldsymbol{s}|$ is the unit normal pointing out of the $\unicode[STIX]{x2202}{\mathcal{K}}_{j}$ surface.
We will introduce a subset of ${\mathcal{V}}_{h}^{p}$ where the piecewise polynomials are continuous across cell interfaces, denoted by $\overline{{\mathcal{V}}}_{h}^{p}$. As we will show later, in order to preserve energy conservation in our discrete scheme, we will require that the discrete Hamiltonian be continuous across cell interfaces, i.e. $H_{h}\in \overline{{\mathcal{V}}}_{h}^{p}$ (Liu & Shu Reference Liu and Shu2000; Shi Reference Shi2017; Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017; Hakim et al. Reference Hakim, Hammett, Shi and Mandell2019). Note that one can show that this ensures that the discrete phase-space characteristics, $\dot{\boldsymbol{R}}_{h}=\{\boldsymbol{R},H_{h}\}$ and $\dot{v}_{\Vert h}^{H}-(q_{s}/m_{s})\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t=\{v_{\Vert },H_{h}\}-(q_{s}/m_{s})\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$, are also continuous across cell interfaces.Footnote 2
We must also discretize the field equations. We introduce the restriction of the phase-space mesh to configuration space, ${\mathcal{T}}^{R}$, and we denote the configuration-space cells by ${\mathcal{K}}_{j}^{R}\in {\mathcal{T}}^{R}$ for $j=1,\ldots ,N_{R}$, where $N_{R}$ is the number of configuration-space cells. We also restrict ${\mathcal{V}}_{h}^{p}$ to configuration space as
Further, we introduce the subset of polynomials that are piecewise continuous across configuration-space cell interfaces $\overline{{\mathcal{X}}}_{h}^{p}\subset {\mathcal{X}}_{h}^{p}$, along with an additional subset where continuity is required in the directions perpendicular to the magnetic field, but not in the direction parallel to the field. Assuming a field-aligned coordinate system (e.g. Beer et al. Reference Beer, Cowley and Hammett1995), we will take the perpendicular directions to be $x$ and $y$, and the parallel direction to be $z$.
Since we require $H_{h}$ to be continuous across all cell interfaces, this means that we require $\unicode[STIX]{x1D719}_{h}$ to be continuous, i.e. $\unicode[STIX]{x1D719}_{h}\in \overline{{\mathcal{X}}}_{h}^{p}$. Thus, to solve the Poisson equation we use the (continuous) finite-element method (FEM). While one could ensure $\unicode[STIX]{x1D719}_{h}$ is continuous in all directions by using a three-dimensional FEM solve, we instead use a two-dimensional FEM solve in the $x$ and $y$ directions, followed by a one-dimensional smoothing operation in the $z$ direction. That is, we first solve for using a two-dimensional FEM solve, and then we use a smoothing/projection operation to ensure continuity in the $z$ direction. We will denote this operation as and define it below. We can make this splitting because $\unicode[STIX]{x1D735}_{\bot }$ only produces coupling in the $x$ and $y$ (perpendicular) directions.
For the two-dimensional solve, we solve for by multiplying equation (2.12) by a test function and integrating (by parts) in each configuration-space cell ${\mathcal{K}}_{j}^{R}$ to obtain the discrete local weak form
where $\unicode[STIX]{x1D709}^{(j)}$ denotes the restriction of $\unicode[STIX]{x1D709}$ to cell $j$ and
with ${\mathcal{T}}^{v}$ the restriction of ${\mathcal{T}}$ to velocity space. The global weak form is then obtained by summing equation (
3.5) over cells in $x$ and $y$ (but not in $z$), which results in cancellation of the surface terms at cell interfaces and leaves only a global $\unicode[STIX]{x2202}{\mathcal{T}}^{R}$ boundary term. Note that, in order to maintain energetic consistency (as we will see below), the introduction of ${\mathcal{P}}_{z}$ necessitates the modification of the right-hand side of (
3.5) with ${\mathcal{P}}_{z}^{\ast }$, the adjoint of ${\mathcal{P}}_{z}$, defined as
For the smoothing operation , we use a one-dimensional FEM solve in the $z$ direction. This can be written as the solution $\unicode[STIX]{x1D719}_{h}$ of the global (in $z$) weak equality
where $\unicode[STIX]{x1D712}\in \widehat{{\mathcal{X}}}_{h}^{p}\subset {\mathcal{X}}_{h}^{p}$, with $\widehat{{\mathcal{X}}}_{h}^{p}$ a subset of the configuration-space basis where continuity is required only in the $z$ direction. Here, ${\mathcal{T}}_{j}^{z}$ denotes a restriction of the domain that is global in $z$ but cell-wise local in $x$ and $y$. We remark that using an FEM solve for this operation makes ${\mathcal{P}}_{z}$ self-adjoint, so that ${\mathcal{P}}_{z}^{\ast }={\mathcal{P}}_{z}$. Note, however, that one could instead use a different, local smoothing operation that is not self-adjoint, so we will keep the distinction between ${\mathcal{P}}_{z}$ and ${\mathcal{P}}_{z}^{\ast }$. Also note that ${\mathcal{P}}_{z}$ is a projection operator, in that .
The continuous discrete Hamiltonian $H_{h}\in \overline{{\mathcal{V}}}_{h}^{p}$ is then given by
where $v_{\Vert h}^{2}$ is the projection of $v_{\Vert }^{2}$ onto $\overline{{\mathcal{V}}}_{h}^{p}$. Note that this is only necessary when $v_{\Vert }^{2}$ is not in the basis, i.e. when $p_{v}<2$, where $p_{v}$ is the maximum degree of the $v_{\Vert }$ monomials in the basis set.
For the parallel Ampère equation we will take so that $A_{\Vert h}$ is continuous in $x$ and $y$ but discontinuous in $z$. Multiplying equation (2.13) by a test function and integrating, we can obtain the discrete weak form of this equation. The local weak form in cell $j$ is
where again the surface terms will cancel on summing over cells except at the global $\unicode[STIX]{x2202}{\mathcal{T}}^{R}$ boundary, and
Here, note that we have replaced the $v_{\Vert }$ in the $J_{\Vert }$ definition from (2.13) with $(1/m)\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }$; this will be required for energy conservation in the $p_{v}=1$ case, since $\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }\neq mv_{\Vert }$ when $v_{\Vert }^{2}$ is not in the basis. Instead, for $p_{v}=1$, $\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }=m\bar{v}_{\Vert }$, the piecewise-constant projection of $mv_{\Vert }$. As before, we solve equation (3.10) using a two-dimensional FEM solve in the $x$ and $y$ directions. Note, however, that we do not require the smoothing operation in $z$ here because $A_{\Vert h}$ is allowed to be discontinuous in the $z$ direction, since it does not appear in the Hamiltonian in the symplectic formulation of EMGK.
The discrete weak form of Ohm’s law can be obtained by taking the time derivative of (3.10); after some manipulation, which we leave to appendix B, the local weak form becomes
where , and
so that the gyrokinetic equation can be written as
Note that some special attention is required to ensure that upwinding of the numerical fluxes is handled consistently in (3.12) and (3.15) in the $p_{v}=1$ case. The upwind flow for the $v_{\Vert }$ surface terms is $\dot{v}_{\Vert h}^{H}-(q/m)\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$; this is somewhat problematic because we cannot readily solve for $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ from (3.12) without first knowing the upwind direction, which depends on $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$. Thus, for $p_{v}=1$ only, we use an approximate $\widetilde{\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t}$, calculated using equation (3.13) (which contains no surface term contributions), to compute the upwind direction for the $v_{\Vert }$ surface terms in (3.12) and (3.15). (One could extend this algorithm by iterating with a new estimate of the upwind direction based on the previous estimate of $\unicode[STIX]{x2202}A_{\Vert \,h}/\unicode[STIX]{x2202}t$, but we leave that for future work. The present algorithm seems to work well for the cases tested so far, and we expect that $\widetilde{\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t}$ results in the correct upwind direction most of the time.)
In our modal DG scheme, integrals in the above weak forms are computed analytically using a quadrature-free scheme that results in exact integrations (of the discrete integrands). (This means there are no aliasing errors, and that integration by parts operations that led to these integrals are treated exactly, for the specified discrete representation of $f_{h}$ and other factors in the integrand.) This is important for ensuring the conservation properties of the scheme, since the conservation laws in the EMGK system are indirect, involving integrals of the gyrokinetic equation. The fact that integrations are exact also has important implications for the cancellation problem. Since integrals in the discrete Ohm’s law are computed exactly, the discretization errors (which are solely embedded in the discrete integrands) cancel exactly, avoiding the cancellation problem. For more details about the modal scheme, the analytical integrations and the avoidance of the cancellation problem, we have included in appendix C a derivation of a semi-discrete Alfvén wave dispersion relation that results from our scheme.
3.2 Discrete conservation properties
Now we would like to show that the discrete system (in the continuous-time limit) preserves various conservation laws of the continuous system. As with the continuous system, we will consider the conservation properties in the absence of collisions, sources and sinks, and we will assume that the boundary conditions are either periodic or that the distribution function vanishes at the boundary.
Proposition 1. The discrete system conserves total number of particles (the $L_{1}$ norm).
Proof. Taking $\unicode[STIX]{x1D713}=1$ in the discrete weak form of the gyrokinetic equation, equation (3.2), and summing over all cells, we have
where the surface terms cancel exactly at cell interfaces because the integrands (both the phase-space characteristics and the numerical fluxes) are continuous across the interfaces. ◻
Proposition 2. The discrete system conserves a discrete total energy, $W_{h}=W_{H\,h}-W_{E\,h}+W_{B\,h}$, where
and
Proof. The proof follows from Proposition 3.2 in Hakim et al. (Reference Hakim, Hammett, Shi and Mandell2019). We start by calculating
The first term can be calculated by taking $\unicode[STIX]{x1D713}=H_{h}$ in (3.2) and summing over cells and species, since $\unicode[STIX]{x1D713}\in {\mathcal{V}}_{h}^{p}$ and $H_{h}\in \overline{{\mathcal{V}}}_{h}^{p}\subset {\mathcal{V}}_{h}^{p}$:
Here, we see why we must require $H_{h}$ to be continuous; we want the surface terms to vanish, which means the integrands must be continuous across cell interfaces so that the contributions from either side of the interface cancel exactly when we sum over cells. The numerical flux $\widehat{{\mathcal{J}}f_{h}}$ is by definition continuous across the interface, and we have already noted above that the phase-space characteristics $\dot{\boldsymbol{R}}_{h}$ and $\dot{v}_{\Vert h}^{H}-(q/m)\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ are also continuous across cell interfaces. This leaves the Hamiltonian, which we require to be continuous so that the surface terms do indeed vanish. Further, the first volume term vanishes exactly because $\dot{\boldsymbol{R}}_{h}\boldsymbol{\cdot }\unicode[STIX]{x1D735}H_{h}+\dot{v}_{\Vert h}^{H}\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }=\{H_{h},H_{h}\}=0$ by definition of the Poisson bracket. This leaves
where, here, we see why we have defined $J_{\Vert h}$ using the derivative of $H_{h}$ instead of $v_{\Vert }$, as noted after equation (3.11). We now have the desired result for this term. For the second term in (3.20), we have
Thus we have
which is consistent with equation (2.24).
Next, we calculate
where we have used in (3.5) to make the second equality, noting that the surface term vanishes upon summing over cells because is continuous in the perpendicular directions. Here, we see why we modified the right-hand side of (3.5) with ${\mathcal{P}}_{z}^{\ast }$, so that the resulting term in (
3.25) matches the one in (3.23).
Finally, we calculate
where we have used $\unicode[STIX]{x1D711}^{(j)}=(1/\unicode[STIX]{x1D707}_{0})\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ in (3.10) to make the second equality, again noting that the surface term vanishes upon summing over cells because is continuous in the perpendicular directions.
We now have conservation of discrete total energy
We note that this proof did not rely on the particular choice of numerical flux function. ◻
Proposition 3. The discrete system exactly conserves the $L_{2}$ norm of the distribution function when using a central flux, while the distribution function $L_{2}$ norm monotonically decays when using an upwind flux.
Proof. The proof is given as Proposition 3.3 in Hakim et al. (Reference Hakim, Hammett, Shi and Mandell2019).◻
Proposition 4. If the discrete distribution function $f_{h}$ remains positive definite, then the discrete scheme grows the discrete entropy monotonically,
Proof. The proof is given as Proposition 3.4 in Hakim et al. (Reference Hakim, Hammett, Shi and Mandell2019).◻
4 Time-discretization scheme
So far we have considered only the discretization of the phase space for the system, and we have considered the conservation properties of the scheme in the continuous-time limit. Indeed, in the discrete-time system the conservation properties are no longer exact due to truncation error in the non-reversible time-stepping methods that we consider. However, the errors will be independent of the phase-space discretization, and errors can be reduced by taking a smaller time step or by using a high-order time-stepping scheme to improve convergence. Following the approach of the Runge–Kutta discontinuous Galerkin method (Cockburn & Shu Reference Cockburn and Shu1998, Reference Cockburn and Shu2001; Shu Reference Shu, Russo, Shu, Bertoluzza and Falletta2009), we have implemented several explicit multi-stage strong stability-preserving Runge–Kutta high-order schemes (Gottlieb, Shu & Tadmor Reference Gottlieb, Shu and Tadmor2001; Shu Reference Shu2002); the results in this paper use a three-stage, third-order scheme (SSP-RK3). These schemes have the property that a high-order scheme can be composed of several forward-Euler stages. Thus we will detail our time-stepping scheme for a single forward-Euler stage, which can then be combined into a multi-stage high-order scheme. Note that, although we present the time-discretization scheme in this section in terms of our DG phase-space discretization, the scheme could be generalized to any spatial discretization.
Given $f_{h}^{n}=f_{h}(t=t_{n})$ and $A_{\Vert h}^{n}=A_{\Vert h}(t=t_{n})$ at time $t_{n}$, the steps of the forward-Euler scheme to advance to time $t_{n+1}=t_{n}+\unicode[STIX]{x0394}t$ are as follows:
(i) Calculate using equation (3.5), and then using equation (3.8).
(4.1)(4.2)(ii) Calculate the partial EMGK update $(\unicode[STIX]{x2202}({\mathcal{J}}f_{h})^{\star }/\unicode[STIX]{x2202}t)^{n}$ using equation (3.14).
(4.3)$$\begin{eqnarray}\displaystyle \int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}\unicode[STIX]{x1D713}\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{h})}{\unicode[STIX]{x2202}t}^{\star }\right)^{n} & = & \displaystyle -\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{j}}\text{d}\boldsymbol{w}\,\text{d}\boldsymbol{s}_{R}\boldsymbol{\cdot }\dot{\boldsymbol{R}}_{h}^{n}\unicode[STIX]{x1D713}^{-}\widehat{{\mathcal{J}}f_{h}}^{n}+\int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f_{h}^{n}\dot{\boldsymbol{R}}_{h}^{n}\boldsymbol{\cdot }\unicode[STIX]{x1D735}\unicode[STIX]{x1D713}\nonumber\\ \displaystyle & & \displaystyle +\,\int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f_{h}^{n}\dot{v}_{\Vert h}^{H\,n}\frac{\unicode[STIX]{x2202}\unicode[STIX]{x1D713}}{\unicode[STIX]{x2202}v_{\Vert }}\nonumber\\ \displaystyle & & \displaystyle +\,\int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}\unicode[STIX]{x1D713}({\mathcal{J}}C[f_{h}^{n}]+{\mathcal{J}}S^{n}).\end{eqnarray}$$(iii) Calculate $(\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t)^{n}$ from (3.13) [for $p_{v}=1$, this is only a provisional value, which we will denote as $(\widetilde{\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t})^{n}$].
(4.4)$$\begin{eqnarray}\displaystyle & & \displaystyle \int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\unicode[STIX]{x1D735}_{\bot }\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\boldsymbol{\cdot }\unicode[STIX]{x1D735}_{\bot }\unicode[STIX]{x1D711}^{(j)}-\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{s}_{R}\boldsymbol{\cdot }\unicode[STIX]{x1D735}_{\bot }\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\unicode[STIX]{x1D711}^{(j)}\nonumber\\ \displaystyle & & \displaystyle \qquad +\,\int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\,\unicode[STIX]{x1D711}^{(j)}\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\mathop{\sum }_{s}\frac{\unicode[STIX]{x1D707}_{0}q_{s}^{2}}{m_{s}}\int _{{\mathcal{T}}^{v}}\text{d}\boldsymbol{w}{\mathcal{J}}f_{s\,h}^{n}\nonumber\\ \displaystyle & & \displaystyle \quad =\unicode[STIX]{x1D707}_{0}\mathop{\sum }_{s}q_{s}\int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\,\unicode[STIX]{x1D711}^{(j)}\int _{{\mathcal{T}}^{v}}\text{d}\boldsymbol{w}v_{\Vert }\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{s\,h})}{\unicode[STIX]{x2202}t}^{\star }\right)^{n}.\end{eqnarray}$$(iv) ($p_{v}=1$ only) Use the provisional $(\widetilde{\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t})^{n}$ from step 3 to calculate the upwinding direction in the surface terms in (3.12), and then calculate $(\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t)^{n}$.
(4.5)$$\begin{eqnarray}\displaystyle & & \displaystyle \int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\unicode[STIX]{x1D735}_{\bot }\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\boldsymbol{\cdot }\unicode[STIX]{x1D735}_{\bot }\unicode[STIX]{x1D711}^{(j)}-\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{s}_{R}\boldsymbol{\cdot }\unicode[STIX]{x1D735}_{\bot }\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\unicode[STIX]{x1D711}^{(j)}\nonumber\\ \displaystyle & & \displaystyle \qquad -\,\int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\,\unicode[STIX]{x1D711}^{(j)}\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\mathop{\sum }_{s}\frac{\unicode[STIX]{x1D707}_{0}q_{s}^{2}}{m_{s}}\mathop{\sum }_{i}\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{i}^{v}}\text{d}s_{w}\bar{v}_{\Vert }^{-}\widehat{{\mathcal{J}}f_{s\,h}}^{n}\nonumber\\ \displaystyle & & \displaystyle \quad =\unicode[STIX]{x1D707}_{0}\mathop{\sum }_{s}q_{s}\int _{{\mathcal{K}}_{j}^{R}}\text{d}\boldsymbol{R}\,\unicode[STIX]{x1D711}^{(j)}\left[\int _{{\mathcal{T}}^{v}}\text{d}\boldsymbol{w}\bar{v}_{\Vert }\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{s\,h})}{\unicode[STIX]{x2202}t}^{\star }\right)^{n}-\mathop{\sum }_{i}\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{i}^{v}}\text{d}s_{w}\bar{v}_{\Vert }^{-}\dot{v}_{\Vert h}^{H\,n}\widehat{{\mathcal{J}}f_{s\,h}}^{n}\right].\nonumber\\ \displaystyle & & \displaystyle\end{eqnarray}$$(v) Calculate the full GK update, $((\unicode[STIX]{x2202}({\mathcal{J}}f_{h}))/\unicode[STIX]{x2202}t)^{n}$, using equation (3.15). For $p_{v}=1$, the provisional $(\widetilde{(\unicode[STIX]{x2202}A_{\Vert h})/\unicode[STIX]{x2202}t})^{n}$ from step 3 should again be used to calculate the upwinding direction in the surface terms for consistency.
(4.6)$$\begin{eqnarray}\displaystyle & & \displaystyle \int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}\unicode[STIX]{x1D713}\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{h})}{\unicode[STIX]{x2202}t}\right)^{n}=\int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}\unicode[STIX]{x1D713}\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{h})}{\unicode[STIX]{x2202}t}^{\star }\right)^{n}\nonumber\\ \displaystyle & & \displaystyle \quad -\,\oint _{\unicode[STIX]{x2202}{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}s_{w}\left[\dot{v}_{\Vert h}^{H\,n}-\frac{q}{m}\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\right]\unicode[STIX]{x1D713}^{-}\widehat{{\mathcal{J}}f_{h}}^{n}\nonumber\\ \displaystyle & & \displaystyle \quad -\,\int _{{\mathcal{K}}_{j}}\text{d}\boldsymbol{R}\,\text{d}\boldsymbol{w}{\mathcal{J}}f_{h}^{n}\frac{q}{m}\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}\frac{\unicode[STIX]{x2202}\unicode[STIX]{x1D713}}{\unicode[STIX]{x2202}v_{\Vert }}.\end{eqnarray}$$(vi) Advance $f_{h}$ and $A_{\Vert h}$ to time $t_{n+1}$.
(4.7)$$\begin{eqnarray}\displaystyle & \displaystyle {\mathcal{J}}f_{h}^{n+1}={\mathcal{J}}f_{h}^{n}+\unicode[STIX]{x0394}t\left(\frac{\unicode[STIX]{x2202}({\mathcal{J}}f_{h})}{\unicode[STIX]{x2202}t}\right)^{n}, & \displaystyle\end{eqnarray}$$(4.8)$$\begin{eqnarray}\displaystyle & \displaystyle A_{\Vert h}^{n+1}=A_{\Vert h}^{n}+\unicode[STIX]{x0394}t\left(\frac{\unicode[STIX]{x2202}A_{\Vert h}}{\unicode[STIX]{x2202}t}\right)^{n}. & \displaystyle\end{eqnarray}$$
Note that the parallel Ampère equation, equation (3.10), is only used to solve for the initial condition of $A_{\Vert h}(t=0)$. For all other times, equation (4.8) is used to advance $A_{\Vert h}$. This prevents the system from being over-determined and ensures consistency between $A_{\Vert h}$ and $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$.
5 Linear benchmarks
5.1 Kinetic Alfvén wave
As a first benchmark of our electromagnetic scheme, we consider the kinetic Alfvén wave. In a slab (straight background magnetic field) geometry, with stationary ions (assuming $\unicode[STIX]{x1D714}\gg k_{\Vert }v_{ti}$), the gyrokinetic equation for electrons reduces to
Taking a single Fourier mode with perpendicular wavenumber $k_{\bot }$ and parallel wavenumber $k_{\Vert }$, the field equations become
After linearizing the gyrokinetic equation by assuming a uniform Maxwellian background with density $n_{0}$ and temperature $m_{e}v_{te}^{2}$, so that $f_{e}=F_{Me}+\unicode[STIX]{x1D6FF}f_{e}$, the dispersion relation becomes
where $\hat{\unicode[STIX]{x1D6FD}}=(\unicode[STIX]{x1D6FD}_{e}/2)m_{i}/m_{e}$, with $\unicode[STIX]{x1D6FD}_{e}=2\unicode[STIX]{x1D707}_{0}n_{0}T_{e}/B^{2}$, $v_{te}=\sqrt{T_{e}/m_{e}}$ is the electron thermal speed, $\unicode[STIX]{x1D70C}_{s}$ is the ion sound gyroradius and $Z(x)$ is the plasma dispersion function (Fried & Conte Reference Fried and Conte1961). In the limit $k_{\bot }\unicode[STIX]{x1D70C}_{s}\ll 1$ the wave becomes the standard shear Alfvén wave from magnetohydrodyamics (MHD), which is an undamped wave with frequency $\unicode[STIX]{x1D714}=k_{\Vert }v_{A}$, where $v_{A}=v_{te}/\hat{\unicode[STIX]{x1D6FD}}^{1/2}$ is the Alfvén velocity. For larger values of $k_{\bot }\unicode[STIX]{x1D70C}_{s}$, the mode is damped by kinetic effects.
In figure 1, we show the real frequencies (a) and damping rates (b) obtained by solving equation (5.5) for a few values of $\hat{\unicode[STIX]{x1D6FD}}$. We also show numerical results from Gkeyll, which match the analytic results very well. These results are a good indication that our scheme avoids the Ampère cancellation problem, which can cause large errors for modes with $\hat{\unicode[STIX]{x1D6FD}}/k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2}\gg 1$ (see appendix A); we see no such errors, even for the case with $\hat{\unicode[STIX]{x1D6FD}}/k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2}=10^{5}$. Each Gkeyll simulation was run using piecewise-linear basis functions ($p=1$) in a reduced dimensionality mode with one configuration-space dimension and one velocity-space dimension, with $(N_{z},N_{v_{\Vert }})=(32,64)$ the number of cells in each dimension. The perpendicular dimensions ($x$ and $y$), which appear only in the field equations in this simple system, were handled by replacing $\unicode[STIX]{x1D735}_{\bot }$ by $k_{\bot }$, as in (5.2) and (5.3). We use periodic boundary conditions in $z$ and zero-flux boundary conditions in $v_{\Vert }$.
We also show in figure 2 the fields $\unicode[STIX]{x1D719}_{h}$ and $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ for the case with $\hat{\unicode[STIX]{x1D6FD}}=10$ and $k_{\bot }\unicode[STIX]{x1D70C}_{s}=0.01$, which gives $\hat{\unicode[STIX]{x1D6FD}}/k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2}=10^{5}$. For these parameters the system is near the MHD limit, which means we should expect $E_{\Vert }=-\unicode[STIX]{x2202}\unicode[STIX]{x1D719}/\unicode[STIX]{x2202}z-\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t\approx 0$. While this condition is never enforced, getting the physics correct requires the scheme to allow $\unicode[STIX]{x2202}\unicode[STIX]{x1D719}_{h}/\unicode[STIX]{x2202}z\approx -\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$. The fact that our scheme allows discontinuities in $A_{\Vert }$ in the parallel direction is an advantage in this case. Because $\unicode[STIX]{x1D719}_{h}$ is piecewise linear here, $\unicode[STIX]{x2202}\unicode[STIX]{x1D719}_{h}/\unicode[STIX]{x2202}z$ is piecewise constant; this is necessarily discontinuous for non-trivial solutions. Thus the scheme produces a piecewise constant $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ in this MHD-limit case, as shown in figure 2, resulting in $E_{\Vert h}\approx 0$. If our scheme did not allow discontinuities in $A_{\Vert h}$, a continuous $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$ would never be able to exactly cancel a discontinuous $\unicode[STIX]{x2202}\unicode[STIX]{x1D719}_{h}/\unicode[STIX]{x2202}z$, and the resulting $E_{\Vert h}\neq 0$ would make the solution inaccurate. Notably, this would be the case had we chosen the Hamiltonian ($p_{\Vert }$) formulation of the gyrokinetic system, which uses $p_{\Vert }=mv_{\Vert }+qA_{\Vert }$ as the parallel velocity coordinate. This is because $A_{\Vert }$ is included in the Hamiltonian in the $p_{\Vert }$ formulation, which would require continuity of $A_{\Vert h}$ (and thereby $\unicode[STIX]{x2202}A_{\Vert h}/\unicode[STIX]{x2202}t$) to conserve energy in our discretization scheme.
5.2 Kinetic ballooning mode
We use the kinetic ballooning mode (KBM) instability in the local limit as a second linear benchmark of our electromagnetic scheme. The dispersion relation is given by solving (Kim, Horton & Dong Reference Kim, Horton and Dong1993)
where
with $\unicode[STIX]{x1D70F}=T_{i}/T_{e}$, $\unicode[STIX]{x1D714}_{\ast e}=k_{y}$, $\unicode[STIX]{x1D714}_{\ast i}=-k_{y}$, $\unicode[STIX]{x1D702}_{s}=L_{n}/L_{Ts}$ and $\unicode[STIX]{x1D6E4}_{0}(b)=I_{0}(b)e^{-b}$ with $I_{0}(b)=J_{0}(ib)$ the modified Bessel function. Here, the wavenumbers $k_{y}$ and $k_{\Vert }$ are normalized to $\unicode[STIX]{x1D70C}_{i}$ and $L_{n}$, respectively, and the frequencies $\unicode[STIX]{x1D714}$ and $\unicode[STIX]{x1D714}_{\ast }$ are normalized to $v_{ti}/L_{n}$. In the local limit, $\unicode[STIX]{x1D714}_{ds}=\unicode[STIX]{x1D714}_{\ast s}L_{n}/R$ and $k_{\bot }=k_{y}$ do not vary along the field line. Note that in (5.6) we have modified the FLR terms from (Kim et al. Reference Kim, Horton and Dong1993) so that we can take $b=k_{\bot }^{2}\rightarrow 0$ while keeping $k_{\bot }\neq 0$ to neglect all FLR effects except for the first-order polarization term, which is consistent with our long-wavelength Poisson equation.
The local limit can be achieved by simulating a helical flux tube with no magnetic shear, which gives a system with constant magnetic curvature that corresponds to $\unicode[STIX]{x1D714}_{d}=\text{const}$. This geometry has been previously used for SOL turbulence studies with Gkeyll (Bernard et al. Reference Bernard, Shi, Gentle, Hakim, Hammett, Stoltzfus-Dueck and Taylor2019; Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019), except in this section we take the boundary condition along the field lines to be periodic. We will provide further details about the helical geometry and the coordinates in the next section.
We show the results of Gkeyll simulations of the KBM instability in the local-limit helical geometry for several values of $\unicode[STIX]{x1D6FD}_{i}$ in figure 3. The results agree well with the analytic result obtained by numerically solving equations (5.6)–(5.7). The parameters $k_{\bot }\unicode[STIX]{x1D70C}_{i}=0.5,k_{\Vert }L_{n}=0.1,R/L_{n}=5,R/L_{Ti}=12.5,R/L_{Te}=10,\unicode[STIX]{x1D70F}=1$ are chosen to match those used in figure 1 of Kim et al. (Reference Kim, Horton and Dong1993), although the differences in FLR terms ($b=0$) cause our growth rates to be larger than those in Kim et al. (Reference Kim, Horton and Dong1993). These are fully five-dimensional simulations with the real deuterium–electron mass ratio using piecewise-linear ($p=1$) basis functions, with $(N_{x},N_{y},N_{z},N_{v_{\Vert }},N_{\unicode[STIX]{x1D707}})=(1,16,16,32,16)$. The boundary conditions are periodic in the three configuration-space dimensions and zero flux in the velocity dimensions. The initial distribution function of each species is composed of a background Maxwellian with gradients in the density and temperature corresponding to the desired $L_{n}$ and $L_{Ts}$, plus a perturbed Maxwellian (for the electrons only) with small sinusoidal variations in the density corresponding to the desired $k_{y}$ and $k_{\Vert }$. Note that, since we are using a full-$f$ representation, the presence of a background gradient in the distribution function means that we must apply the periodic boundary conditions by first subtracting off the initial background distribution function, then applying periodicity to the perturbations only and then adding back the background distribution. Finally, we note that since Gkeyll is designed primarily for nonlinear calculations, the fact that Fourier modes are not eigenfunctions of the DG discretization of the system makes these linear tests somewhat difficult for Gkeyll. This may play a role in the small deviation of the results from the analytical theory. Because of this, Fourier modes other than the one initialized can grow and pollute the results. In particular, we have not included results from the ion temperature gradient (ITG) branch because we find that a mode with $k_{\Vert }=0$ grows and overcomes the initialized finite $k_{\Vert }$ mode before its growth rate has converged.
6 Nonlinear results
We now present preliminary nonlinear electromagnetic results from Gkeyll. We simulate turbulence on helical, open field lines as a rough model of the tokamak scrape-off layer. These simulations are a direct extension of the work of Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019) to include electromagnetic fluctuations. As such, we use the same simulation geometry and similar NSTX-like parameters. In the non-orthogonal field-aligned geometry, $x$ is the radial coordinate, $z$ is the coordinate along the field lines and $y$ is the binormal coordinate which labels field lines at constant $x$ and $z$. These coordinates map to physical cylindrical coordinates $(R,\unicode[STIX]{x1D711},Z)$ via $R=x$, $\unicode[STIX]{x1D711}=(y/\sin \unicode[STIX]{x1D703}+z\cos \unicode[STIX]{x1D703})/R_{c}$, $Z=z\sin \unicode[STIX]{x1D703}$. (Note that this fixes an error in the $\unicode[STIX]{x1D711}(y,z)$ mapping in (Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019).) The field-line pitch $\sin \unicode[STIX]{x1D703}=B_{v}/B$ is taken to be constant, with $B_{v}$ the vertical component of the magnetic field (analogous to the poloidal field in typical tokamak geometry), and $B$ the total magnitude of the background magnetic field. Further, $R_{c}=R_{0}+a$ is the radius of curvature at the centre of the simulation domain, with $R_{0}$ the device major radius and $a$ the minor radius. As in Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019), we neglect all geometrical factors arising from the non-orthogonal coordinate system, except for the assumption that perpendicular gradients are much stronger than parallel gradients so that we can approximate
where we have used $\boldsymbol{B}=B_{axis}(R_{0}/R)\hat{\boldsymbol{e}}_{z}$ in the last step, with $B_{axis}$ the magnetic field strength at the magnetic axis.
We use this geometry to simulate a flux-tube-like domain on the outboard side that wraps helically around the torus and terminates on conducting plates at each end in $z$. The simulation box is centred at $(x,y,z)=(R_{c},0,0)$ with dimensions $L_{x}=50\unicode[STIX]{x1D70C}_{s0}\approx 14.6~\text{cm}$, $L_{y}=100\unicode[STIX]{x1D70C}_{s0}\approx 29.1~\text{cm}$ and $L_{z}=L_{p}/\sin \unicode[STIX]{x1D703}=8~\text{m}$, where $L_{p}=2.4~\text{m}$ and $\unicode[STIX]{x1D70C}_{s0}=c_{s0}/\unicode[STIX]{x1D6FA}_{i}$. Periodic boundary conditions are used in the $y$ direction, and a Dirichlet boundary condition $\unicode[STIX]{x1D719}=0$ is applied in $x$, which effectively prevents flows into the boundaries in $x$. Conducting-sheath boundary conditions are applied in the $z$ direction (Shi et al. Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2017, Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019), which partially reflect one species (typically electrons) and fully absorbs the other species depending on the sign of the sheath potential. This involves solving the gyrokinetic Poisson equation to evaluate the potential at the $z$ boundary, corresponding to the sheath entrance, and using the resulting sheath potential to determine a cutoff velocity below which particles are reflected by the sheath. Notably, our sheath boundary condition allows current fluctuations in and out of the sheath, which we will find to important later in this section. This is different from the standard logical sheath boundary condition (Parker et al. Reference Parker, Procassini, Birdsall and Cohen1993b) that imposes that there is no net current to the sheath by assuming that the ion and electron currents at the sheath entrance are equal at all times. The velocity-space grid has extents $4v_{ts}\leqslant v_{\Vert }\leqslant 4v_{ts}$ and $0\leqslant \unicode[STIX]{x1D707}\leqslant 6T_{s0}/B_{0}$, where $v_{ts}=\sqrt{T_{s0}/m_{s}}$ and $B_{0}=B_{axis}R_{0}/R_{c}$. We use piecewise-linear ($p=1$) basis functions, with $(N_{x},N_{y},N_{z},N_{v_{\Vert }},N_{\unicode[STIX]{x1D707}})=(16,32,10,10,5)$. Note that, although the domain that we simulate is a flux tube, the simulations are not performed in the local limit; the simulations include radial variation of the magnetic field and the profiles, and are thus effectively global.
The simulation parameters are similar to those used in Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019), roughly approximating an H-mode deuterium plasma in the NSTX SOL: $B_{axis}=0.5~\text{T}$, $R_{0}=0.85~\text{m}$, $a=0.5~\text{m}$, $T_{e0}=T_{i0}=40~\text{eV}$. For the particle source, we use the same form as in Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019) but we increase the source particle rate by a factor of 10 to access a higher $\unicode[STIX]{x1D6FD}$ regime where electromagnetic effects will be more important. The source is localized in the region $x<x_{S}+3\unicode[STIX]{x1D706}_{S}$, with $x_{S}=R_{c}-0.05~\text{m}$ and $\unicode[STIX]{x1D706}_{S}=5\times 10^{-3}~\text{m}$. The location $x=x_{S}+3\unicode[STIX]{x1D706}_{S}$, which separates the source region from the SOL region, can be thought of as the separatrix. A floor of one tenth the peak particle source rate is used near the midplane to prevent regions of $n\ll n_{0}$ from developing at large $x$. Unlike in Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019) we do not use numerical heating to keep $f>0$ despite the fact that our DG algorithm does not guarantee positivity. While the simulations appear to be robust to negative $f$ in some isolated regions, lowering the source floor in the SOL region leads to simulation failures due to positivity issues at large $x$. A more sophisticated algorithm for ensuring positivity is left to future work. We also artificially lower the collision frequency to one tenth the physical value to offset the increased particle source rate so that the time-step limit from collisions does not become too restrictive. Further, we model only ion–ion and electron–electron collisions, leaving cross-species collisions to future work.
Using the novel electromagnetic scheme described in this paper, we ran a simulation in this configuration to $t=1~\text{ms}$, with a quasi-steady state being reached around $t=600~\unicode[STIX]{x03BC}\text{s}$ when the sources balance losses to the end plates. For reference, the ion transit time is $\unicode[STIX]{x1D70F}_{i}=(L_{z}/2)/v_{ti}\approx 50~\unicode[STIX]{x03BC}\text{s}$. In figure 4 we show snapshots of the density, temperature and $\unicode[STIX]{x1D6FD}$ of electrons (a–c) and ions (d–f). The snapshots are taken at the midplane ($z=0$) at $t=620~\unicode[STIX]{x03BC}\text{s}$. We can see a blob with a mushroom structure being ejected from the source region. We also show in figure 5 snapshots of the electromagnetic fields taken at the same time and location. We show the electrostatic potential $\unicode[STIX]{x1D719}$, the parallel magnetic vector potential $A_{\Vert }$ and the normalized magnetic fluctuation amplitude $|\unicode[STIX]{x1D6FF}B_{\bot }|/B_{0}=|\unicode[STIX]{x1D735}_{\bot }A_{\Vert }|/B_{0}$ (a–c), along with the components of the parallel electric field $E_{\Vert }=-\unicode[STIX]{x1D735}_{\Vert }\unicode[STIX]{x1D719}-\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ (d–f). Note that only $\unicode[STIX]{x1D719}$, $A_{\Vert }$ and $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ are evolved quantities in the simulation, with the other quantities derived. We see that $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ is of comparable magnitude to $\unicode[STIX]{x1D735}_{\Vert }\unicode[STIX]{x1D719}$, indicating that the dynamics is in the electromagnetic regime. Significant magnetic fluctuations of over $2.5\,\%$ can be seen in $|\unicode[STIX]{x1D6FF}B_{\bot }|/B_{0}$ in this snapshot. We also show in figure 6 the time and spatially averaged profile of magnetic fluctuations vs $x$, which shows that, on average, we observe magnetic fluctuations of the order of $0.5\,\%{-}1\,\%$. This radial profile, and similar ones that will follow, is computed by averaging in $y$ and $z$ using data near the midplane $(|z|<0.4~\text{m})$ over the period of $600~\unicode[STIX]{x03BC}\text{s}{-}1~\text{ms}$.
In figures 7 and 8 we show projections of the three-dimensional magnetic field-line trajectories. These plots are created by integrating the field-line equations for the total (background plus fluctuation) magnetic field. In figure 7, each field line starts at $z=-4~\text{m}$ and either $x=1.33~\text{m}$ or $x=1.38~\text{m}$ for a range of $y$ values and is traced to $z=4~\text{m}$. The starting points (at $z=-4~\text{m}$) are marked with circles, while the ending points (at $z=4~\text{m}$) are marked with crosses. The trajectories have been projected onto the $x-y$ plane, and we have also plotted the ion density at $z=0~\text{m}$ in the background. From left to right, we show a short time series of snapshots, with $t=230$, 240 and $250~\unicode[STIX]{x03BC}\text{s}$. At $t=230~\unicode[STIX]{x03BC}\text{s}$, a blob is starting to emerge from the source region at $y\approx 0.04~\text{m}$. The field lines that start at $x=1.33~\text{m}$ are beginning to be stretched radially outward as the blob emerges. In the $t=240~\unicode[STIX]{x03BC}\text{s}$ snapshot, we see that the blob is now propagating radially outward into the SOL region and the $x=1.33~\text{m}$ field lines have been stretched further. The field lines that start at $x=1.38~\text{m}$ are now also starting to be stretched near $y\approx 0.2~\text{m}$, and they are stretched even more in the $t=250~\unicode[STIX]{x03BC}\text{s}$ snapshot as the blob continues to propagate. We can also see the remnants of another blob that was ejected near $y=-0.1~\text{m}$ in previous frames. In the $t=230~\unicode[STIX]{x03BC}\text{s}$ snapshot, the field lines have been stretched by this blob, but by $t=250~\unicode[STIX]{x03BC}\text{s}$ the field lines in this region have returned closer to their equilibrium position. This behaviour of blobs bending and stretching the field lines is an inherently full-$f$ phenomenon. The blobs have a higher density and temperature than the background, so they raise the local plasma $\unicode[STIX]{x1D6FD}$ as they propagate. This causes the field lines to move with the plasma, allowing the fields lines to be deformed and stretched by the radially propagating blobs and ultimately leading to larger magnetic fluctuations.
In figure 8 we show a slightly different view of the field-line trajectories at $t=240~\unicode[STIX]{x03BC}\text{s}$. Field lines are still traced from the bottom ($z=-4~\text{m}$) to the top ($z=4~\text{m}$), but now each field line starts at $y=0~\text{m}$ for a range of $x$. The starting points are again marked with circles and the ending points are marked with crosses. We have projected the three-dimensional trajectories onto the $x-y$ plane in figure 8(a), and onto the $x-z$ plane in figure 8(b). In (a) we again plot the ion density at $z=0~\text{m}$ in the background; in (b) the ion density has been averaged over $|y|<0.02~\text{m}$. As can be seen in figure 8(b), the blob propagating near $y\approx 0~\text{m}$ has stretched several field lines radially outward near the midplane. These bowed-out field lines originate from a range of $x$ values, $1.3~\text{m}\lesssim x\lesssim 1.35~\text{m}$, and have all been dragged along with the blob as it was ejected from the source region and propagated radially outward. We also see some degree of line tying in these plots, with many of the field lines ending at a similar point in $x-y$ space to where they began, despite being stretched near the midplane. The field lines are not perfectly line tied, however; if they were, the crosses would perfectly align with their corresponding circles in the $x-y$ projections. Because our sheath boundary condition allows current fluctuations at the sheath interface, we can model the finite resistance of the sheath, which makes line tying only partial (Kunkel & Guillory Reference Kunkel and Guillory1966). This allows the footpoints of the field lines to slip at the sheath interface (Ryutov Reference Ryutov2006). Examining figures 7 and 8, we see evidence of this in the simulation, with most of the end points moving slowly and smoothly in the vicinity of their origin, especially at larger $x$. In the source region, however, there are other field lines whose end points suddenly jump further away from their origin. This suggests that we are seeing line breaking (reconnection) due to electron inertia effects and numerical diffusion, as field lines are pushed close together by large perturbations in the source region.
We have also run a corresponding electrostatic simulation in this configuration for direct comparison. This simulation is identical in configuration to the $L_{z}=8~\text{m}$ case from Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019) except for the increased particle source rate and lack of cross-species collisions. In figure 9 we show a comparison of radial profiles of density, temperature and $\unicode[STIX]{x1D6FD}$ for the electromagnetic and electrostatic cases. The profiles for the electromagnetic case are shallower in the SOL region and steeper in the source region. This suggests that there is less radial particle and heat transport into the SOL region in the electromagnetic case. This is in part confirmed by the profile of the radial particle flux in figure 10, showing approximately 40 % less particle transport in the electromagnetic case. The total particle flux $\unicode[STIX]{x1D6E4}_{n,r}$ includes the $E\times B$ particle flux, $\unicode[STIX]{x1D6E4}_{n,r,E\times B}=\langle {\tilde{n}}_{e}\tilde{v}_{r}\rangle$, with $v_{r}=E_{r}/B=-(1/B)\unicode[STIX]{x2202}\unicode[STIX]{x1D719}/\unicode[STIX]{x2202}y$. In the electromagnetic case, $\unicode[STIX]{x1D6E4}_{n,r}$ also includes the particle flux due to magnetic flutter, $\unicode[STIX]{x1D6E4}_{n,r,\text{flutter}}=\langle \widetilde{n_{e}u_{\Vert e}}b_{r}\rangle$, with $b_{r}=(1/B)\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}y$. The tilde indicates the fluctuation of a time-varying quantity, defined as $\tilde{A}=A-\bar{A}$ with $\bar{A}$ the time average of $A$. The brackets $\langle A\rangle$ denote an average in $y$, $z$ (near the midplane) and time. We also note that the electromagnetic profiles might be even shallower in the SOL region if not for the floor on the source used to prevent positivity issues in the distribution function at large $x$.
We also compare fluctuation statistics between the electromagnetic and electrostatic cases in figure 11. Statistics of the electron density are shown on the top row, the middle row shows statistics of electrostatic potential fluctuations and the bottom row shows statistics of the radial electron particle flux. Despite the fact that the electromagnetic case shows less particle transport, the root-mean-square relative density fluctuations are larger in the electromagnetic case by up to a factor of two. The electromagnetic case also has higher skewness and excess kurtosis, indicating that the density fluctuations in the electromagnetic case are more intermittent. The skewness and kurtosis of the particle flux also indicate more intermittency in the electromagnetic case. This contributes to the reduced transport shown in the electromagnetic case, since the transport events are rarer even if the fluctuation levels are larger. Meanwhile, the fluctuation statistics for the potential are relatively similar between the electromagnetic and electrostatic cases. The statistics of the density and potential appear more coupled in the electrostatic case, consistent with the electrons behaving adiabatically when electromagnetic effects are neglected. In the electromagnetic case the density fluctuations are more intermittent and higher amplitude than the potential fluctuations.
Finally, we note that in terms of computational cost, the electromagnetic simulation is less than twice as expensive as the corresponding electrostatic simulation on a per-time-step basis. On 128 cores, the time per time step was 0.41 s/step for the electrostatic simulation and 0.68 s/step for the electromagnetic simulation. The increased cost is due to the additional field solves required for Ohm’s law, along with additional terms in the gyrokinetic equation. However, due to time-step restrictions on an electrostatic simulation due to the electrostatic shear Alfvén mode (also known as the $\unicode[STIX]{x1D714}_{H}$ mode) (Lee Reference Lee1987), the electromagnetic simulation makes up some of the additional cost by taking slightly larger time steps. The total wall-clock time (on 128 cores) for the electrostatic simulation was approximately 65 h, and the electromagnetic simulation took about 82 h. Altogether, the cost of these simulations is relatively modest, and the addition of electromagnetic effects only makes the simulations marginally (${\sim}25$ %) more expensive. We also note that the new version of Gkeyll, which uses a quadrature-free modal DG scheme, is approximately 10 times faster than the previous version of Gkeyll used in Shi et al. (Reference Shi, Hammett, Stoltzfus-Dueck and Hakim2019), which used nodal DG with Gaussian quadrature. More details about the improvements from the quadrature-free modal scheme will be reported elsewhere.
7 Summary and conclusion
In this paper we have presented an energy-conserving scheme for the full-$f$ electromagnetic gyrokinetic system. We choose the symplectic formulation of EMGK, which uses the parallel velocity as an independent variable. This leads to the time derivative of the parallel vector potential, $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$, appearing explicitly in the gyrokinetic equation. We handle this term directly by solving an Ohm’s law. We presented the conservation properties of the EMGK system.
We described the discontinuous Galerkin scheme used to discretize the EMGK system in phase space. We proved that the scheme preserves particle conservation, and that the scheme also preserves energy conservation provided that the discrete Hamiltonian is continuous. This is achieved by using the (continuous) finite-element method for the field solves. We also detailed a basic forward-Euler time-stepping scheme to be used in the stages of a multi-stage high-order SSP-RK scheme. The time-stepping scheme updates the gyrokinetic equation in two parts, with the result of the first part [denoted $\unicode[STIX]{x2202}({\mathcal{J}}f_{s})^{\star }/\unicode[STIX]{x2202}t$] being used in Ohm’s law to solve directly for $\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$ so that it can then be used in the second part of the gyrokinetic update.
We have implemented the scheme in the gyrokinetic solver of the Gkeyll computational plasma framework. We provided two linear benchmarks to validate the electromagnetic scheme: a kinetic Alfvén wave calculation and a local kinetic ballooning mode instability calculation. In both cases results from Gkeyll agree well with analytic results. The success of these calculations, especially in cases with $\hat{\unicode[STIX]{x1D6FD}}/k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2}\gg 1$, indicates that the scheme avoids the Ampère cancellation problem. Further, the discontinuous Galerkin nature of the scheme enables (but does not enforce) exact cancellation of the components of $E_{\Vert }$, allowing the system to capture the MHD limit with $E_{\Vert }=0$.
We presented a nonlinear electromagnetic full-$f$ gyrokinetic simulation of turbulence on helical, open field lines as a rough model of the tokamak scrape-off layer. This simulation is the first nonlinear electromagnetic gyrokinetic simulation on open field lines. We showed data illustrating the interplay between blobs propagating into the SOL and the resulting bending and stretching of magnetic field lines. We also made quantitative comparisons between the electromagnetic simulation and a corresponding electrostatic simulation. Notably, the electromagnetic simulation exhibits less transport and shallower density and temperature profiles in the SOL, as well as larger root-mean-square density fluctuations with more intermittency. Future work will examine the particle and energy balance in these nonlinear simulations to confirm the conservation properties proved in § 3.2 after accounting for sources and losses to the walls.
A number of extensions have been left to future work. The capability to simulate more realistic magnetic geometries using a non-orthogonal field-aligned coordinate system is currently in progress, so that effects of magnetic shear and non-constant curvature can be included. The inclusion of both open and closed-field-line regions, including the X-point in diverted geometries, is an additional complication that must be addressed. Gyroaveraging is another important effect that must be implemented to improve fidelity. Further, a robust solution to the issue of maintaining positivity of the distribution function has been implemented for Hamiltonian terms and is in progress for the collision operator. This could, for example, alleviate the need to use a source floor in the nonlinear simulations presented in § 6, which could further enhance the differences between the electromagnetic and electrostatic profiles.
The modest cost of the nonlinear full-$f$ gyrokinetic simulations that we have presented make the prospect of using Gkeyll for whole-device modelling a feasible goal. The inclusion of electromagnetic effects will be crucial to the fidelity of these efforts. Such a tool would be invaluable to future studies of turbulent transport in fusion devices, both from a theoretical perspective and also as a model for predicting and analysing the performance of current and future experiments.
Acknowledgements
We would like to thank T. Bernard, P. Cagas, J. Juno and other members of the Gkeyll team for helpful discussions and support, including the development of the postgkyl post-processing tool which facilitated the creation of many figures in this paper. Research support came from the U.S. Department of Energy: N.R.M. was supported by the DOE CSGF program, provided under grant DE-FG02-97ER25308; A.H. and G.W.H. were supported by the Partnership for Multiscale Gyrokinetic Turbulence (MGK) Project, part of the DOE Scientific Discovery Through Advanced Computing (SciDAC) program, via DOE contract DE-AC02-09CH11466 for the Princeton Plasma Physics Laboratory; M.F. was supported by DOE contract DE-FC02-08ER54966. Computations were performed on the Eddy cluster at the Princeton Plasma Physics Laboratory.
Supplementary material
Supplementary material is available at https://doi.org/10.1017/S0022377820000070.
Appendix A. Ampère cancellation problem
To understand the root of the Ampère cancellation problem, we examine the simple Alfvén wave case from § 5.1. Recall that in this simple case, the gyrokinetic system is given by
Note that now we have inserted two constants, $C_{N}$ and $C_{J}$, in the integrals in (A 3). We will use these constants to represent small errors that could arise in the numerical calculation of these integrals. As in § 5.1, we can calculate the dispersion relation for this system, but now we will take the limit $\unicode[STIX]{x1D714}\gg k_{\Vert }v_{te}$, so that the dispersion relation reduces to
where recall that $\hat{\unicode[STIX]{x1D6FD}}=(\unicode[STIX]{x1D6FD}_{e}/2)m_{i}/m_{e}$. This reduces to the correct result if $C_{N}=C_{J}=1$. However, if $C_{N}\neq C_{J}$, there will be large errors for modes with $\hat{\unicode[STIX]{x1D6FD}}/(k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2})\gg 1$. This means the two integrals in (A 3) must be calculated carefully and consistently so that any errors exactly cancel.
A.1 Hamiltonian ($p_{\Vert }$) formulation
We now briefly discuss the cancellation problem in the Hamiltonian ($p_{\Vert }$) formulation of gyrokinetics. In this case, the simple system above becomes
where we have again included constants $C_{N}$ and $C_{J}$ to represent numerical errors in the integrals. The resulting dispersion relation is identical to (A 4), so the two integrals must again be calculated carefully and consistently so that errors exactly cancel. This could be slightly more challenging than in the symplectic case. Suppose the $p_{\Vert }$ grid does not extend to infinity but has some finite limits which are expected to be large enough in practice. These limits are used when numerically computing the integrals. Since $p_{\Vert }$ depends on a time-dependent quantity in $A_{\Vert }$, it is possible that the $p_{\Vert }$ limits may need to be time dependent if $A_{\Vert }$ fluctuations are large in order to consistently compute the integrals.
Appendix B. The discrete weak form of Ohm’s law
To obtain the discrete weak form of Ohm’s law, we start by taking the time derivative of (3.10):
Now, note that, analogously to (2.15), we can write the discrete weak form of the gyrokinetic equation as
where
Substituting $\unicode[STIX]{x1D713}=\unicode[STIX]{x1D711}^{(j)}\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }$ in (B 2) and summing over velocity cells, we obtain
Note that, for $p_{v}>1$, the $v_{\Vert }$ surface term on the right-hand side vanishes because $\unicode[STIX]{x2202}H_{h}/\unicode[STIX]{x2202}v_{\Vert }$ is continuous across $v_{\Vert }$ cell interfaces when $v_{\Vert }^{2}$ is included in the basis, resulting in cancellations. However, for $p_{v}=1$ this term is not continuous, and we must keep this surface term; further, the last term on the right-hand side vanishes for $p_{v}=1$ since $\unicode[STIX]{x2202}^{2}H_{h}/\unicode[STIX]{x2202}v_{\Vert }^{2}=0$. We can now substitute this result into the right-hand side of (B 1), giving
In (B 5), $\bar{v}_{\Vert }$ is the piecewise-constant projection of $v_{\Vert }$.
Appendix C. Semi-discrete dispersion relation for Alfvén wave
In this appendix we derive a semi-discrete Alfvén wave dispersion relation using a piecewise-linear DG discretization for only the $v_{\Vert }$ coordinate. The main purpose of this appendix is to show how our discrete scheme avoids the Ampère cancellation problem. We will also show how the integrals in the DG weak form are computed analytically in our modal scheme.
The semi-discrete gyrokinetic weak form for this system is
We begin by mapping each cell ${\mathcal{K}}_{j}$ to $\unicode[STIX]{x1D709}\in [-1,1]$ via the transformation $\unicode[STIX]{x1D709}=2(v_{\Vert }-\bar{v}_{\Vert }^{\,j})/\unicode[STIX]{x0394}v_{\Vert }$, where $\bar{v}_{\Vert }^{\,j}$ is the cell centre of cell $j$
Taking an orthonormal piecewise-linear basis in $\unicode[STIX]{x1D709}$, $\unicode[STIX]{x1D713}=[\frac{1}{\sqrt{2}},\frac{\sqrt{3}}{\sqrt{2}}\unicode[STIX]{x1D709}]$, we expand $f_{h}$ on the basis in cell $j$ as
(Note that in the fully discretized case all coordinate dependence would be contained in multi-variate basis functions.) We can then analytically integrate the weak form for each $\unicode[STIX]{x1D713}_{\ell }$ to obtain the modal evolution equation for each DG ‘mode’ $f_{\ell }$
Finally, we will make the ansatz $f_{\ell }=F_{M\ell }+f_{\ell }\text{e}^{\text{i}k_{\Vert }z-\text{i}\unicode[STIX]{x1D714}t}$ and linearize
We now turn to the field equations. The Poisson equation is
Expanding $f_{h}$ and using the ansatz, this becomes
where we will define $F_{Mh}$ so that $\sum _{j}(\unicode[STIX]{x0394}v_{\Vert }/\sqrt{2})F_{M0}^{j}=n_{0}$ by definition. For Ohm’s law, we must use the $p_{v}=1$ form from (3.12), which gives
where
Again expanding and using the ansatz, Ohm’s law becomes
Analogously to appendix A, we can rewrite this equation as
where we have defined
Clearly, $C_{N}=C_{J}$, which allows us to move the $C_{N}$ term to the right-hand side, giving a term proportional to the total parallel electric field, $E_{\Vert }=-\text{i}k_{\Vert }\unicode[STIX]{x1D719}-\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t$
This is essential for avoiding the cancellation problem because if we instead had $C_{N}\neq C_{J}$, we would have had a leftover term proportional to $(C_{N}-C_{J})(\unicode[STIX]{x2202}A_{\Vert }/\unicode[STIX]{x2202}t)$ on the left-hand side. This leftover term would then lead to the spurious term proportional to $\hat{\unicode[STIX]{x1D6FD}}/(k_{\bot }^{2}\unicode[STIX]{x1D70C}_{s}^{2})$ in (A 4).
In order to compute the integral quantities in the field equations, we use (C 6) to compute
where we have expanded in the limit $\unicode[STIX]{x1D714}\gg k_{\Vert }v_{te}$. Now we can calculate
Substituting these integral quantities into the field equations, the Poisson equation becomes
and Ohm’s law becomes
where we have substituted the definition of $C_{N}$. We can now combine (C 20) and (C 21) by multiplying equation (C 20) by $\text{i}k_{\Vert }T_{e}/n_{0}$, multiplying equation (C 21) by $\unicode[STIX]{x1D70C}_{s}^{2}=m_{i}T_{e}/(e^{2}B^{2})$ and summing the two equations to get
with $\hat{\unicode[STIX]{x1D6FD}}=(\unicode[STIX]{x1D6FD}_{e}/2)m_{i}/m_{e}$. This then yields the dispersion relation
To evaluate $C_{N}$ and the other sum, we need to project the background onto the basis in each cell. Taking $F_{M}=n_{0h}(2\unicode[STIX]{x03C0}v_{t}^{2})^{-1/2}\exp (-v_{\Vert }^{2}/(2v_{t}^{2}))$, we project onto the basis in cell $j$ as
where we have taken the cell centre to be $\bar{v}_{\Vert }^{\,j}=j\unicode[STIX]{x0394}v_{\Vert }$. Now we can evaluate integrated quantities such as
where now note that we have finite limits on the sum to indicate finite extents of the $v_{\Vert }\in [-v_{max},v_{max}]$ grid. As we alluded to before, we will define $n_{0h}$ so that $\sum _{j}(\unicode[STIX]{x0394}v_{\Vert }/\sqrt{2})F_{M0}^{j}=n_{0}$ by definition, which means
Note that $\text{erf}(x)$ quickly approaches 1 with increasing $x$, so that for example when $v_{max}=4v_{t}$, $n_{0h}\approx 1.00006n_{0}$. We can also calculate
where $\unicode[STIX]{x1D70E}$ is the sign of the upwind velocity, and the boundary terms that result from the finite limits on the sum are small for $v_{max}\gtrsim 4v_{t}$. Thus we have $C_{N}\approx 1$ as expected, although it does not need to be exactly equal to unity to eliminate the cancellation problem. Instead, it was sufficient that $C_{N}=C_{J}$ on either side of (C 13).
One can also show that
Now, substituting these results into the dispersion relation from (C 23), we obtain
after again taking the limit $\unicode[STIX]{x1D714}\gg k_{\Vert }v_{te}$ and assuming $\unicode[STIX]{x0394}v_{\Vert }\sim v_{te}$. This finally gives
which is the expected dispersion relation.