betaFeedback

WorksPhysics and Astronomy

Exactly energy-conserving electromagnetic Particle-in-Cell method in curvilinear coordinates

Abstract

In this paper, we introduce and discuss an exactly energy-conserving Particle-in-Cell method for arbitrary curvilinear coordinates. The flexibility provided by curvilinear coordinates enables the study of plasmas in complex-shaped domains by aligning the grid to the given geometry, or by focusing grid resolution on regions of interest without overresolving the surrounding, potentially uninteresting domain. We have achieved this through the introduction of the metric tensor, the Jacobian matrix, and contravariant operators combined with an energy-conserving fully implicit solver. We demonstrate the method's capabilities using a Python implementation to study several one- and two-dimensional test cases: the electrostatic two-stream instability, the electromagnetic Weibel instability, and the geomagnetic environment modeling (GEM) reconnection challenge. The test results confirm the capability of our new method to reproduce theoretical expectations (e.g. instability growth rates) and the corresponding results obtained with a Cartesian uniform grid when using curvilinear grids. Simultaneously, we show that the method conserves energy to machine precision in all cases.

Introduction

Advanced plasma simulation methods have become a key tool for studying a wide variety of systems and phenomena throughout the fields of plasma physics and astrophysics. The difficulty of recreating the relevant plasma conditions in a laboratory environment make simulations irreplaceable for obtaining otherwise unachievable key insight. Among plasma simulations techniques, Particle-in-Cell (PIC) methods stand out as particularly useful when studying plasmas where kinetic effects are important. The state of the art of PIC methods is constantly evolving with new capabilities and improvements being developed. Recently, the astro- and plasma communities have steered their interest toward more advanced PIC methods, especially involving flexible (i.e. adaptive) grids and high-stability algorithms, to allow for long-term simulations of systems where Cartesian (uniform) grids might be ill-suited (for example Tokamak simulations using magnetic coordinates as shown in e.g. Jolliet et al. [23], or accretion disks around astrophysical compact objects using spherical Kerr-Schild coordinates as shown in e.g. Crinquand et al. [11]). A nonuniform, adaptive grid could be particularly beneficial in several cases, e.g. i) when the physical shape of the domain of interest is nontrivial, such that a significant part of an encompassing Cartesian box would be occupied by empty space or otherwise uninteresting regions where plasma behavior is trivial or quasi-static; and ii) when a small region of interest is embedded in a much larger domain, and the latter might be significantly overresolved (in terms of spatial and temporal resolution) due to physical requirements only imposed by the small region of interests. In both cases, employing a standard uniform grid can substantially increase the computational cost of the simulation, in the worst case making certain studies entirely unfeasible. The introduction of a nonuniform grid is one way to relax these limitations, by adapting the grid to the physical setup in question and thus assigning the computational resources more efficiently (see e.g. [16, 13, 7, 36]). Several methods have been developed to use curvilinear grids, but most are implemented with one specific grid in mind, and thus lack flexibility (see e.g. Ringle [34]; Gonzalez-Herrero et al. [20]). Others are fully general, i.e. they work with an arbitrary grid, but come with other trade-offs such as: i) using a reduced set of equations, rather than a full electromagnetic implementation, thus limiting their applicability to the constraints of these approximations (e.g. an electrostatic model in Fichtl et al. [16]; Delzanno et al. [13], or the Vlasov-Darwin approximation in Chacón & Chen [7]); or ii) introducing large deviations from energy conservation in long simulations, due to discretization errors that are intrinsic of the PIC implementation with explicit methods. Energy conservation is a universal physical property, of particular interest in setups where energy is converted from one form to another. For example, when modeling instabilities or reconnection events, preserving energy is extremely important to avoid numerical heating or cooling which could significantly influence the plasma dynamics and potentially invalidate the results (e.g. Markidis & Lapenta [28]).

In this work, we provide a method combining general curvilinear grids, through the introduction of coordinate transformations, with a fully electromagnetic-PIC implementation using an exactly energy-conserving, Jacobian-free Newton-Krylov solver. The method was designed with the architecture of the ECsim code (Lapenta [26]) in mind, to allow for easy implementation in a production-ready infrastructure. To the best of our knowledge, this may represent the first production-scale code which combines the aforementioned properties (curvilinear grids and exact energy conservation).

This paper is organized as follows: the mathematical foundation of the method is described in detail in § 2; in § 3, a series of one- and two-dimensional tests are discussed to assess the validity of the new method; the main results, conclusions, potential applications, and next steps in this line of research are discussed in the final § 4.

The Curvilinear PIC Method

The method described in this paper combines a fully implicit PIC implementation (Chen et al. [8]; Markidis & Lapenta [28]) using finite differences and a Jacobian-free Newton-Krylov solver, with a curvilinear grid through the introduction of the metric tensor, Jacobian matrix, and covariant differentiation operators. As we will show in § 3, the method was successfully implemented and tested in Python.

Governing equations

The PIC method is a first-principles approach for fully kinetic plasma simulations. It describes the plasma as a coupled system between freely moving particles existing in a position-velocity phase space, and a discrete representation of electric and magnetic fields on a computational grid.

To evolve the fields in time we use Maxwell’s equations, here in CGS units:

∇⋅E=4πρ,(1)\nabla\cdot\mathbf{E} = 4\pi\rho, \tag*{(1)}
∇⋅B=0,(2)\nabla\cdot\mathbf{B} = 0, \tag*{(2)}
1c∂B∂t=−∇×E,(3)\frac{1}{c}\frac{\partial\mathbf{B}}{\partial t} = -\nabla\times\mathbf{E}, \tag*{(3)}
1c∂E∂t=−4πcI+∇×B,(4)\frac{1}{c}\frac{\partial\mathbf{E}}{\partial t} = -\frac{4\pi}{c}\mathbf{I} + \nabla\times\mathbf{B}, \tag*{(4)}

where E\mathbf{E} and B\mathbf{B} are the electric and magnetic field respectively, ρ\rho is the charge density, cc is the speed of light, and I\mathbf{I} is the current density, which is computed from the particle velocities (see § 2.3 below). Note that the PIC method only requires Faraday’s law (3) and Ampère’s law (4) to form a closed system of equations. It can easily be shown that Gauss’s law for magnetism (2) will always be satisfied if the spatial discretization on the computational grid mimics the continuous vector identity ∇⋅∇×V=0\nabla\cdot\nabla\times\mathbf{V} = 0 for a generic vector V\mathbf{V} (Lapenta [26]). Gauss’ law for E\mathbf{E} (1), however, is not automatically satisfied in fully implicit PIC. While it is possible to construct a method that also satisfies this equation (e.g. Chen et al. [8]; Chen & Tóth [10]), we are currently only concerned with presenting a first implementation of our method, which conserves energy exactly in curvilinear coordinates, and that can then be further improved upon in future work. Moreover, in our tests we did not detect numerical artifacts linked to charge conservation, implying that numerical errors are limited.

Computational particles in the PIC method are updated using the standard equations of motion,

dxdt=v,(5)\frac{d\mathbf{x}}{dt} = \mathbf{v}, \tag*{(5)}
dvdt=qm(E+1cv×B),(6)\frac{d\mathbf{v}}{dt} = \frac{q}{m}\left(\mathbf{E} + \frac{1}{c}\mathbf{v} \times\mathbf{B}\right), \tag*{(6)}

where x\mathbf{x} and v\mathbf{v} are the particle position and velocity, qq the particle charge, and mm the particle mass.

In the PIC paradigm, the sources for Maxwell’s equations (I\mathbf{I} and ρ\rho) are collected from the particles onto the computational grid via interpolation; electromagnetic fields are interpolated at the particle positions to obtain the Lorentz force needed to update the particles. Because of this, particle and field equations are in general nonlinearly coupled. In the method described in this paper a fully implicit nonlinear iterative solver is used to solve this set of equations, which are discretized as described in § 2.3.

Curvilinear PIC: Coordinate transformation

To work with a curved grid we consider an arbitrary mapping

ξ=f(x).(7)\xi= f(\mathbf{x}). \tag*{(7)}

The space described by the new coordinates ξ\boldsymbol{\xi} will be called the “logical” space and the space described by the original set of coordinates x\mathbf{x} will be called the “physical” space. The mapping ff is chosen such that the curvilinear grid in physical space becomes a regular orthogonal grid in logical space. This is depicted in Figure 1. Next, we introduce the Jacobian and its inverse,

Image not extracted

Figure 1. Diagram of the coordinate transformation between physical and logical space. The Jacobian and its inverse are used to transform contravariant vector components. In physical space the Euclidean metric is used, while a non-trivial metric is used in logical space.

jμi=∂xi∂ξμ,(8)j^{i}_{\mu} = \frac{\partial x_i}{\partial\xi^\mu}, \tag*{(8)}
ji−1μ=∂ξμ∂xi.(9)j^{-1\mu}_{i} = \frac{\partial\xi_\mu}{\partial x_i}. \tag*{(9)}

and the associated metric defined as

gμν=jμijνi.(10)g_{\mu\nu} = j^{i}_{\mu}j^{i}_{\nu}. \tag*{(10)}

Here, Greek indices are used to denote ξ\boldsymbol{\xi} coordinates in the logical space and Latin indices to denote x\mathbf{x} coordinates in physical space. In this way, the difficulty of working with a nonuniform curvilinear grid has been circumvented by transforming to the logical grid, at the cost of a non-trivial metric tensor and Jacobian matrix. Calculating the metric and Jacobian only has to be done once at initialization for each grid point and can subsequently be stored in memory. Note that, in our implementation, the grid is static and therefore the Jacobian and metric are time-invariant.

Due to the introduction of a nontrivial metric the vector operators have to be changed from their usual Cartesian implementation to a covariant implementation. The only differential operator appearing in our PIC equations is the curl operator, e.g. for a generic (covariant) vector field VκV_\kappa,

(∇×V)μ→1Jϵμνκ∂νVκ,(11)(\nabla\times V)^\mu\to\frac{1}{J}\epsilon^{\mu\nu\kappa}\partial_\nu V_\kappa, \tag*{(11)}

where J=∣j∣J = \lvert j\rvert is the Jacobian determinant, and ϵμνκ\epsilon^{\mu\nu\kappa} is the Levi-Civita symbol. Furthermore, the metric tensor can be used to raise and lower indices, e.g. Vκ=gκλVλV_\kappa= g_{\kappa\lambda}V^\lambda.

For the particle equations of motion we keep the Cartesian description from eqs. (5)–(6). We avoid solving these equations in logical space, since this would require the Jacobian and metric tensor to be known at each particle position at every timestep. Given the computational complexity of deriving these values from the initial mapping function, this was not considered a practical operation to be carried out at every iteration for every particle. This operation is in principle feasible if all mapping quantities are analytically known, but this imposes additional constraints on the mapping function (i.e. invertibility and differentiability) which we want to avoid for generality. Calculating the equations of motion in Cartesian coordinates instead introduces the need to convert particle positions and vector-field components between physical and logical space. This strategy is still less computationally demanding than evolving particles in the logical space. Particle positions are transformed from Cartesian physical space to general logical space simply using the original mapping function ff in eq. (7). Contravariant vector components can be transformed using the Jacobian and inverse Jacobian matrices as

Vi=jμiVμ,(12)V^i = j^i_{\mu}V^\mu, \tag*{(12)}
Vμ=ji−1μVi.(13)V^\mu= j^{-1\mu}_{i}V^i. \tag*{(13)}

This is necessary in the interpolation of the current density and the fields, as we show in the following Section. For further details or interest in the topic we recommend the book Liseikin [27].

Discretization

The notation in this paper uses superscript parentheses to denote discrete time steps, and subscript parentheses to denote discrete spatial coordinates. All quantities are known at integer time steps; when the method requires half-integer times (see below), the relevant quantities will be linearly interpolated between subsequent time levels. Field quantities are defined at discrete locations on the computational grid, e.g. in two spatial dimensions, V(ξ,η)(n)V^{(n)}_{(\xi,\eta)} denotes a quantity VV at the grid location (ξ,η)(\xi,\eta) in the logical space and discrete time level nn. This allows us to avoid confusion with indices of vector components. When the exact spatial indices are not relevant they are replaced by subscript gg to indicate a quantity known at a generic grid point, or subscript pp for a quantity known at a particle’s position.

To discretize the governing equations, we use a finite-difference scheme. Magnetic-field components are placed on grid nodes, with integer spatial indices, while electric field components are placed on the grid centers, with half-integer spatial indices.1 Maxwell’s equations (3)–(4) require spatial derivatives of the magnetic field to be colocated with the electric field, and conversely the spatial derivatives of the electric field to be colocated with the magnetic field. This requires the quantities to be averaged along the direction perpendicular to that of the derivative before taking finite differences. This allows for a centered finite-difference spatial derivative which is second-order accurate; in two dimensions, the discrete derivatives for a generic quantity VV along the ξ\xi or η\eta directions are

DξV=(Vξ+1,η+Vξ+1,η+1)−(Vξ,η+Vξ,η+1)2Δξ,(14)D_{\xi}V = \frac{(V_{\xi+1,\eta}+V_{\xi+1,\eta+1})-(V_{\xi,\eta}+V_{\xi,\eta+1})}{2\Delta\xi}, \tag*{(14)}
DηV=(Vξ,η+1+Vξ+1,η+1)−(Vξ,η+Vξ+1,η)2Δη,(15)D_{\eta}V = \frac{(V_{\xi,\eta+1}+V_{\xi+1,\eta+1})-(V_{\xi,\eta}+V_{\xi+1,\eta})}{2\Delta\eta}, \tag*{(15)}

where the spatial indices can be integers or half-integers depending on whether the specific quantity exists on nodes or centers respectively. Time derivatives are discretized using a second-order accurate central-difference scheme. Using these discrete derivatives, we can now write the discrete Maxwell’s equations (3)–(4):

Bgμ(n+1)−Bgμ(n)Δt=−cJgϵμνκ(DνEκ)g(n+1/2),(16)\frac{B_g^{\mu(n+1)}-B_g^{\mu(n)}}{\Delta t}=-\frac{c}{J_g}\epsilon^{\mu\nu\kappa}(D_\nu E_\kappa)_g^{(n+1/2)}, \tag*{(16)}
Egμ(n+1)−Egμ(n)Δt=−4πIgμ(n+1/2)+cJgϵμνκ(DνBκ)g(n+1/2).(17)\frac{E_g^{\mu(n+1)}-E_g^{\mu(n)}}{\Delta t}=-4\pi I_g^{\mu(n+1/2)}+\frac{c}{J_g}\epsilon^{\mu\nu\kappa}(D_\nu B_\kappa)_g^{(n+1/2)}. \tag*{(17)}

The current density on each grid point must be gathered from the particles as

Igμ=(Jg−1jμ)gJgΔξΔη∑pwpgqpvpi,(18)I_g^\mu=\frac{(J_g^{-1}j^\mu)_g}{J_g\Delta\xi\Delta\eta}\sum_p w_{pg}q_pv_p^i, \tag*{(18)}

where wpgw_{pg} is the interpolation function linking particle pp with the grid point gg. wpgw_{pg} is a function of the particle position in logical coordinates; this can be found using the mapping function ξ=f(x)\xi=f(x). The inverse-Jacobian factor in the equation above transforms the current from physical to logical components as described by eq. (13).

Since particles are evolved in the physical space the discretization is straightforward,

xpi(n+1)−xpi(n)Δt=vpi(n+1/2),(19)\frac{x_p^{i(n+1)}-x_p^{i(n)}}{\Delta t}=v_p^{i(n+1/2)}, \tag*{(19)}
vpi(n+1)−vpi(n)Δt=qpmp(Ei+ϵijkvjBk)p(n+1/2).(20)\frac{v_p^{i(n+1)}-v_p^{i(n)}}{\Delta t}=\frac{q_p}{m_p}\left(E^i+\epsilon^{ijk}v_jB_k\right)_p^{(n+1/2)}. \tag*{(20)}

Note that the fields in these equations are located at the particle positions, which requires an interpolation: for a generic field VV,

Vpi=∑gwgp(jiJμ)g,(21)V_p^i=\sum_g w_{gp}(j^iJ^\mu)_g, \tag*{(21)}

where wgpw_{gp} is the interpolation function from grid points to particle positions. By construction we have chosen wgp=wpgw_{gp}=w_{pg}, which is a requirement for energy conservation (see Appendix § 6). As described by eq. (12), we added the Jacobian jμij^i_\mu to convert VμV^\mu from curvilinear to Cartesian coordinates, as required by the Cartesian equations of motion.

To solve for equations (16)–(17) and (19)–(20), a nonlinear Newton-Krylov iterative solver is used. Convergence of this solver is typically case-based, and is not guaranteed when spatiotemporal resolution is insufficient to capture relevant physical phenomena. As a rule of thumb for the tests in the next Sections, the temporal and spatial resolutions were constrained to satisfy cΔt/Δx<1c\Delta t/\Delta x<1, with a typical value for this ratio usually set to ∼0.25\sim0.25. This was sufficient in all test cases to achieve absolute and relative errors below 10−1410^{-14}, typically within ∼10\sim10 iterations. Note that Δx\Delta x may vary throughout our nonuniform grids, in which case the smallest value of Δx\Delta x in the grid must be considered for this constraint.

Discrete energy

To verify the exactly energy-conserving nature of this method, a proper definition for the relevant energies must be established. The electric- and magnetic-field energies are respectively defined as

UE=∑gΔξΔη8π(JEμEμ)g,(22)U_E=\sum_g\frac{\Delta\xi\Delta\eta}{8\pi}(JE_\mu E^\mu)_g, \tag*{(22)}
UB=∑gΔξΔη8π(JBμBμ)g,(23)U_B=\sum_g\frac{\Delta\xi\Delta\eta}{8\pi}(JB_\mu B^\mu)_g, \tag*{(23)}

which combined give the total electromagnetic-field energy UF=UE+UBU_F=U_E+U_B. The particle kinetic energy is defined as

UK=∑pm(vivi)p2.(24)U_K=\sum_p\frac{m(v_iv^i)_p}{2}. \tag*{(24)}

The sum of the kinetic and electromagnetic field energy is the total energy in the system: U=UK+UFU = U_{\mathrm{K}} + U_{\mathrm{F}}. In Appendix § 6 we show analytically that, using these definitions, the total energy will be conserved exactly (i.e. to machine precision).

Test cases

To validate the methods developed in this paper, we considered three different test cases: the one-dimensional, electrostatic two-stream instability; the one-dimensional, electromagnetic Weibel (or filamentation) instability [38, 6]; and the two-dimensional Geospace Environmental Modeling (GEM) challenge, i.e. a paradigmatic magnetic-reconnection setup [3].

Two-stream Instability

The two-stream instability represents a classical one-dimensional test for PIC codes. The initial setup consists of two counterstreaming electron beams with uniform number density n0/2n_0/2. We initialize the particles in each beam according to a drifting Maxwellian with thermal speed vth/c=0.001v_{\mathrm{th}}/c = 0.001. The drift-velocity component is along the only spatial direction of the system xx, and is added to both beams with opposite sign, i.e. vd/c=±0.2v_{\mathrm{d}}/c = \pm0.2. The analytic solution of the dispersion relation predicts that the system is unstable if kvd/ωp<1k v_{\mathrm{d}}/\omega_{\mathrm{p}} < 1 [19], with kk the wave number and ωp\omega_{\mathrm{p}} the plasma frequency. This results in an unstable, purely electrostatic evolution where charge bunching will generate a self-reinforcing electric-field perturbation. During the linear instability phase, the electric-field energy (eq. (22)) in the fastest-growing unstable mode will grow as

UE∼exp⁡(ωpt).(25)U_{\mathrm{E}} \sim\exp\left(\omega_{\mathrm{p}} t\right). \tag*{(25)}

To test the capability of our code to handle curvilinear coordinates, we employed two nonuniform, one-dimensional grids alongside a standard Cartesian grid used as a reference. The first curvilinear grid has a small sinusoidal perturbation of one period along the domain, with mapping function

ξ(x)=x+εLxsin⁡(2πxLx),(26)\xi(x) = x + \varepsilon L_x \sin\left(\frac{2\pi x}{L_x}\right), \tag*{(26)}

where LxL_x the length of the domain and ε\varepsilon parametrizes the strength of the perturbation, which we set to ε=0.02\varepsilon= 0.02. The second grid has a perturbation generated by a hyperbolic tangent, producing a grid with a sech⁡2\operatorname{sech}^{2} profile of cell density. A high density peak is present near the

center of the domain; the mapping function is

ξ(x)=Lx−2εLxLxx−εLxtanh⁡[1w(Lx2−x)]+εLx,(27)\xi(x) = \frac{L_x - 2\varepsilon L_x}{L_x}x - \varepsilon L_x \tanh\left[\frac{1}{w}\left(\frac{L_x}{2}-x\right)\right] + \varepsilon L_x, \tag*{(27)}

where ww determines the width of the high-density region, which we set to 44 with ε=0.04\varepsilon= 0.04. These two perturbed grids are constructed to ensure the total system length LxL_x is maintained. This is necessary to ensure a fair comparison to the Cartesian reference grid. The parameters used in the sinusoidal and hyperbolic grids are chosen such that the ratio of the cell-width between the smallest and largest cells is ∼0.75\sim0.75. This provides a meaningful deviation from the Cartesian case, while still allowing the same time steps without breaking the constraint cΔt/Δx<1c\Delta t/\Delta x < 1 mentioned in § 2.3. Figure 2 depicts the three grids used in this test for a resolution of 64 cells. The gray-scale is an indication for local cell density, with darker colors indicating higher density. The grids used in the simulations had Nx=2048N_x = 2048 cells with a domain length of 32c/ωp32c/\omega_{\mathrm{p}}, time step Δt=0.00390625ωp−1\Delta t = 0.00390625\omega_{\mathrm{p}}^{-1} and ppc=144ppc = 144 particles per cell.

Image not extracted

Figure 2. The three one-dimensional grids used in the study of the two-stream and Weibel instabilities: from top to bottom, Cartesian (i.e. the usual grid employed in standard PIC), sinusoidal, and hyperbolic-tangent mapping functions. They are shown here for a 64-cell grid with the grayscale indicating the local grid cell density.

Our results for this test are shown in Figure 3. The top left panel shows the evolution in time of the electric-field energy for the three distinct grids in one plot. It shows good agreement between the three cases as well as close adherence to the theoretical value of the growth rate outlined in eq. (25) during the linear-growth phase of the instability. The bottom left panel plots the time history of the relative error in the total energy, which confirms energy conservation to machine precision for all three cases. Lastly, the three panels on the right show a snapshot of the position-velocity phase space (x,vx)(x,v_x), where we observe the formation of holes that are typical for the nonlinear phase of this instability. These results give a good indication that the method is capable of faithfully reproducing electrostatic effects in a nonuniform, one-dimensional setup while maintaining exact energy conservation.

Image not extracted

Figure 3. Top left: Evolution of the electric-field energy for the different grids as well as the theoretical growth rate associated with the linear-growth phase of the two-stream instability. Bottom left: Evolution of the relative error in the total energy for the different grids. Right: Snapshots of the (x,vx)(x,v_x) phase space during the nonlinear stage for the different grids.

Weibel Instability

To test our method in a more general electromagnetic case, we study the Weibel (i.e. filamentation) instability. The setup is almost equivalent to the two-stream instability: Nx=2048N_x = 2048, Lx=32c/ωpL_x = 32c/\omega_p, Δt=0.00390625ωp−1\Delta t = 0.00390625\omega_p^{-1} and ppc = 144 uniformly distributed and divided between the two electron populations. The difference here is the direction of the beam drift velocity, which is now perpendicular to the domain’s direction i.e. vy=vd=±0.2cv_y = v_d = \pm0.2c, and similarly, the thermal velocity only has a component along the perpendicular direction as well, with magnitude vth=0.001cv_{\mathrm{th}} = 0.001c. The Weibel instability is

excited by current separation generated by the Lorentz force in a perturbed magnetic field when acting on the two counterstreaming beams. The resulting current filaments will reinforce the initial magnetic-field perturbations. This leads to an exchange of energy between particles and magnetic fields. The magnetic-field energy in fastest-growing unstable mode will evolve as

UB∼exp⁡(2vdt)(28)U_B \sim\exp(2v_d t) \tag*{(28)}

during the linear phase of the instability. Figure 4 shows the results of the Weibel instability tests. The upper-left panel shows the evolution in time of the magnetic-field energy for all grids. For all cases, we observe a slight discrepancy between the simulated and theoretical value of the growth rate during the linear instability phase. However, the results of the different grids are in strong agreement with each other. The slight discrepancy with the theoretical growth rate could be attributed to different factors: for example, the finite spatial resolution prohibits resolving large wave numbers which would otherwise increase the observed growth rate, potentially agreeing better with the theoretical maximum growth rate that corresponds to k→∞k \to\infty; in addition, noise induced by the motion of the limited number of particles drowns out small waves that might otherwise contribute to the instability. At any rate, the discrepancy is very small and the results appear robust in terms of agreement between different cases we run. The lower-left panel shows again the evolution of the relative energy error, indicating conservation of energy to machine precision for all three grid setups. The panels on the right-hand side of the Figure show the current filaments forming and growing throughout the domain as time increases. Considering these results, the method appears capable of correctly reproducing fully electromagnetic effects while conserving energy to machine precision, at least in this simple one-dimensional test case.

Image not extracted

Figure 4. Top left: Evolution of the magnetic-field energy for the different grids as well as the theoretical growth rate associated with the linear-growth phase of the Weibel instability. Bottom left: Evolution of the relative error in the total energy for the different grids. Right: Formation and growth of current filaments in the domain with evolving time for the different grids.

GEM reconnection challenge

The last test case presented in this paper is the Geospace Environmental Modeling (GEM) reconnection challenge. This is a well-known two- (or three-)dimensional setup to study magnetic-reconnection events [3]. We adopt a two-dimensional xyxy geometry where the BxB_x field undergoes a sign reversal along the yy-axis, creating a current sheet in the inversion region. For simplicity, we adopt periodic boundary conditions, initializing two successive inversions to respect periodicity. The initial setup of the magnetic field is

Bx=B0[1−tanh⁡(y−Ly/4δ)+tanh⁡(y−3Ly/4δ)].(29)B_x = B_0 \left[1-\tanh\left(\frac{y-L_y/4}{\delta}\right)+\tanh\left(\frac{y-3L_y/4}{\delta}\right)\right]. \tag*{(29)}

To respect the c∇×B=4πIc\nabla\times\mathbf{B}=4\pi\mathbf{I} condition, we initialize a drifting electron and positron population in the current sheets with a number density of

n=n0[sech⁡2(y−Ly/4δ)+sech⁡2(y−3Ly/4δ)].(30)n=n_0\left[\operatorname{sech}^{2}\left(\frac{y-L_y/4}{\delta}\right)+\operatorname{sech}^{2}\left(\frac{y-3L_y/4}{\delta}\right)\right]. \tag*{(30)}

Here B0B_0 and n0n_0 are the peak magnetic field strength and density in the current sheet respectively, and δ\delta is the width of the current sheet, which we choose equal to 0.5c/ωp0.5c/\omega_p.

At initialization, the thermal pressure of the particles in the current sheet must be able to withstand the magnetic pressure to ensure the structure neither collapses nor expands, i.e. for pressure equilibrium

B028π=2nkbT,(31)\frac{B_0^2}{8\pi}=2nk_{\mathrm{b}}T, \tag*{(31)}

with kbk_{\mathrm{b}} the Boltzmann constant and TT the plasma temperature. The factor 2 is introduced to include both electron and positron contribution to the density. By equating kbTk_{\mathrm{b}}T with mvth2mv_{\mathrm{th}}^2, a constraint for the thermal speed in the current sheet can be found,

vthc=Bc16πnm.(32)\frac{v_{\mathrm{th}}}{c}=\frac{B}{c\sqrt{16\pi n m}}. \tag*{(32)}

Note that we do not manually perturb the initial equilibrium, so that tearing modes eventually causing reconnection are only excited by random particle noise.

As in the 1D cases, a Cartesian grid is used to establish a baseline to which we compare nonuniform-grid results. The Cartesian grid has dimensions Lx=16c/ωpL_x=16c/\omega_p by Ly=32c/ωpL_y=32c/\omega_p with Nx=160N_x=160 by Ny=320N_y=320 cells and ppc=16ppc=16 particles per cell. The time step was set to Δt=0.025ωp−1\Delta t=0.025\omega_p^{-1} for nt=30000nt=30000 steps, for a total time of 750ωp−1750\omega_p^{-1}. This satisfies the convergence constraint cΔt/Δx<1c\Delta t/\Delta x<1.

To test the behavior of our code with curvilinear coordinates, we construct a nonuniform grid such that we achieve the same density of computational cells (i.e. the same numerical resolution) near the current sheets, while significantly reducing the grid resolution in the upstream regions. This naturally results in fewer total grid cells than in the uniform Cartesian case. This grid setup enables us to resolve the reconnection region with the same precision of the Cartesian setup while greatly reducing the total number of cells in regions of no physical interest. The mapping function for this grid was created using piecewise linear functions that were connected using hyperbolic tangents as an approximation for the Heaviside step function,

ξ(x)=x,(33)\xi(x)=x, \tag*{(33)}
η(y)=Lypmax⁡(y−∑n=14gn(y)),(34)\eta(y)=\frac{L_y}{p_{\max}}\left(y-\sum_{n=1}^{4}g_n(y)\right), \tag*{(34)}

where gn(y)=((rny+pn)−(rn−1y+pn−1))tanh⁡(s(y−bn))g_n(y)=((r_n y+p_n)-(r_{n-1}y+p_{n-1}))\tanh(s(y-b_n)). Here, rnr_n is the cell-density ratio with respect to the low-density upstream regions. This is set to 1 in the upstream regions and to a desired larger ratio for the current-sheet regions. ss determines the sharpness of the transition, with larger values more closely resembling the Heaviside function and lower values creating a smoother transition region. This value was set to s=5s=5 for all grids. The bnb_n terms determine the break points i.e. the yy-coordinate where the piecewise function switches from one linear function to the next. These breakpoints therefore determine the points of transition between high and low density regions. These are set at Ly/8L_y/8, 3Ly/83L_y/8, 5Ly/85L_y/8 and 7Ly/87L_y/8 respectively. The pnp_n factors are the offsets of the individual linear functions, which are fully constrained by the previous parameters. Finally, pmax⁡p_{\max} is the maximum value reached by the piecewise function, and is introduced such that η∈[0,Ly]\eta\in[0,L_y].

We employed two nonuniform grids, the first with a density ratio r=5r=5 and number of cells in the yy-direction Ny=192N_y=192, and the second with ratio r=10r=10 and Ny=176N_y=176. The number of cells in the xx-direction remains unchanged from the Cartesian case (Nx=160N_x=160). By design, the curvilinear grid has the same physical size Lx=16c/ωpL_x=16c/\omega_p and Ly=32c/ωpL_y=32c/\omega_p of the Cartesian grid. Furthermore, the time step and number of iterations were deliberately set to be identical in both cases to again satisfy the convergence constrained, since the smallest Δx\Delta x is also unchanged.

Our results are shown in Figure 5. The left panel shows the Cartesian grid in the top half of the domain and the curvilinear grid with density ratio r=10r=10 in the

Image not extracted

Figure 5. Left: Comparison of the uniform Cartesian grid (top) and curvilinear grid with r=10r = 10 (bottom) which has a reduced resolution in the upstream regions, while maintaining the same resolution in the current sheets that was used in the Cartesian grid. The magnetic islands formed in the top and bottom halves are not collocated since their positions are randomized by the starting values of the particle properties. Middle: Comparison of a snapshot of the out-of-plane current and the in-plane magnetic-field lines for the aforementioned grids. Top right: Evolution of the magnetic-field energy and kinetic energy for the different grids. Bottom right: Evolution of the relative error in the total energy for the different grids.

bottom half. In the middle panel we show a comparison of the out-of-plane current log⁡10∣Jz∣\log_{10}|J_z| and the in-plane magnetic-field lines between the Cartesian grid (top) and the curvilinear grid with density ratio r=10r=10 (bottom) at time t=750ωp−1t=750\omega_p^{-1}. Although it is clear that the upstream regions have considerably lower resolution in the curvilinear case, the reconnection regions of interest look very similar. Since the exact position of the formed X-points and magnetic islands is due to the random initialization of the particle properties, they appear in different places in the top and bottom current sheet in the domain. In the top right panel, we plot total magnetic and kinetic energies for all cases, to show the energy exchange between magnetic fields and particles over time. The initial magnetic field contains the majority of the energy, and as the magnetic fields reconfigure into a more relaxed state via reconnection, the particles gain energy and get accelerated. The bottom right panel shows the evolution in time of the relative error in the total energy, which is again conserved to machine precision, supporting our findings from the 1D tests and the theory in Appendix § 6.

Conclusions

In this paper, a method is presented to adapt a fully implicit PIC method to work with arbitrary coordinate systems, including curvilinear coordinates, while maintaining exact (i.e. to machine precision) energy conservation. While previous methods have been published for reduced equations, like the Darwin approximation [7], this is the first time to our knowledge when this is achieved for a PIC with the full Maxwell equations. This is achieved by changing the coordinates to a system where the grid becomes logically rectangular. To change coordinates we introduce the metric tensor, Jacobian matrix, and contravariant curl operator into Maxwell’s equations for the PIC algorithm. The particle equations of motion are solved in Cartesian coordinates, to avoid the complexity of calculating the metric and Jacobian at each particle position and at each iteration.

To validate the method, we have presented three different test cases. The two-stream instability and Weibel instability were tested in one spatial dimension and the GEM reconnection challenge was tested in two dimensions. The tests runs with nonuniform (curvilinear) grids were compared to the results obtained with a uniform Cartesian grid, taken as a baseline. Two nonuniform grids were tested in the one-dimensional cases, both generated by perturbing the baseline Cartesian grid: the first with a sinusoidal perturbation and the second with a hyperbolic-tangent perturbation. The nonuniform grid in the GEM challenge was designed to greatly reduce the total number of grid cells, while maintaining the same spatial resolution of the uniform grid around the current sheets, to properly resolve reconnection dynamics while underresolving the unimportant upstream regions. Comparisons were performed on global quantities such as individual energy components and the total energy of the system.

We demonstrated that our new method achieves energy conservation to machine precision in all three test cases with both Cartesian and curvilinear grids. The two-stream instability modeled with curvilinear grids shows a growth rate of the electric-field energy which closely matches both the (Cartesian uniform) baseline and the theoretical growth rate. The Weibel instability also shows excellent alignment of the magnetic-field energy to the Cartesian baseline. In our nonuniform-grid runs, we observed that the 2D GEM challenge produced reconnection events inside the current-sheet region as expected of this setup, despite the nonuniform grid having only 55–60% the total number of cells with respect to the uniform Cartesian run. Reconnection can be observed in the in-plane magnetic-field line rearrangement, which shows the formation of magnetic islands, and in the exchange between magnetic and particle energy, showing a conversion of magnetic-field energy into kinetic energy as particles get accelerated during the reconnection process.

Although our method possesses desirable properties (exact energy conservation and grid adaptability to complex geometries), ample ground is left for further improvements, which we will pursue in future work. Unlike the energy, the total charge is not conserved, since ∇⋅E=4πρ\nabla\cdot E = 4\pi\rho is not enforced in our implementation. However, as shown in other works (e.g. [10]), a charge-conserving adaptation of fully implicit PIC methods is possible [8], and could be implemented in our code in the future. Another shortcoming is represented by the convergence of the nonlinear iteration, on which our method is based, which is not guaranteed; from our experiments, we observed that a sufficiently high spatiotemporal resolution must be enforced to avoid nonconvergence issues, which could break the temporal iteration. In many practical cases however, this will not pose a problem, since a fine spatiotemporal resolution is required anyway, to resolve the physics of interest. In our tests, convergence (i.e. an absolute error below a tolerance ∼10−14\sim10^{-14}) was always attained with ∼10\sim10 nonlinear iterations; hence, the computational cost in our example simulations was approximately a factor 10 larger than a standard explicit PIC method, since each nonlinear iteration roughly corresponds to one explicit time cycle. The greater computational cost of our method is however counterbalanced by numerous advantages, as discussed below. In addition, speeding up convergence is in principle possible with more advanced strategies: for example, Chen et al. [9] have shown that by preconditioning the nonlinear solver the average number of iterations can be drastically reduced, and the spatiotemporal resolution constraints can be relaxed.

By combining a curvilinear grid with an exactly energy-conserving PIC method, we have achieved a unique set of features with numerous potential applications. In general, nonuniform grids are especially well suited for setups with a small region of interest within a much larger domain, or setups where the bulk of the plasma is contained within a spatial region with a nontrivial shape. Meanwhile, energy conservation is important in many problems where energy conversion from one type to another occurs and has significant impact on the plasma dynamics, e.g. reconnection events or instabilities (see Markidis & Lapenta [28] and references therein). In several cases, the combination of energy conservation and custom grids can be of high interest: in fusion plasma physics, our method could be used in simulations of the scrape-off layer (i.e. the plasma layer close to the separatrix) of a Tokamak plasma (e.g. Ohtsuka et al. [32]; Xu & Cohen 1998; Krasheninnikov [25]; Fundamenski et al. [17]). The nonuniform grid can be tailored to match the geometry of the boundary layer, greatly reducing the total computational cost. Another example is the expanding solar wind (e.g. Innocenti et al. [22, 21]; Bott et al. [4]; Micera et al. [31]): here, a large domain, which expands in time as the solar wind travels, makes it difficult to employ a standard Cartesian box while maintaining sufficient resolution throughout the domain. By using a grid that mimics the shape of the expanding solar wind, with a high resolution closer to the Sun and decreasing grid density further out (where less resolution is required), the computational cost of this problem can be significantly reduced.

Conversely, when considering compression-driven dynamics in plasmas, a compressing box has been used in the past in the context of simulations of the intergalactic medium (e.g. Sironi & Narayan [35]), which could similarly be replaced with our nonuniform grids. Other solar wind-related phenomena whose modeling could benefit from a custom grid are switchbacks. Switchbacks are magnetic structures in the solar wind characterized by a typical S-shape of the plasma stream, and may be related to interchange reconnection events and particle scattering and acceleration (e.g. Drake et al. [14]; Wyper et al. [39]). With our method, a curved grid can be fitted to this S-shaped stream, reducing the total grid resolution and cutting out the surrounding plasma that might be of little interest. This might open up the possibility to a fully kinetic study of the driving phenomena which was thus far unfeasible. In higher-energy plasma scenarios, our method could also find applicability e.g. for general-relativistic plasma simulations. Recent works have simulated plasma accretion around compact objects such as black holes (e.g. [33, 5, 11, 15, 18]), where plasma flows in structures such as accretion disks and jets. These works present large-scale simulations utilizing explicit codes, usually implemented with one specific (four-dimensional) metric corresponding to the particular physical case in question. With the method presented in this work (modified by adding a time component of the metric and relativistic effects; see e.g. [2, 1]), we can simultaneously avoid the aforementioned downsides of explicit codes (i.e. numerical instability and lack of energy conservation) and generalize such simulations to any arbitrary metric tensor that might be of interest, opening the possibility for more physical cases to be studied.

We foresee several potential developments for the future. The logical next step in this line of work is to implement the method in a production-ready, parallel infrastructure such as those currently employed for implicit-PIC simulations (e.g. iPic3D, ECsim). This will open the door to larger-scale simulations outside the capabilities of our current test implementation in Python. The most obvious candidate would be the ECSIM code (Lapenta [26]), since it shares (by design) a very similar discretization of our governing PIC equations. This step will be carried out in the future. It would also be of great interest to consider novel architectures such as GPUs. The traditional bottlenecks in PIC codes are the particle gathering and deposition steps. With the increasing popularity of GPU-accelerated codes, these bottlenecks could be mitigated, since the gathering and deposition steps are well suited to parallelization (e.g. [24, 12, 37]). The field solver, on the other hand, whether implemented on CPUs or GPUs, requires global communication of grid quantities, which hinders scaling behavior to a large number of cores, so it becomes imperative to further reduce the cost of the field-solution step through other means. With the method described in this paper, this can be achieved by optimizing the grid and thus reducing the total number of cells, which is the main driving factor of the field solver’s computational cost.

Appendix

Formal proof of energy conservation

Throughout this Appendix the time-level notation has been shortened for improved readability by dropping the ubiquitous nn, thus only writing the offset from this arbitrary time level. For example (1/2)(1/2) is equivalent to (n+1/2)(n+1/2). Starting from Maxwell’s equations (3)–(4), we contract both sides with Bμg(1/2)B_{\mu g}^{(1/2)} and Eμg(1/2)E_{\mu g}^{(1/2)} respectively:

cJg(Bμϵμνκ∂νEκ)g(1/2)=−(Bμ∂tBμ)g(1/2),(35)\frac{c}{J_g}\left(B_\mu\epsilon^{\mu\nu\kappa}\partial_\nu E_\kappa\right)_g^{(1/2)}=-\left(B_\mu\partial_tB^\mu\right)_g^{(1/2)}, \tag*{(35)}
cJg(Eμϵμνκ∂νBκ)g(1/2)=(Eμ∂tEμ)g(1/2)+4π(EμIμ)g(1/2).(36)\frac{c}{J_g}\left(E_\mu\epsilon^{\mu\nu\kappa}\partial_\nu B_\kappa\right)_g^{(1/2)}=\left(E_\mu\partial_tE^\mu\right)_g^{(1/2)}+4\pi\left(E_\mu I^\mu\right)_g^{(1/2)}. \tag*{(36)}

Subtracting eq. (A1) from eq. (A2) and rearranging terms gives

(Eμ∂tEμ)g(1/2)+(Bμ∂tBμ)g(1/2)=cJg(Eμϵμνκ∂νBκ)g(1/2)−cJg(Bμϵμνκ∂νEκ)g(1/2)−4π(EμIμ)g(1/2).(37)\begin{aligned} \left(E_\mu\partial_tE^\mu\right)_g^{(1/2)}+\left(B_\mu\partial_tB^\mu\right)_g^{(1/2)} ={}&\frac{c}{J_g}\left(E_\mu\epsilon^{\mu\nu\kappa}\partial_\nu B_\kappa\right)_g^{(1/2)} -\frac{c}{J_g}\left(B_\mu\epsilon^{\mu\nu\kappa}\partial_\nu E_\kappa\right)_g^{(1/2)}\\ &-4\pi\left(E_\mu I^\mu\right)_g^{(1/2)}. \tag*{(37)} \end{aligned}

On the left-hand side, the time derivatives are discretized as described in § 2.3 and half-integer timestep values are substituted with a temporal linear interpolation, producing

Eμg(1)+Eμg(0)2Eg(1)−Eg(0)Δt+Bμg(1)+Bμg(0)2Bg(1)−Bg(0)Δt=cJg(Eμϵμνκ∂νBκ)g(1/2)−cJg(Bμϵμνκ∂νEκ)g(1/2)−4π(EμIμ)g(1/2).(38)\begin{aligned} \frac{E_{\mu g}^{(1)}+E_{\mu g}^{(0)}}{2}\frac{E_g^{(1)}-E_g^{(0)}}{\Delta t} +\frac{B_{\mu g}^{(1)}+B_{\mu g}^{(0)}}{2}\frac{B_g^{(1)}-B_g^{(0)}}{\Delta t} ={}&\frac{c}{J_g}\left(E_\mu\epsilon^{\mu\nu\kappa}\partial_\nu B_\kappa\right)_g^{(1/2)} -\frac{c}{J_g}\left(B_\mu\epsilon^{\mu\nu\kappa}\partial_\nu E_\kappa\right)_g^{(1/2)}\\ &-4\pi\left(E_\mu I^\mu\right)_g^{(1/2)}. \tag*{(38)} \end{aligned}

Summing over all grid points and multiplying with JgΔξΔη/4πJ_g\Delta\xi\Delta\eta/4\pi while working out the products on the left-hand side results in

∑gJgΔξΔηΔt((EμEμ)g(1)+(EμEμ)g(0)8π+(BμBμ)g(1)+(BμBμ)g(0)8π)=∑gcΔξΔη4π(Eμϵμνκ∂νBκ−Bμϵμνκ∂νEκ)g(1/2)−∑gJgΔξΔη(EμIμ)g(1/2).(39)\sum_g \frac{J_g\Delta\xi\Delta\eta}{\Delta t}\left(\frac{(E_\mu E^\mu)_g^{(1)}+(E_\mu E^\mu)_g^{(0)}}{8\pi}+\frac{(B_\mu B^\mu)_g^{(1)}+(B_\mu B^\mu)_g^{(0)}}{8\pi}\right) = \sum_g \frac{c\Delta\xi\Delta\eta}{4\pi}\left(E_\mu\epsilon^{\mu\nu\kappa}\partial_\nu B_\kappa-B_\mu\epsilon^{\mu\nu\kappa}\partial_\nu E_\kappa\right)_g^{(1/2)}-\sum_g J_g\Delta\xi\Delta\eta(E_\mu I^\mu)_g^{(1/2)}. \tag*{(39)}

On the left-hand side we can now recognize the definition of the field energies as described by eqs. (22)–(23). The first term on the right-hand side is the divergence of the Poynting-flux vector; this discrete integral (expressed by the sum over all grid points gg) vanishes under periodic boundary conditions. This can be easily shown for the one-dimensional case by expanding the sum,

∑i=0N[−Eη(i+1/2)(Bζ(i+1)−Bζ(i))+Eζ(i+1/2)(Bη(i+1)−Bη(i))+Bη(i)(Eζ(i+1/2)−Eζ(i−1/2))−Bζ(i)(Eη(i+1/2)−Eη(i−1/2))]=0,(40)\sum_{i=0}^{N}\left[-E_{\eta(i+1/2)}(B_{\zeta(i+1)}-B_{\zeta(i)})+E_{\zeta(i+1/2)}(B_{\eta(i+1)}-B_{\eta(i)})+B_{\eta(i)}(E_{\zeta(i+1/2)}-E_{\zeta(i-1/2)})-B_{\zeta(i)}(E_{\eta(i+1/2)}-E_{\eta(i-1/2)})\right]=0, \tag*{(40)}

where every term can indeed be canceled out if the 0-th and NN-th grid points are identical. This argument can easily be extended to two and three dimensions as well. The right-hand side in eq. (39) thus reduces to the second term and can be used to denote the change in field energy between two subsequent time levels,

ΔUFΔt=−∑gJgΔξΔη(EμIμ)g(1/2),(41)\frac{\Delta U_{\mathrm{F}}}{\Delta t}=-\sum_g J_g\Delta\xi\Delta\eta(E_\mu I^\mu)_g^{(1/2)}, \tag*{(41)}

where the remaining term represents energy exchange between fields and particles. We now have to verify that this term is identical to the energy-exchange term obtained from the particle equations. To do so we start from eq. (20) and contract both sides with vipi(1/2)v_{ip}^{i(1/2)},

mpvipi(1/2)vpi(1)−vpi(0)Δt=qp(viEi+viϵijkvjBk)p(1/2).(42)m_p v_{ip}^{i(1/2)}\frac{v_p^{i(1)}-v_p^{i(0)}}{\Delta t}=q_p\left(v_iE^i+v_i\epsilon^{ijk}v_jB_k\right)_p^{(1/2)}. \tag*{(42)}

In the last term on the right-hand side, we can recognize viϵijkvjBk=0v_i\epsilon^{ijk}v_jB_k=0 since this is the dot product of vv with the cross product between itself and BB. Like before, we rewrite the half-integer timesteps as temporal averages in the left-hand side, and we take the sum over all particles pp to get

∑pmΔt(vivi)p(1)−(vivi)p(0)2=∑pqp(viEi)p(1/2).(43)\sum_p\frac{m}{\Delta t}\frac{(v_iv^i)_p^{(1)}-(v_iv^i)_p^{(0)}}{2}=\sum_p q_p(v_iE^i)_p^{(1/2)}. \tag*{(43)}

We can recognize the definition of the kinetic energy as shown in eq. (24) and use the expression for interpolated quantities (eq. (21)) in the right hand side:

ΔUKΔt=∑pqpvipi(1/2)∑gwgp(jiEi)g(1/2).(44)\frac{\Delta U_{\mathrm{K}}}{\Delta t}=\sum_p q_pv_{ip}^{i(1/2)}\sum_g w_{gp}(j_iE^i)_g^{(1/2)}. \tag*{(44)}

Since the interpolation weight from grid to particles wgpw_{gp} is the same as the weight from particles to grid wpgw_{pg}, it is possible to switch the order of the summations,

ΔUKΔt=∑g∑pqpvipi(1/2)wpg(jiEi)g(1/2),(45)\frac{\Delta U_{\mathrm{K}}}{\Delta t}=\sum_g\sum_p q_pv_{ip}^{i(1/2)}w_{pg}(j_iE^i)_g^{(1/2)}, \tag*{(45)}

and by adding the missing factors we can recover the right-hand side of eq. (18) for the current density,

ΔUKΔt=∑gJgΔξΔη(jiEi)g(1/2)(ji−1Iμ)gJgΔξΔη∑pwpgqpvpi(1/2).(46)\frac{\Delta U_{\mathrm{K}}}{\Delta t}=\sum_g J_g\Delta\xi\Delta\eta(j_iE^i)_g^{(1/2)}\frac{(j_i^{-1}I^\mu)_g}{J_g\Delta\xi\Delta\eta}\sum_p w_{pg}q_pv_p^{i(1/2)}. \tag*{(46)}

Substituting and rearranging the Jacobian factors results in

ΔUKΔt=∑gJgΔξΔη(jiνjνμEνIμ)g(1/2)(47)\frac{\Delta U_{\mathrm{K}}}{\Delta t} = \sum_g J_g \Delta\xi\Delta\eta\left(j^i{}_\nu j^\nu{}_\mu E^\nu I^\mu\right)^{(1/2)}_g \tag*{(47)}

where we now recognize the metric jiνjνμ=gνμj^i{}_\nu j^\nu{}_\mu= g_{\nu\mu} and use it to lower the index of the electric field, such that

ΔUKΔt=∑gJgΔξΔη(EμIμ)g(1/2)(48)\frac{\Delta U_{\mathrm{K}}}{\Delta t} = \sum_g J_g \Delta\xi\Delta\eta\left(E_\mu I^\mu\right)^{(1/2)}_g \tag*{(48)}

where the energy-exchange term with the field energy is recovered. Combining the change in kinetic energy (A14) and field energy (A7) gives the change in total energy of the system between time steps,

ΔUΔt=ΔUKΔt+ΔUFΔt=∑gJgΔξΔη(EμIμ)g(1/2)−∑gJgΔξΔη(EμIμ)g(1/2)=0.(49)\frac{\Delta U}{\Delta t} = \frac{\Delta U_{\mathrm{K}}}{\Delta t} + \frac{\Delta U_{\mathrm{F}}}{\Delta t} = \sum_g J_g \Delta\xi\Delta\eta\left(E_\mu I^\mu\right)^{(1/2)}_g - \sum_g J_g \Delta\xi\Delta\eta\left(E_\mu I^\mu\right)^{(1/2)}_g = 0. \tag*{(49)}

Since this vanishes exactly between any two timesteps, the method conserves the total energy UU exactly (to machine precision) independently of the timestep, grid spacing, and any other numerical parameter.

Acknowledgements

This work was supported by the KU Leuven Bijzonder Onderzoeksfonds (BOF) under the C1 project TRACESpace. J.C. acknowledges support from the European Union Horizon 2020 project DEEP-SEA (Grant agreement 955606). L.P. acknowledges support from a PhD grant awarded by the Royal Observatory of Belgium. F.B. acknowledges support from the FED-tWIN programme (profile Prf-2020-004, project “ENERGY”) issued by BELSPO. G.L. acknowledges support from the European Research Council (ERC) Advanced Grant “TerraVirtualE”. The computational resources and services used in this work were provided by the VSC (Flemish Supercomputer Center), funded by the Research Foundation – Flanders (FWO) and the Flemish Government – department EWI.

References

  1. [1]Bacchini, F. 2023, ApJS, 268, 60
  2. [2]Bacchini, F., Amaya, J., & Lapenta, G. 2019, J. Phys: Conf. Ser., 1225, 012011
  3. [3]Birn, J., Drake, J. F., Shay, M. A., et al. 2001, Journal of Geophysical Research: Space Physics, 106, 3715, doi: https://doi.org/10.1029/1999JA900449
  4. [4]Bott, A. F. A., Arzamasskiy, L., Kunz, M. W., Quataert, E., & Squire, J. 2021, The Astrophysical Journal Letters, 922, L35, doi: 10.3847/2041-8213/ac37c2DOI
  5. [5]Bransgrove, A., Ripperda, B., & Philippov, A. 2021, Phys. Rev. Lett., 127, 055101, doi: 10.1103/PhysRevLett.127.055101DOI
  6. [6]Bret, A., Gremillet, L., & Dieckmann, M. E. 2010, Physics of Plasmas, 17, 120501, doi: 10.1063/1.3514586DOI
  7. [7]Chacón, L., & Chen, G. 2016, Journal of Computational Physics, 316, 578, doi: https://doi.org/10.1016/j.jcp.2016.03.070
  8. [8]Chen, G., Chacón, L., & Barnes, D. C. 2011, Journal of Computational Physics, 230, 7018
  9. [9]Chen, G., Chacón, L., Leibs, C., Knoll, D., & Taitano, W. 2014, Journal of Computational Physics, 258, 555, doi: 10.1016/j.jcp.2013.10.052DOI
  10. [10]Chen, Y., & Tóth, G. 2019, Journal of Computational Physics, 386, 632, doi: 10.1016/j.jcp.2019.02.032DOI
  11. [11]Crinquand, B., Cerutti, B., Dubus, G., Parfrey, K., & Philippov, A. 2022, Phys. Rev. Lett., 129, 205101, doi: 10.1103/PhysRevLett.129.205101DOI
  12. [12]Decyk, V. K., & Singh, T. V. 2014, Computer Physics Communications, 185, 708, doi: https://doi.org/10.1016/j.cpc.2013.10.013
  13. [13]Delzanno, G. L., Camporeale, E., Moulton, J. D., et al. 2013, IEEE Transactions on Plasma Science, 41, 3577, doi: 10.1109/TPS.2013.2290060DOI
  14. [14]Drake, J., Agapitov, O., Swisdak, M., et al. 2021, Astronomy and astrophysics (Berlin), 650, A2
  15. [15]El Mellah, I., Cerutti, B., Crinquand, B., & Parfrey, K. 2022, Astronomy and Astrophysics, 663, A169, doi: 10.1051/0004-6361/202142847DOI
  16. [16]Fichtl, C. A., Finn, J. M., & Cartwright, K. L. 2012, Computational Science and Discovery, 5, 014011, doi: 10.1088/1749-4699/5/1/014011DOI
  17. [17]Fundamenski, W., Garcia, O., Naulin, V., et al. 2007, Nuclear Fusion, 47, 417, doi: 10.1088/0029-5515/47/5/006DOI
  18. [18]Galishnikova, A., Philippov, A., Quataert, E., et al. 2023, Phys. Rev. Lett., 130, 115201, doi: 10.1103/PhysRevLett.130.115201DOI
  19. [19]Goldston, R. J., & H, R. P. 1995, Introduction to plasma physics, 1st edn. (IOP Publishing Ltd)
  20. [20]Gonzalez-Herrero, D., Micera, A., Boella, E., Park, J., & Lapenta, G. 2019, Computer Physics Communications, 236, 153, doi: https://doi.org/10.1016/j.cpc.2018.10.026
  21. [21]Innocenti, M. E., Boella, E., Tenerani, A., & Velli, M. 2020, The Astrophysical Journal Letters, 898, L41, doi: 10.3847/2041-8213/aba591DOI
  22. [22]Innocenti, M. E., Tenerani, A., & Velli, M. 2019, The Astrophysical Journal, 870, 66, doi: 10.3847/1538-4357/aaf1beDOI
  23. [23]Jolliet, S., Bottino, A., Angelino, P., et al. 2007, Computer Physics Communications, 177, 409, doi: https://doi.org/10.1016/j.cpc.2007.04.006
  24. [24]Joseph, R. G., Ravunnikutty, G., Ranka, S., D’Azevedo, E., & Klasky, S. 2011, in 2011 IEEE International Parallel and Distributed Processing Symposium, 395–406, doi: 10.1109/IPDPS.2011.46
  25. [25]Krasheninnikov, S. 2001, Physics Letters A, 283, 368, doi: https://doi.org/10.1016/S0375-9601(01)00252-3
  26. [26]Lapenta, G. 2017, Journal of Computational Physics, 334, 349, doi: https://doi.org/10.1016/j.jcp.2017.01.002
  27. [27]Liseikin, V. D. 1999, Grid generation methods, Vol. 1 (Springer)
  28. [28]Markidis, S., & Lapenta, G. 2011a, Journal of Computational Physics, 230, 7037, doi: 10.1016/j.jcp.2011.05.033DOI
  29. [30]Markidis, S., Lapenta, G., & Rizwan-Uddin. 2010, Mathematics and Computers in Simulation, 80, 7
  30. [31]Micera, A., Zhukov, A. N., López, R. A., et al. 2021, The Astrophysical Journal, 919, 42, doi: 10.3847/1538-4357/ac1067DOI
  31. [32]Ohtsuka, H., Kimura, H., Shimomura, S., et al. 1978, Plasma Physics, 20, 749, doi: 10.1088/0032-1028/20/8/003
  32. [33]Parfrey, K., Philippov, A., & Cerutti, B. 2019, Phys. Rev. Lett., 122, 035101, doi: 10.1103/PhysRevLett.122.035101DOI
  33. [34]Ringle, R. 2011, International journal of mass spectrometry, 303, 42
  34. [35]Sironi, L., & Narayan, R. 2015, The Astrophysical Journal, 800, 88, doi: 10.1088/0004-637X/800/2/88DOI
  35. [36]Stanier, A., & Chacón, L. 2022, Journal of Computational Physics, 459, 111144, doi: https://doi.org/10.1016/j.jcp.2022.111144
  36. [37]Vasileska, I., Bogdanović, L., & Kos, L. 2021, in 2021 44th International Convention on Information, Communication and Electronic Technology (MIPRO), 291–294, doi: 10.23919/MIPRO52101.2021.9596959DOI
  37. [38]Weibel, E. S. 1959, Physical review letters, 2, 83
  38. [39]Wyper, P. F., DeVore, C. R., Antiochos, S. K., et al. 2022, The Astrophysical Journal Letters, 941, L29, doi: 10.3847/2041-8213/aca8aeDOI

Paper details

vlnc:W_qstb5mn4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents