relhum

Calculates relative humidity given temperature, mixing ratio, and pressure.


Synopsis

    function relhum(
        t  : float,
        w  : float,
        p  : float
    )


Arguments

t
Temperature (K) (any dimensionality)
w
Mixing ratio (kg/kg) (same dimensions as t)
p
pressure (Pa) (same dimensions as p)

Description

relhum returns a float array (of the same dimensionality as its input arrays) where each value represents the relative humidity given the temperature, mixing ratio, and pressure. The input arrays can be of any dimensionality as long as they are all the same dimensionality as each other.

Example

begin
  p  =(/ 1008.,  \                                        
         1000.,950.,900.,850.,800.,750.,700.,650.,600., \
               550.,500.,450.,400.,350.,300.,250.,200., \
               175.,150.,125.,100., 80., 70., 60., 50., \
                40., 30., 25., 20. /)
  t  =(/  29.3,  \                                        
          28.1,23.5,20.9,18.4,15.9,13.1,10.1, 6.7, 3.1,   \
          -0.5,-4.5,-9.0,-14.8,-21.5,-29.7,-40.0,-52.4,   \
         -59.2,-66.5,-74.1,-78.5,-76.0,-71.6,-66.7,-61.3, \
         -56.3,-51.7,-50.7,-47.5 /)
  q  =(/  20.38, \
          19.03,16.14,13.71,11.56,9.80,8.33,6.75,6.06,5.07, \
           3.88, 3.29, 2.39, 1.70,1.00,0.60,0.20,0.00,0.00, \
           0.00, 0.00, 0.00, 0.00,0.00,0.00,0.00,0.00,0.00, \
           0.00, 0.00 /)

  nlvl = dimsizes(p)
  print (nlvl)

  zsfc = 17.0
  q    =  q*0.001
  tk   = t+273.15
  tkv  = tk*(1.+q*0.61)
  tcv  =  tkv-273.15

  zh   = hydro (p*100.,tkv,zsfc)

  rhccm= relhum (tk, q, p*100. )

  expp = 2.7182
  eps = 0.62197

  do n=0,nlvl-1
    ev = q(n)*p(n)/(eps+q(n))               
    es = 6.112*expp^(17.67*tcv(n)/(243.5+tcv(n)))     
    rh =  (ev/es)*100.       ; in [%]; avoid 0
    print ("HYDRO: "+n+" "+p(n)+" "+zh(n) \
                      +" "+q(n)+" "+tcv(n)\
                      +" rhccm="+rhccm(n) \
                      +" rh="   +rh)
  end do
end


Reference Manual Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.5 $ $Date: 1999/02/04 20:13:28 $