module OW_taper_areal
!--------------------------------------------------
! Compute vref
!
use OW_parms_areal
implicit none
contains

subroutine owtaper(taper)
integer				:: i,j
real				:: taper(:,:),tx,ty
taper=1.
do i=1,kxm%n
   if (i<=tapertrx) then
      tx=(1+cos(pi*(tapertrx-i+1)/tapertrx))/2
   else if (i>=nx-tapertrx+1) then
      tx=(1+cos(pi*(i-tapertrx-nx)/tapertrx))/2
   else
      tx=1
   end if
   do j=1,kym%n
      if (j<=tapertry) then
         ty=(1+cos(pi*(tapertry-j+1)/tapertry))/2
      else if (j>=ny-tapertry+1) then
         ty=(1+cos(pi*(j-tapertry-ny)/tapertry))/2
      else
         ty=1
      end if
      taper(i,j)=tx*ty;
   end do
end do

end subroutine owtaper
end module
