Numerical Modeling of Natural Convection in Square Cavity
Autor: Vignesh C • September 25, 2016 • Coursework • 411 Words (2 Pages) • 826 Views
[pic 1][pic 2]
% Plot Streamlines & Isotherms for Natural Convection across Square Cavity
% Defining constant properties and physical parameters
w=1; % Breadth
h=1; % Length
A=h/w; % Aspect Ratio of Enclosure
Pr=0.7; % Prandtl Number as given in the Reading Material
Ra=1000; % Rayleigh Number
% To include the Conduction between the sides without Natural Convection
% Dividing square sides into Nodal points/Grid
dx=0.01; % Grid length x-direction
dy=0.01; % Grid Length y-direction
X=(0:dx:1);
Thetafn=zeros(101,101); % Dimensionless Temperature
for i=1:101
for j=1:101
Thetafn(i,j)=1-X(j);
end
end
% Iterative Procedure till Convergence is achieved
% Defining the 2-D Array of desired output parameters
Stmfn=ones(101,101); % Stream Function
Vortfn=ones(101,101); % Vorticity
% Assigning Relaxation Factors < 1
r=0.9;
rb=0.95; % rb>r
for n=1:500
% Assigning Output parameters with previous iteration values
for j=1:101
for i=1:101
Vortfn_prev(i,j)=Vortfn(i,j);
Stmfn_prev(i,j)=Stmfn(i,j);
Thetafn_prev(i,j)=Thetafn(i,j);
end
end
% Computing Vorticity at nodal points within Square cavity
% Internal points
for j=2:100
for i=2:100
Vortfn(i,j)=((((-1)/(4*dx*dy*Pr))*(((Stmfn(i-1,j)-Stmfn(i+1,j))...
*(Vortfn(i,j+1)-Vortfn(i,j-1)))-((Stmfn(i,j+1)-Stmfn(i,j-1))...
*(Vortfn(i-1,j)-Vortfn(i+1,j)))))+((Vortfn(i,j+1)+Vortfn(i,j-... 1))/(dx^2))...
+((Vortfn(i-1,j)+Vortfn(i+1,j))/(dy^2))...
-(Ra*((Thetafn(i,j+1)-Thetafn(i,j-1))/(2*dx))))/((2/(dx^2))+(2/(dy^2)));
Vortfn(i,j)=Vortfn_prev(i,j)+(r*(Vortfn(i,j)-Vortfn_prev(i,j)));
end
end
% Vorticity in Edge/Side Nodal points
...