PHYSICAL REVIEW ACCELERATORS AND BEAMS 21, 054201 (2018)

Symplectic particle-in-cell model for space-charge beam dynamics simulation

Ji Qiang* Lawrence Berkeley National Laboratory, Berkeley, California 94720, USA

(Received 27 December 2017; published 29 May 2018)

Space-charge effects play an important role in high intensity particle accelerators and were studied using a variety of macroparticle tracking models. In this paper, we propose a symplectic particle-in-cell (PIC) model and compare this model with a recently published symplectic gridless particle model and a conventional nonsymplectic PIC model for long-term space-charge simulation of a coasting beam. Using the same step size and the same number of modes for the space-charge Poisson solver, all three models show qualitatively similar emittance growth evolutions and final phase space shapes in the benchmark examples. Quanti- tatively, the symplectic PIC and the symplectic gridless particle models agree with each other very well, while the nonsymplectic PIC model yields different emittance growth value. Using finer step size, the emittance growth from the nonsymplectic PIC converges towards that from the symplectic PIC model.

DOI: 10.1103/PhysRevAccelBeams.21.054201

I. INTRODUCTION computers. However, the computational cost of this model is proportional to the number of macroparticles times the The nonlinear space-charge effects from particle inter- number of modes used to solve the Poisson equation. When actions inside a charged particle beam play an important the number of modes is large, this model becomes quite role in high-intensity accelerators. A variety of models have computationally expensive and one has to resort to parallel been developed to simulate the space-charge effects [1–13]. computers. Among those models, the particle-in-cell (PIC) model is In this paper, we propose a symplectic PIC model for probably the most widely used model in the accelerator self-consistent space-charge long-term simulation. This community. The particle-in-cell model is an efficient model model has the advantages of the computational efficiency to handle the space-charge effects self-consistently. It uses a of the PIC method and the symplectic property needed for computational grid to obtain the charge density distribution long-term dynamics tracking. The multisymplectic par- from a finite number of macroparticles and solves the ticle-in-cell model was proposed to study the Vlasov- Poisson equation on the grid at each time step. The Maxwell system in plasmas using a variational method computational cost is linearly proportional to the number [15–18]. A symplectic gridless spectral electrostatic model of macroparticles, which makes the simulation fast for in a periodic plasma was also proposed following the many applications. However, those grid-based, momentum variational method [19]. To the best of our knowledge, conserved, PIC codes do not satisfy the symplectic con- at present, there is no symplectic PIC model that was dition of classic multiparticle dynamics. Violating the proposed and shown applications for the quasistatic symplectic condition in multiparticle tracking might not Vlasov-Poisson system in the space-charge beam dynamics be an issue in a single pass system such as a linear study. In this paper, we derived a symplectic PIC model accelerator. But in a circular accelerator, violating the directly from the multiparticle Hamiltonian. We then symplectic condition may result in undesired numerical carried out long-term space-charge simulations and com- errors in the long-term tracking simulation. Recently, a pared this model with the symplectic gridless particle symplectic gridless particle model was proposed for self- model and the nonsymplectic PIC model in two beam consistent space-charge simulation [14]. This model is easy dynamics applications. to implement and has a good scalability on massive parallel The organization of this paper is as follows: After the Introduction, we present the symplectic multiparticle *[email protected] tracking model including the space-charge effect in Sec. II. We present the nonsymplectic PIC model in Published by the American Physical Society under the terms of Sec. III. In Sec. IV, we compare the symplectic PIC model, the Creative Commons Attribution 4.0 International license. Further distribution of this work must maintain attribution to the symplectic gridless particle model, and the non- the author(s) and the published article’s title, journal citation, symplectic PIC model with two space-charge simulation and DOI. examples. Finally, in Sec. V we draw conclusions.

2469-9888=18=21(5)=054201(13) 054201-1 Published by the American Physical Society JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

1 II. SYMPLECTIC MULTIPARTICLE Letting expð− 2 τ∶H1∶Þ define a transfer map M1 and TRACKING MODELS expð−τ∶H2∶Þ a transfer map M2,forasinglestep,the In the accelerator beam dynamics simulation, for a multi- above splitting results in a second-order numerical integrator for the original Hamilton’s equation as particle system with Np charged particles subject to both a space-charge self-field and an external field, an approximate ζðτÞ¼MðτÞζð0Þ Hamiltonian of the system can be written as [20–22] 3 ¼ M1ðτ=2ÞM2ðτÞM1ðτ=2Þζð0ÞþOðτ Þ: ð7Þ XNp 1 XNp XNp XNp ¼ p2 2 þ φ¯ ðr r Þþ ψðr ÞðÞ H i = 2 q i; j q i 1 The above numerical integrator can be extended to ¼1 ¼1 ¼1 ¼1 i i j i fourth-order accuracy and arbitrary even-order accuracy ðr r … r p p … p ; Þ following Yoshida’s approach [24]. This numerical inte- where H 1; 2; ; Np ; 1; 2; ; Np s denotes the Hamiltonian of the system using distance s as an independent grator Eq. (7) will be symplectic if both the transfer map M M variable, φ¯ is the space-charge interaction potential (includ- 1 and the transfer map 2 are symplectic. A transfer M ing both the direct electric potential and the longitudinal map i is symplectic if and only if the Jacobian matrix Mi M vector potential) between the charged particles i and j of the transfer map i satisfies the following condition: (subject to appropriate boundary conditions), ψ denotes T ¼ ð Þ Mi JMi J 8 the potential associated with the external field, ri ¼ ðxi;yi; θi ¼ ωΔtÞ denotes the normalized canonical spatial 2 where J denotes the 6N × 6N matrix given by coordinates of particle i, pi ¼ðpxi;pyi;pti ¼ −ΔE=mc Þ the normalized canonical momentum coordinates of particle 0 I i,andω the reference angular frequency, Δt the time of flight J ¼ ð9Þ − 0 to location s, ΔE the energy deviation with respect to the I reference particle, m the rest mass of the particle, and c the 3 3 speed of light invacuum. The equations governing the motion and I is the N × N identity matrix. of individual particle i follow the Hamilton’s equations as For the Hamiltonian in Eq. (1), we can choose H1 as

dr ∂H XNp XNp i ¼ ; ð2Þ ¼ p2 2 þ ψðr Þ ð Þ H1 i = q i : 10 ds ∂pi i¼1 i¼1 dp ∂H i ¼ − : ð3Þ This corresponds to the Hamiltonian of a group of charged ds ∂r i particles inside an external field without mutual interaction Let ζ denote a 6N vector of coordinates; the above Hamilton’s among themselves. A single-charged particle magnetic equation can be rewritten as optics method can be used to find the symplectic transfer map M1 for this Hamiltonian with the external fields from dζ most accelerator beam line elements [21,22,25]. ¼ −½H; ζð4Þ ds We can choose H2 as where [,] is the Poisson bracket. A formal solution for above 1 XNp XNp τ ¼ φ¯ ðr r ÞðÞ equation after a single step can be written as H2 2 q i; j 11 i¼1 j¼1 ζðτÞ¼exp½−τð∶H∶Þζð0Þ: ð5Þ which includes the space-charge effect and is only a Here, we have defined a differential operator ∶H∶ as function of position. For the space-charge Hamiltonian ∶H∶g ¼½H; g, for arbitrary function g. For a Hamiltonian H2ðrÞ, the single step transfer map M2 can be written as that can be written as a sum of two terms H ¼ H1 þ H2,an r ðτÞ¼r ð0Þ ð Þ approximate solution to the above formal solution can be i i ; 12 written as [23] ∂H2ðrÞ piðτÞ¼pið0Þ − τ: ð13Þ ζðτÞ¼expð−τð∶H1∶ þ ∶H2∶ÞÞζð0Þ ∂r i 1 ¼ − τ∶ ∶ ð−τ∶ ∶Þ The Jacobi matrix of the above transfer map M2 is exp 2 H1 exp H2 0 1 3 I ×exp − τ∶H1∶ ζð0ÞþOðτ Þ: ð6Þ M2 ¼ ð14Þ 2 LI

054201-2 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

where L is a 3N × 3N matrix. For M2 to satisfy the XNl XNm lm symplectic condition Eq. (8), the matrix L needs to be a ρðx; yÞ¼ ρ sinðαlxÞ sinðβmyÞ; ð22Þ symmetric matrix, i.e. l¼1 m¼1

L ¼ LT: ð15Þ XNl XNm ϕð Þ¼ ϕlm ðα Þ ðβ Þ ð Þ 2 x; y sin lx sin my ; 23 ∂ H2ðrÞ Given the fact that L ¼ ∂p ðτÞ=∂r ¼ − τ, the l¼1 m¼1 ij i j ∂ri∂rj matrix L will be symmetric as long as it is analytically calculated from the function H2. This is also called jolt where factorization in the nonlinear single particle beam dynamics Z Z M 4 a b study [26]. If both the transfer map 1 and the transfer lm ρ ¼ ρðx; yÞ sinðαlxÞ sinðβmyÞdxdy; ð24Þ map M2 are symplectic, the numerical integrator Eq. (7) ab 0 0 for multiparticle tracking will be symplectic. For a coasting beam, the Hamiltonian H2 can be written Z Z 4 a b lm as [21] ϕ ¼ ϕðx; yÞ sinðαlxÞ sinðβmyÞdxdy; ð25Þ ab 0 0

XNp XNp ¼ K φðr r ÞðÞ α ¼ π β ¼ π H2 2 i; j 16 where l l =a and m m =b. The above approxima- i¼1 j¼1 tion follows the numerical spectral since each basis function satisfies the boundary conditions on the 2 2 where K ¼ qI=ð2πϵ0p0v0γ0Þ is the generalized perveance, wall [27–29]. For a smooth function, this spectral approxi- I is the beam current, ϵ0 is the permittivity of vacuum, p0 is mation has an accuracy whose numerical error scales as the momentum of the reference particle, v0 is the speed O½expð−cNÞ with c>0, where N is the number of the of the reference particle, γ0 is the relativistic factor of the basis function (i.e. mode number in each dimension) used reference particle, and φ is the space charge Coulomb in the approximation. By substituting the above expansions interaction potential. In this Hamiltonian, the effects of the into the Poisson Eq. (17) and making use of the ortho- direct Coulomb electric potential and the longitudinal normal condition of the sine functions, we obtain vector potential are combined together. The electric φ Coulomb potential in the Hamiltonian H2 can be 4πρlm obtained from the solution of the Poisson equation. In ϕlm ¼ ð Þ γ2 26 the following, we assume that the coasting beam is inside a lm rectangular perfectly conducting pipe. In this case, the two- ’ γ2 ¼ α2 þ β2 dimensional Poisson s equation can be written as where lm l m. In the simulation, the particle density distribution func- ∂2ϕ ∂2ϕ tion ρðx; yÞ can be represented as þ ¼ −4πρ ð17Þ ∂x2 ∂y2 1 XNp where ϕ is the electric potential, and ρ is the particle density ρð Þ¼ ð − Þ ð − ÞðÞ x; y Δ Δ S x xj S y yj 27 distribution of the beam. x yNp j¼1 The boundary conditions for the electric potential inside the rectangular perfectly conducting pipe are where SðxÞ is the unitless shape function (also called deposition function in the PIC model) and Δx and Δy ϕð ¼ 0 Þ¼0 ð Þ x ;y ; 18 are mesh size in each dimension. The use of the shape function can help smooth the density function when the ϕð ¼ Þ¼0 ð Þ x a; y ; 19 number of macroparticles in the simulation is much less than the real number of particles in the beam. Using the ϕðx; y ¼ 0Þ¼0; ð20Þ above equation and Eqs. (24) and (26), we obtain ϕð ¼ Þ¼0 ð Þ x; y b ; 21 N Z Z 4π 4 1 Xp 1 a b ϕlm ¼ ð − Þ ð − Þ 2 S x xj S y yj γ Δ Δ 0 0 where a is the horizontal width of the pipe and b is the lm ab Np j¼1 x y vertical width of the pipe. ðα Þ ðβ Þ ð Þ Given the boundary conditions in Eqs. (18)–(21), × sin lx sin my dxdy 28 the electric potential ϕ and the source term ρ can be approximated using two sine functions as [27–31] and the electric potential as

054201-3 JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

N Z Z 4 1 Xp XNl XNm 1 1 a b ϕð Þ¼4π ðα Þ ðβ Þ ð¯ − Þ ð¯ − Þ ðα ¯Þ ðβ ¯Þ ¯ ¯ ð Þ x; y 2 sin lx sin my S x xj S y yj sin lx sin my dxdy: 29 γ Δ Δ 0 0 ab Np j¼1 l¼1 m¼1 lm x y

The electric potential at a particle i location can be obtained from the potential as Z Z 1 a b ϕðxi;yiÞ¼ ϕðx; yÞSðx − xiÞSðy − yiÞdxdy ΔxΔy 0 0 N Z Z 4 1 Xp XNl XNm 1 1 a b ¼ 4π ð − Þ ð − Þ ðα Þ ðβ Þ γ2 Δ Δ S x xi S y yi sin lx sin my dxdy ab Np ¼1 ¼1 ¼1 lm x y 0 0 Zj Zl m 1 a b × Sðx − xjÞSðy − yjÞ sinðαlxÞ sinðβmyÞdxdy ð30Þ ΔxΔy 0 0 where the interpolation function to the particle location is assumed to be the same as the deposition function. From the above electric potential, the interaction potential φ between particles i and j can be written as Z Z 4 1 XNl XNm 1 1 a b φð Þ¼4π ð − Þ ð − Þ ðα Þ ðβ Þ xi;yi;xj;yj 2 S x xj S y yj sin lx sin my dxdy ab Np γ ΔxΔy 0 0 Zl¼1Zm¼1 lm 1 a b × Sðx − xiÞSðy − yiÞ sinðαlxÞ sinðβmyÞdxdy: ð31Þ ΔxΔy 0 0

Now, the space-charge Hamiltonian H2 can be written as

N N Z Z K 4 1 Xp Xp XNl XNm 1 1 a b H2 ¼ 4π Sðx − x ÞSðy − y Þ ðα xÞ ðβ yÞdxdy 2 γ2 Δ Δ j j sin l sin m ab Np ¼1 ¼1 ¼1 ¼1 lm x y 0 0 Z iZ j l m 1 a b × Sðx − xiÞSðy − yiÞ sinðαlxÞ sinðβmyÞdxdy: ð32Þ ΔxΔy 0 0

A. Symplectic gridless particle model In the symplectic gridless particle space-charge model, the shape function is assumed to be a Dirac delta function and the particle distribution function ρðx; yÞ can be represented as

1 XNp ρðx; yÞ¼ δðx − xjÞδðy − yjÞ: ð33Þ Np j¼1

Now, the space-charge Hamiltonian H2 can be written as

N N K 4 1 Xp Xp XNl XNm 1 H2 ¼ 4π ðα x Þ ðβ y Þ ðα x Þ ðβ y Þ: ð Þ 2 γ2 sin l j sin m j sin l i sin m i 34 ab Np i¼1 j¼1 l¼1 m¼1 lm

The one-step symplectic transfer map M2 of the particle i with this Hamiltonian is given as

N 4 1 Xp XNl XNm α p ðτÞ¼p ð0Þ − τ4πK l ðα x Þ ðβ y Þ ðα x Þ ðβ y Þ; xi xi γ2 sin l j sin m j cos l i sin m i ab Np j¼1 l¼1 m¼1 lm N 4 1 Xp XNl XNm β ðτÞ¼ ð0Þ − τ4π m ðα Þ ðβ Þ ðα Þ ðβ Þ ð Þ pyi pyi K γ2 sin lxj sin myj sin lxi cos myi : 35 ab Np j¼1 l¼1 m¼1 lm

Here, both pxi and pyi are normalized by the reference particle momentum p0.

054201-4 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

B. Symplectic particle-in-cell model

If the deposition/interpolation shape function is not a delta function, the one-step symplectic transfer map M2 of the particle i with this space-charge Hamiltonian H2 is given as

N Z Z 4 1 Xp XNl XNm 1 1 a b ðτÞ¼ ð0Þ − τ4π ð − Þ ð − Þ ðα Þ ðβ Þ pxi pxi K 2 S x xj S y yj sin lx sin my dxdy γ Δ Δ 0 0 ab Np j¼1 ¼1 m¼1 lm x y Z Z l a b 1 ∂Sðx − xiÞ × Sðy − yiÞ sinðαlxÞ sinðβmyÞdxdy; ΔxΔy 0 0 ∂xi N Z Z 4 1 Xp XNl XNm 1 1 a b ðτÞ¼ ð0Þ − τ4π ð − Þ ð − Þ ðα Þ ðβ Þ pyi pyi K 2 S x xj S y yj sin lx sin my dxdy γ Δ Δ 0 0 ab Np j¼1 l¼1 m¼1 lm x y Z Z a b 1 ∂Sðy − yiÞ × Sðx − xiÞ sinðαlxÞ sinðβmyÞdxdy; ð36Þ ΔxΔy 0 0 ∂yi

0 where both pxi and pyi are normalized by the reference particle momentum p0, and S ðxÞ is the first derivative of the shape function. Assuming that the shape function is a compact local function with respect to the computational grid, the integral in the above map can be approximated as

N 4 1 Xp XNl XNm 1 X X ðτÞ¼ ð0Þ − τ4π ð 0 − Þ ð 0 − Þ ðα 0 Þ ðβ 0 Þ pxi pxi K 2 S xI xj S yJ yj sin lxI sin myJ ab N γ 0 0 p j¼1 l¼1 m¼1 lm I J X X ∂ ð − Þ S xI xi ð − Þ ðα Þ ðβ Þ × ∂ S yJ yi sin lxI sin myJ ; I J xi N 4 1 Xp XNl XNm 1 X X ðτÞ¼ ð0Þ − τ4π ð 0 − Þ ð 0 − Þ ðα 0 Þ ðβ 0 Þ pyi pyi K 2 S xI xj S yJ yj sin lxI sin myJ ab N γ 0 0 p j¼1 l¼1 m¼1 lm I J X X ∂ ð − Þ ð − Þ S yI yi ðα Þ ðβ Þ ð Þ × S xI xi ∂ sin lxI sin myJ ; 37 I J yi where the integers I, J, I0, and J0 denote the two-dimensional computational grid index, and the summations with respect to those indices are limited to the range of a few local grid points depending on the specific deposition function. If one defines the density related function ρ¯ðxI0 ;yJ0 Þ on the grid as

1 XNp ρ¯ðxI0 ;yJ0 Þ¼ SðxI0 − xjÞSðyJ0 − yjÞ; ð38Þ Np j¼1 the space-charge map can be rewritten as

X X ∂ ð − Þ ðτÞ¼ ð0Þ − τ4π S xI xi ð − Þ pxi pxi K ∂ S yJ yi I J xi 4 XNl XNm 1 X X × ρ¯ðx 0 ;y 0 Þ sinðα x 0 Þ sinðβ y 0 Þ sinðα x Þ sinðβ y Þ ; ab γ2 I J l I m J l I m J l¼1 m¼1 lm I0 J0 X X ∂ ð − Þ ðτÞ¼ ð0Þ − τ4π ð − Þ S yI yi pyi pyi K S xI xi ∂ I J yi 4 XNl XNm 1 X X ρ¯ð 0 0 Þ ðα 0 Þ ðβ 0 Þ ðα Þ ðβ Þ ð Þ × 2 xI ;yJ sin lxI sin myJ sin lxI sin myJ : 39 ab γ 0 0 l¼1 m¼1 lm I J

054201-5 JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

It turns out that the expression inside the bracket represents the solution of potential on grid using the charge density on grid, which can be written as

4 XNl XNm 1 X X ϕð Þ¼ ρ¯ð 0 0 Þ ðα 0 Þ ðβ 0 Þ ðα Þ ðβ Þ ð Þ xI;yJ 2 xI ;yJ sin lxI sin myJ sin lxI sin myJ : 40 ab γ 0 0 l¼1 m¼1 lm I J

Then the above space-charge map can be rewritten in a more concise format as X X ∂ ð − Þ ðτÞ¼ ð0Þ − τ4π S xI xi ð − Þϕð Þ pxi pxi K ∂ S yJ yi xI;yJ ; I J xi X X ∂ ð − Þ ðτÞ¼ ð0Þ − τ4π ð − Þ S yJ yi ϕð Þ ð Þ pyi pyi K S xI xi ∂ xI;yJ : 41 I J yi

In the PIC literature, some compact function such as linear function and quadratic function is used in the simulation. For example, a quadratic shape function can be written as [32,33] 8 3 − > − ðxi xI Þ2; jx − x j ≤ Δx=2; <> 4 Δx i I j − j 2 Sðx − x Þ¼ 1 3 − xi xI Δ 2 j − j ≤ 3 2Δ ð42Þ I i > 2 2 Δx ; x= < xi xI = x; :> 0 otherwise;

8 − > −2ðxi xI Þ=Δx; jx − x j ≤ Δx=2; > Δx i I <> ð − Þ ∂Sðx − x Þ ð− 3 þ xi xI Þ=Δx; Δx=2 < jx − x j ≤ 3=2Δx; x >x; I i ¼ 2 Δx i I i I ð43Þ ∂ > ð − Þ xi > ð3 þ xi xI Þ Δ Δ 2 j − j ≤ 3 2Δ ≤ > 2 Δ = x; x= < xi xI = x; xi xI; :> x 0 otherwise:

The same shape function and its derivative can be applied to where r ¼ðx; yÞ, p ¼ðvx=v0;vy=v0Þ, and az is a unit the y dimension. vector in the longitudinal z direction. Using the symplectic transfer map M1 for the external The above equations can be solved using a second- field Hamiltonian H1 from a magnetic optics code and order leap-frog algorithm, which is widely used in many the transfer map M2 for space-charge Hamiltonian H2, one obtains a symplectic PIC model including the self- consistent space-charge effects.

III. NONSYMPLECTIC PARTICLE-IN-CELL MODEL In the nonsymplectic PIC model, for a coasting beam, the equations governing the motion of individual particle i follow the Lorentz equations as

dr i ¼ p ; ð44Þ ds i

dpi ¼ qðE =v0 − a × B Þ; ð45Þ ds i z i

FIG. 2. Four-dimensional emittance growth evolution from the symplectic gridless particle model (red), the symplectic FIG. 1. Schematic plot of a FODO lattice. PIC model (green), and the nonsymplectic spectral PIC (blue).

054201-6 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018) dynamics simulations. Here, for each step, the positions of Then the momenta of the particle are advanced a full step a particle i are advanced a half step by including the forces from the given external fields and the self-consistent space-charge fields. In the PIC model, the space-charge fields are obtained by solving the Poisson equation on a computational grid and then interpolating 1 back to the particle location. In this study, we employ the rðτ=2Þ ¼ rð0Þ þ τp ð0Þ: ð46Þ i i 2 i above spectral method to attain the space-charge fields as

FIG. 3. Final transverse phase space from the symplectic PIC model (top), from the symplectic gridless particle model (middle), and from the nonsymplectic spectral PIC model (bottom).

054201-7 JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

FIG. 4. Final horizontal (left) and vertical (right) density profiles from the symplectic gridless particle model (red), the symplectic PIC model (green), and the nonsymplectic spectral PIC (blue).

XNl XNm X X IV. BENCHMARK EXAMPLES 4 αl E ðx ;y Þ¼− ρðx 0 ;y 0 Þ sinðα x 0 Þ x I J ab γ2 I J l I l¼1 m¼1 lm I0 J0 In this section, we tested and compared the symplectic PIC model with the symplectic gridless particle model ðβ 0 Þ ðα Þ ðβ Þ ð Þ × sin myJ cos lxI sin myJ ; 47 and the nonsymplectic PIC model using two application examples. In both examples, the beam experienced strong

XNl XNm X X space-charge driven resonance. It was tracked including 4 βm ð Þ¼− ρð 0 0 Þ ðα 0 Þ self-consistent space-charge effects for several hundred Ey xI;yJ 2 xI ;yJ sin lxI ab γ 0 0 l¼1 m¼1 lm I J thousands of lattice periods using the above three models. In the first example, we simulated a 1 GeV coasting × sinðβ y 0 Þ sinðα x Þ cosðβ y Þ; ð48Þ m J l I m J proton beam transport through a linear periodic quadrupole focusing and defocusing (FODO) channel inside a rectan- ρð 0 0 Þ where the charge density xI ;yJ on the grid is obtained gular perfectly conducting pipe. A schematic plot of the following the charge deposition Eq. (38). The particle lattice is shown in Fig. 1. It consists of a 0.1 m focusing momenta can then be advanced one step using quadrupole magnet and a 0.1 m defocusing quadrupole magnet with a single period. The total length of the period ext qEx ext is 1 meter. The zero current phase advance through one pxiðτÞ¼pxið0Þþτ −qBy v0 XX þτ4πK SðxI −xiÞSðyJ −yiÞExðxI;yJÞ; I J ext qEy ext pyiðτÞ¼pyið0Þþτ þqBx v0 XX þτ4πK SðxI −xiÞSðyJ −yiÞEyðxI;yJÞ: ð49Þ I J

Here, both the direct electric Coulomb field and the magnetic field from the longitudinal vector potential are included in the space-charge force term of the above equation. Then, the positions of the particle are advanced another half step using the new momenta as

1 rðτÞ ¼ rðτ 2Þ þ τp ðτÞ ð Þ i = i 2 i : 50 FIG. 5. Four-dimensional emittance growth evolution from the symplectic PIC model (red), the nonsymplectic spectral PIC with the nominal step size (green), the spectral PIC with half of the This procedure is repeated many steps during the nominal step size (blue), and the spectral PIC with one quarter of simulation. the nominal step size (pink).

054201-8 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

model yields significantly smaller emittance growth than those from the two symplectic methods, which might result from the numerical damping effects in the non- FIG. 6. Schematic plot of a one-turn lattice that consists of 10 symplectic integrator. The fast emittance growth within the FODO lattice and one sextupole element. first 20 000 periods is caused by the space-charge driven fourth-order collective instability. The slow emittance lattice period is 85°. The current of the beam is 450 A and growth after 20 000 periods might be due to numerical the depressed phase advance is 42°. Such a high current collisional effects. drives the beam across the fourth-order collective insta- Figure 3 shows the transverse phase space distributions bility [34]. The initial transverse normalized emittance of at the end of the simulation (200 000 periods) from these 1 μ the proton beam is m with a 4D Gaussian distribution. three models. It is seen that the distributions from all three Figure 2 shows the four-dimensional emittance growth ϵ ϵ models show similar phase space shapes after the strong ð x y − 1Þ% evolution through 200 000 lattice periods ϵx0 ϵy0 collective resonance. However, the core density distribu- from the symplectic gridless particle model, from the tions show somewhat different structures. The two symplectic PIC model, and from the nonsymplectic spectral symplectic models show similar structures while the non- PIC model. These simulations used about 50 000 macro- symplectic spectral PIC model shows a denser core. This is particles and 15 × 15 modes in the spectral Poisson solver. also seen in the final horizontal and vertical density profiles In both PIC models, 257 × 257 grid points are used to shown in Fig. 4. obtain the density distribution function on the grid. The The accuracy of the nonsymplectic PIC model can be perfectly conducting pipe has a square shape with an improved with finer step size. Figure 5 shows the 4D aperture size of 10 mm. It is seen that the symplectic emittance growth evolution from the symplectic PIC model PIC model and the symplectic gridless particle model agree and those from the nonsymplectic PIC model with the with each other very well. The nonsymplectic spectral PIC same nominal step size, from the nonsymplectic PIC model

FIG. 7. Four-dimensional emittance growth evolution with 10 A, 20 A, and 30 A beam current from the symplectic PIC model (top), the symplectic gridless particle model (middle), and the nonsymplectic spectral PIC model (bottom).

054201-9 JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

FIG. 8. Final transverse phase of the 30 A beam from the from the symplectic PIC model (top), the symplectic gridless particle model (middle), and the nonsymplectic spectral PIC model (bottom). with one-half of the nominal step size, and from the period of nonlinear lattice consists of 10 periods of 1 m nonsymplectic PIC model with one-quarter of the nominal linear FODO lattice and a sextupole magnet to emulate a step size. It is seen that as the step size decreases, the simple storage ring. The zero current horizontal and vertical emittance growth from the nonsymplectic PIC model tunes of the ring are 2.417 and 2.417, respectively. The converges towards that from the symplectic PIC model. integrated strength of the sextupole element is 10 T=m=m. In the second example, we simulated a 1 GeV coasting The proton beam initial normalized transverse emittances proton beam transport through a nonlinear lattice. A are still 1 μm in both directions with a 4D Gaussian schematic plot of the lattice is shown in Fig. 6. Each distribution.

054201-10 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

FIG. 9. Final horizontal (left) and vertical (right) density profiles from the symplectic gridless particle model (red), the symplectic PIC model (green), and the nonsymplectic spectral PIC (blue).

Figure 7 shows the 4D emittance growth evolution with shows much less emittance growth compared with the 10 A, 20 A, and 30 A currents from the symplectic PIC other two models. This is probably due to the numerical model, the symplectic gridless particle model, and the damping effects in the nonsymplectic PIC model. nonsymplectic PIC model. The space-charge tune shift with Figure 8 shows the final transverse phase space distri- a 10 A beam current is 0.038, with a 20 A is 0.075, and with butions after 40 000 turns. All three models show similar a 30 A is 0.113. With a 10 A current, particles stay out of phase space shapes. The two symplectic models show the major third-order resonance; there is little emittance closer density distribution than the nonsymplectic PIC growth. With a 20 A current, the proton beam moves model. Figure 9 shows the final horizontal and vertical near the third resonance and some particles fall into the density profiles from those three models. The two sym- resonance, resulting in a significant increase of the emit- plectic models yield very close density profiles with non- tance growth. With a 30 A current, a lot of particles fall into Gaussian halo tails. The nonsymplectic PIC model yields a the resonance resulting in large emittance growth. It is seen denser core but less halo near the tail density distribution. from the above plot that all three models predict this current The accuracy of the nonsymplectic PIC model can also dependent behavior qualitatively. The two symplectic be improved with a finer step size in the above test case models show very similar emittance growth evolution for with nonlinear resonance. Figure 10 shows the 4D emit- all three currents while the nonsymplectic PIC model tance growth evolution from the symplectic PIC model and those from the nonsymplectic PIC model with the same nominal step size, from the nonsymplectic PIC model with one-half of the nominal step size, and from the non- symplectic PIC model with one-quarter of the nominal step size. It is seen that as the step size decreases, the emittance growth from the nonsymplectic PIC model converges towards that from the symplectic PIC model even in this nonlinear resonance case.

V. CONCLUSIONS In this paper, we proposed a symplectic PIC model and compared this model with the symplectic gridless particle model and the conventional nonsymplectic PIC model for long-term space-charge simulations of a coasting beam in a linear transport lattice and a nonlinear lattice. Using the same step size and the same number of modes for space- FIG. 10. Four-dimensional emittance growth evolution from the symplectic PIC model (red), the nonsymplectic spectral PIC charge solver, all three models qualitatively predict the with the nominal step size (green), the spectral PIC with half of similar emittance growth evolution due to the space-charge the nominal step size (blue), and the spectral PIC with one quarter driven resonance and yield similar final phase space shapes of the nominal step size (pink) in the nonlinear lattice with a 30 A in the benchmark examples. Quantitatively, the symplectic beam current. PIC and the symplectic gridless particle model agree with

054201-11 JI QIANG PHYS. REV. ACCEL. BEAMS 21, 054201 (2018) each other very well, while the nonsymplectic PIC model the CERN PS booster, Proceedings of PAC1999 (Institute yields much less emittance growth value. Using finer step of Electrical and Electronics Engineers, Inc., Piscataway, size, the emittance growth from the nonsymplectic PIC NJ, 1999) p. 2933. converges towards that from the symplectic PIC model. [5] J. Qiang, R. D. Ryne, S. Habib, and V. Decyk, An object- The computational complexity of the symplectic PIC oriented parallel particle-in-cell code for beam dynamics model is proportional to the O½N logðN ÞþN , simulation in linear accelerators, J. Comput. Phys. 163, grid grid p 434, 2000. where N and N are total number of computational grid p [6] P. N. Ostroumov and K. W. Shepard, Correction of beam- grid points and macroparticles used in the simulation. The steering effects in low-velocity superconducting quarter- computational complexity of the symplectic gridless par- wave cavities, Phys. Rev. ST Accel. Beams 4, 110101 ð Þ ticle model is proportional to the O NmodeNp , where (2001). Nmode is the total number of modes for the space-charge [7] R. Duperrier, TOUTATIS: A radio frequency quadrupole solver. On a single processor computer, with a large number code, Phys. Rev. ST Accel. Beams 3, 124201 (2000). of macroparticles used, the symplectic PIC model is [8] J. D. Galambos, S. Danilov, D. Jeon, J. A. Holmes, and computationally more efficient than the symplectic gridless D. K. Olsen, F. Neri and M. Plum, Comparison of particle model. However, on a massive parallel computer, simulated and observed beam profile broadening in the the scalability of the symplectic PIC model may be limited Proton Storage Ring and the role of space charge, Phys. 3 by the challenges of work load balance among multiple Rev. ST Accel. Beams , 034201 (2000). [9] H. Qin, R. C. Davidson, W. W. Lee, and R. Kolesnikov, 3D processors and communication associated with the grid- multispecies nonlinear perturbative particle simulations of based space-charge solver and particle manager [35]. The collective processes in intense particle beams for heavy ion symplectic gridless particle model has a regular data fusion, Nucl. Instrum. Methods Phys. Res., Sect. A 464, structure for a perfect work load balance and a small 477 (2001). amount of communication associated with the space-charge [10] G. Franchetti, I. Hofmann, M. Giovannozzi, M. Martini, solver. It scales well on both multiple processor central and E. Metral, Space charge and octupole driven resonance processing unit computers and multiple graphic processing trapping observed at the CERN Proton Synchrotron, Phys. unit computers [36]. Rev. ST Accel. Beams 6, 124201 (2003). In this paper, we assumed rectangular perfect conducting [11] J. Qiang, S. Lidia, R. D. Ryne, and C. Limborg-Deprey, pipe boundary conditions and used the spectral method Three-dimensional quasistatic model for high brightness to obtain the space-charge potential. For general shape beam dynamics simulation, Phys. Rev. ST Accel. Beams 9, boundary conditions or open boundary conditions, the 044204 (2006). space-charge potential on the computational grid can be [12] J. Amundson, P. Spentzouris, J. Qiang, and R. Ryne, Synergia: An accelerator modeling tool with 3-D space computed using other numerical methods such as the finite ’ charge, J. Comput. Phys. 211, 229 (2006). element or the Green s function method. The symplectic [13] A. Adelmann et al., http://amas.web.psi.ch/docs/opal/ PIC model proposed here would still be valid if one uses the opal_user_guide.pdf. resultant potential on the grid. [14] J. Qiang, Symplectic multiparticle tracking model for self-consistent space-charge simulation, Phys. Rev. Accel. ACKNOWLEDGMENTS Beams 20, 014203 (2017). [15] J. Xiao, J. Liu, H. Qin, and Z. Yu, A variational multi- This work was supported by the U.S. Department of symplectic particle-in-cell algorithm with smoothing func- Energy under Contract No. DE-AC02-05CH11231. We tions for the Vlasov-Maxwell system, Phys. Plasmas 20, would like to thank Dr. A. Friedman, Dr. C. Mitchell, 102517 (2013). Dr. R. D. Ryne, and Dr. J. Vay for discussions. This [16] E. G. Evstatiev and B. A. Shadwick, Variational formu- research used computer resources at the National Energy lation of particle algorithms for kinetic plasma simulations, Research Scientific Computing Center. J. Comput. Phys. 245, 376 (2013). [17] B. A. Shadwick, A. B. Stamm, and E. G. Evstatiev, Varia- tional formulation of macro-particle plasma simulation algorithms, Phys. Plasmas 21, 055708 (2014). [1] A. Friedman, D. P. Grote, and I. Haber, Three‐dimensional [18] H. Qin, J. Liu, J. Xiao, R. Zhang, Y. He, Y. Wang, Y. Sun, particle simulation of heavy‐ion fusion beams, Phys. J. W. Burby, L. Ellison, and Y. Zhou, Canonical symplectic Fluids B 4, 2203 (1992). particle-in-cell method for long-term large-scale simula- [2] H. Takeda and J. H. Billen, Recent developments of the tions of the Vlasov–Maxwell equations, Nucl. Fusion 56, accelerator design code PARMILA, in Proceedings of 014001 (2016). the XIX International Linac Conference, Chicago, 1998 [19] S. Webb, A spectral canonical electrostatic algorithm, (Argonne National Laboratory, Lemont, IL, 1998), p. 156. Plasma Phys. Controlled Fusion 58, 034007 (2016). [3] S. Machida and M. Ikegami, Simulation of space charge [20] E. Forest, Beam dynamics: A new attitude and framework, effects in a synchrotron, AIP Conf. Proc. 448, 73 (1998). in The Physics and Technology of Particle and Photon [4] F. W. Jones and H. O. Schoenauer, New space-charge Beams (Harwood Academic Publishers, Amsterdam, methods in accsim and their application to injection in 1998), Vol. 8.

054201-12 SYMPLECTIC PARTICLE-IN-CELL MODEL FOR … PHYS. REV. ACCEL. BEAMS 21, 054201 (2018)

[21] R. D. Ryne, Computational Methods in Accelerator [30] J. Qiang and R. D. Ryne, Parallel 3D Poisson solver Physics, US Particle Accelerator class note, 2012. for a charged beam in a conducting pipe, Comput. Phys. [22] A. J. Dragt, Lie Methods for Nonlinear Dynamics with Commun. 138, 18 (2001). Applications to Accelerator Physics (unpublished). [31] J. Qiang, Efficient three-dimensional Poisson solvers [23] E. Forest and R. D. Ruth, Fourth-order symplectic in open rectangular conducting pipe, Comput. Phys. integration, Physica D (Amsterdam) 43, 105, 1990. Commun. 203, 122 (2016). [24] H. Yoshida, Construction of higher order symplectic [32] R. W. Hockney and J. W. Eastwood, Computer Simulation integrators, Phys. Lett. 150A, 262, 1990. Using Particles (Adam Hilger, New York, 1988). [25] MAD–Methodical Accelerator Design, http://mad.web [33] C. K. Birdsall and A. B. Langdon, Plasma Physics Via .cern.ch/mad/. Computer Simulation (Taylor and Francis, New York, [26] E. Forest, Geometric integration for particle accelerators, 2005). J. Phys. A 39. 5321 (2006). [34] I. Hofmann, L. J. Laslett, L. Smith, and I. Haber, Stability [27] D. Gottlieb and S. A. Orszag, Numerical Analysis of Spectral of the Kapchinskij-Vladimirskij (KV) distribution in long Methods: Theory and Applications (Society for Industrial periodic transport systems, Part. Accel. 13, 145 (1983). and , Philadelphia, USA, 1977). [35] J. Qiang and X. Li, Particle-field decomposition and domain [28] B. Fornberg, A Practical Guide to Pseudospectral Methods decomposition in parallel particle-in-cell beam dynamics (Cambridge University Press, Cambridge, England, 1998). simulation, Comput. Phys. Commun. 181, 2024 (2010). [29] J. Boyd, Chebyshev and Fourier Spectral Methods (Dover [36] Z. Liu and J. Qiang, Symplectic multi-particle tracking on Publications, Inc., New York, 2000). GPUs, Comput. Phys. Commun. 226, 10 (2018).

054201-13