13
Computer Physics Communications 156 (2003) 73–85 www.elsevier.com/locate/cpc A new charge conservation method in electromagnetic particle-in-cell simulations T. Umeda , Y. Omura, T. Tominaga, H. Matsumoto Radio Science Center for Space and Atmosphere, Kyoto University, Uji, Kyoto 611-0011, Japan Received 5 June 2003; accepted 11 August 2003 Abstract We developed a fast algorithm for solving the current density satisfying the continuity equation of charge in electromagnetic particle-in-cell (PIC) simulations. In PIC simulations of the charge conservation, a particle trajectory over one time step is conventionally assumed to be a straight line. In the present new scheme we assume that a particle trajectory is a zigzag line. Compared with the Villasenor–Buneman method and Esirkepov’s method, the present scheme has an advantage in computation speed without any substantial distortion of physics. 2003 Elsevier B.V. All rights reserved. PACS: 52.65.R Keywords: Charge conservation; Continuity equation; EM PIC code 1. Introduction Electromagnetic particle-in-cell (PIC) codes are widely used for studies of nonlinear wave-particle interactions in plasmas. In electromagnetic PIC codes, Maxwell’s equations and the equations of motion are solved in self- consistent manner. Electric and magnetic fields, current and charge densities are defined at spatial grid points, while charged particles can take arbitrary positions. Electromagnetic fields at a position of a particle are interpolated from those at adjacent grid points. On the other hand, the current density J and charge density ρ at each grid point are computed from velocities and positions of charged particles. That is, a charge q and a charge flux of a particle q v q(v x ,v y ,v z ) are assigned to the surrounding grid points with an area-weighting [1,2]. For example, with the first-order shape-factor (form-factor) (1) S i (ξ) = 1 −|ξ i | for |ξ i | 1, 0 for |ξ i | > 1 * Corresponding author. E-mail addresses: [email protected] (T. Umeda), [email protected] (Y. Omura). 0010-4655/$ – see front matter 2003 Elsevier B.V. All rights reserved. doi:10.1016/S0010-4655(03)00437-5

T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

  • Upload
    yuratol

  • View
    29

  • Download
    1

Embed Size (px)

Citation preview

Page 1: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

c

agneticstep is

igzag line.mputation

actionsin self-

nts, whileted from

eith the

Computer Physics Communications 156 (2003) 73–85

www.elsevier.com/locate/cp

A new charge conservation method in electromagneticparticle-in-cell simulations

T. Umeda∗, Y. Omura, T. Tominaga, H. Matsumoto

Radio Science Center for Space and Atmosphere, Kyoto University, Uji, Kyoto 611-0011, Japan

Received 5 June 2003; accepted 11 August 2003

Abstract

We developed a fast algorithm for solving the current density satisfying the continuity equation of charge in electromparticle-in-cell (PIC) simulations. In PIC simulations of the charge conservation, a particle trajectory over one timeconventionally assumed to be a straight line. In the present new scheme we assume that a particle trajectory is a zCompared with the Villasenor–Buneman method and Esirkepov’s method, the present scheme has an advantage in cospeed without any substantial distortion of physics. 2003 Elsevier B.V. All rights reserved.

PACS: 52.65.R

Keywords: Charge conservation; Continuity equation; EM PIC code

1. Introduction

Electromagnetic particle-in-cell (PIC) codes are widely used for studies of nonlinear wave-particle interin plasmas. In electromagnetic PIC codes, Maxwell’s equations and the equations of motion are solvedconsistent manner. Electric and magnetic fields, current and charge densities are defined at spatial grid poicharged particles can take arbitrary positions. Electromagnetic fields at a position of a particle are interpolathose at adjacent grid points. On the other hand, the current densityJ and charge densityρ at each grid point arecomputed from velocities and positions of charged particles. That is, a chargeq and a charge flux of a particlqv ≡ q(vx, vy, vz) are assigned to the surrounding grid points with an area-weighting [1,2]. For example, wfirst-order shape-factor (form-factor)

(1)Si(ξ)={

1− |ξ − i| for |ξ − i| � 1,0 for |ξ − i|> 1

* Corresponding author.E-mail addresses: [email protected] (T. Umeda), [email protected] (Y. Omura).

0010-4655/$ – see front matter 2003 Elsevier B.V. All rights reserved.doi:10.1016/S0010-4655(03)00437-5

Page 2: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

74 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

buted by

ey areby each

tisfy theelectric

us toescribedvement,shes, theof chargebetween

ght line.s shownf threes-points

spatial profiles of the charge density in three dimensions are given by the superposition of a charge contrieach particle,

(2)ρ(i, j, k)= 1

�x�y�z

Np∑n=1

qnSi

(xn

�x

)Sj

(yn

�y

)Sk

(zn

�z

),

whereNp,�x,�y,�z respectively represent the number of particles, grid spacing in thex, y andz directions, andthe subscriptn represents thenth particle. While the charge densityρ is defined at full-integer grid points(i, j, k),the current densitiesJx , Jy andJz are respectively defined at(i + 1

2, j, k), (i, j + 12, k) and(i, j, k + 1

2) from thedifference form of the continuity equation for charge

0= ρt+�t(i, j, k)− ρt (i, j, k)

�t+ J

t+�t/2x (i + 1

2, j, k)− Jt+�t/2x (i − 1

2, j, k)

�x

+ Jt+�t/2y (i, j + 1

2, k)− Jt+�t/2y (i, j − 1

2, k)

�y

(3)+ Jt+�t/2z (i, j, k + 1

2)− Jt+�t/2z (i, j, k − 1

2)

�z.

The current densitiesJx , Jy andJz at each grid point are computed with different shape-factors, because thdefined at different spatial grid points. They are computed by the superposition of a charge flux contributedparticle,

(4)Jx(i + 1

2, j, k) = 1

�x�y�z

Np∑n=1

qnvxnSi+1/2

(xn

�x

)Sj

(yn

�y

)Sk

(zn

�z

),

(5)Jy(i, j + 1

2, k) = 1

�x�y�z

Np∑n=1

qnvynSi

(xn

�x

)Sj+1/2

(yn

�y

)Sk

(zn

�z

),

(6)Jz(i, j, k + 1

2

) = 1

�x�y�z

Np∑n=1

qnvznSi

(xn

�x

)Sj

(yn

�y

)Sk+1/2

(zn

�z

).

It is well known that the current densities obtained by the simple area-weighting scheme (4)–(6) do not sacontinuity equation for charge exactly. In this case we have to solve Poisson’s equation for correction offields [1–3].

There are several numerical techniques for solving the continuity equation locally [4–8], which allowsavoid solving Poisson’s equation at every time step. They are called “charge conservation methods”. As dby Eastwood [5], a charge flux of a particle can be computed from the start and end points of the particle mowhen both start and end points are located in the same cell. When a particle moves across the cell meparticle movement is assigned to separate motions in each cell by the cell meshes. From superpositionflux, charge conservation can be realized for any particle trajectories made up of straight line segmentsany start and end points.

In the Villasenor–Buneman method [7], a particle trajectory over one time step is assumed to be a straiTherefore all start and end points of the particle trajectory segments are located along the straight line ain Fig. 1. Especially in the case of Fig. 1, the original particle movement is described with movements oparticles. The algorithm of the Villasenor–Buneman method is complex, because the computation of crosof a particle trajectory and cell meshes is realized with several “IF” statements.

Page 3: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 75

ajectory.

s.

along then

ments offied inon,utation

’s method

to be a

spacing,. Weis paper,od and

Fig. 1. Decomposition of a charge flux by the Villasenor–Buneman method in a two-dimensional system. (a) The original particle tr(b) The charge flux is decomposed into segmentsF 1, F2 andF3 at the sides of the cell square, whereqv = F1 + F2 + F3. The dashed linesrepresent cell meshes. The number of segments is determined by the number of cross-points of a particle trajectory and cell meshe

Fig. 2. Decomposition of a charge flux by Esirkepov’s method. (a) In two dimensions a charge flux is decomposed into four segmentsx andy axes. (b) In three dimensions a charge flux is decomposed into twelve segments along thex,y andz axes. Each segment has its owweight as specified in the figure.

In Esirkepov’s method [8], a charge flux is decomposed into movements of four particles along thex andyaxes in two dimensions as shown in Fig. 2(a). In three dimensions, a charge flux is decomposed into movetwelve particles along thex, y andz axes as shown in Fig. 2(b). Each segment has its own weight as speciFig. 2, because the sum of charge flux segments is equal toqv. Since each particle moves only in one dimensialgorithm of Esirkepov’s method becomes easier and is realized without any “IF” statements. The compspeed also becomes faster than that of the Villasenor–Buneman method. Another advantage of Esirkepovis that it is easy to apply to higher-order shape-factors.

In charge conservation methods, a particle trajectory over one time step is conventionally assumedstraight line. However, when a particle moves from(x, y, z) to (x + vx�t, y + vy�t, z + vz�t) for one timestep, the particle can take an arbitrary trajectory as long as it does not move more than one grid�x > vx�t,�y > vy�t,�z > vz�t . In other words, a particle trajectory needs not to be a straight linedeveloped a new charge conservation method assuming that a particle trajectory is a zigzag line. In thwe describe the new scheme and check its validity by comparing it with the Villasenor–Buneman methEsirkepov’s method in test simulations.

Page 4: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

76 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

e

omputedned

idpoint

nt patternrticle at

e thatticle

ticlee Fig. 1).jectory

2. Zigzag scheme in two-dimensional systems

In two dimensions the difference form of the continuity equation is written as

Jt+�t/2x (i + 1

2, j)− Jt+�t/2x (i − 1

2, j)

�x+ J

t+�t2

y (i, j + 12)− J

t+�t/2y (i, j − 1

2)

�y

(7)= ρt (i, j)− ρt+�t(i, j)

�t.

Let us think of a particle with a chargeq moving from(xt , yt ) to (xt+�t, yt+�t). We define

(8)x1 ≡ xt , x2 ≡ xt+�t = xt + v

t+�t/2x �t,

y1 ≡ yt , y2 ≡ yt+�t = yt + vt+�t/2y �t,

and

(9)i1 ≡ floor(x1/�x), i2 ≡ floor(x2/�x),

j1 ≡ floor(y1/�y), j2 ≡ floor(y2/�y),

wherei andj are the largest integer values not greater thanx/�x andy/�y respectively, which are given by th“floor” function. We also assume that the particle does not move more than grid spacings�x and�y for one timestep�t , namely,vx�t <�x, vy�t <�y.

When a particle remains in the same cell square during its movement, a charge flux of a particle can be cfrom the start point(x1, y1) and end point(x2, y2) of the particle movement. Charge conservation of the assigcurrent densities is realized with the procedure described by Eastwood [5],

(10)

Jx(i1 + 1

2, j1) = 1

�x�yFx(1−Wy), Jx

(i1 + 1

2, j1 + 1) = 1

�x�yFxWy,

Jy(i1, j1 + 1

2

) = 1

�x�yFy(1−Wx), Jy

(i1 + 1, j1 + 1

2

) = 1

�x�yFyWx,

where(Fx,Fy)≡ F represents charge flux given by

(11)Fx = qx2 − x1

�t, Fy = q

y2 − y1

�t,

andW represents the first-order shape-factor corresponding to the linear weighting function defined at the mbetween the start point(x1, y1) and the end point(x2, y2)

(12)Wx = x1 + x2

2�x− i1, Wy = y1 + y2

2�y− j1.

When a particle moves across cell meshes, we decompose the particle movement with a special assignmeas shown in Figs. 3 and 4. We have to think of the following four cases depending on positions of the patime t and t + �t : (a) i1 �= i2 andj1 �= j2, (b) i1 �= i2 andj1 = j2, (c) i1 = i2 andj1 �= j2, and (d)i1 = i2 andj1 = j2.

(a) Wheni1 �= i2 andj1 �= j2, the particle moves across two cell meshes. As shown in Fig. 3, we assumthe movement of the particle from(x1, y1) to (x2, y2) is described as movements of two particles. One parmoves from(x1, y1) to ((i1 + 1)�x, (j1 + 1)�y)= (i2�x, j2�y), and another particle moves from(i2�x, j2�y)

to (x2, y2) during the time fromt to t +�t . Therefore the particle trajectory becomes a “zigzag” line. If the partrajectory is assumed to be a straight line, the particle movement is decomposed into three segments (seBy assuming that the particle trajectory is such a zigzag line in Fig. 3, the cross-point of the particle tra

Page 5: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 77

tasier and

mas

tmto

line path.putation

caserocedureent offrom

Fig. 3. Particle trajectory of the two-dimensional zigzag scheme fori1 �= i2 and j1 �= j2 (case (a)). One particle moves from(x1, y1) to((i1 + 1)�x, (j1 + 1)�y) = (i2�x,j2�y), and another particle moves from(i2�x,j2�y) to (x2, y2) during the time fromt to t + �t . Thesolid arrows represent particle trajectories. The dashed lines represent cell meshes.

Fig. 4. Particle trajectory of the two-dimensional zigzag scheme fori1 �= i2, j1 = j2 (case (b)). One particle moves from(x1, y1) to((i1 + 1)�x,

y1+y22 ) = (i2�x,

y1+y22 ), and another particle moves from(i2�x,

y1+y22 ) to (x2, y2) during the time fromt to t + �t . Here

i1 + 1 = i2. The solid arrows represent particle trajectories. The dashed lines represent cell meshes. By interchangingx andy, the case (b) istransformed to the case (c).

and cell meshes can be determined independently of the positions of the particle att andt +�t . Since we do noneed to compute two cross-points of the particle trajectory and cell meshes, computation becomes much efaster.

(b) When i1 �= i2 and j1 = j2, the particle moves to one of the adjacent cells in thex direction. In thiscase one particle moves from(x1, y1) to ((i1 + 1)�x,

y1+y22 ) = (i2�x,

y1+y22 ), and another particle moves fro

(i2�x,y1+y2

2 ) to (x2, y2) during the time fromt to t + �t . The particle trajectory also becomes a zigzag lineshown in Fig. 4.

(c) Wheni1 = i2 andj1 �= j2, the particle moves to one of the adjacent cells in they direction. We assume thaone particle moves from(x1, y1) to ( x1+x2

2 , (j1 + 1)�x) = ( x1+x22 , j2�x), and that another particle moves fro

( x1+x22 , j2�x) to (x2, y2) during the time fromt to t + �t . Thus the particle trajectory becomes very similar

that in case (b).In both cases (b) and (c), the number of segments is two, and is same as that of the case of a straight

However, since we do not need to compute one cross-point of the particle trajectory and a cell mesh, combecomes easier.

(d) Wheni1 = i2 andj1 = j2, the particle remains in the same cell square during its movement. In thiswe do not need to decompose the particle movement into two segments, and we can directly apply the pin Eq. (10) for computation of charge flux at each grid point. However, we formally assume that the movema particle from(x1, y1) to (x2, y2) is described as movements of two particles. That is, one particle moves(x1, y1) to ( x1+x2

2 ,y1+y2

2 ), and another particle moves from( x1+x22 ,

y1+y22 ) to (x2, y2) during the time fromt to

t +�t .

Algorithm. To reduce the four cases listed above, we introduce a relay point of particle movement(xr , yr) and thecharge fluxesF 1 andF 2. That is, one particle moves from(x1, y1) to (xr , yr) and another moves from(xr, yr) to

Page 6: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

78 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

,

general,s also

ly the

ints at

We notes,

le movesto extend

(x2, y2) during the time fromt to t +�t . In a simple one-dimensional case, the relay pointxr is given by

(13)xr ={

x1+x22 , for i1 = i2,

max(i1�x, i2�x), for i1 �= i2.

In this paper we propose the following algorithm for computing the relay point(xr, yr ) without any “IF” statement

(14)xr = min

[min(i1�x, i2�x)+�x,max

{max(i1�x, i2�x), x1+x2

2

}],

yr = min[min(j1�y, j2�y)+�y,max

{max(j1�y, j2�y),

y1+y22

}].

It is noted that computation speeds of the above two algorithms depend on CPU and compiler. Incomputation of an algorithm with “IF” statements takes much time. However, the algorithm in Eq. (13) iuseful on a computer system in which computation speed of an “IF” statement is very fast.

By using(xr, yr), a charge fluxqv = q(vx, vy) is decomposed intoF 1 = (Fx1,Fy1) andF 2 = (Fx2,Fy2) asfollows:

(15)Fx1 = q

xr − x1

�t, Fy1 = q

yr − y1

�t,

Fx2 = qx2 − xr

�t= qvx − Fx1, Fy2 = q

y2 − yr

�t= qvy − Fy1.

We next apply the algorithm in Eq. (10) for computation of charge flux at each grid point. That is, we appshape-factors defined at the midpoints between(x1, y1) and (xr , yr), and (xr, yr) and (x2, y2), respectively, toassign the segmentsF 1 andF 2 to the adjacent grid points. This is because the particles exist at the midpotime t + �t

2 [5,7]. The first-order shape-factors at the midpoints are defined by

(16)

Wx1 = x1 + xr

2�x− i1, Wy1 = y1 + yr

2�y− j1,

Wx2 = xr + x2

2�x− i2, Wy2 = yr + y2

2�y− j2.

The segments of the charge flux assigned to 8 grid points are obtained by the following procedure.

(17)

Jx(i1 + 1

2, j1) = 1

�x�yFx1(1−Wy1), Jx

(i1 + 1

2, j1 + 1) = 1

�x�yFx1Wy1,

Jy(i1, j1 + 1

2

) = 1

�x�yFy1(1−Wx1), Jy

(i1 + 1, j1 + 1

2

) = 1

�x�yFy1Wx1,

Jx(i2 + 1

2, j2) = 1

�x�yFx2(1−Wy2), Jx

(i2 + 1

2, j2 + 1) = 1

�x�yFx2Wy2,

Jy(i2, j2 + 1

2

) = 1

�x�yFy2(1−Wx2), Jy

(i2 + 1, j2 + 1

2

) = 1

�x�yFy2Wx2.

Finally we superpose the charge fluxes contributed by each particle to obtain the total current densities.that we can apply the simple area-weighting scheme (2) for computation ofJz component in two dimensionbecauseJz is free from the charge continuity equation (7).

3. Extension to three dimensions

In three dimensions we have to think of eight cases depending on a particle movement whether a particacross cell meshes or not. The eight cases can be reduced to four cases as listed in Table 1. It is very easy

Page 7: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 79

shed lines

ensionalajectory

is reduced

ux is

Table 1Different cases of the particle positions at timest andt +�t in the three-dimensionalzigzag scheme

i1 �= i2 j1 �= j2 k1 �= k2 Case (a)

i1 = i2 j1 �= j2 k1 �= k2 Case (b)i1 �= i2 j1 = j2 k1 �= k2i1 �= i2 j1 �= j2 k1 = k2

i1 = i2 j1 = j2 k1 �= k2 Case (c)i1 = i2 j1 �= j2 k1 = k2i1 �= i2 j1 = j2 k1 = k2

i1 = i2 j1 = j2 k1 = k2 Case (d)

Fig. 5. Particle trajectories for the three-dimensional zigzag scheme. The solid arrows represent particle trajectories. The darepresent cell meshes. (a) Fori1 �= i2 and j1 �= j2 and k1 �= k2, one particle moves from(x1, y1, z1) to ((i1 + 1)�x, (j1 + 1)�y,

(k1 + 1)�z) = (i2�x,j2�y,k2�z), and the other moves from(i2�x,j2�y,k2�z) to (x2, y2, z2) during the time fromt to t + �t . (b) Fori1 �= i2, j1 �= j2, k1 = k2, one particle moves from(x1, y1, z1) to ((i1+1)�x, (j1+1)�y,

z1+z22 ). The other moves from(i2�x,j2�y,

z1+z22 )

to (x2, y2, z2). (c) For i1 �= i2, j1 = j2, k1 = k2, one particle moves from(x1, y1, z1) to ((i1 + 1)�x,y1+y2

2 ,z1+z2

2 ). The other moves from

(i2�x,y1+y2

2 ,z1+z2

2 ) to (x2, y2, z2). (d) Fori1 = i2 andj1 = j2 andk1 = k2, a particle moves from(x1, y1, z1) to (x2, y2, z2).

the two-dimensional zigzag scheme to the three-dimensional one. Using the same procedure of the two-dimcase described in Section 2, we can illustrate particle trajectories for four cases in Fig. 5. If the particle trbetween the start point(x1, y1, z1) and end point(x2, y2, z2) is a straight line, the number of segments varies 1∼4depending on the locations of the start and end points. By using the zigzag paths, the number of segmentsto 2.

In all cases a charge flux is also decomposed into two segments:F 1 ≡ (Fx1,Fy1,Fz1) andF 2 ≡ (Fx2,Fy2,Fz2).By using a relay point(xr, yr, zr ) given by the algorithm in Eq. (14) or Eq. (13) each segment of the charge flgiven by

(18)

Fx1 = qxr − x1

�t, Fy1 = q

yr − y1

�t, Fz1 = q

zr − z1

�t,

Fx2 = qx2 − xr

�t= qvx − Fx1, Fy2 = q

y2 − yr

�t= qvy − Fy1,

Fz2 = qz2 − zr

�t= qvz −Fz1.

Page 8: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

80 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

e-factors

ased ond with

set thetron

We assign each segment of the charge flux to the adjacent grid points using the following first-order shapdefined at the midpoints(xr ,yr ,zr )+(x1,y1,z1)

2 and (x2,y2,z2)+(xr ,yr ,zr )2 ,

(19)Wx1 = x1 + xr

2− i1, Wy1 = y1 + yr

2− j1, Wz1 = z1 + zr

2− k1,

Wx2 = xr + x2

2− i2, Wy2 = yr + y2

2− j2, Wz2 = zr + z2

2− k2.

The charge fluxesF 1 andF 2 are assigned to 24 grid points as written in the following procedure.For l = 1,2

(20)

Jx(il + 1

2, jl, kl) = 1

�x�y�zFxl(1−Wyl)(1−Wzl),

Jx(il + 1

2, jl + 1, kl) = 1

�x�y�zFxlWyl(1−Wzl),

Jx(il + 1

2, jl, kl + 1) = 1

�x�y�zFxl(1−Wyl)Wzl,

Jx(il + 1

2, jl + 1, kl + 1) = 1

�x�y�zFxlWylWzl,

Jy(il , jl + 1

2, kl) = 1

�x�y�zFyl(1−Wxl)(1−Wzl),

Jy(il + 1, jl + 1

2, kl) = 1

�x�y�zFylWxl(1−Wzl),

Jy(il , jl + 1

2, kl + 1) = 1

�x�y�zFyl(1−Wxl)Wzl,

Jy(il + 1, jl + 1

2, kl + 1) = 1

�x�y�zFylWxlWzl,

Jz(il, jl, kl + 1

2

) = 1

�x�y�zFzl(1−Wxl)(1−Wyl),

Jz(il + 1, jl, kl + 1

2

) = 1

�x�y�zFzlWxl(1−Wyl),

Jz(il, jl + 1, kl + 1

2

) = 1

�x�y�zFzl(1−Wxl)Wyl,

Jz(il + 1, jl + 1, kl + 1

2

) = 1

�x�y�zFzlWxlWyl.

Total current densities are obtained by superposition of the charge flux contributed by each particle.

4. Test simulations

We performed test simulations using new two- and three-dimensional electromagnetic PIC codes bKyoto university ElectroMagnetic Particle cOde (KEMPO) [9]. The simulation source codes were compileIntel Fortran Complier 5.0, and the test runs were performed on a single Pentium III 1.0 GHz processor.

We first performed simulations of an electron two-stream instability for testing electrostatic fields. Weexternal static magnetic field in thex direction. The electron cyclotron frequency is equal to the total elec

Page 9: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 81

g

ermal

r

hown inrkepov’sneman

the threeing due tod thermal

al runsation.

ethodsnumber

an earlierial profileswhen the

loadedx. Wetrono

ofmation

ns withspectral

Fig. 6. Average CPU time used for the computation of current density for one time step. The experimental data of the present zigzascheme,Esirkepov’s method and the Villasenor–Buneman method are respectively plotted as square, circle and x-marks.

plasma frequencyωce = ωpe = 1.0. We assumed two electron beams with the equal density and the equal thvelocity vt = 1.0. One electron beam drifts against the other electron beam with drift velocityvd = 4.0vt alongthe magnetic field. Ions are assumed to be immobile background, and we used a reduced speed of lightc = 20vt .We set that time step isωpe�t = 0.025, and that grid spacing is�x = �y = �z = 1.0λD, whereλD = vt /ωpe isDebye length. We varied number of superparticles per cell for both electron beams,ne1 andne2, as a parametefor different simulation runs. Two-dimensional simulation runs were performed on 256× 256 grid points withne1 = ne2 = 22, 42, 62, 82. Three-dimensional simulation runs were performed on 64× 64× 64 grid points withne1 = ne2 = 13, 23, 33.

We measured average CPU time used for the computation of current density for one time step. As sFig. 6, in both two- and three-dimensional runs the present zigzag scheme works faster than both Esimethod and Villasenor–Buneman method. We also plotted the total energy history for the Villasenor–Bumethod, Esirkepov’s method and the present zigzag scheme in Fig. 7. We found little difference betweenmethods. In all methods, total energy increases as time elapses because of stochastic numerical heatenhanced thermal fluctuations. However, using many superparticles per cell, we can reduce the enhancefluctuations substantially.

To analyze electrostatic fields, we plotted spatial profiles of electrostatic potentials for the two-dimensionwith ne1 = ne2 = 82 in Fig. 8. The profiles of electrostatic potentials are given by solving Poisson’s equIn all runs we started with the same initial condition. At the saturation stage (ωpet = 64: time step= 2560),all runs give the same spatial profiles of the electrostatic potentials. Atωpet = 128 (time step= 5120), there isstill little difference of the spatial profiles of electrostatic potentials between the three methods. Atωpet = 256(time step= 10240), on the other hand, the difference of electrostatic potentials between the three mbecomes apparent. This difference is due to the accumulation of numerical error. When we used fewerof superparticles per cell, the difference of electrostatic potentials between the three methods appears instage. However, in both two- and three-dimensional runs, the present zigzag scheme gives the same spatof electrostatic potentials as those obtained by Esirkepov’s method and the Villasenor–Buneman method,numerical error is suppressed by using a large number of superparticles per cell.

Next we analyzed electromagnetic fields by performing simple two- and three-dimensional test runs. Weboth electron and ion species with Maxwellian velocity distribution functions uniformly in the simulation boset the external static magnetic field in thex direction. The electron cyclotron frequency is equal to the elecplasma frequencyωce = ωpe = 1.0. We set that grid spacing is�x = �y = �z = 2.0λD . Ions are assumed thave a reduced mass ratio 100, and the temperature ratioTe/Ti is equal to 1.0. We used a reduced speedlight c = 6vt . To compute spectrum of the enhanced thermal fluctuations, we performed Fourier transforof Bz simulation data in both time and space. In Fig. 9 we show the result of the three-dimensional rune = ni = 1, in which the enhanced thermal fluctuations are the most intense. Fig. 9 corresponds to

Page 10: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

82 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

scheme.

he

nhe threeed by the.es. Whenrid pointeightingomerticles. A wave

elengthly muchmber oferefore

ffect the

Fig. 7. Total energy history for (top) the Villasenor–Buneman method, (middle) Esirkepov’s method and (bottom) the present zigzagThe number of superparticle per cell is varied for different simulation runs. Total energy is normalized by the initial total energy.

wave energy densities|cBz(ω, kx,0,0)|2 and|cBz(ω,0, ky,0)|2 normalized by the thermal energy density of telectronsnemeV

2te = (meωpeVte/e)

2. In all ω–kx spectra, we can find enhancement ofR mode,L mode andwhistler mode waves. In allω−ky spectra, we can find enhancement ofX mode and harmonic electron cyclotrowaves. Even with one particle per cell, we found little difference in the spectra of normal modes between tmethods. The present test simulation runs show that both electrostatic and electromagnetic fields obtainpresent zigzag scheme are the same as those obtained by the conventional charge conservation methods

The numerical error between the three methods arises when a particle trajectory crosses the cell meshwe consider the current density computed from a motion of only one particle, the obtained value at each gis very different from each other. This is because a segment of the charge flux is assigned with different wfunctions. However, when we take average ofJx , Jy andJz at adjacent grid points, the results respectively becqvx , qvy andqvz, i.e. the same for the three methods. In other words, when distribution and motion of pain adjacent cells are almost uniform, the numerical error between the three methods becomes almost zeromode with the minimum wave length is supported by two grid spacings. Such a mode with a short wavis subject to the numerical error. However, since wavelengths of electromagnetic modes are commonlonger than two grid spacings, they are not affected by the numerical error. By superposing a large nuparticle motions, distribution and motion of particles in adjacent cells can be regarded as uniform, and ththe numerical error of one particle does not become effective. The trajectory of each particle does not asimulation result as confirmed by the present test simulations.

Page 11: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 83

)

mputationsethodss the celltic waves

Fig. 8. Spatial profiles of electrostatic potentials in the two-dimensional runs withne1 = ne2 = 82, for (a) the Villasenor–Buneman method, (bEsirkepov’s method and (c) the present zigzagscheme.

5. Conclusion

The procedures of the present zigzag scheme are itemized below.

(1) Compute the relay point(xr, yr, zr ) by

xr = min[min(i1�x, i2�x)+�x,max

{max(i1�x, i2�x), x1+x2

2

}],

(21)yr = min[min(j1�y, j2�y)+�y,max

{max(j1�y, j2�y),

y1+y22

}],

zr = min[min(k1�z,k2�z)+�z,max

{max(k1�z,k2�z), z1+z2

2

}].

(2) Compute charge fluxesF 1 andF 2 by

(22)F 1 = q

{(xr, yr , zr )− (x1, y1, z1)

}/�t,

F 2 = q{(x2, y2, z2)− (xr , yr, zr )

}/�t = qv − F 1.

(3) AssignF 1 andF 2 to the adjacent grid points with the shape-factors defined at{(xr, yr, zr ) + (x1, y1, z1)}/2and{(x2, y2, z2)+ (xr, yr, zr )}/2, respectively.

The advantage of the present zigzag scheme is that the computation speed becomes faster because cofor different particle trajectories are realized without any “IF” statements, while accuracy of the three mare the same. The numerical error between the three methods arises when a particle trajectory crossemeshes. However, the three methods give the same spatial profiles of both electromagnetic and electrosta

Page 12: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

84 T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85

nnsity of the

useful for

wn thatt we canalizations of the

KDKpported

Fig. 9. Spectral wave energy densities|cBz(ω, kx,0,0)|2 and|cBz(ω,0, ky,0)|2 in the runs withne = ni = 1, for (top) the Villasenor–Bunemamethod, (middle) Esirkepov’s method and (bottom) the present zigzag scheme. The intensity is normalized by the thermal energy deelectronsnemeV

2te = (meωpeVte/e)

2.

when the thermal noises are suppressed by using many particles per cell. Thus the present scheme iselectromagnetic PIC simulations.

In this paper we used the first-order shape-factor which corresponds to the linear interpolation. It is knohigher-order shape-factor reduces the numerical noises substantially in PIC simulations. We expect thaapply the higher-order algorithms described by Eastwood [5] to the zigzag scheme straightforward. Generof charge conservation method to curvilinear meshes was implemented by Eastwood et al. [6]. Applicationzigzag scheme to higher-order algorithms and arbitrary coordinate systems are left as future studies.

Acknowledgements

We thank H. Usui for useful discussions. The computer simulations were performed in part on thecomputer system at Radio Science Center for Space and Atmosphere, Kyoto University. This work was su

Page 13: T.umeda Y.omura,T.tominaga,H.matsumoto.a New Charge Conservation Method in Electromagnetic Particle-In-cell Simulations

T. Umeda et al. / Computer Physics Communications 156 (2003) 73–85 85

ellows,

1.

by Ministry of Education, Culture, Sports, Science and Technology, Grant-in-Aid for JSPS Research F03821.

References

[1] R.W. Hockney, J.W. Eastwood, Computer Simulation Using Particles, McGraw-Hill, New York, 1981.[2] C.K. Birdsall, A.B. Langdon, Plasma Physics via Computer Simulation, McGraw-Hill, New York, 1985.[3] P.J. Mardahl, J.P. Verboncoeur, Comput. Phys. Comm. 106 (1997) 219.[4] R.L. Morse, C.W. Nielson, Phys. Fluids 14 (1971) 830.[5] J.W. Eastwood, Comput. Phys. Comm. 64 (1991) 252.[6] J.W. Eastwood, W. Arter, N.J. Brealey, R.W. Hockney, Comput. Phys. Comm. 87 (1995) 155.[7] J. Villasenor, O. Buneman, Comput. Phys. Comm. 69 (1992) 306.[8] T.Z. Esirkepov, Comput. Phys. Comm. 135 (2001) 144.[9] Y. Omura, H. Matsumoto, in: H. Matsumoto, Y. Omura (Eds.), Computer Space Plasma Physics, Terra Science, Tokyo, 1993, p. 2