5 Numerical Solution of Elliptic Boundary Value Problems
5.1 Some Theory and Examples The Poisson equation
− ∆u = f in Ω ⊆ R
nwith 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 Γ.
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
2are solutions of
−∆u = f with the boundary values g
1and 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 ?
For (P) with Neumann boundary conditions
∂
nu(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
1formula Z
Ω
∆u(x) dx = Z
Γ
∂
nu(x) dS.
If u is a solution, so is u + c (c ∈ R).
1
Carl Friedrich Gauß (1777–1855)
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
2series
g(cos(ϕ), sin(ϕ)) = α
0+
∞
X
j=1
[α
jcos(jϕ) + β
jsin(jϕ)],
then the solution of ∆u = 0 in Ω can be expressed as g(r cos(ϕ), r sin(ϕ)) = α
0+
∞
X
j=1
r
j[α
jcos(jϕ) + β
jsin(jϕ)].
2
Jean Baptiste Joseph Fourier (1768–1813)
The solution of ∆u = 0 with Neumann boundary condition (N) has the same form as
h(cos(ϕ), sin(ϕ)) =
∞
X
j=1
[α
jcos(jϕ) + β
jsin(jϕ)]
(Note R
π−π
h(ϕ)dϕ = 0).
The constant α
0∈ R in the expression for g can be chosen arbitrarily.
−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
Example 2. Let g(x) = P
∞j=1
α
jsin(jπx) be the Fourier expansion of a function g ∈ C
0[0, 1].
The Laplace equation in the unit square Ω = (0, 1)
2with 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
α
jsinh(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.
Example 3. We consider the Poisson equation
−∆u = f auf Ω = (−1, 1)
2with 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
22 − 16 π
3X
k∈N, kodd
sin(kπ(1 + x)/2) k
3sinh(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.
−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.
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.
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.
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
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
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,japproximation of u(x
i, y
j).
Taylor-expansion at (x
i, y
j):
u
i+1,j= u
i,j+
hu
x+ h
22 u
xx+ h
36 u
xxx+ h
424 u
xxxxi,j
+ O(h
5),
u
i−1,j= u
i,j+
−hu
x+ h
22 u
xx− h
36 u
xxx+ h
424 u
xxxxi,j
+ O(h
5).
Summing yields (the terms with h
5also cancel) u
i+1,j+ u
i−1,j= 2u
i,j+
h
2u
xx+ h
412 u
xxxxi,j
+ O(h
6).
Analogously, in the y-direction, u
i,j+1+ u
i,j−1= 2u
i,j+
h
2u
yy+ h
412 u
yyyyi,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 ∆
his called the 5-point-stencil or 5-point discrete Laplacian.
Summary: In each grid point (x
i, y
j), ∆
happroximates the Laplace operator with a local discretisation error of order O(h
2) as h → 0, i.e.,
(∆
hu)
i,j= (∆u)
i.j+ O(h
2).
Note: This requires sufficient smoothness of the solution, in this case
u ∈ C
4(Ω).
In analogy with the differential equation (1a) we now require that the approximate solutions U
i,jsatisfy the discrete Laplace equation
∆
hU
i,j:= (∆
hU )
i,j= 0, 1 ≤ i ≤ n
x, 1 ≤ j ≤ n
y. (2a) (2a) represents n
xn
yequations 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.
Determine the linear system for the numerical solutions U
i,jof 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
As in our example, equations (2) together represent a linear system of equations
Au = b (3)
to determine the approximate values U
i,jat 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
1u
2.. . u
ny
, where u
j=
U
1,jU
2,j.. . U
nx,j
, j = 1, 2, . . . , n
y.
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
xidentity matrix and T is the tridiagonal matrix
T =
−4 1 1 −4 1
1 . .. ...
. .. 1
1 −4
∈ R
nx×nx.
For unknowns U
i,jnear 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
2g(x
3, y
4) + g(x
4, y
3)
or f
2,1= − 1
h
2g(x
2, y
0),
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
1using central differences with uniform mesh width h = 1/(n + 1).
Its discrete approximation leads to the linear system of equations A
1u = b
1, A ∈ R
n×n, b
1∈ R
n,
where
A
1= 1
h
2tridiag(1, −2, 1) := 1 h
2
−2 1 1 . .. ...
. .. 1
1 −2
,
b
1= − 1
h
2[g
0, 0, . . . , 0, g
1]
Tand vector of unknowns
u = [U
1, U
2, . . . , U
n]
T, U
i≈ u(x
i), i = 1, 2, . . . , n.
The discretization of the two-dimensional Laplace operator can now be expressed as
A = T
1⊗ I + I ⊗ T
1(4)
with T
1=
h12tridiag(−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×qand N ∈ R
r×sis defined by
M ⊗ N =
m
1,1N . . . m
1,qN
.. . .. .
m
p,1N . . . m
p,qN
∈ R
pr×qs5.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,jh = h(x
0, y
j), (backward difference), (6a) U
−1,j− U
1,j2h = h(x
0, y
j) (central difference) (6b)
with analogous formulas at the remaining boundaries.
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,jand 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,jon 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.
The discretization matrix (same ordering) is now obtained as the Kronecker product
A = ˜ T
1⊗ I + I ⊗ T ˜
1with
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 =
13once using backward differences and once using central
differences for the Neumann conditions.
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=
h12tridiag(1, −2, 1), we have T
1v
j= λ
jv
j, j = 1, 2, . . . , n,
with eigenvalues λ
j= 2
h
2[cos(jπh) − 1] = − 4
h
2sin
2jπ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.
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,jof 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.
5.2.4 Stability and Convergence
As we have already shown in the derivation of the 5-point approximation
∆
hof the Laplace operator, there holds
∆
hu
i,j= ∆u
i,j+ h
212 (u
xxxx+ u
yyyy)
i,j+ O(h
4).
Setting
[d
h]
i,j:= ∆
hu
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
hsolves the linear system of equations
A
he
h= d
h= O(h
2)
with A
h= A the matrix in (4).
We therefore have e
h= A
−1hd
hand, because of ke
hk = kA
−1hd
hk ≤ kA
−1hkkd
hk
the O(h
2) behavior as h → 0 is transferred from the local to the global discretization error if kA
−1hk 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
−1hk = 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).
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
hk = O(h
2) as h → 0,
assuming the solution u is four times continuously differentiable.
The uniform boundedness of kA
−1hk 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).
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
∆
hU
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.
Excursus: The 9-Point Stencil
The formulas for difference schemes such as ∆
hu 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
.
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)hu = ∆u + h
212 (u
xxxx+ 2u
xxyy+ u
yyyy) + O(h
4).
As an approximation of ∆, the 9-point stencil ∆
(9)htherefore has the
same order of consistency as the 5-pont stencil ∆
h.
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) = ∆
2u.
Since the exact solution u of the Poisson equation satisfies ∆u = f , we conclude that the local discretization error of the approximate equation
∆
(9)hU
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
212 ∆f (x, y)
has order O(h
4) as h → 0.
Example: We consider the Poisson equation ∆u = −1 on Ω = (−1, 1)
2with homogeneous Dirichlet BCs (cf. pg. 181).
We discretize the problem using both ∆
hand ∆
(9)hand compare the absolute value of the error in the point (0, 0) for different values of the mesh size h.
n × n ∆
h∆
(9)h7 × 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ï1010ï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: