function GetRelHumFromTWetBulb(TDryBulb, TWetBulb, Pressure) result(RelHum)
!+ Return relative humidity given dry-bulb temperature, wet bulb temperature and pressure.
!+ References:
!+ ASHRAE Handbook - Fundamentals (2017) ch. 1
real, intent(in) :: TDryBulb
!+ Dry-bulb temperature in °F [IP] or °C [SI]
real, intent(in) :: TWetBulb
!+ Wet-bulb temperature in °F [IP] or °C [SI]
real, intent(in) :: Pressure
!+ Atmospheric pressure in Psi [IP] or Pa [SI]
real :: RelHum
!+ Relative humidity in range [0, 1]
real :: HumRatio
!+ Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
if (TWetBulb > TDryBulb) then
error stop "Error: wet bulb temperature is above dry bulb temperature"
end if
HumRatio = GetHumRatioFromTWetBulb(TDryBulb, TWetBulb, Pressure)
RelHum = GetRelHumFromHumRatio(TDryBulb, HumRatio, Pressure)
end function GetRelHumFromTWetBulb