      subroutine rsurfu(h,p,tgt,dnds,x1,time,u,ciname,slname,msname,
     1                  noel,node,lclose)
c
      include 'aba_param.inc'
c
      character*80 ciname,slname,msname
      dimension p(3), tgt(3,2), dnds(3,2), x1(3,2), u(6,2)
c
c set abig to: 1.d27 for vax under vms, 1.d30 for non-unix ibm,
c              1.d40 all other machines.
c
      parameter( zmax = 25.d0, radius = 5.d0,  zero  = 0.d0, 
     +           one  =  1.d0, two    = 2.d0,  abig   = 1.d27, 
     +           small = 1.d-8 )
c
c initialize variables to be returned by rsurfu
c
      h = -abig
      do 50 k1=1, 2
        do 25 k2=1, 3
           tgt(k2,k1)  = zero
           dnds(k2,k1) = zero
           p(k2)       = zero
 25   continue
 50   continue
c
c coordinates on deforming body
c
      x = x1(1,1)
      y = x1(2,1)
      z = x1(3,1)
c
c find closest point only if (x,y,z) is inside valid region
c
      if ( z .ge. zero .and. z .le. zmax ) then
         r = ( x*x + y*y )**(one/two)
         if ( r .gt. small ) then
            x = x / r
            y = y / r
         else
            x = one
            y = zero 
         end if
         p(1) = radius*x
         p(2) = radius*y
         p(3) = z
         tgt(1,1)  = -y
         tgt(2,1)  =  x
         tgt(3,2)  =  one
         dnds(1,1) = -y / radius
         dnds(2,1) =  x / radius
         h = radius - r
      end if
c
      return
      end

