Assignment - 1, 2, 3 (Save)
Assignment - 1, 2, 3 (Save)
Assignment - 1, 2, 3 (Save)
Submitted By
Aayush Mishra (2021TH01)
Abhay Kumar (2021TH02)
Abhishek Singh (2021TH04)
Ajit Kumar (2021TH05)
Akash Saxena (2021TH06)
1
Contents
Assignment-1...................................................................................................................................1
Solution............................................................................................................................................2
Using Finite Volume Method.......................................................................................................2
Using Finite Difference Method...................................................................................................6
Analytical Solution...........................................................................................................................7
Flow Chart.......................................................................................................................................8
Sci-lab Code...................................................................................................................................11
Finite Volume Method...................................................................................................................16
Inputs.........................................................................................................................................16
Outputs.......................................................................................................................................16
Finite Difference Method...............................................................................................................18
Inputs.............................................................................................................................................18
Outputs...........................................................................................................................................18
Assignment-2.................................................................................................................................20
Solution..........................................................................................................................................21
Using Finite Volume Method.........................................................................................................21
Finite Difference Method...............................................................................................................24
Solution..........................................................................................................................................25
Analytical Solution.........................................................................................................................26
SCI-LAB Code...............................................................................................................................30
Finite Volume Method...................................................................................................................35
Inputs.............................................................................................................................................35
Outputs...........................................................................................................................................35
Finite Difference method................................................................................................................37
INPUTS.........................................................................................................................................37
Outputs...........................................................................................................................................37
X = 0, T = 500
X = L, T= 100
Using:
Finite volume method
Finite difference method
System of linear equation should be solved by
TDMA
Gauss-seidal iteration method
Jacobin method
SOR method
Compare the numerical solution with exact solution of above equation
for different number of node Compare numerical solution with results
of commercial code-FLUENT
1
Solution
Assumptions:-
1. Steady state.
2. One dimensional heat flow.
3. Thermal conductivity of material is independent of temperature.
4. Material is homogeneous and isotropic.
5. No heat generation.
6. Negligible radiation exchange with surrounding.
∂
( )
k
∂T
∂x ∂ x
=0
∫ ∂∂x (k ∂T
∂x )
dV =0
CV
∭ ∂∂x ( k ∂∂ Tx ) dxdydz=0
w
A=dydz
e
∫ ∂∂x ( k ∂∂ Tx ) A dx=0
w
[( kA
∂T
) (
∂x e
− kA
∂T
∂x ) ]=0
w
[ ke A e
( T E −T P
∂ xe ) (
T −T W
−k w Aw P
∂ xw
=0
)]
By rearranging all terms
2
( ke A e kw A w
+
∂ xe ∂ xw )
T P=
k e Ae
∂ xe
T E+
k w Aw
∂ xw W
T
aE aW aP Su
1 1 a P=aW + aE 0
∂x ∂x
( ) ( )
T E −T P T −T B
kA −kA P =0
∂x ∂x
2
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
1 0 a P=aW + aE −S P 2 −2
T
∂x ∂x B ∂x
3
kA ( T ∂−Tx )−kA ( T ∂−Tx )=0
P W A P
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
0 1 a P=aW + aE −S P 2 −2
T
∂x ∂x A ∂x
1 1 0 a P=aW + aE −S P 2 −2
T
∂x ∂x B ∂x
2 1 1 a P=aW + aE −S P 0 0
∂x ∂x
3 1 1 a P=aW + aE −S P 0 0
∂x ∂x
1 1 a P=aW + aE −S P 0 0
∂x ∂x
n-1 1 1 a P=aW + aE −S P 0 0
∂x ∂x
n 0 1 a P=aW + aE −S P 2 −2
T
∂x ∂x A ∂x
( )
a P −ae 0 0 0 0
−aw a P −ae ⋯ 0 0 0
0 −aw aP 0 0 0
⋮ ⋱ ⋮ =Tridiagonal Matrix
0 0 0 aP −ae 0
0 0 0 ⋯ −a w aP −ae
0 0 0 0 −a w aP
4
[] []
T1 Su
T2 Su
T3 Su
T= ⋮ =Unknown matrix, B= ⋮ =Known matrix
⋮ ⋮
T n−1 Su
Tn Su
( )[ ][ ]
a P −ae 0 0 0 0 T1 Su
−aw a P −ae ⋯ 0 0 0 T2 Su
0 −aw aP 0 0 0 T3 Su
⋮ ⋱ ⋮ * ⋮ = ⋮
0 0 0 aP −ae 0 ⋮ ⋮
0 0 0 ⋯ −a w aP −ae T n−1 Su
0 0 0 0 −a w aP Tn Su
Now above system of linear equation can be solved by any direct or iterative
method.
∆x∆x ∆x
X=0 ∂
k ( )
∂T
∂x ∂ x
=0 X=L
5
2T 2=T 3+ T 1
2T 3=T 4 +T 2
2T m−2=T m−1+ T m−3
2T m−1=T m +T m −1
2T m=T m+1 +T m−1
[ A ] [ T ] =[ G ]
( )
−2 1 0 0 0 0
1 −2 0 ⋯ 0 0 0
0 1 −2 0 0 0
A= ⋮ ⋱ ⋮ =Tridiagonal matrix
0 0 0 −2 1 0
0 0 0 ⋯ 1 −2 1
0 0 0 0 1 −2
[] []
T1 −T 0
T2 0
T3 0
T= ⋮ =Unknown Vector, G= ⋮ =known Vector
⋮ ⋮
T m −1 0
Tm −T m+1
( )[ ][ ]
−2 1 0 0 0 0 T1 −T 0
1 −2 0 ⋯ 0 0 0 T2 0
0 1 −2 0 0 0 T3 0
⋮ ⋱ ⋮ ∗ ⋮ = ⋮
0 0 0 −2 1 0 ⋮ ⋮
0 0 0 ⋯ 1 −2 1 T m−1 0
0 0 0 0 1 −2 Tm −T m+1
Now above system of linear equation can be solved by any direct or iterative
method.
6
Analytical Solution
2
d T
2
=0 ………. (1)
dx
7
Flow Chart
8
9
10
Sci-lab Code
clear
clc
option= input('select 1. FVM, 2. FDM:')
if(option==1)
// FINITE VOLUME METHOD
l=input('Enter length in (m):')
Tb=input('Enter the left boundary temperature (in Kelvin):')
n=input('Input no of nodes:')
Ta=input('Enter the right boundary Temperature(in Kelvin):')
a(n,n)=0
T(n,1)=0
B(n,1)=0;
dx=l/n;
aw(n)=0
ae(n)=0
su(n)=0
sp(n)=0
ap(n)=0
// COEFFICIENTS OF EQUATION FOR NODE-1
for i=1
aw(i)=0
ae(i)=(1/dx);
su(i)=(2*Tb/dx);
sp(i)=-(2/dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATIONS FOR MIDDLE INTERIOR NODES
for i=2:n-1
aw(i)=(1/dx);
ae(i)=(1/dx);
su(i)=0;
sp(i)=0;
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATION FOR LAST NODE
for i=n
aw(i)=(1/dx);
ae(i)=0
su(i)=(2*Ta/dx);
sp(i)=-(2/dx);
ap(i)=aw(i)+ae(i)-sp(i);
11
end
//CREATING TRIDIAGONAL MATRIX
for i=2:n-1
a(1,1)=ap(1,1);a(1,2)=-ae(1,1);
a(i,i)=ap(i,1);
a(i,i+1)=-ae(i,1);
a(i,i-1)=-aw(i,1);
a(n,n-1)=-aw(n,1);a(n,n)=ap(n,1);
end
for (i=1:n)
B(1)=su(1);
B(i)=0;
B(n)=su(n);
end
printf("1.TDMA,2.Jacobian,3.Seidel,4.SOR\n")
ch=input("Select:")
// TDMA METHOD
if(ch==1)
for i=2:n
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));
end
end
end
for i=2:n
B(i)=B(i)-a(i,i-1)/a(i-1,i-1)*B(i-1);
end
T(n)=B(n)/a(n,n);
for i=n-1:-1:1
T(i)=(B(i)-T(i+1)*a(i,i+1))/a(i,i);
end
else //if ch is not 1
app=input("Enter initial approximation:")
tol=input("Enter tolerance:")
iter=input('Enter no. of iteration:')
if(ch==4)
omega=input("Enter the value of omega:")
end
TN(n,1)=0;
for(i=1:n)
T(i)=app;
end
12
for(m=1:iter)
for(i=2:n-1)
if(ch==2)
TN(1)=(1/ap(1))*(B(1)+ae(1)*T(2));//Temperature based on boundary
condition
TN(i)=(1/ap(i))*(aw(i)*T(i-1)+ae(i)*T(i+1)+B(i));
TN(n)=(1/ap(n))*(aw(n)*T(n-1)+B(n));// JACOBIAN METHOD
elseif(ch==3)
TN(1)=(1/ap(1))*(B(1)+ae(1)*T(2));//Temperature based on boundary
condition
TN(i)=(1/ap(i))*(aw(i)*TN(i-1)+ae(i)*T(i+1)+B(i));
TN(n)=(1/ap(n))*(aw(n)*TN(n-1)+B(n));// SEIDEL METHOD
elseif(ch==4)
TN(1)=((1-omega)*T(1))+(omega*(1/ap(1))*(B(1)+ae(1)*T(2)));//SOR
METHOD
TN(i)=((1-omega)*T(i))+(omega*(1/ap(i))*(aw(i)*TN(i-
1)+ae(i)*T(i+1)+B(i)));
TN(n)=((1-omega)*T(n))+(omega*(1/ap(n))*(aw(n)*TN(n-1)+B(n)));
end
end
err=abs(TN-T)/abs(TN)//Error Calculation
T=TN;
if(err<tol)// To eject from loop if error<tolerence
break
end
end
end
printf("The temperature at %d node are:\n",n)
for(i=1:n)
printf("Temperature%d:%f\n",i,T(i));
end
//ANALYTICAL SOLUTION
T(i)=0;
t1=Tb;
t2=Ta;
printf("The analytical temperature at %d nodes are:\n",n)
for(i=1:n)
T(i)=(((i-1/2)*dx)/l)*(t2-t1)+t1;
printf("%f\n",T(i));
end
//INPUTS
//Finite Difference Method
else
13
l=input("Enter the value of length(m):")
n=input("Number of nodes:")
Tb=input('enter the left side temperature in (kelvin):')
Ta=input('enter the right side temperature in (kelvin):')
dx=l/(n+1);
a=rand(n,n)//intialising arbitrary matrix "A"
for i=1:n//to create a tridiagonal matrix "A"
for j=1:n
if(i==j)then a(i,j)=-2;
elseif(j==i+1)then a(i,j)=1;
elseif(j==i-1)then a(i,j)=1;
else a(i,j)=0;
end
end
end
T=rand(n,1);//temperature matrix
G=rand(n,1);//RHS of equation [a]*[T]=[G]
G(1)=-Tb,G(n)=-Ta;//boundary conditions
for(i=2:n-1)
G(i)=0;
end
printf("1.TDMA 2.Gauss-Seidel 3.Jacobian 4.Successive over relaxation\n")
S=input("SELECT:")
if(S==1)
for i=2:n//calculation of new diagonal elements
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));//Based on thomas algorithm
end
end
end
for i=2:n//matrix operation on matrix[D]
G(i)=G(i)-a(i,i-1)/a(i-1,i-1)*G(i-1);//Based on thomas algorithm
end
T(n)=G(n)/a(n,n);//End node temperature
for i=n-1:-1:1//Calculating temperataur of other nodes in reverse order
T(i)=(G(i)-T(i+1)*a(i,i+1))/a(i,i);
end
else//if S is not 1
I=input("Enter initial approximation:")
tol=input("Enter tolerance:")
if(S==4)
w=input("Enter the value of relaxation parameter:")
14
end
8
TN=rand(n,1);
for(i=1:n)
T(i)=I;
end
for(m=1:1000)
TN(1)=(-0.5)*(G(1)-T(2));//temperature based on boundary conditio
for(i=2:n-1)
if(S==2)
TN(i)=(-0.5)*(G(i)-TN(i-1)-T(i+1));//gauss seidel
TN(n)=(-0.5)*(G(n)-TN(n-1));
elseif(S==3)
TN(i)=(-0.5)*(G(i)-T(i-1)-T(i+1));//jacobian method
TN(n)=(-0.5)*(G(n)-T(n-1));
elseif(S==4)
TN(1)=((1-w)*T(1))+(w*(-0.5)*(G(1)-T(2)));//Succesive
overrelaxation(SOR)
TN(i)=((1-w)*TN(i))+(w*(-0.5)*(G(i)-TN(i-1)-T(i+1)));
TN(n)=((1-w)*T(n))+(w*(-0.5)*(G(n)-TN(n-1)));
end
end
err=abs(TN-T)/abs(TN)//error calculation
T=TN;
if(err<tol)//to eject from loop
break
end
end
end
printf("the temperature at %d nodes are:\n",n)
for(i=1:n)
printf("T%d:%f\n",i,T(i));//calculated temperatures
end
//for analytical solution
m(n)=0;
t1=Tb
t2=Ta
printf("The analytical temperature at %d nodes are\n",n)
for i=1:n
m(i)=(i*dx/l)*(t2-t1)+t1;
printf("T%d:%f\n",i,m(i));//calculated analytical temperature
end
for (i=1:n)
15
E=rand(n,1)
E(i)=(m(i)-T(i))
printf("Error at each node%d:%f\n",i,E(i))
end
end
Outputs
Nod TDM JACOBI SOR(W=1. ANALYT ERR. ERR
G-S ERR. GS
es A AN 5) ICAL JACOBI. SOR
1 486.67 486.55044 486.54 486.621986 486.66667 0.116224 0.128744 0.044681
2 460 459.65133 459.63 459.878174 460 0.348671 0.36956 0.121826
3 433.33 432.78232 432.75 433.150461 433.33333 0.551018 0.584029 0.182872
4 406.67 405.9133 405.9 406.439427 406.66667 0.753366 0.764033 0.22724
5 380 379.10933 379.1 379.744813 380 0.890675 0.903287 0.255187
6 353.33 352.30535 352.34 353.065649 353.33333 1.027985 0.99754 0.267684
7 326.67 325.59012 325.62 326.400392 326.66667 1.07655 1.044667 0.266275
8 300 298.87489 298.96 299.747076 300 1.125115 1.044667 0.252924
9 273.33 272.25678 272.33 273.103461 273.33333 1.07655 0.999574 0.229872
10 246.67 245.63868 245.75 246.46717 246.66667 1.027985 0.913282 0.199497
11 220 219.10933 219.21 219.835817 220 0.890675 0.791293 0.164183
12 193.33 192.57997 192.69 193.207118 193.33333 0.753365 0.640414 0.126215
13 166.67 166.11565 166.2 166.57898 166.66667 0.551019 0.468405 0.087687
14 140 139.65133 139.72 139.949571 140 0.348671 0.283602 0.050429
15 113.33 113.21711 113.24 113.317367 113.33333 0.116223 0.094534 0.015966
16
600
500
400
Temperature
300
200
100
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No of Nodes
1.2
0.8
Absolute Error
0.6
0.4
0.2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No of Nodes
ERR. JACOBI. ERR. GS ERR SOR
Figure 2: Absolute Error vs No of Nodes
17
Finite Difference Method
Inputs
S.No.
1 Length 2 (m)
2 Number of Nodes 15
3 Initial Approximation 1
4 Tolerance 0.0001
Outputs
18
500
450
400
350
Temperature
300
250
200
150
100
50
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No. of Nodes
1.4
1.2
1
Absolute Error
0.8
0.6
0.4
0.2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No. of Nodes
19
Assignment-2
2. Solve the one dimension steady state conduction equation
∂
( )
k
∂T
∂x ∂ x
+ q=0
X = 0, T = 500
X = L, T= 100
Using:
Finite volume method
Finite difference method
System of linear equation should be solved by
TDMA
Gauss-seidal iteration method
Jacobin method
SOR method
Compare the numerical solution with exact solution of above equation
for different number of node Compare numerical solution with results
of commercial code-FLUENT
20
Solution
Assumptions:-
1. Steady state.
2. One dimensional heat flow.
3. Thermal conductivity of material is independent of temperature.
4. Material is homogeneous and isotropic.
5. Negligible radiation exchange with surrounding.
∂
( )
k
∂T
∂x ∂ x
+ q=0
∫
∆V
[ ( ) ]
∂
k
∂T
∂x ∂ x
+ q dV =0
∫ ∂∂x (k ∂T
∂x )
dV + ∫ q dV =0
∆V ∆V
[ ( ]
e
∫
w
∂
∂x
kA
∂T
∂x )
dx +qA dx =0
[( kA
∂T
∂x e
− kA) (
∂T
∂x ) ]+qA ∆ x=0
w
[ (ke A e
T E −T P
∂ xe )
T −T W
−k w Aw P
∂ xw (
+qA ∆ x=0
)]
By rearranging all terms
( ke A e kw A w
+
∂ xe ∂ xw
k A
) k A
T P= e e T E + w w T W + qA ∆ x
∂ xe ∂ xw
aE aW aP Su
1 1 a P=aW + aE q∆ x
∂x ∂x k
( ) ( )
T E −T P T −T B
kA −kA P + qA ∆ x=0
∂x ∂x
2
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
1 0 a P=aW + aE −S P 2 q∆x −2
T B+
∂x ∂x k ∂x
( ) ( )
T P−T W T −T P
kA −kA A −qA ∆ x=0
∂x ∂x
2
22
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
0 1 a P=aW + aE −S P 2 q∆x −2
T A+
∂x ∂x k ∂x
1 1 0 a P=aW + aE −S P 2 q∆x −2
T B+
∂x ∂x k ∂x
2 1 1 a P=aW + aE −S P q∆ x 0
∂x ∂x k
3 1 1 a P=aW + aE −S P q∆ x 0
∂x ∂x k
1 1 a P=aW + aE −S P q∆ x 0
∂x ∂x k
n-1 1 1 a P=aW + aE −S P q∆ x 0
∂x ∂x k
n 0 1 a P=aW + aE −S P 2 q∆x −2
T +
∂x ∂x A k ∂x
( )
a P −ae 0 0 0 0
−aw a P −ae ⋯ 0 0 0
0 −aw aP 0 0 0
⋮ ⋱ ⋮ =Tridiagonal Matrix
0 0 0 aP −ae 0
0 0 0 ⋯ −a w aP −ae
0 0 0 0 −a w aP
23
[] []
T1 Su
T2 Su
T3 Su
T= ⋮ =Unknown matrix, B= ⋮ =Known matrix
⋮ ⋮
T n−1 Su
Tn Su
( )[ ][ ]
a P −ae 0 0 0 0 T1 Su
−aw a P −ae ⋯ 0 0 0 T2 Su
0 −aw aP 0 0 0 T3 Su
⋮ ⋱ ⋮ * ⋮ = ⋮
0 0 0 aP −ae 0 ⋮ ⋮
0 0 0 ⋯ −a w aP −ae T n−1 Su
0 0 0 0 −a w aP Tn Su
Now above system of linear equation can be solved by any direct or iterative
method.
g1 g M −1
-2T1+T2 + k
(∆ x ¿ ¿2+θ0 =0 TM-2-2TM-1+ k
( ∆ x )2 +θ L=0
T −1 T0 T1 T2
∆x∆x ∆x
X=0 X=L
Solution
By central difference method of second order
24
T i +1−2T i +T i−1 qi
2 + (∆ x)
2
=0
(∆ x ) k
X=0, at T=θ0
X=L, at T=θ L
−qi
Ti-1-2Ti+Ti+1 = k
(∆ x )2 for i=1, 2, 3…., M-1
q M −1 q M −1
TM-2-2TM-1+TM=- k
(∆ x )2 TM-2-2TM-1=-TM- k
( ∆ x )2for i=M-1
−q
Let g= k
( ∆ x )2
AT=G
( )
−2 1 0 0 0 0
1 −2 1 ⋯ 0 0 0
0 1 −2 0 0 0
A= ⋮ ⋱ ⋮ =Tridiagonal Matrices
0 0 0 −2 1 0
0 0 0 ⋯ 1 −2 1
0 0 0 0 1 −2
[] []
T1 −T 0 +g
T2 g
T3 g
T= ⋮ = Unknown Vector, G= ⋮ = known vector
T M−2 g
T M−1 g
TM −T M +g
Analytical Solution
Solve above differential equation we are get:
25
q 2 T 2−T 1 qt
T= - 2 k (x ) + [ L
+k] x+T 1
Flow Chart
26
27
28
29
SCI-LAB Code
clear
clc
option=input('select 1. FVM, 2. FDM:')
if(option==1)
// FINITE VOLUME METHOD
l=input('Enter length in (m):')
q=input('enter the heat generation (w/m3):')
k=input('enter the value of thermal conductivity (w/m-k):')
Tb=input('Enter the left boundary temperature (in Kelvin):')
n=input('Input no of nodes:')
Ta=input('Enter the right boundary Temperature(in Kelvin):');
a(n,n)=0
T(n,1)=0
B(n,1)=0;
dx=l/n;
aw(n)=0
ae(n)=0
su(n)=0
sp(n)=0
ap(n)=0
// COEFFICIENTS OF EQUATION FOR NODE-1
for i=1
aw(i)=0
ae(i)=(k/dx);
su(i)=(2*k*Tb/dx+q*dx);
sp(i)=-(2*k/dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATIONS FOR MIDDLE INTERIOR NODES
for i=2:n-1
aw(i)=(k/dx);
ae(i)=(k/dx);
su(i)=(q*dx);
sp(i)=0;
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATION FOR LAST NODE
for i=n
aw(i)=(k/dx);
ae(i)=0
su(i)=(2*k*Ta/dx+q*dx);
30
sp(i)=-(2*k/dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
//CREATING TRIDIAGONAL MATRIX
for i=2:n-1
a(1,1)=ap(1,1);a(1,2)=-ae(1,1);
a(i,i)=ap(i,1);
a(i,i+1)=-ae(i,1);
a(i,i-1)=-aw(i,1);
a(n,n-1)=-aw(n,1);a(n,n)=ap(n,1);
end
for (i=1:n)
B(1)=su(1);
B(i)=(q*dx);
B(n)=su(n);
end
printf("1.TDMA,2.Jacobian,3.Seidel,4.SOR\n")
ch=input("Select:")
// TDMA METHOD
if(ch==1)
for i=2:n
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));
end
end
end
for i=2:n
B(i)=B(i)-a(i,i-1)/a(i-1,i-1)*B(i-1);
end
T(n)=B(n)/a(n,n);
for i=n-1:-1:1
T(i)=(B(i)-T(i+1)*a(i,i+1))/a(i,i);
end
else //if ch is not 1
app=input("Enter initial approximation:")
tol=input("Enter tolerance:")
iter=input('Enter no. of iteration:')
if(ch==4)
omega=input("Enter the value of omega:")
end
TN(n,1)=0;
for(i=1:n)
31
T(i)=app;
end
for(m=1:iter)
for(i=2:n-1)
if(ch==2)
TN(1)=(1/ap(1))*(B(1)+ae(1)*T(2));//Temperature based on boundary
condition
TN(i)=(1/ap(i))*(aw(i)*T(i-1)+ae(i)*T(i+1)+B(i));
TN(n)=(1/ap(n))*(aw(n)*T(n-1)+B(n));// JACOBIAN METHOD
elseif(ch==3)
TN(1)=(1/ap(1))*(B(1)+ae(1)*T(2));//Temperature based on boundary
condition
TN(i)=(1/ap(i))*(aw(i)*TN(i-1)+ae(i)*T(i+1)+B(i));
TN(n)=(1/ap(n))*(aw(n)*TN(n-1)+B(n));// SEIDEL METHOD
elseif(ch==4)
TN(1)=((1-omega)*T(1))+(omega*(1/ap(1))*(B(1)+ae(1)*T(2)));//SOR
METHOD
TN(i)=((1-omega)*T(i))+(omega*(1/ap(i))*(aw(i)*TN(i-
1)+ae(i)*T(i+1)+B(i)));
TN(n)=((1-omega)*T(n))+(omega*(1/ap(n))*(aw(n)*TN(n-1)+B(n)));
end
end
err=abs(TN-T)/abs(TN)//Error Calculation
T=TN;
if(err<tol)// To eject from loop if error<tolerence
break
end
end
end
printf("The temperature at %d node are:\n",n)
for(i=1:n)
printf("Temperature%d:%f\n",i,T(i));
end
//ANALYTICAL SOLUTION
m(n)=0;
t1=Tb
t2=Ta
a=(q/(2*k));
b=(((t2-t1)/l)+((q*l)/(2*k)));
printf("The analytical temperature at %d nodes are\n",n)
for i=1:n
m(i)=((((-a*((i-1/2)*dx)^2))+(b*(i-1/2)*dx))+t1)
printf("%f\n",T(i));
32
end
//Finite Difference Method
else
q=input("Heat Generation(W/m3):")
l=input("Enter the value of length(m):")
k=input("Thermal conductivity(W/m-k):")
n=input("Number of nodes:")
Tb=input('enter the left side temperature in (kelvin):')
Ta=input('enter the right side temperature in (kelvin):')
dx=t/(n+1)
g=q*(dx^2)/k//Assuming constant g=q*(dx^2)/k
a=rand(n,n)//intialising arbitrary matrix "A"
for i=1:n//to create a tridiagonal matrix "A"
for j=1:n
if(i==j)then a(i,j)=-2;
elseif(j==i+1)then a(i,j)=1;
elseif(j==i-1)then a(i,j)=1;
else a(i,j)=0;
end
end
end
T=rand(n,1);//temperature matrix
G=rand(n,1);//RHS of equation [a]*[T]=[G]
G(1)=-Tb-g,G(n)=-Ta-g;//boundary conditions
for(i=2:n-1)
G(i)=-g;
end
printf("1.TDMA 2.Gauss-Seidel 3.Jacobian 4.Successive over relaxation\n")
S=input("SELECT:")
if(S==1)
for i=2:n//calculation of new diagonal elements
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));//Based on thomas algorithm
end
end
end
for i=2:n//matrix operation on matrix[D]
G(i)=G(i)-a(i,i-1)/a(i-1,i-1)*G(i-1);//Based on thomas algorithm
end
T(n)=G(n)/a(n,n);//End node temperature
for i=n-1:-1:1//Calculating temperataur of other nodes in reverse order
T(i)=(G(i)-T(i+1)*a(i,i+1))/a(i,i);
33
end
else//if S is not 1
I=input("Enter initial approximation:")
tol=input("Enter tolerance:")
if(S==4)
w=input("Enter the value of relaxation parameter:")
end
8
TN=rand(n,1);
for(i=1:n)
T(i)=I;
end
for(m=1:1000)
TN(1)=(-0.5)*(G(1)-T(2));//temperature based on boundary conditio
for(i=2:n-1)
if(S==2)
TN(i)=(-0.5)*(G(i)-TN(i-1)-T(i+1));//gauss seidel
TN(n)=(-0.5)*(G(n)-TN(n-1));
elseif(S==3)
TN(i)=(-0.5)*(G(i)-T(i-1)-T(i+1));//jacobian method
TN(n)=(-0.5)*(G(n)-T(n-1));
elseif(S==4)
TN(1)=((1-w)*T(1))+(w*(-0.5)*(G(1)-T(2)));//Succesive
overrelaxation(SOR)
TN(i)=((1-w)*TN(i))+(w*(-0.5)*(G(i)-TN(i-1)-T(i+1)));
TN(n)=((1-w)*T(n))+(w*(-0.5)*(G(n)-TN(n-1)));
end
end
err=abs(TN-T)/abs(TN)//error calculation
T=TN;
if(err<tol)//to eject from loop
break
end
end
end
printf("the temperature at %d nodes are:\n",n)
for(i=1:n)
printf("T%d:%f\n",i,T(i));//calculated temperatures
end
//for analytical solution
m(n)=0;
t1=Tb
t2=Ta
34
a=(q/(2*k));
b=(((t2-t1)/l)+((q*l)/(2*k)));
printf("The analytical temperature at %d nodes are\n",n)
for i=1:n
m(i)=((-a*((i*dx)^2))+(b*(i*dx))+t1);
printf("T%d:%f\n",i,m(i));//calculated analytical temperature
end
for (i=1:n)
E=rand(n,1)
E(i)=(m(i)-T(i))
printf("Error at each node%d:%f\n",i,E(i))
end
end
Inputs
S.No.
1 Heat Generation (q) 500 W/m3
2 Length (m) 2
3 Thermal Conductivity (W/m-k) 30
4 Tolerance 0.0001
5 No of Nodes 15
6 Initial Approximation 1
Outputs
ERR.
Node JACOBIA SOR(W=1. ANALYTIC ERR.
TDMA G-S JACOBI ERR SOR
s N 5) AL GS
.
1 487.7778 487.664045 487.64584 487.731765 487.740741 0.076696 0.094899 0.008976
2 463.037 462.696005 462.65831 462.911581 463 0.303995 0.341686 0.088419
3 438 437.460793 437.40149 437.811678 437.962963 0.50217 0.561473 0.151285
4 412.6667 411.929807 411.88369 412.432655 412.62963 0.699823 0.745939 0.196975
5 387.037 386.165453 386.11136 386.774245 387 0.834547 0.888645 0.225755
6 361.1111 360.105648 360.08884 360.835449 361.074074 0.968426 0.985235 0.238625
7 334.8889 333.835415 333.81832 334.614679 334.851852 1.016437 1.033531 0.237173
8 308.3704 307.269905 307.2998 308.109909 308.333333 1.063428 1.03353 0.223424
9 281.5556 280.502081 280.5312 281.318833 281.518519 1.016438 0.98732 0.199686
10 254.4444 253.438982 253.50852 254.239002 254.407407 0.968425 0.898888 0.168405
11 227.037 226.165453 226.22613 226.867961 227 0.834547 0.773875 0.132039
12 199.3333 198.596473 198.67704 199.203357 199.296296 0.699823 0.619255 0.092939
35
13 171.3333 170.794126 170.85332 171.243034 171.296296 0.50217 0.442981 0.053262
14 143.037 142.696005 142.7464 142.985105 143 0.303995 0.253596 0.014895
15 114.4444 114.330712 114.34757 114.428002 114.407407 0.076695 0.05984 0.020595
600
500
Temperature
400
300
200
100
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No of Nodes
1.2
0.8
Absolute Error
0.6
0.4
0.2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-0.2
No. of Nodes
36
Finite Difference method
INPUTS
S.No.
1 Heat Generation (q) 500 W/m3
2 Length (m) 2
3 Thermal Conductivity (W/m-k) 30
4 Tolerance 0.0001
5 No of Nodes 15
6 Initial Approximation 1
Outputs
ERR.
Nod TDM JACOBI SOR(W=1 ANALYTIC
G-S JACOB ERR. ERR
es A AN .5) AL
I. GS SOR
476.95 476.71736 476.68 0.2357 0.2684 0.0948
1 476.858239 476.953125
31 4 47 61 37 86
453.64 453.17451 453.12 0.4713 0.5164 0.1746
2 453.471192 453.645833
58 3 94 2 4 41
430.07 429.40673 429.34 0.6713 0.7353 0.2378
3 429.840229 430.078125
81 5 28 9 48 96
405.37911 405.33 0.8708 0.9179 0.2841
4 406.25 405.965899 406.25
3 21 87 37 01
382.16 381.15665 381.10 1.0048 1.0586 0.3134
5 381.848003 382.161458
15 3 28 05 4 55
357.81 356.67463 356.65 1.1378 1.1536 0.3268
6 357.485697 357.8125
25 1 88 69 96 03
333.20 332.01787 332.00 1.1852 1.2012 0.3255
7 332.877599 333.203125
31 6 19 49 23 26
308.33 307.10171 307.13 1.2316 1.2012 0.3114
8 308.021909 308.333333
33 3 21 2 23 24
283.20 282.01787 282.04 1.1852 1.1555 0.2865
9 282.916531 283.203125
31 6 76 49 05 94
257.81 256.67463 256.74 1.1378 1.0675 0.2533
10 257.559192 257.8125
25 1 5 69 47 08
232.16 231.15665 231.21 1.0048 0.9423 0.2139
11 231.947553 232.161458
15 3 92 05 06 05
205.37911 205.46 0.8708 0.7859 0.1706
12 206.25 206.079313 206.25
3 4 87 67 87
180.07 179.40673 179.47 0.6713 0.6056 0.1258
13 179.952292 180.078125
81 5 25 9 65 33
153.64 153.17451 153.23 0.4713 0.4091 0.0813
14 153.564506 153.645833
58 3 67 2 73 27
126.95 126.71736 126.74 0.2357 0.2045 0.0389
15 126.914223 126.953125
31 4 85 61 87 02
37
600
500
400
Temperature
300
200
100
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No. of Nodes
1.4
1.2
1
Absolute Error
0.8
0.6
0.4
0.2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No. of Nodes
38
ASSIGNMENT 3
Problem: - Solve the one-dimension steady state conduction equation from
fin with insulated tip.
∂
∂x (
kA
∂T
∂x )
−hp ( T −Tamb )=0
X=0 , T=500
X=L , ( ∂∂ Tx )=0
Using:
Finite volume method
Finite difference method
System of linear equation should be solved by
TDMA
Gauss-seidal iteration method
Jacobin method
SOR method
Compare the numerical solution with exact solution of above equation
for different number of node Compare numerical solution with results
of commercial code-FLUENT
39
Solution
Assumptions:-
1. Steady state.
2. One dimensional heat flow.
3. Thermal conductivity of material is independent of temperature.
4. Material is homogeneous and isotropic.
5. Uniform heat transfer coefficient.
6. No heat generation.
7. Negligible radiation exchange with surrounding.
Using Finite Volume Method
Tb Ta
1 2 n-1 n
B A
∂ x /2 ∂x ∂ x /2
[ ( ) ∫
∆V
∂
∂x
kA
∂T
∂x
−hp(T −T amb) dV =0
]
∫[ ( ) ]∫
∂
∂x
kA
∂T
∂x
dV − hp(T −T amb )dV =0
∆V ∆V
4h
Where, m2= kd
e
([ ∂∂ Tx ) −( ∂∂Tx ) ]−m (T −T
e w
2
P amb ) ∂ x=0
[( T E −T P
∂ xe
− P
)(
T −T W
∂ xw
2
)]
−m (T P −T amb ) ∂ x=0
40
By rearranging all terms
aE aW aP Su SP
1 1 a P=aW + aE −S P 2
m T amb ∂ x
2
−m × ∂ x
∂x ∂x
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
1
∂x
0 a P=aW + aE −S P 2
∂x B
2
T + m T amb ∂ x −
[ 2
∂x
+m 2 × ∂ x
]
41
By rearranging all terms
( ∂1x +m × ∂ x) T = ∂1x T
2
P W
2
+ m T amb ∂ x
a P T P=aE T E + aW T W + Su
aE aW aP Su SP
0 1 a P=aW + aE −S P 2
m T amb ∂ x
2
−m × ∂ x
∂x
1 1
∂x
0 a P=aW + aE −S P 2
∂x
2
T B + m T amb ∂ x −
[ 2
∂x
2
+m × ∂ x
]
2 1 1 a P=aW + aE −S P 2
m T amb ∂ x
2
−m × ∂ x
∂x ∂x
3 1 1 a P=aW + aE −S P 2
m T amb ∂ x
2
−m × ∂ x
∂x ∂x
1 1 a P=aW + aE −S P 2
m T amb ∂ x
2
−m × ∂ x
∂x ∂x
n 0 1 a P=aW + aE −S P 2
m T amb ∂ x 2
−m × ∂ x
∂x
( )
a P −ae 0 0 0 0
−aw a P −ae ⋯ 0 0 0
0 −aw aP 0 0 0
⋮ ⋱ ⋮ =Tridiagonal Matrix
0 0 0 aP −ae 0
0 0 0 ⋯ −a w aP −ae
0 0 0 0 −a w aP
42
[] []
T1 Su
T2 Su
T3 Su
T= ⋮ =Unknown matrix, B= ⋮ =Known matrix
⋮ ⋮
T n−1 Su
Tn Su
( )[ ][ ]
a P −ae 0 0 0 0 T1 Su
−aw a P −ae ⋯ 0 0 0 T2 Su
0 −aw aP 0 0 0 T3 Su
⋮ ⋱ ⋮ * ⋮ = ⋮
0 0 0 aP −ae 0 ⋮ ⋮
0 0 0 ⋯ −a w aP −ae T n−1 Su
0 0 0 0 −a w aP Tn Su
Now above system of linear equation can be solved by any direct or iterative
method.
Finite Difference Method
For i=1 for i=M-1
g1 g M −1
-2T1+T2 + k
(∆ x ¿ ¿2+θ0 =0 TM-2-2TM-1+ k
( ∆ x )2 +θ L=0
T1 T2 T3 T4
Tn
∆x∆x ∆x
hp
Where m2 = kA
θo = (To-Tamb)
θx = (Tx-Tamb)
θx = θo at x=0
43
∂θ (x)
∂x
=0 at x=L
Let y = −( 2+mΔ x 2 )
θi−1 + y θi +θi+1 =0
( )
2
2+ ( mΔx )
i = n, θn−1−
2
θ n=0
i=n, θn−1 + ( 2y )θ =0
n
( )
y
1 0 0 0 0
1
y 1 ⋯ 0 0 0
0
1 y 0 0 0
A= ⋮ ⋱ ⋮ = Tridiagonal Matrix
0 0 0 y 1 0
0 0 0 ⋯ 1 y 1
0 0 0 0 1 y /2
44
[] []
θ1 −θ0
θ2 0
θ3 0
θ = ⋮ = Unknown Vector, G = ⋮ = known vector
θn−2 0
θn−1 0
θn 0
Analytical Solution:
θ
θ0 = coshcosh
m(L−x)
mL
Flow chart
45
46
47
48
Scilab Code
clear
clc
//INPUTS
option=input('Please enter 1 for FVM and 2 for FDM : ')
if(option==1)
// FINITE VOLUME METHOD
l=input('Enter length of fin(m):')
d=input('Enter diameter of fin(m):')
k=input('Enter thermal conductivity of fin (W/mK):')
h=input('Enter heat transfer coefficient (W/m2K):')
Tamb=input('Enter ambient temperature (in Kelvin):')
n=input('Input no of nodes along fin:')
Tb=input('Enter Fin base Temperature(in Kelvin):');
m2=(4*h)/(k*d)
a(n,n)=0
T(n,1)=0
B(n,1)=0;
dx=l/n;
aw(n)=0
ae(n)=0
su(n)=0
sp(n)=0
ap(n)=0
// COEFFICIENTS OF EQUATION FOR NODE-1
for i=1
aw(i)=0
ae(i)=(1/dx);
su(i)=m2*dx*Tamb+(2*Tb/dx);
sp(i)=-(m2*dx+2/dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATIONS FOR MIDDLE INTERIOR NODES
for i=2:n-1
aw(i)=(1/dx);
ae(i)=(1/dx);
su(i)=m2*dx*Tamb;
sp(i)=-(m2*dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
// COEFFICIENTS OF EQUATION FOR LAST NODE
49
for i=n
aw(i)=(1/dx)
ae(i)=0
su(i)=m2*dx*Tamb;
sp(i)=-(m2*dx);
ap(i)=aw(i)+ae(i)-sp(i);
end
//CREATING TRIDIAGONAL MATRIX
for i=2:n-1
a(1,1)=ap(1,1);a(1,2)=-ae(1,1);
a(i,i)=ap(i,1);
a(i,i+1)=-ae(i,1);
a(i,i-1)=-aw(i,1);
a(n,n-1)=-aw(n,1);a(n,n)=ap(n,1);
end
for i=1:n
B(i)=su(i);
end
printf("1.TDMA,2.Jacobian,3.Seidel,4.SOR\n")
ch=input("Select:")
// TDMA METHOD
if(ch==1)
for i=2:n
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));
end
end
end
for i=2:n
B(i)=B(i)-a(i,i-1)/a(i-1,i-1)*B(i-1);
end
T(n)=B(n)/a(n,n);
for i=n-1:-1:1
T(i)=(B(i)-T(i+1)*a(i,i+1))/a(i,i);
end
else//if ch not 1
app=input("Enter initial approximation:")
tol=input("Enter tolerance:")
iter=input('Enter no. of iteration:')
if(ch==4)
omega=input("Enter the value of omega:")
end
50
TN(n,1)=0;
for(i=1:n)
T(i)=app;
end
for(m=1:iter)
TN(1)=(1/ap(1))*(B(1)+ae(1)*T(2));//Temperature based on boundary
for(i=2:n-1)
if(ch==2)
TN(i)=(1/ap(i))*(aw(i)*T(i-1)+ae(i)*T(i+1)+B(i))
TN(n)=(1/ap(n))*(aw(n)*T(n-1)+B(n));// JACOBIAN METHOD
elseif(ch==3)
TN(i)=(1/ap(i))*(aw(i)*TN(i-1)+ae(i)*T(i+1)+B(i))
TN(n)=(1/ap(n))*(aw(n)*TN(n-1)+B(n));// SEIDEL METHOD
elseif(ch==4)
TN(1)=((1-omega)*T(1))+(omega*(1/ap(1))*(B(1)+ae(1)*T(2)));//
TN(i)=((1-omega)*TN(i))+(omega*(1/ap(i))*(aw(i)*TN(i-
1)+ae(i)*T(i+1)+B(i)));
TN(n)=((1-omega)*T(n))+(omega*(1/ap(n))*(aw(n)*TN(n-1)+B(n)));
end
end
err=abs(TN-T)/abs(TN)//Error Calculation
T=TN;
if(err<tol)// To eject from loop if error<tolerence
break
end
end
end
printf("The temperature at %d node are:\n",n)
for(i=1:n)
printf("%f\n",T(i));
end
//ANALYTICAL SOLUTION
m=m2^(1/2)
printf("The analytical temperature at %d nodes are:\n",n)
for(i=1:n)
T(1)=(cosh(m*(l-dx/2))/cosh(m*l))*(Tb-Tamb)+Tamb;
T(i)=(cosh(m*(l-((i-1)*dx+dx/2)))/cosh(m*l))*(Tb-Tamb)+Tamb;
printf("%f\n",T(i));
end
51
l=input('Enter length of fin(m):')
d=input('Enter diameter of fin(m):')
k=input('Enter thermal conductivity of fin (W/mK):')
h=input('Enter heat transfer coefficient (W/m2K):')
Tamb=input('Enter ambient temperature (in Kelvin):')
n=input('Input no of nodes along fin:')
m2=(4*h)/(k*d)
a(n,n)=0
T(n,1)=0
D(n,1)=0;
T0=500;
theta0=T0-Tamb;
dx=l/n;
x=-(2+m2*(dx)^2);
//CREATING TRIDIAGONAL MATRIX
for i=2:n-1
a(1,1)=x;a(1,2)=1;
a(i,i)=x;
a(i,i+1)=1;
a(i,i-1)=1;
a(n,n-1)=1;a(n,n)=x/2;
end
for i=2:n
D(1)=-T0-(m2*(dx)^2*Tamb);
D(i)=-(m2*(dx)^2*Tamb);
D(n)=-(m2*(dx)^2*Tamb)/2;
end
printf("1.TDMA,2.Jacobian,3.Seidel,4.SOR\n")
ch=input("Select:")
// TDMA METHOD
if(ch==1)
for i=2:n
for j=1:n
if(i==j)
a(i,j)=a(i,j)-(a(i,j-1)/a(i-1,j-1)*a(i-1,j));
end
end
end
for i=2:n
D(i)=D(i)-a(i,i-1)/a(i-1,i-1)*D(i-1);
end
T(n)=D(n)/a(n,n);
for i=n-1:-1:1
52
T(i)=(D(i)-T(i+1)*a(i,i+1))/a(i,i);
end
else//if ch not 1
app=input("Enter initial approximation:")
tol=input("Enter tolerance:")
if(ch==4)
omega=input("Enter the value of omega:")
end
TN(n,1)=0;
for(i=1:n)
T(i)=app;
end
for(m=1:1000)
TN(1)=(1/x)*(D(1)-T(2));//Temperature based on boundary condition
for(i=2:n-1)
if(ch==2)
TN(i)=(1/x)*(D(i)-T(i-1)-T(i+1))
TN(n)=(2/x)*(D(n)-T(n-1));// JACOBIAN METHOD
elseif(ch==3)
TN(i)=(1/x)*(D(i)-TN(i-1)-T(i+1))
TN(n)=(2/x)*(D(n)-TN(n-1));// GAUSS SEIDEL
elseif(ch==4)
TN(1)=((1-omega)*T(1))+(omega*(1/x)*(D(1)-T(2)));// SOR METHOD
TN(i)=((1-omega)*TN(i))+(omega*(1/x)*(D(i)-TN(i-1)-T(i+1)));
TN(n)=((1-omega)*T(n))+(omega*(2/x)*(D(n)-TN(n-1)));
end
end
err=abs(TN-T)/abs(TN)//Error Calculation
T=TN;
if(err<tol)// To eject from loop if error<tolerence
break
end
end
end
printf("The temperature at %d node are:\n",n)
for(i=1:n)
printf("%f\n",T(i));
end
//ANALYTICAL SOLUTION
m=m2^(1/2)
printf("The temperature at %d nodes are:\n",n)
for(i=1:n)
53
T(i)=cosh(m*(l-i*dx))/cosh(m*l)*(theta0)+Tamb;
printf("%f\n",T(i));
end
end
Outputs
ERR.
ANALYTICA ERR. ERR
Nodes TDMA JACOBIAN G-S SOR(W=1.5) JACOBI
L GS SOR
.
1 452.69506 452.670816 452.6696 452.693197 456.786562 4.115746 4.116921 4.093365
2 394.27956 394.211575 394.215 394.288899 396.353346 2.141771 2.138366 2.064447
3 358.2118 358.099395 358.1184 358.230712 359.214169 1.114774 1.095757 0.983457
4 335.9424 335.792423 335.8292 335.963718 336.390396 0.597973 0.561165 0.426678
5 322.19268 322.003657 322.0675 322.211083 322.364234 0.360577 0.296748 0.153151
6 313.70345 313.486557 313.5728 313.716821 313.744768 0.258211 0.172007 0.027947
7 308.46245 308.215647 308.3316 308.470922 308.448188 0.232541 0.116556 -0.022734
8 305.22736 304.964614 305.1007 305.232083 305.194012 0.229398 0.093314 -0.038071
9 303.23134 302.950336 303.1121 303.233623 303.195522 0.245186 0.083401 -0.038101
10 302.00127 301.717102 301.8919 302.002168 301.96957 0.252468 0.07771 -0.032598
11 301.24558 300.955892 301.1475 301.245799 301.219774 0.263882 0.072236 -0.026025
12 300.78514 300.504713 300.6993 300.784966 300.764865 0.260152 0.065541 -0.020101
13 300.5108 300.237457 300.4375 300.510608 300.494868 0.257411 0.057383 -0.01574
14 300.35754 300.104673 300.2965 300.35788 300.344509 0.239836 0.047999 -0.013371
15 300.28903 300.054745 300.2397 300.288922 300.277437 0.222692 0.037744 -0.011485
54
500
450
400
350
Temperature
300
250
200
150
100
50
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Number of Nodes
Fig.1
4.5
4
3.5
3
2.5
Error
2
1.5
1
0.5
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Number of Nodes
Fig.2
Finite Difference Method
Inputs
S.No.
1 Ambient Temperature (Kelvin) 300
2 Length of Fin(m) 2
3 Thermal Conductivity (W/m-k) 30
4 Tolerance 0.0001
5 No of Nodes 15
55
6 Initial Approximation 1
7 Base Temperature of Fin (Kelvin) 500
Outputs
ERR.
Node SOR(W=1.5 ANALYTIC
TDMA JACOBIAN G-S JACOBI ERR. GS ERR SOR
s ) AL
.
1 423.4873 423.453597 423.446984 423.490825 422.910152 0.54345 0.536832 0.580673
2 376.2457 376.177973 376.174177 376.254252 375.534621 0.64335 0.639556 0.719631
3 347.0771 346.978219 346.982301 347.087862 346.420067 0.55815 0.562234 0.667795
4 329.0675 328.936665 328.956185 329.077644 328.527862 0.4088 0.428323 0.549782
5 317.9481 317.790356 317.825872 317.955977 317.53245 0.25791 0.293422 0.423527
6 311.083 310.897164 310.954713 311.088322 310.775621 0.12154 0.179092 0.312701
7 306.8449 306.637743 306.714595 306.848082 306.623867 0.01388 0.090728 0.224215
8 304.2293 303.999303 304.100201 304.230933 304.073475 0.074172 0.026726 0.157458
9 302.6163 302.370756 302.490888 302.61688 302.507871 0.137115 0.016983 0.109009
10 301.6234 301.360723 301.503718 301.623445 301.548561 0.187838 0.044843 0.074884
11 301.0154 300.742901 300.902826 301.015129 300.963626 0.220725 0.0608 0.051503
12 300.648 300.364073 300.543625 300.647488 300.611654 0.247581 0.068029 0.035834
13 300.4342 300.145937 300.338645 300.434092 300.407553 0.261616 0.068908 0.026539
14 300.3233 300.029042 300.236881 300.323183 300.301981 0.272939 0.0651 0.021202
15 300.289 299.995619 300.211781 300.288853 300.269415 0.273796 0.057634 0.019438
450
400
350
300
Temperature
250
200
150
100
50
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
No.of Nodes
Fig.3
56
0.8
0.7
0.6
No. of Nodes
Fig.4
57