1-D transient conduction explicit method
19 ビュー (過去 30 日間)
古いコメントを表示
%I am trying to solve this problem but, I am just getting linear line as a result which is wrong.
% I tried to put if function beacause left wall i temperature prescribed and which is changing
%respect to the time. The right side is insulated. In this problem, I am using explicit method.
clear;
clc;
L= 0.152; %meter, wall thickness
n= 10; %number of simulation nodes
Ti=80; % Deg F, Initial temperature of wall
% c=1;
dx= L/n; %meter, node thickness
rho= 7801;
cp=473;
k=43;
alpha1= k/(rho*cp); %carbon steel
alpha2=0.00000525166; %nickel
dt=0.1; %sec, fixed time step
t=0:dt:3;
nt=100;
if 0<=t<=1
Ts1= 1500*t;
Ts2= 80;
% T0=400*ones(1,n);
% T1=300*ones(1,n);
for j=1:nt
for i=2:n-1;
T1(i)=Ts1(i)+alpha1*(Ts1(i+1)-2*Ts1(i)+Ts1(i-1));
end
T0=T1;
end
elseif 1<t<=2
Ts1=-1500*t;
Ts2=80;
for j=1:nt
for i=2:n-1;
T1(i)=Ts1(i)+alpha2*(Ts1(i+1)-2*Ts1(i)+Ts1(i-1));
end
T0=T1;
end
else
Ts1=0;
Ts2=80;
for j=1:nt
for i=2:n-1;
T1(i)=Ts1(i)+alpha2*(Ts1(i+1)-2*Ts1(i)+Ts1(i-1));
end
T0=T1;
end
end
plot (T1)
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!