1D transient conduction

13 次查看(过去 30 天)
Kamal Rizal
Kamal Rizal 2020-12-2
I have trying to graph 1D transient conduction given initial condition as 80F. The right side is insulated. But the left side is tricky as it is prescribed temperature based on given graph of temperature vs time. I have been coding and getting just box like graph --which is wrong. I am trying to do Finite Difference Method based on forward explicit. The code I am using is bellow. Any suggestions on why I am not getting any iterations graphs but just initial matrix graph?
clear;
clc;
clf;
L=152; %mm
tf=100; %total time of simulation (sec)
n=152;%number of iteration
dt=0.01;%time step
dx=L/n; %change in length
k=43; %thermal conductivity
rho=7801; %density
cp=473;% heat capacity
%t=0:dt:tf; %time vector
alpha=k/(rho*cp);
d=alpha*dt/dx^2;
%Initial Conditions
Ti=80;
%Boundary Conditions
T0=1500*ones(1,n);%creates matrix with 1500s
T1=80*ones(1,n);% creates matrix with 80s
T0(1) = 80; %Initial temperature at left wall
T0(end) = 80; %Initial temperature at right wall
for j=1:n %time iteration
for i=2:n-1 %node Temperature iteration
T1(i)=T0(i)+d*(T0(i+1)-2*T0(i)+T0(i-1)); %T(x,t), Explicit forward Main equation
end
end
plot(T1)
disp(T1)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by