c***********************************************************************
      SUBROUTINE PREPDISTRING(u,v,w,c,p,ls,nx,ny,nz)
      INCLUDE 'undefined.h'
      INTEGER nx,ny,nz,i,j,k,n0,n1s2,n2s2,ierr00
      INTEGER GP_IFETCH
      DOUBLE PRECISION c(nx,ny,nz), u(nx,ny,nz), v(nx,ny,nz)
      DOUBLE PRECISION w(nx,ny,nz),p(nx,ny,nz),h,ls(nx,ny,nz)
      DOUBLE PRECISION r0,r01,x0,x,y,z,phi,r,r1,r2
      DOUBLE PRECISION GP_DFETCH
      DOUBLE PRECISION FINDN2S,norm

      r01 = GP_DFETCH('large_radius',3.d0,'SEVERE')
      r0 = GP_DFETCH('small_radius',1.d0,'SEVERE')
      x0 = GP_DFETCH('ring_center',0.5d0,'WARNING')
      r1 = GP_DFETCH('amplitude_of_disturbance',0.d0,'DEFAULT')
      n1s2 = GP_IFETCH('number_of_digits',0,'DEFAULT')
      r2 = GP_DFETCH('amplitude_of_disturbance_2',0.d0,'DEFAULT')
      n2s2 = GP_IFETCH('number_of_digits_2',0,'DEFAULT')
c***
     
      write(*,*) 'r0 =',r0
      write(*,*) 'r01 =',r0
      write(*,*) 'x0=',x0

      h = 1.d0/(nx-2)
      do j=1,ny
         y=(j-1.5)*h
         do k=1,nz
            z=(k-1.5)*h
            phi = atan(y/z)
            do i=1,nx
               x=(i-1.5)*h+PPRANK
               r = r0 + r1 * cos(2 * n1s2 * phi) 
     &                + r2 * cos(2 * n2s2 * phi) 
               ls(i,j,k)=r**2-((x-x0)**2+(dsqrt(y**2 + z**2)-r01)**2)
               u(i,j,k)=0.d0
               v(i,j,k)=0.d0
               w(i,j,k)=0.d0
               p(i,j,k)=0.d0
            end do
         end do
      end do
      norm = h**2*FINDN2S(p,nx,ny,nz)
      call bc_c(c,nx,ny,nz)
      call levelset2vof(ls,c)

      if(PPRANK.eq.0) call writeminmax('cc at end of prepjet',c,nx,ny,nz)
      return
      end

