FDM_lecturenotes-4

Embed Size (px)

Citation preview

  • 8/22/2019 FDM_lecturenotes-4

    1/34

    Finite Difference Method

    MEL 807

    Computational Heat Transfer (2-0-4)

    Dr. Prabal TalukdarAssistant Professor

    Department of Mechanical Engineering

    IIT Delhi

  • 8/22/2019 FDM_lecturenotes-4

    2/34

    Discretization Methods Required to convert the general transport

    equation to set of algebraic equations Finite difference method

    Finite volume method

    Finite element method

  • 8/22/2019 FDM_lecturenotes-4

    3/34

    Introduction to Finite Difference

    +++

    +

    +=+

    !n)x(

    xf

    2)x(

    xfx

    xf)x(f)xx(f

    n

    n

    n2

    2

    2

    Taylor series expansion

    gradient curvature

  • 8/22/2019 FDM_lecturenotes-4

    4/34

    Discretization

    +

    +

    += + 6

    )x(

    x2

    )(

    xxx

    3

    j,i3

    32

    j,i2

    2

    j,ij,ij,1i

    x

  • 8/22/2019 FDM_lecturenotes-4

    5/34

    Representation of a Derivative

    )x(xx

    j,ij,1i

    j,i

    +

    =

    +

    O

    =

    +

    6

    )x(

    x2

    )x(

    xxx

    2

    j,i

    3

    3

    j,i

    2

    2j,ij,1i

    j,i

    Finite difference

    representation

    +

    +

    += +

    6

    )x(

    x2

    )x(

    x

    x

    x

    3

    j,i

    3

    32

    j,i

    2

    2

    j,i

    j,ij,1i

    Forward difference

  • 8/22/2019 FDM_lecturenotes-4

    6/34

    Backward Difference

    +

    +

    +=

    6

    )x(

    x2

    )x(

    x

    )x(

    x

    3

    j,i

    3

    32

    j,i

    2

    2

    j,i

    j,ij,1i

    +

    =

    6

    )x(

    x2

    )x(

    x

    x

    x

    3

    j,i

    3

    32

    j,i

    2

    2

    j,i

    j,ij,1i

    )x(xx

    j,1ij,i

    j,i+

    =

    OBackward difference

  • 8/22/2019 FDM_lecturenotes-4

    7/34

    Central difference

    +

    +

    += +

    6

    )x(

    x2

    )x(

    x

    x

    x

    3

    j,i

    3

    32

    j,i

    2

    2

    j,i

    j,ij,1i

    +

    = 6

    )x(

    x2

    )x(

    xx

    x

    3

    j,i

    3

    32

    j,i

    2

    2

    j,i

    j,ij,1i

    2j,1ij,1i

    j,i

    )x(x2x

    +

    =

    +

    OSubtracting,

    Central difference

  • 8/22/2019 FDM_lecturenotes-4

    8/34

    Forward, backward and central

    difference stencil

    )x(Oxx

    j,ij,1i

    j,i

    +

    =

    +

    )x(xx

    j,1ij,i

    j,i

    +

    =

    O

    2j,1ij,1i

    j,i

    )x(x2x

    +

    =

    +

    O

  • 8/22/2019 FDM_lecturenotes-4

    9/34

    Stencil in y direction

    )y(yy

    j,i1j,i

    j,i

    +

    =

    + O

    )y(yy

    1j,ij,i

    j,i

    +

    =

    O

    2j,1ij,1i

    j,i

    )y(y2y

    +

    =

    +

    O

  • 8/22/2019 FDM_lecturenotes-4

    10/34

    2nd

    Order and Mixed Derivative

    ))x()x(

    2

    x2

    2j,1ij,ij,1i

    j,i

    2

    2

    +

    +=

    + 0

    ))y()y(

    2

    y

    2

    2

    1j,ij,i1j,i

    j,i

    2

    2

    +

    +=

    +

    0

    ])y(,)x[(

    yx4yx

    22

    1j,1i1j,1i1j,1i1j,1i

    j,i

    2

    +

    +=

    ++++

    O

  • 8/22/2019 FDM_lecturenotes-4

    11/34

    Boundary Consideration What kind of differencing scheme is possible at the

    boundaries?

    Central difference approximationis not possible as point 2 is

    beneath the boundary

    How we can get a second orderaccurate scheme?

    Possibility: Polynomial approach

    )y(yy

    12

    1

    +

    =

    O

  • 8/22/2019 FDM_lecturenotes-4

    12/34

    Polynomial Approach Assume

    At grid point 1, 1 = a

    At grid point 2 where y = y,

    At grid point 3 where y = 2y,

    2cybya ++=

    2

    2 )y(cyba ++=

    2

    2 )y2(cy2ba ++=

  • 8/22/2019 FDM_lecturenotes-4

    13/34

    Polynomial Approach (contd) Solving these equations,

    Differentiation of

    gives

    At point 1 (boundary),

    What is the order of

    approximation??

    y2

    43b 321

    +=

    by

    cy2b

    y

    cybya

    1

    2

    =

    +=

    ++=

    y2

    43

    y

    321

    1

    +=

  • 8/22/2019 FDM_lecturenotes-4

    14/34

    Order of Approximation Taylor series gives,

    Comparing with the polynomial expression ,

    we can say that our polynomial is of O(

    y)

    3

    1, 2, 3 can all be expressed in terms of the polynomial

    Represents one-sided difference of 2nd order accuracy

    +

    +

    +

    +=

    6y

    y2y

    yy

    y)y(

    3

    1

    3

    32

    1

    2

    2

    1

    1

    23

    321

    1

    )y(

    y

    )y(

    y2

    43

    y

    =

    =

    +=

    O

    O

    2cybya ++=

  • 8/22/2019 FDM_lecturenotes-4

    15/34

    FDM for 1D diffusion Uses truncated Taylor series expansion to approximate the

    derivative of the DE

    Consider 1-D diffusion equation

    Expand in Taylor series about

    point 2

    0Sdx

    d2

    2

    =+

    Subtracting these equations yields

  • 8/22/2019 FDM_lecturenotes-4

    16/34

    FDM (contd)

    ))x()x(

    2

    dx

    d 22

    231

    2

    2

    2

    +

    +=

    0

    2

    231

    2

    2

    2

    )x(

    2

    dx

    d

    +=

    Second ordertruncation error

    Dropping the truncated terms

    Adding the equations

    2321222S

    )x()x()x(

    2+

    +

    =

    The final discretized equation

    S2 = S(2)

  • 8/22/2019 FDM_lecturenotes-4

    17/34

    FDM (contd)

    We can write one such equation for each gridpoint

    Boundary conditions gives us boundary value

    Second order accurate Need to find a way to solve the couple

    algebraic equation set

    2321222 S)x()x()x(

    2

    +

    +

    =

  • 8/22/2019 FDM_lecturenotes-4

    18/34

    1D Steady State Conduction Consider the steady state heat conduction in a slab of thickness L,

    in which energy is generated at a constant rate of S W/m3. The

    boundary surface at x = 0 is maintained at a constant temperatureTo, while the boundary surface at x = 0 dissipates heat by

    convection with a heat transfer coefficient h into an ambient at

    temperature T .

    Compute the temperature inside the slab for h = 200W/(m2.C), k = 18 W/(m.C), L = 0.01 m, T = 100C, To = 50C, andS = 7.2 x 107.

    To = 50 C

    0.01 m

    T = 100 C

    x

    x

    0 1 32 54

  • 8/22/2019 FDM_lecturenotes-4

    19/34

    Solution

    0.01mLat xhThT

    dx

    )x(dTk

    0at xT)x(T

    0Sdx

    Tdk

    o

    2

    2

    ===+

    ==

    =+

    B.C.

    16Sk

    )5/L(S

    k

    )x(TT2T

    ST)x(

    kT

    )x(

    k2T

    )x(

    k

    ST)x(

    kT

    )x(

    kT

    )x(

    k2

    i

    2

    i

    2

    1ii1i

    i1i2i21i2

    i1i21i2i2

    ==

    =+

    =+

    +

    +

    =

    +

    +

    +

  • 8/22/2019 FDM_lecturenotes-4

    20/34

    Treatment of Boundary Condition

    16TT2T 1ii1i =+ +

    To = 50 C

    0.01 m

    x

    x

    01 32 N=54

    Applicable to node 1-4

    x/2

    044.416T044.2T2

    0Tk

    xh2

    k

    S)x(T

    k

    xh22T2

    02

    xS)TT(h

    x

    TTk

    54

    N

    2

    N1N

    N1NN

    =++

    =

    +

    +

    +

    =

    +

    T

    cond conv

    Applying it to

    node 5

  • 8/22/2019 FDM_lecturenotes-4

    21/34

    Treatment of Boundary Condition

    (Another Way)

    16TT2T 654 =+

    456

    546

    T)TT(k

    xh2T

    0)TT(hx2

    TTk

    +

    =

    =

    16TT2T 1ii1i =+ +

    To = 50 C

    0.01 m

    x

    x

    01 32 N=54

    Apply to node 5

    T

    B.C. gives

    44.416T044.2T2

    Tk

    xh216T

    k

    xh22T2

    54

    54

    +=

    +=

    +

  • 8/22/2019 FDM_lecturenotes-4

    22/34

    Algebraic Equations16TT2T 210 =+

    16TT2T 321 =+

    16TT2T 432 =+16TT2T 543 =+

    44.416T044.2T2 54 =

    5016TT2 21 =+

    Can be solved by Thomas algorithm

    Matrix inversion as shown in next slide

  • 8/22/2019 FDM_lecturenotes-4

    23/34

    Matrix Form

    =

    44.20

    16

    1616

    66

    T

    T

    TT

    T

    044.22000

    12100

    0121000121

    00012

    5

    4

    3

    2

    1

    [ ][ ] [ ][ ] [ ] [ ]BAx

    BxA1=

    =

  • 8/22/2019 FDM_lecturenotes-4

    24/34

    Prescribed Heat Flux

    X=0

    x

    0 1 32 NN-1

    x/2

    X=L

    qoqN

    Energy balance gives,

    0xS2

    1

    x

    TTkq

    0xS2

    1

    x

    TTkq

    NN1N

    N

    001

    0

    =++

    =+

    +

  • 8/22/2019 FDM_lecturenotes-4

    25/34

    FDM representation

    Ni0k

    xq2

    k

    S)x(T2T2

    0i0kxq2

    kS)x(T2T2

    NN

    2

    N1N

    00

    2

    01

    ==

    +

    +

    ==++

    for

    for

    Ni0k

    S)x(

    T2T2

    0i0k

    S)x(T2T2

    N

    2

    N1N

    0

    2

    01

    ==

    +

    ==

    +

    for

    for

    For insulated or symmetry boundary,

    Flux boundary,

  • 8/22/2019 FDM_lecturenotes-4

    26/34

    Unsteady Heat Conduction with

    FDM Unsteady heat conduction in 1-

    D with constant thermal

    conductivity

    Expand the individual

    terms with Taylor series,

    2

    2

    x

    T

    t

    T

    =

    +

    =

    +

    2

    t

    t

    T

    t

    TT

    t

    Tn

    i

    2

    2n

    i

    1n

    i

    n

    i

    +

    +=

    +12

    )x(xT

    )x(TT2T

    xT

    2n

    i

    4

    4

    2

    n

    1i

    n

    i

    n

    1i

    n

    i

    2

    2

  • 8/22/2019 FDM_lecturenotes-4

    27/34

    Unsteady Heat Conduction (contd)

    2

    n

    1i

    n

    i

    n

    1i

    n

    i

    1n

    i

    )x(

    )TT2T(

    t

    TT

    +=

    ++

  • 8/22/2019 FDM_lecturenotes-4

    28/34

    Explicit Solutions

    )TT2T()x(

    tTT

    )x(

    )TT2T(

    t

    TT

    n1i

    ni

    n1i2

    ni

    1ni

    2

    n1i

    ni

    n1i

    ni

    1ni

    ++

    ++

    +

    +=

    +=

    cm105

    50x == s/cm10x17 22

    =

    Tw = 30CTw = 100C

    50 cm

    Find 1-D unsteady temperature distribution till steady state

    Initial temp Tin = 30C, t = 10 sec

    2

    1

    )x(

    t2

    will talk later

  • 8/22/2019 FDM_lecturenotes-4

    29/34

    Results

    0

    20

    40

    60

    80

    100

    120

    0 1 2 3 4 5 6 7 8

    20sec

    90sec

    260sec

    360

    T(C)

    Nodes

  • 8/22/2019 FDM_lecturenotes-4

    30/34

    2D Steady State Heat Conduction

    0k

    )y,x(S

    y

    T

    x

    T2

    2

    2

    2

    =+

    +

    2

    j,1ij,ij,1i

    j,i

    2

    2

    )x(TT2T

    xT

    +=

    +

    2D steady state with heat generation

    21j,ij,i1j,i

    j,i

    2

    2

    )y(TT2T

    yT

    +=

    +

    lyx

    0klST4TTTT

    2

    j,ij,i1j,i1j,ij,1ij,1i

    ==

    =++++ ++

    where

  • 8/22/2019 FDM_lecturenotes-4

    31/34

    Flux Boundary Condition

    Ti,,j+1

    Ti,,j-1

    Ti+1,,j

    Ti,,j

    l

    qoW/m2

    l/2

    Nodes (i,j) on a prescribed heat flux boundary

    0k

    lq2

    k

    SlT4TT2T

    0Sl2

    1

    l

    TT

    2

    lk

    l

    TTkl

    l

    TT

    2

    lklq

    oj,i2

    j,i1j,ij,1i1j,i

    j,i

    2j,i1j,ij,ij,1ij,i1j,i

    0

    =++++

    =+

    +

    +

    +

    ++

    ++

    After rearrangement

    l d C d

  • 8/22/2019 FDM_lecturenotes-4

    32/34

    Flux Boundary Condition

    (another way)

    0k

    SlT4TTTT

    j,i2

    j,i1j,i1j,ij,1ij,1i =++++ ++

    j,1io

    j,1i

    j,1ij,1i

    o

    Tklq2T

    l2

    TTk

    x

    Tkq

    +

    +

    +=

    =

    =

    Ti,,j+1

    Ti,,j-1

    Ti+1,,j

    Ti,,j

    l

    qoW/m2

    l/2

    Applying the finite difference equation at the

    boundary node (i, j)

    B.C.

    0

    k

    lq2

    k

    SlT4TT2T o

    j,i2

    j,i1j,ij,1i1j,i =++++ ++

  • 8/22/2019 FDM_lecturenotes-4

    33/34

    Convective Boundary Condition

    0Sl

    4

    3)TT(hl

    l

    TT

    2

    lk

    l

    TTkl

    l

    TTkl

    l

    TT

    2

    lk j,i

    2j,i

    j,ij,1ij,i1j,ij,ij,1ij,i1j,i =++

    +

    +

    +

    ++

    After rearrangement,

    0T

    k

    hl2S

    k

    l

    2

    3T

    k

    hl26TT2T2T j,i

    2

    j,ij,1i1j,ij,1i1j,i =++

    ++++ ++

    Ti,,j+1

    Ti,,j

    l

    l/2

    Ti-1,,jTi+1,j

    Convection h,T

    Ti,,j-1

    l

    Energy balance gives,

  • 8/22/2019 FDM_lecturenotes-4

    34/34

    Insulated Boundary

    xb6

    cos100)x(T

    =

    0 3b

    02b

    T1

    T2

    T5T3

    T4 T6

    100 86.66 50

    Insulated

    Maintained at

    zero temperature

    Insulated

    Node 1: 2T2+2T3-4T1= 0

    Node 2: T1+2T4+100-4T2 = 0Node 3: T1+2T4+T5-4T3 = 0

    Node 4: T2+T3+T6+86.66-4T4 = 0

    Node 5: T3+2T6-4T5 = 0

    Node 6: T4+T5+50-4T6 = 0

    =

    50

    0

    66.86

    0

    100

    0

    T

    T

    T

    T

    T

    T

    411000

    240100

    104110

    012401

    002041

    000224

    6

    5

    4

    3

    2

    1

    Matrix Form