A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time integrations

Andrew Myers [email protected] Applied Numerical Algorithms Group, Computational Research Division with Phillip Colella, Brian Van Straalen, Bei Wang, Boris Lo, Victor Minden

Advanced Modeling Seminar Series NASA Ames Research Center https://arxiv.org/abs/1602.00747 November10th, 2016 2 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 3 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 4 The Vlasov-Poisson Equations

@f @f @f + v E =0 @t · @x · @v

2 = ⇢ E = r r

• The Vlasov-Poisson equations describe the evolution of a charged, collisionless fluid in phase space. • The electric field is obtained by solving Poisson’s equation. • Applicable as a simplified model to (space plasmas, accelerator modeling, controlled fusion) and to cosmology.

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 5 Eulerian Methods

• Nonlinear advection equation in a high-dimensional space, can be solved by Eulerian techniques. • Advantages: – Strong body of theory on finite volume methods – Do not suffer from “noise” – High order methods exist (Vogman + 2014) • Disadvantages: – High cost of grids in high-dimensional (4D, 5D, or 6D) spaces

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 6 Particle Methods

• Discretize system with set of Lagrangian interpolating points, P

f(x, v,t ) q x x i v v i ini ⇡ p p p p X2P • Reduces problem to system of ODEs for particle trajectories:

dqp =0 v p x (t) dt p dx p = v E p dt p dv p = E dt p • Can reconstruct distribution at later times from (x p(t), v p(t))

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 7 Particle Methods

• Variety of methods - mainly differ in how the force is computed • PIC methods, in which the force solve is performed on an intermediate grid, are particularly popular. • Advantages: – Mathematically simpler. Reduces a PDE to a set of coupled ODEs. – Naturally adaptive - the particles go where more resolution is needed. – Usually lower computational cost

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 8 Disadvantages of Particle Methods

• Less Wang+2011 mathematical guidance • Particle noise prevents convergence • Usually limited to 2nd order accuracy

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 9 The goal of this talk

• Describe a particle method (PIC) that attempts to address these downsides. • Show how to all the PIC stages at 4th-order – Heart of this is really the interpolation kernels. • Describe a high-order remapping procedure to ameliorate particle noise while maintaining 4th order accuracy

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 10 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 11 Overview of a Particle-in-Cell time step

Start • Deposition: Particle charges are deposited onto mesh:

n+1 q x i x ⇢n+1 = p W p i x x p ! Deposition X ⇣ ⌘

2nd order: Piecewise linear, Cloud-in-Cell interpolation • Field solve: force is computed on the mesh by e.g. Field Solve solving Poisson’s Equation w/ 2nd order finite differences.

Interpolation • Interpolation: Force is interpolated back to particle positions using same kernel.

• Particle Push: Particle positions and velocities are Particle Push updated. 2nd-order leapfrog.

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 12 High-order in space (interpolation kernels)

⇢ ⇢ 1 • Given solution at a set of points, 0 ... reconstruct in between

• Functions W(x) need to be even, normalized, have compact support

x x ⇢(x) W j ⇢ ⇡ x j j X ✓ ◆ x0 x1 ...

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 13 High-order in space (interpolation kernels)

• Commonly taken to be one of the B-spline functions. Limited to 2nd Order.

NGP CIC TSC

1 x , 0 x 1, 3 x 2, 0 x 1/2, 1, 0 x 1/2, 4 M2(x)= | | | | 1 3| | 2 | | M1(x)= | | 0 otherwise. M3(x)= x , 1/2 x 3/2, 0 otherwise. 8 2 2 ⇢ 0| |  otherwise.| | ⇢ < :

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 14 High-order in space (interpolation kernels)

• Error analysis involves looking at the of W ( x ) , W˜ (k)

• Can show that W ˜ ( k ) 1 must have a zero of order n at k =0 AND W ˜ ( k ) must have zeros of order n at k =2 ⇡ , 4 ⇡ , ... to be O(n). sin (k/2) n • For the Basis spline of order n, W˜ (k)= k/2 ✓ ◆ • Fulfills the second requirement, but zero at k = 0 is only order 2.

• Hence, all the basis splines interpolate with at best 2nd order accuracy • They do, however, have increasing degrees of smoothness which may be desirable when the particles are highly disordered. • See Schoenberg 1975, Monaghan 1985 for more details.

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 15 High-order in space (interpolation kernels)

• However, it is possible to design a polynomial with the appropriate zeros in Fourier space and transform back into real space to obtain a W ( x ) with the desired properties. • For details, see Lo, Minden, and Colella 2016.

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time B a0 =1 W˜ q(k)

q/2 1 W (x)= a ( 1)pM (2p)(x), q 2p q p=0 X B [ q/16 2,q/2] High-order in space (interpolation kernels)Wq q =4, 6

3 x 2 x | 2| x |2| +1, x [0, 1], 3 | | | | 2 x 2 11 x W4(x)=8 | | + x | | +1, x [1, 2], 6 | | 6 | | 2 <> 0, x 5 x 4 5 x 3 5 x 2 x :> | | + | | + | | | | | | +1, x [0, 1], • 4-point stencil 12 4 12 4 3 | | 2 x 5 3 x 4 25 x 3 5 x 2 13 x • Reproduces8 cubic |24| |8| + 24| | |8| 12| | +1, x [1, 2], W6(x)= | | 2 > x 5 x 4 17 x 3 15 x 2 137 x functions exactly> | | + | | | | + | | | | +1, x [2, 3], < 120 8 24 8 60 | | 2 • Continuous with 0, > discontinuous> first derivative :> k k =4 q A high-order accurate Particle-In-Cell method q for Vlasov-Poisson problems over long time [ q/2,q/2] 17 High-order in space (field solve)

• Replace 2nd-order finite difference approximation with 4th-order, centered differences:

D 2 i+2ed + 16i+ed 30i + 16i ed i+2ed = ⇢ = ⇢i 12x2 r d=1 X

d i+2ed +8i+ed 8i ed + i+2ed E = E = r i 12x

• Resulting system can be solved with a variety of methods (we used geometric multigrid).

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 1 The Method

The goal is to solve the following system of equations for the particle posi- tions and velocities x and v given the force F : x˙ = v v˙ = F (t, x). (1) 18 The standard, fourth-order Runge-Kutta method applied to this system High-ordergives, for thein specialtime case (RK4) of a force that does not depend on v: 1 xn+1 = xn + vnt + (k +2k ) t2 6 1 2 1 The Method 1 vn+1 = vn + (kn +4k + k ) t, (2) • Replace leapfrog with 4th-Order Runge-Kutta6 1 2method3 The goal is to solve the following system of equations for the particle posi- where tions and velocities x and v given the force F : k = F (tn,xn) 1 x˙ = v 1 1 1 k = F tvn˙ += Ft,( xt,n x+). vnt + k t2 (1) 2 2 2 8 1 ✓ ◆ The standard, fourth-order Runge-Kutta method1 applied to this system k = F tn + t, xn + vnt + k t2 . (3) gives, for the special3 case of a force that does not depend2 2 on v: ✓ ◆ Note the sequentialn+1 naturen ofn this algorithm;1 k must2 be computed before x = x + v t + (k1 +2k21) t k2, which must be computed before k36. An alternative is to extrapolate the forces from then previous+1 timen 1 step.n For example, the forces at the stages v = v + (k1 +4k2 + k3) t, (2) corresponding to times tn 6 t, tn 1 t, and tn were kn, kn, and kn. 2 1 2 3 whereDefining n n k1 = F (t ,x ) t (tn t) • Requires 3 force solves per time step⌧ = (velocity independent, force), instead(4) of 1 n 1 n 1 t n 1 2 k2 = F t + t, x + v t + k1t a 2nd order interpolating polynomial2 that2 passes8 through the required points • Self-starting. Gives up on symplectic✓ property. ◆ is n n n 1 2 k3 = F t + t, x + v t + k2t . (3) n n n 2 n 2 n n n f˜(⌧)=(2k ✓4k +2k ) ⌧ +( 3k +4k ◆k ) ⌧ + k . (5) 1 2 3 1 2 3 1 Note the sequential nature of this algorithm; k must be computed before A high-orderFor ⌧ = accurate 0, 1/2, and 1, weParticle-In-Cell recover kn, kn, and k1n, method respectively. Extrapolated k , which must be computed before k 1. An2 alternative3 is to extrapolate the 2 forward to ⌧ = 1, 3/2, and 2 (t = 3tn,tn +1/2t, and tn + t), we find: for Vlasov-Poissonforces from the previous problems time step. For over example, long the forcestime at the stages corresponding to times tn f˜(1)t, t =n k1nt, and tn were kn, kn, and kn. 23 1 2 3 Defining 3 f˜ = kn 3kn +3kn 2 1 2 3 ✓ ◆t (tn t) ⌧f˜(2)= = 3kn 8,kn +6kn. (4) (6) t 1 2 3 a 2nd order interpolating polynomial that passes through the required points is 1 f˜(⌧)=(2kn 4kn +2kn) ⌧ 2 +( 3kn +4kn kn) ⌧ + kn. (5) 1 2 3 1 2 3 1 n n n For ⌧ = 0, 1/2, and 1, we recover k1 , k2 , and k3 , respectively. Extrapolated forward to ⌧ = 1, 3/2, and 2 (t = tn,tn +1/2t, and tn + t), we find: ˜ n f(1) = k3 3 f˜ = kn 3kn +3kn 2 1 2 3 ✓ ◆ f˜(2) = 3kn 8kn +6kn. (6) 1 2 3

1 19 Particle Remapping

• In PIC convergence theory, stability error for field contains exponential term: eE(x,t) exp (at) (Wang+2011) / • Periodically restart problem with new particles with interpolated weights

Particles with tiny masses are discarded

Before remap After remap B a0 =1 W˜ q(k)

q/2 1 W (x)= a ( 1)pM (2p)(x), q 2p q p=0 X B [ q/2,q/2] Wq q =4, 6 20

3 x 2 x Particle Remapping| 2| x |2| +1, x [0, 1], 3 | | | | 2 x 2 11 x W4(x)=8 | | + x | | +1, x [1, 2], 6 | | 6 | | 2 <> 0, x 5 x 4 5 x 3 5 x 2 x :> | | + | | + | | | | | | +1, x [0, 1], 12 4 12 4 3 | | 2 x 5 3 x 4 25 x 3 5 x 2 13 x 8 |24| |8| + 24| | |8| 12| | +1, x [1, 2], W6(x)= | | 2 > x 5 x 4 17 x 3 15 x 2 137 x > | | + | | | | + | | | | +1, x [2, 3], < 120 8 24 8 60 | | 2 0, > > :> k k =4 • One order of accuracyq is lost during the remap step q [ q/2,q/2] • High-order deposition • 6-point, 6th-order stencil 21 Particle Remapping

• Particles are laid on at the cell centers of a (possibly AMR) Cartesian grid in phase space. The new weights are then computed as:

x i x p v j v p q⇤ = q W W p p 6 h 6 h p x v X ✓ ◆ ✓ ◆

• Particles with small weights are discarded. • Can be applied every few time steps, or just a few times per calculation • Can be thought of as Semi-Lagrangian • Compare the Forward Semi-Lagrangian technique (Crouseilles+2008) 22 Particle Remapping

• Higher order interpolation functions are not positivity preserving

(x y)`W (x y)dy D ZR

• Can show that the 2nd moment of the interpolating function must vanish for Positivity not guaranteed the kernel to have better than 2nd order accuracy. 23 Particle Remapping

• Higher order interpolation functions are not positivity preserving

(x y)`W (x y)dy D ZR

• Use a redistribution procedure to maintain positivity of the distribution Positivity not guaranteed function 24 Redistribution procedure

l neighboring cells n fi =min(0,fi ) n ⇠i+l = max(0,fi+l )

n+1 n ⇠i+l fi+l = fi+l + neighbors fi k=0 ⇠i+k 6 • 2 or 3 iterations is usually sufficientP 25 Particle Remapping AMR example

• Example distribution function from a remapping stage, using 4 AMR levels • Cosmological dark matter test problem (Myers+2015) 26 Remapping on Cosmology Calculation

Not remapped Remapped

http://adsabs.harvard.edu/abs/2016ApJ...816...56M 27 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 28 Implementation

• Chombo - A set of tools for numerically solving PDEs • Especially useful for AMR applications • Mixture of C++ and FORTRAN • Uses a Box-based, SPMD approach to parallelism • Provides distributed data containers, including (in the next release) for particle data • Our method was implemented using these tools, running NERSC’s Edison machine + my laptop. • Code, tests, and analysis scripts are all here:

https://bitbucket.org/atmyers/4thorderpic

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 29 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 30 Linear Landau Damping

• Exponentially damped oscillation of a space charge • Wave-particle interactions cause the electric field wave to lose energy to the particles, damping its amplitude • Very commonly used test problem for PIC codes – Analytic solution for the decay rate – Long-time evolution is challenging for classical PIC methods

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 31 Linear Landau Damping (initial conditions)

• Gaussian velocity distribution • Small (linear) perturbation to the charge density (physical space) • Track the electric field as a function of time

1 2 f(x, v, t = 0) = exp v /2 (1 + ↵ cos (kx)) k =0.5 p2⇡ ↵ =0.01 (x, v)=[0,L=2⇡/k] [ v ,v ] ⇥ max max

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 32 Linear Landau Damping (movie)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 33 Linear Landau Damping (results)

• Black shows simulation result, red shows damping rate expected from linear theory. • Remapping is needed to track the analytical damping rate for late times. • Recurrence effect seen in all simulations past t = 80, a consequence of finite cell spacing in the velocity dimension

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 34 Convergence studies for PIC simulations

• All discrete elements of the problem, including t , reduced by factor of 2.

• Ratio of x/h x remains fixed.

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 35 Convergence studies for PIC simulations

• We then use Richardson extrapolation to compute the error. • The error in the electric field is then defined as:

eh = E h E 2h | | • And the order is computed as:

e2h q = log || || 2 eh ✓ || || ◆ A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 36 Linear Landau Damping (convergence results)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 37 Linear Landau Damping (results)

Remapping every 5 steps gives the best results, but even every 100 helps

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 38 Nonlinear Landau Damping (initial conditions)

1 f(x, v, t = 0) = exp v2/2 (1 + ↵ cos (kx)) p2⇡ (x, v)=[0,L=2⇡/k] [ v ,v ] ⇥ max max

k =0.5 ↵ =0.5

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 39 Nonlinear Landau Damping (movie)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 40 Nonlinear Landau Damping (results)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 41 Nonlinear Landau Damping (convergence)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 42 Nonlinear Landau Damping (Phase Diagrams)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 43 Two-Stream Instability

• Initial distribution function corresponds to two particle streams with opposing velocities: 1 f(x, v, t = 0) = v2 exp v2/2 (1 + ↵ cos (kx)) p2⇡ (x, v)=[0,L=2⇡/k] [ v ,v ] ⇥ max max

k =0.5 ↵ =0.01

“Inverse” of Landau Damping

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 44 Two-Stream Instability

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 45 Two-Stream Instability

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 46 Two-Stream Instability

Remapping 10 times (out of ~1000)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 47 Two-Stream Instability (convergence results)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 48 Two-Stream Instability

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 49 http://yt-project.org/

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 50 Talk Outline

• Background and motivation • Description of our numerical method • Implementation using the Chombo framework • Numerical results • Summary and future research directions

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time 51 Summary and Future Research

• High-order method is more accurate in regions where the flow is smooth • Not more necessarily more accurate for thin or unresolved phase- space features in the nonlinear regime. • Remapping is necessary to control particle noise over long time evolutions • Involves some degree of retreat from pure Lagrangian. AMR helps to an extent.Trade-offs need to be explored. • Future research involves performing the remap selectively rather than globally. • Coupled with high-order Maxwell solver for electromagnetic PIC (Sven Chilton)

A high-order accurate Particle-In-Cell method for Vlasov-Poisson problems over long time Thanks for listening!

Andrew Myers [email protected] Applied Numerical Algorithms Group, Computational Research Division with Phillip Colella, Brian Van Straalen, Bei Wang, Boris Lo, Victor Minden

Advanced Modeling Seminar Series NASA Ames Research Center November 10th, 2016 https://arxiv.org/abs/1602.00747