function GetTDryBulbFromMoistAirVolumeAndHumRatio(MoistAirVolume, HumRatio, Pressure) result(TDryBulb)
!+ Return dry-bulb temperature given moist air specific volume, humidity ratio, and pressure.
!+ Reference:
!+ ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 26
!+ Notes:
!+ In IP units, R_DA_IP / 144 equals 0.370486 which is the coefficient appearing in eqn 26
!+ The factor 144 is for the conversion of Psi = lb in⁻² to lb ft⁻².
!+ Based on the `GetMoistAirVolume` function, rearranged for dry-bulb temperature.
real, intent(in) :: MoistAirVolume
!+ Specific volume of moist air in ft³ lb⁻¹ of dry air [IP] or in m³ kg⁻¹ of dry air [SI]
real, intent(in) :: HumRatio
!+ Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
real, intent(in) :: Pressure
!+ Atmospheric pressure in Psi [IP] or Pa [SI]
real :: TDryBulb
!+ Dry-bulb temperature in °F [IP] or °C [SI]
real :: BoundedHumRatio
!+ Humidity ratio bounded to MIN_HUM_RATIO
if (HumRatio < 0.0) then
error stop "Error: humidity ratio is negative"
end if
BoundedHumRatio = max(HumRatio, MIN_HUM_RATIO)
if (isIP()) then
TDryBulb = GetTFahrenheitFromTRankine(MoistAirVolume * (144 * Pressure) &
/ (R_DA_IP * (1 + 1.607858 * BoundedHumRatio)))
else
TDryBulb = GetTCelsiusFromTKelvin(MoistAirVolume * Pressure &
/ (R_DA_SI * (1 + 1.607858 * BoundedHumRatio)))
end if
end function GetTDryBulbFromMoistAirVolumeAndHumRatio