Professional Documents
Culture Documents
xD
ui 1 u xi 1 u ( xi x )
Eu ( x ) e u ( x)
Eui u ( xi 1 ) u ( xi x)
xD
therefore E e therefore Eui ui 1
1 Eui 1 ui 2 etc from the defintion of E
D ln E
x therefore E 2ui ui 2
E nui ui n
Finite Difference Method continued
ui ui 1 ui Eui ui ( E 1)ui
E 1 E=1+
1
therefore D ln E
x
1
or , D(u i )= ln E (ui )
x
u 1
or , ln(1 )(ui )
x i x
2
u 1 3 4 .... A
... ui
x i x 2 3 4
E 1 E 1 E 1
2 3 4
u 1
E 1 ... ui ( B)
x i x 2 3 4
Eui ui 1 , Eui 1 E 2ui ui 2 ;.......E nui ui n
For 1st order accuracy we will consider only one term on RHS of Equation (B)
u 1 Eui ui ui 1 ui
[ E 1]ui
x
i x x x
Finite Difference Method continued
Backward Difference Formula : u ( x) x 2 u ( x) x3 u ( x)
u ( x x) u ( x) x ...
x 2! x 2 3! x 2
2 3 4
1
x.D xD xD
E u ( x) 1 x.D .... u ( x)
2! 3! 4!
xD xD xD
2 3 4
E 1 1 x.D ....
2! 3! 4!
=e xD
-xD ln E 1
1
D=- ln( E 1 ) ... C
x
Again,
ui ui ui 1 ui E 1ui 1 E 1 ui
1 E 1 E 1 1
Finite Difference Method
c continued
1 1
D ln(1 ); Dui ln(1 )(ui )
x x
u 1 ( ) 2 ( )3 ( ) 4
ui (C )
x i x 2 3 4
1 2 1 3
u 1 1 E 1 E
x i x
1
E 1
2 3
ui ( D)
1ST order accuracy :- Only 1st term of equation (A) or equation (B) is considered.
u 1 1 ui E 1ui ui ui 1
[1 E ]ui
x i x x x
2nd order accuracy:- upto 2nd term of equation (A) or equation (B) is considered.
u 1
1 E
1 2
x i x
1 E
1
2
ui
u 3ui 4ui 1 ui 2 x 2 3 u
x i 2x 3 x 3
Finite Difference cMethod continued
Central difference Formula 1 1
E 2 ui u 1 ; E 2 ui u 1
i i
2 2
1 1
ui u 1 u 1 E E 2 ui
2
i i
2 2
1 1
E2 E2
1 1
E2 E2
Using the definition of mean,
2
from forward difference we get, E ex.D
1
E 2 ex.D /2
1
From backward difference , E2 ex.D / 2
1
E 2 ex.D /2
e x e x
E 1/2
E 1/2
e xD /2
e xD/2
2sinh xD / 2 using sinh x
2
c
Finite Difference Method continued
xD / 2 sinh 1
2
1
D
x
2sinh 1
/2
u 1 3 3 5 5 7
........ ui
x i x 24 640 7168
5 7
2 2 2 2 2
3 1 .3 . 1 .3 .5
u 2 1 2
/ 2 2
2
...... ( E )
/ 2
x i x 3! 5! 7!
3
1/ 2 1/2
E E
u
x i
x
1 1/2
E E 1/2
24
u ....................( F )
i
2nd order accuracy with 1st term only:
u 1 1/2 1 1
u
1/2 1/2 1/2 3
E u E u . E E
x i x x 24
i i i
e
3
xD /2
ui 1/2 ui 1/2 e xD /2
ui
x 24.x
ui 1/2 ui 1/2 x 2 D 3ui
x 24 24
ui 1/2 ui 1/2 x 2 3u
x 24 x 3
E1/2 E 1/2
To avoid the half integer mesh point, the definition of mean may be employed.where =
2
2 2
1 E1/ 2 E 1/2 1
1/2
E 1/2
2 2 E 4
1 2 4
2
1 2 /4
Now from equation F we have
u 3 5 7
3 5 ......
x 24 640 7168
i x 1 2 /4
1
2 2 3 5 7
1 3 5 ......
x 4 24 640 7168
2 3 4 15 6 3 3 5 5 7
1 ... ...... ui
x 8 816 4864 24 640 7168
1 1 E E 2 E 2 E 2
2 u
E E 2 ui i
x 2 3! x
ui 1 ui 1 x 2 3 u
2x 6 x 3
Higher order derivative by Finite Difference Method
Backward difference:-
u 1
ln 1 ui
x i x
nu 1
n n ln 1 ui
n
x i x
2 3 4 n
1
n .... ui
x 2 3 4
nu 1 n n n 1 n 3n 5 n 2 n n 2
n n ......(2)
x x 2 24 48
1 1
Where, 1 E E 1
Higher order derivative by Finite Difference Method
Forward Difference
u 1
ln 1 ui ...... First order forward difference
x i x
nu 1
n ln 1 ui
n
n
taking nth power on both the sides
x i x
n
n u 1 2 3 4
n
n
.... ui
x x 2 3 4
1 n
2
nu n 1 2
3
4
n n 1 n 2 2
n
n n. ... ....
x i x 2 3 4 2! 2
1 n n 1
2
n 1
3
n 1
4
n n 1 n 2 4 6 8
n n. n. . n. . ..... ... ... ui
x 2 3 4 2! 4 9 16
1 n n n 1 n 3n 5 n 2 n n 2 n 3 n 3
n .... ui 1
x 2 24 48
Where, E 1 E=1+
Higher order derivative by Finite Difference Method
Central difference for n =even
u 1 1
2sin h ui
x x 2
n 3 5 7 n
u 1 3 5
n n 24 640 7168 ...... ui
x x
n n 2 n 22 5n 4 n 5 n 1
n
x 1 24 64 90 45 7 5 .....(3)
1 1
Where, ui u 1 u 1 E 2 E 2 ui
i i
2 2
1 1
E2 E2
Higher order derivative by Finite Difference Method
Central difference for n=odd
n
n
u 2 1
n
2 x
sin ui
x 2
1
4
n
n 3 2 5n2 52n 135 4
n 1 ui 4
x 24 5760
1 1
E2 E2
1 1
Where, mean, and E E
2 2
2
Finite Difference Method
x y i , j x y 6 6
Finite Difference Method: SUMMERY
nu 1 n n n 1 n 3n 5 n 2 n n 2 n 3 n 3
1. .... ui 1 Forward
x n x n
2 24 48
Where, E 1 E=1+
nu 1 n n n 1 n 3n 5 n 2 n n 2
2. ......(2)Backward
x n x n 2 24 48
Where, 1 E 1 E 1 1
nu n n 2 n 22 5n 4 n 5 n 1
3. 1
24 5 .....(3) Central Diff, fro n= even
x n
x n 64 90 4 7 5
1 1
E E 2 2
nu n n 3 2 5n 2 52n 135 4
4. n
1 ui 4 Central Diff, fro n= odd
x x n 24 5760
12 1
1 1
Where, mean, E E / 2 and
2
E E 2
2
5. For mixed derivatives :
Using Equation either (1) or (2) or(3) or(4) depending on the Backward,
or Forward or Central Diff (n=even) or Central Diff (n=odd) respectively.
e.g. for central difference and n=odd.
2u 1 x2 4
y2 4
x x 1 O( x ) y y 1 O(y ) ui , j
x y i , j x y 6 6
Finite Difference Method
u ui1, j ui, j u ui , j 1 ui , j
Forward Difference, = and =
x x y y
u ui , j ui1, j u ui , j ui , j 1
Backward Difference, = and =
x x y y
u ui 1, j ui 1, j u ui1, j ui 1, j
Central Difference, = and =
x 2 x y 2y
2u ui2, j 2ui1, j ui, j
Forward Difference, =
x 2 x 2
2u ui, j2 2ui, j1 ui, j
and =
y 2 y 2
Backward Difference,
2u ui, j 2ui1, j ui2, j
=
x2 x 2
2u u 2u u
i, j i , j 1 i , j 2
and =
y 2 y 2
2u u
i 1, j 2ui , j ui1, j
Central Difference, =
x2 x2
2u u
i , j 1 2ui , j ui , j 1
and =
y 2 y 2
Problem -1: 2-d heat diffusion
T=0K
T=0K 20 cm X 20 cm T=0K
T=300K 20 cm X 20 cm T=0K
T=400K
General Governing Equation is :
k T 0
For 2 D, Governing Equation is :
d dT d dT
k k 0...( A)
dx dx dy dy
Problem -3: 2-d heat diffusion
T=500K
T=300K 20 cm X 20 cm T=200K
T=400K
General Governing Equation is :
k T 0
For 2 D, Governing Equation is :
d dT d dT
k k 0...( A)
dx dx dy dy
Problem -6.5: 2-d heat diffusion
T
k h(T T f ); (Convective heat transfer )
y
T=T0 20 cm X 20 cm
T
k q, ( Heat flux q )
x
T k=205 W/m-K
0, ( Insulated ; i.e. flux, q 0) q=50 w/m2
x
General Governing Equation is : T0=100oC
k T 0 Fluid Temp,Tf=50oC
For 2 D, Governing Equation is : (Bi), Biot No.=hL/k=2
d dT d dT
k k 0...( A)
dx dx dy dy
Problem -4: 2-d heat diffusion
Non-dimensionalising the governing equation and all the BCs with the following:
x y T Tf
x* ; y* , We get the following
L L T0 T f
Governing Equation is :
d 2 d 2
2 2
0...(1)
dx * dy *
Left Boundary , x* 0; 1
qL
Right Boundary , x* 1;
x * k (T0 T f )
Bottom Boundary , y* 0; 0
y *
Top Boundary , y* 1; Bi *
y *
Problem -6.4: 1-d Conduction-Convection
Tf
scr_conduction_convection.m
T=Tw L T
at x L, 0 (Adiabatic condition)
x
For steady state 1-d conduction-convection without source is:
2T hP
2
(T T f ) 0 (1)
x kA
Boundary conditions are:
T
At x=0, T=Tw and at x= L , 0 (2)
x
2
Nondimensional form are: 2
Bi b 0 (1a)
x *
At x*=0, 1, and at x*= 1 , * 0 (2a)
x
hL PL AP
Where, Bi ( Biot no.); b ( Area ratio), P Perimeter ,
k A Ac
(1) Take Bi 0.3, 0.4, 0.5; b 3; solve temperature field .
(2) Take Bi 0.3; b 3, 4,5 ; solve temperature field .
Problem -6: 1-d UNSTEADY
Unsteady_1D-Heatflow.m
T=Tw T=Ti T=Tw
L
For 1-d transient heat transfer without source is:
2T cP T
2
(1)
x k t
Boundary conditions are:
At x=0, T=Tw and at x= L , T=Tw (2)
Initial Condition i.e. at t=0, T=Ti i.e. at all the nodes except boundaries.
Non-dimensionalising the governing equation and all the BCs and ICs with the following:
x y T Tw t
x* ; y* , and = 2 , where = Thermal difusivity;We get the following
L L Ti Tw L
2
Nondimensional form are: 2
(1a)
x *
At x*=0, 0 and at x*= 1 , 0 (2a)
And Initial Condition i.e. at =0, 1
Continueed
BTi n1,
1
j DTi , j
n 1
ATi n1,
1
j Ci
n
n 1 n
T1, j 0
1 0 0 0 . . . . 0 0
T2, j C2, j
0 D A 0 . . . . 0 0
0 T3, j C
B D A 0 . . . 0 0
3, j
0 0 B D A 0 . . . . T4, j C
4, j
0
0 0 B D A 0 . . . .
.
.
. . 0 0 B . A 0 . . .
. . 0 0 0 . . A 0 0 .
.
0 . 0 0 0 0 . . A 0 C
T
N 1, j N 1, j
0 . 0 0 0 . 0 B D A T C
N , j N , j
0
0 0 0 0 . . 0 0 1 ( N 1) X ( N 1)
TN 1, j 1
( N 1,1) N 1,1
Thomas Algorithm forTriDiagonalMatrixalgorithm(TDMA)
d x ax
1 1 1 2
c 1
................. A.1
b x d x a x
2 1 2 2 2 3
c
2
..............A.2
b x d x a x
3 2 3 3 3 4
c
3
.................A.3
b x d x a x
4 3 4 4
c
4 5 4
........................................................................
bN-1 x d x a x c
N -2 N -1 N -1 N -1 N N -1
..............A.4
b x d x
N N 1 N N
c N
...............A.5
A.2 d A.1 b
1 2
db x d d x d a x c d
1 2 1 1 2 2 1 2 3 2 1
- b d x ab x cb
2 1 1 1 2 2 1 2
................................................................ ...
d d a b x d a x c d c b
1 2 1 2 2 1 2 3 2 1 1 2
d 2
b a / d 1 x a x c b c / d
2 1 2 2 3 2 2 1 1
d ' x a x c'
2 2 2 3 2
........................ A.6
d ' d - b a / d , c' c -b c / d
2 2 2 1 1 2 2 2 1 1
c by c - b c / d c ' .
2 2 2 1 1 2
Similarly,(A.7) is obtained from(A.3) bdropping first term, replacing d3 by d3 - b3 a2 / d2 d '3
Keeping third term unchanged and by replacing c by c - b c ' / d ' c '
3 3 3 2 2 3
& c 'i ci - bc
i 'i-1 / d 'i-1 where i 2,3..............N
for i=3 to N
c(i 1,1) b(i, i 1)
c '(i,1) c(i,1)
d '(i 1, i 1)
a(i 1, i ) b(i, i 1)
d '(i, i ) d (i, i )
d '(i 1, i 1)
n 1
1 0 0 0 . . . . 0 0 T1 0
0 d 22 a23 0 . . . . . 0 T2 C 21
' '
0 0 d33 a34 0 . . . . 0 T3 C 31
' '
0 0 0 d 44 a45 0 . . . . T
4 C 41
0 . 0 0 . . 0 . . . T5 .
. . . 0 0 . . 0 . . . .
. . . . 0 0 . . 0 . . .
0 . . . . 0 0 . aN 1, N . T
N 1 .
0 . . . . '
. 0 0 d NN aN , N 1 T C
N N ,1
0 0 0 . . . . . 0 1 N 1XN 1 TN 1 N 1 X 1
1