% David O. Lignell
% 12/27/03
% make_grid.m
% called by ns.m
% specify grid dimensions, cell types
% Code assumes constant delta_x, and delta_y
% Obviously there should be a whole number of cells in each dir so make L/ny whole, etc.
% This grid is for the slot jet problem of phils cfd class
% Inlet area is 0.2*W, and is 4 cells across
%
%     |  outlet BC  |
%     |             |
%     |             |
%     |             |
%     |  Fluid      |
%     |             | Walls
%     |             |
%     |      ^      |             ^ y , j              
%     |      |      |             |
%     |____|in|_____|       x,i   |---->        Lower right corner = (0,0)


L   = 4.0;                     % y-dir grid width
W   = 1.0;                     % x-dir grid length

% Set base flow domain

nx = 80;
ny = nx*L/W;
dx = W/nx;
dy = L/ny;

[x y]  = meshgrid(dx:dx:W, dy:dy:L);
% Add ghost cells (for simple grids this is the boundary cells)

nx = nx + 2;
ny = ny + 2;

% Define four valid cell types (flow, wall, inlet, outlet)
% Flow is 0, inlet is 1, outlet is 2, wall is 3
% Assume flow only in interior cells, inlet and outlet only on boundary (ghost cells)
% and wall cells anywhere

cell_types = zeros(nx,ny);  % not used in this code

cell_types(1,:)        = 3;
cell_types(end,:)      = 3;
cell_types(2:nx-1,end) = 2;

win = W*0.2;
cell_types(nx/2-1:nx/2+2,1) = 1;
