MODULE atmosLib
! Written by Kate T-C
! Today is 9/8/09.
! This module includes a function for calculating the relative
! humidity at a given temperature, pressure, and mixing ratio.
implicit none
CONTAINS
REAL FUNCTION RelHum (T, P, R)
implicit none
real, intent(IN) :: T, P, R
real :: Es, Rs
! Calculate the saturation vapor pressure at this temperature
Es = 6.111 * exp( (17.67*(T-273.15)) / ((T-273.15)+245.5) )
! Calculate the saturation mixing ratio
Rs = 0.62 * Es / ( P - Es )
! The relative humidity is a ratio of the given mixing ratio to saturation
RelHum = R / Rs * 100
END FUNCTION RelHum
END MODULE atmosLib