Question: Problem 2 : Run the entrance flow program of Appendix F for Re = 0 . 1 , 3 . 0 , and 3 5

Problem 2:
Run the entrance flow program of Appendix F for Re=0.1,3.0, and 35. Refer to presented
results in the lecture, generate:
a. Plots for the stream function.
b. Plots for velocity profiles at x=+-0.2
c. Plots for velocity versus x//h for the centerline and stagnation line.
d. Plots the vorticity lines from the wall to the centerline.
Here is the Program in MATLAB:
% MATLAB PROGRAM 7.11.0(R2010b)
% program to compute entrance flow
% vort(i0+1, jj) given by Stokes Flow
%
% set input data
%
n=5;
i0=n*10;
ii=n*20;
jj=n*10;
al=4.0;
re=1.0;
epsi=1.0e-4;
evort=1.0e-4;
%
% allocate memory for vortn1,ycord
%
vortn1= zeros(ii+1,jj+1);
ycord = zeros(jj+1);
%
% compute dx, beta and f
%
dx=al/ii;
beta=al*jj/ii;
beta2=beta^2;
beta2plus1=beta2+1.0;
dt=0.5/((1.0+beta)/dx+beta2plus1*4.0/re/dx^2);
e=(cos(pi/double(2*ii+1))+beta2*cos(pi/double(jj)))/beta2plus1;
eta=e^2;
f=2.0*(1.0-sqrt(1.0-eta))/eta;
%
% set initial conditions and boundary values
%
% initial conditions
u = ones(ii+1,jj+1);
v = zeros(ii+1,jj+1);
vort = zeros(ii+1,jj+1);
psi =(repmat((1:jj+1)-1,ii+1,1))./jj;
% boundary conditions on plate
u(i0+1:ii+1,jj+1)=0;
v(i0+1:ii+1,jj+1)=0;
psi(i0+1:ii+1,jj+1)=1.0;
vort(i0+1:ii+1,jj+1)=3.0;
% boundary conditions at outlet
y =(0:1/jj:1);
v(ii+1,:)=0.0;
u(ii+1,:)=1.5*(1.0-(y.^2));
psi(ii+1,:)=1.5*y-0.5*(y.^3);
vort(ii+1,:)=3.0*y;
%
% solve for vorticity at interior points
%
isw2=true;
while isw2
isw2=false;
for i=2:ii
for j=2:jj
delsq=vort(i+1,j)+vort(i-1,j)+beta2*(vort(i,j+1)...
+vort(i,j-1))-2.0*beta2plus1*vort(i,j);
if (u(i,j)>0.0)
conu=u(i,j)*vort(i,j)-u(i-1,j)*vort(i-1,j);
else
conu=u(i+1,j)*vort(i+1,j)-u(i,j)*vort(i,j);
end
if (v(i,j)>0.0)
conv=v(i,j)*vort(i,j)-v(i,j-1)*vort(i,j-1);
else
conv=v(i,j+1)*vort(i,j+1)-v(i,j)*vort(i,j);
end
dvort=dt/dx*(-(conu+beta*conv)+2.0/re/dx*delsq);
vortn1(i,j)=vort(i,j)+dvort;
if dvort > evort
isw2=true;
end
end
end
%
% update vorticity matrix
%
vort(2:end-1,2:end-1)=vortn1(2:end-1,2:end-1);
%
% solve for stream function
%
isw1=true;
while isw1
isw1=false;
for i=2:ii
for j=2:jj
dstr=psi(i+1,j)+psi(i-1,j)+beta2*psi(i,j+1)...
+beta2*psi(i,j-1)-2.0*beta2plus1*psi(i,j)+vort(i,j)*dx^2;
psi(i,j)=psi(i,j)+f/2.0/beta2plus1*dstr;
if dstr > epsi
isw1=true;
end
end
end
end
%
% calculate u and v velocities at interior points
%
u(2:ii,2:jj)=(psi(2:ii,3:jj+1)-psi(2:ii,1:jj-1))*beta/2.0/dx;
v(2:ii,2:jj)=(psi(1:ii-1,2:jj)-psi(3:ii+1,2:jj))/2.0/dx;
%
% calculate centerline and stagnation streamline
% values of u
%
u(2:ii,1)=psi(2:ii,2)*beta/dx;
u(2:i0,jj+1)=(1.0-psi(2:i0,jj))*beta/dx;
%
% calculate vorticities on the walls
%
for i=i0+2:ii
vortemp=vort(i,jj+1);
vort(i,jj+1)=(1.0-psi(i,jj))*2*beta2/dx^2;
dvort=vort(i,jj+1)-vortemp;
if(dvort > evort)
isw2=true;
end
end
vort(i0+1,jj+1)=vort(i0+1,jj)+(1.0-psi(i0+1,jj))/dx^2*5*beta2/4.0;
end
omega=vort
stm=psi
xmin=-i0*al/ii;
xmax=al*(ii-i0)/ii;
x =(xmin:al/ii:xmax

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mechanical Engineering Questions!