Heat flux as boundary condition in 2D transient heat conduction equation
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a question regarding the 2D transient heat conduction equation:
clc
clear all
close all
length_x=0.2;
length_y=0.2;
nx=4;% Number of Grid Points in x
ny=4;% Number of Grid Points in y
nt=1000;
x=linspace(0,length_x,nx);% Method to Create The Grid Points in x
y=linspace(0,length_y,ny);% Method to Create The Grid Points in y
dx=x(2)-x(1);
dy=y(2)-y(1);
error=9e9;
tolerance=1e-4;
dt=1e-3;
omega=1.1;
T_L=150; %Left side of domain
T_R=150; %Right side of domain
T_T=300; %Top side of domain
T_B=77; %Botom side of domain
T=300*ones(nx,ny); %Defining the Inital Condition
T(2:ny-1,1)=T_L;
T(2:ny-1,nx)=T_R;
T(1,2:nx-1)=T_T;
T(ny,2:ny-1)=T_B;
% assign the T value at corner
T(1,1)=(T_L+T_T)/2;
T(nx,ny)=(T_R+T_B)/2;
T(1,ny)=(T_T+T_R)/2;
T(nx,1)=(T_L+T_B)/2;
% keeping the Back Up of T
T_ini=T;
T_old=T;
T_end=T;
% Calculation of 2D Transient Heat Conduction Equation by Explicit
k1=1.1*(dt/(dx^2));
k2=1.1*(dt/(dy^2));
is=1;
fc=1;
if fc==1
gs=1;
for k=1:nt
error=9e9;
while(error>tolerance)
for i=2:nx-1
for j=2:ny-1
t1=T_old(i,j);
t2=k1*(T_old(i+1,j)-2*T_old(i,j)+(T_old(i-1,j)));
t3=k2*(T_old(i,j+1)-2*T_old(i,j)+(T_old(i,j-1)));
T(i,j)=t1+t2+t3;
end
end
error=max(max(abs(T_old-T)));
T_old=T;
gs=gs+1;
end
end
end
figure(1)
contourf(x,y,T)
clabel(contourf(x,y,T))
colorbar
colormap(jet)
set(gca,'ydir','reverse')
xlabel('X -Axis')
ylabel('Y -Axis')
Is it possible to change the code to insert a variable temperatur boundary conditions (T=f(x,y,t), like Temperature graph/function instead a constant temperature at the boundarys?
and can the code altered to use a time dependent heat flux at the bottom instead a Temperature boundary condtion like:
-lambda*dT/dx = 10
Maybe someone has a clue
Best regards
Steffen
1 commentaire
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!