template of finite difference coefficients

13
CE 341/441 - Lecture 14 - Fall 2004 p. 14.1 LECTURE 14 PRA CTICAL ISSUES IN APPL YING FINITE DIFFERENCE APPR O XIMA TIONS Deri v ati v es of V ariable Coefficients Consider the term where is a coefficient which is a function of Proceed in steps. First let: Now evaluate: d dx ----- gx ( 29 df x ( 29 dx ------------- g x u gx ( 29 df dx ----- du dx ----- u i 1 ( 29 =

Upload: nirmalramya

Post on 17-Dec-2015

234 views

Category:

Documents


2 download

DESCRIPTION

Finite Element Method

TRANSCRIPT

  • CE 341/441 - Lecture 14 - Fall 2004

    LECTURE

    PRACTIC ATIONS

    Derivatives

    Consider

    where i

    Proceed i

    Now eval

    gp. 14.1

    14

    AL ISSUES IN APPLYING FINITE DIFFERENCE APPROXIM

    of Variable Coefficients

    the term

    s a coefficient which is a function of

    n steps. First let:

    uate:

    ddx------ g x( )

    df x( )dx-------------

    x

    u g x( )dfdx------

    dudx------ ui

    1( )=

  • CE 341/441 - Lecture 14 - Fall 2004

    Now evalp. 14.2

    uate and

    hi

    i-1 ii-1/2 i+1/2 i+1

    hi+1

    x x

    ui1( )

    ui 12---+

    ui 12---

    12--- hi hi 1++( )------------------------------=

    ui 12---+

    ui 12---

    ui 12---+

    gi 12---+

    fi 12---+

    1( ) gi 12---+

    f i 1+ f ihi 1+

    ----------------------

    = =

    ui 12---

    gi 12---

    fi 12---

    1( ) gi 12---

    f i f i 1hi

    ----------------------

    = =

  • CE 341/441 - Lecture 14 - Fall 2004

    Hence

    where

    When

    Example

    Fluids

    Solids

    h

    h =p. 14.3

    , then the approximation reduces to:

    Applications with variable coefficients:

    : spatially varying viscosities/diffusivities

    : spatially varying elasticities

    ui1( ) f i 1+

    gi 1/2+havghi 1+----------------------- f i

    gi 1/2+havghi 1+-----------------------

    gi 1/2havghi----------------+ f i 1

    gi 1/2havghi----------------+=

    avghi hi 1++

    2----------------------

    hi 1+ hi=

    ui1( ) 1

    h2----- f i 1+ gi 12---+

    f i gi 12---+g

    i 12---+ f i 1 gi 12---+=

  • CE 341/441 - Lecture 14 - Fall 2004

    Two Dimen

    Define no

    = sp

    = sp

    i

    jp. 14.4

    sional Finite Difference Approximations

    des in a two-dimensional plane with

    atial index in the -direction

    atial index in the -direction

    x

    y

    fi , j+2i, j+2 i+2, j+2

    f

    i, j+1

    i, j-1

    i, j-2

    fi+2, jy x

    i-2, j i-1, j i, j i+1, j i+2, jx

    fi , j

    fi+2 , j+2y

  • CE 341/441 - Lecture 14 - Fall 2004

    When tak

    and

    Similarlyp. 14.5

    ing partial derivatives w.r.t. , we hold constantx y

    fx------ i j,

    f i 1 j,+ f i 1 j,2x-------------------------------------=

    2 fx2---------

    i j,

    f i 1 j,+ 2 f i j, f i 1 j,+x2

    --------------------------------------------------------=

    2 fy2---------

    i j,

    f i j 1+, 2 f i j, f i j 1,+y2

    --------------------------------------------------------=

  • CE 341/441 - Lecture 14 - Fall 2004

    Example 1 Consider

    This mayp. 14.6

    Laplaces equation and :

    be viewed as follows in terms of a molecule:

    x y h= =

    f2 i j, 2 f

    x2---------

    2 fy2---------+=

    2 f i j,1h2----- f i 1 j,+ f i 1 j, f i j 1+, f i j 1, 4 f i j,+ + +( )=

    fi , j+1

    fi-1, j fi, j fi+1, j

    fi , j-1

    1

    1 1

    1

    -41h2

  • CE 341/441 - Lecture 14 - Fall 2004

    Example 2 Lets cons

    Draw a m

    Obtain 4

    x-----p. 14.7

    ider:

    olecule diagram for the 2nd order central difference formulation.

    by finding

    4 f 2 2 f( ) 4 f

    x4--------- 2

    4 fx2y2-----------------

    4 fy4---------+ += =

    f4----

    2

    x2--------

    2 fx2---------

    4 fx4---------

    2

    x2--------

    2 fx2---------

    =

    4 fx4---------

    2

    x2--------

    1x2--------- f i 1 j,+ 2 f i j, f i 1 j,+( ) =

  • CE 341/441 - Lecture 14 - Fall 2004p. 14.8

    4 fx4---------

    1x2---------

    2

    x2-------- f i 1 j,+( ) 2

    2

    x2-------- f i j,( )

    2

    x2-------- f i 1 j,( )+

    =

    4 fx4---------

    1x2---------

    1x2--------- f i 2 j,+ 2 f i 1+ j, f i j,+( )=

    2x2--------- f i 1 j,+ 2 f i j, f i 1 j,+( )

    1x2--------- f i j, 2 f i 1 j, f i 2 j,+( )+

    4 fx4---------

    1x4--------- f i 2 j, 4 f i 1 j, 6 f i j, 4 f i 1 j,+ f i 2 j,+++( )=

    1 -4 6 1-41x4

  • CE 341/441 - Lecture 14 - Fall 2004

    Similarlyp. 14.9

    :

    4 fdy4---------

    1y4--------- f i j 2, 4 f i j 1, 6 f i j, 4 f i j 1+, f i j 2+,++( )=

    1y4

    1

    -4

    6

    -4

    1

  • CE 341/441 - Lecture 14 - Fall 2004

    Evaluatiop. 14.10

    n of the mixed derivative:

    4 fx2y2-----------------

    2

    y2--------

    2 fx2---------

    =

    4 fx2y2-----------------

    2

    y2--------

    1x2--------- f i 1 j, 2 f i j, f i 1 j,++( ) =

    4 fx2y2-----------------

    1x2---------

    1y2--------- f i 1 j 1, 2 f i 1 j, f i 1 j 1+,+( )=

    2y2--------- f i j 1, 2 f i j, f i j 1+,+( )

    1y2--------- f i 1 j 1,+ 2 f i 1 j,+ f i 1 j 1+,++( )+

  • CE 341/441 - Lecture 14 - Fall 2004

    This thenp. 14.11

    produces the following module

    4 fx2y2-----------------

    1x2y2------------------- f i 1 j 1, 2 f i 1 j, f i 1 j 1+,+[=

    2 f i j 1, 4 f i j, 2 f i j 1+,+

    f i 1 j 1,+ 2 f i 1 j,+ f i 1 j,+ ]++

    1y2

    1 -2 1

    -2 4 -2

    1 -2 1

    x2

  • CE 341/441 - Lecture 14 - Fall 2004

    We can al

    Therefore

    2

    y22

    x

    1

    -2

    1p. 14.12

    so obtain this module as follows:

    2fx2

    =

    x21 -2 1

    1 [ ]

    2fy2

    =

    y21

    1

    -2

    1

    =

    x21 1 -2 1y2

    1

    -2

    1

    f2 x x2

    1y2

    =

    1 -2

    -2 4

    1 -2

  • CE 341/441 - Lecture 14 - Fall 2004

    To obtain

    If x =p. 14.13

    , we must add up modules:

    then:

    4 f

    4 f 4 f

    x4--------- 2

    4 fx2y2-----------------

    4 fy4---------+ +=

    y h=

    -8

    20

    -8

    1

    2 2

    -8 -81 1

    1

    2 2

    1h4

    LECTURE 14PRACTICAL ISSUES IN APPLYING FINITE DIFFERENCE APPROXIMATIONSDerivatives of Variable Coefficients Consider the termwhere is a coefficient which is a function of Proceed in steps. First let: Now evaluate: Now evaluate and Hence

    where When , then the approximation reduces to: Example Applications with variable coefficients: Fluids: spatially varying viscosities/diffusivities Solids: spatially varying elasticities

    Two Dimensional Finite Difference Approximations Define nodes in a two-dimensional plane with = spatial index in the -direction = spatial index in the -direction

    When taking partial derivatives w.r.t. , we hold constantand Similarly

    Example 1 Consider Laplaces equation and :

    This may be viewed as follows in terms of a molecule:

    Example 2 Lets consider: Draw a molecule diagram for the 2nd order central difference formulation. Obtain by finding

    Similarly: Evaluation of the mixed derivative:

    This then produces the following module We can also obtain this module as follows: Therefore To obtain , we must add up modules: If then: