Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

Embed Size (px)

Citation preview

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    1/12

    [email protected] www.tjprc.org

    International Journal of Mathematics andComputer Applications Research (IJMCAR)ISSN(P): 2249-6955; ISSN(E): 2249-8060Vol. 4, Issue 6, Dec 2014, 75-86 TJPRC Pvt. Ltd.

    TWO FULL MULTIGRID ALGORITHMS IN CARTESIAN AND POLAR

    COORDINATE SYSTEMS TO SOLVE AN ELLIPTIC PARTIAL DIFFERENTIAL

    EQUATION WITH A MIXED DERIVATIVE TERM IN A QUARTER OF A UNIT CIRCLE

    OSAMA EL-GIAR

    Department of Basic Science, Modern Academy for Engineering and Technology in Maadi, Cairo, Egypt

    ABSTRACT

    In this paper we introduce two full multigrid algorithms in a Cartesian and a Polar coordinate system that have

    been modified to treat the elliptic partial differential equations with a mixed derivative term, in the two dimensional space

    in a quarter of a unit circle, special modification for the points in the neighborhood of the curved boundary has been done.

    An advantage of the two algorithms is that the extension from two to three space dimensions is straightforward. numerical

    examples have been given.

    KEYWORDS: Multigrid Method, Numerical Analysis, Elliptic PDE, Cartesian and Polar Co-Ordinate Systems

    1 FULL MULTIGRID ALGORITHMS IN CARTESIAN COORDINATES

    1.1 INTRODUCTION

    Consider the general linear elliptic partial differential equation:

    LU = AU xx + 2BU xy + CU yy + F = 0 R 2 (1.1a)

    with Dirichlet boundary conditions

    U = F R 2 (1.1b)

    Where is a quarter of a unit circle. A difference approximation L h of L in equation 1.1a

    is said to be of order p if L h(U) = O(hp), where h is the mesh size. In our case p = 2, so we

    shall use the 6-point difference equation to the mixed derivative term U xy to avoid the absent

    points in our grids because of the curved boundary see [3] and [4]

    1.2 Finite Difference Discretizaton

    For each grid we replace each term in equation 1.1a by a second order finite difference approx-

    imation for two kinds of points as follows:

    1.Normal Points: These points are interior points are not laying near the curved boundary:

    for a grid with mesh size is h, we have the following discretizaton:

    U xx = h2 (u i+1,j + u i1,j 2u i,j )

    U yy = h2 (u i,j+1 + u i,j1 2u i,j ) (1.2)

    U xy = h 2 (u i,j u i1,j u i,j1 + u i1,j1 )

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    2/12

    76 Osama El-Giar

    Impact Factor (JCC): 4.2949 Index Copernicus Value (ICV): 3. 0

    Substitute these values in equation 1.1a we get the following system of linear equations for normal

    points:

    (1.3)

    2.Curved Boundary Points: These points are points that laying near the curved boundary:

    see [4] and Figure 1 When the boundary is curved and intersects the rectangular grid at

    points that are not grid points, so we shall

    Figure 1: Curved Mesh

    Give the finite difference approximation to the derivatives at the points in the neighborhood of the

    curved boundary thus:

    ( )

    ++

    += +

    ji ji j j xx uuuhU ,,1,1

    2 2)1(

    21

    2

    ( )

    ++

    += +

    ji ji ji yy uuuhU ,1,1,

    2 21

    2)1(

    2

    (1.4)

    Uxy = h 2 (u i,j u i1,j u i,j1 + u i1,j1 )

    Substituting 1.4 into 1.1a we get a system of linear equations for the points in the neighborhood

    of the curved boundary given by:

    ( ) ( ) 1,,

    ,1,,

    ,1,

    12

    12

    12

    ++

    ++

    ++

    + ji ji

    ji ji ji

    ji jai ucubau

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    3/12

    Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic 77 Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

    [email protected] www.tjprc.org

    ji ji ji ji ji

    ji ji ji ji

    ji f hububca

    ubc

    ,2

    1,1,,,,,

    1,,, 22

    12 =+

    +

    +

    + (1.5)

    Where 1 i,j N 1, ,1

    1

    +=

    N h N is the number of interior points in each direction h, h

    are the distances from the point in the neighborhood of the boundary and the curve boundary in

    direction of the x-coordinate and the y-coordinate respectively.

    1.3 Multigrid Method

    A sequence of 5 grids kh have been used with mesh sizes kh, k = 2n , n = 0, 1, 4,

    where h = 64. The elliptic equation have been solved using full multigrid V ( 1 , 2)-cycle

    method with the coarse grid correction (CGC), see Figure 2 and has the following components:

    1. Coarse to Fine Interpolation with Operator I h

    h2 : Within the V-cycle, we will use correction

    interpolation where corrections are to be interp olated from coarser grids and added to finer grids and the full

    multigrid interpolation where current values of the approximate solution on the coarser grid are interpolated as the first

    approximation to the solution (on the first visit to the grid) on the finer grids, see [2], we choose for both cases of

    interpolations the bilinear interpolation. Now we have two kinds of points see figure 3:

    Figure 2: FMG V (2, 1)

    (a) Normal Points:

    uu h

    ji

    h

    ji

    2

    ,2,2 = for common points in the two grids, (point 13)

    ( )21 2

    ,1

    2

    ,2,12 uuu h

    ji

    h

    ji

    h

    ji ++ += for odd points in the x direction, (point 12)

    ( )21 2

    1,

    2

    ,12,2 uuu h

    ji

    h

    ji

    h

    ji ++ += for odd points in the y direction, (point 8)

    ( )41 2

    1,1

    2

    1,

    2

    ,1

    2

    ,12,12 uuuuu h

    ji

    h

    ji

    h

    ji

    h

    ji

    h

    ji ++++++ +++= for remaining points in, (point 7) (1.6)

    (B) Curved Boundary Points

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    4/12

    78 Osama El-Giar

    Impact Factor (JCC): 4.2949 Index Copernicus Value (ICV): 3. 0

    Since we have used red- black gauss-Seidel iteration, then we need interpolation only for odd points in

    the x and y directions respectively defined by

    for odd points in the x direction, (point 14)

    +

    +=

    ++ 1 2

    1,

    2

    ,12,2 huuu h

    ji

    h

    ji

    h

    ji h for odd points in the direction, (point 19) (1.7)

    Figure 3: Numbering Two Grids

    2. Fi ne to Coarse Restriction Operator: The restriction operator denoted by I h

    h

    2 takes the residual equation

    computed on the fine-grid and transfer it to the coarse-grid according to the rule: hhhh R R I 22 = where the

    components of hij R2 of h R 2 are given by the following two schemes- see [2] and [3]:

    (a) Half-Weight: If B = 0 in equation 1.1a, we use the red-black Gauss-Seidel relaxation it is better to use thehalf-weight operator since the residual at the black (odd) points must vanish and the stencil of the half-weight operator

    takes the form:

    h

    h

    h

    h I

    2

    2

    010

    141

    010

    81

    = (1.8)

    (b) Full-Weight: If B = 0 in equation 1.1a, we use the red-black Gauss-Seidel relaxation, so we may use either the

    half-weight operator or the full-weight operator, or it is better to use the half-weight operator for normal points and

    full-weight operator for curved boundary points. The stencil of the full-weight operator takes the form:

    h

    h

    h

    h I

    2

    2

    121

    242

    121

    161= (1.9)

    1.4 Test Problems, Results and Performance

    In this section we report the results and performance of some test problems All our implemen-tations in

    Fortran were executed on a pentium 4 PC using FORTRAN90 workstation compiler.

    The accuracy of the method is measured by both L 2 norm of both defect and error and the

    max norm of both defect and the error. The general formula for the test problem is given by :

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    5/12

    Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic 79 Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

    [email protected] www.tjprc.org

    21

    21

    AU xx + 2BU xy + CU yy + F = 0 R2

    Consider the following test problems:

    1. Test Problem 1: Let A = C = 1, B = 0 using half-weight restriction:

    Uexact = e 2xy , F (x,y) = 4(x2 + y 2)e 2xy (1.10a)

    Uexact = sin(3x + y), F (x,y) = 10 sin(3x + y) (1.10b)

    2. Test Problem 2: Let A = C = B = 1, using half-weight restriction:

    Uexact = e 2xy , F (x,y) = 4(x2 + y 2 + xy + )e 2xy (1.11a)

    Uexact = sin(3x + y), F (x, y) = 13 sin(3x + y) (1.11b)

    3. Test Problem 3: Let A = C = B = 1, using full-weight restriction:

    Uexact = e 2xy , F(x,y)=4(x 2 +y 2 +xy+ )e 2xy (1.12a)

    Uexact = sin(3x + y), F (x, y) = 13 sin(3x + y) (1.12b)

    Test Problem 1: Equation 1.10a and Equation 1.10b

    Table 1: Fortran Implementation of Test Problem 1 Using F M V (2, 1) on PC

    Test Problem 2: Equation 1.11a and Equation 1.11b

    Table 2: Fortran Implementation of Test Problem 2 Using F M V (2, 1) on PC

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    6/12

    80 Osama El-Giar

    Impact Factor (JCC): 4.2949 Index Copernicus Value (ICV): 3. 0

    Test Problem 3: Equation 1.12a and Equation 1.12b

    Table 3: Fortran Implementation of Test Problem 3 Using F M V (2, 1) on PC

    2 Full Multigrid Algorithms in Polar Coordinates

    2.1 Introduction

    A multigrid algorithm has been modified to treat the elliptic boundary value problem for partial differential

    equations with a mixed derivative term in two dimensional space in polar coordinates. A full multigrid algorithm in which

    W ( 1, 2) with a line relaxation scheme are used to deal with the finite difference approximation of the mixed derivative

    term in polar coordinates. Full weight restriction of residuals and linear interpolation operators are used. Numerical

    examples are given.

    Consider the elliptic partial differential equation with a mixed derivative term U r in polar coordinates which is

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    7/12

    Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic 81 Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

    [email protected] www.tjprc.org

    equivalent to equation 1.1 with A = C = 1, B =21

    :

    (1 + sin cos ) U rr + r 1

    (1 sin cos ) U r + 21r (1 sin cos ) U

    ( ) ( ) =++ ),,(sincos1 cossin1 22222 r F U r U r r (2.1)

    where ( ) =4

    00,10,, r r , subject to the dirchlit boundary conditions:

    = gU (2.2)

    2.2 Finite Difference Discretizaton

    For each grid we replace each term in equation 2.1 by a second order finite approximation as follows

    see Figure 4

    U rr = h2 (u i+1,j + u i1,j 2 ui,j )

    U r = (2h)1 (u i+1,j u i1,j )

    U = ( ) 2 (u i,j+1 + u i,j1 2 ui,j ) (2.3)

    U = (2 ) 1 (u i,j+1 u i,j1 ) and

    U r = (4h )1

    (u i+1,j+1 + u i1,j1 u i+1,j1 u i1,j+1 )

    Figure 4 : Descritization of a Quarter of a Unit Circle

    substitute these values in equation 2.1 we get the following system of linear equations:

    =

    1

    2

    1

    1

    2

    1

    11

    111

    11

    111

    11

    0...0

    ...0

    0............

    010

    0...

    0...0

    N N b

    b

    b

    u

    u

    u

    DC

    B DC

    B DC

    B DC

    B D

    M

    M

    M

    M (2.4)

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    8/12

    82 Osama El-Giar

    Impact Factor (JCC): 4.2949 Index Copernicus Value (ICV): 3. 0

    where 1 I, j N 1, h1

    1+ N

    , =( )12

    1+ N

    , are the mesh size and

    D 1 = 2( )

    ++ 2sin2

    1

    1

    1

    2sin2

    1

    1 2i

    B 1=( )

    22 22cos

    2sin21

    11

    ii

    (2.5)

    C 1=( )

    22 2

    2cos2sin

    21

    11

    ii+

    where N is the number of interior points in each direction

    2.3 Multigrid Method

    A sequence of 5 grids kh have been used with mesh sizes kh, k = 2 n , n = 0, 1, 4,

    Where h =641

    . The elliptic equation have been solved using full multigrid W-cycle method with the coarse

    grid correction (CGC), see Figure 5 and has the following components:

    Figure 5: FMG W-Cycle

    Line Relaxation: Since the finite difference approximation of the mixed derivative term contains the four corner

    points, then a scheme of line-relaxation should be used, (first we may first relax the solution at even (odd) lines, then relax

    at the odd (even) lines, this gives the tridiagonal system of linear equation 2.4.

    Interpolation Operator I h

    h2: It takes coarse-grid vectors u 2h defined on G 2h and produces fine grid vectors u h

    defined on G h using I h

    h2 hu 2 = hu , the components of u h are divided into 4 groups as follows- see figure 4:

    (a) Common points of the two grids

    h ji

    h ji uu

    2,2,2 = (point 5) (2.6)

    (b) Radial points

    ( )uuu h jih jih ji 2 ,12,122,12 21 ++ += (points 4, 6) ` (2.7)

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    9/12

    Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic 83 Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

    [email protected] www.tjprc.org

    (c) Angle points

    ( )uuuuu h jih jih jih jih ji 22,1222,122,122,1212,2 41

    +++++ +++= (points 2, 8) (2.8)

    where the right hand side is obtained from 2.7.

    (d) Intermediate points: They are two kinds:

    i. Points are not in the neighborhood of the center of the circle

    ( )uuuuu h jih jih jih jih ji 2 1,12 1,2 ,12,12,12 41

    ++++++ +++= (points 3, 9) (2.9)

    ii. Points are in the neighborhood of the center of the circle

    ( )uuuu h

    ji

    h

    ji

    h

    ji

    h

    ji

    2

    1,1

    2

    ,1

    2

    ,12,12 31

    +++++ ++= (points 1, 7) (2.10)

    Restriction Operator hh I 2 : It takes fine grid vectors R h defined on G h and produces coarse grid vectors R 2h

    defined on G 2h using hh I 2 h R = h R 2 since we use the line relaxation for every grid it is better to use the full-weight

    restriction operator whose stencil takes the form:

    ( )( )

    ( )

    ( )

    ( )

    ( )

    h

    h

    hh i

    i

    i

    i

    is

    i

    iii

    I

    2

    2

    2

    2

    2

    2

    2

    121

    12

    1

    2

    112

    121

    12

    1

    18

    1

    +

    +

    =

    (2.11)

    2. 4 Test Problems, Results and Performance

    In this section we report the results and performance of some test problems All our implementations in Fortran

    were executed on a pentium 4 PC using FORTRAN90 workstation compiler. The accuracy of the method is measured by

    both L 2 norm of both defect and error and the max norm of both defect and the error. Consider the following test

    problems: Consider the following test problems:

    1. Test Problem 1:

    Uexact = 3e 0.5r2 sin cos + 2r 2 sin cos (2.12)

    2. Test Problem 2:

    Uexact =24 )cos(sin r e (2.13)

    3. Test Problem 3:

    Uexact = sin (r2 sin cos + 1 ) (2.14)

    4. Test Problem 4:

    Uexact = r 6 (sin cos )3 + 3r 4 (sin cos )2 +6r 2 (sin cos ) + 2 (2.15)

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    10/12

    84 Osama El-Giar

    Impact Factor (JCC): 4.2949 Index Copernicus Value (ICV): 3. 0

    5. Test Problem 5:

    Uexact =2r e (sin

    cos ) (2.16)

    Test Problem 1: Equation 2.12Table 4: Fortran Implementation of Test Problem 1 Using F M W (2, 1) on PC

    Test Problem 2: Equation 2.13Table 5: Fortran Implementation of Test Problem 2 Using F M W (2, 1) on PC

    Test Problem 3: Equation 2.14

    Table 6: Fortran Implementation of Test Problem 3 Using F M W (2, 1) on PC

    Test Problem 4: Equation 2.15

    Table 7: Fortran Implementation of Test Problem 5 Using F M W (2, 1) on PC

    Test Problem 5: Equation 2.16

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    11/12

    Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic 85 Partial Differential Equation with a Mixed Derivative Term in a Quarter of a unit Circle

    [email protected] www.tjprc.org

    Table 8: Fortran Implementation of Test Problem 5 Using F M W (2, 1) on PC

    3. CONCLUSIONS

    The implementation of an elliptic partial differential equation in the 2-dimensional space in a quarter of a unit

    circle have been shown to be an efficient method. The convergence rate of the method in Cartesian coordinates has been

    improved as we increase the number of relaxation steps before coarse grid correction, in the polar coordinates we should

    use the W-cycle instead of V-cycle to achieve almost the same or a little bit better convergence rate than that of the method

    in Cartesian coordinates. The other advantage of the two algorithms in Cartesian and in Polar coordinates is that the

    extension from two to three space dimensions is straightforward.

    REFERENCES

    1. Brandt A., Multi-level adaptive technique (MLAT) for fast numerical solution to bound-ary value problem,

    Springer, Berlin - 1973.

    2.

    Briggs L., A Multigrid Tutorial, Society for Industrial and applied mathematics - 2000.

    3. Hackbucsh W., Multigrid Methods and applications, Springer Berlin Heidelberg Berlin,- 2003.

    4. G. D. Smith, Numerical Solution of Partial Differential Equations: Finite Difference Methods., Oxford

    Applied Mathematics & Computing Science Series, - January 16, 1986.

    5. McCormick S. F., Mulitigrid Methods, SIAM, Phildelphia-Pennsylvania - 1987

    6. Briggs W. L, Mulitigrid tutorial, SIAM, Phildelphia-Pennsylvania - 1987

    7. John D. Anderson, Jr. Computational Fluid Dynamics: The Basics with Applications, McGraw-Hill Inc, - 1995.

    8. J.E. Dennis and R.B. Schnabel, Numerical Methods for Unconstrained Optimization

    and Nonlinear Equations, SIAM Books, Philadelphia, - 1996.

    9. J.C. Tannehill, D.A. Anderson, Computational Fluid Mechanics and Heat Transfer,

    Second Edition , Series in Computational and Physical Processes in Mechanics and Thermal Sciences., - April 1,

    1997.

    10. W. L. Briggs, V. E. Henson, and S. F. McCormick, A Multigrid Tutorial, Second Edition SIAM Books,

    Philadelphia - 2000

    11. Bobby Philip, An Introduction to Multigrid Techniques The Institute for Mathematics and Its Applications,

    Minnesota - January 11, 2008.

  • 8/10/2019 Two Full Multigrid Algorithms in Cartesian and Polar Coordinate Systems to Solve an Elliptic Partial Differential Equ

    12/12