contour integral methods for pdes · contour integral methods for pdes ... recall estimates for...

25
Contour Integral Methods for PDEs Practical computation with conformal maps and double exponential quadrature JAC Weideman & N Hale Stellenbosch University, South Africa

Upload: others

Post on 04-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsPractical computation with conformal maps and double exponential quadrature

JAC Weideman & N HaleStellenbosch University, South Africa

Page 2: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsBackground: The Trapezoidal Rule

Trapezoidal rule for integrals on R:∫∞

−∞

f(x) dx ≈ h∞∑

k=−∞

f(kh), h > 0

Convergence can be superfast:

Example:∫∞

−∞

e−x2

√1 + x2

dx = 1.5241093 . . .

Re z

Im z

ia

−ia

h Abs. Err e−2π/h

0.4 5.5 · 10−7 1.5 · 10−7

0.2 5.7 · 10−14 2.4 · 10−14

0.1 9.0 · 10−27 5.2 · 10−27

Theorem (Martensen 1986): If the in-tegrand is analytic in a strip of half-width a about R then the discretizationerror is

DE = O(e−2πa/h)

JAC Weideman - Stellenbosch University Slide 1/22

Page 3: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsBackground: The Trapezoidal Rule

When the sum is truncated: h∞∑

k=−∞

f(kh) ≈ hn∑

k=−n

f(kh)

This introduces a second error, the truncation error. If integrand decays rapidlywe estimate this as the magnitude of the first omitted term

Example:∫∞

−∞

e−x2

√1 + x2

dx

⇒ TE = O(e−(nh)2)

An estimate for the optimal step lengthfollows from balancing the truncationand discretization errors

2πh

= (nh)2⇒ h =

(2π)1/3

n2/3 0 5 10 15 20 25 30 35 40 45 5010

−16

10−14

10−12

10−10

10−8

10−6

10−4

10−2

n

Abs

olut

e E

rror

Actual Error

e−(2πn)2/3

JAC Weideman - Stellenbosch University Slide 2/22

Page 4: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

Let x ∈ [0,1], t ∈ [0,∞), u ∈ Rm×1, A ∈ Rm×m, with σ(A) ∈ R−

Semi-discrete Parabolic PDE:

∂u∂t

= Au, t > 0

Initial condition:

u(0) = f

Contour integral:

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Semi-discrete Elliptic PDE:

∂2u∂x2 + Au = 0, 0 < x < 1

Boundary conditions:

u(0) = 0, u(1) = f

Contour integral:

u(x) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

E(x; z) = sin(x√

z)/ sin(√

z)

JAC Weideman - Stellenbosch University Slide 3/22

Page 5: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

Let x ∈ [0,1], t ∈ [0,∞), u ∈ Rm×1, A ∈ Rm×m, with σ(A) ∈ R−

Semi-discrete Parabolic PDE:

∂u∂t

= Au, t > 0

Initial condition:

u(0) = f

Contour integral:

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Semi-discrete Elliptic PDE:

∂2u∂x2 + Au = 0, 0 < x < 1

Boundary conditions:

u(0) = 0, u(1) = f

Contour integral:

u(x) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

E(x; z) = sin(x√

z)/ sin(√

z)

JAC Weideman - Stellenbosch University Slide 3/22

Page 6: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

Let x ∈ [0,1], t ∈ [0,∞), u ∈ Rm×1, A ∈ Rm×m, with σ(A) ∈ R−

Semi-discrete Parabolic PDE:

∂u∂t

= Au, t > 0

Initial condition:

u(0) = f

Contour integral:

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Semi-discrete Elliptic PDE:

∂2u∂x2 + Au = 0, 0 < x < 1

Boundary conditions:

u(0) = 0, u(1) = f

Contour integral:

u(x) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

E(x; z) = sin(x√

z)/ sin(√

z)

JAC Weideman - Stellenbosch University Slide 3/22

Page 7: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

References for the Parabolic case:Talbot [1979]Sheen, Sloan & Thomee [2000]Gavrilyuk & Makarov [2001]Lopez-Fernandez & Palencia[2004]W & Trefethen [2007]etc

References for the Elliptic case:Gavrilyuk, Makarov & Vasylyk[2006, 2011]

Gavrilyuk et al prove very generaltheorems in an abstract Banachspace

Our aim is practical: optimalcontours and step sizes, attentionto the numerical linear algebra, etc

JAC Weideman - Stellenbosch University Slide 4/22

Page 8: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

Numerical approach to contour integrals:conformal mapping + trapezoidal rule ⇒ double exponential quadratureDomain of analyticity of each integrand?Both integrals singular when z = λ < 0, for any λ ∈ σ(A). When choosing acontour we therefore exclude R− (or (−∞,−`2], if dominant λ is known)

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Because the exponential function isentire, there are no other singularities.In floating-point arithmetic, however,ezt is “practically singular” for Re(z)sufficiently large

u(x) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

By contrast

E(x; z) = sin(x√

z)/ sin(√

z)

has isolated poles at z = π2,4π2,9π2,etc. We exclude [π2,∞)

JAC Weideman - Stellenbosch University Slide 5/22

Page 9: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsIntroduction

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Re z

Im z

Γ

Red: “Floating-pt singularity” of ezt

u(x) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

Re z

Im z

Γ

Blue: σ(A) Red: Poles of E(x; z)

JAC Weideman - Stellenbosch University Slide 6/22

Page 10: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsConformal Mapping for Elliptic Case

Until further notice we focus on the Elliptic case.

z =12π2

(1 + i sinh w

), |Im w | <

12π

Re z

Im z

π20

Re w

Im w

i2π

− i2π

JAC Weideman - Stellenbosch University Slide 7/22

Page 11: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsQuadrature Sum

Contour of integration:

Γ : z =12π2

(1 + i sinhθ

), −∞ < θ < ∞

12πi

∫Γ

E(x; z)((zI − A)−1f

)dz =

12πi

∫∞

−∞

E(x; z(θ))((z(θ)I − A)−1f

)z′(θ) dθ

Introduce grid with spacing h

θk = (k + 12)h, k = 0,±1,±2, . . .

The approximation is then

u(x) ≈h

2πi

∞∑k=−∞

E(x; z(θk ))((

z(θk )I − A)−1

f)z′(θk )

=hπ

Im

n−1∑k=0

E(x; z(θk ))((

A − z(θk )I)−1

f)z′(θk )

JAC Weideman - Stellenbosch University Slide 8/22

Page 12: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsPractical Implementation of Quadrature Sum

For each node of the quadrature sum a shifted linear system has to be solved:

u(x) =hπ

Im

n−1∑k=0

E(x; z(θk ))z′(θk )vk

, (A − z(θk )I

)︸ ︷︷ ︸

complex shift

vk = f

Since A is typically large, we wish to minimize number of resolvent solves.Can do this by(a) choosing a step size h for optimal accuracy(b) using efficient numerical algorithms for solving the shifted linear systems

In this talk we focus mainly on (a). Considerations for (b) includedirect vs iterativeserial vs parallelSylvester or Lyapunov solvers when A is in Kronecker product form

JAC Weideman - Stellenbosch University Slide 9/22

Page 13: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsFeatures of The Method

∂2u∂x2 + Au = 0, 0 < x < 1

u(0) = 0, u(1) = fu(x) =

Im

n−1∑k=0

E(x; z(θk ))z′(θk )vk

Key points to note:

Solution of resolvent systems (A − z(θk )I)vk = f can be implemented inparallel, e.g., parfor in MATLABIf original problem is posed in Rd+1, subproblems in Rd are solvedSolution is computed at a fixed x “slice”, not in the entire domainAccuracy is lost when x → 1, which is the edge where the BC is prescribedOther types of BCs can also be handled, e.g., u(0) = g,u(1) = f . AlsoNeumann and mixedNeed to pick step size h carefully, otherwise convergence is slow as n→∞

JAC Weideman - Stellenbosch University Slide 10/22

Page 14: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsDiscretization Error Estimate for the Trapezoidal/Midpoint Rule

If integrand is analytic in strip ofhalf-width a

DE = O(e−2πa/h)

In this case a = 12π

DE = O(e−π2/h)

Geometric convergence as h → 0,but only if infinite series can besummed exactly

Re w

Im w

i2π

− i2π

In practice the infinite series is truncated and a second error, namely theTruncation Error, is incurred

JAC Weideman - Stellenbosch University Slide 11/22

Page 15: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsTruncation Error Estimate

Estimate truncation error as first omitted term in series

u(x) =hπ

Im

n−1∑k=0

E(x; z(θk ))z′(θk )vk

, E(x; z) =sin(x

√z)

sin(√

z)

⇒ TE = O(e−(1−x) Im√

z(θn))

Now, as n→∞ with h fixed

z(θn) ∼i2π2 sinhθn ∼

i4π2 eθn ⇒

√z(θn) ∼

eπi/4

2πeθn/2

Because θn ∼ nh it follows that

TE = O(e−(1−x)πenh/2/(2√

2))

Note: Double exponential decay in integrand⇒ double exponential quadratureJAC Weideman - Stellenbosch University Slide 12/22

Page 16: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsEstimate for Optimal Step Size h

Recall estimates for discretization and truncation errors, respectively,

DE = O(e−π2/h), TE = O(e−(1−x)πenh/2/(2

√2))

Set exponential orders equal

π2

h=

1 − x

2√

2πe

w︷︸︸︷hn/2 (

w ew = t ⇒ w = W(t))

︸ ︷︷ ︸Solve for optimal step size h in terms of the Lambert W -function

h∗ =2n

W( √

2πn1 − x

)The corresponding estimate for the total error, as n→∞, is

Total Error = O(e−π

2/h∗)

Next we check the validity of these estimates on a toy problemJAC Weideman - Stellenbosch University Slide 13/22

Page 17: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsModel Problems

Laplace in a square [0,1] × [0,1]

∂2u∂x2 +

∂2u∂y2︸︷︷︸A u

= 0

Boundary conditions:

u(x ,0) = u(x ,1) = 0, 0 < x < 1

u(0, y) = 0, u(1, y) = 1, 0 < y < 1 1

0.5

01

0.5

1

0.5

00

xy

Will also considersame problem on the rectangle [0,1] × [0,10], which is equivalent to the lastof the famous Ten Digit problems of Nick Trefethen (2002)same problem in the box [0,1] × [0,1] × [0,10]

JAC Weideman - Stellenbosch University Slide 14/22

Page 18: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsVerification of Optimal Step-Size Formula

Optimal formula for h∗ is shown as dashed curve in the (n,h) parameter plane:experiment (left) and theory (right). (Error computed at x = 0.5)

Above the dashed curve the discretization error dominates O(e−π2/h)

Below it, the truncation error dominates O(e−(1−x)πenh/2/(2√

2))

JAC Weideman - Stellenbosch University Slide 15/22

Page 19: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsAsymptotic Behavior of Error

The principal (real) branch of the W -function satisfies W(t) ∼ log t , t →∞Therefore, for fixed x and n→∞

h∗ =2n

W( √

2πn1 − x

)∼

2n

log( n1 − x

)Total Error = O

(e−π

2/h∗)

= O

(e−

12π

2n/ log(n/(1−x)))

“Almost” geometric convergence,typical of double exponential quadrature

What if x ≈ 1? Can modify contour andchoice of h to obtain O

(e−c

√n)

convergence(Gavrilyuk et al, 2006, 2011)

JAC Weideman - Stellenbosch University Slide 16/22

Page 20: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsFine Tuning: Using Spectral Information

If dominant eigenvalue of A is known, one can replace R− by (−∞,−`2], i.e.,

z =12

(π2− `2) +

i2

(π2 + `2) sinhθ, −∞ < θ < ∞

Number of resolvent solves0 5 10 15 20 25 30

Rel

ativ

e er

ror

10 -10

10 -5

10 0

Rectangle: [0,1]x[0,10]. x = 0.5

Without spectral infoWith spectral info

JAC Weideman - Stellenbosch University Slide 17/22

Page 21: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsA 3D Problem

Laplace in a box [0,1] × [0,1] × [0,10]

∂2u∂x2 +

∂2u∂y2 +

∂2u∂z2︸ ︷︷ ︸

A u

= 0

Shifted systems (A −zI)v = f solved byApproximating 2D Laplacian A byKronecker product of Chebyshevdifferentiation matrices D (20 × 20)This leads to a Sylvester systemthat can be solved efficiently bylyap in MATLAB

Timing and accuracy results coming up

Boundary conditions:One square edge u = 1, all others 0This is the 3D version of the last of theTrefethen 10 Digit problems:

JAC Weideman - Stellenbosch University Slide 18/22

Page 22: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsA 3D Problem: numerical results

Error computed at midpoint of[0,1] × [0,1] × [0,10]

ParticleInBox_opt

Number of terms in Trap rule 15

Elapsed time is 0.006097 seconds.

ans =

7.298817657065122e-107.298817657048526e-10

[Dell Precision M400 laptop]

Trefethen & W, SIAM Review 2014

JAC Weideman - Stellenbosch University Slide 19/22

Page 23: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsParabolic vs Elliptic: convergence rates & stability

Parabolic:∂u∂t

= Au, t > 0

u(t) =1

2πi

∫Γ

ezt((zI − A)−1f

)dz

Elliptic:∂2u∂x2 + Au = 0, 0 < x < 1

u(t) =1

2πi

∫Γ

E(x; z)((zI − A)−1f

)dz

JAC Weideman - Stellenbosch University Slide 20/22

Page 24: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsParabolic vs Elliptic: sensitivity to parameters

Parabolic:∂u∂t

= Au, t > 0

n

h

2 4 6 8 10 12 14 16 18 20

0.05

0.1

0.15

0.2

0.25

−14

−12

−10

−8

−6

−4

−2

Elliptic:∂2u∂x2 + Au = 0, 0 < x < 1

n

h

5 10 15 20 25 30

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

−14

−12

−10

−8

−6

−4

−2

JAC Weideman - Stellenbosch University Slide 21/22

Page 25: Contour Integral Methods for PDEs · Contour Integral Methods for PDEs ... Recall estimates for discretization and truncation errors, respectively, ... Contour Integral Methods for

Contour Integral Methods for PDEsFurther Reading

To see details for Parabolic PDEs: To see proofs:

JAC Weideman - Stellenbosch University Slide 22/22