% Lid-Driven Cavity Flow test case
%%NOTE! Changing this script will also affect LidDrivenCavitySetup_DO, 
%% which calls this script. 

% Forcing Function
Fu = @(time,p) 0;
Fv = @(time,p) 0;

%Setup boundary size
a    = 1;          b    = 1;
dx   = a./(app.Nx);    dy   = b./(app.Ny); 

%Set boundary conditoins
bcsDP= []; bcsOP= []; bcsNP= [0 0 0 0];        
bcsDu= [0 0 0 1]  ;  bcsNu= [];        
bcsDv= [0 0 0 0]  ;  bcsNv= [];        

%Set number of timesteps
Nt   = ceil(app.T/app.dt);

%% create geometry mask
Nbcs = length(bcsDP) + length(bcsNP);
bnd = [1 1 1 1];
Mask = zeros(app.Ny, app.Nx);

%create Node matrices
[NodeP, Nodeu, Nodev, idsP, idsu, idsv] = NodePad(Mask,bnd,1);

%% Initialize fields
xp = linspace(dx/2, a-dx/2, app.Nx  );yp = fliplr(linspace(dy/2, b-dy/2, app.Ny  ));
xu = linspace( dx   ,a-dx , app.Nx-1);yu = fliplr(linspace(dy/2, b-dy/2, app.Ny  ));
xv = linspace(dx/2, a-dx/2, app.Nx  );yv = fliplr(linspace(dy    , b-dy, app.Ny-1));
[XP YP] = meshgrid(xp,yp);[XU YU] = meshgrid(xu,yu);[XV YV] = meshgrid(xv,yv);
P = [bcsDP';bcsNP'; 0*idsP];
u = [bcsDu';bcsNu';idsu*0];
v = [bcsDv';bcsNv'; 0*idsv];
ucentid = Nodeu(:,floor(app.Nx/2+1));
vcentid = Nodev(:,floor(app.Nx/2+1));
