Numerical Modeling of Natural Convection in Square Cavity
[pic 1][pic 2]% Plot Streamlines & Isotherms for Natural Convection across Square Cavity % Defining constant properties and physical parametersw=1; % Breadthh=1; % LengthA=h/w; % Aspect Ratio of EnclosurePr=0.7; % Prandtl Number as given in the Reading MaterialRa=1000; % Rayleigh Number % To include the Conduction between the sides without Natural Convection% Dividing square sides into Nodal points/Griddx=0.01; % Grid length x-directiondy=0.01; % Grid Length y-directionX=(0:dx:1);Thetafn=zeros(101,101); % Dimensionless Temperaturefor i=1:101  for j=1:101   Thetafn(i,j)=1-X(j);  endend% Iterative Procedure till Convergence is achieved% Defining the 2-D Array of desired output parametersStmfn=ones(101,101); % Stream FunctionVortfn=ones(101,101); % Vorticity% Assigning Relaxation Factors < 1r=0.9;rb=0.95; % rb>rfor n=1:500% Assigning Output parameters with previous iteration valuesfor 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);  endend% Computing Vorticity at nodal points within Square cavity% Internal pointsfor 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)));  endend% Vorticity in Edge/Side Nodal points

Get Your Essay

Cite this page

Previous Iteration Valuesfor J And Internal Pointsfor J. (June 11, 2021). Retrieved from https://www.freeessays.education/previous-iteration-valuesfor-j-and-internal-pointsfor-j-essay/