You are on page 1of 65

3-D ADI Poisson Solver

A Project Report
Submitted in partial fulfilment of the
requirements for the Degree of
Master of Technology
in
Computational Science
by
V.Karthik
Supercomputer Education and Research Center
Indian Institute of Science
BANGALORE 560 012
June 7, 2011
Acknowledgements
I would like to thank my advisor Dr.Atanu Mohanty for his valuable guidance and support
through out the project. I would like to mention that his passion for teaching, interest
towards students encourages us to perceive our studies and research with much more
interest.
I would like to thank all the people of SERC for providing this platform of study to
us.
I would like to thank my friends Govind, Sufal, Avinash Bhat, Mritunjay, Avinash
Dash for all the nice time we had together studying and having fun. Special thanks to
my friends Appala Naidu and Brahmanandam.
I would like to thank all my family members for being with me all the time and giving
continuous support and encouragment.
Finally, I would like to thank god for his blessings through out.
i
Abstract
Alternating Direction Implicit(ADI) method is a Finite Dierence Method(FDM) to solve
partial dierential equations. We employ ADI method to solve Poissons equation for
dirichlet boundary conditions.The discretised equation is modied near the boundaries to
incorporate arbitrary domain shapes. The ADI Poisson solver developed, works for both
two or three dimensions. ADI method performs much better than traditional iterative
methods because of usage of ecient tri-diagonal solvers
ii
Contents
Acknowledgements i
Abstract ii
1 Introduction 1
1.1 Poissons Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Applications of Poissons equation . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Properties of Poissons equation . . . . . . . . . . . . . . . . . . . . . . . 5
2 Analytical Solution to Poissons Equation 7
2.1 Solution strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Solution of Laplace equation on square domain: . . . . . . . . . . . . . . 10
2.2.1 Solution of Poisson equation on square domain: . . . . . . . . . . 13
2.2.2 Solution of Poisson equatin on square domain with given boundary
conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.3 Solution of Laplace equation on an annular ring: . . . . . . . . . . 15
2.2.4 Solution of Laplace equation on circular domain: . . . . . . . . . . 16
2.2.5 Solution of Poissons equation on circular domain: . . . . . . . . . 17
3 Solution of Poissons equation using Finite Dierence Methods 20
3.1 Finite Dierence Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2 Mesh/Grid Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Discretised Poissons equation . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4 Matrix Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5 Iterative Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.5.1 Jacobi Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5.2 Gauss-Siedel Method . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5.3 Successive-over Relaxation Method . . . . . . . . . . . . . . . . . 25
3.6 Convergence of Iterative Methods . . . . . . . . . . . . . . . . . . . . . . 25
4 Alternating Direction Implicit(ADI) Method 27
4.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3 Matrix Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
iii
CONTENTS iv
4.4 ADI Method Implementation . . . . . . . . . . . . . . . . . . . . . . . . 31
4.5 Solution of Laplace equation on Square domain . . . . . . . . . . . . . . 32
4.5.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.2 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.3 Error Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.4 Choice of relaxation parameter . . . . . . . . . . . . . . . . . . . 34
4.6 Solution of Poisson Equation on square domain . . . . . . . . . . . . . . 36
4.6.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.6.2 Governing Equation and Numerical Solution . . . . . . . . . . . . 36
4.6.3 Error Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5 ADI Method on various domains 39
5.1 ADI Solver Implementation Steps . . . . . . . . . . . . . . . . . . . . . . 39
5.2 FDM formula for irregular boundary . . . . . . . . . . . . . . . . . . . . 39
5.3 Solution of Laplace equation on a ring domain . . . . . . . . . . . . . . . 40
5.4 Solution of Poisson equation on a circular disk domain . . . . . . . . . . 42
5.5 Solution of Laplace equation on a hyperbola domain . . . . . . . . . . . . 43
6 ADI Method on 3-D Domains 48
6.1 3-D Poisson Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.2 3-D ADI method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.3 Solution of Laplace Equation on the Cube . . . . . . . . . . . . . . . . . 49
7 Conclusions and Future Work 56
7.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
References 57
List of Tables
4.1 Comparision of iterations taken by various iterative methods . . . . . . . 35
4.2 Cyclic ADI parameters performance comparision . . . . . . . . . . . . . . 36
v
List of Figures
2.1 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Solution of Laplace Equation on Square domain . . . . . . . . . . . . . . 12
2.4 Analytical Solution of Poisson Equation on Square domain . . . . . . . . 14
3.1 Domain Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1 Square Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2 Laplace equation Solution using ADI method on Square domain . . . . . 33
4.3 Error plot for ADI method in Square domain . . . . . . . . . . . . . . . . 33
4.4 Error plot for ADI Method in the interior of Square domain . . . . . . . 34
4.5 Poisson function for square plate . . . . . . . . . . . . . . . . . . . . . . 37
4.6 Numerical solution of Poisson equation on square domain . . . . . . . . . 37
4.7 Error plot for Poisson equation on square domain . . . . . . . . . . . . . 38
4.8 Error plot in the interior of the domain for Poisson equation on square
domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.1 A curved boundary with mesh . . . . . . . . . . . . . . . . . . . . . . . 40
5.2 Mesh point O with neighbours NEWS . . . . . . . . . . . . . . . . . . . 40
5.3 Ring Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.4 Laplace equation Solution using ADI method on ring domain . . . . . . . 42
5.5 Error plots for solution of Laplace equation on ring domain . . . . . . . . 43
5.6 Poisson equation Solution using ADI method on circular disk . . . . . . . 44
5.7 Error plots for solution of Poisson equation on circular disk . . . . . . . . 45
5.8 Hyperbola Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.9 Laplace equation Solution using ADI method on hyperbola domain . . . 46
5.10 Error plots for solution of Laplace equation on hyperbola domain . . . . 47
6.1 A point in 3D domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.2 Solution of Laplace Equation on Cube domain using ADI method . . . . 54
6.3 Error plot on Cube domain . . . . . . . . . . . . . . . . . . . . . . . . . 55
vi
Chapter 1
Introduction
1.1 Poissons Equation
Poissons Equation is an elliptic linear inhomogeneous partial dierential equation of the
second order. It is given by

2
u = f (1.1)
where
2
(also denoted with ) stands for the Laplacian operator, and f is called as
load/source function. The solution of the equation u, is the unknown scalar potential
function.
In Cartesian coordinate coordinate system, the Poisson equation is given by

2
u
x
2
+

2
u
y
2
+

2
u
z
2
= f(x, y, z) (1.2)
where x, y, z are the independent space dimensions.
When the Poisson equation is satised by a scalar potential in a given domain . We
can nd the scalar potential inside the domain by solving the Poisson equation with the
help of boundary conditions prescribed at the boundary .
1
Chapter 1. Introduction 2
1.2 Applications of Poissons equation
Poisson equation arises in a variety of branches mathematical and physical contexts rang-
ing through elasticity and solid mechanics, uid mechanics, electromagnetism, potential
theory, heat conduction, geometry, probability, number theory, and many more [4, 5].
Poisson equation is mainly used to describe the equilibrium physical phenomena under
the presence of source particles or load function. It is used to describe the steady state
conditions of a given system as it involves no time variable.
Electrostatics:
In electrostatics, it is often necessary to nd the electric eld (

E) for a given charge


distribution in a region[3].
Directly solving for

E requires solving two equations.


E = 0


E =

4
0
As

E is a vector, it involves solving for all the vector components which is cumber-
some. This process can be simplied with help of Poissons equation.
We can nd the electric potential in the region by solving Poissons equation.

2
V (x, y, z) =
1
4
0
(x, y, z)
where (x, y, z) is a charge distribution in the given volume. Then electric eld is given
simply by the gradient of the potential.
The advantages of second method is that it involves only scalars and requires to solve
only one partial dierential equation(Poissons equation) involving voltage instead of two
involving gradient and curl.
Chapter 1. Introduction 3
Derivation of Poissons equation in Electrostatics
In a given volume, Gausss law in dierential form states that the divergence of the
electric eld in a region is proportional to charge enclosed in the region.


E =
1
4
0
(1.3)
where stands for charge density. In the absence of changing magnetic eld

B, Faradays
law of induction gives


E =

B
t
= 0
Since curl of electric eld is zero, the electric eld can be given by the gradient of the
electric potential.

E =

V (1.4)
Combining the equations 1.2 and 1.2, we get the Poisson equation for electric potential

2
V =
1
4
0
(1.5)
Stationary Heat Equation
Poissons equation also governs heat ow problems that are steady, that is, time inde-
pendent. The thermal equilibrium of bodies(eg. at plates) can be described by the
Poissons equation in the presence of heat sources:

2
T(x, y) = h(x, y)
where T(x,y) represents the temperature, h(x,y) represents the external heat source and
stands for the thermal conductivity.
Chapter 1. Introduction 4
Steady state Wave equation
The steady state displacement of a membrane(like drum skin) follows Poissons equa-
tion. The inhomogenuous term represents an external forcing over the surface of the
membrane. The governing equation is given by

2
u(x, y) =
P(x, y)
T
P(x, y) represents pressure, T represent Tension and u(x, y) represents the displacement
of the membrane.
Fluid Dynamics
The velocity potential of a steady incompressible, irrotational planar ow of uid follows
Laplace equation. The gradient of the velocity potential gives the velocity.
Elasticity
Poissons equation arises in the study of torsion of prismatic bars. The stress distribution
over a non-circular cross-section of a twisted bar can be determined by nding the stress
function (x, y) which satises the two-dimensional Poisson equation.

2
= 2G
G is shear modulus. is the angle of twist per unit length
Gravitational Potential
To study the forces acting in a gravitational eld lled with masses, Poisson equation is
also useful.The gravitational potential is given by the equation

2
= 4G
Chapter 1. Introduction 5
stands for Gravitational potential, G stands for universal gravitational constant and
stands for mass density. Besides above,Poissons equation has applications in image
processing, number theory etc.
1.3 Properties of Poissons equation
Poissons equation and its homogeneous counter-part Laplace equation has several in-
teresting properties which help in nding their solutions or make their study interesting
and useful in many areas which are worth mentioning here.
1. Harmonic functions: The Solutions of Laplace equations are called as harmonic
functions. They have continuous second-order partial-derivaties.
2. Mean value property: The value of the harmonic function at any interior point is
equal to the mean value of the function on any circle in the domain with its center
at that point.
3. Maximum modulus property: Solution of Laplace equation cannot have maximum
or minimum in the interior of the domain. Consequently, the maximum and the
minimum are taken on the boundary of the domain
4. Analytic functions: The real and imaginery part of analytic functions are harmonic.
They remain harmonic under conformal mapping so that conformal mapping be-
comes a powerful tool in solving boundary value problems for Laplace equation by
mapping complex domains on to simpler domains like circle.
The complex representation of potential has several interpretations. For example,
in electrostatics, the equal real parts correspond to equi-potential lines and the
equal imaginery parts correspond to lines of electric force.In heat problems, they
are isotherms and lines of heat ow.
5. Linearity : Laplace equation is second order linear PDE. So the principle of super-
position hold good. So new solutions can be obtained by the summation of two
Chapter 1. Introduction 6
existing solutions. This is very useful in obtaining solution of Laplace equation like
complex problems can be constructed by summing simple solutions.
6. Uniqueness: We can derive from above properties that Laplace equation and Pois-
sons equation has unique stable solution for Dirichlet or Neumann boundary con-
ditions for closed surfaces. So that if a solution is found to Laplace equation by any
method then any other solution is just dierent represention of the same solution.
Chapter 2
Analytical Solution to Poissons
Equation
In this chapter we introduce various traditional analytical methods used to solve partial
dierential equations. Finding analytical solutions helps in verifying the correctness of
solution obtained from the numerical method.
2.1 Solution strategies
Some general techniques used to solve Partial Dierential Equations analytically are as
follows
1. Separation of variables: This is the most common method used to solve partial
dierential equations on simple domains. The idea is to express the solution as the
product of the functions of the variables involved. For example, in two variables,
Solution u(x,y) can be written as
u(x, y) = F(x)G(y)
This separates out the partial dierential equation in to two or three ordinary dif-
ferential equations which are related by a common constant(usually eigen values).
7
Chapter 2. Analytical Solution to Poissons Equation 8
These ordinary dierential equations are solved using the boundary conditions that
are already transformed in to simpler conditions involving only one of the variable.
Thus separation of variables is a very useful technique when domain boundary
is symmetric to the variables involved and boundary conditions specied involve
those variables only.
2. Conformal mapping: These are useful to reduce a complicated domain in to a sim-
pler domain like disk. Complex analysis is useful in this method. Components
of analytic functions satisfy laplace equation and they remain analytic in confor-
mal maps. So that Laplace equation is solved on the simpler domain and inverse
mapped to get the solution on the complicated domain.
3. Greens function : Greens function characterise the response of the system for a
unit impulse. In simpler terms, it gives the solution of the system for a unit load
at a particular point which when integrated over the domain with required scaling
gives the solution for the given load. Solution of Laplace equation on circular disk
can be derived in this method with the help of Poissons Integral formula and also
inhomogeneous equation like Poisson equation can be solved using this method.
But this method involves integrals which may be tough to evaluate.
4. Integral transforms Integral transforms like Fourier transforms are useful when the
domain considered is innite domain.
5. Superposition principle Laplace equation is linear so that combination of solutions
is also a solution. We can nd solution for complicated boundary condition by
splitting it in to smaller problems.
Solution of Laplace equation
2
U = 0 on square domain of length L with two
boundaries x = 0 , y = L having potential one can be found by U = U
1
+U
2
where

2
U
1
= 0 with U
1
(x, L) = 0 and
2
U
2
= 0 with U
2
(0, y) = 1. This is described in
gure (2.1).
Solution of Poisson equation for given boundary conditions can be found by adding
Chapter 2. Analytical Solution to Poissons Equation 9
Figure 2.1: Superposition principle
solution of poisson equation for homogeneous zero boundary condition and partic-
ular solution of laplace equation for given boundary conditions.This is described
in gure(2.2)
Figure 2.2: Superposition principle
Mathematically solution of
2
U = f(x, y) for U = g(x, y) on boundary is
given by U = U
1
+U
2
where
2
U
1
= f(x, y) for U
1
(x, y) = 0 on boundary and

2
U
2
= 0 with U
2
(x, y) = g(x, y) on .
Chapter 2. Analytical Solution to Poissons Equation 10
6. Eigen function expansions: Solution of inhomogenuous dierential equations like
Poissons equation can be found by expressing the source/load function as an ex-
pansion of eigen functions of the linear operator and nding the coecients/eigen
values. Fourier series is used in rectangular domain and Fourier-Bessel series is
used in circular domains.
2.2 Solution of Laplace equation on square domain:
Problem Statement
To solve Laplace equation
u
xx
+ u
yy
= 0 (2.1)
in the interior of a square domain of length L with the Dirichlet boundary conditions.
u(0, y) = 0 for 0 < y L (2.2)
u(L, y) = 0 for 0 < y L (2.3)
u(x, 0) = 0 for 0 x L (2.4)
u(x, L) = V for 0 < x < L (2.5)
i.e. three sides are kept at zero boundary conditions and another side(y = L) is main-
tained at a constant potential V.
Separation of Variables
By the method of separation of variables, we split the partial dierential equation (2.1)
in to two ordinary dierential equations and solve for the potential u in the interior of
the domain. The rst step is to assume the solution as the product of functions which
depend on only one variable i.e.
u(x, y) = F(x) G(y) (2.6)
Chapter 2. Analytical Solution to Poissons Equation 11
Substituting in equation (2.1) we get,
G(y)F

(x) + F(x)G

(y) = 0
Dividing by U(x, y) we get,
F

(x)
F(x)
+
G

(y)
G(y)
= 0
We write the above equation as
F

(x)
F(x)
=
G

(y)
G(y)
=
2
Since the LHS in the above equation involes only x variable and RHS is only a function
of y variable, we conclude that this can happen only if
2
is constant.
This forms the two ordinary dierential equations
F

(x) +
2
F(x) = 0 (2.7)
G

(y)
2
G(y) = 0 (2.8)
The solution of (2.7) is given by
F(x) = Asin(x) + Bcos(x) (2.9)
Applying boundary conditions (2.2), we get B=0 in the above equation.
Applying the boundary condition (2.3), we get =
n
L
where n = 1, 2 . . .
The solution of (2.8) is given by
F(x) = Ce
y
+ De
y
= C
1
sinh(y) + D
1
cosh(y)
Chapter 2. Analytical Solution to Poissons Equation 12
Using boundary condition (2.4), we get D
1
= 0 in the above equation. Now using
equation (2.6), the solution of Laplace equation can be given as follows:
u(x, y) =

n=1
c
n
sinh
_
ny
L
_
sin
_
nx
L
_
(2.10)
Fourier Series
In order to determine the solution completely, we need to determine the coecients c
n
.
It can be determined by the fourth boundary condition given.Assume on y = L, the
potential is f(x). We can observe that equation (2.10) is in the form of fourier sine series.
Then the coecient c
n
is given by
c
n
=
2
Lsinh(n)
_
L
0
f(x)sin
_
nx
L
_
dx (2.11)
For the given problem f(x) = V which gives the solution,
u(x, y) =

n=1 ,n:odd
4 V
n sinh(n)
sinh
_
ny
L
_
sin
_
nx
L
_
(2.12)
0
0.5
1
0
0.5
1
0
0.5
1
x
y
u
(
x
,
y
)
Figure 2.3: Solution of Laplace Equation on Square domain.
Boundary Conditions: u(x,y) = 0 on three sides and u(x,1) = 1
No. of terms in fourier series used = 200
Chapter 2. Analytical Solution to Poissons Equation 13
2.2.1 Solution of Poisson equation on square domain:
Problem Statement
To solve Poisson equation
u
xx
+ u
yy
=
1
4
0
(x, y) (2.13)
in a square domain of length L with homogeneous zero boundary conditions and constant
charge density
0
in the interior of the domain. i.e.
(x, y) =
0
for 0 < x < L, 0 < y < L (2.14)
Eigenfunctions
The solution to the Poissons equation
2
u = q(x, y) for homogeneous dirichlet bound-
ary conditions can be given in terms of eigenfunctions of the Laplacian operator: sin
_
nx
L
_
sin
_
my
L
_
i.e. Let the solution vector u be:
u =

m,n=1
K
m,n
sin
_
nx
L
_
sin
_
my
L
_
Then,

2
u = u
xx
+ u
yy
=
(m
2
+ n
2
)
2
L
2
K
m,n
sin
_
nx
L
_
sin
_
my
L
_
=
(m
2
+ n
2
)
2
L
2
u
So in order to nd the solution of Poisson equation, we express charge density in
terms of eigen functions sin
_
nx
L
_
sin
_
my
L
_
with the help of two dimensional Fourier
sine series
(x, y) =

m,n=1
Q
n,m
sin
_
nx
L
_
sin
_
my
L
_
(2.15)
Chapter 2. Analytical Solution to Poissons Equation 14
where Q
n,m
is given by the fourier series coecient:
Q
n,m
=
4
L
2
_
L
0
_
L
0
q(x, y) sin
_
nx
L
_
sin
_
my
L
_
dxdy (2.16)
Then the solution to Poissons equation is given by,
u(x, y) =

m,n=1
Q
n,m
L
2
(m
2
+ n
2
)
2
sin
_
nx
L
_
sin
_
my
L
_
(2.17)
For the given problem, fourier series coecients of unit charge density is given by,
Q
n,m
=
4
L
2
_
L
0
_
L
0

0
4
0
sin
_
nx
L
_
sin
_
my
L
_
dxdy
=
16
nm
2

0
4
0
n, m: odd otherwise zero
Thus from the equation (2.17), the solution for the given problem is
u(x, y) =

m,n=1, odd

0
4
0
16L
2
mn(m
2
+ n
2
)
4
sin
_
nx
L
_
sin
_
my
L
_
(2.18)
0
2
4
6
0
2
4
6
0
0.5
1
1.5
2
x 10
10
x
y
V
o
l
t
a
g
e
Figure 2.4: Analytical Solution of Poisson Equation on Square domain
with zero boundary value and f(x,y) = 9e9.
No. of terms in fourier series used = 100
Chapter 2. Analytical Solution to Poissons Equation 15
2.2.2 Solution of Poisson equatin on square domain with given
boundary conditions
2.2.3 Solution of Laplace equation on an annular ring:
To solve Laplace equation

2
u = 0
on a ring domain with inner radius R
1
and outer radius R
2
with boundary conditions.
f(r, ) =
_

_
1 r = R
1
0 r = R
2
(2.19)
We express Laplace equation in polar coordinates so that boundary becomes symmetric
to the variables involved. Laplace equation in polar coordinates is given by:
1
r

r
_
r
_

r
u
__
+
1
r
2

2
u = 0
General solution
Using separation of variables in polar coordinates, let us say,
u(r, ) = R(r) ()
gives us two ordinary dierential equations,
r
2
R

+ rR R = 0 (2.20)

+ = 0 (2.21)
Solution of equation(2.21) is given in terms of trigonmetric functions because it needs
to be periodic ( + 2) = (). Equation (2.20) is in the form of second order Euler
ordinary dierential equation. The solutions can be given in terms of eigen functions as
follows:
Chapter 2. Analytical Solution to Poissons Equation 16
n = 0, () = 1, R(r) = 1 and R(r) = ln r
n > 0, () = sin(n), cos(n) R(r) = r
n
and R(r) = r
n
Thus general solution of Laplace Equation on ring is:
u(r, ) = a
0
+

n
a
n
r
n
cos(n) +

n
a
n
r
n
cos(n)
+ b
0
lnr +

n
b
n
r
n
sin(n) +

n
b
n
r
n
sin(n) (2.22)
Since the given boundary conditions does not depend on the parameter we can say
solution is in the form
u(r, ) = c
1
+ c
2
ln r
Solving with the boundary conditions (2.19), we get
u(r, ) =
ln R
2
ln r
ln R
2
ln R
1
(2.23)
2.2.4 Solution of Laplace equation on circular domain:
Problem Statement
To solve Laplace equation

2
u
r
2
+
1
r
u
r
+
1
r
2

2
u

2
= 0 (2.24)
on a circular domain of radius R with boundary conditions u(R, ) = f(). For a circular
disk, the terms containing ln r , r
n
in equation (2.22) have singularities as r 0 so
that solution on disk is given by,
u(r, ) = a
0
+

n=1
(a
n
r
n
cos n + b
n
r
n
sin n) (2.25)
The coecients can be determined by using the boundary conditions and nding fourier
coecients.
Solution on circular disk can also be given in terms of Greens function which is given
Chapter 2. Analytical Solution to Poissons Equation 17
by Poissons kernel, P(x, s). The inuence due to a small element s on the boundary at
a point x in the interior of the boundary is given by
P(x, s) =
R
2
x
2
x s
2
where the denominator measures squared distance from x to s and numerator roughly
measures distance from x to boundary. In polar coordinates, s can be given by single
angular coordinate [, ) If x has coordinates (x, y), then
P(x, s) =
R
2
(x
2
+ y
2
)
(x Rcos())
2
+ (y Rsin())
2
Converting to polar coordinates x is represented by (r, ) and dividing by R
2
we get,
P(x, s) =
1
_
r
R
_
2
1 2
_
r
R
_
cos( ) +
_
r
R
_
2
So the solution on circular disk is given by Poissons Integral formula:
u(r, ) =
1
2
_

f()
1
_
r
R
_
2
1 2
_
r
R
_
cos( ) +
_
r
R
_
2
d (2.26)
The solution can be viewed as a sort of convolution of boundary function with Poissons
kernel in circular domain.
2.2.5 Solution of Poissons equation on circular domain:
Problem Statement
To solve Poisson equation
2
u = q(r, ) i.e.

2
u
r
2
+
1
r
u
r
+
1
r
2

2
u

2
= q(r, ) (2.27)
Chapter 2. Analytical Solution to Poissons Equation 18
on a circular domain of radius R with homogeneous zero boundary conditions and unit
source function inside the domain i.e. q(r, ) = 1 for r < R
Bessel Equation derivation
Let f(r, ) be an eigen function of the Laplacian operator then the eigen vector equation
is given by
f =
2
f (2.28)
for some eigen value
2
.
Applying separation of variables, f(r) = R(r)() in the polar coordinates form we get,
R

(r)() +
1
r
R

(r)() +
1
r
2
R(r)

() =
2
R(r)()
Dividing by R(r)()
R

(r)
R(r)
+
R

(r)
rR(r)
+

()
r
2
()
=
2
Multiplying with r
2
and rearranging the terms we get,
r
2
R

(r)
R(r)
+ r
R

(r)
R(r)
+
2
r
2
=

()
()
To satisfy the periodic boundary condtions on , both LHS and RHS should be equal to
a negative constant, so that equations become,

() m
2
() = 0 (2.29)
r
2
R

(r) + rR

(r) + (
2
r
2
m
2
)R(r) = 0 (2.30)
Equation (2.30) is known as Bessels equation. The solution of (2.30) is given in terms
of Bessels function of rst kind J
n
(r) and Bessel functions of second kind Y
n
(r) . The
solution of (2.29) is given by cos(n) and sin(n).
Y
n
(x) is unbounded at the centre, so that Y
n
(x) is not a solution for the circular
disk. In order to satisfy homogeneous zero boundary conditions we need J
n
(R) = 0. So
Chapter 2. Analytical Solution to Poissons Equation 19
we consider a sequence of roots of Bessel function = k
nm
which are irrational. Then
solution to (2.28) is given by Fourier-Bessel expansion
f(r, ) =

n=0

m=1
A
nm
J
n
_
k
nm
r
R
_
cos(n) +

n=1

m=1
B
nm
J
n
_
k
nm
r
R
_
sin(n)
where A
nm
and B
nm
are real-valued coecients.
To nd the solution of Poissons equation given in equation (2.27), we nd Fourier-
Bessel expansion of q(r, ).
q(r, ) =

n=0

m=1
A
nm
J
n
_
k
nm
r
R
_
cos(n) +

n=1

m=1
B
nm
J
n
_
k
nm
r
R
_
sin(n)
The coecients are given by the formula
A
nm
=
2
R
2
J
2
n+1
(k
nm
)
_

_
R
0
q(r, )J
n
_
k
nm
r
R
_
cos(n) r dr d
B
nm
=
2
R
2
J
2
n+1
(k
nm
)
_

_
R
0
q(r, )J
n
_
k
nm
r
R
_
sin(n) r dr d
Then the solution of Poissons equation is given by,
u(r, ) =

n=0

m=1
R
2
A
nm
k
2
nm
J
n
_
k
nm
r
R
_
cos(n)

n=1

m=1
R
2
B
nm
k
2
nm
J
n
_
k
nm
r
R
_
sin(n)
(2.31)
Consider a unit radius circular disk with uniform charge density then its Fourier-Bessel
expansion in terms of J
0
(
kmr
R
)is given by
q(r, ) = 1 =

n=0
2
k
0m
J
1
(k
0m
)
J
0
_
k
0m
r
R
_
Then the solution of Poissons equation is given by
u(r, ) =

n=0
2R
2
k
3
0m
J
1
(k
0m
)
J
0
_
k
0m
r
R
_
(2.32)
where radius R = 1
Chapter 3
Solution of Poissons equation using
Finite Dierence Methods
It is not always possible to solve dierential equation analytically. For example, it
is not possible to get analytical solution to Poissons Equation for L-shaped domain.
Even when analytical solutions exist it may be tough to calculate i.e. it may involve
evaluating complicated integrals. In such situations, numerical methods are employed to
get approximate solutions to some desired level of accuracy.
Various numerical methods exist for solving dierential equations like nite element
methods, nite dierence methods, boundary element method etc. Here we employ nite
dierence methods to solve Poisson equation.
3.1 Finite Dierence Methods
The Finite Dierence Methods(FDM) involve approximating the equation involving
derivates with dierence equation. For example,
df
dx
is taken as
f(x + h) f(x)
h
20
Chapter 3. Solution of Poissons equation using Finite Dierence Methods21
3.2 Mesh/Grid Generation
To apply the dierence equation we rst divide the solution region of potential function
u(x, y) in to rectangles or meshes. For a 2D mesh, consider the distance between two
adjacent mesh points as x = h
x
, y = h
y
. Then coordinates of any point P with index
(i, j) on 2D mesh is given by
x = i h
x
y = j h
y
where h
x
=
xmax xmin
no of divisions + 1
h
y
=
ymax ymin
no of divisions + 1
.
Here xmax, xmin, ymax, ymin stand for boundary extremes.
Figure 3.1: Domain Grid
3.3 Discretised Poissons equation
Now the discretised Poissons equation at point P(x,y) for the potential u(x,y) is given
by centralised dierence formula is given by,
u
i+1,j
2u
i,j
+ u
i1,j
h
2
x
+
u
i,j+1
2u
i,j
+ u
i,j1
h
2
y
= f(x, y) (3.1)
Chapter 3. Solution of Poissons equation using Finite Dierence Methods22
where u
i,j
= u(x
i
, y
j
) and f(x, y) is the load function. With the above dierence formula,
the accuracy of the calculated solution depends on the number of divisions of the mesh
and the error is O(h
2
).
3.4 Matrix Formulation
A system of equations are obtained when the dierence formula is applied at each in-
terior mesh point. For 1 i, j no of divisions we get N
2
number of equations,(N =
no of divisions). These equations can be put in matrix form as follows:
AU = B,
Vector of unknowns : U = [u
11
, u
21
, ..., u
N1
, u
12
, ...u
N2
, ..., u
NN
]
T
,
Right hand side vector : B = h
2
[f
11
, ..., f
N1
, ..., f
1N
, ..., f
NN
]
T
Chapter 3. Solution of Poissons equation using Finite Dierence Methods23
The N
2
N
2
matrix A is given by
A =
_

_
4 1 1
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
.
.
.
1 4 1
1 4 1
.
.
.
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
.
.
.
1 1 4
.
.
.
.
.
.
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
1 4 1
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
1 1 4
_

_
(3.2)
The solution of Poissons equation can thus be found by solving above equations.
3.5 Iterative Methods
To solve the above system of equations usual elimination methods cannot be applied.
Especially when the number of divisions become more, the amount of storage required
to store intermediate matrices produced during the computation by elimination methods
become very large.
Iterative methods are employed to solve system of equations. This is because they
take advantage of the sparsity structure of the A matrix. They require storage of just
the same as A matrix (5N
2
in our problem) and can be terminated when we get the
Chapter 3. Solution of Poissons equation using Finite Dierence Methods24
solution with sucient amount of accuracy.
In an iterative method, we begin with an initial vector X
(0)
, and generate a sequence
of vectors
X
(0)
X
(1)
X
(2)

which converge towards the desired solution X. Each iteration requires very less amount
of work comparable to that of multiplication of A with a vector which is very less when
matrix A is sparse. So we can carry out a large number of iterations.
3.5.1 Jacobi Method
This is the simplest of the iterative methods. A system of n equations where i
th
equation(1 i n) is given by
n

j=1
a
ij
x
j
= b
i
can be solved by transforming each equation in to a suitable format. The i
th
equation
is rewritten as
x
i
=
b
i

j=1j=n
a
ij
x
j
a
ii
(3.3)
Jacobi method involves nding next iteration vector X
(I+1)
from current vector X
(I)
by substituting x
(I+1)
in LHS and x
(I)
in RHS of equation 3.3. So each iteration of the
Jacobi method is given by n explicit steps. The i
th
step involves calculating x
(I)
i
using
the formula:
x
(I+1)
i
=
b
i

j=1 j=n
a
ij
x
(I)
j
a
ii
(3.4)
Chapter 3. Solution of Poissons equation using Finite Dierence Methods25
3.5.2 Gauss-Siedel Method
Gauss Siedel Method uses new values as soon as they are computed. It involves using
(i-1) new values of X in RHS in the calculation of x
i
.
x
(I+1)
i
=
b
i

i1

j=1
a
ij
x
(I+1)
j

n

j=i+1
a
ij
x
(I)
j
a
ii
(3.5)
3.5.3 Successive-over Relaxation Method
In this method, in order to improve convergence, we extrapolate the solution vector
obtained from Gauss-Siedel method. Extrapolation is done in form of weighted average
of the previous iteration solution and new solution from Gauss-Siedel method with the
help of relaxation parameter .
x
(I+1)
j
= (1 )x
(I)
j
+ x (3.6)
where x is obtained using gauss-siedel method as in 3.5.2.
3.6 Convergence of Iterative Methods
In order to study the convergence of iterative methods, iterative method can be formu-
lated in terms of matrix notation. For each iterative method, we have a new matrix M
which expresses iteration step for solution of matrix equation AX = B as
MX
(I+1)
= (M A)X
(I)
+ B
X
(I+1)
= (I M
1
A)X
(I)
+ B
Chapter 3. Solution of Poissons equation using Finite Dierence Methods26
The convergence of iterative method depends on the spectral radius () of the (IM
1
A)
matrix.
For an iterative method to converge, the spectral radius () should be less than
one.
The smaller the spectral radius, faster the convergence of iterative method is.
Given below are the results from [8],
For consistently ordered matrices, Spectral radius of Jacobi method (J) and
Gauss-Siedel method (H) are related by
(H) = (J)
2
For SOR method, the optimal parameter
b
is given by ,

b
=
2
1 +
_
1 (J)
2
(H(
b
) =
_
_
(J)
1 +
_
1 (J)
2
_
_
2
Therefore Gauss-Siedel method converges twice as fast as Jacobi method and SOR
method converges N times as fast as Jacobi method.
ADI method, an iterative method to solve Poisson equation is introduced in next
chapter and is shown to be superior than above classical iterative methods.
Chapter 4
Alternating Direction Implicit(ADI)
Method
Alternating Direction Implicit(ADI) method is an iterative method to solve system of
equations arising from the nite dierence discretizations of parabolic and elliptic partial
dierential equations. It was rst introduced in mid-1950s by Peaceman and Rachford.
4.1 Motivation
When dealing with multi-dimensional domains, inversion of coecient matrix A (3.2)
requires lot of eort. But if we do it in steps by solving for each dimension once we get
a tridiagonal system to solve which can be carried out in O(n) time. So, as the iteration
steps varies in direction every time, the name is given as alternation direction method.
Also since the system of equations needs to solved implicitly, this is an implicit method.
4.2 Procedure
The idea of the ADI method is to execute each iteration in two or three steps( equal to
the number of dimensions). The nite dierence formula (6.2) is written in such a way
that derivates involving one spatial direction are in left hand side of the equation and
27
Chapter 4. Alternating Direction Implicit(ADI) Method 28
remaining terms are carried to the right hand side.
u
i+1,j
2u
i,j
+ u
i1,j
h
2
x
= f(x, y)
u
i,j1
2u
i,j
+ u
i,j+1
h
2
y
(4.1)
u
i,j1
2u
i,j
+ u
i,j+1
h
2
y
= f(x, y)
u
i1,j
2u
i,j
+ u
i+1,j
h
2
y
(4.2)
Using above equations, each iteration is described in two steps. U
(I+
1
2
)
is obtained
by using 4.1 and then U
(I+1)
is obtained from 4.2
u
(I+
1
2
)
i+1,j
2u
(I+
1
2
)
i,j
+ u
(I+
1
2
)
i1,j
h
2
x
= f(x, y)
u
(I)
i,j1
2u
(I)
i,j
+ u
(I)
i,j+1
h
2
y
(4.3)
u
(I+1)
i,j1
2u
(I+1)
i,j
+ u
(I+1)
i,j+1
h
2
y
= f(x, y)
u
(I+
1
2
)
i1,j
2u
(I+
1
2
)
i,j
+ u
(I+
1
2
)
i+1,j
h
2
y
(4.4)
So in each iteration, the discrete equations are solved rst in one spatial direction and
then in the other direction. Also the system of equations should be solved implicitly
leading to the terminology, alternating direction implicit method.
4.3 Matrix Formulation
The dierence equations given in 4.4 when applied to each point on the domain gives
rise to system of equations which can be given in matrix equations.
Hu = B V u (4.5)
V u = B Hu (4.6)
where
H: Horizontal dimension matrix,contains coecients for unknowns in x direction
V : Vertical dimension matrix, contains for coecients for unknowns in y-direction.
B : RHS vector In mathematical terms,
w =
2u
i,j
u
i1,j
u
i+1,j
h
2
x
if w = Hu
Chapter 4. Alternating Direction Implicit(ADI) Method 29
w =
2u
i,j
u
i,j1
u
i,j+1
h
2
y
if w = V u
In simple words, H and V arise as the central dierence approximations of the corre-
sponding terms in the Poissons equation.
The H matrix for the the domain described in gure (3.1) is given by:
H =
1
h
2
x
_

_
2 1 1
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
.
.
.
1 2 1
1 2 1
.
.
.
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
.
.
.
1 1 2
.
.
.
.
.
.
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
1 2 1
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
1 1 2
_

_
(4.7)
The diagonal entries of H matrix correspond to the current point(x
i
, y
j
) for which the
equation is being generated. H matrix row contains a subdiagonal entry for the preced-
ing point(x = x
i1
) and a superdiagonal entry for the next point in x-direction. If the
adjacent point is a boundary point, then correspondingly sub-diagonal or super-diagonal
entry may be zero and the rhs vector is updated with the value at the boundary.
Chapter 4. Alternating Direction Implicit(ADI) Method 30
The V matrix for the the domain described in gure (3.1) is given by:
V =
1
h
2
y
_

_
2 1
.
.
.
.
.
.
.
.
.
.
.
.
2 1
1 2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 2
.
.
.
.
.
.
.
.
. 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 1
1 2
.
.
.
.
.
.
.
.
.
.
.
.
1 2
_

_
(4.8)
Each row of V matrix corresponds to an equation for a point(x
i
, y
j
) in the interior of the
domain in vertical direction. One entry in lower triangular part is non-zero corresponding
to the preceding point (y = y
j1
) in the vertical dimension and an entry in upper
triangular part is non-zero corresponding to the next point (y = y
j+1
)in the vertical
dimension.
This matrix formulation can also be viewed as the coecient matrix A described in
(3.2) being split in to parts in the ADI method depending on the number of dimensions
of the domain. For two dimensions,
A = H + V
Chapter 4. Alternating Direction Implicit(ADI) Method 31
The B vector is obtained by evaluation the Poisson load/source function and accumulat-
ing the boundary values if the adjacent points to the given point are boundary points.
4.4 ADI Method Implementation
Relaxation parameter r is introduced in the equations 4.6 similar to Gauss-Siedel method
to enhance the convergence. Now the steps in an iteration of the ADI method can be
summarised as follows:
(H + rI)u
(n+
1
2
)
= (rI V )u
(n)
+ B (4.9)
(V + rI)u
(n+1)
= (rI H)u
(n+
1
2
)
+ B (4.10)
Each iteration step involves solving a matrix equation which is costly if we employ
Gaussian elimination (O(n
3
) where n = N
2
). But we can observer that H matrix is
tri-diagonal i.e. it contains non-zero entries only in diagonal, sub-diagonal and super-
diagonal elements. So to solve system of equations (4.9), we can employ tri-diagonal
solve which involves only O(n) work.
Algorithm Tri-diagonal-solve can be slightly modied to solve for equations (4.10)
where elimination of non-zero lower-triangular entry below this diagonal element is done
and corresponding row is modied instead of next row. We can observe that this algo-
rithm also involves only O(n) work.
So the implementation of an iteration requires only O(n) to solve the matrix equations
given in the steps of ADI method. But it is still costlier than classical elimination
methods. This may seem to be a disadvantage. But the advantage of ADI method
springs from the fact that it converges at much faster rate by clever choice of relaxation
parameter r.
Chapter 4. Alternating Direction Implicit(ADI) Method 32
4.5 Solution of Laplace equation on Square domain
4.5.1 Problem Statement
To nd the steady state temperature distribution on a unit square plate(length L = 1)
with boundary conditions with boundary conditions unit temperature on top edge(y =
L, 0 < x < L) and zero on the remaining edges.
Figure 4.1: Square Domain
4.5.2 Numerical Solution
The problem involves nding the solution of Laplace equation
2
u = 0 on the square
domain. Solving the problem using ADI method involves generating H and V matrices
as given in equation (4.7) and (4.8) and RHS vector B contains non-zero entries only for
index j = N rows of the domain given in (3.1). Iterations steps described in (4.9) and
(4.10) are applied.
4.5.3 Error Analysis
The relative error plot given in gure(4.3) is obtained by taking ratio of dierence between
analytical solution (g. 2.3) and numerical solution (g. 4.2) with analytical solution.
Chapter 4. Alternating Direction Implicit(ADI) Method 33
0
0.5
1
0
0.5
1
0
0.5
1
x
y
T
e
m
p
e
r
a
t
u
r
e
Figure 4.2: Temperature distribution on unit square plate.
Solution of Laplace Equation using ADI Method.
Side Length =1 No. of Divisions = 99
The relative error plot indicates two peaks at the corners of the square which are due
to discontinuity in the function value on the boundary( sudden jump from 0 to 1).
Analytically, error can be explained with the help of Gibbs Phenomenon [1] ( overshoot
of Fourier series approximation near the discontinuity).
0
0.5
1
0
0.5
1
0
0.01
0.02
0.03
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
Figure 4.3: Relative error plot between ADI solution and analytical solution
for Laplace equation on Square domain. No. of Divisions = 99
Generally two dierent methods [11] are used to to reduce or localise the error arising
due to the discontinuity in the boundary shape/ boundary function
Chapter 4. Alternating Direction Implicit(ADI) Method 34
1. Highly rened mesh near the boundary
2. Higher order approximations(Considering more terms in Taylor series).
Relative error plot inside the domain is given in gure (4.4) which shows that error
when compared with analytical solution is very minimal in the interior of the solution.
0
0.5
1
0
0.5
1
0
1
2
3
4
x 10
4
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
Figure 4.4: Error plot in the interior of the domain
for Laplace equation on Square domain. x, y [0.1, 0.9] No. of Divisions = 100
4.5.4 Choice of relaxation parameter
ADI Method gives faster convergence when we choose relaxation parameters optimally.
In this section we compare the performance of ADI method with the classical iterative
methods like Jacobi, Gauss Siedel and SOR methods and show that ADI method is
superior to them.
Number of iterations taken by dierent methods to generate solution for Laplace
Equation in a square domain is shown in the table (4.1). We can observe that Gauss-
Siedel method converges twice as fast as Jacobi method and SOR method converges
much faster than both the methods(N times faster).
Chapter 4. Alternating Direction Implicit(ADI) Method 35
Table 4.1: Comparision of iterations taken by various iterative methods
No. of Iterations
Divisions Jacobi Gauss-Siedel SOR ADI
Method Method Method Method
10 237 127 33 36
20 964 513 184 141
30 2106 1120 412 309
40 3629 1932 717 535
50 5509 2936 1095 817
60 7727 4123 1544 1151
100 19706 10567 3990 2981
Cyclic ADI parameters
ADI method when given cyclic parameters as prescribed in [8] takes very less number of
iterations. Relaxation parameter in ADI method is chosen dierently for each step upto
m = 2
k
steps and cyclically repeated.
Relaxation parameters are recursively calculated by the formula:
r
(n)
i
= r
(2n)
i
+

k1j

k1j
r
2n
i
i = 1, 2, 3...2
j
j = 0, 1, ...k 1
Lower bound on Eigen values of H and V matrices: = 4 sin
2

2(N + 1)
Upper bound on Eigen values of H and V matrices: = 4 cos
2

2(N + 1)
Calculation of bounds:

0
=
0
=

j+1
=
_

j

j+1
=

j
+
j
2
j = 0, 1, ...k 1
When relaxation parameters are selected cyclically, the values of relaxation parameters
obtained by above algorithm with period m = 8 steps :
Chapter 4. Alternating Direction Implicit(ADI) Method 36
Table 4.2: Cyclic ADI parameters performance comparision
Number of r=1 m=4 m=8
Divisions Iterations taken Iterations taken Big ADI steps Iterations taken Big ADI steps
10 36 17 4 25 3
100 2981 33 8 33 4
500 55304 49 12 41 5
1000 57 14 49 6
2000 69 17 49 6
3000 77 19 57 7
r[0] : 3.365050 r[1] : 0.001197 r[2] : 0.116132 r[3] : 0.034673
r[4] : 1.270268 r[5] : 0.003170 r[6] : 0.388272 r[7] : 0.010371
The comparision of iterations taken with constant and varying relaxation parameters is
given in table 4.2.
4.6 Solution of Poisson Equation on square domain
4.6.1 Problem Statement
To nd the electro static potential inside a square domain of length(L = 5) with homo-
geneous zero boundary conditions with unit charge density distributed inside the domain
4.6.2 Governing Equation and Numerical Solution
The electro static potential(Voltage) in a closed region with charge density contained
inside satises Poisson equation

2
V =
1
4
0
(4.11)
where V stands for Voltage or electro static potential. The value of the constant, permi-
tivity of free space is
1
4
0
is 910
9
For the given problem, charge density = 1Coulomb.
The plot of solution obtained by ADI method is given in 4.6. The potential is in the
Chapter 4. Alternating Direction Implicit(ADI) Method 37
Figure 4.5: Poisson function for square plate
shape of a dome as the edges of the plate are maintained at ground potential.
0
2
4
6
0
2
4
6
0
0.5
1
1.5
2
x 10
10
x
y
V
o
l
t
a
g
e
Figure 4.6: Numerical Solution of Poisson equation on square domain of length 5m.
No. of Divisions = 100
4.6.3 Error Analysis
Figure (4.7) shows relative error plot containing four peaks due to the discontinuity in
the shape of the boundary at the corners of the square domain. The reduced error plot
in the interior of the region is shown in (4.8).
Chapter 4. Alternating Direction Implicit(ADI) Method 38
0
2
4
6
0
2
4
6
0
2
4
6
8
x 10
3
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
Figure 4.7: Error plot for Poisson equation on Square domain. No. of Divisions = 100
0
2
4
6
0
2
4
6
0
1
2
3
4
x 10
4
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
Figure 4.8: Error plot in the interior of the domain for Poisson equation on Square
domain. No. of Divisions = 100
Chapter 5
ADI Method on various domains
ADI method was introduced in the previous chapter and was shown to be able to solve
Laplace and Poisson equation with good accuracy on square domain. In this chapter,
we extend ADI method to various domains in two dimensions.
5.1 ADI Solver Implementation Steps
The ADI solver takes the following conditions as inputs. Find Boundary Extremes: This
is useful for the generation of mesh. The bounding box of the domain is determined.
The
5.2 FDM formula for irregular boundary
Finite Dierence approximation formula given in equation(6.2) holds when the boundary
is aligned with the grid points. If the boundary is curved and doesnt intersect at mesh
point as given in the gure (5.1) then the discretisation should take in to account that
adjacent point is not at a distance h but a fraction of it, say nh.
A generalised discretisation formula taking into account the fractional distances as
39
Chapter 5. ADI Method on various domains 40
Figure 5.1: A curved boundary with mesh
Figure 5.2: Mesh point O with neighbours NEWS
shown in gure (5.2) is given in [4].It is as follows:

2
u
o
=
2
h
2
_
u
R
r(r + l)
+
u
N
n(n + s)
+
u
L
l(l + r)
+
u
S
s(s + n)

lr + ns
lrns
u
o
_
(5.1)
5.3 Solution of Laplace equation on a ring domain
Problem statement
To nd the electrostatic potential in an annular ring domain(gure 5.3) whose outer
radius(R
2
= 1) boundary is maintained at ground voltage and inner radius (R
1
= 0.25)
Chapter 5. ADI Method on various domains 41
Figure 5.3: Ring Domain
boundary at voltage 1V
u(r, ) = 1, r = R
1
= 0, r = R
2
Numerical Solution
The solution involves solving laplace equation
2
u = 0 in the interior of ring domain.
In cartesian coordinates, ring has curved boundary so that discretisation as described in
equation (5.1) is applied at points near to the boundary. The solution obtained is given
in the gure5.4). The voltage increases from interior boundary to exterior boundary in
a logarithmic fashion.
Error Analysis
The analytical solution for the given problem is obtained from equation(2.23). The error
plot and relative error plot for the ring domain is given in gure (5.5).
Chapter 5. ADI Method on various domains 42
1
0
1
1
0
1
0
0.5
1
x
y
V
o
l
t
a
g
e
Figure 5.4: Voltage inside ring domain.
Solution of Laplace Equation using ADI Method.
Inner Radius = 0.25 Outer Radius =1 No. of Divisions = 100
5.4 Solution of Poisson equation on a circular disk
domain
Problem statement
To nd the solution of Poissons equation
2
u = 1 on a circular disk of radius R = 1
with homogeneous zero boundary conditions.
Numerical Solution
The problem can be viewed as uniform charge density inside circular disk for electro
static potential or uniform pressure on a membrane. The potential will be maximum at
the centre of the disk. The solution plot is given in gure (5.6)
Error Analysis
The analytical solution for the given problem can be obtained by equation (2.32). Then
the error plot is obtained as given in gure(5.7)
Chapter 5. ADI Method on various domains 43
1
0
1
1
0
1
1
0.5
0
0.5
1
x 10
4
x
y
E
r
r
o
r
(a) Actual Error
1
0
1
1
0
1
0
1
2
3
4
x 10
4
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
(b) Relative Error
Figure 5.5: Error plots for solution of Laplace equation on ring domain
5.5 Solution of Laplace equation on a hyperbola do-
main
Problem statement
To solve Laplace equation u
x
x + u
y
y = 0 in the interior of region bounded by a pair of
hyperbolas x
2
y
2
= a
2
and y
2
x
2
= b
2
with boundary conditions
U(x, y) = V when x
2
y
2
= a
2
= 0 when y
2
x
2
= b
2
Analytical Solution
We can see that the solution is symmetric along the x, y axes so that the solution may
not contain any x, y terms. So we can expect a polynomial solution as:
U(x, y) = c
0
+ c
1
x
2
+ c
2
y
2
Chapter 5. ADI Method on various domains 44
1 0.5 0 0.5 1
1
0
1
0
0.05
0.1
0.15
0.2
0.25
x y
u
(
x
,
y
)
Figure 5.6: Solution of Poisson equation on circular disk.
Radius = 1 Source function f(x,y) = 1 No. of Divisions = 100
To satisfy Laplace equation, the necessary condition is c
1
= c
2
So the general solution is:
U(x, y) = c
0
+ c
1
(x
2
y
2
)
By applying boundary conditions, we get
c
0
+ c
1
(a
2
) = V
c
0
+ c
1
(b
2
) = 0
Solving we get, c
0
= V
_
b
2
a
2
+b
2
_
c
1
= V
_
1
a
2
+b
2
_
Therefore solution is:
U(x, y) = V
__
b
2
a
2
+ b
2
_
+
_
1
a
2
+ b
2
_
_
x
2
y
2
)
_
_
Numerical Solution
The domain is not closed so it cannot be solved directly with ADI solver. We consider
x=-3a, 3a and y= -3b, 3b as boundary extremes and consider them as boundaries. Very
few points fall on this line so that the solution is accurate enough. The solution in the
interior gives a saddle shape surface i.e. it can not have maximum or minimum in the
Chapter 5. ADI Method on various domains 45
1
0
1
1
0
1
4
2
0
2
4
x 10
6
x
y
E
r
r
o
r
(a) Actual Error
1
0
1
1
0
1
2
1
0
1
2
x 10
6
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
(b) Relative Error in interior
Figure 5.7: Error plots for solution of Poisson equation on circular disk
Figure 5.8: Hyperbola Domain
Chapter 5. ADI Method on various domains 46
interior of the surface. Iso-lines are hyperbolas increasing in magnitude in xdirection
and decreasing in ydirection. The solution plot is given in the gure(5.9).
10
0
10
10
0
10
0
0.5
1
x
y
V
o
l
t
a
g
e
Figure 5.9: Solution of Laplace equation on hyperbola domain.
a = 2 b = 2 V = 1 No. of Divisions = 100
x [3a, 3a] = [6, 6] y [3b, 3b] = [6, 6]
Error Analysis
The error plot indicates four peaks at the corners where the boundary is discontin-
uous(in the modied version). However the error is very minimum in the interior
region(gure:5.10).
Chapter 5. ADI Method on various domains 47
10
0
10
10
0
10
1
0.5
0
0.5
1
x
y
E
r
r
o
r
(a) Actual Error
5
0
5
5
0
5
0
0.5
1
1.5
x 10
6
x
y
R
e
l
a
t
i
v
e

E
r
r
o
r
(b) Relative Error in interior
Figure 5.10: Error plots for solution of Laplace equation on hyperbola domain
Chapter 6
ADI Method on 3-D Domains
In this chapter, ADI method formulation is explained for 3-Dimensional Domains.
6.1 3-D Poisson Equation
3D Poisson Equation in cartesian coordinate system is given by:
u
xx
+ u
yy
+ u
zz
= f(x, y, z) (6.1)
where f(x, y, z) stands for load function at point (x, y, z) and u(x, y, z) stands for poten-
tial that needs to be determined. Similar to the nite dierence descretisation described
in section(3.2) the discretised equation at point, as given in gure(6.1) described by index
(i, j, k) with coordinates x
i
= i h
x
, y
j
= j h
y
, z
k
= k h
z
is given by
u
i+1,j,k
2u
i,j,k
+ u
i1,j,k
h
2
x
+
u
i,j+1,k
2u
i,j,k
+ u
i,j1,k
h
2
y
+
u
i,j,k+1
2u
i,j,k
+ u
i,j,k1
h
2
z
= f(x, y, z) (6.2)
48
Chapter 6. ADI Method on 3-D Domains 49
Figure 6.1: A point in 3D domain
6.2 3-D ADI method
For three dimensional domains, Each iteration of ADI method involves three steps to get
the solution.
(H + rI)z
(i+1/3)
= (rI V N)z
(i)
+ B
(V + rI)z
(i+2/3)
= (rI H N)z
(i+1/3)
+ B
(N + rI) z
(i+1)
= (rI H V )z
(i+2/3)
+ B (6.3)
H: Horizontal dimension Matrix
V: Vertical dimension Matrix
N: Normal dimension Matrix
Thus the coecent matrix A is split as A = H + V + N
6.3 Solution of Laplace Equation on the Cube
Problem statement
To solve 3D Laplace equation
u
xx
+ u
yy
+ u
zz
= 0
Chapter 6. ADI Method on 3-D Domains 50
on the cube domain with side length L with boundary conditions
U(x, y, z) = V z = L, 0 < x < L, 0 < y < L
= 0 on the other ve faces.
i.e. for x, y, z [0, L]
U(0, y, z) = 0
U(L, y, z) = 0
U(x, 0, z) = 0
U(x, L, z) = 0
U(x, y, 0) = 0
Analytical Solution:
Analytical solution is obtained by the method of separation of variables i.e. solution is
expressed as product of three functions each of single variable.
U(x, y, z) = F(x)G(y)H(z)
Substituting in Laplace equation:
G(y)H(z)F

(x) + F(x)H(z)G

(y) + F(x)G(y)H

(z) = 0
Dividing the equation by U(x,y,z) we get,
F

(x)
F(x)
+
G

(y)
G(y)
+
H

(z)
H(z)
= 0
We write the above equation as:
F

(x)
F(x)
=
G

(y)
G(y)

H

(z)
H(z)
=
2
Chapter 6. ADI Method on 3-D Domains 51
Since the rst term involves only x variable and RHS doesnt have any x variable terms
we conclude that
2
is a constant. Similarly we dene a constant
2
as
G

(x)
G(x)
=
F

(y)
F(y)

H

(z)
H(z)
=
2
Let
2
=
2
+
2
then,
H

(z)
H(z)
=
F

(y)
F(y)

G

(z)
G(z)
=
2
General solution to the above equation is given by
H(z) = Asinh(z) + Bcosh(z)
Applying the boundary condition U(x, y, 0) = 0, we get H(0) = 0 so that B = 0 which
gives,
H(z) = Asinh(z)
Solution of F

(x) +
2
F(x) = 0 is given by,
F(x) = C sin(x) + Dcos(x)
Applying the boundary condition U(0,y,z) = 0 we get, D = 0
Applying the boundary condition U(L,y,z) = 0 we get, =
n
L
, n = 1,2,...
which gives
F(x) = C sin
_
n
L
x
_
Similarly, we get
G(y) = E sin
_
m
L
y
_
So the solution to the Laplace equation can be written as
Chapter 6. ADI Method on 3-D Domains 52
U(x, y, z) =

n,m=1
A
n,m
sin
_
n
L
x
_
sin
_
m
L
y
_
sinh (z)
where =

2
+
2
=
_
(n
2
+ m
2
)

L
To determine the coecient A
n,m
we use the remaining boundary condition U(x, y, L) =
f(x, y) = V
f(x, y) =

n,m=1
A
n,m
sinh (L) sin
_
n
L
x
_
sin
_
m
L
y
_
We see that [A
n,m
sinh (L)] are the coecients of 2D Fourier sine series of f(x, y)
Multiply both sides of the above equation with sin
_
j
L
x
_
sin
_
l
L
y
_
and integrate over
x and y. Using orthogonality of sine functions,
_
L
0
dxsin
_
n
L
x
_
sin
_
j
L
x
_
=
_

_
L/2 if j = n
0 j = n
A
n,m
=
1
sinh(L)
4
L
2
_
L
x=0
_
L
y=0
f(x, y) sin
_
n
L
x
_
sin
_
m
L
y
_
dxdy
=
1
sinh(L)
4
L
2
V
_
L
x=0
sin
_
n
L
x
_
dx
_
L
y=0
sin
_
m
L
y
_
dy
=
1
sinh(L)
4
L
2
V
_
cos
_
n
L
x
__
L
0
_
cos
_
m
L
y
__
L
0
=
4 V [1 cos(n)] [1 cos(m)]
sinh(L) L
2
Therefore solution to Laplace equation on cube with above boundary conditions is given
by,
U(x, y, z) =

n,m=1
4 V [1 (1)
n
] [1 (1)
m
]
L
2
sinh(L)
sin
_
n
L
x
_
sin
_
m
L
y
_
sinh(z)
Chapter 6. ADI Method on 3-D Domains 53
Since even terms become zero we get,
U(x, y, z) =

n,m=1
16V
L
2
sinh(L)
sin
_
n
L
x
_
sin
_
m
L
y
_
sinh(z) n, m odd
Numerical Solution
Numerical Solution obtained using ADI method is given in gure (6.2). The slices at
x = 0.1, 0.25, 0.5, 0.75, 0.9 are given. The solution increases exponentially from 0 to 1
along z axis.
Error Analysis
Error plot is given in gure(??). The error is more near the top four edges i.e. intersection
z = 1 plane with x=0,x=1,y=0,y=1 planes due to discontinuity of boundary function at
that edges. The error is very minimum of the order of 10

4 in the interior region. Thus


ADI method works well for 3-D Domains also.
Chapter 6. ADI Method on 3-D Domains 54
Figure 6.2: Solution of Laplace Equation on Cube domain using ADI method.
No. of Divisions =100
Chapter 6. ADI Method on 3-D Domains 55
Figure 6.3: Error plot for Laplace equation on Cube domain
No. of Divisions =100
Chapter 7
Conclusions and Future Work
7.1 Conclusion
Poisson Solver based on Alternating Direction Implicit(ADI) method is developed. The
solver takes as input the geometry of the domain, boundary conditions and source func-
tion produces the potential distribution inside the domain. The convergence of ADI
method is observed to be much better than convergence of other classical iterative meth-
ods. The working of ADI poisson solver on various geometries like circle,ring, hyperbola
are demonstrated. The ADI solver is extended to work for three dimensions also.
7.2 Future Work
A Graphical User Interface (GUI) needs to be developed which can simplify the
input of geometry,description of boundary conditions and source function.
The optimal parameters for dierent geometries needs to be determined.
The working of the method should be checked on much more complicated domains.
56
References
[1] Arfken, G. B., Weber, H.J., Mathematical Methods for Physicists, Elsevier, Noida,
(2005), Sixth Edition.
[2] Foley, J.D., et al., Computer Graphics: Principles and Practice, Addison Wesley,
Reading, (1990), Second Edition.
[3] Griths, D. J., Introduction to Electrodynamics, Prentice Hall, New Jersey, (1999).
[4] Kreyszig, E., Advanced Engineering Mathematics, John Wiley & Sons (1993), Seventh
Edition.
[5] Olver, P.J., Introduction to Partial Dierential Equations, available at, http://www.
math.umn.edu/
~
olver/pdn.html.
[6] Peaceman, D. W., Rachford, H. H., Jr., The Numerical Solution of Parabolic and
Elliptic Dierential Equations, Journal of the Society for Industrial and Applied
Mathematics 3 (1955), 2841.
[7] Pivato, M., Linear Partial Dierential Equations and Fourier Theory, Cambridge
University Press, (2009).
[8] Stoer, J., Bulirsch, R., Introduction to Numerical Analysis, Springer Verlag, New
York, (1993), Second Edition.
[9] Saad, Y., Iterative Methods for Sparse Linear Systems, SIAM, Philadelphia, (1993),
Second Edition.
57
REFERENCES 58
[10] Varga, R.S., Matrix Iterative Analysis, Springer-Verlag, Heidelberg, (2000), Second
Revised and Expanded Edition.
[11] Zenger, C., Gietl, H., Improved Dierence Schemes for the Dirichlet Problem of
Poissons Equation in the Neighbourhood of Corners Numerische Mathematik, 30,
(1978), 315332.

You might also like