• Keine Ergebnisse gefunden

5 Numerical Solution of Elliptic Boundary Value Problems

N/A
N/A
Protected

Academic year: 2021

Aktie "5 Numerical Solution of Elliptic Boundary Value Problems"

Copied!
37
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

5 Numerical Solution of Elliptic Boundary Value Problems

5.1 Some Theory and Examples The Poisson equation

− ∆u = f in Ω ⊆ R

n

with f ∈ C

0

(Ω) (P) is widely used and solved in applications. We first consider the Dirichlet boundary condition

u = g auf Γ := ∂Ω mit g ∈ C

0

(Γ) (D) and make some assumptions on Ω:

Ω is bounded,

Γ = ∂Ω is piecewise smooth

Ω lies locally on one side of Γ.

(2)

Under these conditions there exists an unique solution u ∈ C

2

(Ω) ∩ C

0

(Ω), such that (P) and (D) are satisfied.

The solution depends continuously on the data: u

1

, u

2

are solutions of

−∆u = f with the boundary values g

1

and g

2

, then sup

x∈Ω

|u

1

(x) − u

2

(x)| = sup

x∈Γ

|g

1

(x) − g

2

(x)|

(continuous dependence on boundary data).

Further, there is a constant c, which only depends on Ω, such that sup

x∈Ω

|u(x)| ≤ sup

x∈Γ

|u(x)| + c sup

x∈Ω

|∆u(x)|

for all u ∈ C

2

(Ω) ∩ C

0

(Ω).

Why the latter inequality implies the continuous dependence of the

solution on the right hand side f ?

(3)

For (P) with Neumann boundary conditions

n

u(x) = h(x) on Γ = ∂Ω with h ∈ C

0

(Γ) (N) one must require

Z

Γ

h(x)dS + Z

f(x)dx = 0

in order to ensure the existence of a solution.

The reason is the Gaussian

1

formula Z

∆u(x) dx = Z

Γ

n

u(x) dS.

If u is a solution, so is u + c (c ∈ R).

1

Carl Friedrich Gauß (1777–1855)

(4)

In applied analysis, there are many methods for solving the Poisson equation in special cases. We restrict ourselves to a few examples which are useful for tests.

Example 1. Let Ω be the open unit disc in R

2

. If the Dirichlet boundary condition is given in a form of a Fourier

2

series

g(cos(ϕ), sin(ϕ)) = α

0

+

X

j=1

j

cos(jϕ) + β

j

sin(jϕ)],

then the solution of ∆u = 0 in Ω can be expressed as g(r cos(ϕ), r sin(ϕ)) = α

0

+

X

j=1

r

j

j

cos(jϕ) + β

j

sin(jϕ)].

2

Jean Baptiste Joseph Fourier (1768–1813)

(5)

The solution of ∆u = 0 with Neumann boundary condition (N) has the same form as

h(cos(ϕ), sin(ϕ)) =

X

j=1

j

cos(jϕ) + β

j

sin(jϕ)]

(Note R

π

−π

h(ϕ)dϕ = 0).

The constant α

0

∈ R in the expression for g can be chosen arbitrarily.

(6)

−3 −2 −1 0 1 2 3

−8

−6

−4

−2 0 2 4 6 8

r=1 r=.75 r=.5 r=.25

−1

−0.5 0

0.5 1

−1

−0.5 0 0.5 1

−8

−6

−4

−2 0 2 4 6 8

(7)

Example 2. Let g(x) = P

j=1

α

j

sin(jπx) be the Fourier expansion of a function g ∈ C

0

[0, 1].

The Laplace equation in the unit square Ω = (0, 1)

2

with boundary values

u(x, 0) = u(0, y) = u(1, y) = 0 und u(x, 1) = g(x) has the solution

u(x, y) =

X

j=1

α

j

sinh(jπ) sin(jπx) sinh(jπy),

in Ω \ {(x, y) : y = 1} from C

.

Further examples with inhomogeneous Dirichlet boundary data also on

the other boundary segments can be constructed by superposition.

(8)

Example 3. We consider the Poisson equation

−∆u = f auf Ω = (−1, 1)

2

with the source term f (x, y) ≡ 1 and a homogeneous Dirichlet boundary condition applied at ∂Ω.

By separation of variables we construct the series solution u(x, y) = 1 − x

2

2 − 16 π

3

X

k∈N, kodd

sin(kπ(1 + x)/2) k

3

sinh(kπ)

·

sinh kπ(1 + y)

2 + sinh kπ(1 − y) 2

.

Perform the calculation via separation of variables for Example 2.

Transform Example 3 into a BVP for the Laplace equation with

inhomogeneous Dirichlet boundary conditions.

(9)

−1

−0.5 0

0.5 1

−1

−0.5 0 0.5 1

−0.05 0 0.05 0.1 0.15 0.2 0.25 0.3

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1

−1

−0.8

−0.6

−0.4

−0.2 0 0.2 0.4 0.6 0.8 1

Surface and contour plot of the solution from Example 3.

(10)

5.2 Laplace’s Equation on a Square 5.2.1 The Dirichlet Problem

We consider the following boundary value problem (BVP) for Laplace’s equation:

∆u = u

xx

+ u

yy

= 0 on Ω := (0, 1)

2

, (1a)

u = g along Γ := ∂Ω. (1b)

with a given boundary function g = g(x, y) defined on Γ.

Just as in our discretization of ordinary differential equations, we shall

apply finite difference methods to seek approximations to the solution

u = u(x, y) of (1) not at all points of Ω, but rather at a finite number

of grid points.

(11)

Consider each coordinate separately: introducing the partitions 0 = x

0

< x

1

< x

2

< · · · < x

nx

< x

nx+1

= 1, 0 = y

0

< y

1

< y

2

< · · · < y

ny

< y

ny+1

= 1 of [0, 1], we define the grid (tensor product grid) or mesh

h

:=

(x

i

, y

j

) : 0 ≤ i ≤ n

x

+ 1, 0 ≤ j ≤ n

y

+ 1 consisting of (n

x

+ 2)(n

y

+ 2) points.

A grid which is equidistant (in both directions) is one in which the grid spacing in each direction is constant:

x

i

= i∆x, i = 0, 1, . . . , n

x

+ 1, ∆x = 1/(n

x

+ 1), y

j

= j∆y, j = 0, 1, . . . , n

y

+ 1, ∆y = 1/(n

y

+ 1).

For equal spacing in both directions (uniform grid) we set

h := ∆x = ∆y.

(12)

0 0.2 0.4 0.6 0.8 1 0

0.2 0.4 0.6 0.8 1

tensor product grid

0 0.2 0.4 0.6 0.8 1

0 0.2 0.4 0.6 0.8 1

equidistant grid

(13)

In the following we consider the uniform case ∆x = ∆y = h (uniform grid):

0 0.2 0.4 0.6 0.8 1

0 0.2 0.4 0.6 0.8 1

(14)

Notation:

u

i,j

:= u(x

i

, y

j

) function value of exact solution at point (x

i

, y

j

) U

i,j

≈ u

i,j

approximation of u(x

i

, y

j

).

Taylor-expansion at (x

i

, y

j

):

u

i+1,j

= u

i,j

+

hu

x

+ h

2

2 u

xx

+ h

3

6 u

xxx

+ h

4

24 u

xxxx

i,j

+ O(h

5

),

u

i−1,j

= u

i,j

+

−hu

x

+ h

2

2 u

xx

− h

3

6 u

xxx

+ h

4

24 u

xxxx

i,j

+ O(h

5

).

Summing yields (the terms with h

5

also cancel) u

i+1,j

+ u

i−1,j

= 2u

i,j

+

h

2

u

xx

+ h

4

12 u

xxxx

i,j

+ O(h

6

).

(15)

Analogously, in the y-direction, u

i,j+1

+ u

i,j−1

= 2u

i,j

+

h

2

u

yy

+ h

4

12 u

yyyy

i,j

+ O(h

6

)

and, summing all 4 expansions and dividing by h

2

,

ui+1,j+ui−1,j+ui,j+1+ui,j−1−4ui,j

h2

| {z }

=:(∆hu)i,j

=

∆u+h2

12(uxxxx+uyyyy)

i,j

+O(h4).

The difference formula ∆

h

is called the 5-point-stencil or 5-point discrete Laplacian.

Summary: In each grid point (x

i

, y

j

), ∆

h

approximates the Laplace operator with a local discretisation error of order O(h

2

) as h → 0, i.e.,

(∆

h

u)

i,j

= (∆u)

i.j

+ O(h

2

).

Note: This requires sufficient smoothness of the solution, in this case

u ∈ C

4

(Ω).

(16)

In analogy with the differential equation (1a) we now require that the approximate solutions U

i,j

satisfy the discrete Laplace equation

h

U

i,j

:= (∆

h

U )

i,j

= 0, 1 ≤ i ≤ n

x

, 1 ≤ j ≤ n

y

. (2a) (2a) represents n

x

n

y

equations in (n

x

+ 2)(n

y

+ 2) unknowns, since the 5-point stencil is not applicable in the boundary points.

But there, the boundary conditions supply the missing equations:

U

i,j

= g(x

i

, y

j

) if (x

i

, y

j

) ∈ ∂Ω. (2b) Written out in detail, (2b) reads

U

0,j

= g(0, y

j

), U

nx+1,j

= g(1, y

j

), 0 ≤ j ≤ n

y

+ 1,

U

i,0

= g(x

i

, 0), U

i,ny+1

= g(x

i

, 1), 0 ≤ i ≤ n

x

+ 1.

(17)

Determine the linear system for the numerical solutions U

i,j

of the elliptic BVP

−∆u(x, y) = 0,

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

2

, u(1, y) = y,

on a uniform grid with the following enumeration of the unknowns:

0 1

1 x

y

U1,1 U1,2 U1,3

U2,1 U2,2 U2,3

U3,1 U3,2 U3,3

(18)

As in our example, equations (2) together represent a linear system of equations

Au = b (3)

to determine the approximate values U

i,j

at the interior grid points.

The entries of the coefficient matrix A and the right hand side b depend on our enumeration of the unknowns. A common one is the lexicographic order:

u = [U

1,1

, U

2,1

, . . . , U

nx,1

, U

1,2

, . . . , U

nx,2

, . . . , U

1,ny

, . . . , U

nx,ny

]

>

or

u =

 u

1

u

2

.. . u

ny

, where u

j

=

 U

1,j

U

2,j

.. . U

nx,j

, j = 1, 2, . . . , n

y

.

(19)

The Matrix A possesses the block structure

A = 1 h

2

 T I

I T I

I . .. ...

. .. I

I T

∈ R

nxny×nxny

,

in which I denotes the n

x

× n

x

identity matrix and T is the tridiagonal matrix

T =

−4 1 1 −4 1

1 . .. ...

. .. 1

1 −4

∈ R

nx×nx

.

(20)

For unknowns U

i,j

near the boundary, i.e.,

i ∈ {1, n

x

} or j ∈ {1, n

y

},

the 5-point stencil (2a) contains neighboring approximation values already specified by the Dirichlet boundary condition (2b).

Moving these to the r.h.s. of each corresponding equation, we obtain for the (nonzero) entries of the vector b in (3) for the example shown

f

3,3

= − 1

h

2

g(x

3

, y

4

) + g(x

4

, y

3

)

or f

2,1

= − 1

h

2

g(x

2

, y

0

),

(21)

Representation of A via Kronecker products

Due to the

simple geometry of Ω,

the simple structure of the Laplacian and

the same type of boundary conditions on all boundaries,

the block tridiagonal matrix A possesses additional structure: it can be built up from discretization matrices arising in the simpler

one-dimensional BVP.

We therefore consider the discretization of the (ordinary) one-dimensional BVP

u

00

(x) = 0, u(0) = g

0

, u(1) = g

1

using central differences with uniform mesh width h = 1/(n + 1).

(22)

Its discrete approximation leads to the linear system of equations A

1

u = b

1

, A ∈ R

n×n

, b

1

∈ R

n

,

where

A

1

= 1

h

2

tridiag(1, −2, 1) := 1 h

2

−2 1 1 . .. ...

. .. 1

1 −2

 ,

b

1

= − 1

h

2

[g

0

, 0, . . . , 0, g

1

]

T

and vector of unknowns

u = [U

1

, U

2

, . . . , U

n

]

T

, U

i

≈ u(x

i

), i = 1, 2, . . . , n.

(23)

The discretization of the two-dimensional Laplace operator can now be expressed as

A = T

1

⊗ I + I ⊗ T

1

(4)

with T

1

=

h12

tridiag(−1, 2, −1) and the identity matrix I

n

∈ R n × n.

In equation (4), the Kronecker product (or tensor product) M ⊗ N of two matrices M ∈ R

p×q

and N ∈ R

r×s

is defined by

M ⊗ N =

m

1,1

N . . . m

1,q

N

.. . .. .

m

p,1

N . . . m

p,q

N

 ∈ R

pr×qs

(24)

5.2.2 The Neumann Problem

We now consider a BVP for the Laplace operator in which the Dirichlet BC are replaced by the Neumann BC

∂u

∂n = h(x), x ∈ Γ. (5)

Since in our model problem the four segments of the boundary Γ lie parallel to the coordinate axes, the discretization of (5) is easy.

In the boundary points (x

0

, y

j

), for example, one may use either U

0,j

− U

1,j

h = h(x

0

, y

j

), (backward difference), (6a) U

−1,j

− U

1,j

2h = h(x

0

, y

j

) (central difference) (6b)

with analogous formulas at the remaining boundaries.

(25)

Note:

The central difference formula (6b) introduced so-called ghost points U

−1,j

, which, strictly speaking, lie outside the domain Ω.

These can, however, immediately be eliminated from the equations by solving (6b) for U

−1,j

and inserting this expression into the 5-point stencil centered at (x

0

, y

j

).

In contrast to the discretized Dirichlet problem with the same mesh width h, for the Neumann problem the unknowns U

i,j

on the domain boundary Γ are not fixed by the boundary conditions alone.

They but must also be determined, along with the interior unknowns, by solving the coupled linear system of equations.

In this case the system has (n

x

+ 2) · (n

y

+ 2) unknowns.

(26)

The discretization matrix (same ordering) is now obtained as the Kronecker product

A = ˜ T

1

⊗ I + I ⊗ T ˜

1

with

T ˜

1

= 1 h

2

−1 1 1 −2 . ..

. ..

. .. −2 1 1 −1

 .

For illustration discretize the one-dimensional BVP

u

00

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

0

(1) = 1

with h =

13

once using backward differences and once using central

differences for the Neumann conditions.

(27)

5.2.3 Eigenvalues and Eigenvectors

One reason why (1) is often chosen as a model problem is that the spectral decomposition of the discretization matrix is available in closed form.

Beginning with the n × n matrix T

1

=

h12

tridiag(1, −2, 1), we have T

1

v

j

= λ

j

v

j

, j = 1, 2, . . . , n,

with eigenvalues λ

j

= 2

h

2

[cos(jπh) − 1] = − 4

h

2

sin

2

jπh

2 , j = 1, 2, . . . , n, (7) and (orthonormal) eigenvectors

[v

j

]

k

= r 2

n + 1 sin(jkπh), k = 1, 2, . . . , n; j = 1, 2, . . . , n.

(28)

Using properties of the Kronecker product of matrices, the eigenvalues and eigenvectors of the 2D problem can also be inferred from those of the 1D problem.

More precisely: the eigenvalues λ

i,j

of A in (4) are given by

λ

i,j

= λ

i

+ λ

j

, 1 ≤ i, j ≤ n, (8) with associated eigenvectors

v

i,j

= v

i

⊗ v

j

, 1 ≤ i, j ≤ n.

Determine the smallest and the largest eigenvalue of the discretization

matrix A for the 2D Dirichlet case and discuss the conditioning of A in

dependence on the mesh width h.

(29)

5.2.4 Stability and Convergence

As we have already shown in the derivation of the 5-point approximation

h

of the Laplace operator, there holds

h

u

i,j

= ∆u

i,j

+ h

2

12 (u

xxxx

+ u

yyyy

)

i,j

+ O(h

4

).

Setting

[d

h

]

i,j

:= ∆

h

u

i,j

− ∆u

i,j

(local discretization error) [e

h

]

i,j

:= u

i,j

− U

i,j

(global discretization error) we conclude that, due to ∆u = 0 for the exact solution u of the BVP, e

h

solves the linear system of equations

A

h

e

h

= d

h

= O(h

2

)

with A

h

= A the matrix in (4).

(30)

We therefore have e

h

= A

−1h

d

h

and, because of ke

h

k = kA

−1h

d

h

k ≤ kA

−1h

kkd

h

k

the O(h

2

) behavior as h → 0 is transferred from the local to the global discretization error if kA

−1h

k remains uniformly bounded for all

sufficiently small values of h > 0.

Fixing the norm to be the Euclidean norm k · k = k · k

2

, we have kA

−1h

k = 1

min

(A

h

)| .

The uniform boundedness property can now be inferred from (7) and (8), since

min

(A

h

)| = 4

h

2

· 2 sin

2

πh

2 = 2π

2

+ O(h

2

), (h → 0).

(31)

Summary

The (global) discretization error of the approximate solution of the model problem (1) obtained by finite difference approximation using central differences with uniform mesh size h satisfies

ke

h

k = O(h

2

) as h → 0,

assuming the solution u is four times continuously differentiable.

The uniform boundedness of kA

−1h

k as h → 0 is a stability property of the difference scheme.

Check the O(h

2

) behaviour of the local discretization error with

Matlab for the test problem on page 180 with g(x) = 2 sin(3πx).

(32)

5.3 The Poisson Equation

Replacing the Laplace equation (1a) in the BVP (1) by the inhomogeneous (Poisson) equation

∆u = f,

with a given function f = f (x, y) defined on Ω, applying the central finite difference discretization leads to a discrete problem in which (2a) is modified to

h

U

i,j

= f

i,j

, with f

i,j

= f (x

i

, y

j

) (1 ≤ i ≤ n

x

, 1 ≤ j ≤ n

y

).

For the Dirichlet problem, the right hand side f of the resulting linear

system of equations (3) consists of the sum of the Dirichlet boundary

values and the corresponding function values f

i,j

.

(33)

Excursus: The 9-Point Stencil

The formulas for difference schemes such as ∆

h

u can become cumbersome, particularly in 2 or more space dimensions.

Therefore, the following notation, in which the weights defining the scheme are given in a table corresponding to their spatial arrangement, is sometimes practical:

h

, 1 h

2

0 1 0

1 −4 1

0 1 0

 .

(34)

Using this notation, the approximation

(9)h

, 1 6h

2

1 4 1

4 −20 4

1 4 1

of the Laplace operator is known as the 9-point stencil.

Using the same analysis based on Taylor series expansion reveals that

(9)h

u = ∆u + h

2

12 (u

xxxx

+ 2u

xxyy

+ u

yyyy

) + O(h

4

).

As an approximation of ∆, the 9-point stencil ∆

(9)h

therefore has the

same order of consistency as the 5-pont stencil ∆

h

.

(35)

However, it can still be used to construct a higher order approximation as follows: The leading error term is observed to contain the biharmonic operator applied to u:

u

xxxx

+ 2u

xxyy

+ u

yyyy

= ∆(u

xx

+ u

yy

) = ∆(∆u) = ∆

2

u.

Since the exact solution u of the Poisson equation satisfies ∆u = f , we conclude that the local discretization error of the approximate equation

(9)h

U

i,j

= ˜ f

i,j

, 1 ≤ i ≤ n

x

, 1 ≤ j ≤ n

y

,

with the modified right-hand side

f ˜

i,j

:= f (x

i

, y

j

) + h

2

12 ∆f (x, y)

has order O(h

4

) as h → 0.

(36)

Example: We consider the Poisson equation ∆u = −1 on Ω = (−1, 1)

2

with homogeneous Dirichlet BCs (cf. pg. 181).

We discretize the problem using both ∆

h

and ∆

(9)h

and compare the absolute value of the error in the point (0, 0) for different values of the mesh size h.

n × n ∆

h

(9)h

7 × 7 3.6e − 03 1.8e − 05 15 × 15 9.0e − 04 1.1e − 06 31 × 31 2.3e − 04 7.0e − 08 63 × 63 5.7e − 05 4.3e − 09 127 × 127 1.4e − 05 2.7e − 10 255 × 255 3.5e − 06 1.7e − 11

511 × 511 8.9e − 07 1.4e − 12

10ï12100 101 102 103 10ï10

10ï8 10ï6 10ï4 10ï2

Number of grid points in each direction

Error in (0,0)

5ïpoint stencil 9ïpoint stencil

Note:

The last problem requires solving a linear system of dimension 261121 and

takes 5 s on a really old laptop.

(37)

Goals of Chapter 5

You should know how test examples for the Laplace and Poisson equation on simple domains can be constructed and be able to do this in some simple cases.

You should be able to discretize Dirichlet and Neumann BVPs for the Laplace and Poisson equation on simple domains.

You should be able to write Matlab programs for solving such problems.

You should know the 1D and 2D discretization matrices for the Laplacian with Dirichlet and Neumann BCs and their connection via Kronecker products.

You should know the order of convergence for the 5-point stencil.

Referenzen

ÄHNLICHE DOKUMENTE

Hint: This exercises should be done during the problem session on June, 13. Draw a picture of the exact and the numerical solutions. Play with the step size parameter h.. b)

(6) Terminology: the explicit Euler method for solving the heat equation is consistent of first order in time and of second order in space.... Besides the asymptotic statement (6)

(6) Terminology: the explicit Euler method for solving the heat equation is consistent of first order in time and of second order in space.. Parabolic Problems TU Bergakademie

For purposes of comparison notice, that the exact solution is given by u(x, y) = 400xy if the boundaries with zero boundary condition are placed along the

A new three point highly accurate nite dierence method for solving linear second order dierential equations is proposed.. The coecients of the scheme are constructed via

found by embedding the systems in a complex setting and applying a numerical homotopy continuation method to compute all of the complex solutions of the polynomial system.. There

Palagachev, Boundary value problem with an oblique derivative for uniformly elliptic operators with discontinuous coefficients, Forum Math.. Palagachev

Users of the PACE TR-48 Analog Computer will find the High Speed Repetitive Operation Group a· valuable aid in the solution of a variety of computing