      subroutine init_hbmsk(hbmsk,im,jm,nm)

      implicit none

      integer::im,jm,nm,i,j,n
      real,dimension(0:im+1,0:jm+1,nm)::hbmsk

      hbmsk=0.

      do i=2,im-1
      do j=2,jm-1
        hbmsk(i,j,:)=1.
      enddo
      enddo

      if(nm.eq.14)then
      hbmsk(1:im,1:jm,3)=1.
      hbmsk(1:im,1:jm,10)=1.
      hbmsk(2:im-1,1,2)=1.
      hbmsk(2:im-1,1,4)=1.
      hbmsk(2:im-1,1,9)=1.
      hbmsk(2:im-1,1,11)=1.
      hbmsk(2:im-1,jm,2)=1.
      hbmsk(2:im-1,jm,4)=1.
      hbmsk(2:im-1,jm,9)=1.
      hbmsk(2:im-1,jm,11)=1.

      hbmsk(1,2:jm-1,1)=1.
      hbmsk(1,2:jm-1,5)=1.
      hbmsk(1,2:jm-1,7)=1.
      hbmsk(1,2:jm-1,13)=1.
      hbmsk(im,2:jm-1,1)=1.
      hbmsk(im,2:jm-1,5)=1.
      hbmsk(im,2:jm-1,7)=1.
      hbmsk(im,2:jm-1,13)=1.

      hbmsk(1,1:jm,2)=1.
      hbmsk(1:im,1,1)=1.
      hbmsk(1:im,jm,5)=1.
      hbmsk(im,1:jm,4)=1.

      else
       do n=1,4
       do i=1,im-1
        hbmsk(i,1,n)=1.
        hbmsk(i,jm,n)=1.
        hbmsk(1,i,n)=1.
      enddo
      enddo
      endif

      end subroutine init_hbmsk



