       subroutine init_sigh(lhgt,hgt,ref)

       use dynam

       implicit none
       include 'param_o.h'
       include 'const.h'
!!!       include 'dynam_comm.h'  !!!!!
       real,dimension(0:im+1,0:jm+1,nm)::hgt,sm,hgts,ref
       integer,dimension(0:im+1,0:jm+1,nm)::lhgt
       integer,parameter::nsmud=10
       integer::k,i,j,n

      open(1,file='topo.dat', status='old',form='unformatted')
      read(1) hgt,sm
      close(1)

      call bocoh(hgt,im,jm,nm)
      call bocoh(sm,im,jm,nm)
!--------------5-point smoothing of mountains---------------------------
         do k=1,nsmud
!-----------------------------------------------------------------------
         do n=1,nm
         do j=1,jm
         do i=1,im
          if(sm(i,j,n).lt.0.5)    then
             hgts(i,j,n)=(hgt(i,j-1,n)+hgt(i,j+1,n)  &
               +hgt(i+1,j,n)+hgt(i-1,j,n)          &
               +hgt(i,j,n)*4.)*0.125
          else
!             hgts(i,j,n)=hgt(i,j,n)
             hgts(i,j,n)=0.
          endif
         enddo
         enddo
!
         do j=1,jm
         do i=1,im
           hgt(i,j,n)=hgts(i,j,n)
         enddo
         enddo
!-----------------------------------------------------------------------
         enddo
	 call bocoh(hgt,im,jm,nm)
         enddo

         lhgt=lm
	 ref=1.


       end subroutine init_sigh
