%% Lid-Driven Cavity Flow Convergence Test clear, clc, clf, close all pause off % Written for MIT 2.29 % Set number of timesteps dt = 1/100; T = 6000*dt; %Set plot intervals plt = 500; %Set viscosity nu = 0.001; %(for RE=1000) U=cell(5,2); for i = 1:length(U) N = 5*2^(i-1); app.Nx = N; app.Ny = N; app.nu = nu; app.PlotIntrvl = plt; app.T = T; app.dt = dt; [P, u, v, rho] = TestCase(10,app); % Extract u velocities at center vertical line if ~mod(N,2) U{i,1} = u(5+N*(N/2-1):4+N*(N/2)); else U{i,1} = 0.5*(u(5+N*(N-1)/2:4+N*(N-1)/2+N)+... u(5+N*(N+1)/2:4+N*(N+1)/2+N)); end; dy = 1/N; U{i,2} = fliplr(linspace(dy/2,1-dy/2,N)); end %% Plot the center vertical line u velocity profile figure; str={'-*k','-xm','-ob','-