Professional Documents
Culture Documents
%%% -- Silver --
name=('Silver'); % Material name
conductivity = 406; % thermal conductivity
(W/m.K)
spacific_heat = 233; % specific heat (J/kg
K)
denisty = 10490; % density (kg/m^3)
k=conductivity;
% Geometry
%%
Lx= 1; % plate width (m)
Ly= 1; % plate length (m)
Nx=40; % nodes in x direction
Ny=40; % nodes in y direction
dx=Lx/Nx; % delta
x
dy=Ly/Ny; % delta
y
T=zeros(Nx,Ny);
T(1,:)=T_south;
T(Nx,:)=T_north;
T(:,Ny)=T_east;
T(:,1)=T_west;
T(1,1)=(T_south+T_west)/2;
T(1,Ny)=(T_south+T_east)/2;
T(Nx,Ny)=(T_north+T_east)/2;
T(Nx,1)=(T_north+T_west)/2;
while MSE>=tolerence_ss
for i=2:Nx-1 % looping
for j=2:Ny-1
if west==1
if(j==2)
Tss(i,1)= 0.25*((2*qw*dx/k)+Tss(i+1,1)+Tss(i-1,1)+(2*Tss(i,2)));
end
end
if east==1
if(j==Ny-1)
Tss(i,Ny)=0.25*((2*qe*dx/k) + Tss(i+1,Ny)+Tss(i-1,Ny)
+(2*Tss(i,Ny-1)));
end
end
if north==1
if(i==Nx-1)
Tss(Nx,j)=0.25*((2*qn*dx/k)+Tss(Nx,j-
1)+Tss(Nx,j+1)+(2*Tss(Nx-1,j)));
end
end
if south ==1
if(i==2)
Tss(1,j)=0.25*((2*qs*dx/k)+Tss(1,j-
1)+Tss(1,j+1)+(2*Tss(2,j)));
end
end
Tss(1,1)=(Tss(1,2)+Tss(2,1))/2;
Tss(1,Ny)=(Tss(1,Ny-1)+Tss(2,Ny))/2;
Tss(Nx,Ny)=(Tss(Nx,Ny-1)+Tss(Nx-1,Ny))/2;
Tss(Nx,1)=(Tss(Nx,2)+Tss(Nx-1,1))/2;
Tss(i,j)=0.25*(Tss(i+1,j)+Tss(i,j+1)+Tss(i-1,j)+Tss(i,j-1));
error(i,j)=(Tss(i,j)-T(i,j))^2;
end
end
T=Tss;
MSE=sqrt(sum(sum(error))/(Nx*Ny));
end
contourf(Tss);