You are on page 1of 16

Poissons Equation in 2D

Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 1 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
1. Poissons Equation in 2D
We will now examine the general heat conduction equation,
T
t
= T +
q
c
.
in the 2-dimensional case, assuming a steady state problem(T
t
= 0).
We get Poissons equation:
u
xx
(x, y) u
yy
(x, y) = f(x, y), (x, y) = (0, 1) (0, 1),
where we used the unit square as computational domain.
Again, we will only deal with Dirichlet boundary conditions:
u(x, y) = g(x, y) for x
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 2 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
2. Analytic Solutions
We will concentrate on the homogenous equation,
u
xx
(x, y) u
yy
(x, y) = 0, (x, y) = (0, 1) (0, 1),
and consider the boundary conditions
u(0, y) = u(1, y) = 0 0 y 1,
u(x, 0) = 0 0 x 1,
u(x, 1) = g(x) 0 < x < 1.
2.1. Separation of Variables revisited
Similar to the 1D heat equation, we use the ansatz
u(x, y) = X(x)Y (y)
to get

X
xx
(x)
X(x)
=
Y
yy
(y)
Y (y)
Consequently, left hand side and right hand side have to be equal to
a constant .
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 3 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
2.2. Particular solutions
For the function X(x), we get the eigenvalue problem
X
xx
(x) = X(x), 0 < x < 1,
X(0) = X(1) = 0.
We already know that the eigenvalues are

k
= (k)
2
,
and the respective eigenfunctions are
X
k
(x) = sin(kx).
The function Y (0) has to satisfy similar equations,
(Y
k
)
yy
(y) = Y
k
(y), 0 < y < 1,
Y
k
(0) = 0,
however, note the absence of the minus sign!
Thus, Y
k
(y) is a linear combination of e

k
y
and e

k
y
.
With Y
k
(0) = 0, we get the solution
Y
k
(y) = sinh(ky),
which satises the boundary condition Y
k
(1) = sinh(k).
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 4 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
2.3. Fouriers method
We have therefore computed particular solutions
u
k
(x, y) = sin(kx) sinh(ky)
that solve the boundary value problems
u
xx
(x) u
yy
(y) = 0 0 < x, y < 1,
u(0, y) = u(1, y) = 0, 0 y 1
u(x, 0) = 0, 0 x 1
u(x, 1) = sinh(k), 0 < x < 1.
Thus, if we can represent the boundary function g(x) by
g(x) =

k=1
g
k
sin(kx),
then the function
u(x, y) =

k=1
c
k
sin(kx) sinh(ky), c
k
=
g
k
sinh(k)
solves the given boundary problem for
u(x, 1) = g(x), 0 < x < 1.
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 5 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
3. A Finite Difference Scheme
3.1. Discretization of the computational domain
We use a rectangular, equidistant grid of nn grid points with mesh
size h =
1
n
:

h
:= {(ih, jh): i, j = 1, . . . , n 1}
x
i,j
x
i1,j
x
i+1,j
x
i,j+1
x
i,j1
h
x
h
y
We have chosen h = h
x
= h
y
function u will be computed at grid points x
i,j
,
i.e. we have unknowns u
i,j
u(x
i,j
).
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 6 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
3.2. Discretization of the derivatives Difference Quotients
Replace derivatives by difference quotients:
rst derivatives: forward, backward, or central differences
u
x
(x
k
)
_

_
u(x
k+1
) u(x
k
)
h
x
u(x
k
) u(x
k1
)
h
x
u(x
k+1
) u(x
k1
)
2h
x
second derivatives: standard second-order discretization (3-
point-stencil)

2
u
x
2
(x
k
)
u(x
k+1
) 2u(x
k
) + u(x
k1
)
h
2
x
In stencil notation:
[0 1 1], [1 1 0], or [1 0 1] for the rst derivatives
[1 2 1] for the second derivatives
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 7 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
3.3. 2D stencils
Using standard second order discretization, we get
(u
xx
+ u
yy
)(x
i,j
)
u
i+1,j
2u
i,j
+ u
i1,j
h
2
+
u
i,j+1
2u
i,j
+ u
i,j1
h
2
Thus, discretization of the PDE
u
xx
(x, y) u
yy
(x, y) = f(x, y)
leads to the linear system of equations

1
h
2
(u
i+1,j
+ u
i,j+1
4u
i,j
+ u
i,j1
+ u
i1,j
) = f(x
i,j
)
for i, j = 1, . . . , n 1.
This is often represented using a 2D stencil:
_
_
1
1 4 1
1
_
_
4
1
1
1
1
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 8 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
4. A Linear System of Equations
4.1. Homogeneous Dirichlet boundary conditions
To account for homogeneous Dirichlet boundary conditions, we set
u
0,j
= u
n,j
= u
i,0
= u
i,n
= 0
for i, j = 0, . . . , n.
Altogether, we get the following linear system of equations:
u
0,j
= u
n,j
= u
i,0
= u
i,n
= 0 for i, j = 0, . . . , n

(u
i+1,j
+ u
i,j+1
4u
i,j
+ u
i,j1
+ u
i1,j
)
h
2
= f(x
i,j
) for i, j = 1, . . . , n 1
This system has
N = (n + 1) (n + 1) unknowns u
i,j
, (i, j = 0, . . . , n);
N = (n + 1) (n + 1) equations.
Question: Is there a unique solution?
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 9 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
4.2. LSE in matrix-vector notation
We can write the previous system of equation in matrix-vector nota-
tion,
A
h
u
h
= f
h
,
where
u
h
is the vector
u
h
:= (u
1,1
, . . . , u
1,n
, u
2,1
, . . . u
n2,n1
, u
n1,1
, . . . , u
n1,n1
)
T
,
f
h
, similar to u
h
, is the vector of the right hand sides f
i,j
=
f(x
i,j
);
A
h
is the following sparse matrix
1
h
2
_
_
_
_
_
_
_
_
_
_
_
_
_
4 1 1
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
.
.
.
.
.
.
.
.
.
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1 1 4
_
_
_
_
_
_
_
_
_
_
_
_
_
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 10 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
Block-Tridiagonal Matrix:
A
h
is more precisely described by the following block-tridiagonal ma-
trix:
A
h
=
1
h
2
_
_
_
_
_
_
_
_
B
h
I 0 0
I B
h
I
.
.
.
.
.
.
0
.
.
.
.
.
.
.
.
.
0
.
.
.
.
.
.
I B
h
I
0 0 I B
h
_
_
_
_
_
_
_
_
where B
h
and I are (n 1) (n 1) matrices.
While I is the unity matrix, B
h
is given by
B
h
=
_
_
_
_
_
_
_
_
4 1 0 0
1 4 1
.
.
.
.
.
.
0
.
.
.
.
.
.
.
.
.
0
.
.
.
.
.
.
1 4 1
0 0 1 4
_
_
_
_
_
_
_
_
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 11 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
4.3. Properties of the system matrix A
h
Resume:
A
h
is a sparse (n 1)
2
(n 1)
2
-matrix, and has a so-called
band structure;
A
h
is block-tridiagonal
all diagonal elements of A
h
are 4;
in each row, between 2 and 4 elements are non-zeroes (1),
depending on whether the respective unknown is close to the
boundary;
Conclusions:
A
h
is therefore diagonal dominant
As A
h
is diagonal dominant, it is also positive denite.
Thus, the system has a unique solution!
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 12 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
5. Direct Solution of the LSE
5.1. Gaussian elimination for band matrices
A
h
is a band-matrix (band-width is n 1)
Gaussian elimination on a LSE of N unknowns usually requires
O(N
3
) operations.
for band matrices this reduces to
O(N bandwidth
2
) operations.
Solving our LSE using Gaussian elimination therefore requires
O(N
2
) = O(n
4
) operations.
The numerical error of our method is only O(n
2
).
Thus, to reduce an error to half of its size, we have to
use twice as many unknowns;
wait four times as long!
Faster methods to solve the LSE are needed!
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 13 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
5.2. Faster methods
Direct methods:
use a clever numbering of the unknowns (not line by line but
divide and conquer)
nested dissection, O(n
3
)
use eigenvectors of the matrix, and Fast Sine Transform
Fast Poisson Solvers, O(n
2
log n)
Iterative methods:
solve system line by line, but do this again and again
Jacobi or Gauss-Seidel relaxation, O(n
4
)
clever weghting of corrections
SOR (successive over-relaxation), O(n
3
)
reformulate LSE as minimization problem
Krylow methods, Conjugate Gradients, O(n
3
)
use different mesh sizes and combine their solutions
Multigrid methods, O(n
2
)
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 14 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
6. Classication of PDE
Classication similar to ODE:
rst/second/. . . order according to order of derivatives
linear/non-linear
Example: General linear PDE of second order:
d

i=1
d

j=1
a
i,j
(x) u
x
i
,x
j
(x) +
d

i=1
a
i
(x) u
x
i
(x) + a(x) u(x) = f(x)
Some linear PDE of second order:
1D heat equation: x
1
=t, x
2
=x
2D Poisson equation: x
1
=x, x
2
=y
1D wave equation (u
tt
= u
xx
): x
1
=t, x
2
=x
etc.
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 15 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
6.1. Boundary Conditions
Among other things, elliptic, parabolic, and hyperbolic PDE differ in
the type of boundary or initial conditions they require.
Examples:
Laplace equation, Poisson equation (elliptic):
u
xx
u
yy
= f
boundary conditions
heat equation (parabolic):
u
t
= u
initial condition for t, boundary conditions for x
wave equation (hyperbolic):
u
tt
= u
initial conditions for u and u
t
Poissons Equation in 2D
Analytic Solutions
A Finite Difference. . .
A Linear System of . . .
Direct Solution of the LSE
Classication of PDE
Page 16 of 16
Introduction to Scientic Computing
Poissons Equation in 2D
Michael Bader
6.2. Elliptic, Parabolic, and Hyperbolic PDE
General linear PDE of second order:
d

i=1
d

j=1
a
i,j
(x) u
x
i
,x
j
(x) +
d

i=1
a
i
(x) u
x
i
(x) + a(x) u(x) = f(x)
Three types of PDE:
elliptic PDE:
the matrix A of the a
i,j
is positive or negative denite
parabolic PDE:
one eigenvalue of A is zero, the others have the same sign, and
the rank of A together with the vector of the a
i
is full (d)
hyperbolic PDE:
A has 1 pos. and d 1 neg. eigenvalues or vice versa.
If the a
i,j
are functions of x:
elliptic in x:
the matrix A of the a
i,j
(x) is positive or negative denite for a
certain x
elliptic:
the matrix A of the a
i,j
(x) is positive or negative denite for all x

You might also like