Help programing 2D conduction heat transfer in time, using finite diference method (forward euler for time, centered euler for space).
Ältere Kommentare anzeigen
25 Points Grid. r = x, z = y.
The formulas are correct, but i don't kwon what i am doing wrong with the matlab programming. Please help >.<
%Body properties
H = 0.3; % Height [m]
D = 0.2; % Diameter [m]
Alpha = 1.5; %Difusion heat transfer coefficient [m^2/s]
% Factores para Diferencia Finita
dr = D/8;
dz = H/8;
dt = 7;
tp = 3600; %Total Process Time. [s]
tc = 2000; %Proces tranfer from heating to cooling. [s]
Ti = 18; %Initial body temperature. [°C]
Tc = 120; %Heating Temperature. [°C]
Tf = 8; %Cooling Temperature. [°C]
%Grid Initialization
T(:,:,1)= Ti*ones(5,5);
time(1) = 0;
time(2) = dt;
t=1;
while time(t+1)<=tp
for i=[5,4,3,2,1]
for j=[5,4,3,2,1]
if i==5&&time(t+1)<=tc
T(i,j,t+1) = Tc;
elseif j==5&&time(t+1)<=tc
T(i,j,t+1) = Tc;
elseif i==5&&time(t+1)>tc
T(i,j,t+1) = Tf;
elseif j==5&&time(t+1)>tc
T(i,j,t+1) = Tf;
elseif i>1&&i<5&&j>1&&j<5
T(i,j,t+1) = Alpha*dt*((T(i+1,j,t)-2*T(i,j,t)+T(i-1,j,t))/(dr)^2 + (1/((i-1)*dr))*((T(i+1,j,t)-T(i,j,t))/(2*dr)) + (T(i,j+1,t)-2*T(i,j,t)+T(i,j-1,t))/(dz)^2) + T(i,j,t);
elseif i==1&&j>1&&j<5
T(i,j,t+1) = Alpha*dt*(4*(T(i+1,j,t)-T(i,j,t))/(dr)^2 + (T(i,j+1,t)-2*T(i,j,t)+T(i,j-1,t))/(dz)^2) + T(i,j,t);
elseif i<1&&i>5&&j==1
T(i,j,t+1) = Alpha*dt*((T(i+1,j,t)-2*T(i,j,t)+T(i-1,j,t))/(dr)^2 + (1/((i-1)*dr))*((T(i+1,j,t)-T(i,j,t))/(2*dr)) + 2*(T(i,j+1,t)-T(i,j,t))/(dz)^2) + T(i,j,t);
elseif i==1&&j==1
T(i,j,t+1) = 2*Alpha*dt*(2*(T(i+1,j,t)-T(i,j,t))/(dr)^2 + (T(i,j+1,t)-T(i,j,t))/(dz)^2) + T(i,j,t);
end
end
end
t = t+1;
time(t+1) = time(t)+dt;
end
1 Kommentar
Nataly Challapa
am 20 Mai 2016
Hello! My question is about the graphic, how can I do a graphic in 3D of this solution? it is possible? because this method would be a solution for the heat equation. Is not it right?
Akzeptierte Antwort
Weitere Antworten (2)
Walter Manns
am 7 Okt. 2011
Walter Manns
am 7 Okt. 2011
0 Stimmen
Kategorien
Mehr zu Thermal Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!