Info

此问题已关闭。 请重新打开它进行编辑或回答。

Help in plot!

2 次查看(过去 30 天)
Green Sal
Green Sal 2011-12-2
关闭: MATLAB Answer Bot 2021-8-20
Hey guys. So now i know the time at which the duct reach steady state condition but i would like to plot the isotherms at only t=0.25*t(ss), t=0.50*t(ss) and t(ss) is the time at which it reaches steady state.
Please Help.
Thank you!
  3 个评论
Green Sal
Green Sal 2011-12-2
Jan, my code is the following and the it is for a square duct with heat steam passing inside of it.
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
dt = 0.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.01; % 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));
% 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)
colorbar;
Green Sal
Green Sal 2011-12-3
does anybody know how to deal with this?

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by