Kinetic description FDTD scheme Interaction PIC Plasma oscillations
The Particle-in-Cell (PIC) Method
Kai Germaschewski
Space Science Center & Department of PhysicsUniversity of New Hampshire
July 29, 2013
Contributors: W. Fox, H. Ruhl
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillations
Overview
1 Kinetic description of plasmasVlasov-Maxwell description of plasmas
2 The FDTD scheme for solving Maxwell’s equationsMaxwell’s equationsFDTD
3 Interaction strengthCoupling strengthFinite-size particles
4 Derivation of the PIC methodNumerical ApproachDerivation of the equations of motionTime integration
5 Plasma oscillations
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsVlasov-Maxwell
Description as a collection of particles
A plasma is an ionized gas, where the charged particles (ionsand electrons) interact via electromagnetic forces.The equations of motion for a particle p are:
dxp
dt= v m
dvp
dt= Fp
The force Fp on the particle is just the Lorentz force:
Fp = qp(E(xp) + vp × B(xp))
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsVlasov-Maxwell
Finding the electromagnetic fields
Here, the electromagnetic fields need to be known at everyparticle’s position. For, e.g., the electrostatic electric field,Coulomb’s Law could be used to find the electric field bysumming up the contributions from every other particle:
E(xp) =∑p′ 6=p
14πε0
qp′
r2qq′
r̂qq′
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsVlasov-Maxwell
Why not simulate the plasma directly?
To simulate a plasma, one could just implement an ODE solverthat integrates the equations of motion for all particles in thesystem, and obtains the forces needed from Coulomb’s /Biot-Savart’s Laws. In fact for certain systems, in particular inthe electrostatic case, this is actually done, and calledmolecular dynamics. However, for typical systems that we callplasmas, this is computationally not feasible at all due to twomain reasons:
Plasmas consist of a huge number of particles, e.g., thereare roughly 1030 particles in the magnetosphere.Using Coloumb’s Law creates an algorithm that scales asO(N2), where N is the number of particles.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsVlasov-Maxwell
Vlasov-Maxwell description of plasmas
Vlasov equation
∂t fs + v · ∇xfs +qs
ms(E + v× B) · ∇vfs =
(∂fs∂t
)coll
The electromagnetic fields are obtained from Maxwell’sequations:
∇ · E =ρ
ε0∇ · B = 0
∂E∂t
= c2∇× B− jε0
∂B∂t = −∇× E
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsVlasov-Maxwell
Finding the source quantities in Maxwell’s equations
Charge density and current density are obtained by integratingthe distribution function over velocity space:
ρ =∑
s
qs
∫f (x,v, t) d3v j =
∑s qs
∫vf (x,v, t) d3v
and satisfy the continuity equation
∂tρ+∇ · j = 0
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
Too many equations?
∇ · E =ρ
ε0∇ · B = 0
∂E∂t
= c2∇× B− jε0
∂B∂t = −∇× E
Which equations should we use?If the divergence equations are satisfied initially (say, at timet = 0), then they will remain satisfied at all times:
∂t (∇ · B) = ∇ · ∂tB= ∇ · (−∇× E)
= 0
Exercise: What happens for ∇ · E?Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
Discretizing Maxwell’s equations
To be able to solve partial differential equations (PDEs) on acomputer, they generally need to be discretized in time andspace. One method to do this is to introduce a uniform grid, so,e.g., the function E(x , y , z, t) is represented by its values on thediscrete grid:
Eni,j,k = E(i∆x , j∆y , k∆z,n∆t)
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
Discretizing Maxwell’s equations
Spatial derivatives are then approximated by finite differences(slopes), and a time integration scheme is used to step thesolution from an initial condition at t = 0 forward in time.
Most numerical schemes try to collocate all degrees of freedom(E,B) on the same spatial locations. It is also highly desirablefor the numerical scheme to satisfy discrete equivalents ofconserved quantities, though, and for Maxwell’s equation wesaw some of those earlier, in particular the fact that thedivergence of the fields maintain their initial value. Since thereare no magnetic monopoles in reality, it’d be rather nice to nothave magnetic monopoles in your simulations, either.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
The finite difference time domain (FDTD) scheme
The FDTD method satisfies discrete equivalents of the twodivergence conditions in Maxwell’s equation, as well as adiscrete Poynting theorem (in particular, energy is conserved ifj · E = 0. Unfortunately, it comes at a cost (or at least aninconvenience): The FDTD scheme is staggered in time andspace.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
Yee grid
On the so-called Yee grid, the electric fields live on edges of thegrid cell, and the magnetic fields live on the faces.
Ex ,i+1/2,j,k , Bx ,i,j+1/2,k+1/2
Ey ,i,j+1/2,k , By ,i+1/2,j,k+1/2
Ez,i,j,k+1/2, Bz,i+1/2,j+1/2,k
[wikipedia]After defining where the various field quantities live, theimplementation is actually fairly straightforward, as allderivatives are approximated as differences between twoneighboring points, which gives a 2nd order accurateapproximation for the center values.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
FDTD
As one example, the z-component Faraday’s Law
∂Bz
∂t= −∂xEy + ∂yEx
is discretized as
Bn+1z,i+1/2,j+1/2,k − Bn
z,i+1/2,j+1/2,k
∆t= −
En+1/2y ,i+1,j+1/2,k − En+1/2
y ,i,j+1/2,k
∆x
+En+1/2
x ,i+1/2,j+1,k − En+1/2x ,i+1/2,j,k
∆y
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsMaxwell’s equations FDTD
Divergence of B in FDTD
The divergence of ∇ · B lives naturally in the cell center:
(∇ · B)i+1/2,j+1/2,k+1/2 =Bx ,i+1,j+1/2,k+1/2 − Bx ,i,j+1/2,k+1/2
∆x+
Bx ,i+1/2,j+1,k+1/2 − Bx ,i+1/2,j,k+1/2
∆y+
Bx ,i+1/2,j+1/2,k+1 − Bx ,i+1/2,j+1/2,k
∆z
Exercise: Assuming that everything is invariant in z-direction,calculate (∇ · B)
n+1/2i+1/2,j+1/2,k+1/2 as a function of
(∇ · B)ni+1/2,j+1/2,k+1/2 and En+1/2.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsCoupling strength Finite-size particles
Debye shielding
An important point to consider in the description of plasmas isthe type of interaction between a particle and the rest of thesystem.A test charge introduced into a plasma causes other chargedparticles to adjust their position and effectively shield thecharge on a length scale called the Debye length λD:
λD =
√ε0kBTnq2
This material is based on [Lapenta].
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsCoupling strength Finite-size particles
Strongly coupled systems
Let’s look at just a λD-sized box of charged particles:
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsCoupling strength Finite-size particles
Weakly coupled systems
If the number of particles in the Debye sphere is large,however, the situation looks rather different:
When we talk about plasmas, we normally mean a weaklyinteracting system dominated by collective behavior, a systemwith many particles in the Debye sphere, or equivalenty, asystem dominated by kinetic energy (Ekin � Epot ).
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsCoupling strength Finite-size particles
Finite-size particles
The quasi-particles that are used to represent the distributionfunction correspond to a large number of actual particles. Butthey are also given a finite size, typically related to the gridspacing of the mesh where the electromagnetic field equationsare solved.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsCoupling strength Finite-size particles
Finite-size particles
Finite-size particles interact (about) the same as point particlesas long as they do not overlap. However, once they overlap, theforces on the overlapping pieces cancel.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Vlasov-Maxwell
Vlasov equation for species s
∂t fs + v · ∇xfs +qs
ms(E + v× B) · ∇vfs =
(∂fs∂t
)coll
together with Maxwell’s equations
∇ · E =ρ
ε0∇ · B = 0
∂E∂t
= c2∇× B− jε0
∂B∂t
= −∇× E
Charge density and current density are obtained by integratingthe distribution function over velocity space:
ρ =∑
s
qs
∫f (x,v, t) d3v j =
∑s
qs
∫vf (x,v, t) d3v
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Quasi-particle distribution function
We now approximate the phase space distribution function as asum of quasi-particles:
fs(x,v, t) =∑
p
fp(x,v, t)
Each quasi-particle represents a large number of particles thatare close to each other in phase space. Instead ofdelta-functions which would represent a single particle, we nowuse shape function in configuration and velocity space torepresent the distribution function belonging to thequasi-particle p:
fp(x,v, t) = NpSx(x− xp(t))Sv(v− vp(t))
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Shape function properties
It makes sense to demand that the shape functions can befactorized as, e.g.,
Sx(x− xp(t)) = Sx (x − xp(t)) Sy (y − yp(t)) Sz(z − zp(t))
We further demand certain properties of the shape functions:The support of the shape function is compact.The shape function is normalized.
∫∞−∞ Sξ(ξ − ξp) dξ = 1
Symmetry. Sξ(ξ − ξp) = Sξ(ξp − ξ)
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Particle shape functions
The standard PIC method chooses the velocity space shapefunctions to be delta-functions, so that the spatial shapefunction remains constant in time:
Sv (v − vp) = δ(v − vp)
For the spatial shape function, the original PIC method useddelta-functions, too, but nowadays, b-splines are nowcommonly used.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
The first spline b0 is defined as follows:
b0(ξ) =
{1 if |ξ| < 1/20 otherwise
The other b-splines are obtained by convoluting the previousspline with b0:
bl(ξ) =
∫ ∞−∞
b0(ξ − ξ′)bl−1(ξ′) dξ′
The first 3 b-splines are shown here:
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Particle shape functions
The actual spatial shape function is then chosen as
Sx (x − xp) =1
∆xbl
(x − xp
∆x
)where ∆x is the scale length for the size of the computationalparticle.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
So far, each quasi-particle has a position and velocity, xpandvp,whose evolution in time has not yet been specified. We obtainevolution equations by taking moments of the Vlasov equation.For simplicity, the following is written for the 1-d electrostaticcase, but generalization to 3-d is straight-forward. The Vlasovequation for each quasi-particle distribution function looks like
∂fp∂t
+ v∂fp∂x
+qsEms
∂fp∂v
= 0.
where the electric field is still determined by all particlestogether, though.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
The Vlasov equation will not be satisfied for the prescribedparticle shapes, however, we demand that the first momentsare satisfied.We obtain moments by integrating over configuration andvelocity space:
〈. . .〉 ≡∫
dx∫
dv . . .
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
Taking the 0th order moment of the Vlasov equation, it followsthat
dNp
dt= 0
That is, the number of physical particles represented by aquasi-particle remains constant in time.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
Taking the moment of the Vlasov equation multiplied by x , wefind
dxp
dt= vp
This is the same equation of motion that we had for a singlereal particle.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
Finally, we take the moment of the Vlaosv equation multipliedby v and find
dvp
dt=
qs
msEp
where the electric field acting on the quasi particle is averagedover space according to the particle’s shape function:
Ep =
∫Sx (x − xp)Ex
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
dNp
dt= 0
dxp
dt= vp
dvp
dt=
qs
msEp
In conclusion, the particle in cell method actually solves theusual Newton’s equations of motions for quasi-particles as wehad for the actual particles, though the electric field is averageddue to the finite size of the quasi-particles.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Derivation of the equations of motion
The electric field is calculated on the grid and then assumed tobe constant within each cell, so it is given as
E(x) =∑
i
Eib0
(x − xi
∆x
)From the definition of Ep we get
Ep =∑
i
Ei
∫b0
(x − xi
∆x
)Sx (x − xp) =
∑i
EiW (xi − xp)
where the weight function W is essentially just the next higherorder b-spline
W (xi − xp) = bl+1
(xi − xp
∆x
)where l is the order of the b-spline used in the particle shapefunction b-spline.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Time integration
The integration of the particle is staggered in time (leap-frog),too. We start with particle velocities at vn
p and particle positions
at xn+1/2p . The positions xn+1/2
p are used to interpolate the fieldsto the particle position at time n + 1/2 and calculate the Lorentzforce Fn+1/2
p . The Lorentz force is then used to update theparticle velocity according to
mdvp
dt= Fp =⇒ m
vn+1p − vn
p
∆t= F n+1/2
p .
Then, the new particle positions can be found using vn+1p :
dxp
dt= vp =⇒
xn+3/2p − xn+1/2
p
∆t= vn+1
p
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Time integration
The particle positions xn+1/2 and xn+3/2 are used to calculatethe charge densities on the grid at those times. From thecharge densities we then find the current densities jn+1 tosatisfy discretely the charge continuity equation
dρdt
= ∇ · j =⇒ρ
n+3/2i,j,k − ρn+1/2
i,j,k
∆t= (∇ · j)n+1
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Time integration
The whole cycle showing the interaction between fields areparticles is summarized in the following diagram.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Boris pusher
We skipped the details of numerically solving Newton’s 2ndLaw with the Lorentz force, which contains the particle velocity,too. One common option is to used the pusher developed byBoris [1970]:We split the Lorentz force into electric and magnetic parts:
Fp = Felec,p + Fmagn,p = qsEp + qsvp × Bp
and then split the update as follows:
mpv− − vn
∆t/2= qsEn+1/2
p =⇒ v− = vn +qp
mpEn+1/2
p
mpv+ − v−
∆t= qs
v− + v−
2× Bn+1/2 =⇒ v+ = rotation of v− around Bn+1/2
mpvn+1 − v+
∆t/2= qsEn+1/2
p =⇒ vn+1 = v+ +qp
mpEn+1/2
p
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillationsNumerical Approach EOM Time integration
Stability
Courant-Friedrichs-Lewy conditions:
c∆t < ∆xωpe∆t < 2
are needed for avoiding numerical instability.
Kai Germaschewski The Particle-in-Cell Method
Kinetic description FDTD scheme Interaction PIC Plasma oscillations
Plasma oscillations
Single-fluid picture:
m∂v1
∂t= qE1 ∇× B1 = j1 + ε0
∂E∂t
=⇒ ω2 = ω2pe =
n0q2
ε0m
With background flow:
ω = k · v0 ± ωpe
Kai Germaschewski The Particle-in-Cell Method