! module m_relhum ! ! Module for transforming between specific and relative humidities ! ! For the saturation vapor pressure v this uses a linear interpolation ! between values from a look-up table constructed in the routine ! relhum_setup. These are starurations with repect to liquid water. ! Then, given ta=t-tmin it ! determines the largest value of t1 v) then q=q*(p-v)/(v*ep2) else ier=ier+1 endif ! end subroutine relhum_q2rh ! ! ! X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ! subroutine relhum_rh2q (t,p,q,ier) ! ! Replace specific humidity by relative humidity ! implicit none integer :: ier real(rkind1) :: t, p, q ! local integer :: ip real(rkind1) :: tx, v ! tx=(t-satvp(2))/satvp(3) ! t-tmin in units of satvp(2) ip=int(tx) v=satvp(ip+4)+(tx-ip)*(satvp(ip+5)-satvp(ip+4)) if (p > v) then q=ep2*q*v/(p-v) else ier=ier+1 endif ! end subroutine relhum_rh2q ! ! ! X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ! subroutine relhum_td2q (tq,p) ! ! Replace dew point temperature (input in array tq) by specific humidity ! (output array tq). ! implicit none integer :: ier real(rkind2) :: tq, p ! local integer :: ip real(rkind1) :: tx, v, w ! tx=(tq-satvp(2))/satvp(3) ! t-tmin in units of satvp(2) ip=int(tx) v=satvp(ip+4)+(tx-ip)*(satvp(ip+5)-satvp(ip+4)) w=ep2*v/(p-v) tq=w/(1.+w) ! end subroutine relhum_td2q ! ! end module m_relhum