Newtonian Nbody Dynamics Alexander Knebe Centre for Astrophysics
Newtonian N-body Dynamics Alexander Knebe, Centre for Astrophysics & Supercomputing, Swinburne University Ø cosmological N-body simulations • what is the idea ? • what is state-of-the art ? Motivation Realisation Ø the techniques and the codes • generating the initial conditions • the time evolution - obtaining the forces: § particle based vs. grid based methods - integrating the equations of motions Ø how do they compare? Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University Bottomline
cosmological n-body simulations: CMB why at all ? structure formation turns non-linear n-body simulations Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the initial conditions 1. initial conditions a) create homogeneous and isotropic Universe b) superimpose density perturbations 2. evolve density perturbations forward in time N-body => discretize density using N particles Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: • power spectrum of density perturbations: • decomposing fluctuations as waves • P(k) constrained by cosmology creating random realisation of P(k) using N particles initial conditions Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University the initial conditions
cosmological n-body simulations: the initial conditions • generating IC’s: homogeneous isotropic universe P(k) initial conditions Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the time evolution following the trajectories of N particles under their mutual gravity (in comoving coordinates) Newton’s second law mn rn = Fn (rn) n N 1. obtain force at each particle position 2. integrate equations of motion Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the equations of motion • integrating the equations of motion Ø leap-frog scheme (minimal storage requirements) § moving particles from time step n to time step n+1 discretized equations of motion . r = v. v = f Dt/2 r 1/2 = r 0 + v 0 vn+1 = vn + fn+1/2 Dt rn+1 = rn+1/2 + vn+1 Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University Dt/2
cosmological n-body simulations: the equations of motion • integrating the equations of motion Ø leap-frog scheme (original idea): 2 N updates per time step v update 1 n n+1/2 r update 2 n+1 Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University n+3/2
cosmological n-body simulations: the equations of motion • integrating the equations of motion Ø leap-frog scheme (realisation in MLAPM) § moving particles from time step n to time step n+1 discretized equations of motion . r=v. v = f rn+1/2 = rn + vn Dt/2 + fn+1/2 Dt vn+1 = vn rn+1 = rn+1/2 + vn+1 Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University Dt/2
cosmological n-body simulations: the equations of motion • integrating the equations of motion Ø leap-frog scheme (realisation in MLAPM): 3 N updates per time step v update 2 positions and velocities are synchronized at all timestep n r update 1 3 n+1/2 Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University n+1
cosmological n-body simulations: the forces • obtaining the forces Ø Poisson’s equation Ñ 2 F = 4 p. G r F = -ÑF heart and soul of every N-body code Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces 1. “natural” approach Ø numerically solve Poisson’s equation (on a grid) = 4 p. G ri, j, k Ñ 2 Fi, j, k = -ÑFi, j, k difficult easy introduces a scale: the grid spacing various numerical methods feasible to obtain Fi, j, k … Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces 1. 1. relaxation Ø numerically solve Poisson’s equation = 4 p. G ri, j, k Ñ 2 Fi, j, k discretized Poisson’s equation Fi, j, k = 1/6 (Fi+1, j, k+ Fi-1, j, k+ Fi, j+1, k+ Fi, j-1, k+ Fi, j, k+1+ Fi, j, k-1 - ri, j, k D 2) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces 1. 1. relaxation discretized Poisson’s equation Fi, j, k = 1/6 (Fi+1, j, k+ Fi-1, j, k+ Fi, j+1, k+ Fi, j-1, k+ Fi, j, k+1+ Fi, j, k-1 - ri, j, k D 2) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces 1. 2. Fast Fourier Transformation Ø Potential Theory: F=r G FFT (G = tuned Green’s function accounting force anisotropies) (convolution becomes multiplication) F= r G FFT-1 F (FFT requires a regular grid though) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces 2. common “simplification” Ø assumption that particles are d-functions… r(r) = å d(r-rn) analytical solution to Poisson’s equation G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m n N very time consuming Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: the forces following the trajectories of N particles under their mutual gravity (in comoving coordinates) PP (particle-particle) Newton’s second law => time consuming G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m mn rn = Fn (rn) PM (particle-mesh) => = 4 p. G ri, j, k Ñ 2 Fi, j, k = -ÑFi, j, k Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University grid spacing
cosmological n-body simulations: comoving coordinates following the trajectories of N particles under their mutual gravity (in comoving coordinates) r(t) = a(t) x(t) a(t) measures expansion rate of Universe x(t) comoving coordinate H(t) Hubble parameter Newton’s second law Poisson’s equation . . . x + 2 H x = Fx/a 3 Ñx 2 Y = 4 p. G (r-r) Fx = -Ñx. Y note: H(t) and a(t) depend on cosmological model Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: cosmological dependencies • expansion rate of Universe: H 0 ~ 65 km/s/Mpc • matter content of Universe: W 0 ~ 0. 3 • nature of (dark) matter: cold, hot, warm, … • amplitude of density perturbations: s 8 ~ 0. 5 – 1. 2 • cosmological constant: l 0 ~ 0. 7 mix and stir in a very fast super computer together with your favourite N-body code and simmer for about 13 - 15 Gyr’s… Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: initial conditions Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University state-of-the-art today's Universe ?
cosmological n-body simulations: phase-space markers one simulation particle represents billions of dark matter particles msimu ~ 108 M m. DM < 10 -24 M simulation particles are “phase-space markers” Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
cosmological n-body simulations: • GADGET the codes http: //www. mpa-garching. mpg. de/gadget • fully particle based force derivation • combining distant particles into aggregates (Tree) • MLAPM http: //astronomy. swin. edu. au/MLAPM • fully grid based force derivation • places finer and finer grids of arbitrary shape in high density regions • HYDRA/AP 3 M http: //hydra. mcmaster. ca/hydra • combination of particle and grid based force derivation • no refined grids, no Tree structures Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GADGET (Tree code) : the particle approach in general G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m direct particle-particle summation (PP) Ø brute force N 2 summation not feasible organizing particles in a tree-like structure gives N log(N) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GADGET (Tree code) : the particle approach in practice G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m tree code Ø combining distant particles into aggregates (“adaptive particles”) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GADGET (Tree code) : in practice the particle approach G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m tree code Ø walking the tree (for each particle) L 3 D 3 L 2 1 D 2 2 D 1 L 1 3 opening “angle” Q: D >Q L Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GADGET (Tree code) : the particle approach in practice G mn mm Fn (rn) = ån¹m (r – r )3 (rn – rm) n m force resolution Ø soften the force to avoid singularity for rn=rm (“softening”) G mn mm Fn (rn) = ån¹m (r –r +e)3 (rn – rm) n m Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GADGET (Tree code) : the particle approach in practice G mn mm Fn (rn) = ån¹m (r –r +e)3 (rn – rm) n m Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
GRAPE motherboards : the particle approach in general G mn mm Fn (rn) = ån¹m (r –r +e)3 (rn – rm) n m GRAPE = Gravity Pip. E particle approach hardwired into motherboard Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
MLAPM in general (AMR code) : the grid approach = 4 p. G ri, j, k Ñ 2 Fi, j, k = -ÑF i, j, k particle mesh calculation (PM): 1. 2. 3. 4. assign particles to grid solve Poisson’s equation on grid (relaxation or FFT) differentiate potential to get forces interpolate forces back to particles sounds like a waste of time and computer resources, but exceptionally fast in practice Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
MLAPM in practice (AMR code) : the grid approach = 4 p. G ri, j, k Ñ 2 Fi, j, k = -ÑF i, j, k artificial scale introduced Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
MLAPM in practice (AMR code) : the grid approach = 4 p. G ri, j, k Ñ 2 Fi, j, k = -ÑF i, j, k Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
MLAPM adaptive mesh refinement (AMR code) : n-bodies grid hierarchy Multi Level Adaptive Particle Mesh • only open source AMR code • written in C • most memory efficient n-body code • fastest (single-CPU) n-body code (Knebe, Green & Binney 2001) • on-the-fly analysis (under way…) • MPI parallelisation (planned…) • hydrodynamics (planned…) http: //astronomy. swin. edu. au/MLAPM Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
HYDRA (P 3 M code) : in general the particle-particle-mesh approach P 3 M code Ø short range force: pure PP method (no tree) Ø long range force: pure PM method (no adaptive grids) AP 3 M code Ø using “small-grid” P 3 M calculation in high density regions overall resolution dictated by PP softening Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
HYDRA (P 3 M code) : the particle-particle-mesh approach Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University in practice
the confrontation: in general • LCDM test simulation run with various codes Ø identical initial conditions for 643 particles Ø comparable (if not identical) parameter set-up GADGET AP 3 M MLAPM Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University MLAPM (refinements)
the confrontation: timings • benchmarking the codes PP domain time Ø MLAPM 42. 3 hours Ø ART 47. 4 hours Ø GADGET 57. 5 hours Ø AP 3 M 69. 4 hours pure PP code PM domain (FFT !) latest MLAPM version about twice as fast ! Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University (Knebe, Green & Binney 2001) code
the confrontation: • mass segregation numerical effects (keyword: collisionless) (Binney & Knebe 2002) • run simulation with 2 mass species and check for mass segregation N GADGET (tree code) => expels lighter particles from halos ü MLAPM (AMR code) => ratio always about unity Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
the confrontation: (keyword: spatially adaptive force resolution) (Knebe et al. 2000) • two-body scattering numerical effects Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
the confrontation: numerical effects • major difference Øtree codes: spatially ØAMR codes spatially adaptive softening fixed softening ü resolve the local inter-particle separation at all times and at all places … nor more, no less! ü particles are “phase-space” markers rather than interacting “billiard balls” Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
the confrontation: more complicated physics • the Santa Barbara cluster comparison project: temperature profile entropy profile grid based codes particle based codes (Frenk et al. 1999) Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University the summary (1)
Newtonian N-body Dynamics the summary (2) following the trajectories of N particles under their mutual gravity (in comoving coordinates) • GADGET http: //www. mpa-garching. mpg. de/gadget • fully particle based force derivation • MLAPM http: //astronomy. swin. edu. au/MLAPM • fully grid based force derivation • HYDRA/AP 3 M http: //hydra. mcmaster. ca/hydra • combination of particle and grid based force derivation Newtonian N-body Dynamics, Gravity 2004 Workshop, Sydney University
- Slides: 42