All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
A block-step version of KS regularization
1. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
A block-step version of KS regularization
at Steller N-body Dynamics, Sexten
Keigo Nitadori
Co-Design Team, Exascale Computing Project
RIKEN Advanced Institute for Computational Sciencd
September 10, 2014
2. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Acknowledgement
My sincerest thanks go to Sverre Aarseth and IoA for inviting
me 7 times, 07, 08, 09, 10, 11, 12, and 13, in which the most
important and creative collaboration on the development of
NBODY6/GPU was done.
3. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Abstract
I talk about a new future implemented in NBODY6/GPU:
A block-step version of KS regularized binary.
I To eliminate serial bottleneck
I Very accurate with fully conservational Hermite integrator
Amazingly, it is already working!
Public code is available as nbody6b and nbody7b
4. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Topics
1. Brief introduction of Kustaanheimo–Stiefel (KS)
regularization (with Hamilton’s quaternion numbers)
2. A very accurate variant of Hermite integrator for harmonic
oscillators (and regularized binaries)
3. Block stepping in real time t
5. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
3 steps of regularization
1. Time transformation. dt = krkd, (hereafter, [˙] = d
dt [ ],
d [ ] = krk[˙])
and [ ]0 = d
I r() is already a harmonic oscillator (+bias ).
I But equation of motion r00 = f (r; r0) is numerically
dangerous.
2. Write the equation of motion in conserved quantities.
ex. r00 = f (E;e; r) in Sparing–Burdeet–Heggie
regularization.
I Perturbation to E and e are integrated independently.
3. Coordinate transformation from r to u. Finally, it becomes
a harmonic oscillator, u00 = 12
hu.
I h is an energy integral and available as h(u;u0), but should
be integrated independently.
6. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Levi-Civita transformation in a complex plane
1.5
1
0.5
0
-0.5
-1
-1.5
harmonic
Kepler
F1
F2
-1.5 -1 -0.5 0 0.5 1 1.5
Ellipse of harmonic oscillator:
u = A cos + iB sin (1)
Ellipse of Kepler motion:
r =u2
=
A2 B2
2 +
A2 + B2
2
cos 2 + i2AB sin 2
=a(e + cos ) + ia
p
1 e2 sin
with
= 2; a =
A2 + B2
2
; e =
A2 B2
A2 + B2
(2)
7. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Hamilton’s quaternion
I The complex numbers algebra can be applied to the
two-dimensional geometry
I We can add, subtract, multiply, and divide 2D vectors
I What about on 3D vectors?
I According to a letter Hamilton wrote later to his son
Archibald:
Every morning in the early part of October 1843, on my coming
down to breakfast, your brother William Edward and yourself
used to ask me: Well, Papa, can you multiply triples? Whereto
I was always obliged to reply, with a sad shake of the head, No,
I can only add and subtract them.
I Finally, he discovered that quadruple numbers can be applied to
the arithmetics of 3D vectors
8. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
cont.
Introduce a new imaginary unit j that anti-commutes with i,
e.g. ij = ji, and let k = ij. Then,
i2 = j2 = k2 = ijk = 1
or
ij = ji = k; jk = kj = i; ki = ik = j
defines the (non-commutative) quaternion algebra.
A quaternion is
H 3 q = s + ix + jy + kz (s;x;y; z 2 R)
s is referred to as scalar and ix + jy + kz vector.
10. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Usage of quaternion
A unit quaternion rotates a vector.
rrot = r ¯; (3)
with a unit quaternion and a vector r = ix + jy + kz.
Example:
ek=2(ix + jy + kz)ek=2 =ek (ix + jy) + kz
=ek (x + ky)i + kz (4)
iek=2 = ek=2i; jek=2 = ek=2j; kek=2 = ek=2k
= ek=2
= cos
2 + k sin
2
rotated a vector about the z-axis
by an angle .
11. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Let’s rotate the orbit
Let Kepler orbit on the xy-plane
x + iy = u2; (5)
with LC coordinate u = u0 + iu1. By multiplying j from right,
we move the orbit on the yz-plane,
(x + iy)j = jx + ky = u2j = uj¯u: (6)
With arbitrary rotational quaternions and
20. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Comparison of LC and KS
LC KS
12
12
algebra complex, C quaternion, 12
12H
phys. coord. r = x + iy r = ix + jy + kz
reg. coord. u = u0 + iu1 u = u0 + iu1 + ju2 + ku3
transformation r = u2 r = u u
¯eq. of motion u00 = hu + juj2fu u00 = hu kuk2fu
I f is a perturbation vector
I Original 2 2 real matrix formulation is possible for LC
I Original 4 4 real matrix or 2 2 complex matrix (Pauli
matrices) formulation is possible for KS
21. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
A very accurate Hermite integrator
(Accidentally) it turn out that the following symmetric
corrector form
ucorr =uold +
2
(u0
corr + u0
old)
2
12
(u00
new u00
old);
u0
corr =u0
old +
2
(u00
new + u00
old)
2
12
(u000
new u000
old); (9)
after P(EC)n convergence 5 of 6 orbital elements (except for the
phase) conserve in machine accuracy.
If you use another form for the position
ucorr =uold +
2
(u0
corr + u0
old)
2
10
(u00
new u00
old) +
3
120
(u000
new + u000
old);
(10)
this property is lost.
22. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Why it works
Consider a harmonic oscillator ¨x = !x, and let vi = ˙xi and
fi = ¨xi.
An analytical solution for one step t writes,
!x1
v1
!
=
cos!t sin!t
sin!t cos!t
!
!x0
v0
!
: (11)
It is equivalent to
v1 v0
x1 x0
!
=
tan(!t=2)
!t=2
!
t
2
f1 + f0
v1 + v0
!
: (12)
A second order integrator approximates this as
v1 v0
x1 x0
!
=
t
2
f1 + f0
v1 + v0
!
: (13)
The dierence is only a small factor on the stepsize t.
23. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Fourth- and sixth-order version
The 4th-order Hermite integrator is equivalent to
v1 v0
x1 x0
!
=
*..
,
1
1 13
!t
2
2
+//
-
t
2
f1 + f0
v1 + v0
!
; (14)
and a 6th-order one
v1 v0
x1 x0
!
=
*..
,
1 1
15
!t
2
2
1 25
!t
2
2
+//
-
t
2
f1 + f0
v1 + v0
!
: (15)
The factor to t is approaching to
tan(!t=2)
!t=2
!
, of exact
solution.
Phase error shared among 4 waves of KS
) 5 of 6 orbital elements conserve
24. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Phase correction
If one likes to conserve also the phase, emphasize the step-size
t.
x1 =x0 +
c2t
2
(v1 + v0);
x1 =x0 +
c4t
2
(v1 + v0)
t2
12
(f1 f0);
x1 =x0 +
c6t
2
(v1 + v0)
t2
10
(f1 f0) +
c6t3
120
(˙f1 + ˙f0); (16)
(so on the velocity), with
c2 =
tan
; c4 =
tan
1
1
3
2
!
; c6 =
tan
1 25
2
1 1
15 2
; (17)
and = !t=2. Now the results agree with the analitic
trigonometric functions in machine accuracy.
25. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Block stepping
I Usually, fixed , 30 step/orbit is enough for weakly
perturbed binary.
I Then, real step t =
Z +
dt
d
d =
Z +
krkd,
becomes a varying real (non-quantized) number.
I This prevents parallelization, we hope t restricted to
2n (n 2 Z) (McMillan, 1986; Makino 1992).
26. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Truncation procedure
From given natural step nat, we compute a truncated step
bs ( nat) for which the corresponding step tbs = 2n obeys
the block-step criterion.
nat !
integrate
tnat !
truncate
tbs !
solve
bs (18)
We integrate
tnat =
X6
n=1
thni (nat)n
n!
;
thni =
dn
dn t
!
: (19)
After truncation tnat ! tbs, we solve bs from
tbs +
X6
n=1
thni (bs)n
n! = 0; (20)
by using of Newton–Raphson iterations (unique solution
exists).
27. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Derivatives of physical time t
I After a 4th-order Hermite integration, up to 3rd derivative
of force (5th derivative of coordinate) is available
I Up to 6th derivative of time is available
t0 =u u;
t00 =2(u u0);
t000 =2(u u00 + u0 u0);
th4i =2(u u000) + 6(u0 u00);
th5i =2(u uh4i) + 8(u0 u000) + 6(u00 u00);
th6i =2(u uh5i) + 10(u0 uh4i) + 20(u00 u000): (21)
I tnext is explicitly available at the end of this step
I Predictor only, no corrector is applied for t
28. A block-step version
of KS regularization
Keigo Nitadori
KS regularization
Hermite integrator
KS block-step
Summary
Summary
I The block-step version of KS is working in Sverre’s code
I Some Hermite integrators turned out to integrate harmonic
oscillators very accurately with P(EC)n iterations
I Regularization is not acrobatics, nor a black magic
(at least for two-body).