summaryrefslogtreecommitdiff
path: root/1244/CH3/EX3.5/Example35.sce
blob: de96797c407cc49ca19e67b93fd3ba2be4cf020b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111


// Display mode
mode(0);

// Display warning for floating point exception
ieee(1);

clc;
disp("Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.5 ")

//Thermal conductivity of alloy bus bar in W/m-K is given as
k = 20;
//Heat generation rate in W/m3 is given as
qg = 10^6;
//dimensions of the bar in m is given as
L = 0.1;//Length in m
b = 0.05;//Width in m
d = 0.01;//Thickness in m

//For top edge, heat transfer coefficient in W/m2K and ambient temperature
//in C are
h = 75;
Tinfinity = 0;
//We are taking a total of 11 nodes in the direction of length and 6 nodes
//in the direction of width
dx = 0.01; //dx in m
dy = 0.01; //dy in m
//Assigning a guess temperature of 25C to all nodes
for i = 1:6
  for j = 1:11
    //Old temp. in degree C
    Told(i,j) = 25;
  end;
end;

//Assigning temperature on the left and right hand side
for i = 1:6
  //Old temp. in degree C
  Told(i,1) = 40;
  Told(i,11) = 10;
  //New temp. in degree C
  Tnew(i,1) = 40;
  Tnew(i,11) = 10;
end;
//Intitalisation of looping parameter
p = 0;
//Iteration to find temperature distribution
while p<500
  //Equation for all interior nodes
  for i = 2:5
    for j = 2:10
      //New temp. in degree C
      Tnew(i,j) = 0.25*(Told(i-1,j)+Told(i+1,j)+Told(i,j-1)+Told(i,j+1)+((qg*dx)*dx)/k);
    end;
  end;

  //Equation for top wall
  for j = 2:10
    //New temp. in degree C
    Tnew(1,j) = (h*Tinfinity+(qg*dx)/2+(k*(0.5*(Told(1,j-1)+Told(1,j+1))+Told(2,j)))/dx)/(h+(2*k)/dx);
  end;

  //Equation for bottom wall
  for j = 2:10
    //New temp. in degree C
    Tnew(6,j) = 0.25*(Told(6,j-1)+Told(6,j+1))+0.5*Told(5,j)+((qg*dx)*dx)/(4*k);
  end;
  for i = 1:6
    for j = 1:11
      //Assigning Old Temp=New Temp
      Told(i,j) = Tnew(i,j);
    end;
  end;
  //New looping parameter incremented
  p = p+1;
end;
disp("The temperature distribution in the bar in C is the following")
//Old temp. in degree C
Told

//Finding maximum temperature
Tmax = Told(1,1);
for i = 1:6
  for j = 1:11
    if Told(i,j)>Tmax then
      Tmax = Told(i,j);
    else
      Tmax = Tmax;
    end;
  end;
end;
disp("The maximum temperature in C in the alloy bus bar is")
//maximum temperature in C
Tmax

//Finding heat transfer rate
dz = 0.01; //dz in m
//Defining areas
for i = 2:10
  A(1,i) = dx*dz; //Area in m2
end;
A = mtlb_i(A,1,(dx*dz)/2);
A = mtlb_i(A,11,A(1));
for i = 1:11
  //heat transfer rate in W
  q(1,i) = (h*A(i))*(Tnew(1,i)-Tinfinity);
end;
disp("The heat transfer rate from the top edge in W is given by")
//heat transfer rate in W
q