Karthik M.tech. Project Report

  • Upload
    laxdora

  • View
    230

  • Download
    0

Embed Size (px)

Citation preview

  • 7/31/2019 Karthik M.tech. Project Report

    1/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

  • 7/31/2019 Karthik M.tech. Project Report

    2/65

    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 tomy 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

  • 7/31/2019 Karthik M.tech. Project Report

    3/65

    Abstract

    Alternating Direction Implicit(ADI) method is a Finite Difference Method(FDM) to solve

    partial differential equations. We employ ADI method to solve Poissons 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

  • 7/31/2019 Karthik M.tech. Project Report

    4/65

    Contents

    Acknowledgements i

    Abstract ii

    1 Introduction 11.1 Poissons Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Applications of Poissons equation . . . . . . . . . . . . . . . . . . . . . . 21.3 Properties of Poissons equation . . . . . . . . . . . . . . . . . . . . . . . 5

    2 Analytical Solution to Poissons 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 Poissons equation on circular domain: . . . . . . . . . 17

    3 Solution of Poissons equation using Finite Difference Methods 203.1 Finite Difference Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2 Mesh/Grid Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3 Discretised Poissons 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    4.3 Matrix Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    iii

  • 7/31/2019 Karthik M.tech. Project Report

    5/65

    CONTENTS iv

    4.4 ADI Method Implementation . . . . . . . . . . . . . . . . . . . . . . . . 31

    4.5 Solution of Laplace equation on Square domain . . . . . . . . . . . . . . 324.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

  • 7/31/2019 Karthik M.tech. Project Report

    6/65

    List of Tables

    4.1 Comparision of iterations taken by various iterative methods . . . . . . . 35

    4.2 Cyclic ADI parameters performance comparision . . . . . . . . . . . . . . 36

    v

  • 7/31/2019 Karthik M.tech. Project Report

    7/65

    List of Figures

    2.1 Superposition principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    2.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 . . . . . . . . . . . . . . . . . . . . . . 37

    4.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 . . . . . . . 44

    5.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

  • 7/31/2019 Karthik M.tech. Project Report

    8/65

    Chapter 1

    Introduction

    1.1 Poissons Equation

    Poissons Equation is an elliptic linear inhomogeneous partial differential 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

    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

  • 7/31/2019 Karthik M.tech. Project Report

    9/65

    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, 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 =

    40

    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 Poissons equation.

    We can find the electric potential in the region by solving Poissons equation.

    2V(x,y,z) = 140

    (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(Poissons equation) involving voltage instead of two

    involving gradient and curl.

  • 7/31/2019 Karthik M.tech. Project Report

    10/65

    Chapter 1. Introduction 3

    Derivation of Poissons equation in Electrostatics

    In a given volume, Gausss law in differential form states that the divergence of the

    electric field in a region is proportional to charge enclosed in the region.

    E = 140

    (1.3)

    where stands for charge density. In the absence of changing magnetic field B, Faradays

    law of induction gives

    E = Bt

    = 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 = 140

    (1.5)

    Stationary Heat Equation

    Poissons 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

    Poissons 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.

  • 7/31/2019 Karthik M.tech. Project Report

    11/65

    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

    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

    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 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 = 4G

  • 7/31/2019 Karthik M.tech. Project Report

    12/65

    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 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

  • 7/31/2019 Karthik M.tech. Project Report

    13/65

    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 different represention of the same solution.

  • 7/31/2019 Karthik M.tech. Project Report

    14/65

    Chapter 2

    Analytical Solution to PoissonsEquation

    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

  • 7/31/2019 Karthik M.tech. Project Report

    15/65

    Chapter 2. Analytical Solution to Poissons 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. 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 infinite domain.

    5. Superposition principle Laplace equation is linear so that combination of solutionsis 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 twoboundaries 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 infigure (2.1).

    Solution of Poisson equation for given boundary conditions can be found by adding

  • 7/31/2019 Karthik M.tech. Project Report

    16/65

    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 figure(2.2)

    Figure 2.2: Superposition principle

    Mathematically solution of 2U = f(x, y) for U = g(x, y) on boundary isgiven 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 .

  • 7/31/2019 Karthik M.tech. Project Report

    17/65

    Chapter 2. Analytical Solution to Poissons Equation 10

    6. Eigen function expansions: Solution of inhomogenuous differential 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 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 for0 < 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)

  • 7/31/2019 Karthik M.tech. Project Report

    18/65

    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 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 =nL where n = 1, 2 . . .

    The solution of (2.8) is given by

    F(x) = Cey + Dey

    = C1 sinh(y) + D1 cosh(y)

  • 7/31/2019 Karthik M.tech. Project Report

    19/65

    Chapter 2. Analytical Solution to Poissons 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

    ny

    L

    sin

    nx

    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)

    L0

    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) sinhny

    L

    sinnx

    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

  • 7/31/2019 Karthik M.tech. Project Report

    20/65

    Chapter 2. Analytical Solution to Poissons Equation 13

    2.2.1 Solution of Poisson equation on square domain:

    Problem Statement

    To solve Poisson equation

    uxx + uyy = 140

    (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 2u = q(x, y) for homogeneous dirichlet bound-ary conditions can be given in terms of eigenfunctions of the Laplacian operator: sin

    nxL

    sinmyL

    i.e. Let the solution vector u be:

    u =

    m,n=1

    Km,n sin

    nxL

    sin

    myL

    Then,

    2u = uxx + uyy=

    (m2 + n2)2

    L2Km,n sin

    nx

    L

    sin

    my

    L

    =(m2 + n2)2

    L2 u

    So in order to find the solution of Poisson equation, we express charge density in

    terms of eigen functions sinnxL

    sinmyL

    with the help of two dimensional Fourier

    sine series

    (x, y) =

    m,n=1

    Qn,m sin

    nx

    L

    sin

    my

    L

    (2.15)

  • 7/31/2019 Karthik M.tech. Project Report

    21/65

    Chapter 2. Analytical Solution to Poissons Equation 14

    where Qn,m is given by the fourier series coefficient:

    Qn,m =4

    L2

    L0

    L0

    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

    Qn,mL2

    (m2 + n2)2sin

    nx

    L

    sin

    my

    L

    (2.17)

    For the given problem, fourier series coefficients of unit charge density is given by,

    Qn,m =4

    L2

    L0

    L0

    040

    sin

    nx

    L

    sin

    my

    L

    dxdy

    =16

    nm20

    40n, 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

    40

    16L2

    m n (m2 + n2)4 sinnx

    L

    sinmy

    L

    (2.18)

    02

    46

    0

    2

    4

    60

    0.5

    1

    1.5

    2

    x 1010

    xy

    Voltage

    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

  • 7/31/2019 Karthik M.tech. Project Report

    22/65

    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

    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

    r22

    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:

  • 7/31/2019 Karthik M.tech. Project Report

    23/65

    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) = rn and R(r) = rn

    Thus general solution of Laplace Equation on ring is:

    u(r, ) = a0 +n

    anrn cos(n) +n

    anrn cos(n)

    + b0 ln r +n

    bnrn sin(n) +n

    bnrn 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, ) =ln R2 ln rln R2 ln R1 (2.23)

    2.2.4 Solution of Laplace equation on circular domain:

    Problem Statement

    To solve Laplace equation2u

    r2+

    1

    r

    u

    r+

    1

    r22u

    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 sothat 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 Greens function which is given

  • 7/31/2019 Karthik M.tech. Project Report

    24/65

    Chapter 2. Analytical Solution to Poissons Equation 17

    by Poissons 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 x2x s2

    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

    21 2rR

    cos( ) +rR

    2

    So the solution on circular disk is given by Poissons Integral formula:

    u(r, ) =1

    2

    f()1 rR

    21 2rR

    cos( ) +rR

    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 2u = q(r, ) i.e.

    2u

    r2+

    1

    r

    u

    r+

    1

    r22u

    2= q(r, ) (2.27)

  • 7/31/2019 Karthik M.tech. Project Report

    25/65

    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 = 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)() + 1rR(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 Bessels equation. The solution of (2.30) is given in terms

    of Bessels 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

  • 7/31/2019 Karthik M.tech. Project Report

    26/65

    Chapter 2. Analytical Solution to Poissons 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 Poissons 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)

    R0

    q(r, )Jn

    knmr

    R

    cos(n) rdrd

    Bnm =

    2

    R2J2n+1(knm)R0 q(r, )Jnknmr

    R

    sin(n) rdrd

    Then the solution of Poissons equation is given by,

    u(r, ) = n=0

    m=1

    R2Anmk2nm

    Jn

    knmr

    R

    cos(n)

    n=1

    m=1

    R2Bnmk2nm

    Jn

    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 Poissons equation is given by

    u(r, ) =n=0

    2R2

    k30mJ1(k0m)J0

    k0mr

    R

    (2.32)

    where radius R = 1

  • 7/31/2019 Karthik M.tech. Project Report

    27/65

    Chapter 3

    Solution of Poissons equation usingFinite Difference Methods

    It is not always possible to solve differential 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 involveevaluating 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

  • 7/31/2019 Karthik M.tech. Project Report

    28/65

    Chapter 3. Solution of Poissons 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 yminno 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 difference formula is given by,

    ui+1,j 2ui,j + ui1,jh2x

    +ui,j+1 2ui,j + ui,j1

    h2y

    = f(x, y) (3.1)

  • 7/31/2019 Karthik M.tech. Project Report

    29/65

    Chapter 3. Solution of Poissons 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

  • 7/31/2019 Karthik M.tech. Project Report

    30/65

    Chapter 3. Solution of Poissons equation using Finite Difference Methods23

    The N2 N2 matrix A is given by

    A =

    4 1 11 . . . . . . . . .

    . . .. . . 1 . . .1 4 1

    1 4 1 . . .. . . 1 . . . . . . . . .

    . . . . . . . . . 1 . . .1 1 4 . . .

    . . .. . . 1

    . . .. . .

    . . .

    . . . . . . . . .

    . . .. . . 1

    1 4 1. . . 1 . . . . . .

    . . .. . .

    . . . 11 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 (5N2 in our problem) and can be terminated when we get the

  • 7/31/2019 Karthik M.tech. Project Report

    31/65

    Chapter 3. Solution of Poissons 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 rewritten as

    xi =

    bi n

    j=1j=n

    aij xjaii

    (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=1j=naij x(I)j

    aii(3.4)

  • 7/31/2019 Karthik M.tech. Project Report

    32/65

    Chapter 3. Solution of Poissons 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 i1j=1

    aij x(I+1)j n

    j=i+1

    aij x(I)jaii

    (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) = (MA)X(I) + B X(I+1) = (IM1A)X(I) + B

  • 7/31/2019 Karthik M.tech. Project Report

    33/65

    Chapter 3. Solution of Poissons equation using Finite Difference Methods26

    The convergence of iterative method depends on the spectral radius () of the (IM1A)matrix.

    For an iterative method to converge, the spectral radius () should be less thanone.

    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) andGauss-Siedel method (H) are related by

    (H) = (J)2

    For SOR method, the optimal parameter b is given by ,

    b = 21 +

    1 (J)2

    (H(b) =

    (J)

    1 +

    1 (J)2

    2

    Therefore Gauss-Siedel method converges twice as fast as Jacobi method and SORmethod 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.

  • 7/31/2019 Karthik M.tech. Project Report

    34/65

    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

  • 7/31/2019 Karthik M.tech. Project Report

    35/65

    Chapter 4. Alternating Direction Implicit(ADI) Method 28

    remaining terms are carried to the right hand side.

    ui+1,j 2ui,j + ui1,jh2x

    = f(x, y) ui,j1 2ui,j + ui,j+1h2y

    (4.1)

    ui,j1 2ui,j + ui,j+1h2y

    = f(x, y) ui1,j 2ui,j + ui+1,jh2y

    (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+12 )

    i+1,j 2u(I+ 12 )i,j + u(I+ 12 )i1,jh2x

    = f(x, y) u(I)i,j1 2u(I)i,j + u(I)i,j+1

    h2y(4.3)

    u(I+1)i,j1 2u(I+1)i,j + u(I+1)i,j+1

    h2y= f(x, y) u

    (I+ 12)

    i1,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

    ui1,j

    ui+1,j

    h2x if w = Hu

  • 7/31/2019 Karthik M.tech. Project Report

    36/65

    Chapter 4. Alternating Direction Implicit(ADI) Method 29

    w =2ui,j ui,j1 ui,j+1

    h2

    y

    if w = V u

    In simple words, H and V arise as the central difference approximations of the corre-

    sponding terms in the Poissons 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. . . . . . . . .

    . . . . . . . . .

    . . . . . . 11 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 subdiagonal entry for the preced-

    ing point(x = xi1) 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.

  • 7/31/2019 Karthik M.tech. Project Report

    37/65

    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 11 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 = yj1) 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

  • 7/31/2019 Karthik M.tech. Project Report

    38/65

    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+ 12 ) + B (4.10)

    Each iteration step involves solving a matrix equation which is costly if we employ

    Gaussian elimination (O(n3) where n = 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.

  • 7/31/2019 Karthik M.tech. Project Report

    39/65

    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 squaredomain. 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.

  • 7/31/2019 Karthik M.tech. Project Report

    40/65

    Chapter 4. Alternating Direction Implicit(ADI) Method 33

    0

    0.5

    1

    0

    0.5

    10

    0.5

    1

    xy

    Temperature

    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

    10

    0.01

    0.02

    0.03

    xy

    RelativeError

    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

  • 7/31/2019 Karthik M.tech. Project Report

    41/65

  • 7/31/2019 Karthik M.tech. Project Report

    42/65

  • 7/31/2019 Karthik M.tech. Project Report

    43/65

    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 5

    1000 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 SolutionThe electro static potential(Voltage) in a closed region with charge density contained

    inside satisfies Poisson equation

    2V = 140

    (4.11)

    where V stands for Voltage or electro static potential. The value of the constant, permi-

    tivity of free space is 140

    is 9109 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

  • 7/31/2019 Karthik M.tech. Project Report

    44/65

    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

    2

    x 1010

    xy

    Voltage

    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).

  • 7/31/2019 Karthik M.tech. Project Report

    45/65

    Chapter 4. Alternating Direction Implicit(ADI) Method 38

    02

    46

    0

    2

    4

    60

    2

    4

    6

    8

    x 103

    xy

    RelativeError

    Figure 4.7: Error plot for Poisson equation on Square domain. No. of Divisions = 100

    02

    46

    0

    2

    4

    60

    1

    2

    3

    4

    x 104

    xy

    RelativeError

    Figure 4.8: Error plot in the interior of the domain for Poisson equation on Squaredomain. No. of Divisions = 100

  • 7/31/2019 Karthik M.tech. Project Report

    46/65

    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 doesnt 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

  • 7/31/2019 Karthik M.tech. Project Report

    47/65

    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 = 2h2

    uR

    r(r + l)+

    uNn(n + s)

    +uL

    l(l + r)+

    uSs(s + n)

    lr + nslrns

    uo

    (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)

  • 7/31/2019 Karthik M.tech. Project Report

    48/65

    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).

  • 7/31/2019 Karthik M.tech. Project Report

    49/65

    Chapter 5. ADI Method on various domains 42

    1

    0

    1

    1

    0

    10

    0.5

    1

    xy

    Voltage

    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 Poissons equation 2u = 1 on a circular disk of radius R = 1with 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 atthe 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)

  • 7/31/2019 Karthik M.tech. Project Report

    50/65

    Chapter 5. ADI Method on various domains 43

    1

    0

    1

    1

    0

    11

    0.5

    0

    0.5

    1

    x 104

    xy

    Error

    (a) Actual Error

    1

    0

    1

    1

    0

    10

    1

    2

    3

    4

    x 104

    xy

    RelativeError

    (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

  • 7/31/2019 Karthik M.tech. Project Report

    51/65

    Chapter 5. ADI Method on various domains 44

    1 0.5 0 0.5 1101

    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

  • 7/31/2019 Karthik M.tech. Project Report

    52/65

    Chapter 5. ADI Method on various domains 45

    1

    0

    1

    1

    0

    14

    2

    0

    2

    4

    x 106

    xy

    Error

    (a) Actual Error

    1

    0

    1

    1

    0

    12

    1

    0

    1

    2

    x 106

    xy

    Re

    lativeError

    (b) Relative Error in interior

    Figure 5.7: Error plots for solution of Poisson equation on circular disk

    Figure 5.8: Hyperbola Domain

  • 7/31/2019 Karthik M.tech. Project Report

    53/65

    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 figure(5.9).

    10

    0

    10

    10

    0

    100

    0.5

    1

    xy

    Voltage

    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).

  • 7/31/2019 Karthik M.tech. Project Report

    54/65

  • 7/31/2019 Karthik M.tech. Project Report

    55/65

    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 + ui1,j,kh2x

    +ui,j+1,k 2ui,j,k + ui,j1,k

    h2y

    +ui,j,k+1 2ui,j,k + ui,j,k1

    h2z= f(x,y,z) (6.2)

    48

  • 7/31/2019 Karthik M.tech. Project Report

    56/65

    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

  • 7/31/2019 Karthik M.tech. Project Report

    57/65

    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 onthe other five faces.

    i.e. forx, 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 isexpressed 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

  • 7/31/2019 Karthik M.tech. Project Report

    58/65

    Chapter 6. ADI Method on 3-D Domains 51

    Since the first term involves only x variable and RHS doesnt 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) = Csin(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, = nL

    , n = 1,2,...

    which gives

    F(x) = Csin

    nL

    x

    Similarly, we get

    G(y) = Esin

    m

    Ly

    So the solution to the Laplace equation can be written as

  • 7/31/2019 Karthik M.tech. Project Report

    59/65

    Chapter 6. ADI Method on 3-D Domains 52

    U(x,y,z) =

    n,m=1

    An,m sin

    nL

    x

    sin

    mL

    y

    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=1An,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 sinjL

    x

    sinlL

    y

    and integrate over

    x and y. Using orthogonality of sine functions,

    L0

    dx sin

    n

    Lx

    sin

    j

    Lx

    =

    L/2 if j = n

    0 j = n

    An,m =1

    sinh(L)

    4

    L2

    Lx=0

    Ly=0

    f(x, y) sin

    n

    Lx

    sin

    m

    Ly

    dxdy

    =1

    sinh(L)

    4

    L2VLx=0

    sin

    n

    Lx

    dxLy=0

    sin

    m

    Ly

    dy

    =1

    sinh(L)

    4

    L2V

    cos

    n

    LxL

    0

    cos

    m

    LyL

    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)

  • 7/31/2019 Karthik M.tech. Project Report

    60/65

    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 104 in the interior region. Thus

    ADI method works well for 3-D Domains also.

  • 7/31/2019 Karthik M.tech. Project Report

    61/65

    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

  • 7/31/2019 Karthik M.tech. Project Report

    62/65

    Chapter 6. ADI Method on 3-D Domains 55

    Figure 6.3: Error plot for Laplace equation on Cube domain

    No. of Divisions =100

  • 7/31/2019 Karthik M.tech. Project Report

    63/65

    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 ADImethod 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 theinput 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

  • 7/31/2019 Karthik M.tech. Project Report

    64/65

    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), 2841.

    [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

  • 7/31/2019 Karthik M.tech. Project Report

    65/65

    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

    Poissons Equation in the Neighbourhood of Corners Numerische Mathematik, 30,

    (1978), 315332.