function GetTDewPointFromRelHum(TDryBulb, RelHum) result(TDewPoint)
!+ Return dew-point temperature given dry-bulb temperature and relative humidity.
!+ References:
!+ ASHRAE Handbook - Fundamentals (2017) ch. 1
real, intent(in) :: TDryBulb
!+ Dry-bulb temperature in °F [IP] or °C [SI]
real, intent(in) :: RelHum
!+ Relative humidity in range [0, 1]
real :: TDewPoint
!+ Dew-point temperature in °F [IP] or °C [SI]
real :: VapPres
!+ Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
if (RelHum < 0.0 .or. RelHum > 1.0) then
error stop "Error: relative humidity is outside range [0,1]"
end if
VapPres = GetVapPresFromRelHum(TDryBulb, RelHum)
TDewPoint = GetTDewPointFromVapPres(TDryBulb, VapPres)
end function GetTDewPointFromRelHum