multi-particle simulation techniques i - cern · 2019. 2. 28. · spectral-finite difference...

53
Multi-Particle Simulation Techniques I CERN Accelerator School, Thessaloniki, Greece Nov. 15, 2018 Ji Qiang Accelerator Modeling Program Accelerator Technology & Applied Physics Division Lawrence Berkeley National Laboratory

Upload: others

Post on 30-Dec-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Multi-Particle Simulation Techniques I

CERN Accelerator School, Thessaloniki, Greece

Nov. 15, 2018

Ji Qiang

Accelerator Modeling Program

Accelerator Technology & Applied Physics Division

Lawrence Berkeley National Laboratory

Page 2: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Outline

• Introduction of the particle-in-cell method for multi-particle

simulation

• Deposition/interpolation

• Self-consistent field calculations

• FFT based Green function method for open boundary

condition

• Multigrid method for irregular shape boundary condition

• Particle advance

Page 3: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Introduction

• Particle-in-cell method: “the method amounts to following the trajectories of charged

particles in self-consistent electromagnetic (or electrostatic) fields

computed on a fixed mesh”

• Particle-in-cell codes are widely used in accelerator physics community:

• PARMELA, ASTRA, GPT, IMPACT-T, IMPACT-Z, GENESIS, GINGER….

• An example of 2D particle-in-cell simulation an mismatched beam transport

through a FODO

Courtesy of R. D. Ryne

Page 4: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Governing Equations in Space-Charge Simulation

/2

pdtprf 3),,(

0),,(),,(),,(

p

tprfp

r

tprfr

t

tprf

))(( iii pprrw

Page 5: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

particle deposition

field interpolation

pa

rtic

le a

dva

nce

field

ca

lcu

latio

n

One Step Particle-In-Cell Method

Page 6: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Particle Deposition/Field Interpolation

i

i

piip

i

piip

xxwq

xxwq

vJ )(

)(

)(

)(

p

pipi

p

pipi

xxw

xxw

BB

EE

Particle deposition:

Field interpolation:

p

qip

p

p

• Grid reduces the computational cost compared

with direct N-body point-to-point interaction

• Grid also provides smoothness to the shot noise

and close collision

Page 7: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Spatial localization of errors

- At particle separations large compared with the mesh spacing, the field

error should be small

• Smoothness

- The charge assigned to the mesh from a particle and the force

interpolated to a particle a particle from the mesh should smoothly

vary as the particle moves across the mesh

• Momentum conservation

- No self force

Weight Function for Deposition/Interpolation

Page 8: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

p

qip

p

p

qj

m

p

piijip

m

p

pjipj xxxxGxwxxGxwx11

)()()()()(

m

p nn

ij

nn

pi

ip

m

p

ijipjdx

xxGd

n

xxxwxxGxwx

1 11

)(

!

)()()()()(

m

p

ip xw1

1)(

m

p

n

piip constxxxw1

))((

0 1-1

• Spatial localization of errors

• Smoothness:

• Continuity of weight function value

• Continuity of derivative

-h 0 h• Momentum conservation

x

);();(

)()();()(

''

1

int'

1'

'

pppp

m

p

pipidep

m

p

ppiself

xxdxxd

xxwxxwxxdxF

Weight Function for Deposition/Interpolation

Page 9: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Weight Functions for Deposition/Interpolation

)()(h

xxxw

p

p

||1)(h

xxxw

p

p

2

2

|)|2

3(

2

1

)(4

3

)(

h

xx

h

xx

xwp

p

p

NGP:

CIC:

TSC:

x

R. W. Hockney and J. W. Eastwood, Computer Simulation Using Particles

Page 10: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Self-Consistent Field Calculations

/2

pdprf 3),(

Page 11: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Transverse irregular pipe

FFT based Green function method:

• Standard Green function: low aspect ratio beam

• Shifted Green function: separated particle and field domain

• Integrated Green function: large aspect ratio beam

• Non-uniform grid Green function: 2D radial non-uniform beam

Spectral-finite difference method:

Multigrid spectral-finite difference method:

Fully open boundary conditions

Transverse regular pipe with

longitudinal open/periodic

Transverse irregular pipe

Different Boundary/Beam Conditions Need

Different Efficient Numerical Algorithms O(Nlog(N)) or O(N)

Page 12: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Field Calculation with Open Boundary Conditions

; r = (x, y,z) ')'()',()( drrrrGr

(ri) h G(rii '1

N

ri' )(ri' )

)(/1),,( 222 zyxzyxG

Direct summation of the convolution scales as N2 !!!!

N – total number of grid points

Green Function Solution of Poisson’s Equation

Page 13: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

L

G(r)G(-r)

(r)

Hockney’s Algorithm or Zero Padding

G(-r)G(r)

Gc(r)

• This is different from a real periodic system

• The real calculation is done in discrete coordinate instead of continuous coordinate

R. W. Hockney and J. W. Eastwood, Computer Simulation Using Particles

Page 14: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Hockney’s Algorithm or Zero Padding

Page 15: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

y

A Schematic Plot of an e- Beam and Its Image Charge

o e-e+

cathode

z

F(r) Gs(r,r')(r')dr'Gs(r,r') G(r rs,r')

Shifted Green function Algorithm:

J. Qiang, M. Furman, and R. Ryne, Phys. Rev. ST Accel. Beams, vol 5, 104402 (October 2002).

Page 16: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Test of Image Space-Charge Calculation

Numerical Solution vs. Analytical Solution

Shifted-green function

Analytical solution

Page 17: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Integrated Green Function for Large Aspect Ratio Beam

• Lack of resolution along longer side if same number of grids are used for both sides

• Brute force: use more grid points along longer side

• Better way: break the original convolution integral into a sum of small cell integral and

use integrated Green’s function within each cell

G(r)

Page 18: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

c(ri) Gi(rii '1

2N

ri' )c(ri' )

Gi(r,r') Gs(r,r')dr'

Integrated Green Function

J. Qiang, S. Lidia, R. D. Ryne, and C. Limborg-Deprey, Phys. Rev. ST Accel. Beams, vol 9, 044204 (2006).

Page 19: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

A Comparison Example: Aspect Ratio = 30

Page 20: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Poisson Solver with Finite Boundary Conditions

jj-1 j+1

Where j = 1, …,N

Page 21: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Finite Difference Poisson Solver: Iterative Methods

• Direct Gaussian elimination: O(N3)

• Iterative method: O(mN)

Where S is an approximation of A-1, i = 1,…,m

A: is a sparse matrix

Page 22: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Classical iterative methods: – Jacobi

– Damped Jacobi

– Gauss-Seidel

– Successive Over Relaxation

Finite Difference Poisson Solver: Iterative Methods

• Problems of classical iterative methods: – slow convergence

Page 23: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Weighted Jacobi Chosen to Damp High Frequency Error

Initial error

“Rough”

Lots of high frequency components

Norm = 1.65

Error after 1 Jacobi step

“Smoother”

Less high frequency component

Norm = 1.055

Error after 2 Jacobi steps

“Smooth”

Little high frequency component

Norm = .9176,

won’t decrease much more

Ref: J. Demmel’s class note

Page 24: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Classical sparse-matrix-vector-multiply-based algorithms:

o low frequency error decreases slowly after a few iterations

o move information one grid at a time

o take N1/d steps to get information across grid

o matrix-vector multiplications are done on the full fine grid

• Multigrid algorithm:

o smooths out the numerical errors of different frequencies on different

scales using multiple grids

o moves the information across grid by W(log n) steps

o most multipications are done on coarse grids

Multigrid Motivation

Page 25: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Comparison of Convergent Time for an Example:

SOR vs. Multi-Grid

Page 26: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Multi-Grid Iteration Method

• Basic Algorithm:– Replace correction problem on fine grid by an approximation on a

coarser grid

– Solve the coarse grid problem approximately, and use the solution

as a correction to the fine grid problem and build a new starting

guess for the fine-grid problem, which is then iteratively updated

– Solve the coarse grid problem recursively, i.e. by using a still

coarser grid approximation, etc.

• Success depends on coarse grid solution being a good approximation

to the fine grid

Page 27: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Consider a 2m+1 grid in 1D for simplicity

• Let P(i) be the problem of solving the discrete Poisson equation on a 2i+1 grid in 1D

• Write linear system as A(i) * x(i) = b(i)

• P(m) , P(m-1) , … , P(1) is a sequence of problems from finest to coarsest

Multigrid Sketch on a Regular 1D Mesh

Page 28: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Consider a 2m+1 by 2m+1 grid

• Let P(i) be the problem of solving the discrete Poisson equation on a 2i+1 by 2i+1 grid in 2D

o Write linear system as A(i) * x(i) = b(i)

• P(m) , P(m-1) , … , P(1) is a sequence of problems from finest to coarsest

Multigrid Sketch on a Regular 2D Mesh

Page 29: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• For problem P(i) :o b(i) is the RHS and

o x(i) is the current estimated solution

o (A(i) is implicit in the operators below.)

• All the following operators just average values on neighboring grid pointso Neighboring grid points on coarse problems are far away in fine problems, so information

moves quickly on coarse problems

• The restriction operator R(i) maps P(i) to P(i-1)

o Restricts problem on fine grid P(i) to coarse grid P(i-1) by sampling or averaging

o b(i-1)= R(i) (b(i))

o Graphic representation:

• The prolongation operator P(i-1) maps an approximate solution x(i-1) to an x(i)

o Interpolates solution on coarse grid P(i-1) to fine grid P(i)

o x(i) = P(i-1)(x(i-1))

o Graphic representation:

• The smooth operator S(i) takes P(i) and computes an improved solution x(i) on same grido Uses “weighted” Jacobi or Gauss-Seidel

o x improved (i) = S(i) (b(i), x(i))

o Graph representation:

both live on grids of size 2i-1

Basic Operators of Multigrid Iteration

Page 30: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• The restriction operator, R(i), takes

o a problem P(i) with RHS b(i) and

o maps it to a coarser problem P(i-1) with RHS b(i-1)

• Simplest way: sampling

• Averaging values of neighbors is better; in 1D this is

o xcoarse(i) = 1/4 * xfine(i-1) + 1/2 * xfine(i) + 1/4 * xfine(i+1)

• In 2D, average with all 8 neighbors (N,S,E,W,NE,NW,SE,SW)

Restriction Operator R(i) - Details

Page 31: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• The prolongation/interpolation operator P(i-1), takes a function on a

coarse grid P(i-1) , and produces a function on a fine grid P(i)

• In 1D, linearly interpolate nearest coarse neighbors

o xfine(i) = xcoarse(i) if the fine grid point i is also a coarse one, else

o xfine(i) = 1/2 * xcoarse(left of i) + 1/2 * xcoarse(right of i)

• In 2D, interpolation requires averaging with 2 or 4 nearest neighbors

(NW,SW,NE,SE)

Prolongation/Interpolation Operator

Page 32: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Pre-smoothing: compute approximated solution by applying n1 steps of a

relaxation method on fine grid:

• Construct residual vectors:

• Restrict the residual to coarser grid:

• Solve exactly on the coarse grid for the error vector:

• Prolongate/Interpolate the error vector to fine grid:

• Compute the improved approximation x on fine grid:

• Post-smoothing: compute approximated solution by applying n2 steps of a

relaxation method on fine grid:

1

1 ,,1));2(()2()2( n iXABSXX iii

)2()2(11

nXABr

))2(()1( rRr

))1(()1( 1 rRAE

))1(()2( EPE

)2()2()2(11 1 EXX n

2

1 ,,1));2(()2()2( n

iXABSXX iii

Two-Grid Iteration

Page 33: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

g is the number of two-grid iterations at each intermediate stage

V-Cycle W-Cycle

Structure of Multigrid Cycles

Page 34: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Function MGV ( b(i), x(i) )

… Solve A(i)*x(i) = b(i) given b(i) and an initial guess for x(i)

… return an improved x(i)

if (i = 1)

compute exact solution x(1) of P(1) only 1 unknown

return x(1)

else

x(i) = S(i) (b(i), x(i)) improve solution by

damping high frequency error

r(i) = A(i)*x(i) - b(i) compute residual

r(i-1) = R(i)(r(i)) restrict from fine to coarser grid

MGV( r(i-1), e(i-1) ) solve A(i)*e(i) = r(i) recursively

e(i) = P(i-1)(e(i-1)) prolongate from coarser grid to fine grid

x(i) = x(i) - e(i) correct fine grid solution

x(i) = S(i) ( b(i), x(i) ) improve solution again

return x(i)

Multigrid V-Cycle Algorithm

Page 35: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• At level i, the number of unknown is (2i-1)x (2i-1)

• On a serial machine

o Work at each point in a V-cycle is O(the number of unknowns)

o Cost of Level i is O((2i-1)2 )= O(4 i)

o If finest grid level is m, total time is:

o SO(4 i) = O( 4 m) = O(# unknowns)

• On a parallel machine (PRAM)

o with one processor per grid point and free communication, each

step in the V-cycle takes constant time

o Total V-cycle time is O(m) = O(log #unknowns)

m

i=1

Complexity of a V-Cycle on a 2D Grid

Page 36: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• Overview:

o Solve the problem with 1 unknown on coarsest grid

o Given a solution to the coarser problem, P(i-1) , map it to starting guess

for P(i)

o Solve the finer problem using the Multigrid V-cycle

• Advantages:

o no need for initial guess of solution

o avoid expensive fine-grid (high frequency) cycles

o obtain solutions at multiple grid level (can be used for error estimate or

extrapolation)

Full/Nested Multigrid (FMG)

Page 37: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

•Error decreases by a factor >5 on each iteration

Convergence Picture of Multigrid in 1D

Page 38: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Particle Advance: Numerical Integration

• Consistency

• Accuracy

• Stability

• Efficiency

• Examples of numerical integrators:

– Runge-Kutta

– Leap frog

– Boris

– Integrators beyond Boris

– Symplectic integrators

Page 39: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integration: Consistency

)(xFdt

dv

vdt

dx

dtxFvv

dtvxx

nnn

nnn

)(1

1

1D Example

Euler algorithm:

Consistency:

under the limit of dt->0, the discrete model -> continuous model

Page 40: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integration: Accuracy

Accuracy: local truncation errors in the numerical discrete algebraic equations

compared with the original differential equations

)(2

1

)(2

1

2

2

21

2

2

21

dtOdtdt

vd

dt

dv

dt

vv

dtOdtdt

xd

dt

dx

dt

xx

nn

nn

)(2

1)(

)(2

1

2

2

2

2

2

2

dtOdtdt

vdxF

dt

dv

dtOdtdt

xdv

dt

dx

The above Euler method is the 1st order accuracy.

Higher order accuracy can be obtained using more sub steps.

Page 41: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

• The order of accuracy can also be expressed as the local

truncation error of variables in the numerical integration method.

• The “mth order method” denotes a numerical integration

method that is locally correct through order hm and makes local errors

of order hm+1.

)(((~

(~ 1 mhO0)xh)xh)e

The error for one step is

Numerical Integration: Accuracy

)((~ mhOn h)e

for n step is

...~~

(

~(

~~

~(

~~

0

0

t

t

h

FtF

F

F

xx(0))-(x(0),0)( t)(t),

t)dt(t),(0)(t)

t)dt(t),(0)(h)

FF xx

xxx

xxx

Page 42: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integration: Stability

Stability: propagation of errors (e.g. roundoff error) in the discrete

algebraic equations . A stable numerical integration algorithm is the one

that a small error at any stage does not keep on increasing as number of

steps increases

dtexFee

dteee

n

xn

n

v

n

v

n

v

n

x

n

x

)('1

1

dtXFVV

dtVXX

nnn

nnn

)(1

1

Euler algorithm on computer:

Linearized equations of errors:

y

x

eVv

eXx

Page 43: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

n

v

x

n

n

v

x

e

e

dtxF

dt

e

e

1)('

11

For an integration scheme to be numerically stable,

the eigenvalues of the error transfer matrix must

lie in or on the unit circle.

Numerical Integration: Stability

dtxF n )('1

The explicit Euler method will be unstable

Page 44: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integrator: Runge-Kutta

),...,,( 1 Nii xxtf

dt

dx

)(6336

),(

)2

,2

(

)2

,2

(

),(

54321

34

23

12

1

hO

hth

hth

hth

th

n

n

n

n

kkkkxx

kxfk

kxfk

kxfk

xfk

n1n

n

n

n

n

• “one of the most popular schemes for integrating ODEs”

• applicable to arbitrary ODEs

• 4th order accuracy

• variable time step size

• auxiliary storage

• 4 field calculations per step

Page 45: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integrator: Leap-Frog

)(xfv

vx

dt

d

dt

d

)(2

1

2

1

2

1

1

nnn

nnn

h

h

xfvv

vxx

• easy to implement, low memory storage

• 2nd order accuracy

• time reversible

• stable for

• single field calculation per step

2/1

max||;2

W

W

dx

dfh

Page 46: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integrator: Boris Algorithm

)( BvEv

vx

qdt

dm

dt

d

svvv

ts

tvvv

Bt

2tan(

Bvvvv

Evv

Evv

'

1

2

'

2

2)

)(2

2

2

2

2

1

2

1

t

h

m

q

hm

qB

m

qh

h

m

q

h

m

q

n

n

Lorentz equations of motion

v-

v+

v++v-

v+-v-

Boris Algorithm

v’-

• widely used in plasma/accelerator community

• 2nd order accuracy

• time reversible

Page 47: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

47

• 50 MeV electron beam transports in free space

Boris

Newnew algorithm can use 100 times

larger time step size

New Numerical Integrator Needed to Include Space-Charge

Fields in Relativistic Electron Beam

Page 48: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

48

J. Qiang, Nucl. Intrum. Meth. Phys. Res. A, 2017.

Widely Used Boris Integrator

New Fast Relativistic Integrator

Lorentz Force Equations:

J. Boris, in Proceedings of the Fourth Conference

on the Numerical Simulation of Plasmas (Naval Re-

search Laboratory, Washington, DC, 1970), pp. 367.

Fast Numerical Integrator for Relativistic Charged Particle Tracking

Page 49: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

49

Another Relativistic Integrator (Vay)

J. V. Vay, Phys. Plasmas 15, 056701 (2008).

Page 50: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

50

space-charge electric and magnetic fields from positron beam:

Numerical Test of an Electron Co-Moving with a Positron

Coasting Beam with Uniform Transverse Density

Page 51: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

51• All three algorithms show 2nd order accuracy

• Boris algorithm shows much larger error than the other two algorithms

50 MeV 100 MeV

2nd order convergence test

~t2New + Vay

integrators

2nd order convergence test

~t2

new + Vay

integrators

BorisBoris

Numerical Examples Show 2nd Order Accuracy of

the New Fast Algorithms in Space-Charge Fields

Page 52: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

Numerical Integrator: Symplectic Integrator

Hamiltonian equations of motion:

x

p

p

x

H

H

dt

d

dt

d

)(1 nn f ξξ

Numerical integrator:

n

j

n

iijM

1

Define its Jacobian matrix M:

JJMM t

Symplectic condition:

1

1

00

00

00

J

J

J

01

101J

Symplectic Integrator preserve: • the symplectic nature of Hamlitonian equations

• the phase space structure

This corresponds to more constraints

Page 53: Multi-Particle Simulation Techniques I - CERN · 2019. 2. 28. · Spectral-finite difference method: Multigrid spectral-finite difference method: ... A Schematic Plot of an e-Beam

53

Summary

• Deposition/interpolation in particle-in-cell method

• Self-consistent space-charge field calculations through solving

the Poisson equation at each time step using the updated

charge density distribution

- FFT based Green function methods for open boundary condition

- Spectral (and finite) methods for regular shape boundary condition

• Numerical integrators for particle advance

- Euler method

- Runge Kutta method

- Leap-frog method

- Boris method

- Relativistic particle integrator

- Symplectic integrator