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 Difference Method(FDM) to solve
partial differential equations. We employ ADI method to solve Poisson’s equation for
dirichlet boundary conditions.The discretised equation is modified 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 efficient tri-diagonal solvers
ii
Contents
Acknowledgements i
Abstract ii
1 Introduction 11.1 Poisson’s Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Applications of Poisson’s equation . . . . . . . . . . . . . . . . . . . . . . 21.3 Properties of Poisson’s equation . . . . . . . . . . . . . . . . . . . . . . . 5
2 Analytical Solution to Poisson’s Equation 72.1 Solution strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 Solution of Laplace equation on square domain: . . . . . . . . . . . . . . 10
2.2.1 Solution of Poisson equation on square domain: . . . . . . . . . . 132.2.2 Solution of Poisson equatin on square domain with given boundary
conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2.3 Solution of Laplace equation on an annular ring: . . . . . . . . . . 152.2.4 Solution of Laplace equation on circular domain: . . . . . . . . . . 162.2.5 Solution of Poisson’s equation on circular domain: . . . . . . . . . 17
3 Solution of Poisson’s equation using Finite Difference Methods 203.1 Finite Difference Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2 Mesh/Grid Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3 Discretised Poisson’s equation . . . . . . . . . . . . . . . . . . . . . . . . 213.4 Matrix Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.5 Iterative Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.5.1 Jacobi Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.5.2 Gauss-Siedel Method . . . . . . . . . . . . . . . . . . . . . . . . . 253.5.3 Successive-over Relaxation Method . . . . . . . . . . . . . . . . . 25
3.6 Convergence of Iterative Methods . . . . . . . . . . . . . . . . . . . . . . 25
4 Alternating Direction Implicit(ADI) Method 274.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.2 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.3 Matrix Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
iii
CONTENTS iv
4.4 ADI Method Implementation . . . . . . . . . . . . . . . . . . . . . . . . 314.5 Solution of Laplace equation on Square domain . . . . . . . . . . . . . . 32
4.5.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 324.5.2 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 324.5.3 Error Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.5.4 Choice of relaxation parameter . . . . . . . . . . . . . . . . . . . 34
4.6 Solution of Poisson Equation on square domain . . . . . . . . . . . . . . 364.6.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 364.6.2 Governing Equation and Numerical Solution . . . . . . . . . . . . 364.6.3 Error Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5 ADI Method on various domains 395.1 ADI Solver Implementation Steps . . . . . . . . . . . . . . . . . . . . . . 395.2 FDM formula for irregular boundary . . . . . . . . . . . . . . . . . . . . 395.3 Solution of Laplace equation on a ring domain . . . . . . . . . . . . . . . 405.4 Solution of Poisson equation on a circular disk domain . . . . . . . . . . 425.5 Solution of Laplace equation on a hyperbola domain . . . . . . . . . . . . 43
6 ADI Method on 3-D Domains 486.1 3-D Poisson Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486.2 3-D ADI method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496.3 Solution of Laplace Equation on the Cube . . . . . . . . . . . . . . . . . 49
7 Conclusions and Future Work 567.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
References 57
List of Tables
4.1 Comparision of iterations taken by various iterative methods . . . . . . . 354.2 Cyclic ADI parameters performance comparision . . . . . . . . . . . . . . 36
v
List of Figures
2.1 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.3 Solution of Laplace Equation on Square domain . . . . . . . . . . . . . . 122.4 Analytical Solution of Poisson Equation on Square domain . . . . . . . . 14
3.1 Domain Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1 Square Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.2 Laplace equation Solution using ADI method on Square domain . . . . . 334.3 Error plot for ADI method in Square domain . . . . . . . . . . . . . . . . 334.4 Error plot for ADI Method in the interior of Square domain . . . . . . . 344.5 Poisson function for square plate . . . . . . . . . . . . . . . . . . . . . . 374.6 Numerical solution of Poisson equation on square domain . . . . . . . . . 374.7 Error plot for Poisson equation on square domain . . . . . . . . . . . . . 384.8 Error plot in the interior of the domain for Poisson equation on square
domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.1 A curved boundary with mesh . . . . . . . . . . . . . . . . . . . . . . . 405.2 Mesh point O with neighbours NEWS . . . . . . . . . . . . . . . . . . . 405.3 Ring Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415.4 Laplace equation Solution using ADI method on ring domain . . . . . . . 425.5 Error plots for solution of Laplace equation on ring domain . . . . . . . . 435.6 Poisson equation Solution using ADI method on circular disk . . . . . . . 445.7 Error plots for solution of Poisson equation on circular disk . . . . . . . . 455.8 Hyperbola Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455.9 Laplace equation Solution using ADI method on hyperbola domain . . . 465.10 Error plots for solution of Laplace equation on hyperbola domain . . . . 47
6.1 A point in 3D domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496.2 Solution of Laplace Equation on Cube domain using ADI method . . . . 546.3 Error plot on Cube domain . . . . . . . . . . . . . . . . . . . . . . . . . 55
vi
Chapter 1
Introduction
1.1 Poisson’s Equation
Poisson’s Equation is an elliptic linear inhomogeneous partial differential equation of the
second order. It is given by
∇2u = −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
∂2u
∂x2+∂2u
∂y2+∂2u
∂z2= −f(x, y, z) (1.2)
where x, y, z are the independent space dimensions.
When the Poisson equation is satisfied by a scalar potential in a given domain Ω. We
can find 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 Poisson’s equation
Poisson equation arises in a variety of branches mathematical and physical contexts rang-
ing through elasticity and solid mechanics, fluid 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 find the electric field ( ~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 simplified with help of Poisson’s equation.
We can find the electric potential in the region by solving Poisson’s equation.
∇2V (x, y, z) =1
4πǫ0ρ(x, y, z)
where ρ(x, y, z) is a charge distribution in the given volume. Then electric field 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 differential equation(Poisson’s equation) involving voltage instead of two
involving gradient and curl.
Chapter 1. Introduction 3
Derivation of Poisson’s equation in Electrostatics
In a given volume, Gauss’s law in differential form states that the divergence of the
electric field 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 field ~B, Faraday’s
law of induction gives
~∇× ~E =∂ ~B
∂t= 0
Since curl of electric field is zero, the electric field 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
∇2V =1
4πǫ0ρ (1.5)
Stationary Heat Equation
Poisson’s equation also governs heat flow problems that are steady, that is, time inde-
pendent. The thermal equilibrium of bodies(eg. flat plates) can be described by the
Poisson’s equation in the presence of heat sources:
α∇2T (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 Poisson’s equa-
tion. The inhomogenuous term represents an external forcing over the surface of the
membrane. The governing equation is given by
∇2u(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 flow of fluid follows
Laplace equation. The gradient of the velocity potential gives the velocity.
Elasticity
Poisson’s 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 finding the stress
function Ψ(x, y) which satisfies 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 field filled with masses, Poisson equation is
also useful.The gravitational potential is given by the equation
∇2ψ = 4πGρ
Chapter 1. Introduction 5
ψ stands for Gravitational potential, G stands for universal gravitational constant and
ρ stands for mass density. Besides above,Poisson’s equation has applications in image
processing, number theory etc.
1.3 Properties of Poisson’s equation
Poisson’s equation and its homogeneous counter-part Laplace equation has several in-
teresting properties which help in finding 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 flow.
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-
son’s 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 different represention of the same solution.
Chapter 2
Analytical Solution to Poisson’s
Equation
In this chapter we introduce various traditional analytical methods used to solve partial
differential 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 Differential Equations analytically are as
follows
1. Separation of variables: This is the most common method used to solve partial
differential 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 differential 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 Poisson’s Equation 8
These ordinary differential 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 specified 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. Green’s function : Green’s 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 Poisson’s 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 infinite domain.
5. Superposition principle Laplace equation is linear so that combination of solutions
is also a solution. We can find solution for complicated boundary condition by
splitting it in to smaller problems.
Solution of Laplace equation ∇2U = 0 on square domain of length L with two
boundaries x = 0 , y = L having potential one can be found by U = U1 +U2 where
∇2U1 = 0 with U1(x, L) = 0 and ∇2U2 = 0 with U2(0, y) = 1. This is described in
figure (2.1).
Solution of Poisson equation for given boundary conditions can be found by adding
Chapter 2. Analytical Solution to Poisson’s 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 figure(2.2)
Figure 2.2: Superposition principle
Mathematically solution of ∇2U = f(x, y) for U = g(x, y) on boundary ∂Ω is
given by U = U1 + U2 where ∇2U1 = f(x, y) for U1(x, y) = 0 on boundary ∂Ω and
∇2U2 = 0 with U2(x, y) = g(x, y) on ∂Ω.
Chapter 2. Analytical Solution to Poisson’s Equation 10
6. Eigen function expansions: Solution of inhomogenuous differential equations like
Poisson’s equation can be found by expressing the source/load function as an ex-
pansion of eigen functions of the linear operator and finding the coefficients/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
uxx + uyy = 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 differential equation (2.1)
in to two ordinary differential equations and solve for the potential u in the interior of
the domain. The first 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 Poisson’s 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 differential equations
F ′′(x) + λ2F (x) = 0 (2.7)
G′′(y)− λ2G(y) = 0 (2.8)
The solution of (2.7) is given by
F (x) = A sin(λx) +B cos(λ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
= C1 sinh(λy) +D1 cosh(λy)
Chapter 2. Analytical Solution to Poisson’s Equation 12
Using boundary condition (2.4), we get D1 = 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
cn sinh(
nπy
L
)
sin(
nπx
L
)
(2.10)
Fourier Series
In order to determine the solution completely, we need to determine the coefficients cn.
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 coefficient cn is given by
cn =2
L sinh(nπ)
∫ L
0f(x)sin
(
nπx
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
(
nπy
L
)
sin(
nπx
L
)
(2.12)
0
0.5
1
0
0.5
10
0.5
1
xy
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 Poisson’s Equation 13
2.2.1 Solution of Poisson equation on square domain:
Problem Statement
To solve Poisson equation
uxx + uyy = − 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 Poisson’s equation ∇2u = −q(x, y) for homogeneous dirichlet bound-
ary conditions can be given in terms of eigenfunctions of the Laplacian operator: sin(
nπxL
)
sin(
mπyL
)
i.e. Let the solution vector u be:
u =∞∑
m,n=1
Km,n sin(
nπx
L
)
sin(
mπy
L
)
Then,
∇2u = uxx + uyy
=(m2 + n2)π2
L2Km,n sin
(
nπx
L
)
sin(
mπy
L
)
=(m2 + n2)π2
L2u
So in order to find the solution of Poisson equation, we express charge density in
terms of eigen functions sin(
nπxL
)
sin(
mπyL
)
with the help of two dimensional Fourier
sine series
ρ(x, y) =∞∑
m,n=1
Qn,m sin(
nπx
L
)
sin(
mπy
L
)
(2.15)
Chapter 2. Analytical Solution to Poisson’s Equation 14
where Qn,m is given by the fourier series coefficient:
Qn,m =4
L2
∫ L
0
∫ L
0q(x, y) sin
(
nπx
L
)
sin(
mπy
L
)
dxdy (2.16)
Then the solution to Poisson’s equation is given by,
u(x, y) =∞∑
m,n=1
Qn,mL2
(m2 + n2)π2sin
(
nπx
L
)
sin(
mπy
L
)
(2.17)
For the given problem, fourier series coefficients of unit charge density is given by,
Qn,m =4
L2
∫ L
0
∫ L
0
ρ04πǫ0
sin(
nπx
L
)
sin(
mπy
L
)
dxdy
=16
nmπ2
ρ04πǫ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
ρ04πǫ0
16L2
mn (m2 + n2)π4sin
(
nπx
L
)
sin(
mπy
L
)
(2.18)
02
46
0
2
4
60
0.5
1
1.5
2x 10
10
xy
Vol
tage
Figure 2.4: Analytical Solution of Poisson Equation on Square domainwith zero boundary value and f(x,y) = 9e9.No. of terms in fourier series used = 100
Chapter 2. Analytical Solution to Poisson’s 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
∇2u = 0
on a ring domain with inner radius R1 and outer radius R2 with boundary conditions.
f(r, θ) =
1 r = R1
0 r = R2
(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
(
∂
∂ru
)
+1
r2∂2
∂θ2u = 0
General solution
Using separation of variables in polar coordinates, let us say,
u(r, θ) = R(r) Θ(θ)
gives us two ordinary differential equations,
r2R′′ + 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 differential equation. The solutions can be given in terms of eigen functions as
follows:
Chapter 2. Analytical Solution to Poisson’s Equation 16
n = 0, Θ(θ) = 1, R(r) = 1 and R(r) = ln r
n > 0, Θ(θ) = sin(nθ), cos(nθ) R(r) = rn and R(r) = r−n
Thus general solution of Laplace Equation on ring is:
u(r, θ) = a0 +∑
n
anrn cos(nθ) +
∑
n
a−nr−n cos(nθ)
+ b0 ln r +∑
n
bnrn sin(nθ) +
∑
n
b−nr−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, θ) = c1 + c2 ln r
Solving with the boundary conditions (2.19), we get
u(r, θ) =lnR2 − ln r
lnR2 − lnR1(2.23)
2.2.4 Solution of Laplace equation on circular domain:
Problem Statement
To solve Laplace equation∂2u
∂r2+
1
r
∂u
∂r+
1
r2∂2u
∂θ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 , rn in equation (2.22) have singularities as r −→ 0 so
that solution on disk is given by,
u(r, θ) = a0 +∞∑
n=1
(an rn cos nθ + bn r
n sin nθ) (2.25)
The coefficients can be determined by using the boundary conditions and finding fourier
coefficients.
Solution on circular disk can also be given in terms of Green’s function which is given
Chapter 2. Analytical Solution to Poisson’s Equation 17
by Poisson’s kernel, P (x, s). The influence 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) =R2 − ‖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) =R2 − (x2 + y2)
(x−Rcos(α))2 + (y −Rsin(α))2
Converting to polar coordinates x is represented by (r, θ) and dividing by R2 we get,
P (x, s) =1−
(
rR
)2
1− 2(
rR
)
cos(θ − α) +(
rR
)2
So the solution on circular disk is given by Poisson’s Integral formula:
u(r, θ) =1
2π
∫ π
−πf(α)
1−(
rR
)2
1− 2(
rR
)
cos(θ − α) +(
rR
)2 dα (2.26)
The solution can be viewed as a sort of convolution of boundary function with Poisson’s
kernel in circular domain.
2.2.5 Solution of Poisson’s equation on circular domain:
Problem Statement
To solve Poisson equation ∇2u = q(r, θ) i.e.
∂2u
∂r2+
1
r
∂u
∂r+
1
r2∂2u
∂θ2= q(r, θ) (2.27)
Chapter 2. Analytical Solution to Poisson’s 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 = −λ2f (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
rR′(r)Θ(θ) +
1
r2R(r)Θ′′(θ) = −λ2R(r)Θ(θ)
Dividing by R(r)Θ(θ)R′′(r)
R(r)+
R′(r)
rR(r)+
Θ′′(θ)
r2Θ(θ)= −λ2
Multiplying with r2 and rearranging the terms we get,
r2R′′(r)
R(r)+ r
R′(r)
R(r)+ λ2r2 = −Θ′′(θ)
Θ(θ)
To satisfy the periodic boundary condtions on θ, both LHS and RHS should be equal to
a negative constant, so that equations become,
Θ′′(θ)−m2Θ(θ) = 0 (2.29)
r2R′′(r) + rR′(r) + (λ2r2 −m2)R(r) = 0 (2.30)
Equation (2.30) is known as Bessel’s equation. The solution of (2.30) is given in terms
of Bessel’s function of first kind Jn(r) and Bessel functions of second kind Yn(r) . The
solution of (2.29) is given by cos(nθ) and sin(nθ).
Yn(x) is unbounded at the centre, so that Yn(x) is not a solution for the circular
disk. In order to satisfy homogeneous zero boundary conditions we need Jn(λR) = 0. So
Chapter 2. Analytical Solution to Poisson’s Equation 19
we consider a sequence of roots of Bessel function λ = knm which are irrational. Then
solution to (2.28) is given by Fourier-Bessel expansion
f(r, θ) =∞∑
n=0
∞∑
m=1
AnmJn
(
knmr
R
)
cos(nθ) +∞∑
n=1
∞∑
m=1
BnmJn
(
knmr
R
)
sin(nθ)
where Anm and Bnm are real-valued coefficients.
To find the solution of Poisson’s equation given in equation (2.27), we find Fourier-
Bessel expansion of q(r, θ).
q(r, θ) =∞∑
n=0
∞∑
m=1
AnmJn
(
knmr
R
)
cos(nθ) +∞∑
n=1
∞∑
m=1
BnmJn
(
knmr
R
)
sin(nθ)
The coefficients are given by the formula
Anm =2
πR2J2n+1(knm)
∫ π
−π
∫ R
0q(r, θ)Jn
(
knmr
R
)
cos(nθ) r dr dθ
Bnm =2
πR2J2n+1(knm)
∫ π
−π
∫ R
0q(r, θ)Jn
(
knmr
R
)
sin(nθ) r dr dθ
Then the solution of Poisson’s equation is given by,
u(r, θ) = −∞∑
n=0
∞∑
m=1
R2Anm
k2nmJn
(
knmr
R
)
cos(nθ)−∞∑
n=1
∞∑
m=1
R2Bnm
k2nmJn
(
knmr
R
)
sin(nθ)
(2.31)
Consider a unit radius circular disk with uniform charge density then its Fourier-Bessel
expansion in terms of J0(kmrR
)is given by
q(r, θ) = 1 =∞∑
n=0
2
k0mJ1(k0m)J0
(
k0mr
R
)
Then the solution of Poisson’s equation is given by
u(r, θ) =∞∑
n=0
2R2
k30mJ1(k0m)J0
(
k0mr
R
)
(2.32)
where radius R = 1
Chapter 3
Solution of Poisson’s equation using
Finite Difference Methods
It is not always possible to solve differential equation analytically. For example, it
is not possible to get analytical solution to Poisson’s 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 differential equations like finite element
methods, finite difference methods, boundary element method etc. Here we employ finite
difference methods to solve Poisson equation.
3.1 Finite Difference Methods
The Finite Difference Methods(FDM) involve approximating the equation involving
derivates with difference equation. For example,df
dxis taken as
f(x+ h)− f(x)
h
20
Chapter 3. Solution of Poisson’s equation using Finite Difference Methods21
3.2 Mesh/Grid Generation
To apply the difference equation we first 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 = hx, δy = hy. Then coordinates of any point P with index
(i, j) on 2D mesh is given by
x = i ∗ hx y = j ∗ hy
where hx =xmax− xmin
no of divisions + 1hy =
ymax− ymin
no of divisions+ 1.
Here xmax, xmin, ymax, ymin stand for boundary extremes.
Figure 3.1: Domain Grid
3.3 Discretised Poisson’s equation
Now the discretised Poisson’s equation at point P(x,y) for the potential u(x,y) is given
by centralised difference formula is given by,
ui+1,j − 2ui,j + ui−1,j
h2x+ui,j+1 − 2ui,j + ui,j−1
h2y= −f(x, y) (3.1)
Chapter 3. Solution of Poisson’s equation using Finite Difference Methods22
where ui,j = u(xi, yj) and f(x, y) is the load function. With the above difference formula,
the accuracy of the calculated solution depends on the number of divisions of the mesh
and the error is O(h2).
3.4 Matrix Formulation
A system of equations are obtained when the difference formula is applied at each in-
terior mesh point. For 1 ≤ i, j ≤ no of divisions we get N2 number of equations,(N =
no of divisions). These equations can be put in matrix form as follows:
AU = B,
Vector of unknowns : U = [u11, u21, ..., uN1, u12, ...uN2, ..., uNN ]T ,
Right hand side vector : B = h2 [f11, ..., fN1, ..., f1N , ..., fNN ]T
Chapter 3. Solution of Poisson’s equation using Finite Difference Methods23
The N2 ×N2 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 Poisson’s 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 (5N2 in our problem) and can be terminated when we get the
Chapter 3. Solution of Poisson’s equation using Finite Difference Methods24
solution with sufficient 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 ith
equation(1 ≤ i ≤ n) is given byn∑
j=1
aij ∗ xj = bi
can be solved by transforming each equation in to a suitable format. The ith equation
is re–written as
xi =
bi −n∑
j=1j 6=n
aij ∗ xj
aii(3.3)
Jacobi method involves finding 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 ith step involves calculating x(I)i using
the formula:
x(I+1)i =
bi −n∑
j=1 j 6=n
aij ∗ x(I)j
aii(3.4)
Chapter 3. Solution of Poisson’s equation using Finite Difference 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 xi.
x(I+1)i =
bi −i−1∑
j=1
aij ∗ x(I+1)j −
n∑
j=i+1
aij ∗ x(I)j
aii(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−1A)X(I) +B
Chapter 3. Solution of Poisson’s equation using Finite Difference Methods26
The convergence of iterative method depends on the spectral radius (ρ) of the (I−M−1A)
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 finite difference discretizations of parabolic and elliptic partial
differential equations. It was first introduced in mid-1950s by Peaceman and Rachford.
4.1 Motivation
When dealing with multi-dimensional domains, inversion of coefficient matrix A (3.2)
requires lot of effort. 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 finite difference 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.
ui+1,j − 2ui,j + ui−1,j
h2x= −f(x, y)− ui,j−1 − 2ui,j + ui,j+1
h2y(4.1)
ui,j−1 − 2ui,j + ui,j+1
h2y= −f(x, y)− ui−1,j − 2ui,j + ui+1,j
h2y(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)
i−1,j
h2x= −f(x, y)− u
(I)i,j−1 − 2u
(I)i,j + u
(I)i,j+1
h2y(4.3)
u(I+1)i,j−1 − 2u
(I+1)i,j + u
(I+1)i,j+1
h2y= −f(x, y)− u
(I+ 1
2)
i−1,j − 2u(I+ 1
2)
i,j + u(I+ 1
2)
i+1,j
h2y(4.4)
So in each iteration, the discrete equations are solved first 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 difference 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 coefficients for unknowns in x direction
V : Vertical dimension matrix, contains for coefficients for unknowns in y-direction.
B : RHS vector In mathematical terms,
w =2ui,j − ui−1,j − ui+1,j
h2xif w = Hu
Chapter 4. Alternating Direction Implicit(ADI) Method 29
w =2ui,j − ui,j−1 − ui,j+1
h2yif w = V u
In simple words, H and V arise as the central difference approximations of the corre-
sponding terms in the Poisson’s equation.
The H matrix for the the domain described in figure (3.1) is given by:
H =1
h2x
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(xi, yj) for which the
equation is being generated. H matrix row contains a sub–diagonal entry for the preced-
ing point(x = xi−1) and a super–diagonal 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 figure (3.1) is given by:
V =1
h2y
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(xi, yj) in the interior of the
domain in vertical direction. One entry in lower triangular part is non-zero corresponding
to the preceding point (y = yj−1) in the vertical dimension and an entry in upper
triangular part is non-zero corresponding to the next point (y = yj+1)in the vertical
dimension.
This matrix formulation can also be viewed as the coefficient 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(n3) wheren = N2). 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 modified to solve for equations (4.10)
where elimination of non-zero lower-triangular entry below this diagonal element is done
and corresponding row is modified 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 find 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 finding the solution of Laplace equation ∇2u = 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 figure(4.3) is obtained by taking ratio of difference between
analytical solution (fig. 2.3) and numerical solution (fig. 4.2) with analytical solution.
Chapter 4. Alternating Direction Implicit(ADI) Method 33
0
0.5
1
0
0.5
10
0.5
1
xy
Tem
pera
ture
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 Gibb’s Phenomenon [1] ( overshoot
of Fourier series approximation near the discontinuity).
0
0.5
1
0
0.5
10
0.01
0.02
0.03
xy
Rel
ativ
e E
rror
Figure 4.3: Relative error plot between ADI solution and analytical solutionfor Laplace equation on Square domain. No. of Divisions = 99
Generally two different 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 refined mesh near the boundary
2. Higher order approximations(Considering more terms in Taylor series).
Relative error plot inside the domain is given in figure (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
10
1
2
3
4x 10
−4
xy
Rel
ativ
e E
rror
Figure 4.4: Error plot in the interior of the domainfor 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 different 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 IterationsDivisions Jacobi Gauss-Siedel SOR ADI
Method Method Method Method10 237 127 33 3620 964 513 184 14130 2106 1120 412 30940 3629 1932 717 53550 5509 2936 1095 81760 7727 4123 1544 1151100 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 differently for each step upto
m = 2ksteps and cyclically repeated.
Relaxation parameters are recursively calculated by the formula:
r(n)i = r
(2n)i +
αk−1−j βk−1−j
r2ni
i = 1, 2, 3...2j
j = 0, 1, ...k − 1
Lower bound on Eigen values of H and V matrices: α = 4 sin2 π
2(N + 1)
Upper bound on Eigen values of H and V matrices: β = 4 cos2π
2(N + 1)Calculation of bounds:
α0 = α β0 = β
αj+1 =√
αjβj βj+1 =αj + βj
2j = 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=8Divisions Iterations taken Iterations taken Big ADI steps Iterations taken Big ADI steps
10 36 17 4 25 3100 2981 33 8 33 4500 55304 49 12 41 51000 57 14 49 62000 69 17 49 63000 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 find 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 satisfies Poisson equation
∇2V =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 14πǫ0
is 9×109 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.
02
46
0
2
4
60
0.5
1
1.5
2x 10
10
xy
Vol
tage
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
02
46
0
2
4
60
2
4
6
8x 10
−3
xy
Rel
ativ
e E
rror
Figure 4.7: Error plot for Poisson equation on Square domain. No. of Divisions = 100
02
46
0
2
4
60
1
2
3
4x 10
−4
xy
Rel
ativ
e E
rror
Figure 4.8: Error plot in the interior of the domain for Poisson equation on Squaredomain. 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 Difference approximation formula given in equation(6.2) holds when the boundary
is aligned with the grid points. If the boundary is curved and doesn’t intersect at mesh
point as given in the figure (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 figure (5.2) is given in [4].It is as follows:
∇2uo =2
h2
[
uRr(r + l)
+uN
n(n + s)+
uLl(l + r)
+uS
s(s+ n)− lr + ns
lrnsuo
]
(5.1)
5.3 Solution of Laplace equation on a ring domain
Problem statement
To find the electrostatic potential in an annular ring domain(figure 5.3) whose outer
radius(R2 = 1) boundary is maintained at ground voltage and inner radius (R1 = 0.25)
Chapter 5. ADI Method on various domains 41
Figure 5.3: Ring Domain
boundary at voltage 1V
u(r, θ) = 1, r = R1
= 0, r = R2
Numerical Solution
The solution involves solving laplace equation ∇2u = 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 figure5.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 figure (5.5).
Chapter 5. ADI Method on various domains 42
−1
0
1
−1
0
10
0.5
1
xy
Vol
tage
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 find the solution of Poisson’s equation ∇2u = 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 figure (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 figure(5.7)
Chapter 5. ADI Method on various domains 43
−1
0
1
−1
0
1−1
−0.5
0
0.5
1x 10
−4
xy
Err
or
(a) Actual Error
−1
0
1
−1
0
10
1
2
3
4x 10
−4
xy
Rel
ativ
e E
rror
(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 uxx + uyy = 0 in the interior of region bounded by a pair of
hyperbolas x2 − y2 = a2 and y2 − x2 = b2 with boundary conditions
U(x, y) = V when x2 − y2 = a2
= 0 when y2 − x2 = b2
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) = c0 + c1x2 + c2y
2
Chapter 5. ADI Method on various domains 44
−1 −0.5 0 0.5 1−101
0
0.05
0.1
0.15
0.2
0.25
xy
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 c1 = −c2So the general solution is:
U(x, y) = c0 + c1(x2 − y2)
By applying boundary conditions, we get
c0 + c1(a2) = V
c0 + c1(−b2) = 0
Solving we get, c0 = V(
b2
a2+b2
)
c1 = V(
1a2+b2
)
Therefore solution is:
U(x, y) = V
[(
b2
a2 + b2
)
+(
1
a2 + b2
)
(
x2 − y2))
]
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
4x 10
−6
xy
Err
or
(a) Actual Error
−1
0
1
−1
0
1−2
−1
0
1
2x 10
−6
xy
Rel
ativ
e E
rror
(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 x–direction
and decreasing in y–direction. The solution plot is given in the figure(5.9).
−10
0
10
−10
0
100
0.5
1
xy
Volta
ge
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 modified version). However the error is very minimum in the interior
region(figure:5.10).
Chapter 5. ADI Method on various domains 47
−10
0
10
−10
0
10−1
−0.5
0
0.5
1
xy
Err
or
(a) Actual Error
−5
0
5
−5
0
50
0.5
1
1.5x 10
−6
xy
Rel
ativ
e E
rror
(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:
uxx + uyy + uzz = −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 finite difference descretisation described
in section(3.2) the discretised equation at point, as given in figure(6.1) described by index
(i, j, k) with coordinates xi = i ∗ hx, yj = j ∗ hy, zk = k ∗ hz is given by
ui+1,j,k − 2ui,j,k + ui−1,j,k
h2x+
ui,j+1,k − 2ui,j,k + ui,j−1,k
h2y
+ui,j,k+1 − 2ui,j,k + ui,j,k−1
h2z= −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 coefficent 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
uxx + uyy + uzz = 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 five 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 first term involves only x variable and RHS doesn’t have any x variable terms
we conclude that α2 is a constant. Similarly we define 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) = A sinh(γz) +B cosh(γz)
Applying the boundary condition U(x, y, 0) = 0, we get H(0) = 0 so that B = 0 which
gives,
H(z) = A sinh(γz)
Solution of F ′′(x) + α2F (x) = 0 is given by,
F (x) = C sin(αx) +D cos(α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π
Lx)
Similarly, we get
G(y) = E sin(
mπ
Ly)
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
An,m sin(
nπ
Lx)
sin(
mπ
Ly)
sinh (γz)
where γ =√α2 + β2 =
√
(n2 +m2)π
LTo determine the coefficient An,m we use the remaining boundary condition U(x, y, L) =
f(x, y) = V
f(x, y) =∞∑
n,m=1
An,m sinh (γL) sin(
nπ
Lx)
sin(
mπ
Ly)
We see that [An,m sinh (γL)] are the coefficients of 2D Fourier sine series of f(x, y)
Multiply both sides of the above equation with sin(
jπLx)
sin(
lπLy)
and integrate over
x and y. Using orthogonality of sine functions,
∫ L
0dx sin
(
nπ
Lx)
sin(
jπ
Lx)
=
L/2 if j = n
0 j 6= n
An,m =1
sinh(γL)
4
L2
∫ L
x=0
∫ L
y=0f(x, y) sin
(
nπ
Lx)
sin(
mπ
Ly)
dx dy
=1
sinh(γL)
4
L2V∫ L
x=0sin
(
nπ
Lx)
dx∫ L
y=0sin
(
mπ
Ly)
dy
=1
sinh(γL)
4
L2V[
cos(
nπ
Lx)]L
0
[
cos(
mπ
Ly)]L
0
=4 V [1− cos(nπ)] [1− cos(mπ)]
sinh(γL)L2
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]
L2 sinh(γL)sin
(
nπ
Lx)
sin(
mπ
Ly)
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
L2 sinh(γL)sin
(
nπ
Lx)
sin(
mπ
Ly)
sinh(γz) n,m odd
Numerical Solution
Numerical Solution obtained using ADI method is given in figure (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 figure(??). 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 domainNo. 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 different 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] Griffiths, 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 Differential 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 Differential Equations, Journal of the Society for Industrial and Applied
Mathematics 3 (1955), 28–41.
[7] Pivato, M., Linear Partial Differential 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 Difference Schemes for the Dirichlet Problem of
Poisson’s Equation in the Neighbourhood of Corners Numerische Mathematik, 30,
(1978), 315–332.