SlideShare a Scribd company logo
Controlling Numerical Error in Particle-in-Cell
Simulations of Collisionless Dark Matter
Andrew Myers
atmyers@lbl.gov
Applied Numerical Algorithms Group, Computational Research Division
with Phillip Colella, Brian Van Straalen
SIAM-CSE Meeting
March 17th, 2015
Extreme Resilient Discretizations
Submitted to ApJ
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• Standard PIC methods don’t converge for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
2
Talk outline
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• Standard PIC methods don’t converge for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
3
Talk outline
Tuesday, March 17, 15
Roofline Performance Model
Cori Node
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
4
Roofline Model - High Arithmetic Intensity needed
for maximum performance
Tuesday, March 17, 15
• Field solve: force is computed on the mesh by e.g.
solving Poisson’s Equation w/ 2nd order finite
differences.
• Interpolation: Force is interpolated back to particle
positions using same kernel.
• Particle Push: Particle positions and velocities are
updated. 2nd-order leapfrog.
• Deposition: Particle masses are deposited onto mesh:
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
5
This is a problem for 2nd Order PIC Methods
⇢n+1
i =
X
p
✓
mp
Vi
◆
W
xi xn+1
p
x
!
2nd order: Piecewise linear, Cloud-in-Cell interpolation
Start
Deposition
Field Solve
Interpolation
Particle Push
Tuesday, March 17, 15
• Poisson solve is a global bottleneck. Theoretical peak AI is bad.
• Even if we read in a chunk of particles and do all the work we possibly can before
moving on to the next chunk, by:
• Reading in a batch of particles
• Subtracting of their contribution to the density
• Interpolating the field to the particle positions
• Pushing the particles
• Depositing the particles at their new positions
AI .
1
1 + 1/nppc
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
6
Performance problems: global bottleneck, poor AI
In 1D,
perfect cache:
24 Flops,
3 doubles per
particle,
3 doubles per
cell
1 for high ppc (convergence)
1/2 for 1 particle per cell
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
7
Improving AI - Higher Order in Space
B a0 = 1
˜Wq(k)
Wq(x) =
q/2 1
X
p=0
a2p( 1)p
M(2p)
q (x),
B
[ q/2, q/2]
Wq q = 4, 6
W4(x) =
8
><
>:
|x|3
2 |x|2 |x|
2 + 1, |x| 2 [0, 1],
|x|3
6 + |x|2 11|x|
6 + 1, |x| 2 [1, 2],
0,
W6(x) =
8
>>>><
>>>>:
|x|5
12 + |x|4
4 + 5|x|3
12
5|x|2
4
|x|
3 + 1, |x| 2 [0, 1],
|x|5
24
3|x|4
8 + 25|x|3
24
5|x|2
8
13|x|
12 + 1, |x| 2 [1, 2],
|x|5
120 + |x|4
8
17|x|3
24 + 15|x|2
8
137|x|
60 + 1, |x| 2 [2, 3],
0,
k
k = 4
q
q
[ q/2, q/2]
B a0 = 1
˜Wq(k)
Wq(x) =
q/2 1
X
p=0
a2p( 1)p
M(2p)
q (x),
B
[ q/2, q/2]
Wq q = 4, 6
W4(x) =
8
><
>:
|x|3
2 |x|2 |x|
2 + 1, |x| 2 [0, 1],
|x|3
6 + |x|2 11|x|
6 + 1, |x| 2 [1, 2],
0,
W6(x) =
8
>>>><
>>>>:
|x|5
12 + |x|4
4 + 5|x|3
12
5|x|2
4
|x|
3 + 1, |x| 2 [0, 1],
|x|5
24
3|x|4
8 + 25|x|3
24
5|x|2
8
13|x|
12 + 1, |x| 2 [1, 2],
|x|5
120 + |x|4
8
17|x|3
24 + 15|x|2
8
137|x|
60 + 1, |x| 2 [2, 3],
0,
k
k = 4
q
q
[ q/2, q/2]
• Replace CIC with higher-order interpolation kernels
• Discrete delta approximations of any order we want (Lo, Minden, Colella
2015, in prep)
4 x AI 8 x AI
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
8
High-order, time integrators with fewer bottlenecks -
Example: RK4
• 4th order RK methods require 3 or 4 force evaluations per time step, and 2
or 3 particle pushes. These must be done sequentially.
• An alternative is to store the force evaluations from the RK4 stages of the
previous time step at grid points, and extrapolate to get approximate forces
with which to compute the displacements for your next time step.
• Cheap with many p.p.c.
tn t tn
1
2
t tn +
1
2
t tn + ttn
f(tn t) ˜f(tn + t)
f(tn
1
2
t) ˜f(tn +
1
2
t)
f(tn)
- past
- future
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
9
• Here is an example for a velocity-independent force using a 2nd order
interpolating polynomial to extrapolate the forces.
If we use these approximate force to compute the displacements, we have
kn+1
1 = F (tn
, xn
)
kn+1
2 = F
✓
tn
+
1
2
t, xn
+
1
2
vn
t +
1
8
˜f(1) t2
◆
kn+1
3 = F
✓
tn
+ t, xn
+ vn
t +
1
2
˜f
✓
3
2
◆
t2
◆
(7)
An alternative time-stepping scheme with better arithmetic intensity is
thus
kn+1
1 = F (tn
, xn
)
kn+1
2 = F
✓
tn
+
1
2
t, xn
+
1
2
vn
t +
1
8
kn
3 t2
◆
kn+1
3 = F
✓
tn
+ t, xn
+ vn
t +
1
2
(kn
1 3kn
2 + 3kn
3 ) t2
◆
xn+1
= xn
+ vn
t +
1
6
kn+1
1 + 2kn+1
2 t2
vn+1
= vn
+
1
6
kn+1
1 + 4kn+1
2 + kn+1
3 t. (8)
This is quite similar to the classical method, except that the displacements
for all three k values can be computed without doing any force solves.
Using Taylor expansions, one can verify that this is still 4th-order accu-
rate. In fact, one could also use linear extrapolation for ˜f(⌧) with any two
of the RK stages from time step n 1 and still retain 4th-order accuracy.
2 Stability Analysis
To check for stability, we consider the linearized model system:
˙x = v
˙v = x. (9)
The numerical scheme in equation (7), applied to (8), can be written in
a compact form if we consider the lagged forces kn
1 , kn
2 , and kn
3 to be part
The Method
goal is to solve the following system of equations for the particle posi-
and velocities x and v given the force F:
˙x = v
˙v = F(t, x). (1)
The standard, fourth-order Runge-Kutta method applied to this system
, for the special case of a force that does not depend on v:
xn+1
= xn
+ vn
t +
1
6
(k1 + 2k2) t2
vn+1
= vn
+
1
6
(kn
1 + 4k2 + k3) t, (2)
e
k1 = F (tn
, xn
)
k2 = F
✓
tn
+
1
2
t, xn
+
1
2
vn
t +
1
8
k1 t2
◆
k3 = F
✓
tn
+ t, xn
+ vn
t +
1
2
k2 t2
◆
. (3)
Note the sequential nature of this algorithm; k1 must be computed before
which must be computed before k3. An alternative is to extrapolate the
s from the previous time step. For example, the forces at the stages
sponding to times tn t, tn 1
2 t, and tn were kn
1 , kn
2 , and kn
3 .
ning
⌧ =
t (tn t)
t
, (4)
d order interpolating polynomial that passes through the required points
˜f(⌧) = (2kn
1 4kn
2 + 2kn
3 ) ⌧2
+ ( 3kn
1 + 4kn
2 kn
3 ) ⌧ + kn
1 . (5)
= 0, 1/2, and 1, we recover kn
1 , kn
2 , and kn
3 , respectively. Extrapolated
ard to ⌧ = 1, 3/2, and 2 (t = tn, tn + 1/2 t, and tn + t), we find:
˜f(1) = kn
3
˜f
✓
3
2
◆
= kn
1 3kn
2 + 3kn
3
˜f(2) = 3kn
1 8kn
2 + 6kn
3 . (6)
he Method
l is to solve the following system of equations for the particle posi-
d velocities x and v given the force F:
˙x = v
˙v = F(t, x). (1)
standard, fourth-order Runge-Kutta method applied to this system
r the special case of a force that does not depend on v:
xn+1
= xn
+ vn
t +
1
6
(k1 + 2k2) t2
vn+1
= vn
+
1
6
(kn
1 + 4k2 + k3) t, (2)
k1 = F (tn
, xn
)
k2 = F
✓
tn
+
1
2
t, xn
+
1
2
vn
t +
1
8
k1 t2
◆
k3 = F
✓
tn
+ t, xn
+ vn
t +
1
2
k2 t2
◆
. (3)
the sequential nature of this algorithm; k1 must be computed before
h must be computed before k3. An alternative is to extrapolate the
om the previous time step. For example, the forces at the stages
nding to times tn t, tn 1
2 t, and tn were kn
1 , kn
2 , and kn
3 .
⌧ =
t (tn t)
t
, (4)
der interpolating polynomial that passes through the required points
All the right hand sides for Poisson can be computed at once for a
subset of particles that will fit in cache. Still 4th order accurate. Real
issue is time step.
3 - 4 x AI
High-order time integrators, w/ fewer bottlenecks -
Example: Extrapolating RK4
Total for going to high order: ~ 10 x
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
10
Another important question: Will these techniques
actually give better results?
• Need to evaluate the utility of these methods on realistic problems
• For plasma PIC, yes. Convergence theory and empirical evidence from Wang, Miller,
and Colella 2011. Need remapping and high particle counts (100-1000 particles per
cell).
1e-06
1e-05
0 5 10 15 20 25 30
t
hx=L/64, hv=vmax/128
hx=L/128, hv=vmax/256
hx=L/256, hv=vmax/512
(a)
-1
0 5 10 15 20 25 30
co
t
(b)
Fig. 10. Error and convergence rate plots for the two-stream instability without remapping.
We set rh = 1/2. Scales (hx, hv) denote the particle grid mesh spacing at the base level. (a) The
L∞ norm of the electric field errors on three different resolutions. (b) The convergence rates for
the errors on plot (a). Second-order convergence rates are lost around t = 20.
1e-06
1e-05
0.0001
0.001
0.01
0.1
0 5 10 15 20 25 30
error
t
hx=L/64, hv=vmax/128
hx=L/128, hv=vmax/256
hx=L/256, hv=vmax/512
(a)
-1
0
1
2
3
0 5 10 15 20 25 30
convergencerate
t
hx=L/128, hv=vmax/256
hx=L/256, hv=vmax/512
(b)
Fig. 11. Error and convergence rate plots for the two-stream instability with remapping. We
set rh = 1/2. Scales (hx, hv) denote the particle grid mesh spacing at the base level. (a) The L∞
norm of the electric field errors on three different resolutions. (b) The convergence rates for the
Wang+2011
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
11
For Cosmology, Evidence Suggests Not...
Romain TeyssierComputational Astrophysics 2009
High-resolution with constant force softening
Particle discreteness effects show up
quite dramatically in Warm Dark
Matter simulations (from Wang &
White, MNRAS, 2007)
Very slow convergence N^(-1/3)
These effects can be neglected if
d: local inter-particular spacing
Adaptive force softening ?
Splinter, R.J., Melott, A.L., Shandarin, S.F., Suto, Y., “ Fundamental Discreteness
Limitations of Cosmological N-Body Clustering Simulations”, ApJ, 497, 38, (1998)
Romeo, A.B., Agertz, O., Moore, B., Stadel, J., “Discreteness Effects in ΛCDM
Simulations: A Wavelet-Statistical View”, ApJ, 686, 1, (2008)
maintain the strict planar symmetry of the pancake collapse that
is apparently the root cause of the problem. To reiterate, the 2563
and 5123
PM runs roughly span the force resolutions used for
the other codes, and since only the 5123
run shows a very mild
failure of convergence, force resolution alone cannot be the source
of the difficulty.
Our results provide a different and more optimistic interpreta-
tion of the findings of Melott et al. (1997; see also Binney 2004).
While high-resolution codes when run with small smoothing
lengths (or several refinement levels in the case of AMR) are
not able to pass the pancake test after the formation of several
caustics, the main culprit appears to be an inability to maintain
the planar symmetry of the problem and not direct collisionality
(at least at the force resolutions relevant for this paper), which
Fig. 3.—Failure of convergence near the midplane for the pancake test: MC2
results, 643
particles with four grid sizes at z ¼ 0. Convergence fails at the final
resolution reduction step (going from a 2563
mesh to a 5123
mesh). See the text
for a discussion of these results.
F COSMOLOGICAL SIMULATIONS. I. 33
Wang + White 2007
Heitmann+2005
Also: “Demonstrating Discreteness and Collision Error in
Cosmological N-body Simulations of Dark Matter
Gravitational Clustering” - Melott + 1997
Need to be addressed before
benefiting from high order
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• Standard PIC methods don’t converge for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
12
Talk outline
Tuesday, March 17, 15
• Important point: all cosmology simulations are run with singular
initial conditions:
@f
@t
=
v
a
·
@f
@x
+
✓
˙a
a
◆
v +
1
a
r ·
@f
@v
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
13
Vlasov-Poisson for Cosmology Simulations
f(x, v, tini) = ⇢(x, tini) (v ¯v)
• Low particle counts.
• Done for sound physical reasons, numerically problematic.
• We use PIC to solve this. Run a “Zel’dovich Pancake” setup.
• First, we do a 1D problem.
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
14
The Zel’dovich Pancake - 1D Convergence Results
• Convergence is bad
after particle
trajectories cross
• Poor convergence
rates in 1D hint at
more serious
problems in higher
dimensions...
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
15
The Zel’dovich Pancake - 2D, Tilted Results
• Spurious
fragmentation
regardless of the
number of particles
per Poisson cell
• Does not respect the
initial symmetry of
the problem setup
• Suggestive of Wang
+White 2007
1/4
1
256
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• Standard PIC methods don’t converge for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
16
Talk outline
Tuesday, March 17, 15
• Remove the singularity in the initial data
• Natural approach is to regularize the initial conditions via a finite, artificial
initial velocity dispersion, , for which we choose a Gaussian form:i
(v ¯v) !
✓
1
2⇡ i
2
◆D/2
exp

(v ¯v, tini))2
2 i
2
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
17
Regularized Initial Conditions
• Makes things look more like plasma case. Many particles per cell.
• Analogy with shock-capturing schemes in gas dynamics is instructive.
Tuesday, March 17, 15
lim
i!1
✓
1
2⇡ i
2
◆D/2
exp

(v ¯v, tini))2
2 i
2
= (v ¯v)
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
18
Regularized Initial Conditions
i = 0.2i = 0.4i = 0.8
Tuesday, March 17, 15
• For finite , we
do obtain the
expected order of
accuracy.
i
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
19
Regularized Convergence Results - 1D
Tuesday, March 17, 15
• This approach gives us a way to obtain
solutions to the original, cold problem
• For a given , increase resolution until a
converged solution is obtained.
• Then, look to see how the solutions
behave as .
• Inspired by a similar technique in vortex
methods
i
i ! 0
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
20
The Double Limit
tion asmay be seenby comparison with the S = 400 solution in the iast panel
3~It is therefore presumed that the curves in Figs 2 and 3 arc essentially The
n of the 6 equations (l), (2) for the two particular values of 6 chosen, over
me intervat 0 d t 6 4. Comparable accuracy can be obtained at later times by
smaller 3I and larger N.
effect of decreasing 6 at a fixed time (I = 1) greater than the vortex sheet’s
time (TV= 0.375) is shown in Fig. 5 which plots the interpolating curve fc:-
al values of 6 between 0.2 and 0.05. These calculations used N = 406 and
b x 1
FIG. 5. Solution of the 6 equations (1 1. (2) at I = 1.0 using 6 = 0.2. 0.15, 0.1. 0.05
Krasny, 1986
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
21
The Double Limit
• The converged, regularized solutions approach a well-defined curve.
• Artificial smooths out structures smaller than some length scale
• In practice, pick a length scale below which you won’t believe the results
i
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
22
Regularized Results - 2D
• Regularization works in 1D. However, the problem with fragmentation in
2D persists...
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• The failure of basic PIC for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
23
Talk outline
Tuesday, March 17, 15
eE
(x, t) / exp (at)
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
24
Particle Remapping
High-order deposition
Positivity not guaranteed, need
mass distribution
• In plasma convergence theory, error for
field contains exponential term:
Before remap After remap
• Periodically restart problem with new particles
Wang+2011
Particles with tiny
masses are discarded
Requires regularization
Tuesday, March 17, 15
• Wrinkle: In comoving
coordinates, velocities
shrink with time.
• shrinks as box
expands, must as well
• Solution: remap with AMR
• Resolves with same #
of particles throughout
• Example, 4 levels
v
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
25
Particle Remapping, with AMR
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
26
Remapping preserves order of method in 1D...
• Once this is
done, still get
2nd order in 1D
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
27
And greatly improves artificial fragmentation issue
RemappedNot remapped
a = 0.013 levels,
Tuesday, March 17, 15
• Motivation - why is understanding these errors relevant for us here?
• The failure of basic PIC for Cosmology applications
• Two modifications:
– Regularization
– Adaptive Remapping
• Summary and Future Research
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
28
Talk outline
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
29
Conclusions and Future Research
• We know how to make PIC converge on Cosmology problems at the
stated order of accuracy. Can now benefit from high-order PIC.
Interpolation kernels, etc. for doing so are there.
• The necessary scheme looks a lot like PIC for electrostatic plasmas:
with particle remapping and high particle counts.
• We can exploit this information for designing high-AI methods. Example
- extrapolating RK4.
• Results on the convergence of PIC schemes for cosmology have been
submitted to ApJ, paper and code available here:
https://bitbucket.org/atmyers/cosmologicalpic
Tuesday, March 17, 15
Thank you for listening!
Controlling Numerical Error in Particle-in-Cell
Simulations of Collisionless Dark Matter
Andrew Myers
atmyers@lbl.gov
Applied Numerical Algorithms Group, Computational Research Division
with Phillip Colella, Brian Van Straalen
SIAM-CSE Meeting
March 17th, 2015 Extreme Resilient Discretizations
Submitted to ApJ
Tuesday, March 17, 15
• VP equation is a non-linear advection equation in phase space
• Can be solved using Eulerian methods in phase space on up to
128^6 domains (Yoshikawa + 2013)
• Expense of working in high-dimensional spaces is significant, both in
terms of memory requirements and the number of operations
involved.
• Large range of scales involved implies that adaptivity is usually
required.
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
31
Eulerian Methods
Tuesday, March 17, 15
f(x, v, tini) ⇡
X
p2P
mp x xi
p v vi
p
P
dmp
dt
= 0
dxp
dt
=
1
a
vp
dvp
dt
=
˙a
a
vp +
1
a
gp
(xp(t), vp(t))
vp
gp
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
32
Particle Methods
• Discretize system with set of Lagrangian interpolating points,
• Reduces problem to system of ODEs for particle trajectories:
• Can reconstruct distribution at later times from
xp(t)
Tuesday, March 17, 15
f(x, v, tini) ⇡
X
p2P
mp x xi
p v vi
p
P
dmp
dt
= 0
dxp
dt
=
1
a
vp
dvp
dt
=
˙a
a
vp +
1
a
gp
(xp(t), vp(t))
vp
gp
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
33
Particle Methods
• Discretize system with set of Lagrangian interpolating points,
• Reduces problem to system of ODEs for particle trajectories:
“Viscous drag”
term associated
with comoving
coordinate
system
• Can reconstruct distribution at later times from
xp(t)
Tuesday, March 17, 15
• Naturally adaptive
• Do not require keeping track of full, phase-space distribution function
• Basically all of the workhorse Dark Matter codes take this approach (e.g.
Enzo, Flash, Nyz, RAMSES, Gadget, ART, CHARM)
• Differ mainly in the way they compute gp
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
34
Particle Methods
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
35
2nd order PIC for Cosmology
Start
Initialize Particles
EndTime to stop?
Particle Kick
Particle Drift
Particle Deposition
Poisson Solve
Force Interpolation
Particle Kick
yes
no
• Deposition / Interpolation handled by CIC
• Poisson’s equation solved w/ 2nd order FD
• Kick-Drift-Kick scheme (Miniati+Colella 2007)
vn+1/2
p =
an
an+1/2
vn
p +
1
an+1/2
gn
p
t
2
.
xn+1
p = xn
p +
1
an+1/2
vn+1/2
p t.
vn+1
p =
an+1/2
an+1
vn+1/2
p +
1
an+1
gn+1
p
t
2
.
Kick
Kick
Drift
All these pieces should be 2nd order.
Tuesday, March 17, 15
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
36
The Zel’dovich Pancake
• Collapse of a single, sinusoidal perturbation in an expanding background
• A common test case for cosmological dark matter codes
• Analytic solution exists prior to the “first caustic” - the time at which the
first matter parcels cross
• “Single-mode” analysis of cosmological structure formation
Tuesday, March 17, 15
• Usually, a uniform, zero-temperature fluid is discretized with evenly-
spaced, equal mass particles.
• These particles are then perturbed from the initial positions using the
Zel’dovich approximation.
• Each point in space has only one particle, no velocity dispersion
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
37
The Zel’dovich Pancake
Tuesday, March 17, 15
• These initial conditions represent an initial distribution function that is
singular in velocity space:
f(x, v, tini) = ⇢(x, tini) (v ¯v)
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
38
The Zel’dovich Pancake
• This approximation is made for good physical reasons.
• However, singular initial data can pose problems for numerical solution
methods. Problem may be ill-posed.
• When we look at the Richardson-extrapolated order as a function of time:
Tuesday, March 17, 15
• Sample the regularized distribution on a Cartesian grid in phase space,
discarding those with tiny masses.
• = initial particle spacing in physical, velocity space.
Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter
Andrew Myers, LBNL
39
Regularized Initial Conditions
(hx, hv)
Tuesday, March 17, 15

More Related Content

PDF
A Load-Balanced Parallelization of AKS Algorithm
TELKOMNIKA JOURNAL
 
PDF
Metodo Monte Carlo -Wang Landau
angely alcendra
 
PPTX
Matlab Assignment Help
Matlab Assignment Experts
 
PDF
Markov chain Monte Carlo methods and some attempts at parallelizing them
Pierre Jacob
 
PDF
Grovers Algorithm
CaseyHaaland
 
PPTX
Shor’s algorithm the ppt
Mrinal Mondal
 
PDF
Jere Koskela slides
Christian Robert
 
PDF
MetiTarski's menagerie of cooperating systems
Lawrence Paulson
 
A Load-Balanced Parallelization of AKS Algorithm
TELKOMNIKA JOURNAL
 
Metodo Monte Carlo -Wang Landau
angely alcendra
 
Matlab Assignment Help
Matlab Assignment Experts
 
Markov chain Monte Carlo methods and some attempts at parallelizing them
Pierre Jacob
 
Grovers Algorithm
CaseyHaaland
 
Shor’s algorithm the ppt
Mrinal Mondal
 
Jere Koskela slides
Christian Robert
 
MetiTarski's menagerie of cooperating systems
Lawrence Paulson
 

What's hot (20)

PPT
Qualifier
Alex Chuck
 
PPTX
Statistical Physics Assignment Help
Statistics Assignment Help
 
PDF
2012 mdsp pr06  hmm
nozomuhamada
 
PPTX
Ph.D. Defense
Muhammad Ahsan
 
PPTX
Mechanical Engineering Assignment Help
Matlab Assignment Experts
 
PDF
Cryptanalysis with a Quantum Computer - An Exposition on Shor's Factoring Alg...
Daniel Hutama
 
DOCX
Very brief highlights on some key details 2
foxtrot jp R
 
PPTX
AcceleratingBayesianInference
Luca Carniato
 
PPTX
Turing awards seminar
RajKumar Rampelli
 
PPT
Indexing Text with Approximate q-grams
Yasmine Long
 
PDF
audition wrutings. draft
NeverMora
 
DOCX
Very brief highlights on some key details tosssqrd
foxtrot jp R
 
PDF
Introduction to MCMC methods
Christian Robert
 
PDF
Recent developments on unbiased MCMC
Pierre Jacob
 
PPTX
Data Structure and Algorithms Merge Sort
ManishPrajapati78
 
PDF
Availability of a Redundant System with Two Parallel Active Components
theijes
 
PPT
D. Vulcanov, REM — the Shape of Potentials for f(R) Theories in Cosmology and...
SEENET-MTP
 
PPTX
A framework for practical fast matrix multiplication
Austin Benson
 
PDF
Control assignment#3
cairo university
 
Qualifier
Alex Chuck
 
Statistical Physics Assignment Help
Statistics Assignment Help
 
2012 mdsp pr06  hmm
nozomuhamada
 
Ph.D. Defense
Muhammad Ahsan
 
Mechanical Engineering Assignment Help
Matlab Assignment Experts
 
Cryptanalysis with a Quantum Computer - An Exposition on Shor's Factoring Alg...
Daniel Hutama
 
Very brief highlights on some key details 2
foxtrot jp R
 
AcceleratingBayesianInference
Luca Carniato
 
Turing awards seminar
RajKumar Rampelli
 
Indexing Text with Approximate q-grams
Yasmine Long
 
audition wrutings. draft
NeverMora
 
Very brief highlights on some key details tosssqrd
foxtrot jp R
 
Introduction to MCMC methods
Christian Robert
 
Recent developments on unbiased MCMC
Pierre Jacob
 
Data Structure and Algorithms Merge Sort
ManishPrajapati78
 
Availability of a Redundant System with Two Parallel Active Components
theijes
 
D. Vulcanov, REM — the Shape of Potentials for f(R) Theories in Cosmology and...
SEENET-MTP
 
A framework for practical fast matrix multiplication
Austin Benson
 
Control assignment#3
cairo university
 
Ad

Viewers also liked (14)

PPT
інформаційно роз’яснювальна робота. реєстрація. зно-2016
njhujdbwz
 
PDF
зарядись!
Максим Рева
 
PPTX
Executive & Managerial Planning for Bosch-Kazakhstan
viviennevibar
 
PPT
обдаровані учні
njhujdbwz
 
DOC
RogerResume2015v1
Roger Walls
 
PPTX
З досвіду роботи вчителя української мови та літератури
njhujdbwz
 
DOC
MARTIN_BOGUE_CURRENT_CV_2
martin bogue
 
PPTX
Poster Breakdown
Jasmine Bliszko
 
PPT
16158 євген маланюк
njhujdbwz
 
PDF
HELLO: the 14 types of Business Name and what they mean for branding
Dave Clark
 
PPT
Микола Вороний 10кл.
njhujdbwz
 
PPTX
Asdw
Jose Erraez
 
DOCX
Trabajo de ciencias sociales2015
winycha
 
PDF
POSmedia_kampan roku 2012
Marie Machatova
 
інформаційно роз’яснювальна робота. реєстрація. зно-2016
njhujdbwz
 
зарядись!
Максим Рева
 
Executive & Managerial Planning for Bosch-Kazakhstan
viviennevibar
 
обдаровані учні
njhujdbwz
 
RogerResume2015v1
Roger Walls
 
З досвіду роботи вчителя української мови та літератури
njhujdbwz
 
MARTIN_BOGUE_CURRENT_CV_2
martin bogue
 
Poster Breakdown
Jasmine Bliszko
 
16158 євген маланюк
njhujdbwz
 
HELLO: the 14 types of Business Name and what they mean for branding
Dave Clark
 
Микола Вороний 10кл.
njhujdbwz
 
Trabajo de ciencias sociales2015
winycha
 
POSmedia_kampan roku 2012
Marie Machatova
 
Ad

Similar to Myers_SIAMCSE15 (20)

PDF
MATEX @ DAC14
Hao Zhuang
 
PDF
Network-Growth Rule Dependence of Fractal Dimension of Percolation Cluster on...
Shu Tanaka
 
PDF
Breaking the 49 qubit barrier in the simulation of quantum circuits
hquynh
 
PDF
DAC15 Hao Zhuang poster
Hao Zhuang
 
PDF
SPICE-MATEX @ DAC15
Hao Zhuang
 
PDF
xldb-2015
Mohitdeep Singh
 
PDF
generalized_nbody_acs_2015_challacombe
Matt Challacombe
 
PDF
Chaotic Communication for mobile applica
YaseenMo
 
PDF
SLAM of Multi-Robot System Considering Its Network Topology
toukaigi
 
PDF
Virus, Vaccines, Genes and Quantum - 2020-06-18
Aritra Sarkar
 
PPT
Current Research on Quantum Algorithms.ppt
DefiantTones
 
PPT
Semi-Classical Transport Theory.ppt
VivekDixit100
 
PDF
Lecture: Interatomic Potentials Enabled by Machine Learning
DanielSchwalbeKoda
 
PPT
MD_course.ppt
Gold681565
 
PPT
HUST-talk-1.pptof uncertainty quantification. Volume 6. Springer, 2017. SFK08...
bappadasgolkunda
 
PDF
On selection of periodic kernels parameters in time series prediction
csandit
 
PDF
APPLICATION OF PARTICLE SWARM OPTIMIZATION TO MICROWAVE TAPERED MICROSTRIP LINES
cseij
 
PDF
Application of particle swarm optimization to microwave tapered microstrip lines
cseij
 
PDF
1789 1800
Editor IJARCET
 
PDF
1789 1800
Editor IJARCET
 
MATEX @ DAC14
Hao Zhuang
 
Network-Growth Rule Dependence of Fractal Dimension of Percolation Cluster on...
Shu Tanaka
 
Breaking the 49 qubit barrier in the simulation of quantum circuits
hquynh
 
DAC15 Hao Zhuang poster
Hao Zhuang
 
SPICE-MATEX @ DAC15
Hao Zhuang
 
xldb-2015
Mohitdeep Singh
 
generalized_nbody_acs_2015_challacombe
Matt Challacombe
 
Chaotic Communication for mobile applica
YaseenMo
 
SLAM of Multi-Robot System Considering Its Network Topology
toukaigi
 
Virus, Vaccines, Genes and Quantum - 2020-06-18
Aritra Sarkar
 
Current Research on Quantum Algorithms.ppt
DefiantTones
 
Semi-Classical Transport Theory.ppt
VivekDixit100
 
Lecture: Interatomic Potentials Enabled by Machine Learning
DanielSchwalbeKoda
 
MD_course.ppt
Gold681565
 
HUST-talk-1.pptof uncertainty quantification. Volume 6. Springer, 2017. SFK08...
bappadasgolkunda
 
On selection of periodic kernels parameters in time series prediction
csandit
 
APPLICATION OF PARTICLE SWARM OPTIMIZATION TO MICROWAVE TAPERED MICROSTRIP LINES
cseij
 
Application of particle swarm optimization to microwave tapered microstrip lines
cseij
 
1789 1800
Editor IJARCET
 
1789 1800
Editor IJARCET
 

More from Karen Pao (8)

PDF
LupoPasini_SIAMCSE15
Karen Pao
 
PDF
Druinsky_SIAMCSE15
Karen Pao
 
PDF
Barker_SIAMCSE15
Karen Pao
 
PPTX
Adams_SIAMCSE15
Karen Pao
 
PPTX
Austin_SIAMCSE15
Karen Pao
 
PDF
Slattery_SIAMCSE15
Karen Pao
 
PPTX
Loffeld_SIAMCSE15
Karen Pao
 
PPTX
Dubey_SIAMCSE15
Karen Pao
 
LupoPasini_SIAMCSE15
Karen Pao
 
Druinsky_SIAMCSE15
Karen Pao
 
Barker_SIAMCSE15
Karen Pao
 
Adams_SIAMCSE15
Karen Pao
 
Austin_SIAMCSE15
Karen Pao
 
Slattery_SIAMCSE15
Karen Pao
 
Loffeld_SIAMCSE15
Karen Pao
 
Dubey_SIAMCSE15
Karen Pao
 

Recently uploaded (20)

PDF
A deep Search for Ethylene Glycol and Glycolonitrile in the V883 Ori Protopla...
Sérgio Sacani
 
PPT
Grade_9_Science_Atomic_S_t_r_u_cture.ppt
QuintReynoldDoble
 
PPTX
first COT (MATH).pptxCSAsCNKHPHCouAGSCAUO:GC/ZKVHxsacba
DitaSIdnay
 
PPTX
Limbic system_components_connections_ functions.pptx
muralinath2
 
PPT
1a. Basic Principles of Medical Microbiology Part 2 [Autosaved].ppt
separatedwalk
 
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
ESUG
 
PPTX
Sleep_pysilogy_types_REM_NREM_duration_Sleep center
muralinath2
 
PPTX
Laboratory design and safe microbiological practices
Akanksha Divkar
 
PPTX
Nanofertilizer: Its potential benefits and associated challenges.pptx
BikramjitDeuri
 
PDF
study of microbiologically influenced corrosion of 2205 duplex stainless stee...
ahmadfreak180
 
PPTX
Quality control test for plastic & metal.pptx
shrutipandit17
 
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
PDF
Identification of unnecessary object allocations using static escape analysis
ESUG
 
PDF
Approximating manifold orbits by means of Machine Learning Techniques
Esther Barrabés Vera
 
PPTX
Brain_stem_Medulla oblongata_functions of pons_mid brain
muralinath2
 
PDF
Paleoseismic activity in the moon’s Taurus-Littrowvalley inferred from boulde...
Sérgio Sacani
 
PPTX
RED ROT DISEASE OF SUGARCANE.pptx
BikramjitDeuri
 
PPTX
Hericium erinaceus, also known as lion's mane mushroom
TinaDadkhah1
 
PPTX
Reticular formation_nuclei_afferent_efferent
muralinath2
 
PDF
Challenges of Transpiling Smalltalk to JavaScript
ESUG
 
A deep Search for Ethylene Glycol and Glycolonitrile in the V883 Ori Protopla...
Sérgio Sacani
 
Grade_9_Science_Atomic_S_t_r_u_cture.ppt
QuintReynoldDoble
 
first COT (MATH).pptxCSAsCNKHPHCouAGSCAUO:GC/ZKVHxsacba
DitaSIdnay
 
Limbic system_components_connections_ functions.pptx
muralinath2
 
1a. Basic Principles of Medical Microbiology Part 2 [Autosaved].ppt
separatedwalk
 
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
ESUG
 
Sleep_pysilogy_types_REM_NREM_duration_Sleep center
muralinath2
 
Laboratory design and safe microbiological practices
Akanksha Divkar
 
Nanofertilizer: Its potential benefits and associated challenges.pptx
BikramjitDeuri
 
study of microbiologically influenced corrosion of 2205 duplex stainless stee...
ahmadfreak180
 
Quality control test for plastic & metal.pptx
shrutipandit17
 
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
Identification of unnecessary object allocations using static escape analysis
ESUG
 
Approximating manifold orbits by means of Machine Learning Techniques
Esther Barrabés Vera
 
Brain_stem_Medulla oblongata_functions of pons_mid brain
muralinath2
 
Paleoseismic activity in the moon’s Taurus-Littrowvalley inferred from boulde...
Sérgio Sacani
 
RED ROT DISEASE OF SUGARCANE.pptx
BikramjitDeuri
 
Hericium erinaceus, also known as lion's mane mushroom
TinaDadkhah1
 
Reticular formation_nuclei_afferent_efferent
muralinath2
 
Challenges of Transpiling Smalltalk to JavaScript
ESUG
 

Myers_SIAMCSE15

  • 1. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers [email protected] Applied Numerical Algorithms Group, Computational Research Division with Phillip Colella, Brian Van Straalen SIAM-CSE Meeting March 17th, 2015 Extreme Resilient Discretizations Submitted to ApJ Tuesday, March 17, 15
  • 2. • Motivation - why is understanding these errors relevant for us here? • Standard PIC methods don’t converge for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 2 Talk outline Tuesday, March 17, 15
  • 3. • Motivation - why is understanding these errors relevant for us here? • Standard PIC methods don’t converge for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 3 Talk outline Tuesday, March 17, 15
  • 4. Roofline Performance Model Cori Node Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 4 Roofline Model - High Arithmetic Intensity needed for maximum performance Tuesday, March 17, 15
  • 5. • Field solve: force is computed on the mesh by e.g. solving Poisson’s Equation w/ 2nd order finite differences. • Interpolation: Force is interpolated back to particle positions using same kernel. • Particle Push: Particle positions and velocities are updated. 2nd-order leapfrog. • Deposition: Particle masses are deposited onto mesh: Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 5 This is a problem for 2nd Order PIC Methods ⇢n+1 i = X p ✓ mp Vi ◆ W xi xn+1 p x ! 2nd order: Piecewise linear, Cloud-in-Cell interpolation Start Deposition Field Solve Interpolation Particle Push Tuesday, March 17, 15
  • 6. • Poisson solve is a global bottleneck. Theoretical peak AI is bad. • Even if we read in a chunk of particles and do all the work we possibly can before moving on to the next chunk, by: • Reading in a batch of particles • Subtracting of their contribution to the density • Interpolating the field to the particle positions • Pushing the particles • Depositing the particles at their new positions AI . 1 1 + 1/nppc Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 6 Performance problems: global bottleneck, poor AI In 1D, perfect cache: 24 Flops, 3 doubles per particle, 3 doubles per cell 1 for high ppc (convergence) 1/2 for 1 particle per cell Tuesday, March 17, 15
  • 7. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 7 Improving AI - Higher Order in Space B a0 = 1 ˜Wq(k) Wq(x) = q/2 1 X p=0 a2p( 1)p M(2p) q (x), B [ q/2, q/2] Wq q = 4, 6 W4(x) = 8 >< >: |x|3 2 |x|2 |x| 2 + 1, |x| 2 [0, 1], |x|3 6 + |x|2 11|x| 6 + 1, |x| 2 [1, 2], 0, W6(x) = 8 >>>>< >>>>: |x|5 12 + |x|4 4 + 5|x|3 12 5|x|2 4 |x| 3 + 1, |x| 2 [0, 1], |x|5 24 3|x|4 8 + 25|x|3 24 5|x|2 8 13|x| 12 + 1, |x| 2 [1, 2], |x|5 120 + |x|4 8 17|x|3 24 + 15|x|2 8 137|x| 60 + 1, |x| 2 [2, 3], 0, k k = 4 q q [ q/2, q/2] B a0 = 1 ˜Wq(k) Wq(x) = q/2 1 X p=0 a2p( 1)p M(2p) q (x), B [ q/2, q/2] Wq q = 4, 6 W4(x) = 8 >< >: |x|3 2 |x|2 |x| 2 + 1, |x| 2 [0, 1], |x|3 6 + |x|2 11|x| 6 + 1, |x| 2 [1, 2], 0, W6(x) = 8 >>>>< >>>>: |x|5 12 + |x|4 4 + 5|x|3 12 5|x|2 4 |x| 3 + 1, |x| 2 [0, 1], |x|5 24 3|x|4 8 + 25|x|3 24 5|x|2 8 13|x| 12 + 1, |x| 2 [1, 2], |x|5 120 + |x|4 8 17|x|3 24 + 15|x|2 8 137|x| 60 + 1, |x| 2 [2, 3], 0, k k = 4 q q [ q/2, q/2] • Replace CIC with higher-order interpolation kernels • Discrete delta approximations of any order we want (Lo, Minden, Colella 2015, in prep) 4 x AI 8 x AI Tuesday, March 17, 15
  • 8. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 8 High-order, time integrators with fewer bottlenecks - Example: RK4 • 4th order RK methods require 3 or 4 force evaluations per time step, and 2 or 3 particle pushes. These must be done sequentially. • An alternative is to store the force evaluations from the RK4 stages of the previous time step at grid points, and extrapolate to get approximate forces with which to compute the displacements for your next time step. • Cheap with many p.p.c. tn t tn 1 2 t tn + 1 2 t tn + ttn f(tn t) ˜f(tn + t) f(tn 1 2 t) ˜f(tn + 1 2 t) f(tn) - past - future Tuesday, March 17, 15
  • 9. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 9 • Here is an example for a velocity-independent force using a 2nd order interpolating polynomial to extrapolate the forces. If we use these approximate force to compute the displacements, we have kn+1 1 = F (tn , xn ) kn+1 2 = F ✓ tn + 1 2 t, xn + 1 2 vn t + 1 8 ˜f(1) t2 ◆ kn+1 3 = F ✓ tn + t, xn + vn t + 1 2 ˜f ✓ 3 2 ◆ t2 ◆ (7) An alternative time-stepping scheme with better arithmetic intensity is thus kn+1 1 = F (tn , xn ) kn+1 2 = F ✓ tn + 1 2 t, xn + 1 2 vn t + 1 8 kn 3 t2 ◆ kn+1 3 = F ✓ tn + t, xn + vn t + 1 2 (kn 1 3kn 2 + 3kn 3 ) t2 ◆ xn+1 = xn + vn t + 1 6 kn+1 1 + 2kn+1 2 t2 vn+1 = vn + 1 6 kn+1 1 + 4kn+1 2 + kn+1 3 t. (8) This is quite similar to the classical method, except that the displacements for all three k values can be computed without doing any force solves. Using Taylor expansions, one can verify that this is still 4th-order accu- rate. In fact, one could also use linear extrapolation for ˜f(⌧) with any two of the RK stages from time step n 1 and still retain 4th-order accuracy. 2 Stability Analysis To check for stability, we consider the linearized model system: ˙x = v ˙v = x. (9) The numerical scheme in equation (7), applied to (8), can be written in a compact form if we consider the lagged forces kn 1 , kn 2 , and kn 3 to be part The Method goal is to solve the following system of equations for the particle posi- and velocities x and v given the force F: ˙x = v ˙v = F(t, x). (1) The standard, fourth-order Runge-Kutta method applied to this system , for the special case of a force that does not depend on v: xn+1 = xn + vn t + 1 6 (k1 + 2k2) t2 vn+1 = vn + 1 6 (kn 1 + 4k2 + k3) t, (2) e k1 = F (tn , xn ) k2 = F ✓ tn + 1 2 t, xn + 1 2 vn t + 1 8 k1 t2 ◆ k3 = F ✓ tn + t, xn + vn t + 1 2 k2 t2 ◆ . (3) Note the sequential nature of this algorithm; k1 must be computed before which must be computed before k3. An alternative is to extrapolate the s from the previous time step. For example, the forces at the stages sponding to times tn t, tn 1 2 t, and tn were kn 1 , kn 2 , and kn 3 . ning ⌧ = t (tn t) t , (4) d order interpolating polynomial that passes through the required points ˜f(⌧) = (2kn 1 4kn 2 + 2kn 3 ) ⌧2 + ( 3kn 1 + 4kn 2 kn 3 ) ⌧ + kn 1 . (5) = 0, 1/2, and 1, we recover kn 1 , kn 2 , and kn 3 , respectively. Extrapolated ard to ⌧ = 1, 3/2, and 2 (t = tn, tn + 1/2 t, and tn + t), we find: ˜f(1) = kn 3 ˜f ✓ 3 2 ◆ = kn 1 3kn 2 + 3kn 3 ˜f(2) = 3kn 1 8kn 2 + 6kn 3 . (6) he Method l is to solve the following system of equations for the particle posi- d velocities x and v given the force F: ˙x = v ˙v = F(t, x). (1) standard, fourth-order Runge-Kutta method applied to this system r the special case of a force that does not depend on v: xn+1 = xn + vn t + 1 6 (k1 + 2k2) t2 vn+1 = vn + 1 6 (kn 1 + 4k2 + k3) t, (2) k1 = F (tn , xn ) k2 = F ✓ tn + 1 2 t, xn + 1 2 vn t + 1 8 k1 t2 ◆ k3 = F ✓ tn + t, xn + vn t + 1 2 k2 t2 ◆ . (3) the sequential nature of this algorithm; k1 must be computed before h must be computed before k3. An alternative is to extrapolate the om the previous time step. For example, the forces at the stages nding to times tn t, tn 1 2 t, and tn were kn 1 , kn 2 , and kn 3 . ⌧ = t (tn t) t , (4) der interpolating polynomial that passes through the required points All the right hand sides for Poisson can be computed at once for a subset of particles that will fit in cache. Still 4th order accurate. Real issue is time step. 3 - 4 x AI High-order time integrators, w/ fewer bottlenecks - Example: Extrapolating RK4 Total for going to high order: ~ 10 x Tuesday, March 17, 15
  • 10. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 10 Another important question: Will these techniques actually give better results? • Need to evaluate the utility of these methods on realistic problems • For plasma PIC, yes. Convergence theory and empirical evidence from Wang, Miller, and Colella 2011. Need remapping and high particle counts (100-1000 particles per cell). 1e-06 1e-05 0 5 10 15 20 25 30 t hx=L/64, hv=vmax/128 hx=L/128, hv=vmax/256 hx=L/256, hv=vmax/512 (a) -1 0 5 10 15 20 25 30 co t (b) Fig. 10. Error and convergence rate plots for the two-stream instability without remapping. We set rh = 1/2. Scales (hx, hv) denote the particle grid mesh spacing at the base level. (a) The L∞ norm of the electric field errors on three different resolutions. (b) The convergence rates for the errors on plot (a). Second-order convergence rates are lost around t = 20. 1e-06 1e-05 0.0001 0.001 0.01 0.1 0 5 10 15 20 25 30 error t hx=L/64, hv=vmax/128 hx=L/128, hv=vmax/256 hx=L/256, hv=vmax/512 (a) -1 0 1 2 3 0 5 10 15 20 25 30 convergencerate t hx=L/128, hv=vmax/256 hx=L/256, hv=vmax/512 (b) Fig. 11. Error and convergence rate plots for the two-stream instability with remapping. We set rh = 1/2. Scales (hx, hv) denote the particle grid mesh spacing at the base level. (a) The L∞ norm of the electric field errors on three different resolutions. (b) The convergence rates for the Wang+2011 Tuesday, March 17, 15
  • 11. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 11 For Cosmology, Evidence Suggests Not... Romain TeyssierComputational Astrophysics 2009 High-resolution with constant force softening Particle discreteness effects show up quite dramatically in Warm Dark Matter simulations (from Wang & White, MNRAS, 2007) Very slow convergence N^(-1/3) These effects can be neglected if d: local inter-particular spacing Adaptive force softening ? Splinter, R.J., Melott, A.L., Shandarin, S.F., Suto, Y., “ Fundamental Discreteness Limitations of Cosmological N-Body Clustering Simulations”, ApJ, 497, 38, (1998) Romeo, A.B., Agertz, O., Moore, B., Stadel, J., “Discreteness Effects in ΛCDM Simulations: A Wavelet-Statistical View”, ApJ, 686, 1, (2008) maintain the strict planar symmetry of the pancake collapse that is apparently the root cause of the problem. To reiterate, the 2563 and 5123 PM runs roughly span the force resolutions used for the other codes, and since only the 5123 run shows a very mild failure of convergence, force resolution alone cannot be the source of the difficulty. Our results provide a different and more optimistic interpreta- tion of the findings of Melott et al. (1997; see also Binney 2004). While high-resolution codes when run with small smoothing lengths (or several refinement levels in the case of AMR) are not able to pass the pancake test after the formation of several caustics, the main culprit appears to be an inability to maintain the planar symmetry of the problem and not direct collisionality (at least at the force resolutions relevant for this paper), which Fig. 3.—Failure of convergence near the midplane for the pancake test: MC2 results, 643 particles with four grid sizes at z ¼ 0. Convergence fails at the final resolution reduction step (going from a 2563 mesh to a 5123 mesh). See the text for a discussion of these results. F COSMOLOGICAL SIMULATIONS. I. 33 Wang + White 2007 Heitmann+2005 Also: “Demonstrating Discreteness and Collision Error in Cosmological N-body Simulations of Dark Matter Gravitational Clustering” - Melott + 1997 Need to be addressed before benefiting from high order Tuesday, March 17, 15
  • 12. • Motivation - why is understanding these errors relevant for us here? • Standard PIC methods don’t converge for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 12 Talk outline Tuesday, March 17, 15
  • 13. • Important point: all cosmology simulations are run with singular initial conditions: @f @t = v a · @f @x + ✓ ˙a a ◆ v + 1 a r · @f @v Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 13 Vlasov-Poisson for Cosmology Simulations f(x, v, tini) = ⇢(x, tini) (v ¯v) • Low particle counts. • Done for sound physical reasons, numerically problematic. • We use PIC to solve this. Run a “Zel’dovich Pancake” setup. • First, we do a 1D problem. Tuesday, March 17, 15
  • 14. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 14 The Zel’dovich Pancake - 1D Convergence Results • Convergence is bad after particle trajectories cross • Poor convergence rates in 1D hint at more serious problems in higher dimensions... Tuesday, March 17, 15
  • 15. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 15 The Zel’dovich Pancake - 2D, Tilted Results • Spurious fragmentation regardless of the number of particles per Poisson cell • Does not respect the initial symmetry of the problem setup • Suggestive of Wang +White 2007 1/4 1 256 Tuesday, March 17, 15
  • 16. • Motivation - why is understanding these errors relevant for us here? • Standard PIC methods don’t converge for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 16 Talk outline Tuesday, March 17, 15
  • 17. • Remove the singularity in the initial data • Natural approach is to regularize the initial conditions via a finite, artificial initial velocity dispersion, , for which we choose a Gaussian form:i (v ¯v) ! ✓ 1 2⇡ i 2 ◆D/2 exp  (v ¯v, tini))2 2 i 2 Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 17 Regularized Initial Conditions • Makes things look more like plasma case. Many particles per cell. • Analogy with shock-capturing schemes in gas dynamics is instructive. Tuesday, March 17, 15
  • 18. lim i!1 ✓ 1 2⇡ i 2 ◆D/2 exp  (v ¯v, tini))2 2 i 2 = (v ¯v) Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 18 Regularized Initial Conditions i = 0.2i = 0.4i = 0.8 Tuesday, March 17, 15
  • 19. • For finite , we do obtain the expected order of accuracy. i Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 19 Regularized Convergence Results - 1D Tuesday, March 17, 15
  • 20. • This approach gives us a way to obtain solutions to the original, cold problem • For a given , increase resolution until a converged solution is obtained. • Then, look to see how the solutions behave as . • Inspired by a similar technique in vortex methods i i ! 0 Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 20 The Double Limit tion asmay be seenby comparison with the S = 400 solution in the iast panel 3~It is therefore presumed that the curves in Figs 2 and 3 arc essentially The n of the 6 equations (l), (2) for the two particular values of 6 chosen, over me intervat 0 d t 6 4. Comparable accuracy can be obtained at later times by smaller 3I and larger N. effect of decreasing 6 at a fixed time (I = 1) greater than the vortex sheet’s time (TV= 0.375) is shown in Fig. 5 which plots the interpolating curve fc:- al values of 6 between 0.2 and 0.05. These calculations used N = 406 and b x 1 FIG. 5. Solution of the 6 equations (1 1. (2) at I = 1.0 using 6 = 0.2. 0.15, 0.1. 0.05 Krasny, 1986 Tuesday, March 17, 15
  • 21. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 21 The Double Limit • The converged, regularized solutions approach a well-defined curve. • Artificial smooths out structures smaller than some length scale • In practice, pick a length scale below which you won’t believe the results i Tuesday, March 17, 15
  • 22. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 22 Regularized Results - 2D • Regularization works in 1D. However, the problem with fragmentation in 2D persists... Tuesday, March 17, 15
  • 23. • Motivation - why is understanding these errors relevant for us here? • The failure of basic PIC for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 23 Talk outline Tuesday, March 17, 15
  • 24. eE (x, t) / exp (at) Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 24 Particle Remapping High-order deposition Positivity not guaranteed, need mass distribution • In plasma convergence theory, error for field contains exponential term: Before remap After remap • Periodically restart problem with new particles Wang+2011 Particles with tiny masses are discarded Requires regularization Tuesday, March 17, 15
  • 25. • Wrinkle: In comoving coordinates, velocities shrink with time. • shrinks as box expands, must as well • Solution: remap with AMR • Resolves with same # of particles throughout • Example, 4 levels v Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 25 Particle Remapping, with AMR Tuesday, March 17, 15
  • 26. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 26 Remapping preserves order of method in 1D... • Once this is done, still get 2nd order in 1D Tuesday, March 17, 15
  • 27. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 27 And greatly improves artificial fragmentation issue RemappedNot remapped a = 0.013 levels, Tuesday, March 17, 15
  • 28. • Motivation - why is understanding these errors relevant for us here? • The failure of basic PIC for Cosmology applications • Two modifications: – Regularization – Adaptive Remapping • Summary and Future Research Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 28 Talk outline Tuesday, March 17, 15
  • 29. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 29 Conclusions and Future Research • We know how to make PIC converge on Cosmology problems at the stated order of accuracy. Can now benefit from high-order PIC. Interpolation kernels, etc. for doing so are there. • The necessary scheme looks a lot like PIC for electrostatic plasmas: with particle remapping and high particle counts. • We can exploit this information for designing high-AI methods. Example - extrapolating RK4. • Results on the convergence of PIC schemes for cosmology have been submitted to ApJ, paper and code available here: https://bitbucket.org/atmyers/cosmologicalpic Tuesday, March 17, 15
  • 30. Thank you for listening! Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers [email protected] Applied Numerical Algorithms Group, Computational Research Division with Phillip Colella, Brian Van Straalen SIAM-CSE Meeting March 17th, 2015 Extreme Resilient Discretizations Submitted to ApJ Tuesday, March 17, 15
  • 31. • VP equation is a non-linear advection equation in phase space • Can be solved using Eulerian methods in phase space on up to 128^6 domains (Yoshikawa + 2013) • Expense of working in high-dimensional spaces is significant, both in terms of memory requirements and the number of operations involved. • Large range of scales involved implies that adaptivity is usually required. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 31 Eulerian Methods Tuesday, March 17, 15
  • 32. f(x, v, tini) ⇡ X p2P mp x xi p v vi p P dmp dt = 0 dxp dt = 1 a vp dvp dt = ˙a a vp + 1 a gp (xp(t), vp(t)) vp gp Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 32 Particle Methods • Discretize system with set of Lagrangian interpolating points, • Reduces problem to system of ODEs for particle trajectories: • Can reconstruct distribution at later times from xp(t) Tuesday, March 17, 15
  • 33. f(x, v, tini) ⇡ X p2P mp x xi p v vi p P dmp dt = 0 dxp dt = 1 a vp dvp dt = ˙a a vp + 1 a gp (xp(t), vp(t)) vp gp Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 33 Particle Methods • Discretize system with set of Lagrangian interpolating points, • Reduces problem to system of ODEs for particle trajectories: “Viscous drag” term associated with comoving coordinate system • Can reconstruct distribution at later times from xp(t) Tuesday, March 17, 15
  • 34. • Naturally adaptive • Do not require keeping track of full, phase-space distribution function • Basically all of the workhorse Dark Matter codes take this approach (e.g. Enzo, Flash, Nyz, RAMSES, Gadget, ART, CHARM) • Differ mainly in the way they compute gp Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 34 Particle Methods Tuesday, March 17, 15
  • 35. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 35 2nd order PIC for Cosmology Start Initialize Particles EndTime to stop? Particle Kick Particle Drift Particle Deposition Poisson Solve Force Interpolation Particle Kick yes no • Deposition / Interpolation handled by CIC • Poisson’s equation solved w/ 2nd order FD • Kick-Drift-Kick scheme (Miniati+Colella 2007) vn+1/2 p = an an+1/2 vn p + 1 an+1/2 gn p t 2 . xn+1 p = xn p + 1 an+1/2 vn+1/2 p t. vn+1 p = an+1/2 an+1 vn+1/2 p + 1 an+1 gn+1 p t 2 . Kick Kick Drift All these pieces should be 2nd order. Tuesday, March 17, 15
  • 36. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 36 The Zel’dovich Pancake • Collapse of a single, sinusoidal perturbation in an expanding background • A common test case for cosmological dark matter codes • Analytic solution exists prior to the “first caustic” - the time at which the first matter parcels cross • “Single-mode” analysis of cosmological structure formation Tuesday, March 17, 15
  • 37. • Usually, a uniform, zero-temperature fluid is discretized with evenly- spaced, equal mass particles. • These particles are then perturbed from the initial positions using the Zel’dovich approximation. • Each point in space has only one particle, no velocity dispersion Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 37 The Zel’dovich Pancake Tuesday, March 17, 15
  • 38. • These initial conditions represent an initial distribution function that is singular in velocity space: f(x, v, tini) = ⇢(x, tini) (v ¯v) Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 38 The Zel’dovich Pancake • This approximation is made for good physical reasons. • However, singular initial data can pose problems for numerical solution methods. Problem may be ill-posed. • When we look at the Richardson-extrapolated order as a function of time: Tuesday, March 17, 15
  • 39. • Sample the regularized distribution on a Cartesian grid in phase space, discarding those with tiny masses. • = initial particle spacing in physical, velocity space. Controlling Numerical Error in Particle-in-Cell Simulations of Collisionless Dark Matter Andrew Myers, LBNL 39 Regularized Initial Conditions (hx, hv) Tuesday, March 17, 15