Azzera filtri
Azzera filtri

How do i create a convection Boundary conditions

2 visualizzazioni (ultimi 30 giorni)
I am trying to solve a heat transfer problem with convection boundaries at the bottom, fixed temperature boundaries at the top, left and write side. these are the codes, but the answers differ from analytic solutions. N=5; % Number of columns M=5; % Number of rows T_amb = 290;% initial temp T = ones(5,5)*T_amb; T(:,1)=500;% boundary condition at the left T(:,5)=500;% boundary condition at the right T(1,:)=500;% boundary condition at the top % convection equation boundary at bottom,m=5, is T(m,n)= 2*T(m-1,n)+T(m,n-1)+T(m,n+1)+1500-9*T(m,n);
codes
N=5; % Number of columns
M=5; % Number of rows
T_amb = 290;% initial temp
T = ones(5,5)*T_amb;
Tol = 10^-6;
pmax = 10*10^6;
for p=1:pmax;
T_old=T;
for m=2:M-1;
for n=2:N-1;
if m==5;
T(m,n)= 2*T(m-1,n)+T(m,n-1)+T(m,n+1)+1500-9*T(m,n);
%T(5,n)= 2*T(4,n)+T(5,n-1)+T(5,n+1)+1500-9*T(5,n);% convection equation boundary condition at m=5
end
T(m,n) = 1/4*(T(m+1,n)+T(m-1,n)+T(m,n+1)+T(m,n-1));
end
end
diff = max(max(abs(T - Tol)));
if (diff < Tol)
break
end
end

Risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by