c cdebug.f c c
      program htcoef
c
c       John Mahaffy,  Penn State University, CmpSc 201 Example
c       1/26/96
c
c
c     John Mahaffy 12/27/95
c
      implicit none
      real k,D,h,Re,Pr
      real htc
c
c    Calculate an approximation for heat transfer coefficients
c    in a 1 inch pipe for several different Reynolds numbers
c
c   h    -  heat transfer coefficient ( w/m**2/K)'
c   k   -  conductivity ( w/m/K)'
c   D   -  hydraulic diameter (m)
c   Re  -  Reynolds number
c
      data k,D,Pr/0.617,0.0254,1.0/
c
c    Calculate and print Heat Transfer Coefficients for several
c    Reynolds numbers.
c
      Re=10.
      h=htc(Re,D,k,Pr)
      call output (Re,h)
c
      h=htc(100.,D,k,Pr)
      call output( 100., h)
c
      call output (1000.,htc(1000.,D,k,Pr))
c
      h=htc(1.e4,k,D,Pr)
      call output(1.0e4,h)
c
      stop
      end
c
      function htc(Re,Hd,k,Pr)
c
c    Calculate a heat transfer coefficient based on the maximum of the
c    Laminar and Turbulent coefficients.  The turbulent coefficient is
c    obtained from a Dittus-Boelter correlation
c
c     John Mahaffy, 12/27/95
c
      implicit none
      real Re,k,Hd,Pr,htc,Nulam,Nuturb
c
c   htc  -  heat transfer coefficient ( w/m**2/K)'
c   Nulam - laminar Nusselt number
c   Nuturb - Turbulent Nusselt number (Dittus-Boelter correlation)
c   k   -  conductivity ( w/m/K)'
c   Hd  -  hydraulic diameter (m)
c   Re  -  Reynolds number
c   Pr  -  Prandl number
c
      data Nulam / 4.0/
c
c     One big advantage of isolating repeated operations in a single
c     location is that you can change things quickly.  Here, I'm going
c     to use what I know about the "**" operator to speed the calculation
c     of "Nuturb=0.023*Re**.8*Pr**0.4
c
      Nuturb=0.023*exp(log(Re)*0.8+log(Pr)*0.4)
c     
      htc=k/Hd*max(Nulam,Nuturb)
c     
      return
      end
c
      subroutine output ( Re, h)
c   Print results to the screen
c
      implicit none
      real Re, h
c
c   Re  -  Reynolds Number
c   h   -  Heat Transfer Coefficient
c
      print *, 'For Reynolds Number = ',Re
      print *, 'Heat Transfer Coefficient is ',h,' w/m**2/K'
      return
      end
c
c c