!
!  cal_anorm.f90
!
      subroutine cal_anorm(x,y,z,anorm,icvs,jcvs,kcvs,rz,iz,dz,cz,ierr)
!
      implicit none
      real :: rz(*)
      integer :: iz(*),ierr
      character :: cz(*)
      real (selected_int_kind (5)) :: dz(*)
!
      integer :: icvs,jcvs,kcvs
      real :: x(icvs,jcvs,kcvs),y(icvs,jcvs,kcvs),z(icvs,jcvs,kcvs), &
              anorm(icvs,jcvs,kcvs,3)
!
      real :: delx,dely,delz 
      integer :: i,j,k  
!
      do i=1,icvs
      do j=1,jcvs
      do k=1,kcvs
        if (i==icvs) then
          delx = x(i,j,k) - x(i-1,j,k)
        else
          delx = x(i+1,j,k) - x(i,j,k)
        endif
        if (j==jcvs) then
          dely = y(i,j,k) - y(i,j-1,k)
        else
          dely = y(i,j+1,k) - y(i,j,k)
        endif
        if (k==kcvs) then
          delz = z(i,j,k) - z(i,j,k-1)
        else
          delz = z(i,j,k+1) - z(i,j,k) 
        endif
        anorm(i,j,k,1) = dely*delz
        anorm(i,j,k,2) = delx*delz
        anorm(i,j,k,3) = delx*dely  
      enddo
      enddo
      enddo                           
!
      end subroutine cal_anorm