GetTDryBulbFromEnthalpyAndHumRatio Function

public function GetTDryBulbFromEnthalpyAndHumRatio(MoistAirEnthalpy, HumRatio) result(TDryBulb)

Arguments

Type IntentOptional AttributesName
real, intent(in) :: MoistAirEnthalpy
real, intent(in) :: HumRatio

Return Value real


Contents


Source Code

  function GetTDryBulbFromEnthalpyAndHumRatio(MoistAirEnthalpy, HumRatio) result(TDryBulb)
    !+ Return dry bulb temperature from enthalpy and humidity ratio.
    !+ Reference:
    !+ ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30
    !+ Notes:
    !+ Based on the `GetMoistAirEnthalpy` function, rearranged for temperature.

    real, intent(in)  ::  MoistAirEnthalpy
      !+ Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹
    real, intent(in)  ::  HumRatio
      !+ Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [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  = (MoistAirEnthalpy - 1061.0 * BoundedHumRatio) / (0.240 + 0.444 * BoundedHumRatio)
    else
      TDryBulb  = (MoistAirEnthalpy / 1000.0 - 2501.0 * BoundedHumRatio) / (1.006 + 1.86 * BoundedHumRatio)
    end if
  end function GetTDryBulbFromEnthalpyAndHumRatio