+ All Categories
Home > Documents > Comp Heat Transfer4 Repaired)

Comp Heat Transfer4 Repaired)

Date post: 05-Apr-2018
Category:
Upload: rozanti-a-hamid
View: 213 times
Download: 0 times
Share this document with a friend

of 48

Transcript
  • 7/31/2019 Comp Heat Transfer4 Repaired)

    1/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Chapter Four FINITE DIFFERENT APPLICATION TO STEADY STATE HEAT

    CONDUCTION

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    2/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    In this chapter, the modeling of steady state heat conduction problems by the finite

    difference technique is discussed. Several illustrative examples are presented in rectangular

    and cylindrical coordinates system.

    4.1 Steady State Heat Conduction

    We begin with the simplest case as shown in Fig. 4.1. Here we only consider a steady state

    one-dimensional conduction mode of heat transfer without heat generation. Therefore, the

    heat conduction equation reduces to

    02

    2

    =x

    T(4.1)

    We discretize Eq. (4.1) using the finite difference approximation and gives

    ( )0

    22

    11 =

    + +x

    TTT iii(4.2)

    or

    2

    11 + += iii TTT (4.3)

    Note that the central difference with second order accuracy was used to approximate Eq.

    (4.1).

    Figure 4.1 Heated steel bar

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    3/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    By referring to Fig. 4.1, we evaluate the temperature at each nodes using Eq. (4.2) with the

    following boundary condition

    5001

    =T (4.4)

    1004 =T (4.5)

    and

    2

    500

    2

    3132

    +=

    +=

    TTTT (4.6)

    2

    100

    2

    2243

    TTTT

    +=

    += (4.7)

    Equations (4.6) and (4.7) can be easily solved and get

    2

    3

    366.67

    233.33

    T

    T

    == (4.8)

    Next, we consider steady state with no heat generation, two-dimensional heat flow equation

    with the following governing equations

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.9)

    Thus, the finite difference approximation for the above equation becomes

    ( ) ( )0

    222

    ,1,1,

    2

    ,,1,1 =

    ++

    + ++y

    TTT

    x

    TTT jijijijijiji(4.10)

    If yx = then

    04 ,1,1,,1,1 =+++ ++ jijijijiji TTTTT (4.11)

    or

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    4/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    4

    1,1,,1,1

    ,

    ++ +++= jijijijijiTTTT

    T (4.12)

    Figure 4.2 Four nodes problem

    Another simple example is shown in Figure 4.2 and the four equations for nodes 6, 7, 10

    and 11 would be

    Node 6

    4

    500100 1076

    TTT

    +++= (4.13)

    Node 7

    4

    500100 1167

    TTT

    +++= (4.14)

    Node 10

    4

    100100 61110

    +++=

    TTT (4.15)

    Node 11

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    5/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    4

    100100 71011

    +++=

    TTT (4.16)

    Since symmetrical boundary condition for the left and right sides

    1110

    76

    TT

    TT

    ==

    (4.17)

    and the final results are

    150

    250

    1110

    76

    ====

    TT

    TT(4.18)

    4.2 Iterative Methods

    For the number of nodes very large, any iterative technique may frequently yield a more

    efficient solution. The basis of all iterative methods is that an approximate solution is

    guessed for each point at which solution is sought and the values are then repeatedly

    updated. One such method is called aJacobi method

    . The procedure in Jacobi method is as

    follow

    1. An initial set of values for the Tis assumed. For a large number of nodes,

    the Tare usually assigned a zero value to start the calculation

    2. The new value of the nodal temperature are calculated

    3. The process is repeated until successive calculation differs by a sufficient

    small amount.

    For practice purpose, we return to the first case above and the updating equation for

    temperature is

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    6/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    2

    50032

    +=T

    T (4.19)

    2

    100 23

    TT

    += (4.20)

    Tab. 4.1 shows the solution for the current problem using the Jacobi method

    Table 4.1 Solution by Jacobi iteration method

    Number of iteration2T 3T

    0 0 0

    1 250 50

    2 275 1753 337.5 187.5

    4 343.75 218.75

    5 359.375 221.875

    6 360.9375 229.6875

    7 364.8438 230.4688

    8 365.2344 232.4219

    18 366.6653 233.3324

    19 366.6662 233.3326

    20 366.6667 233.3333

    The compute program code written in MATLAB is shown below

    %One-dimensional conduction heat transfer without heat generation

    %Jacobi method

    clear all; clc; close all;

    lmax=100;

    imax=4;

    imm1=imax-1;

    t = zeros;

    t(1)=500;

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    7/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    t(imax)=100;

    for l =1:lmax

    for i=2:imm1

    tnew(i)=(t(i+1)+t(i-1))/2;

    end

    for i=2:imm1

    t(i)=tnew(i);

    end

    end

    Tab. 4.2 shows the predicted value of temperature for the case of two-dimensional problem

    using the discussed Jacobi iteration method.

    Table 4.2 Solution by Jacobi iteration method for two-dimensional problem

    Number of iteration 6T 7T 10T 11T

    0 0 0 0 0

    1 150 150 50 50

    2 200 200 100 100

    3 225 225 125 125

    4 237.5 237.5 137.5 137.5

    5 243.75 243.75 143.75 143.75

    6 246.875 246.875 146.875 146.875

    After six iterations, the approximate solution is

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    8/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    )150(875.146

    )150(875.146

    )250(875.246

    )250(875.246

    11

    10

    7

    6

    ====

    T

    T

    T

    T

    (4.21)

    with the exact solution shown in parentheses for comparison. More iteration will take us

    even nearer to this exact solution.

    The compute program code written in MATLAB is shown below

    %Two-dimensional conduction heat transfer without heat generation

    %Jacobi method

    clear all; clc; close all;

    lmax=100;

    imax=4;

    jmax=4;

    imm1=imax-1;

    jmm1=jmax-1;

    t = zeros;

    for i=1:imax

    t(i,jmax)=500;

    t(i,1)=100;

    end

    for j=1:jmax

    t(1,j)=100;

    t(imax,j)=100;

    end

    for l =1:lmax

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    9/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    for i=2:imm1

    for j=2:jmm1

    tnew(i,j)=(t(i+1,j)+t(i-1,j)+t(i,j+1)+t(i,j-1))/4;

    end

    end

    for i=2:imm1

    for j=2:jmm1

    t(i,j)=tnew(i,j);

    end

    end

    end

    Another well-known technique is the Gauss-Seidel iterative method. This method is very

    similar to the Jacobi method. The sole different is that, when sequentially iterating with the

    update equations, new updated value are used as soon as they are available. Example

    calculation for two-dimensional case is shown as follow

    4

    500100 1076

    TTT

    +++= (4.16)

    4

    500100 1167

    TTT

    +++= (4.17)

    4

    100100 61110

    +++=

    TTT (4.18)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    10/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    4

    100100 71011

    +++=

    TTT (4.19)

    Table 4.2 Solution by Gauss-Seidel iteration method

    Number of iteration 6T 7T 10T 11T

    0 0 0 0 0

    1 150 187.5 87.5 118.75

    2 218.75 234.375 134.375 142.18

    3 242.18 246.09 146.09 148.05

    4 248.05 249.025 149.025 149.51

    They can be seen that, after only four iterations, the approximate solution is

    )150(51.149

    )150(025.149

    )250(025.249

    )250(05.248

    11

    10

    7

    6

    ====

    T

    T

    T

    T

    (4.20)

    The compute program code written in MATLAB is shown below

    %Two-dimensional conduction heat transfer without heat generation

    clear all; clc; close all;

    lmax=100;

    imax=4;

    jmax=4;

    imm1=imax-1;

    jmm1=jmax-1;

    t = zeros;

    for i=1:imax

    t(i,jmax)=500;

    t(i,1)=100;

    end

    for j=1:jmax

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    11/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    t(1,j)=100;

    t(imax,j)=100;

    end

    for l =1:lmax

    for i=2:imm1

    for j=2:jmm1

    tnew(i,j)=(t(i+1,j)+t(i-1,j)+t(i,j+1)+t(i,j-1))/4;

    t(i,j)=tnew(i,j);

    end

    end

    end

    4.2.1 Boundary treatments

    When the solid is exposed to some other type of boundary conditions; i.e convection

    boundary condition, the temperature at the surface must be computed differently from the

    method given above. To see this, now, let consider a long rectangular bar as shown in Fig.

    4.3.

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    12/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.3 Two dimensional heat conduction in a bar (Physical problem)

    In the absence of heat source, the heat conduction equation for this geometry is given by

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.21)

    The following boundary conditions are applied on the side surfaces of the bar:

    0TT= atx = 0 (4.22)

    0=y

    Taty = 0 (4.23)

    qx

    Tk =

    atx =L (4.24)

    ( )fTThxTk = aty =H (4.25)

    Using central difference approximation for the second derivatives, the nodal equation at

    point (i,j) is given by

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    13/48

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    14/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.4 Two dimensional heat conduction in a bar (grid)

    The prescribed temperature condition at i = 1 becomes

    0,1 TT j = for 11 + Mj (4.28)

    On the bottom surface ( 1=j ), the discretised heat conduction equation is determined as

    04 1,0,2,1,11,1 =+++ + iiiii TTTTT (4.29)

    Here, it is required to introduce an imaginary node point 0,iT at a distance y from the

    bottom surface. We know that the insulated boundary can be discretized as

    02

    0,2,

    1,

    =

    =

    y

    TT

    y

    T ii

    i

    (4.30)

    or

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    15/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    0,2, ii TT = (4.31)

    and we obtain

    042 1,2,1,11,1 =++ + iiii TTTT for Ni 2 (4.32)

    And therefore

    4

    2 2,1,11,11,

    iii

    i

    TTTT

    ++= + for Ni 2 (4.33)

    For the right boundary, the heat flux condition is applied as follow. Consider an imaginary

    point outside the boundary, then the discretised form of the boundary condition becomes

    qx

    TTk

    x

    Tk

    jNjN =

    =

    +2

    ,,2(4.34)

    or

    jNjN Tk

    xqT ,,2

    2+

    =+ (4.35)

    Combine the above equation for the heat conduction equation for the right boundary node

    gives

    k

    xqTTTT jNjNjNjN

    =++ ++++

    242 ,11,11,1, for Mj 2 (4.36)

    and therefore

    jN

    jNjNjN

    jN Tk

    xqTTT

    T ,1

    1,11,1,

    ,1 44

    22

    +

    +++

    +

    ++

    =for Mj 2 (4.37)

    In a similar manner, the nodal equations for the top boundary can be obtained by

    discretizing the convective condition using imaginary point

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    16/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    ( )fTTh

    y

    Tk =

    (4.38)

    or

    ( )f

    MiMiTT

    k

    h

    y

    TT=

    +

    2

    ,2,(4.39)

    and

    ( )fMiMi TT

    k

    yhTT

    =+

    2,2, (4.40)

    Substituting for this imaginary point temperature in the heat conduction equation give the

    nodal equations as follow

    fMiMiMiMi Tk

    yhT

    k

    yhTTT

    =

    +++ ++++ 2222 1,,1,11,1 for Ni 2 (4.41)

    Next, let consider the corner nodes of the domain. The nodal equations of the corner points

    on the prescribed temperature boundary are

    01,1

    01,1

    TT

    TT

    M =

    =

    + (4.42)

    For the corner node ( 1,1+N ), two imaginary points ( 0,1+N ) and ( 1,2+N ) have to be

    considered. The boundary conditions on the lower and the right surfaces are discretised

    using these imaginary points. After combining the discretised boundary condition with the

    heat conduction equation, the following nodal equation is obtained

    kxqTTT NNN =+ ++ 1,12,11, 2 (4.43)

    Similarly, by incorporating the boundary condition of heat flux and convective heat

    exchange with the help of two imaginary points, the equation for the node ( 1,1 ++ MN ) is

    obtained as

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    17/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    k

    xqT

    k

    yhT

    k

    yhTT fMNMNMN

    +

    =

    ++ ++++ 1,1,11, 2 (4.44)

    The other nodal point equation for corner boundary nodes exposed to ambient temperature

    fT is shown below

    Bi1

    Bi2,11,1,1 +

    ++= ++++

    fNMNM

    NM

    TTTT

    wherek

    xh=Bi

    Bi3

    2Bi 1,,1,11,, +

    +++++= ++ jijijijifji

    TTTTTT

    wherek

    xh=Bi

    Figure 4.6 Convection boundary nodes

    Example 4.1

    A 1-by 2-cm ceramic strip (k= 3W/moC, =1600kg/m3 and c = 0.8kJ/kgoC) is embedded

    in a high-thermal-conductivity material as shown in Fig. 4.7 so that the sides are

    maintained at a constant temperature of 900oC. The bottom surface of the ceramic is

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    18/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    insulated, and the top surface is exposed to a convection environment at T= 50oC, h =

    50W/m2. Solve the steady state temperature distribution of the nodes.

    Figure 4.7 Heated ceramic strip

    Solution

    Since the problem is steady state heat conduction without heat generation, the governing

    equation is expressed as

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.45)

    and the discretised equation is

    ( ) ( )0

    222

    ,1,1,

    2

    ,,1,1 =

    ++

    + ++y

    TTT

    x

    TTT jijijijijiji(4.46)

    Since yx = and therefore

    04 ,1,1,,1,1 =+++ ++ jijijijiji TTTTT (4.47)

    or

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    19/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    4

    1,1,,1,1

    ,

    ++ +++= jijijijijiTTTT

    T (4.48)

    Let us employ a uniform square grid as shown in Figure below.

    Fig. 4.8 Uniform square grid for heated ceramic

    For the bottom boundary, the adiabatic boundary condition is applied as follow. Consider

    an imaginary point outside the boundary, then the discretised form of the boundary

    condition becomes

    042 1,2,1,11,1 =++ + iiii TTTT (4.49)

    or

    4

    22,1,11,1

    1,

    iii

    i

    TTTT

    ++=

    +

    for 3,2,1=i and 1=j (4.50)

    In a similar manner, the nodal equations for the top boundary can be obtained by

    discretizing the convective condition using imaginary points and substituting for the

    imaginary point temperature in the heat conduction equation. The resulting nodal equations

    are

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    20/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    fMiMiMiMi Tk

    yhT

    k

    yhTTT

    =

    +++ ++++ 2222 1,,1,11,1 or (4.51)

    +

    +++

    =+++

    +

    k

    yh

    TTTTk

    yh

    TMiMiMif

    Mi

    22

    22 ,1,11,11, for 3,2,1=i and 1+= Mj (4.52)

    The computer program code written in MATLAB is shown below

    clear all;clc;close all;

    width = 0.02;

    height = 0.01;

    h = 50;

    k = 3;

    t_air = 50;

    t_wall = 900;

    l=0; %

    lmax=100;

    imax=5;

    jmax=3;

    imm1=imax-1;

    jmm1=jmax-1;

    dx = width/imm1;

    dy = height/jmm1;

    for j = 1:3

    t(1,j) = t_wall;

    t(imax,j) = t_wall;

    end

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    21/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    for l=1:100

    for i=2:imm1

    j = 1;

    tnew=(t(i+1,j)+t(i-1,j)+2.*t(i,j+1))/4;

    t(i,j)=tnew;

    end

    for i=2:imm1

    j = 2;

    tnew=(t(i+1,j)+t(i,j+1)+t(i,j-1)+t(i-1,j))/4;

    t(i,j)=tnew;

    end

    for i=2:imm1

    j = jmax;

    tnew=((2*h*dy/k).*t_air + t(i-1,j)+t(i+1,j)+2.*t(i,j-1))/

    (2*(2+h*dy/k));

    t(i,j)=tnew;

    end

    end

    The value of temperature at all nodes after 100 iteration is shown in Table 4.2.

    Table 4.2 Temperature distribution for Example 4.1

    No. of Node Temperature No. of Node Temperature

    1 822.645 5 843.8972

    2 801.9496 6 848.7429

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    22/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    3 822.6465 7 868.4098

    4 858.7429 8 856.1535

    9 868.4098

    Example 4.2

    Consider the square as shown in Fig. 4.9. The left surface is maintained at 100oC and the

    top surface 500oC, while the other two surfaces are exposed to an environment at 100oC.

    The block is 1m square. Compute the temperature of the various nodes in the figure.

    CmWh

    2

    10= andmCWk 10

    =

    Solution

    Since the problem is steady state heat conduction without heat generation, the governing

    equation is expressed as

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.53)

    and the discretised equation is

    ( ) ( )0

    222

    ,1,1,

    2

    ,,1,1 =

    ++

    + ++y

    TTT

    x

    TTT jijijijijiji(4.54)

    Since yx = and therefore

    04 ,1,1,,1,1 =+++ ++ jijijijiji TTTTT (4.55)

    Therefore, for the internal nodes the temperature can be calculated by

    4

    1,1,,1,1

    ,

    ++ +++= jijijijijiTTTT

    T (4.56)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    23/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.9 Heated square block

    Solution

    For the bottom boundary nodes (j =1), since they are exposed to ambient temperature, the

    general equation can be written as

    04 1021111 =+++ + i,i,i,,i,i TTTTT (4.57)

    From the convective boundary condition, we get

    ( )fi

    i,i,TTh

    y

    TTk =

    1,20

    2(4.58)

    This leads to

    ( ) 2,1,02

    ifii, TTTk

    yhT +

    = (4.59)

    Substitute into Eq. (4.58) yields

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    24/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    02

    42

    2 1,21111 =

    +

    +

    ++ + fii,,i,i T

    k

    yhT

    k

    yhTTT (4.60)

    or

    +

    +++

    =+

    42

    22 21111

    1,

    k

    yh

    Tk

    yhTTT

    Tfi,,i,i

    i (4.61)

    Since the right surface is also exposed to ambient temperature, the equation for the right

    boundary nodes (i = imax) can be expressed as

    04max1max1max1max1max =+++ ++ ,ji,ji,ji,ji,ji

    TTTTT(4.62)

    where

    ( )fji

    ,jijiTTh

    x

    TTk =

    + max,

    1max,1max

    2(4.63)

    This leads to

    ( )jifji,ji TTT

    k

    xhT ,1maxmax,1max

    2+ +

    = (4.64)

    Substitute into Eq. (4.62) yields

    022

    42

    1max1max,1maxmax, =+++

    +

    +

    + ,ji,jijifji TTTT

    k

    xhT

    k

    xh

    (4.65)

    or

    +

    +++= +

    42

    2

    2 1max1max1maxmax,

    k

    xhTk

    xh

    TTTTf,ji,ji,ji

    ji (4.66)

    Now, we demonstrate the treatment for the bottom right corner node (imax,1).

    The discretized equation for this node is expressed as

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    25/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    04 1max0max2max11max11max =+++ + ,i,i,i,i,i TTTTT (4.67)

    Here, we need to replace two imaginary nodes (imax+1,1) and (imax, 0). Since the right

    and bottom boundary are exposed to the ambient temperature, therefore

    ( )2max,1max,0max

    2ifi,i TTT

    k

    yhT +

    = (4.68)

    and

    ( ) 1,1max1max,11max2

    + +

    = ifi,i TTTk

    xhT (4.69)

    Substitute Eq. (4.69) and (4.68) into Eq. (4.67) gives

    02222

    422

    2max1,1max1max, =++

    +

    +

    +

    +

    ,iifi TTT

    k

    yh

    k

    xhT

    k

    yh

    k

    xh(4.70)

    Then

    +

    +

    ++

    +

    =

    422

    2222

    2max1,1max

    1max,

    k

    yh

    k

    xh

    TTTk

    yh

    k

    xh

    T,iif

    i (4.71)

    The computer program code written in MATLAB is shown below

    clear all;clc;close all;

    width = 1.00;

    height = 1.00;

    h = 10;

    k = 10;

    t_air = 100;

    t_left_wall = 100;

    t_top_wall = 500;

    l=0; %

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    26/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    lmax=100;

    imax=5;

    jmax=5;

    imm1=imax-1;

    jmm1=jmax-1;

    dx = width/imm1;

    dy = height/jmm1;

    for j = 1:jmax

    t(1,j) = t_left_wall;

    end

    for i = 1:imax

    t(i,jmax) = t_top_wall;

    end

    for l=1:100

    for i=2:imm1

    for j=2:jmm1

    tnew=(t(i+1,j)+t(i-1,j)+t(i,j+1)+t(i,j-1))/4;

    t(i,j)=tnew;

    end

    end

    for i=2:imm1

    j = 1;

    tnew=(t(i+1,j)+t(i-1,j)+2*t(i,j+1)+(2*dy*h*t_air)/k)/

    (((2*dy*h)/k)+4);

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    27/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    t(i,j)=tnew;

    end

    for j=2:jmm1

    i = imax;

    tnew=(t(i,j+1)+t(i,j-1)+2*t(i-1,j)+(2*dx*h*t_air)/k)/

    (((2*dx*h)/k)+4);

    t(i,j)=tnew;

    end

    j=1;

    i=imax;

    tnew=((2*dx*h*t_air)/k + (2*dy*h*t_air)/k +2*t(i-1,j)

    +2*t(i,j+1))/((2*dx*h)/k + (2*dy*h)/k+4);

    t(i,j)=tnew;

    end

    Example 4.3

    The fin shown in Fig. 4.10 has a base maintained at 300oC and is exposed to the convective

    environment indicated. Calculate the steady state temperature of the nodes shown in the

    figure ifk= 1.0W/moC and h = 40W/m2oC

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    28/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.10 Heated fin exposed to ambient temperature

    Since the problem is steady state heat conduction without heat generation, the governing

    equation is expressed as

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.72)

    and the discretised equation is

    ( ) ( )0

    222

    ,1,1,

    2

    ,,1,1 =

    ++

    + ++y

    TTT

    x

    TTT jijijijijiji(4.73)

    Since yx = and therefore

    ( ) ( )( ) ( ) ( ) ( ) ( ) 02 1,1,2

    ,1,1

    2

    ,

    22 =+++++ ++ jijijijiji TTxTTyTxy (4.74)

    Then, the temperature at the internal nodes (nodes 5.6 and 7) can be calculated by

    ( ) ( ) ( ) ( )( ) ( )( )22

    1,1,

    2

    ,1,1

    2

    ,2

    0

    xy

    TTxTTyT

    jijijiji

    ji +

    =+++= ++ (4.75)

    For the bottom boundary nodes (j =1), since they are exposed to ambient temperature, the

    general equation can be written as

    ( ) ( )0

    222

    1,0,2,

    2

    1,1,11,1 =

    ++

    + +y

    TTT

    x

    TTT iiiiii(4.76)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    29/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    From the convective boundary condition, we get

    ( )( )

    fi

    i,i,TTh

    y

    TTk =

    1,20

    2(4.77)

    This leads to

    ( ) 2,1,02

    ifii, TTTk

    yhT +

    = (4.78)

    Substitute into Eq. (4.76) yields

    ( ) ( )( ) ( ) ( ) ( )

    ( ) 022

    22

    2,2

    1,11,1

    2

    1,

    222

    = ++

    ++

    ++ +

    fi

    iii

    TkyhTx

    TTyTk

    yhxxy

    (4.79)

    or

    ( ) ( ) ( )

    ( ) ( )( ) ( )

    ++

    +++

    =+

    k

    yhxxy

    Tk

    yhTxTTy

    Tfiii

    i2

    2

    22

    222

    2,

    2

    1,11,1

    2

    1, (4.80)

    Since the right surface is also exposed to ambient temperature, the equation for the right

    boundary nodes (i = imax) can be expressed as

    ( ) ( )0

    222

    max,1max,1max,

    2

    max,,1max,1max =

    ++

    + ++y

    TTT

    x

    TTT jijijijijiji(4.81)

    where

    ( )fji

    ,jijiTTh

    x

    TTk =

    + max,

    1max,1max

    2

    (4.82)

    This leads to

    ( )jifji,ji TTT

    k

    xhT ,1maxmax,1max

    2+ +

    = (4.83)

    Substitute into Eq. (4.81) yields

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    30/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    ( ) ( ) ( )( ) ( )

    ( ) ( ) 0

    22

    22

    1max,1max,

    2

    ,1max

    2

    max,

    222

    =++

    +

    +

    ++

    +

    jiji

    jifji

    TTx

    TTk

    xhyTxyy

    k

    xh

    (4.84)

    or

    ( ) ( ) ( )

    ( ) ( ) ( )( )

    ++

    ++

    +

    =+

    222

    1max,1max,

    2

    ,1max

    2

    max,

    22

    22

    xyyk

    xh

    TTxTTk

    xhy

    Tjijijif

    ji (4.85)

    Now, we demonstrate the treatment for the bottom right corner node (imax,1).

    The discretized equation for this node is expressed as

    ( ) ( )0

    222

    1max,0max,2max,

    2

    1max,1,1max1,1max =

    ++

    + +y

    TTT

    x

    TTT iiiiii(4.86)

    Here, we need to replace two imaginary nodes (imax+1,1) and (imax, 0). Since the right

    and bottom boundary are exposed to the ambient temperature, therefore

    ( ) 2max,1max,0max2

    ifi,i TTTk

    yhT +

    = (4.87)

    and

    ( ) 1,1max1max,11max2

    + +

    = ifi,i TTTk

    xhT (4.88)

    Substitute Eq. (4.87) and (4.88) into Eq. (4.86) gives

    ( ) ( ) ( ) ( )( )

    ( ) ( ) ( ) ( ) 02222

    222

    2max,

    2

    1,1max

    222

    1max,

    2222

    =++

    ++

    ++

    +

    iif

    i

    TxTyTkyhx

    kxhy

    Txyk

    yhx

    k

    xhy

    (4.89)

    Then

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    31/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    ( ) ( ) ( ) ( )

    ( ) ( ) ( ) ( )( )

    ++

    +

    ++

    +

    =

    2222

    2max,

    2

    1,1max

    222

    1max,

    222

    2222

    xyk

    yhx

    k

    xhy

    TxTyTk

    yhx

    k

    xhy

    Tiif

    i (4.90)

    Finally, since the problem is symmetric at the horizontal centerline of the fin, the

    temperature at the top boundary nodes (node 1,2 and 3) can be set equal to the temperature

    at the bottom boundary nodes.

    The computer program code written in MATLAB is shown below

    clear all;clc;close all;

    width = 0.08;

    height = 0.02;

    h = 40;

    k = 1;

    t_air = 20;

    t_left_wall = 300;

    l=0; %

    lmax=100;

    imax=5;

    jmax=3;

    t(1:imax,1:jmax)=zeros;

    imm1=imax-1;

    jmm1=jmax-1;

    dx = width/imm1;

    dy = height/jmm1;

    for j = 1:jmax

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    32/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    t(1,j) = t_left_wall;

    end

    for l=1:100

    for i=2:imm1

    j=2;

    tnew=((t(i+1,j)+t(i-1,j))*dy^2 +...

    (t(i,j+1)+t(i,j-1))*dx^2)/(2*(dy^2+dx^2));

    t(i,j)=tnew;

    end

    for i=2:imm1

    j = 1;

    tnew=((t(i+1,j)+t(i-1,j))*dy^2 +

    (2*t(i,j+1)+(2*dy*h*t_air)/k)*dx^2)/(2*(dy^2+dx^2)+((2*dy*h)/k)*dx^2);

    t(i,j)=tnew;

    end

    for i=2:imm1

    t(i,jmax)=t(i,1);

    end

    for j=2:jmm1

    i = imax;

    tnew=((t(i,j+1)+t(i,j-1))*dx^2 + (2*t(i-1,j)

    +(2*dx*h*t_air)/k)*dy^2)/(2*(dy^2+dx^2)+((2*dx*h)/k)*dy^2);

    t(i,j)=tnew;

    end

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    33/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    j=1;

    i=imax;

    tnew=(2*(t(i-1,j)*dy^2+t(i,j+1)*dx^2) +...

    (2*h*(dx*dy^2+dy*dx^2)/k)*t_air)/((2*h*(dx*dy^2+dy*dx^2)/k)

    +2*(dy^2+dx^2));

    t(i,j)=tnew;

    t(imax,jmax)=t(imax,1);

    end

    4.3 Steady State Heat Conduction in Cylindrical Geometries.

    Sometimes, it is desired to consider the governing equations expressed in the cylindrical

    coordinate due to the nature of the problem. However, few modifications have to be made

    for the finite different formulation in cylindrical geometries. To see this, let consider heat

    conduction in a cylindrical geometry with the computational grids as shown below

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    34/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.10 Grid for radial conduction in a cylinder

    Here, we consider one-dimensional heat conduction in radial direction and the governing

    equations reduced to

    01

    2

    2

    =

    +

    r

    T

    rr

    T(4.91)

    Let the surface of the cylinder be maintained at a temperature of ST . For an axisymmetric

    problem in cylindrical geometry, it can be shown that 0= rT at 0=r .

    Now, consider a radial grid with constant size r . At a node i, the discretized form of the

    heat conduction becomes

    02

    2 112

    11 =

    +

    + ++rr

    TT

    r

    TTT

    i

    iiiii(4.92)

    For the surface node (N+1), the prescribed temperature condition gives

    SN TT =+1 (4.93)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    35/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    The so called LHospital rule has to be applied at the center ofr= 0 to avoid 1/r

    approaches as follow

    2

    2

    1rT

    rT

    r = (4.94)

    Therefore, the equation becomes

    022

    2

    =r

    T(4.95)

    Therefore discretized equation at r = 0 is

    0

    2

    2 2102

    =

    +r

    TTT

    (4.96)

    Note that we consider an imaginary node at i = 0. This imaginary term can be replaced by

    considering the boundary condition at r= 0

    02

    02 =r

    TT(4.97)

    which gives

    20 TT = (4.98)

    Then at the r= 0 boundary condition, we obtain

    21 TT = (4.99)

    Example 4.4

    Consider a problem of heat conduction as shown in figure below. The inner side is heated

    to the temperature of 30oC and outer side is heated to temperature of 150oC. Determine the

    temperature distribution between these two boundaries.

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    36/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.11 Differentially heated 1D bar.

    Solution

    The discretized equation is given as

    02

    2 112

    11 =

    +

    + ++rr

    TT

    r

    TTT

    i

    iiiii(4.100)

    And the equation for the internal nodes is given by

    ( )

    i

    iiiii

    r

    TTr

    TTT

    42

    1111 ++ ++

    = (4.101)

    Let r= 0.5m and mesh size is (M= 5), therefore

    1.05

    5.0==r (4.102)

    The total number of grid points isM+1=6

    The computer program code written in MATLAB is given as below

    clear all;clc;close all;

    radius = 0.5;

    mesh = 5;

    deltaR = radius/mesh;

    l = 0; %

    lmax=100;

    rmax=mesh+1;

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    37/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    t(1) = 30;

    t(rmax) = 150;

    for l =1:lmax

    for r = 2:rmax-1

    tnew(r) = (t(r+1)+t(r-1))/2 - deltaR*(t(r+1)-t(r-1))/(4*(r-

    1)*deltaR);

    t(r) = tnew(r);

    end

    end

    The temperature distribution at steady state is obtained as in Tab. 4.3

    Table 4.3 Temperature distribution for Example 4.4

    Node 1 Node 2 Node 3 Node 4 Node 5 Node 6

    30.0 34.8 49.2 73.2 106.8 150.0

    Example 4.5

    Consider a problem of heat conduction as shown in figure below. The inner side is

    maintained at 50 oC and outer side is exposed to ambient temperature of 30oC and h =

    50W/m2. Determine the temperature distribution between these two boundaries. (Consider

    k= 30W/moC)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    38/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Figure 4.12 1D heated cylindrical bar exposed to ambient temperature.

    Solution

    Here, we consider one-dimensional heat conduction in radial direction and the governing

    equations reduced to

    01

    2

    2

    =+

    r

    T

    rr

    T(4.103)

    The discretized form of the governing equation is written as

    02

    2 11211 =+ +

    ++rrTT

    rTTT

    i

    iiiii (4.104)

    and the equation for the internal nodes is given by

    ( )

    i

    iiiii

    r

    TTr

    TTT

    42

    1111 ++ +

    = 0 (4.105)

    For the internal surface node, the prescribed temperature condition gives

    CT

    0

    1 500= (4.106)

    Due to the convective heat transfer condition at the end point given as

    ( )fw TTh

    r

    Tk =

    (4.107)

    Discretise the above equation with central difference leads to

    ( )fi

    ii TTk

    h

    r

    TT=

    +

    max

    1max1max

    2(4.108)

    or

    ( ) 1maxmax1max2

    + +

    = ifii TTTk

    rhT (4.109)

    Substitute Eq. (4.109) into the discretized governing equation gives

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    39/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    022

    22

    1max

    2

    max

    2

    =+

    +

    +

    +

    +

    iimacfimaci

    imac

    imac TrTk

    hr

    k

    rhrT

    kr

    hr

    k

    rhr (4.110)

    or

    +

    +

    +

    +

    =

    22

    22

    max

    2

    max

    1maxmax

    2

    max

    max

    kr

    hr

    k

    rhr

    TrTk

    hr

    k

    rhr

    T

    i

    i

    iifi

    i (4.111)

    The computer program code written in MATLAB is given as below

    clear all; clc; close all;

    radius = 0.5;

    mesh = 5;

    imax = mesh+1;

    deltaR =radius/mesh;

    t(1:imax) = zeros;

    maxiter = 10000;

    tf = 30;

    h=50;

    k=30;

    t(1) = 50;

    for iter = 1:maxiter

    for i = 2:imax-1

    tnew(i) = (t(i+1)+t(i-1))/2 + deltaR*(t(i+1)-t(i-1))/...

    (4*(i-1)*deltaR);

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    40/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    end

    i = imax;

    ri=(i-1)*deltaR;

    tnew(i)=((ri*2*deltaR*h+deltaR^2*h)*tf/k + 2*ri*t(i-1))/...

    (ri*2*deltaR*h/k + deltaR^2*h/k +2*ri);

    for i = 2:imax

    t(i)=tnew(i);

    end

    end

    4.3.1 Two-Dimensional Steady State Heat Conduction in Cylindrical Geometry.

    The governing equation for 2D steady state heat conduction in cylindrical geometry is

    given as

    011

    2

    2

    22

    2

    =

    +

    +

    T

    rr

    T

    rr

    T(4.112)

    Let imax andjmax be the number of nodes in the rand directions respectively. Using the

    double notation, the discretized form of the governing equation at node (i,j) is given by

    02

    2

    222

    ,1,1,,1,1

    2

    ,,1,1 =

    ++

    +

    + +++i

    jijiji

    i

    jijijijiji

    r

    TTT

    rr

    TT

    r

    TTT(4.113)

    Let the surface temperature be specified as

    sji TT =max, (4.114)

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    41/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    for each angle j . At the centerr= 0, it is not possible to apply the LHospital rule. On

    this mesh, the heat conduction in Cartesian coordinates which is discretized as

    0222

    02

    0 = ++ + rTTT

    rTTT SNWE (4.115)

    is used. Here we consider that ryx ==

    Problem 4.6

    The temperature at the surface of half cylinder is fixed at 100oC while the lower surface is

    maintained at 300oC. Compute the temperature for nodes shown in Figure 4.13

    Figure 4.13 Differentially heated surface of half cylinder

    Solution

    The governing equation for this case can be written as

    0

    112

    2

    22

    2

    =

    +

    +

    T

    rr

    T

    rr

    T

    (4.116)

    Applying second order central difference and Eq. (4.116) can be discretized into the

    following algebraic expression as follow

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    42/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    02

    2

    2

    22

    ,1,1,,1,1

    2

    ,,1,1 =

    ++

    +

    + +++i

    jijiji

    i

    jijijijiji

    r

    TTT

    rr

    TT

    r

    TTT(4.117)

    For the internal nodes, Eq. (4.117) can be rewritten as

    1,222

    2

    1,222

    2

    ,1222

    222

    ,1222

    222

    ,

    44

    2

    44

    2

    44

    2

    44

    2

    +

    +

    +

    ++

    ++

    +++

    =

    ji

    i

    ji

    i

    ji

    i

    iiji

    i

    iiji

    Trr

    rT

    rr

    r

    Trr

    rrrT

    rr

    rrrT

    (4.118)

    or

    1,1,,1,1, ++ +++= jijijijiji CTCTBTATT (4.119)

    where

    222

    2

    222

    222

    222

    222

    44

    2

    44

    2

    44

    2

    rr

    rC

    rr

    rrrB

    rr

    rrrA

    i

    i

    ii

    i

    ii

    +

    =

    +

    =

    ++

    =

    (4.120)

    The computer program code written in MATLAB is given as below

    clear all;clc;close all;

    radius = 0.05;

    theta = pi;

    k = 20;

    t_wall1 = 100;

    t_wall2 = 300;

    l=0;

    lmax=10000;

    imax=3;

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    43/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    jmax=7;

    imm1=imax-1;

    jmm1=jmax-1;

    dr = radius/imm1;

    dthe = theta/jmm1;

    t(imax,jmax)=zeros;

    %boundary condition

    for j = 1:jmax

    t(imax,j) = t_wall1;

    end

    for i = 1:imm1

    t(i,1) = t_wall2;

    t(i,jmax) = t_wall2;

    end

    t0 = 300;

    for l=1:lmax

    for i=1:imm1

    for j = 2:jmm1

    A = (2*((i*dr)^2)*(dthe^2)+(i*dr)*dr*(dthe^2))/(4*((i*dr)^2)*dthe^2

    +4*dr^2);

    B = (2*((i*dr)^2)*(dthe^2)-(i*dr)*dr*(dthe^2))/(4*((i*dr)^2)*dthe^2

    +4*dr^2);

    C = 2*(dr^2)/(4*((i*dr)^2)*dthe^2 + 4*dr^2);

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    44/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    if i == 1

    tnew(i,j)=A*t(i+1,j) + B*t0 +C*t(i,j+1)+C*t(i,j-1);

    else

    tnew(i,j)=A*t(i+1,j) + B*t(i-1,j) +C*t(i,j+1)+C*t(i,j-1);

    end

    t(i,j)=tnew(i,j);

    end

    end

    end

    disp(t)

    Problem 4.7

    The half cylinder has ./3 mWk= oC and is exposed to the convection environment at 20oC.

    The lower surface is maintained at 100oC. Compute the temperature for nodes shown in

    Figure 4.14

    Figure 4.14 Heated half cylinder and exposed to ambient temperature

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    45/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Solution

    The governing equation for this case can be written as

    011

    2

    2

    22

    2

    =++ T

    rr

    T

    rr

    T(4.121)

    Applying second order central difference, Eq. (4.121) can be discretized into the following

    algebraic expression as follow

    02

    2

    222

    ,1,1,,1,1

    2

    ,,1,1 =

    ++

    +

    + +++i

    jijiji

    i

    jijijijiji

    r

    TTT

    rr

    TT

    r

    TTT(4.122)

    For the internal nodes, Eq. (4.122) can be rewritten as

    1,1,,1,1, ++ +++= jijijijiji CTCTBTATT (4.123)

    where A, B and C are expressed in Eq. (4.120)

    Fig. 4.15 Coordinates of node and the center and its neighbor

    At the center node of the surface, we have to consider a Cartesian based governing

    equation which is

    02

    2

    2

    2

    =

    +

    y

    T

    x

    T(4.124)

    After discretization, Eq. (4.124) becomes (See Fig. 4.15)

    ( )0

    222

    021max,1

    2

    0max,11,1 =

    ++

    + +r

    TTT

    r

    TTT jNj(4.125)

    Here ryx ==

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    46/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    Then

    ( )

    4

    21max,1max,11,1

    0

    ++++= jNjTTTT

    T (4.126)

    Since the boundary is exposed to the ambient temperature where

    ( )fTTh

    y

    Tk =

    0 (4.127)

    or

    ( ) ( )f

    jNTT

    k

    h

    y

    TT=

    +0

    21max,1

    2(4.128)

    and therefore

    ( ) ( )fjN TTk

    yhTT

    = + 021max,1

    2(4.129)

    Substitute into Eq. (4.128) and rearrange gives

    ( )

    +

    +++

    =+

    k

    yh

    Tk

    yhTTT

    Tfjj

    214

    22 21max,1max,11,1

    0 (4.130)

    Here, ry = then

    ( )

    +

    +++

    =+

    k

    rh

    Tk

    rhTTT

    Tfjj

    214

    22 21max,1max,11,1

    0 (4.131)

    The discretized equation for the top boundary nodes can be written as

    0,2,1,11,11, iiiii CTCTBTATT +++= + (4.132)

    Since these boundary nodes are exposed to the ambient temperature where

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    47/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    ( )fw TT

    k

    h

    r

    T=

    (4.133)

    or in discretized form, Eq. (4.133) becomes

    ( )fi

    i

    iiTT

    k

    h

    r

    TT=

    1,

    2,0,

    2 (4.134)

    and therefore

    ( )fiiii TT

    k

    hrTT = 1,2,0, 2 (4.135)

    Substitute Eq. (4.135) into Eq. (4.134) yields

    +++

    +

    = + fiiiii

    i Tk

    hCrCTBTAT

    hCrk

    kT

    22

    22,1,11,11, (4.136)

    The computer program code written in MATLAB is given as below

    clear all;clc;close all;radius = 0.05;theta = pi;k = 3;t_wall1 = 100;

    tf = 20;h=50;imax=3;jmax=7;imm1=imax-1;jmm1=jmax-1;dr = radius/imm1;dthe = theta/jmm1;t(imax,jmax)=zeros;%boundary condition

    for j = 1:jmaxt(imax,j) = t_wall1;endfor l=1:100000t0 = (t(1,1)+ t(1,jmax)+2*t(1,(jmax+1)/2)+2*dr*h*tf/k)/(4+2*dr*h/k); for i=1:imm1

  • 7/31/2019 Comp Heat Transfer4 Repaired)

    48/48

    Chapter Four Finite Different Application to Steady State Heat Conduction

    for j = 1:jmaxA = (2*((i*dr)^2)*(dthe^2)+(i*dr)*dr*(dthe^2))/

    (4*((i*dr)^2)*dthe^2 +4*dr^2);B = (2*((i*dr)^2)*(dthe^2)-(i*dr)*dr*(dthe^2))/

    (4*((i*dr)^2)*dthe^2 +4*dr^2);

    C = 2*(dr^2)/(4*((i*dr)^2)*dthe^2 + 4*dr^2);

    if i == 1 && j == 1tnew(i,j)=(A*t(i+1,j) + B*t0

    +2*C*t(i,j+1)+2*C*(i*dr)*dthe*h*tf/k)/...(1+2*C*(i*dr)*dthe*h/k);

    elseif i ==1 && j~=1 && j~=jmaxtnew(i,j)=A*t(i+1,j) + B*t0 +C*t(i,j+1)+C*t(i,j-1);

    elseif j ==1 && i ~=1tnew(i,j)=(A*t(i+1,j) + B*t(i-1,j)

    +2*C*t(i,j+1)+2*C*(i*dr)*dthe*h*tf/k)/...

    (1+2*C*(i*dr)*dthe*h/k); elseif i ==1 && j ==jmax

    tnew(i,j)=tnew(1,1); elseif i ~=1 && j == jmax

    tnew(i,j)=tnew(2,1); else

    tnew(i,j)=A*t(i+1,j) + B*t(i-1,j)+C*t(i,j+1)+C*t(i,j-1); end

    t(i,j)=tnew(i,j); end

    endenddisp(t')


Recommended