clear xloc yloc ylower yupper; % Upper boundary height Hupper = 20*h0; % Lower boundary height Hlower = 15*h0; % Number of y-steps in wall Nywall = 8; % Multiple of wall thickness for resolution above wall Mupper = 5; % Multiple of wall thickness for resolution below wall Mlower = 3; % Stretching factor dyfactor = 1.5; % Number of x-steps Nx = 10; % Calculate grid spacing dx = L/Nx; dywall = tw/Nywall; % Calculate spacing below wall upper surface (y<0) ylower = 0:dywall:(Mlower+1)*tw; ylower = -ylower; % Stretch mesh Nlower = length(ylower); while (ylower(Nlower) > -Hlower), ylower(Nlower+1) = ylower(Nlower) + dyfactor*(ylower(Nlower)- ... ylower(Nlower-1)); Nlower = Nlower + 1; end % Calculate spacing below wall upper surface (y<0) yupper = 0:dywall:(Mupper+1)*tw; % Stretch mesh Nupper = length(yupper); while (yupper(Nupper) < Hupper), yupper(Nupper+1) = yupper(Nupper) + dyfactor*(yupper(Nupper)- ... yupper(Nupper-1)); Nupper = Nupper + 1; end % Combine lower and upper into a vector for jj = 1:Nlower, yloc(jj) = ylower(Nlower - jj + 1); end yloc = [yloc (h/h0)*yupper(2:Nupper)]; dyloc_dh = [zeros(1,Nlower) (1.0/h0)*yupper(2:Nupper)]; jmax = length(yloc)-1; % Locate lower and upper wall coordinates jupper = Nlower; jlower = Nlower - Nywall; % Calculate spacing xloc = 0:dx:L; imax = length(xloc)-1;