!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       Subroutine Bocov_cb(u,v,im,jm)
!     ******************************************************************
!c    *                                                                *
!c    *  Boundary Conditions for Height Points on cube                 *
!c    *                                                                *
!c    ******************************************************************
!c----------------------------------------------------------------------
!c-------------------------------------------------------------------
      implicit none

      integer::im,jm
      integer,parameter::nm=6
      REAL    :: u(0:im+1,0:jm+1,6),v(0:im+1,0:jm+1,6)
      INTEGER :: n,nl,nr,i,j,im1,jm1

      im1=im-1
      jm1=jm-1
!c-----------------------------------------------------------------------
!c                Lateral Faces                                          
!c-----------------------------------------------------------------------
!c
!c Lateral Conditions
!c
      Do n=1,4
        nl=n-1+4*((5-n)/4)
        nr=n+1-4*(n/4)
         Do j=1,jm
           u(0   ,j,n)=u(im1,j,nl)
           v(0   ,j,n)=v(im1,j,nl)
           u(im,j,n)=u(1  ,j,nr)
           v(im,j,n)=v(1  ,j,nr)
	 End Do
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im
        u(i,jm,1)=u(i,1  ,5)             !     Face 1
        v(i,jm,1)=v(i,1  ,5)             !     Face 1
        u(i,0   ,1)=u(i,jm1,6)             !
        v(i,0   ,1)=v(i,jm1,6)             !
        u(i,jm,2)=v(im1,i     ,5)        !     Face 2
        v(i,jm,2)=-u(im1,i     ,5)        !     Face 2
        u(i,0   ,2)=-v(im1,jm-i,6)        !
        v(i,0   ,2)=u(im1,jm-i,6)        !
        u(i,jm,3)=-u(im-i,jm1,5)        !     Face 3
        v(i,jm,3)=-v(im-i,jm1,5)        !     Face 3
        u(i,0   ,3)=-u(im-i,1  ,6)        !
        v(i,0   ,3)=-v(im-i,1  ,6)        !
        u(i,jm,4)=v(1,jm-i,5)          !     Face 4
        v(i,jm,4)=-u(1,jm-i,5)          !     Face 4
        u(i,0   ,4)=v(1,i     ,6)          !
        v(i,0   ,4)=-u(1,i     ,6)          !
      End Do
!c-----------------------------------------------------------------------
!c                Upper and Lower Faces                                  
!c-----------------------------------------------------------------------
!c
!c Lateral Conditions
!c
      Do j=1,jm
        u(0   ,j,5)=v(im-j,jm1,4)        !     Face 5
        v(0   ,j,5)=-u(im-j,jm1,4)        !     Face 5
        u(im,j,5)=-v(j     ,jm1,2)        !
        v(im,j,5)=u(j     ,jm1,2)        !
        u(0   ,j,6)=-v(j     ,1,4)          !     Face 6
        v(0   ,j,6)=u(j     ,1,4)          !     Face 6
        u(im,j,6)=v(im-j,1,2)          !
        v(im,j,6)=-u(im-j,1,2)          !
      End Do
!c
!c Lower and Upper Conditions
!c
      Do i=1,im
        u(i,jm,5)=-u(im-i,jm1,3)        !     Face 5
        v(i,jm,5)=-v(im-i,jm1,3)        !     Face 5
        u(i,0   ,5)=u(i     ,jm1,1)        !
        v(i,0   ,5)=v(i     ,jm1,1)        !
        u(i,jm,6)=u(i     ,1,1)          !     Face 6
        v(i,jm,6)=v(i     ,1,1)          !     Face 6
        u(i,0   ,6)=-u(im-i,2,3)          !
        v(i,0   ,6)=-v(im-i,2,3)          !
      End Do

      END SUBROUTINE Bocov_cb


