module OW_grabvel_areal
use OW_type
use OW_parms_areal
implicit none
contains
!------------------------------------
subroutine owgrab_velim(velint,vel,ni)
integer   			:: ni
integer				:: nvx,nvy,i,j,k
real				:: velint(v%xm%n,v%ym%n,v%z%n), vel(nx,ny,nz),owrkx,owrky

   nvx = floor((xmin-v%xm%o)/v%xm%d)+1
   nvy = floor((ymin-v%ym%o)/v%ym%d)+1
   vel=0
   do k=nzmin,nzmax
   do j=nvy,nvy+ny-1
   do i=nvx,nvx+nx-1
      vel(i-nvx+1,j-nvy+1,k-nzmin+1)=velint(i,j,k)
   end do
   end do
   end do

if(exist_file("velout")) call srite("velout",vel,4*nx*ny*nz)

end subroutine
!=========================
end module
