o PIC codes use particles to ... Numerical Algorithms for a 2-1/2D Electromagnetic PIC Code ..... Inertial confinement fusion aims to make fusion a clean.
FSC
Introduction to Particle-in-Cell Methods in Plasma Simulations Chuang Ren University of Rochester The 2011 HEDP Summer School
1
Simulations are an important tool in scientific research FSC
• Computer simulations are carried out to
Experiment
– Understand the consequences of fundamental physical laws – Help interpret experiments
• Can provide detailed information which is difficult to measure
– Design and predict new experiments
Simulation
Theory
2
PIC simulations are indispensible in HEDP research FSC
• Outline – What is PIC method? – Numerical algorithm for 2-1/2D EM code – An example: two-plasmon-decay instabilities
3
There are various ways to describe a plasma FSC
•
The complete description is to specify x(t) & v(t) of each particle – Klimontovich formalism
•
Neglecting particle-correlation (collisions), we get the Vlasov equation – Closed Vlasov-Maxwell eqs.
•
∂ q v×B + v ⋅ ∇ + α (E + ) ⋅ ∇ v ] f α ( x, v ,t) = 0 ∂t mα c ∇ ⋅ E = 4 π ∑ qα ∫ f α dv
[
α
∇×B=
The fluid description describes macroscopic
quantities – Closure problem
(For details see textbooks, e.g. Krall & Trivelpiece)
1 ∂E 4 π + ∑ qα c ∂t c α
∇×E =−
€
∫ vf
α
dv
1 ∂B c ∂t
∂nα ( x,t) + ∇ ⋅ (nαVα ( x,t)) = 0 ∂t ∂ V ×B nα mα Vα + nα mαVα ⋅ ∇Vα − nα qα (E + α )+∇⋅P ∂t c = −∑ nα mα (Vα − Vβ ) < ν αβ > β
4
€
Particle simulations take the Klimontovich approach FSC Maxwell’s Eqs • Particle methods simulate a plasma system by following a number of particle trajectories • Essential physics can be captured with a much smaller number of particles than that in a real plasma
€
• The charge/mass ratio and € charge density remain the same • 103~1011 particles used
• Statistics of the model system is different from a real plasma • The detailed description is computation-intensive
x i,v i
E( x i ),B( x i ) Newton’s Eq + Lorentz force
€
4πne ω = m
2
2 p
Invariant e/m and ne -> invariant ωp 5
€
The phase-space is efficiently represented in particle methods FSC
• It is difficult to sample a 6D-
P
unoccupied phase space (wasted cells)
phase space by cells o Difficult to solve Vlasov equations in high dimensions
o PIC codes use particles to efficiently sample the phase space distribution
plasma distribution function
X 6
Calculating inter-particle forces directly is expensive FSC
• number of calculations~ 100 Np2
108 particles, 100 Tflop/s 1 time step ~ 3 hrs 10000 time step sim. ~ 3 yrs
7
Particle-in-Cell Algorithms FSC
•
Find (ρij,Jij) from (xk,vk)
•
Solving Maxwell’s eqs on grid to obtain (Eij,Bij)
•
Find Fk from (Eij,Bij)
•
Number of calculatons for 1 step –
Deposit charge/current ∝Np
–
Advance fields ∝Ncells
–
Interpolate forces and advance particles ∝Np
–
Total ~ αNp + β(Ncells)
108 particles, 100 Tflop/s 64 x 64 x 64 cells 1 time step ~ 0.3 ms 10000 time step sim. ~ 3 s 8
The Simple & Straightforward PIC Scheme FSC
dp v ⎛ ⎞ = q ⎜ E + × B⎟ ⎝ ⎠ dt c
Integration of equations of motion, moving particles
Fk uk xk Weighting
( E , B )ij Fk
Δt
Integration of Field Equations on the grid
( E , B )ij Jij
Weighting
(x,u)k Jij
∂E = 4π j − c∇ × B ∂t ∂B = −c∇ × E ∂t 9
Finite-size particles reduce collision FSC
• Close-range collisions are much reduced by using the finite-size particles • This compensates for the smaller number of particles used – ν/ωp~(nλD3)-1
• We are interested in nλD3>>1 regime • PIC models are not collisionless – Can be used to test collision operators
10
FSC
• References on PIC methods – J. M. Dawson, ‘Particle simulation of plasmas,’ Rev. Mod. Phys. 55, 403-447 (1983) – R. W. Hockney and J. W. Eastwood, Computer Simulation Using Particles, McGraw-Hill, New York (1981) – C. K. Birdsall and A. B. Langdon, Plasma Physics via Computer Simulation, Institute of Physics Publishing, Bristol, UK (1991)
11
FSC
Numerical Algorithms for a 2-1/2D Electromagnetic PIC Code
no spatial variation in z (half-dimension)
12
Advancing EM Fields FSC
• The EM fields are advanced by Maxwell’s Equations – The other 2 Maxwell’s eqs are satisfied as initial conditions
€ • In 2D, the field components can be decomposed into 2 independent modes – TE mode (k·E=0): Ez, Bx, By. – TM mode (k·B=0): Bz, Ex, Ey.
∂t B = −∇ × E, ∂t E = ∇ × B − J. ∇ ⋅ E = ρ, ∇ ⋅ B = 0.
€
∂t Bx = −∂y E z ,∂t By = ∂ x E z ,∂ t E z = ∂x By − ∂ y Bx − J z . ∂t Bz = −(∂ x E y − ∂y E x ),∂ t E x = ∂y Bz − J x ,∂t E y = −∂x Bz − J y . 13
€
FSC
Centered difference can be used in both time & space domain
For TM mode 2 n−1/ 2 Bzni,+1/ − B z j i, j
Δt
=−
E xni,+1j +1/ 2 − E xni , j +1/ 2 Δt E yni+1 − E xni +1/ 2, j +1/ 2, j Δt
=
E yni +1/ 2, j − E yni −1/ 2, j Δx 2 2 Bzni,+1/ − Bzni,+1/ j +1 j
=−
Δy
Δy
(Ex,,Jx)
− j x i , j +1/ 2
2 Bzni +1,+1/j 2 − Bzni,+1/ j
Δx
+
E xni, j +1/ 2 − E xni , j −1/ 2
j
− j y i +1/ 2, j
Bz (Ey,, Jy)
i
TE mode is similar €
Bx
j
By (Ez, Jz)
i
14
Combining the Two Sets of Fields FSC
• Two equal ways of putting both modes on one grid
j+1
Yee lattice j+1
or
(Ez,, Bz, Jz)
j+1/2 (E , B , J ) (E , B , J ) j i i+1/2 i+1 y,
y
y
x,
x
(Ez,, Jz)
j+1/2 (E , B , J ) (E , B , J ) j B i i+1/2 i+1 x,
x
y
x
y,
x
y
z
• Leapfrog in time domain
E
x n-1
B,J
n
n-1/2
n+1/2
V
15
Time step is limited by the Courant condition FSC
•
Plane EM Waves in Vacuum
•
Dispersion relation from difference scheme
– (E,B)=(E0,B0)exp(ik·x-iωt)
€
•
Small ∆ t is required for stability in explicit schemes
•
Large ∆ t can be achieved with implicit schemes – Still need to resolve relevant physics
sin(ωΔt /2) ωΔt /2 sin(kx Δx /2) κ x = kx k x Δx /2 Ω=ω
ΩB = κ × E ΩE = −κ × B
2 ⎛ ωΔt ⎞ 2 ⎛ k x Δx ⎞ 2 ⎛ k y Δy ⎞ ⎜ sin 2 € ⎟ ⎜ sin 2 ⎟ ⎜ sin 2 ⎟ 2 2 2 Ω = c κ ⇒ ⎜ ⎟ ⎟ = ⎜ ⎟ + ⎜ ⎜ cΔt ⎟ ⎜ Δx ⎟ ⎜ Δy ⎟ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠
€
1 1 1 > 2+ 2 2 c Δt Δx Δy 2
Courant Condition for Numerical Stability
€
16
The numerical dispersion relation contains modes with VphVph, unwanted Cerenkov emission can occur.
2
Numerical dispersion (c∆t/∆x=0.6)
1 0
1
2
3
kΔx
2 ⎛ ωΔt ⎞ 2 ⎛ k x Δx ⎞ 2 ⎛ k y Δy ⎞ ⎜ sin 2 ⎟ ⎜ sin 2 ⎟ ⎜ sin 2 ⎟ ⎟ ⎜ ⎟ = ⎜ ⎟ + ⎜ cΔt Δx Δy ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠
€
17
Pushing Particles FSC
E( x k ) = ∑ E ij S(x k − X ij )
• To update p, EM fields have to first be interpolated from the grid to the particle locations
i, j
ΔA
Δy
– Linear (area) weighting
Δx €
• The same S should be used in charge deposition to ensure momentum conservation
ΔA S( x k − X ij ) = ΔxΔy ∑ S(x k − X ij ) = 1
(i, j) €
€
i, j
€
€ ρ ij = ∑ qk S(x k − X ij ) k
dP = ∑ qk E(x k ) = ∑ qk ∑ E ij S(x k − X ij ) dt k k i, j
– dP/dt=0 for 1 particle, independent of S.
= ∑ E ij ρ ij i, j
1
€
E1 = −
2
ρ2 ρ , E 2 = 1 ⇒ E1ρ1 + E 2 ρ 2 = 0 2 2 18
€
Pushing Particles (Boris Pusher) FSC
p n +1/ 2 − p n−1/ 2 q n 1 p n +1/ 2 + p n−1/ 2 = (E + × Bn ) n Δt m c 2γ B n +1/ 2 + B n−1/ 2 (B = ) 2
• Differencing Relativistic Newton’s Eq.
n
• Separating fE & fB
Δt q n E 2 m Δt q n p n +1/ 2 = p + + E 2 m p− = p n−1/ 2 +
€
• The magnetic force causes a pure rotation €
p + − p− q p+ + p_ = × Bn n Δt mc 2γ [( p + ) 2 − ( p− ) 2 = 0]
€
19
€
v×B Rotation FSC
Eq. for v×B rotation p + − p− q p+ + p_ n = × B Δt mc 2γ n
p⊥+
p⊥+ − p−⊥
θ € €
− ⊥
tan
+ ⊥
p +p
€ p−⊥
θ qB =− Δt 2 2mcγ
€ €
In practice, this is used
€ p+
−
−
p'= p + p × t, p + = p− + p'×s,
θ (t = qBΔt /2γmc = −tan ) 2 θ θ (s = 2t /(1+ t 2 ) = −2sin cos ) 2 2
p'×s
θ p' €
€ p−
€
p− × t
€ €
€
20
Current Deposition & Charge Conservation FSC
x
•
Updating positions
•
Current deposition needs both V & x defined at different times
j
– ∂ρ/∂t+∇⋅j=0 may not be satisfied
n +1/ 2 ij
€
= ∑q v
•
Charge conservation is critical to guarantee solutions satisfying all Maxwell’s eqs. Two ways to achieve charge conservation
– Adjusting longitudinal E – Using charge-conserving current deposition schemes – Spectral method
€
p n +1/ 2 = x + n +1/ 2 Δt γ
n +1/ 2 k k
k
or
•
n +1
n
x kn + x kn +1 S( − X ij ) 2
n n +1 − X ij ) n +1/ 2 S( x k − X ij ) + S( x k
j ijn +1/ 2 = ∑ qk v k k
€
2
∂t B = −∇ × E ⇒ ∂t ∇ ⋅ B = 0 ∂t E = ∇ × B − J ⇒ ∂ t ∇ ⋅ E = −∇ ⋅ J ⎯ ⎯? →∂ t ρ
21
Charge-Conserving Current Deposit Scheme FSC
For unit grid & unit charge (0.5 − y) + (0.5 − y − Δy) 1 = Δx(0.5 − y − Δy) 2 2 1 J x 2 = Δx(0.5 + y + Δy) 2 1 J y1 = Δy(0.5 − x − Δx) 2 1 J y 2 = Δy(0.5 + x + Δy) 2 J x1 = Δx
€
For more complicated crossing, the current can be calculated in stages [see Villasenor & Buneman, Computer Phys. Comm. 69, 306 (1992).] 22
Adjusting E to Satisfy ∇⋅E=ρ FSC
• E’ obtained from a non-CC j does not satisfy ∇⋅E’=ρ • Find δφ so that ∇2 δφ= ∇⋅E’-ρ • The corrected field is E=E’- ∇δφ
j+1 (Ez,, Bz, Jz)
j+1/2 (Ey,, By, Jy)
j
(ρ,δφ)
i
(Ex,, Bx, Jx)
i+1/2
i+1 23
Boundary conditions are important to model reality FSC
• For fields – Periodic – Conducting – Open, absorbing,…
• For particles
z z z z E −1/ 2, j = E Nx−1/ 2, j , E Nx +1/ 2, j = E1/ 2, j ,...
E € €
y 0, j
z z E −1/ 2, j + E1/ 2, j = 0, =0 2
j+1 (Ez,, Bz, Jz)
j+1/2 (E , B , J ) (E , B , J ) j i i+1/2 i+1 y,
y
y
x,
x
x
– Periodic – Reflecting – Thermal bath
24
Grid Instability FSC
•
Since particle positions are continuous, δn can have high-k modes – Dominated by kn~ωp/vt
•
Due to aliasing, δρ can have modes with k=kn-p(2π/∆x)
•
δρ can resonantly interact with E of the same k, causing instability
•
In practice, if ∆ωp
overdense ω050 keV electron distribution in px-py space
Px
Px
Most hot e- are generated in the nonlinear stage FSC
10000
1000
100
2ps 4ps
10
9.9ps
1
The existence of >100 keV e- is consistent with hard X-ray diagnostic
The appearance of hot e- (>100 keV) is correlated to new modes that are not seen in the linear stage
Px
FSC
X
Plane-wave, 2D PIC simulations gave 10-100X more hot electrons than HXR measurements FSC Max I14
Te(keV)
Ti(kev)
Lµm
Mi/me
Run time
Forward Hot e-(>50kev)
Abs
η
4
3
1.5
150
3410
5ps
~0 (100 ptc per cell)
~0
0.8
6
3
1.5
150
3410
10ps
17% (100 ptc per cell)
42%
1.2
B. Yaakobi et al., Phys. Plasmas 16, 102703 (2009): hot e-