Problem 10
Modify the vorticity-stream function code used to simulate the two-dimensional
driven cavity problem (Code 3) to simulate the flow in a rectangular 2 ×1
channel with periodic boundaries. Set the value of the vorticity and the stream
function at the top and bottom to zero. As initial conditions place two circular
blobs with radius r= 0.25 and ω= 10 on the centerline of the channel at y= 0.5
and x= 0.6 and x= 1.4. Refine the grid to ensure that the solution converges.
Describe the evolution of the flow as the viscosity is decreased.
Solution
The code, modified as specified in the problem is listed below. Notice that
the viscosity here is 0.01 and that we accommodate the periodic boundary
conditions by extending the grid one grid line in the x-direction. Thus, the
grid spacing is given by h= 2.0/(Nx −2), rather than h= 2.0/(Nx −1). Here,
the 2 is the length of the domain in the x-direction.
% Problem 10 Modified Vorticity-Stream Function Code
Nx=34; Ny=17; MaxStep=200; Visc=0.01; dt=0.005; time=0.0;
MaxIt=100; Beta=1.5; MaxErr=0.001; % parameters for SOR
sf=zeros(Nx,Ny); vt=zeros(Nx,Ny); vto=zeros(Nx,Ny);
for i=2:Nx-1; for j=2:Ny-1
vt(i,j)=vt(i,j)+dt*(-0.25*((sf(i,j+1)-sf(i,j-1))*…