% David O. Lignell
% Compute maximum cell divergence to test satisfaction of the continuity equation

for i=2:nx-1
    for j=2:ny-1
        div(i,j) = (u_vel(i+1,j)-u_vel(i,j))*dy + dx*(v_vel(i,j+1)-v_vel(i,j));
    end
end

maxdiv = max(max(abs(div)));
[imd,jmd] = find(abs(div) == maxdiv);
maxv   = max([max(abs(v_vel)) max(abs(u_vel))]);
fprintf('maxdiv = ')
fprintf('%6.2e\n', maxdiv);
fprintf('maxu = ')
fprintf('%6.2e\n', maxv);
%imd
%jmd





