c
c     example of use of bump function
c     this is one way to modify an airfoil
c     w.h. mason, Feb. 12, 1994

c     set input parameters

      xb1    = 0.1
      xb2    = 0.4
      xb3    = 0.6

      dtc    = 0.50

      xmax   = 1.0

      write(6, 90) xb1,xb2,xb3,dtc
   90 format(/3x,'bump example'//
     1        3x,'xb1 = ',f7.4,3x,'xb2 = ',f7.4,3x,
     2           'xb3 = ',f7.4/3x,'dtc = ',f7.4/
     3       /4x,'i',7x,'x/c',7x,'delta y',4x,
     4           'd(dy)/dx'3x,'d2(dy)/dy2')

      do 10 i = 1,101
      xc      = 0.01*(i-1)
      call bump(xb1,xb2,xb3,dtc,xmax,xc,ymod,ymodp,ymodpp)
   10 write(6,100) i,xc,ymod,ymodp, ymodpp

  100 format(i5,4f12.5)

      stop
      end

      subroutine bump(xb1,xb2,xb3,dtc,xmax,xin,ymod,ymodp,ymodpp)
c
c     so-called cubic bump function
c
c     used to make mods to aero surfaces
c
c     W.H. Mason, December 1989
c
c     xb1    - start of bump (dimensional)
c     xb2    - location of maximum bump height (dimensional)
c     xb3    - end of bump (dimensional)
c
c     dtc    - magnitude of bump
c     xmax   - reference length of geometry
c
c     xin    - input location to get bump value
c     ymod   - bump height
c     ymodp  - first derivative of bump wrt xin
c     ymodpp - second derivative of bump wrt xin

      x      = xin/xmax
      x1     = xb1/xmax
      x2     = xb2/xmax
      x3     = xb3/xmax

      xd     = 0.0
      dxddx  = 0.0
      if ( x .ge. x1 .and. x .le. x2) then

               xd = (x - x1)/2.0/(x2 - x1)
               dxddx = 1./2./(x2 - x1)
               endif

      if ( x .gt. x2 .and. x .le. x3) then

               xd = (x + x3 - 2.0*x2)/2.0/(x3 - x2)
               dxddx = 1./2./(x3 - x2)
               endif

      ymod   = -64.*dtc*xd**3*(xd - 1.0)**3

      ymodp  = -64.*dtc*3.0*dxddx*xd**2*
     1          (xd - 1.0)**2*(2.0*xd - 1.0)
      ymodpp = -64.*dtc*6.0*dxddx**2*xd*(xd - 1.0)*
     1          (5.0*xd**2 - 5.0*xd + 1.0)

      return
      end
