subroutine boundaries(g,rb,lb,t,nx,ny)
!---------------------------------------------------
! set boundary conditions after grid update
!---------------------------------------------------

use types
use adaptive
real(SP), dimension(:,:,:) :: g
integer(I4B), dimension(3) :: rb,lb
real(SP)                   :: t
integer(I4B)               :: nx,ny

!HPF$ PROCESSORS P(PX,PY)
!HPF$ DISTRIBUTE (BLOCK,BLOCK,*) ONTO P :: g


g(1,:,1)=g(2,:,1)
g(nx,:,1)=g(2,:,1)

! the following condition is imposed only when the edge of the
! grid g on a given level of refinement coincide with 
! edges of the base grid

if(lb(1)==1) g(:,1,1)=sin(0.15*t)

write(6,*) g(5,1:5,1), '*'
return
end