      program interpolate
      implicit none
      open(10,file='nuwlin')
      open(11,file='nuwcube')
      call nuwlin
      call nuwcube
      call plotit
      stop
      end
      subroutine nuwlin
      implicit none
      real Nulam,Nuturb,Pr,Re,w,Nu
      real Re1,Re2,rwfac
      parameter (Pr=1.0,Nulam=4.0,Re1=640,Re2=2000.,rwfac=1./(Re2-Re1))
      Re=0.0
      do 100 while (Re.le.3000.)
        if(Re.lt.Re1) then
           Nu = Nulam
        else if (Re.gt.Re2)  then
           Nu=Nuturb(Re,Pr)
        else
           w = (Re - Re1)*rwfac
           Nu = (1.-w)*Nulam + w*Nuturb(Re,Pr)
        endif
        write(10,*)Re,Nu
        Re=Re+10.
  100 continue
      return
      end
      subroutine nuwcube
      implicit none
      real Nuturb,Nulam,Pr,Re,w,SRe,Re1,Re2, Nu
      parameter (Pr=1.0,Nulam=4.0,Re1=640,Re2=2000.)
      Re=0.
      do 200 while (Re.le.3000.)
        if(Re.lt.Re1) then
           Nu=Nulam
        else if (Re.gt.Re2) then
           Nu=Nuturb(Re,Pr)
        else
           SRe=(Re-Re1)/(Re2-Re1)
           w= (3. - 2.*SRe)*SRe**2
           Nu= (1.-w)*Nulam + w*Nuturb(Re,Pr)
        endif
        write(11,*)Re,Nu
        Re=Re+10.
  200 continue
      return
      end
      function Nuturb(Re,Pr)
      implicit none
      real Re,Pr,Nuturb
      Nuturb=0.023*exp(log(Re)*0.8+log(Pr)*0.4)
      return
      end
      subroutine plotit
       logical fexist


      inquire (file='gp-int3',exist=fexist)
      if (.not.fexist) then
         call system('cp ~jhm/201/gp-int3 .')
         print *, ' Graphics input file copied'
      endif
      close ( 11 )
      close ( 10 )
      return
      end
