Mayur Jerol Project2

Embed Size (px)

DESCRIPTION

NM methods project 1 d heat equation isae ensma

Citation preview

  • Numerical Methods

    Practical Work 2

    1 Dimensional Heat Equation

    Mayur Srivatsav V S

    Jerol Soibam

    October 2015

    1

  • 1 Introduction

    We will focus on solving partial dierential equation Cp@T@t +div(~') = 0 in which T is temperature

    and ~' = ~gradT is Fourier Flux. This simplifies in 1 D as:

    Cp@T

    @t+

    @

    @x(@T

    @x) (1)

    , Cp, represent the density(kgm3),the heat capacity(Wm2K1) and the conductivity(Wm2K1)of the material. This problem can be found when considering the temperature evolution in a bar oflength L. Initial and boundary conditions have to be fixed in order to solve a well-posed problem:

    T (0, x) = 400 Initial

    T (t, 0) = 300 Dirichlet Condition

    T (t, L) = 500 Dirichlet Condition (2)

    Figure 1:

    Time and spatial variable x will be uniformly discretised: t and x = 1/(n+ 1)

    2 Finite dierence explicit method

    2.1 Relation between the Space and Time coordinate

    Assuming the value of to be constant and equal to 1, to use the dimensional numbers eT ,x,t, fromequation 1 we have:

    @ eT@ t

    =@2 eT@x2

    (3)

    LetT kj = T (tk, xj)

    2.2 To obtain the 1-D Heat equation

    In order to obtain the heat equation:

    T k+1j = cTkj1 + (1 2c)T kj + cT kj + cT kj+1where c =

    T

    x2(4)

    To obtain the Time derivative, we use the First derivative approximation of the Forward dierence,

    y0(t) =

    y(t+ h) y(t)h

    y0(t) =

    y(t+t) y(t)t

    @T

    @t=

    T (t+t) T (t)t

    @Tj@t

    =T k+1j T kj

    t(5)

    To obtain the Space derivative, we use the Second derivative approximation of the Centereddierence,

    y(x) =y(x+ h) 2y(x) + y(x h)

    h2

    1

  • @2T

    @x2=

    T (x+ h) 2T (x) + T (x h)h2

    @2T

    @x2=

    T (x+x) 2T (x) + T (xx)x2

    @2T

    @x2=

    c(T kj+1 2T kj + T kj1)t

    , where x2 =t

    c, = 1 (6)

    Using the eqn(3) we equate the equations (5) and (6) to obtain,

    T k+1j T kjt

    =c(T kj+1 2T kj + T kj1)

    t

    T k+1j = cTkj+1 + (1 2c)T kj + cT kj1 (7)

    3 Boundary Conditions

    T (0, x) = 0.5

    T (t, 0) = 0

    T (t, 1) = 1

    On assuming values less than 2 for j, we see that the equation(7) tends to give a negative result,and hence we take the values of j to be between 2 and (n-1), i.e. 2 < j < (n 1).

    At j = 2 , T k+12 = cTk3 + (1 2c)T k2 + cT k1 (8.1)

    At j = 3 , T k+13 = cTk4 + (1 2c)T k3 + cT k2 (8.2)

    .

    .At j = (n-1) , T k+1n1 = cT

    kn + (1 2c)T kn1 + cT kn2 (8.3)

    4 System of equations in Matrix form

    Applying the boundary condition on the equation (7), we obtained numerous results for dierentvalues of j. In order to represent all the results in a simplified manner, we depict it in a matrixform:

    ~T k+1 = A~T k +~b

    2

    System of Equations

  • 5 Fortran program to solve the 1 dimensional heat equation

    5.1 Results

    Figure 2: Stable condition at CFL = 0.45

    3

  • 6 Determination of stability for c > 1/2

    Figure 3: Unstable condition at CFL > 0.5

    6.1 Stability of the Equation

    It is seen from the above graphs that when CFL = 0.45, the Temperature at time step with respectto Space coordinate is a smooth curve, and is stable in nature until CFL = 0.5. When CFl isvaried beyond 0.5, the temperature evolution curve is highly irregular.

    7 Von Neumann Condition

    T kj+1 T kj12x

    = 50

    T kj+1 = 100x+ Tkj1 (9)

    Now, putting the value of T kj+1 in equation (7), we get,

    T k+1j = c(100x+ Tkj1) + (1 2c)T kj + cT kj1

    T k+1j = 2cTkj1 + (1 2c)T kj + (100 c x) (10)

    For executing the program to satisfy the Von Neumann condition, certain changes are required inthe code used to solve the 1 dimensional heat equation, as shown below:

    4

  • 7.1 Results

    Figure 4: Stable condition at CFL = 0.45

    Figure 5: Unstable condition at CFL = 0.51

    The stability of the above graphs is determined by solving the Von Neumann condition. For astable condition the value of G is such that 1