18.336J/6.335J: Fast methods for partial differential and...

33
18.336J/6.335J: Fast methods for partial differential and integral equations Cambridge, October 12, 2017 MIT Mathematics Department Instructor: Carlos Pérez Arancibia Lecture10

Transcript of 18.336J/6.335J: Fast methods for partial differential and...

Page 1: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

18.336J/6.335J:Fastmethodsforpartialdifferentialandintegralequations

Cambridge,October12,2017

MITMathematicsDepartment

Instructor:CarlosPérezArancibia

Lecture10

Page 2: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:Algorithm

• Let N be the maximum of the number of charges and number of evaluation

points. We build the quad tree adaptively so that the leaf boxes contain

no more than s charges and evaluation points, with s to be determined

later.

• Assume that the projection and interpolation rule both involve (no more

than) p canonical charges and canonical potentials per box, i.e., both mand n run from 1 to p.

• Assume that the projection/interpolation rules, and the interaction lists,

are precomputed (they do not depend on the particular charge distribu-

tion.)

Page 3: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:Algorithm

Initialization

Collect the points source locations yj in boxes B at all scales, and the observa-

tion locations xi in boxes A at all scales.

Let L be the level of the finest leaf box.

for all leaf boxes B:

Source-to-multipole: qBm =

Z

B\�PBm (y)q(y) dsy.

end

uAn = 0 for A the root box

Page 4: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:AlgorithmUpward pass

for ` = L� 1, . . . , 1

for B in tree at at level `

M2M operation from Bc to B:

qBm =

X

c

X

m0

PBm (yBc

m0)qBcm0 .

end

end

Downward pass

for ` = 2, . . . , Lfor A in tree at at level `

L2L operation from Ap to A, and M2L conversion:

uAn =

X

n0

PAp

n0 (x

An )u

Ap

n0 +

X

B2IL(A)

X

m

G(x

An ,y

Bm)qBm.

end

end

Page 5: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:Algorithm

Termination

for all leaf boxes A

Local-to-evaluation and diagonal interactions:

ui =

X

n

PAn (xi)u

An +

X

B2NL(A)

Z

B\�G(xi,y)q(y) dsy.

end

Page 6: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:Complexity

• s: maximum number of charges and evaluation points per leaf box.

• p: number of canonical charges and canonical potentials per box.

Claim. If we take s = p, the complexity of the 2D FFM is O(pN).

Proof.

• The number of leaf boxes is O(N/s).

• The number of boxes is at most twice the number of leaf boxes, regardless

of the tree, so it is also O(N/s).

• The complexity of one M2M, or one M2L or one L2L operations is a small

p-by-p matrix vector multiplication, hence O(p2) operations.

• The construction of the quadtree structure requires O(N) operations.

Importantassumption!

Page 7: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMM:ComplexityProof (cont.).

• The source-to-multipole step involves mapping every one of the N charges

to p canonical charges, hence has complexity O(pN).

• In the upward pass, every one of the O(N/s) source boxes is visited once,

with an M2M that costs O(p2) operations, for a total of O(p2N/s).

• In the downward pass, every one of the O(N/s) evaluation boxes is visited

once, with an M2L and an L2L that both cost O(p2) operations, for a

total of O(p2N/s) as well.

• For the termination, the local-to-evaluation step involves mapping p canon-ical potentials to every one of the N evaluation points, hence has com-

plexity O(pN).

• The diagonal term is a sum over O(s) sources for each of the N evaluation

points, hence has complexity O(sN).

The overall operation count is O(pN + p2N/s+ sN), and is minimized pro-

vided we take s of order p. This shows that the complexity is O(pN) in 2D.

Page 8: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin2DWe proved that

G(x,y) = � 1

2⇡log |x� y| = 1

2⇡Re

( 1X

k=0

Ok(z0 � zc)Ik(z � zc)

)

where z0 = x1 + ix2, z = y1 + iy2 and |z � zc| < |z0 � zc| and

Ik(z) =zk

k!for k � 0

Ok(z) =(k � 1)!

zkfor k � 1, O0(z) = � log z.

Additionally we have the following identities:

Ik(z1 + z2) =kX

l=0

Ik�l(z1)Il(z2) =kX

l=0

Il(z1)Ik�l(z2)

and

Ok(z1 + z2) =1X

l=0

(�1)

lOk+l(z1)Il(z2), |z2| < |z1|.

Page 9: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin2DWe consider the problem of e�ciently approximate the integral

Z

B\�G(x,y)q(y) dsy =

1

2⇡Re

( 1X

k=0

Ok(z0 � zc)

Z

�\BIk(z � zc)q(z) dsz

)

for x = (Re z0, Im z0) 2 A and y = (Re z, Im z) 2 B, where A and B are well-

separated boxes, with yc = (Re zc, Im zc) denoting the center of the source box

B.

We then define the moments associated with the source box B as

µk(zc) =

Z

�\BIk(z � zc)q(z) dsz, k � 0.

M2M translation. If the expansion point zc is moved to a new location zc0the moments can be “translated” by using the following intensity:

µk(zc0) =

Z

�\BIk(z � zc0)q(z) dsz

=

Z

�\BIk(z � zc| {z }

z2

+ zc � zc0| {z }z1

)q(z) dsz

=

kX

l=0

Ik�l(zc � zc0)µl(zc) exact!

Page 10: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin2DM2L conversion. We introduce the so-called local expansion about the source

point z0 (x). Suppose zL is a point close to the source point z0, |z0 � zL| ⌧|zL � zc|, then:

Z

�\BG(z0, z)q(z) dsz =

1

2⇡

1X

k=0

Ok(z0 � zc)µk(zc)

=

1

2⇡

1X

k=0

Ok(zL � zc| {z }z1

+ z0 � zL| {z }z2

)µk(zc)

=

1

2⇡

1X

k=0

1X

l=0

(�1)

lOk+l(zL � zc)Il(z0 � zL)µk(zc)

=

1

2⇡

1X

l=0

Il(z0 � zL)(�1)

l1X

k=0

Ok+l(zL � zc)µk(zc)

=

1

2⇡

1X

l=0

Il(z0 � zL)Ll(zL)

where the expansion coe�cients Ll(zL) are given by the M2L conversion for-

mula:

Ll(zL) = (�1)

l1X

k=0

Ok+l(zL � zc)µk(zc).

Localexpansion

Multipoleexpansion

Page 11: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin2DL2L translation. If the point of the local expansion is moved from zL to zL0

we then have the following expression for the new local expansion coe�cients:

Z

�\BG(z0, z)q(z) dsz ⇡ 1

2⇡

pX

l=0

Ll(zL)Il(z0 � zL)

=1

2⇡

pX

l=0

Ll(zL)Il(z0 � zL0 + zL0 � zL)

=1

2⇡

pX

l=0

lX

m=0

Ll(zL)Im(z0 � zL0)Il�m(zL0 � zL)

=1

2⇡

pX

m=0

Im(z0 � zL0)

pX

l=m

Ll(zL)Il�m(zL0 � zL).

On the other hand, since

Z

�\BG(z0, z)q(z) dsz ⇡ 1

2⇡

pX

m=0

Lm(z0L)Im(z0 � z0L),

we obtain

Lm(zL0) =

pX

l=m

Ll(zL)Il�m(zL0 � zL)

which we refer to as the L2L translation formula.

Page 12: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Helmholtzequationin2D

The fundamental solution of the 2D Helmholtz equation can be expanded as:

Gk(x,y) =i

4H(1)

0 (k|x�y|) = i

4

1X

n=�1On(x�yc)I�n(y�yc), |y�yc| < |x�yc|

where k is the wavenumber, yc is an expansion point close to y, and the twoauxiliary function In and On are given by:

In(x) =(�i)nJn(kr) ein↵,

On(x) =inH(1)n (kr) ein↵ with x = r(cos↵, sin↵).

Graf’s addition theorem:

Cn(w) ein✓

=

1X

m=�1Cn+m(u)Jm(v) eim↵

(|v e±i↵ | < |u|)

where Cn is Jn, Yn or H(1)n ,

w =

pu2

+ v2 � 2uv cos↵

and

u� v cos↵ = w cos ✓, v sin↵ = w sin ✓.

v

w

u

Page 13: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

SeparabilityoftheHelmholtzGreenfunction

We consider x, y 2 R2, and

G(x, y) =i

4

H(1)0 (k|x� y|).

Assume that x 2 A and y 2 B, where A and B are two well-separated boxes.

Let r > 0 be the radius of (the circumscribed circle of) B, and d > 2r be the

distance from the center of B to the box A. For convenience, the box B is

centered at the origin.

Theorem. Consider A and B as described above. For all p > 0, there ex-

ists exists a constant Cp(k) > 0 such that

�����G(x,y)� i

4

pX

n=�p

On(x)I�n(y)

����� Cp(k)⇣ rd

⌘p.

Page 14: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

SeparabilityoftheHelmholtzGreenfunction

We consider x, y 2 R2, and

G(x, y) =i

4

H(1)0 (k|x� y|).

Assume that x 2 A and y 2 B, where A and B are two well-separated boxes.

Let r > 0 be the radius of (the circumscribed circle of) B, and d > 2r be the

distance from the center of B to the box A. For convenience, the box B is

centered at the origin.

Theorem. Consider A and B as described above. For all p > 0, there ex-

ists exists a constant Cp(k) > 0 such that

�����G(x,y)� i

4

pX

n=�p

On(x)I�n(y)

����� Cp(k)⇣ rd

⌘p.

In practice one needs to select p such that p > kr.

Page 15: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Helmholtzequationin2D

M2M translation. If the expansion point yc is moved to a new location yc0

the moments can be “translated” by using the following intensity:

µn(yc0) =

Z

�\BIn(y � yc0)q(y) dsy =

Z

�\BIn(y � yc| {z }

y2

+yc � yc0| {z }y1

)q(y) dsy

=

1X

m=�1In�m(yc � yc0)µm(yc)

We consider the approximation of the integral:

Z

�\BG(x,y)q(y) dsy =

i

4

1X

n=�1On(x� yc)

Z

�\BI�n(y � yc)q(y) dsy,

where y 2 B and x 2 A, A and B being well-separated boxes. We thus define

the moments as:

µn(yc) =i

4

Z

�\BI�n(y � yc)q(y) dsy, n 2 Z.

Page 16: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Helmholtzequationin2D

L2L translation. If the point of the local expansion is moved from xL to xL0

we then have the following expression for the new local expansion coe�cients:

Ln(xL0) =

1X

m=�1Im(xL0 � xL)Ln�m(xL).

which we refer to as the L2L translation formula.

Local expansion and M2L conversion. By the symmetry of the Green

function we obtain the following local expansion:

Z

�\BG(x,y)q(y) ds

y

=

1X

n=�1I�n(x� xL)

i

4

Z

�\BOn(y � xL)q(y) dsy

| {z }Ln(xL)

where |x � xL| < |yc � xL| (yc denotes the center of the box B). Therefore,

using the addition theorem we obtain the following M2L conversion formula:

Ln(xL) =

1X

m=�1(�1)

mOn�m(xL � yc)µm(yc).

Page 17: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Initialization

Collect the points source locations yj in boxes B at all scales, and the observa-

tion locations xi in boxes A at all scales.

Let L be the level of the finest leaf box.

for all leaf boxes B:

Source-to-multipole (source-to-moment):

Compute µBm = µm(y

Bc ) where y

Bc is the center of the leaf box B.

end

uAn = 0 for A the root box

FMMalgorithm

We consider the problem of e�ciently approximate the integral

Z

B\�G(x,y)q(y) dsy =

1

2⇡Re

( 1X

k=0

Ok(z0 � zc)

Z

�\BIk(z � zc)q(z) dsz

)

for x = (Re z0, Im z0) 2 A and y = (Re z, Im z) 2 B, where A and B are well-

separated boxes, with yc = (Re zc, Im zc) denoting the center of the source box

B.

We then define the moments associated with the source box B as

µk(zc) =

Z

�\BIk(z � zc)q(z) dsz, k � 0.

We consider the approximation of the integral:

Z

�\BG(x,y)q(y) dsy =

i

4

1X

n=�1On(x� yc)

Z

�\BI�n(y � yc)q(y) dsy,

where y 2 B and x 2 A, A and B being well-separated boxes. We thus define

the moments as:

µn(yc) =i

4

Z

�\BI�n(y � yc)q(y) dsy, n 2 Z.

Laplace:

Helmholtz:

Notethat:

Page 18: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMalgorithm:leafboxes

leafboxes

Page 19: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMalgorithm:interactionlistIL(A)

A

Page 20: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMalgorithm:far(A)

A

Page 21: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMalgorithm:neighborlistNL(A)

A

Page 22: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

…inthecaseoftheLaplaceequation:(M2Mtranslation)

Upward pass

for ` = L� 1, . . . , 1for B in tree at at level `

M2M translation from Bc to B:

µBn = µm(yB

c ) =

X

c

1X

m=�1In�m(yBc

c � yBc )µ

Bcm .

yBc is the center of the box B

yBcc is the center of the child box Bc

end

end

µBn = µn(z

Bc ) =

X

c

nX

l=0

In�l(zBcc � zBc )µBc

l .

FMMalgorithm

momentsassociatedtochildboxesmomentassociatedtoparentbox

Helmholtz

Page 23: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Upwardpass:M2Mtranslation

Bc

yBcc

yBc

B

FMMalgorithm

Page 24: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

(L2L)

(M2L)

…inthecaseoftheLaplaceequation

Downward pass

for ` = 0, . . . , Lfor A in tree at at level `

Compute the local expansion coe�cients:

Ln(xAL) =

1X

m=�1Im(x

AL � x

Ap

L )Ln�m(x

Ap

L )+

X

B2IL(A)

1X

m=�1(�1)

mOn�m(x

AL � y

Bc )µm(y

Bc )

x

AL : is the center of the box A

x

Ap

L is the center of the parent box Ap.

end

end

Ln(zAL ) =

pX

l=n

Il�n(zAL � z

Ap

L )Ll(zAp

L ) +X

B2IL(A)

1X

k=0

(�1)nOk+n(zAL � zBc )µm(zBc ).

FMMalgorithm

Helmholtz

Page 25: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Downwardpass:L2Ltranslation

Ap

x

Ap

L

x

AL

A

FMMalgorithm

Page 26: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMalgorithm

Termination

for all leaf boxes A

Local-to-evaluation and diagonal interactions:

u(xi) = ui =

1X

n=�1I�n(xi � x

AL)Ln(x

AL) +

X

B2NL(A)

Z

B\�G(xi,y)q(y) dsy

x

AL is the center of the box A.

end

…inthecaseoftheLaplaceequation:

Helmholtz

u(xi) =1

2⇡

1X

`=0

Re�L`(z

AL )I`(zi � zAL )

+

X

B2NL(A)

Z

B\�G(xi,y)q(y) dsy

Page 27: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMin3D

Page 28: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMin3D:Octree

Example:NeighborlistNL(A)

A centerofthepanels

Page 29: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMin3D:Octree

Example:InteractionlistIL(A)

Page 30: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

FMMin3D:Octree

Example:Interactionlistfar(A)

Page 31: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin3DWe proved that

G(x,y) =1

4⇡|x� y| =1

4⇡

1X

n=0

nX

m=�n

Sn,m(x�yc)Rn,m(y�yc), |y�yc| < |x�yc|

where

Rn,m(x) =

1

(n+m)!

Pmn (cos ✓) eim� rn

Sn,m(x) =(n�m)!Pmn (cos ✓) eim� 1

rn+1

where (⇢, ✓,�) are the coordinates of x in spherical coordinates.

Moments:

µn,m(yc) =

Z

�\BRn,m(y � yc)q(y) dsy, n � 0, |m| n

yc: center of the 3D box B.

Page 32: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence

Multipoleexpansions:Laplaceequationin3DM2M translation:

µn,m(yc0) =nX

n0=0

n0X

m0=�n0

Rn0,m0(y � yc0)µn�n0,m�m0(yc).

M2L conversion:

Ln,m(xL) = (�1)

n1X

n0=0

n0X

m0=�n0

Sn+n0,m+m0(xL�yc)µn0,m0

(yc), |x�xL| < |yc�xL|,

xL is the center of the 3D evaluation box A. (A and B are well separated)

L2L translation:

Ln,m(xL0) =1X

n0=n

n0X

m0=�n0

Rn0�n,m0�m(xL0)Ln0,m0(xL).

Page 33: 18.336J/6.335J: Fast methods for partial differential and ...math.mit.edu/~cperezar/18.336/lectures/10_12_17.pdf · ical potentials to every one of the N evaluation points, hence