On the discrete conservation of the Gauss-Poisson equation of plasma Physics F. Bouchut Universite d'Orleans et CNRS, UMR 6628 Departement de Mathematiques BP 6759 45067 Orleans cedex 2, France e-mail: fbouchut@labomath.univ-orleans.fr Abstract We consider numerical methods which exactly preserve the Gauss-Poisson equation when solving the charge conservation and Maxwell-Ampere's equations. Apart from the well-known leap-frog method, we present two situations where this property is veried, one with rectangular mesh and functions dened at the center of the cells, and one with a nite volume type of formulation on triangles. Key-words. Gauss-Poisson equation, exact discrete conservation, discrete divergence. PACS '96 Classication Codes. Primary 52.65.-y, 41.20.Bt, 02.70.Fj, 02.70.Dh. Sur la conservation discrete de l'equation de Gauss-Poisson de la physique des plasmas Resume Nous considerons des methodes numeriques qui conservent exactement l'equation de Gauss-Poisson quand on resout les equations de conservation de la charge et de Maxwell-Ampere. Mise a part la methode saute-mouton bien connue, nous presentons deux situations ou cette propriete est veriee, une sur un maillage rectangulaire et avec des fonctions denies au centre des mailles, et une avec une formulation de type volumes nis sur des triangles. Mots-cles. Equation de Gauss-Poisson, conservation discrete exacte, divergence discrete. 1 1 Introduction We consider numerical methods for solving the charge conservation and MaxwellAmpere's equations of plasma Physics @t + div j @t E c2 curl B = 0; (1.1) = "1 j; (1.2) 0 where is the charge density, j is the current density and E; B are the electromagnetic elds. These equations have to be completed so as to determine the evolution of B and j . For example, B can solve the Maxwell-Faraday equation @tB + curl E = 0: (1.3) For j , there are mainly two possibilities: either uid equations or kinetic equations. We do not assume here any peculiar form for these supplementary relations. We rather study the striking property of only (1.1)-(1.2) which lies in the Gauss-Poisson equation, which is obtained as follows. If we subtract (1.1) from the divergence of "0 (1.2), we get @ ("0 div E ) = 0: (1.4) Therefore, the law "0 div E = (1.5) is preserved at any time if it is satised initially, and this holds independently of the choice of additional relations on B and j . When dealing with numerical methods, the accuracy at which (1.5) is true is very important to get physically relevant results. One usually uses a Poisson corrector [1], [7]. This procedure can be described as follows. From the density and electric eld and E at time nt (t denotes the timestep), we compute +1 and a prediction E +1 at time (n + 1)t by a given method, then we set t n n n n pred E n+1 where the correction E +1 n =E +1 n (1.6) n has to solve "0 div E n+1 In practice, we choose E the Poisson equation +1 + E +1 ; n pred = +1 n n+1 : "0 div Epred (1.7) +1 = r +1, so we are led to to be a gradient eld E +1 "0 ncor n n cor = +1 "0 div E +1: (1.8) The drawbacks of this method are well-known. { It introduces an unnatural non-local dependence (and also a dependence on arbitrary boundary conditions). n n pred 2 { It involves a high computational time, and it is dicult to use on vector or parallel computers. An attempt to bypass this last (and most serious) diculty is to use an approximate method for solving (1.8), see [9], [8]. Another method consists in draining the error in Gauss-Poisson equation by suitable dispersive equations so that it is absorbed in boundary conditions [10]. In an ideal method, there should exist an exact discrete conservation of the GaussPoisson equation (1.5). This situation can be roughly described as follows: we look for discrete versions of (1.1) and (1.2), and a discrete divergence div such that (1.4) is replaced by "0 div E +1 +1 = "0 div E ; (1.9) d n n n d n d and this should be automatically satised without further correction. It was known for a long time [1] that such methods exist. However, at least in the context of the resolution of Vlasov's equation by a PIC (particle in cell) method, these methods have been known to give very low resolution, compared to the Poisson correction method. The rst method to work successfully with PIC methods was introduced by J. Villasenor and O. Buneman [11]. It consists in a precise current assignment by area weighting. Then, a general formulation by time-space nite element was introduced by J.W. Eastwood [4]. It has been found to be ecient in conjunction with PIC methods, and it can be used in complex geometries [5]. In this paper, we consider (1.1) and (1.2) in two dimensions, that is @t + div j @tE = 0; (1.10) + c2(rB )? = "1 j; 0 (1.11) where , B are scalar and j , E are vectors. Here, z? denotes the image of the twodimensional vector z by the rotation of angle =2. Our aim is not to build a method which satises the discrete Gauss-Poisson equation, this could only be done after specifying the additional relations on B and j . Rather, we look for specic discrete forms of (1.10)-(1.11) that automatically satisfy an exact conservation of the type (1.9), disregarding the nature of the additional equations on B and j , in the same way as (1.4) corresponds to (1.1)-(1.2). These specic discrete forms can be viewed as analogous of conservative forms used in the numerical computation of conservation laws. Here we are mainly concerned with uid equations, in which (1.1) can be easily written in conservative form. Therefore, we will not deal with the problem of realizing (1.1) for PIC methods, which is connected to what is usually called "current assignment". 3 yj Ey , jy B y j+1/2 Ex ,jx y j-1/2 B Ex ,jx ρ B B Ey , jy x i-1/2 xi x i+1/2 Figure 1: rectangle (i; j ) and location of quantities in the case of staggered grid 2 The case of rectangles and staggered grid The well-known situation where (1.9) happens to be veried can be described as follows. We assume that quantities are dened on a rectangular grid of lengths x and y, according to Figure 1. The indices i and j refer to the space position (x = ix; y = j y ), while n refers to the time nt. If a numerical scheme for (1.10)-(1.11) can be put under the form t (j +1 2 j +1 2 ) + t (j +1 2 j +1 2 ) = 0; +1 + (2.1) 12 12 x +1 2 y +1 2 i n n n ij ij i = n = ;j c2t i = n = ;j = i;j n = j = i;j = t j +1 2 ; (2.2) +1 2 +1 2 ( B +1 2 +1 2 B +1 2 1 2) = y "0 +1 2 2 (E ) +1+1 2 (E ) +1 2 + cxt (B +1+1 22 +1 2 B +11 22 +1 2) = " t j +1+1 22; (2.3) 0 +1 2 +1 2 +1 2 for some numerical uxes (j +1 2 ), (j +1 2) and (B +1 2 +1 2), then "0 "0 P ( E ) +1 2 ( E ) 1 2 + ( E ) +1 2 (E ) 1 2 (2.4) x y is in fact independent of n. It is easily obtained by plugging (2.1)-(2.3) into the expression giving P +1 P . Let us underline that, as stated in introduction, we have not dened what should be the numerical uxes (j +1+1 22 ), (j +1+1 22) and (B +1+1 22 +1 2). Their denition should of course depend on what equations we want to solve for B and j . The above dened P is independent of n, independently of this choice. This property relies on the specic form of (2.1)-(2.3). +1 (E ) +1 2 n x i = ;j (E ) +1 2 n x n y i;j i i = i n n y = i;j n i n ij = i n = ;j n x n = ;j i;j = n = ;j = i = i = n = ;j = n n ij ij i n = i = i;j = n = ;j n = = ;j n n ij 4 = n i;j i = = n y = ;j = = ;j = i n x = ;j = = ;j y = = = ;j n i;j i;j = = n = ij n i = = ;j = This formulation is adapted to the usual leap-frog method for Maxwell's equations, because in that case (2.2)-(2.3) hold, while B evolves according to Maxwell-Faraday's equation @ B div E ? = 0; (2.5) which is discretized by t (E ) +1 2 12 B +1 2 +1 2 B +1 2 +1 2 + ( E ) +1 2 +1 +1 2 x (2.6) t (E ) ( E ) +1 2 = 0: +1 2 +1 y Therefore, this situation is a special case of the more general one dened by (2.1)-(2.3) where B can evolve according to a dierent law. t n = i n = ;j = i = n = ;j y = n i ;j y = i;j = n x 3 n i x = ;j i = ;j The case of rectangles and centered values We now describe a situation where quantities are dened at the centers of the cells, according to Figure 2. If a numerical scheme for (1.10)-(1.11) can be put under the form t (j +1 2 j +1 2 ) + t (j +1 2 j +1 2 ) = 0; +1 + (3.1) 12 12 x +1 2 y +1 2 +1 2 +1 2 c2 t B 1 2 +1 2 + B +1 2 +1 2 +1 (E ) (E ) y 2 (3.2) ! +1 2 +1 2 +1 2 +1 2 B 1 2 1 2 + B +1 2 1 2 t j 1 2 + j +1 2 = " ; 2 2 n n n ij ij i = n = ;j n n x x ij n (E ) y +1 ij (E ) + n y n n = ;j = = i;j n = = i;j = = i = ;j = ij i n = = ;j = i n i ij = n = ;j = +1 2 x i = = n = 2 = = ;j = n 2 n i = = ;j = i i = = ;j 0 = ;j = ! +1 2 +1 2 1 2 1 2 + B 1 2 +1 2 = n Bi n = = ;j +1 2 1 2 + B +1 2 +1 2 c2t Bi+1=2;j n i t j = = ;j +1 2 + j +1 2 12 +1 2 n = i;j = "0 n = i;j 2 (3.3) = = ; for some numerical uxes (j +1+1 22 ), (j +1+1 22) and (B +1+1 22 +1 2), then "0 P +1 2 +1 2 ( E ) +1 ( E ) + (E ) +1 +1 (E ) +1 2x "0 ( E ) +1 +1 (E ) +1 + (E ) +1 (E ) + 2 (3.4) y 1 + +1 +1 + +1 + 4 +1 is in fact independent of n. As in Section 2, it is easily obtained by plugging (3.1)-(3.3) into P +1+12 +1 2 P +1 2 +1 2, and this result does not depend on the choice of evolution equations for B and j . n i = n i n = ;j = i;j n = n = ;j x = i n i x ;j n i n i y ;j n ;j i ;j n = ;j = i = ;j n i x ;j n i = 5 = n x i;j n y = = ;j i i;j n y ;j n n i;j i;j i;j n y i;j y j+1/2 jy (B) (B) jx yj jx ρ, E x, E y , B y j-1/2 (B) (B) jy x i-1/2 xi x i+1/2 Figure 2: rectangle (i; j ) and location of quantities in the case of centering This situation is very close to the staggered grid case of Section 2. However, when solving the complementary Maxwell-Faraday equation (2.5), we are led to a dierent method, which is written as follows. We now consider centered values B +1 2 of B , and the vertex values appearing in (3.2), (3.3) are dened by 1 B +1 2 + B +1 2 + B +1 2 + B +1 2 : +1 2 (3.5) B +1 2 +1 2 = +1 +1 +1 +1 4 With (3.5), we can reformulate (3.2), (3.3), and we also write a similar equation for the evolution of B . We obtain 2 2 + 2B +1 2 + B +1 2 (E ) +1 (E ) c8yt B +11 +1 +1 +1 +1 (3.6) +1 2 +1 2 t j 1 2 + j +1 2 +1 2 +1 2 +1 2 B 1 1 2B 1 B +1 1 = ; "0 2 2 2 (E ) +1 (E ) + c8xt B +1+1 2 1 + 2B +1+1 2 + B +1+1 +1 +1 2 +1 2 (3.7) t j 1 2 + j +1 2 +1 2 +1 2 +1 2 ; B 1 1 2B 1 B 1 +1 = "0 2 t (E ) +1 2 B 1 2 B 1 +1 + 2(E ) +1 + (E ) +1 +1 8y (E ) 1 1 2(E ) 1 (E ) +1 1 (3.8) t (E ) + 8 +1 1 + 2(E ) +1 + (E ) +1 +1 x (E ) 1 1 2(E ) 1 (E ) 1 +1 = 0: n ij n n x x ij n = i = ;j = n i;j = n n ij i = n i;j = n ;j = i n = i;j n ;j = i ;j = i ;j n n i n y y ij = n ;j = n i;j n n ij i i = n ;j = n ;j i n ij = n ij = n ;j i = = n ;j i y i y i i i n x i;j n y ;j i ;j n ;j 6 = ;j n x ;j n y = i;j n x i;j n ;j n = ;j n x i n = i;j n x ;j = = ;j ;j = i n x i = i n n n = ;j ;j = i i = y i n ;j y i ;j i ;j = This leap-frog type method (3.6)-(3.8) to solve Maxwell's equations (if j 0 in (3.6)(3.7)) with unknowns E , B +1 2 seems to be new. We can compute its discrete dispersion relation, which is given by #2 " #2 !t " ct 1 + cos( k y ) 1 + cos( k x) ct 2 sin 2 = 2x sin(k x) + 2y sin(k y) ; 2 2 (3.9) where ! is the pulsation and k = (k ; k ) the wavevector. By expressing the right-hand 2 side in terms of cos2(k x=2) and that its maximum over cos (k 2y=2), we can2check all real values of k , k is max (ct=2x) ; (ct=2y) . Since ! has to be real for stability, this method is stable if and only if the CFL condition ! ct ct max (3.10) x ; y 2 is satised. Notice that if all functions are independent of y, (3.7), (3.8) reduce to (2.3), (2.6), with double x and y. The dierence is that (3.6)-(3.8) induce smaller phase velocities when k is not parallel to the coordinate axis, thus allowing larger Courant numbers. This method can be used to solve uid problems, together with the splitting method, see [2]. n n ij ij = y x x y x y x x 4 y y The case of triangles and centered values Let us now consider a mesh of triangles (T ) . We are going to introduce a discrete formulation of (1.10)-(1.11) that satises an exact conservation, as stated in (1.9), independently of the evolution of B and j . We assume that the charge density and the electric eld E are dened at the center of each triangle (see Figure 3), and we write a nite volume formulation for (1.10) t X jej +1 2 n = 0; +1 + (4.1) jT j i i n n n i i e i a e = ie Ti where n refers to the time nt, jT j is the area of T , e a T means that "e is an edge of T ", jej is the length of e, and n is the unit normal to e which is exterior to T . The numerical ux +1 2 is proportional to n and is an approximation of the component of j in the n direction, i i i i ie n i = ie e ie en+1=2 ' (j +1 2 n n = ie )n ie (4.2) : We write a discrete version of (1.11) as follows, t X jej B +1 2 n? = t j E +1 E + c2 n n i i jT j i n a e e Ti 7 = ie "0 +1 2 ; n i = (4.3) nie Me Gi Figure 3: triangle T i 1 X jej ( +1 2 n ) G M!; jT j +1 2 = n ji = n i a e (4.4) = ie e i e Ti where G is the gravity center of T , M is the middle of e, and B +1 2 is an approximation of the value of B on e. If a numerical scheme for (1.10)-(1.11) can be put under the form (4.1),(4.3) for some numerical uxes +1 2 and B +1 2 (that depend on the evolution equations for +1 2 being dened by (4.4); then there exists discrete quantities that B and j ), j approximate "0 div E and that are independent of time. More precisely, consider a vertex V , and let H be the union of the triangles T having V as a vertex (see Figure 4). Let ' be the continuous function, with compact support in H , which is linear on each triangle of H and such that '(V ) = 1. Dene E (x) to be constant by triangle equal to E , and (x) to be constant by triangle equal to . Then the quantity Z Z Z P "0 ' div E ' = ' (4.5) i i n = n e n n e e = = e = i i n n n i n i n n V H n H H is independent of n. In order to prove this property, let us dene j +1 2(x) to be constant by cell equal to j +1 2. Then, by (4.3) we get Z t +1 2 +1 j ' div E E + "0 Z = r' E +1 E + " t j +1 2 0 X t +1 2 +1 = j T j ( r') E E + j (4.6) "0 0 1 X X = (r') @c2t jejB +1 2 n? A n n = = i n n n = H n n n = H i Ti i n n n i i i H n Ti = 0; i H = a e = e ie Ti because when e is an external edge of H , (r') n? = 0 since ' vanishes on the boundary of H , and the interior contributions cancel two by two. Then, by (4.4), i 8 ie eex V ein Figure 4: set H of triangles around a vertex V . e : internal edge, e : external edge. Z Z j +1 2 r' ' div j +1 2 = X = jT j j +1 2 (r') # X "X ! +1 2 = jej n G M (r') "a # X X +1 2 = jej n '(M ) '(G ) a Z 1 X jej +1 2 n ; = ' in n ex n = = H H n i Ti = i i H n = ie e Ti H e n H e i (4.7) e ie i Ti jH j H e = e Ti i Ti n a e = He e H where e a H means that e is an external edge of H , because again, the interior contributions cancel two by two, and '(G ) = 1=3. Therefore, (4.6) yields Z ' div(E +1 E ) X Z (4.8) = jHtj jej +1 2 n : "0 i n n n H a ' e H = e He H Now, by averaging (4.1) over all triangles T H , we get t X jej +1 2 n = 0; +1 + jH j i n n n H H e a e with H n Z n (4.9) i H i ' H n : (4.10) nH ; (4.11) H Finally, (4.8) and (4.9) lead to Z H He H ' X = jH1 j jT j = Z Ti "0 = ' div(E n+1 Z En) = +1 n H ' H 9 which means that P +1 = 0, and the proof is complete. PVn n V Notice that the above formulation makes use of both nite volume and nite element type of formulations. It does not seem to be possible to obtain similar results for the time-space nite element method of J.W. Eastwood [4]. However, there exists a nite volume method for Maxwell's equations which satises (1.9) on Delaunay-Vorono meshes, see F. Hermeline [6]. The formula (4.3) giving the approximation of curl B , which has vanishing discrete divergence according to (4.6), can also be used in dierent situations where a curl is involved, as in the MHD equations, see J.-P. Croisille, R. Khanr and G. Chanteur [3]. This formula can actually be interpreted as follows, in terms of non-conforming nite +1 2 +1 2 elements. Dene the function B (x) for x 2 T to be linear, with B (M ) = +1 2 +1 2 B for any edge e of T . Then, the function B (x) which coincides with B +1 2 in each triangle satises (4.12) (rB +1 2)? curl B +1 2 = curl B +1 2 + curl B +1 2 ; where the regular part curl B +1 2 is piecewise constant with value in T given by X curl B +1 2 = jT1 j jejB +1 2 n? ; (4.13) n = n i i n = n i e n = e i n = = i = n = n n = n = i r n = s r = n r;i i a e = e ie Ti and the singular part, which is small in the sense of measures, is of the form X curl B +1 2 = (x)b +1 2(x); n n = e s = e (4.14) e with the Dirac distribution supported by e, and b +1 2(x) is dened for x 2 e and is parallel to e. Moreover, b +1 2 is linear on e and b +1 2(M ) = 0. Equation (4.3) can thus be written t j +1 2: E +1 E c2 t curl B +1 2 = (4.15) n e n e n = e n n n = = e e r "0 = n = Now, the above function ' which is used to evaluate the discrete divergence satises Z (4.16) r' curl B +1 2 = 0: n = s Indeed, this quantity is well-dened because b +1 2 is parallel to e, and (4.16) holds because the average of b +1 2 on e vanishes. Therefore, Z Z r' curl B +1 2 = r' curl B +1 2 = 0; (4.17) n e n e = = n = n r and we recover the cancellation in (4.6). 10 = Let us nally notice that the interpolation formula (4.4) is consistent. Actually, we have for any vector v 1 X jej (v n ) G M!: v= (4.18) jT j a i e ie i e Ti In order to prove this identity, let us dene the function ! u(x) = G x w v; (4.19) i for a given vector w. Then div u = v w, and according to Stokes' formula, Z jT j v w = div u Z = un XZ = un a X = jej u(M ) n a X = jej G M! w (v n ); i Ti @Ti ie e Ti e Ti e e a e i (4.20) ie e ie Ti and (4.18) follows since (4.20) is true for any w. 5 Conclusion Whenever possible, a method having exact discrete conservation of the Gauss-Poisson law for solving the continuity equation (1.1) and Maxwell-Ampere's equation (1.2) has the great advantage of fast and easy to vectorize computations. We have shown that in two dimensions and for dierent geometries, this property holds as soon as the scheme can be put under a coherent form involving numerical uxes. Moreover, this is true independently of the way these uxes are computed, and therefore independently of the evolution of B and j . However, such methods are very constraining. Therefore, in each situation, one should look carefully if there exists such a method which is adapted to the given set of equations and to the geometry. 11 References [1] C.K. Birdsall and A.B. Langdon, Plasma Physics via computer simulation, Institute of Physics Publishing, London, 1991. [2] F. Bouchut and G. Bonnaud, Numerical simulation of relativistic plasmas in hydrodynamic regime, Proceedings of the ICIAM 95, Numerical analysis, scientic computing, computer science, Z. Angew. Math. Mech. 76 Suppl. 1, 287-290 (1996). [3] J.-P. Croisille, R. Khanr and G. Chanteur, Numerical simulation of the MHD equations by a kinetic-type method, J. Scient. Comp. 10, 81-92 (1995). [4] J.W. Eastwood, The virtual particle electromagnetic particle-mesh method, Comp. Phys. Comm. 64, 252-266 (1991). [5] J.W. Eastwood, W. Arter, N.J. Brealey and R.W. Hockney, Body-tted electromagnetic PIC software for use on parallel computers, Comp. Phys. Comm. 87, 155-178 (1995). [6] F. Hermeline, Two coupled particle-nite volume methods using Delaunay-Vorono meshes for the approximation of Vlasov-Poisson and Vlasov-Maxwell equations, J. Comp. Phys. 106, 1-18 (1993). [7] R.W. Hockney and J.W. Eastwood, Computer simulation using particles, AdamHilger, London, 1988. [8] A.B. Langdon, On enforcing Gauss's law in electromagnetic particle-in-cell codes, Comp. Phys. Comm. 70, 447-450 (1992). [9] B. Marder, A method for incorporating Gauss's law into electromagnetic PIC codes, J. Comp. Phys. 68, 48-55 (1987). [10] J.-L. Vay and C. Deutsch, A 3D electromagnetic particle-in-cell code to simulate heavy ion beam propagation in the reaction chamber, to appear in J. Fusion Engineering and Design (1996). [11] J. Villasenor and O. Buneman, Rigorous charge conservation for local electromagnetic eld solvers, Comp. Phys. Comm. 69, 306-316 (1992). 12