c===========================================================================

      function relhum(t,h2o) 1
c
c purpose:
c     return relative humidity for a give temperature and water vapor 
c     density
c
c input:
c   t          temperature (kelvin)
c   h2o        water vapor density (g/m3)
c output:
c   relhum     relative humidity 
c
      parameter (tzero=273.15)
      a=tzero/t
c
c h2osat is the mass density (g/m3) of water vapor at 100% saturation 
c (source: handbook of chemistry and physics, h2o vapor pressure table d-112,
c assuming density related to pressure by ideal gas law)
c
      h2osat=a*exp(18.916758-a*(14.845878+a*2.4918766))
      relhum=h2o/h2osat
      return
      end