Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Duct Temperature Distribution
Replies: 10   Last Post: Dec 1, 2011 4:08 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Green Sal

Posts: 48
Registered: 10/15/10
Duct Temperature Distribution
Posted: Nov 29, 2011 3:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello guys, i am trying to find the temperature distribution in a dukt that is insulated from both sides, constant temperature on one side, and const. heat flux from the top. in the inner duct steam flows at constant temperature. The following is the code that i used but i know something is not working. I am trying to validate my code by changing the values of the heat flux but the temperature distribution seems to stay the same. Also, if i run the code at 10 seconds and 100 seconds, the results are the same. If anybody understand such problems please help. Thank you.

clear
clc

T = zeros(20,20);
% Initial condition
% Set all material to 20C ambient temp
for y = 1:20;
for x = 1:20;
T(y,x) = 20;
end
end
h=[1000000;0;0;0];
dt = .1; %(Time increment, Seconds)
p = 9000; %(Density of Copper, kg/m^3)
Cp = 380; %(Specific heat of Copper, J/kg*K)
qT = 500; %(Solar heat flux, W/m^2)
TL = 50; %(Temperature of the left side of the block, Celsius)
Tsteam = 400; % (Temperature of steam inside the duct, Celsius)
l = 0.005; % 0.005 Meters
K = 400; % (Thermal conductivity of Coppy,W/m*C)
Alpha = K/(p*Cp); % (Thermal diffusivity)
Fo = (Alpha*dt)/(l^2); % Seconds
Bi=(h*l)/K;
b(1)=det(T);
fprintf('Enter Time (s):\n')
t = input(' ');

A=t/dt; %time/step increment size
%instant steam at center
for y = 6:15;
for x = 6:15;
T(y,x) = Tsteam;
end;
end;
%for whole matrix
for n = 1:A

% BOUNDRY CONDITIONS
% Node 1 - Top left node
T(1,1) = T(1,1)*(1-4*Fo)+2*Fo*(T(1,2) + T(2,1) + (2/K)*TL+ qT*l/K);

% Node 21 - Top right node

T(1,20) = T(1,20)*(1-4*Fo)+2*Fo*(T(1,19) + T(2,20)+ qT*l/K);

% Left nodes - Left side BC
for x = 1;
for y = 2:19;
T(y,x) = TL;
end
end

% Right nodes - Right surface BC (Insulated section (no qT))

for x = 20;
for y = 3:19;
T(y,x) = T(y,x)*(1-4*Fo) + Fo*(T(y-1,x) + T(y+1,x) + 2*T(y,x-1));
end;
end;


% Bottom left Node - insulated with left BC

T(20,1) = T(20,1)*(1-4*Fo) + 2*Fo*(T(19,1) + T(20,2) + (2*TL)/K);

% Bottom right Node - insulated with right BC

T(20,20) = T(20,20)*(1-4*Fo) + 2*Fo*(T(19,20) + T(20,19));

% Top nodes calcs - Top surface (Heat Flux addition)
for y = 1;
for x = 2:19;
T(y,x) = T(y,x)*(1-3*Fo) + Fo*((qT*l/K) + T(y,x-1) + T(y,x+1) + T(y+1,x));
end;
end;

% Calculating the in between nodal temperatures at each delta(time)
for y = 2:19; %inside left slab and right slab
for x = [2:5,16:19]
T(y,x) = T(y,x)*(1-4*Fo) + Fo*(T(y,x-1) + T(y,x+1) + T(y-1,x) + T(y+1,x));
end;
end;
%central nodes
for x = 6:19;%center slab portions above and below duct
for y = [2:5,16:19];
T(y,x) = T(y,x)*(1-4*Fo) + Fo*(T(y,x-1) + T(y,x+1) + T(y-1,x) + T(y+1,x));
end;
end;

% Bottom Nodes - Insulated section (no qT)

for y = 20;
for x = 2:19;
T(y,x) = T(y,x)*(1-4*Fo) + Fo*(T(y,x-1) + T(y,x+1) + 2*T(y-1,x));
end;
end;

%this part below kills the initial for loop if the duct has reached steady
%state, and displays the time in seconds
b(n+1)=det(T);
if b(n)== b(n+1);
s=(n-1)*.1;
fprintf('The Duct reached Steady State at: %4.1f seconds \n',s);
break
end
end;

Tfinal = flipud(T);

% Graphing the temperature isotherm

Spacing = (20:5:400);
[C,h]=contourf(Tfinal,Spacing);
clabel(C,h)

[val,ind] = max(Tfinal(:));
[max_x,max_y] = ind2sub(size(Tfinal),ind);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.