I have this part of my algorith
dVmax=0.e0 do i=1,Nx do j=1,Ny dVmax=max(dVmax,abs(V(i,j)-Vnew(i,j))) end do end do if (dVmax .lt. delta) exit