Regularized Fast Multipole Method (RFMM) for Geometric...
Transcript of Regularized Fast Multipole Method (RFMM) for Geometric...
FMM and Velocity Verlet scheme
Regularized Fast Multipole Method (RFMM)for Geometric Numerical Integrations
Eric DARRIGRAND
Universite de Rennes 1 – INRIA - [email protected]
http://perso.univ-rennes1.fr/eric.darrigrand-lacarrieu
joint work with Philippe CHARTIER and Erwan FAOU
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Outline
• Hamiltonian systems
? symplectic integrators
? motivation of fast methods
• a classical FMM
? derivation of the FMM
? FMM and symplectic integrators
? some improvements of the FMM
• a regularized FMM (RFMM)
? regularization of the classical FMM
? numerical application to the Solar System
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Hamiltonian systems
ODE system: q = M−1p ∈ R3N
p = −∇U(q) ∈ R3N
where M = diag(m1IR3 , · · · ,mNIR3)
Hamiltonian of the system:
H(p, q) = T (p) + U(q)
? T (p) =12pTM−1p is the kinetic energy
? U(q) is the potential function
−→ For invariance energy: Use of symplectic integrators.
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Symplectic integrators
Velocity Verlet scheme: ([Hairer, Lubich, Wanner - 06])qn+ 1
2= qn + h
2 vn
vn+1 = vn − h∇U(qn+ 12)
qn+1 = qn+ 12
+ h2 vn+1
where qn ≈ q(nh) and vn ≈ v(nh) with v = q = M−1p
−→ explicit, symplectic and symmetric
Calculation of the potential:
astronomy / molecular dynamics =⇒ evaluation of∇U of order N2.
For instance, for the Outer Solar System,
U(q) = −γ5∑i=1
i−1∑j=0
mimj
‖qi − qj‖
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
The Fast Multipole Method (FMM): Basic idea
• Compute: ∀i = 1, N , Yi =N∑j=1
Mij Xj −→ Complexity = O(N2)
• Suppose: ∃ (ai)i , (bj)j /Mij = ai bj
Algorithm:Step 1: F =
N∑j=1
bj Xj
Step 2: ∀i, Yi = aiF
−→ Complexity = O(N)
• Suppose: ∃ (ali)il , (bl
j)jl /Mij =L∑
l=1
ali bl
j , L << N
Algorithm:
Step 1: ∀l , F l =N∑j=1
blj Xj
Step 2: ∀i , Yi =L∑l=1
aliFl
−→ Complexity = O(N L)
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
FMM: a 1D simple example
Speed up of matrix-vector productsMX with given X and
Mi j =
1
xi − xjif i 6= j
1 if i = j
Suppose the configuration
B1 B2 B3 B4
0 1
•xi xj
•
For xj ∈ B3 ∪B4
1xi − xj
=1
C1 − xj − (C1 − xi)=
1C1 − xj
∞∑l=0
(C1 − xiC1 − xj
)l.
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Hence∑
j/xj∈B3∪B4
Mi j .Xj =Lε∑l=0
(C1 − xi)l∑
j/xj∈B3∪B4
Xj
(C1 − xj)l+1.
•Ckxi
◦xj1◦
xj2◦
xj3◦
Complexity of a matrix-vector product: O(KN ln N + N2/K)with K = number of boxes and N = number of points xj)
Optimal complexity: O(N3/2 ln N) obtained with K ∼ N1/2.
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
FMM for the Outer Solar System
Coulomb forces of the Outer Solar System
∇iU(q) = −γ∑j 6=i
mimj∇1G(qi, qj) = −γ∑j
Mi,j
with
G(x, y) =1
‖x− y‖Mj,j = 0
Mi,j = mimj∇1G(qi, qj) for i 6= j
−→ common matrix-vector product calculable with FMM(V. Rokhlin - L. Greengard)
First step: FMM expansion for∑j 6=i
wj‖xi − yj‖
for given {wj}j .
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
18 interactions
BT1
BS2
BS3
x11
x12
x13
y21y22
y23
y31y32
y33 11 interactions
BT1
BS2
BS3
C2◦
C3◦
C1
◦x11
x12
x13
y21y22
y23
y31y32
y33
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Source boxes – multipole expansion:(yj , wj) source points in a box Bsrc of center Csrc and xi a target point far away.
Φ(xi) =∑j
wj‖xi − yj‖
=∑j
wj‖(xi − Csrc)− (yj − Csrc)‖
Consider (xi − Csrc)↔ (r′, θ′, ϕ′) and (yj − Csrc)↔ (ρj , αj , βj). Then
Φ(xi) =∞∑n=0
n∑m=−n
Mmn
r′n+1Y mn (θ′, ϕ′)
Mmn =
∑j
wj ρnj Y
−mn (αj , βj)
Choice of the truncation, with a = radius of the boxes:∣∣∣∣∣Φ(xi)−L∑n=0
n∑m=−n
Mmn
r′n+1Y mn (θ′, ϕ′)
∣∣∣∣∣ ≤∑j |wj |r′ − a
( ar′
)L+1
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Target boxes – local expansion:xi in a box Btrg of center Ctrg ; (xi − Ctrg)↔ (ρi, αi, βi)If (Csrc − Ctrg)↔ (r, θ, ϕ) with r > (c+ 1)a, c > 1 and ρi ≤ a.
Then Φ(xi) =∞∑ν=0
ν∑µ=−ν
Lµν ρνi Y
µν (αi, βi)
Lµν =∞∑n=0
n∑m=−n
ı|µ−m|−|µ|−|m| Amn Aµν
(−1)n Am−µν+n
Y m−µν+n (θ, ϕ)rν+n+1
Mmn
with
Amn =(−1)n√
(n−m)!(n+m)!
Error estimates:∣∣∣∣∣Φ(xi)−L∑ν=0
ν∑µ=−ν
Lµν ρνi Y
µν (αi, βi)
∣∣∣∣∣ ≤∑j |wj |
ca− a
(1c
)L+1
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Algorithm:
• Step 0: w-independent quantities:
? Translation operator: multipole exp. around Csrc→ local exp. around Ctrg.
? Far moments fn,mj and local moments gν,µi .
• Step 1: Far fields: ∀Bsrc, ∀yj ∈ Bsrc, Fn,mBsrc← wj · fn,mj .
• Step 2: Local fields: ∀Btrg, ∀Bsrc far from Btrg, (Gν,µBtrg)ν,µ ← (Fn,mBsrc
)n,m.
• Step 3: Far interactions: ∀Btrg, ∀xi ∈ Btrg, ∀(ν, µ), Φfar(xi)← Gν,µBtrg· gν,µi .
• Step 4: Close interactions: ∀Btrg, ∀xi ∈ Btrg,Φclose(xi)← neighbor-source-points contribution.
• Step 5: The matrix-vector product: ∀Btrg, ∀xi ∈ Btrg,Φ(xi) ≈ Φclose(xi) + Φfar(xi).
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Complexity:With N = number of degrees of freedom.
K = number of boxes.
T = number of translations between boxes.
L = truncature parameter.
• Translations between boxes (step 2): T × L4.
• Local translations inside the boxes (steps 1 and 3): N × L2.
• Close interactions (step 4): N2/K.
• One-level FMM (SL-FMM): total cost ∼N2/K + K2 L4 + N L2.
• Multilevel FMM (ML-FMM): total cost ∼N2/K + K L4 + N L2.−→ Optimal choice: K ∼ N ; complexity N L4.
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
FMM discontinuities:
•CBT
CBS1• •CBS2
xi1◦
yj1◦ ◦
yj2
CBT1• •CBT2
xi1◦ ◦xi2
Far interactions of BT1
Far interactions of BT2
Close interactions of xi1 ∈ BT1
Close interactions of xi2 ∈ BT2
−→ loss of regularity and preservation of the Hamiltonian
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Some algorithm improvements:
• ML-FMM using multipole-multipole and local-local translations.
• Optimization of the translation costs:
? vFMM: Number of multipoles L adapted to the level in ML-FMM.Petersen et al., 1994;
? Rotation of the system: translations are more efficient along the axes.Greengard and Rokhlin, 1997; −→ reduces L4 to L2.
? Convolution ((n− ν), (m− µ)) and FFT for translations Mmn −→ Lµν .
Elliott and Board, 1996; −→ reduces L4 to L2 ln L.
• Alternatives:
? FFTM: Convolution (Csrc − Ctrg) and FFT for the translations Csrc to Ctrg.Ong, Lim, and Lee, 2003. A modified SL-FMM.
? Generalization of the FMM: e.g., using the SVD concept.
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM – a regularized FMM: Overlapping boxes and partition of unity.
Virtual box B1
Virtual box B2
Virtual box B3
Box 1 Box 2 Box 3x1• x2•x3•
Φ(x1) ≈ Φclose(x1 ∈ B2) + Φfar(x1 ∈ B2)
Φ(x2) ≈ (1− χ(x2))[Φclose(x2 ∈ B2) + Φfar(x2 ∈ B2)
]+ χ(x2)
[Φclose(x2 ∈ B3) + Φfar(x2 ∈ B3)
]Φ(x3) ≈ (1− χ(x3))
[Φclose(x3 ∈ B1) + Φfar(x3 ∈ B1)
]+ χ(x3)
[Φclose(x3 ∈ B2) + Φfar(x3 ∈ B2)
]Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
Algorithm consequencies:
? The overlapping of the boxes may affect the speed of the convergence of thelocal/multipole expansions
=⇒ larger order of neighborhood.
? A target point may belong to several boxes.
? A low increase of the number of points in each target box.=⇒ A low increase of the cost of the step involving the local moments.
? No change of the global algorithm complexity.
=⇒ a regularized FMM for a comparable computational cost
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
1D illustration: x1, · · · , x800, uniformly distributed on [0, 1] ;
Compute ∀i = 1, · · · , 800: Si =400∑
j 6=i,j=250
1‖xi − xj‖
.
0 0.2 0.4 0.6 0.8 1−2
0
2
4
6
8
10 x 10−3
x
erro
r on
Sum
y( G(x
,y) )
Error on Sumy( G(x,y) )
classical FMMsmooth FMM
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4−2
0
2
4
6
8
10 x 10−3
x
erro
r on
Sum
y( G(x
,y) )
Error on Sumy( G(x,y) )
classical FMMsmooth FMM
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
Problem: The solar system (Sun, Jupiter, Saturn, Uranus, Neptune, Pluto).Initial data: positions/velocities on sept. 4, 1994.FMM for the computation of
∇iU(q) = −γ∑j 6=i
mimj∇1G(qi, qj) , G(x, y) =1
‖x− y‖
Notations:
? L: number of multipoles. Typical value ≈ 6, very accurate with L = 15 or even 20.
? No: order of neighborhood (defines close and far interactions).
? NL: number of levels of the oc-tree. Here, a good tradeoff is NL = 7.
? Rreg: ratio (regularization zone on each side of a group / length of the group).
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 3, NL = 7, No = 1, Rreg = 0.25
0 0.5 1 1.5 2 2.5x 106
−7
−6
−5
−4
−3
−2
−1
0
1
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 3p7b
regular FMMclassical FMMwithout FMM
0 0.5 1 1.5 2 2.5x 106
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
1.2
time (unit = 1 day) −− Time−step = 10 days
Rel
ativ
e er
ror o
n H
amilt
onia
n
Relative error on Hamiltonian versus time in days − 3p7b
regular FMMclassical FMM
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 3, NL = 7, No = 1, Rreg = 0.25
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 5 or 6, NL = 7, No = 1, Rreg = 0.25
0 1 2 3 4 5 6 7 8x 105
−8
−7
−6
−5
−4
−3
−2
−1
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 5p7b
regular FMMclassical FMMwithout FMM
0 0.5 1 1.5 2x 106
−8
−7
−6
−5
−4
−3
−2
−1
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 6p7b
regular FMMclassical FMMwithout FMM
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 6, NL = 7, No = 1, Rreg = 0.25
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 10, NL = 7, No = 1, Rreg = 0.25
0 2 4 6 8 10x 105
−10
−9
−8
−7
−6
−5
−4
−3
−2
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 10p7b
regular FMMclassical FMMwithout FMM
0 0.5 1 1.5 2x 105
−11
−10
−9
−8
−7
−6
−5
−4
−3
−2
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 10p7b
regular FMMclassical FMMwithout FMM
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 3, NL = 7, No = 2, Rreg = 0.45
0 0.5 1 1.5 2x 106
−6
−5.5
−5
−4.5
−4
−3.5
−3
−2.5
−2
−1.5
time (unit = 1 day) −− Time−step = 10 days
Log 10
(rela
tive
erro
r on
Ham
ilton
ian)
Log10 of relative error on Hamiltonian versus time in days − 3p7b 2Nei Tr=0.45
regular FMMclassical FMMwithout FMM
0 0.5 1 1.5 2x 106
−0.015
−0.01
−0.005
0
0.005
0.01
0.015
0.02
0.025
0.03
time (unit = 1 day) −− Time−step = 10 days
Rel
ativ
e er
ror o
n H
amilt
onia
n
Relative error on Hamiltonian versus time in days − 3p7b 2Nei Tr=0.45
regular FMMclassical FMM
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
RFMM and the Outer Solar System
L = 3, NL = 7, No = 2, Rreg = 0.45
Eric Darrigrand Seminaire IECN – 15 juin 2010
FMM and Velocity Verlet scheme
A first conclusion
The regularized FMM
• recovers the invariance of energy of an Hamiltonian system,
• has the same algorithm complexity as the usual FMM.
Coming work
• Application of improvements regarding the source-to-target translations.
• Application of the regular FMM to molecular dynamics.
Eric Darrigrand Seminaire IECN – 15 juin 2010