Computational Astrophysics I: Introduction and basic concepts
Helge Todt
Astrophysics Institute of Physics and Astronomy University of Potsdam
SoSe 2021, 3.6.2021
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 1 / 52 The (special) three-body problem
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 2 / 52 The (special)† three-body problemI
We will not solve the general case of the three-body problem, but consider only the following configuration (m1, m2 < M): y
2 d ~r1 GMm1 m2 m1 2 = − 3 ~r1 r dt r1 21 m1 Gm1m2 + 3 ~r21 (1) r21 r r 2 1 2 d ~r2 GMm2 m2 2 = − 3 ~r2 dt r2 Gm1m2 − 3 ~r21 (2) r21 M x
† not to confuse with the restricted three-body problem, where m1 ≈ m2 m3
→ Lagrangian points, e.g, L1 for SOHO, L2 for JWST
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 3 / 52 The (special)† three-body problemII
It is useful to divide the Eqn. (1) & (2) each by m1 and m2 respectively:
2 d ~r1 GM Gm2 2 = − 3 ~r1 + 3 ~r21 (3) dt r1 r21 2 d ~r2 GM Gm1 2 = − 3 ~r2 − 3 ~r21 (4) dt r2 r21 Moreover we can set – using astronomical units – again:
GM = 4π2 (5)
The terms
Gm2 Gm1 + 3 ~r21 & − 3 ~r21 (6) r21 r21 can be written with help of mass ratios m m 2 & − 1 (7) M M H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 4 / 52 The (special)† three-body problemIII
so that m m ratio[0] = 2 GM & ratio[1] = − 1 GM (8) M M The accelerations are then calculated like this:
dx = x[1] - x[0] ... dr3 = pow(dx * dx + dy * dy , 3./2. ) ... ax = -GM * x[i] / r3 + ratio[i] * dx / dr3 ay = -GM * y[i] / r3 + ratio[i] * dy / dr3
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 5 / 52 Methods for solving the Newtonian equations of motion
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 6 / 52 Numerical IntegrationI
Review → Newtonian equations of motion
dv = a(t) (9) dt dx = v(t) (10) dt Numerical solution from Taylor expansion:
2 vn+1 = vn + an ∆t + O((∆t) ) (11) 1 x = x + v ∆t + a (∆t)2 + O((∆t)3) (12) n+1 n n 2 n Euler method: account only for O(∆t) (for ∆t → 0):
vn+1 = vn + an ∆t (13)
xn+1 = xn + vn ∆t (14) therefore, only having O(∆t):
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 7 / 52 Numerical IntegrationII
→ local truncation error in one time step: ∼ (∆t)2 t 1 → global error over t: ∼ (∆t), because n steps with n = ∆t ∼ ∆t , so order of global error 1 reduced by ∆t
A method is of n th order, if the global error is of the order of (∆t)n. The Euler method is of of 1st order. Note, the Euler-Cromer method (semi-implicit Euler method) is also of 1st order, but conserves energy (symplectic integrator):
vn+1 = vn + an(xn)∆t (15)
xn+1 = xn + vn+1∆t (16) but there is also a 2nd variant of the (semi-implicit) Euler method
xn+1 = xn + vn∆t (17)
vn+1 = vn + an+1(xn+1)∆t (18)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 8 / 52 Numerical IntegrationIII
Possible improvement: use velocity from the midpoint of the interval
cf. Heun’s method (Karl Heun, 1859-1929) xn+1 (vn+1 )
vn+1 = vn + an∆t (as for Euler) (19) xn+1
1 xn+1 (vn ) x = x + (v + v )∆t (20) n+1 n 2 n n+1 1 2 x = x + v ∆t + a ∆t (21) n n n 2 n
tn tn+1 t → accuracy of position is of 2nd order and velocity is of 1st order (only good for constant acceleration, not more accurate than Euler, as error increases with each time step)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 9 / 52 Numerical IntegrationIV
Better (stable for oscillatory motions with const. ∆t ≤ 2/ω, therefore common, error bounded): Halfstep method / Leapfrog integration
v 1 = v 1 + an∆t (22) n+ 2 n− 2 xn+1 = xn + v 1 ∆t (23) n+ 2
v1/2 v3/2 ... vn/2 vn/2+1
x0 x1 ... xn xn+1
t0 t1 ... tn tn+1
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 10 / 52 Numerical IntegrationV
→ 2nd order with same number of steps as Euler (1st order)
But: not self starting, i.e. from Eq. (22) 9 v 1 2 therefore Euler method for the first half step: 1 v 1 = v0 + a0∆t (24) 2 2 Moreover, velocity steps can be eliminated by using Eq. (22) & (23):
(xn+1 − xn) − (xn − xn−1) = (v 1 − v 1 )∆t (25) n+ 2 n− 2 xn+1 − 2xn + xn−1 = an∆t (26) 2 xn+1 = 2xn − xn−1 + an∆t (27)
1 2 with start values x0, x1 = x0 + v0 + 2 a0∆t (so v0 is still required!)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 11 / 52 Numerical IntegrationVI
Or, by interpolation of intermediate values as combination of symplectic, semi-implicit Euler methods (Eq. (15)-(18))
1 ) 1 ) v 1 = vn + an ∆t xn+1 = x 1 + v 1 ∆t n+ 2 2 n+ 2 n+ 2 2 1 (28) 1 (29) x 1 = xn + v 1 ∆t vn+1 = v 1 + an+1 ∆t n+ 2 n+ 2 2 n+ 2 2 by substituting system (28) into system (29) one obtains Leapfrog with integer steps:
1 x = x + v ∆t + a ∆t2 (30) n+1 n n 2 n 1 v = v + (a + a )∆t (31) n+1 n 2 n n+1 → so-called Verlet integration (see next slides)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 12 / 52 Numerical IntegrationVII Higher order methods for that purpose: Taylor expansion of xn−1 (negative time step): 1 x = x − v ∆t + a (∆t)2 − O((∆t)3) (32) n−1 n n 2 n 1 + x = x + v ∆t + a (∆t)2 + O((∆t)3) (33) n+1 n n 2 n 2 4 = xn+1 + xn−1 = 2xn + an(∆t) + O((∆t) ) (34) 2 ⇒ xn+1 = 2xn − xn−1 + an(∆t) (35)
Analogously: 1 x = x + v ∆t + a (∆t)2 + O((∆t)3) (36) n+1 n n 2 n 1 − (x = x − v ∆t + a (∆t)2 − O((∆t)3)) (37) n−1 n n 2 n 3 = xn+1 − xn−1 = 2vn∆t + O((∆t) ) (38) x − x ⇒ v = n+1 n−1 (Verlet) (39) n 2∆t H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 13 / 52 Numerical IntegrationVIII → method of 2nd order in v and 3rd order in x But: 1 2 not self starting (needs start values x0, x1 = x0 + v0 + 2 a0∆t , see above) Eq. (39) contains differences of two values of same order of magnitude and expected ∆x x → round-off errors possible (subtractive cancelation) Therefore, from Eq. (39)
xn−1 = xn+1 − 2vn∆t insert in Eq. (35): (40) 2 xn+1 = 2xn − xn+1 + 2vn∆t + an(∆t) (41)
Solve for xn+1, yields: Velocity Verlet
1 x = x + v ∆t + a (∆t)2 (42) n+1 n n 2 n 1 v = v + (a + a )∆t (43) n+1 n 2 n+1 n
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 14 / 52 Numerical IntegrationIX
→ self-starting → minimizes round-off errors (no differences) → 4th order in x (why? → Eq. (36) & (37)) Eq. (43) results from Eq. (39) for vn+1: x − x v = n+2 n (44) n+1 2∆t 2 and xn+2 = 2xn+1 − xn + an+1(∆t) from Eq. (35) (45) 2x − x + a (∆t)2 − x ⇒ v = n+1 n n+1 n (46) n+1 2∆t x − x 1 = n+1 n + a (∆t)2 & x from Eq. (42) ∆t 2 n+1 n+1 1 2 xn + vn∆t + an(∆t) − xn 1 = 2 + a ∆t (47) ∆t 2 n+1 1 = v + (a + a )∆t (48) n 2 n+1 n
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 15 / 52 Numerical IntegrationX
Alternatively: (developed for liquid particles in a Lennard-Jones potential) Beeman method (Schofield 1973; Beeman 1976)
1 x = x + v ∆t + (4a − a )(∆t)2 (49) n+1 n n 6 n n−1 1 v = v + (2a + 5a − a )∆t (50) n+1 n 6 n+1 n n−1 → not self-starting → locally: O(∆t)4 in x and O(∆t)3 in v, globally O(∆t)3 → better energy conservation than for Verlet, but more calculation steps even better: → Runge-Kutta method of 4th order
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 16 / 52 The Runge-Kutta method
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 17 / 52 Runge-Kutta method of 4th orderI
Remember: Euler-Richardson method (Euler-halfstep method)
an = F (xn, vn, tn)/m (51) 1 v = v + a ∆t (52) M n n 2 1 x = x + v ∆t (53) M n n 2 1 a = F x , v , t + ∆t /m (54) M M M n 2
vn+1 = vn + aM∆t (55)
xn+1 = xn + vM∆t (56)
→ calculation of F or a, respectively, for the whole step at the “midpoint” of the interval, instead of using the values from the beginning ≡ Runge-Kutta method 2nd order
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 18 / 52 Runge-Kutta method of 4th orderII
We will refine the halfstep method by using more supporting points:
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 19 / 52 Runge-Kutta method of 4th orderIII
With the Runge-Kutta method† the initial value problem
0 dy/dx = y = f (x, y), y(x0) = y0 (57) is solved by calculating approximate values yi at selected supporting points xi to obtain the wanted y(x). These yi are calculated with help of the following scheme (cf. Bronstein), where also only linear terms are calculated, but in form of a “polygonal line”:
supporting point at the beginning and at the end of the interval two additional supporting points in the middle of the interval with doubled weight
†Carl Runge (1856-1927), Wilhelm Kutta (1867-1944)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 20 / 52 Runge-Kutta method of 4th orderIV
Move from x0 to xi = x0 + ih (step size h, i = 0, 1, 2,...) → single step method
x y k = h · f (x, y) = h · dy/dx x0 y0 k1 x0 + h/2 y0 + k1/2 k2 x0 + h/2 y0 + k2/2 k3 x0 + h y0 + k3 k4 1 x1 = x0 + h y1 = y0 + 6 (k1 + 2k2 + 2k3 + k4)
Cf.: Simpson’s rule† (actually Kepler’s rule , “Keplersche Fassregel”) for integration of y 0(x) via a parabola:
Z b b − a a + b y 0(x)dx ≈ y 0(a) + 4 y 0 + y 0(b) (58) a 6 2
†Thomas Simpson (1710-1761)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 21 / 52 Runge-Kutta method of 4th orderV
For the equations of motion this means therefore:
~ k1v = ~a(~xn,~vn, t) ∆t (= ~agrav.(~xn) ∆t in our case) (59) ~ k1x = ~vn ∆t (60) ! ~k ~k ∆t ~k = ~a ~x + 1x ,~v + 1v , t + ∆t (61) 2v n 2 n 2 n 2 ! ~k ~k = ~v + 1v ∆t (62) 2x n 2 ! ~k ~k ∆t ~k = ~a ~x + 2x ,~v + 2v , t + ∆t (63) 3v n 2 n 2 n 2 ! ~k ~k = ~v + 2v ∆t (64) 3x n 2
~ ~ ~ k4v = ~a(~xn + k3x ,~vn + k3v , t + ∆t) ∆t (65) ~ ~ k4x = (~vn + k3v ) ∆t (66)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 22 / 52 Runge-Kutta method of 4th orderVI
So, finally
1 v = v + (k + 2k + 2k + k ) (67) n+1 n 6 1v 2v 3v 4v 1 x = x + (k + 2k + 2k + k ) (68) n+1 n 6 1x 2x 3x 4x
→ Runge-Kutta methods are self-starting
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 23 / 52 Numerical integration: ImprovementsI
Adaptive stepsize: step doubling
1 calculate new coordinates (~x,~v) via two Runge-Kutta steps each with ∆t 2 calculate new coordinates (~x,~v)0 via one Runge-Kutta step with 2∆t → calculation overhead increases only by 11/8, because of same derivatives on the beginning of the interval Now, if
|(x, v) − (x, v)0| ≥ (69) |(x, v)| max with an accuracy criterion max → decrease stepsize ∆t If |(x, v) − (x, v)0| ≤ mit < (70) |(x, v)| min min max
→ increase ∆t
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 24 / 52 Numerical integration: ImprovementsII
Predictor-corrector method First prediction of the new position, e.g.:
xp = xn−1 + 2vn∆t (71)
→ yields accleration ap → corrected position by trapezoidal rule: 1 v 0 = v + (a + a )∆t (72) n+1 n 2 p n 1 x0 = x + (v + v )∆t (73) n+1 n 2 n+1 n
→ yields better value for an+1 and hence
1 vn+1 = vn + an+1∆t (74) 1 xn+1 = xn + vn+1∆t (75)
k+1 k repeated iteration until |xn+1 − xn+1| < with intended accuracy
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 25 / 52 Bulirsch-Stoer methodI
Especially interesting for interactions of several bodys (few-body problem): Requires: resonances in planetary systems high numerical accuracy influence by one-time passage of a star flexibility influence of the galactic gravitational potential high computation rate
Idea: combination of modified midpoint method Richardson extrapolation extrapolation via rational functions → Bulirsch-Stoer method (Stoer & Bulirsch 1980)† cf. Numerical Recipes
†Roland Bulirsch (∗1932), Josef Stoer (∗1934)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 26 / 52 Bulirsch-Stoer methodII
Modified midpoint method For an ODE dx/dt = f (t, x) over a time step H = Nh with N equidistant sub-steps
x0 = x(t) (76)
x1 = x0 + hf (t, x0) (77) ... (78)
xn = xn−2 + 2hf (t + [n − 1]h, xn−1) n = 2,..., N (79) 1 x(t + H) ≈ x˜ = [x + x + hf (t + H, x )] (80) 2 N N−1 N → 2nd order method, but with only one derivative per h-(sub)step (where 2nd order Runge-Kutta has two derivatives per step)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 27 / 52 Bulirsch-Stoer methodIII
Gragg† (1965): error in Eq. (80) → even power series:
∞ X 2i x˜ − x(t + H) = αi h (81) i=1
→ for even N (so, N = 2, 4, 6,...) all odd error terms cancel out Let xN/2 the result for x(t + H) with half the number of steps:
4x˜N − x˜ x(t + H) ≈ N/2 (82) 3 → 4th order accuracy (as for RK4), but only with 1.5 derivatives (RK4: 4)
†William B. Gragg (1936-2016)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 28 / 52 Bulirsch-Stoer methodIV
Richardson extrapolation Idea: result x(t + H) is an analytic function of h with h = H/N:
1 calculate xt+H (h = 2, 4, 6,...)
2 fit function xt+H (h) to xt+H (N = 2), xt+H (N = 4), ...
3 extrapolate xt+H (h → 0), corresponding to N → ∞ x(t+H)
0 H/6 H/4 H/2 h
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 29 / 52 Bulirsch-Stoer methodV
Extrapolation via polynomial
Compute k-times xt+H with N = 2, 4, 6,...:
2 k−1 xt+H (h) = a0 + a1h + a2h + ... + ak h (83) where following Lagrange
(h − h2)(h − h3) ... (h − hk ) xt+H (h) = xt+H (h1) (84) (h1 − h2)(h1 − h3) ... (h1 − hk ) (h − h1)(h − h3) ... (h − hk ) + xt+H (h2) (85) (h2 − h1)(h2 − h3) ... (h2 − hk ) (h − h1)(h − h2) ... (h − hk−1) + ... + xt+H (hk ) (86) hk − h1)(hk − h2) ... (hk − hk−1)
In the original Bulirsch-Stoer method: rational function (P(h)/Q(h)) instead of Lagrange polynomial
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 30 / 52 RegularizationI
Consider an N-body system with
2 N d ~xi X Gmj (~xi − ~xj ) 2 = − 3 (87) dt |~xi − ~xj | j=1;j6=i
1 problem: aij ∝ 2 for very small distances rij (close encounters) rij → small distances → large accelerations → requires small ∆t → slows down calculations & increases numerical accumulation error possibly uncomplicated for one time encounters But in star clusters: → formation of close binaries → periodic so-called “binary hardening”: transfer of the energy of the binary system to the cluster by consecutive close encounters
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 31 / 52 RegularizationII
M 62 (NGC 6266). Left: optical HST. Right: X-ray CHANDRA
→ above-average rate of close binary systems (e.g., low-mass X-ray binaries) in globular clusters (Pooley et al. 2003)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 32 / 52 RegularizationIII
obvious (and inaccurate) idea: “softening” term in Eq. (87):
G m m (~r −~r ) F~ = i j j i (88) ij 2 2 3/2 ( + |~ri −~rj | ) such that (89) 2G mi 1 max |~aj | = at r = √ (90) 33/2 2 2
→ adaptive ∆t not arbitrarily small; but: close binary orbits and passages not resolvable When is “softening” applicable? → if close encounters are irrelevant → collisionless systems, e.g., galaxy
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 33 / 52 RegularizationIV
Illustration: distances in a galaxy 23 11 11 19 Galaxy: Ø ≈ 10 cm with 10 stars with R∗ ≈ 10 cm → d ≈ 10 cm
100× → width of 1011 sand grains
→ average distance between sand grains ≈ 10 km
→ t∗,coll tHubble → collisionless stars perceive only the average gravitational potential of the galaxy
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 34 / 52 RegularizationV Better: regularization (technique in physics to avoid ∞) with help of transformation of spacetime coordinates. Consider vector R~ between two particles (center of mass frame):
d 2R~ R~ = −G(m1 + m2) + F~12 (91) dt2 |R~ |3 with external force F~12 = F~1 − F~2 per mass, by other particles 1. regularized time τ
dt = Rndτ (92) d 2 1 d 2 n dR d = − (93) dt2 R2n dτ 2 R2n+1 dτ dτ d 2R~ n dR dR~ R~ = − G(m + m ) + R2nF~ (94) dτ 2 R dτ dτ 1 2 R3−2n 12 for n = 1 → R˙ ∝ t/τ and without R−2- singularity, but with R~ /R term (indefinite for R → 0)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 35 / 52 RegularizationVI therefore: 2. regularized distance u, initially only for 1 dimension (already known by Euler), without external force (see Aarseth 2003):
d 2 1 dR 2 = − G(m + m ) (95) dτ 2 R dτ 1 2 (96) and with conservation of energy, total energy h per reduced mass µ = m1m3/(m1 + m2):
1 dR 2 G h = − (m + m ) (97) 2 dt R 1 2 with dR 1 dR = (98) dt R dτ d 2R ⇒ = 2hR + G(m + m ) (99) dτ 2 1 2
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 36 / 52 RegularizationVII
→ no more singularities. With u2 = R:
d 2u 1 = hu (100) dτ 2 2 → easy to integrate → method: change from (x, t) to (u, τ) below some distinct distance (for 1d collision!)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 37 / 52 RegularizationVIII in 2 dimensions (Levi-Civita 1904):
2 2 x = u1 − u2 (101) y = 2u1u2 (102) or R~ = L~u (103) u −u where L = L(~u) = 1 2 (104) u2 u1
With the following properties:
L(~u)T L(~u) = RI (105) d d~u L(~u) = L (106) dt dt L(~u)~v = L(~v)~u (107) ~u · ~uL(~v)~v − 2~u · ~vL(~u)~v + ~v · ~vL(~u)~u = 0 (108)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 38 / 52 RegularizationIX
With help of Eqn. (106 & 107) coordinates change to
dR~ d~u = 2L(~u) (109) dτ dτ d 2R~ d 2~u d~u d~u = 2L(~u) + 2L (110) dτ 2 dτ 2 dτ dτ
Hence in Eq. (94) with n = 1 and with Eq. (108) and some transformations:
d 2~u d~u d~u 2~u · ~uL(~u) − 2 · L(~u)~u + G(m + m )L(~u)~u = (~u · ~u)3F~ (111) dτ 2 dτ dτ 1 2 12 further transformations lead to a form without singularities and indefinitenesses:
d 2~u 1 1 = h~u + RLT (~u)F~ (112) dτ 2 2 2 12
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 39 / 52 RegularizationX
Binary star without external forces F~12 → energy h conserved Binary star with external forces:
d~u d~u h = 2 · − G(m + m ) R (113) dτ dτ 1 2
The time evolution in usual coordinates " # d 1 dR 2 G dR~ − (m + m ) = · F~ (114) dt 2 dt R 1 2 dt 12 after transformation dh d~u = 2 ·L(~u)F~ (115) dτ dτ 12 can be solved continuously for R = 0
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 40 / 52 RegularizationXI
Application of the 2d solution to the so-called Pythagoraian three-body problem (~L = 0) in Szebehely & Peters (1967):
because of ~L = 0 three-body collision possible → does not occur
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 41 / 52 RegularizationXII
Regularization for 3 dimensions (Kustaanheimo & Stiefel 1965) requires transformation to 4d coordinates:
2 2 2 2 R1 = u1 − u2 − u3 + u4 (116) R2 = 2(u1u2 − u3u4) (117)
R3 = 2(u1u3 + u2u4) (118)
R4 = 0 (119) and R~ = L(~u)~u, such that u1 −u2 −u3 u4 u2 u1 −u4 −u3 L = (120) u3 u4 u1 u2 u4 −u3 u2 −u1 → yields again equations similar to (112) & (115) see Bodenheimer et al. (2007)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 42 / 52 N-body simulations for large N I
Problems:
1 number of interactions is N(N − 1)/2 ∝ O(N2)
2 multiple timescales for adaptive time steps for each particle i: s 1 ∆ti ' k (121) |~ai |
with acceleration ~ai and small factor k
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 43 / 52 N-body simulations for large N II possible solutions: 1 Tree method (Barnes & Hut 1986, 1989)
→ hierarchical structure and calculation of Star B
d1 r1 multipoles of the potential → O(N log N) Star A
Star cluster Holmberg (Lund, 1941) even O(N) with help of light bulbs Star B on 2d grid (flux ∝ 1/r 2) r2 2 Fourier transformation: compute potential Φ(~x)
with FFT → CA 2 d2
3 Leapfrog method (2nd order integ.): Star cluster
n+1/2 n−1/2 The gravitational effect excerted by the star n cluster and the single star B on star A can be ~ri = ~ri + ∆ti~vi (122) approximated by a point mass. (from n+1 n n+1/2 Barnes-Hut Galaxy Simulator) ~vi = ~vi + ∆ti~ai (123)
n with time step doubling ∆ti = ∆tmax/2 i for each particle i
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 44 / 52 N-body simulations for large N III
Example time step doubling with → leapfrog method particle A: time step ∆t/2, particle B: time step ∆t starting via 1 1 ~r n+1/2 = ~r n + ∆t ~v n + ∆t2~an for i = A, B. (124) i i 2 i i 8 i i
Hence, we get ~rA(∆t/4) and ~rB (∆t/2) and from that
~aA(A[∆t/4], B[∆t/2]) and analogously ~aB → time asymmetry
~aA →~vA(∆t/2) →~rA(3/4∆t) ~aA(A[3/4∆t], B[∆t/2]) →~vA(∆t) → reversed time asymmetry
Averaging of ~rA(∆t/4),~rA(3/4∆t) to ~rA(∆t/2), then
→~aB (A[∆t/2], B[∆t/2]) →~vB (∆t)
from ~vA(∆t),~vB (∆t) →~rA(5/4∆t) i.e. next cycle starts
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 45 / 52 Summary
Methods to solve N-body interactions: Runge-Kutta (RK4): standard for any ODE 2nd order leapfrog: reasonable accuracy for extremely large number of particles, integration only over a few dynamical times (e.g., Sun orbiting Galactic center) Bulirsch-Stoer†: highly accurate, for few-body systems predictor-corrector: reasonable accuracy for moderate up to large number of particles for close encounters: softening (collisionless) or accurate regularization (collisions)
†alternatively for long-term evolution of few-body systems, e.g., over lifetime of Sun and whithout close encounters: symplectic map → split Hamiltonian H = HKepler + Hinteraction, where analytic solution (ellipse) is used for HKepler, requires transformation to Jacobi coordinates
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 46 / 52 Outlook: Interacting galaxiesI
Arp 271 (Gemini South)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 47 / 52 Outlook: Interacting galaxiesII
NGC 4676 “Mice” (HST / NASA)
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 48 / 52 Galactic “Bridges” and “Tails”I
Toomre & Toomre (1972): bridges (connections between galaxies) and tails (structures on the opposite site of the interaction point) as the result of tidal forces between galaxies simplified model:
encounter of only two galaxies, parabolic (unbound) galaxies as disks of non-interacting “test particles”, initially on circular orbits around a central point mass
result: mutual distortion of the galaxies just by gravitation, kinematic evolution to narrow, elongated structures
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 49 / 52 Galactic “Bridges” and “Tails”II
simulation of NGC 4676 from Toomre & Toomre (1972) → two identical galaxies
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 50 / 52 Galactic “Bridges” and “Tails”III
NGC 4676 as before, but now seen edge-on
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 51 / 52 LiteratureI
Aarseth, S. J. 2003, Gravitational N-Body Simulations (Johns Hopkins University Press) Barnes, J. & Hut, P. 1986, Nature, 324, 446 Barnes, J. E. & Hut, P. 1989, ApJS, 70, 389 Beeman, D. 1976, Journal of Computational Physics, 20, 130 Bodenheimer, P., Laughlin, G. P., Rózyczka, M., & Yorke, H. W., eds. 2007, Numerical Methods in Astrophysics: An Introduction (CRC Press) Pooley, D., Lewin, W. H. G., Anderson, S. F., et al. 2003, ApJ, 591, L131 Schofield, P. 1973, Computer Physics Communications, 5, 17 Szebehely, V. & Peters, C. F. 1967, AJ, 72, 876 Toomre, A. & Toomre, J. 1972, ApJ, 178, 623
H. Todt (UP) Computational Astrophysics SoSe 2021, 3.6.2021 52 / 52