dLnPws_ Function

public function dLnPws_(TDryBulb) result(dLnPws)

Arguments

Type IntentOptional AttributesName
real, intent(in) :: TDryBulb

Return Value real


Contents

Source Code


Source Code

  function dLnPws_(TDryBulb) result(dLnPws)
    !+ Helper function returning the derivative of the natural log of the saturation vapor pressure
    !+ as a function of dry-bulb temperature.
    !+ Reference:
    !+ ASHRAE Handbook - Fundamentals (2017) ch. 1  eqn 5

    real, intent(in)  ::  TDryBulb
      !+ Dry-bulb temperature in °F [IP] or °C [SI]
    real              ::  dLnPws
      !+ Derivative of natural log of vapor pressure of saturated air in Psi [IP] or Pa [SI]
    real              ::  T
      !+ Dry bulb temperature in R [IP] or K [SI]

    if (isIP()) then

      T = GetTRankineFromTFahrenheit(TDryBulb)

      if (TDryBulb <= TRIPLE_POINT_WATER_IP) then
        dLnPws = 1.0214165E+04 / T**2 - 5.3765794E-03 + 2 * 1.9202377E-07 * T &
                 + 3 * 3.5575832E-10 * T**2 - 4 * 9.0344688E-14 * T**3 + 4.1635019 / T
      else
        dLnPws = 1.0440397E+04 / T**2 - 2.7022355E-02 + 2 * 1.2890360E-05 * T &
                 - 3 * 2.4780681E-09 * T**2 + 6.5459673 / T
      end if

    else

      T = GetTKelvinFromTCelsius(TDryBulb)

      if (TDryBulb <= TRIPLE_POINT_WATER_SI) then
        dLnPws = 5.6745359E+03 / T**2 - 9.677843E-03 + 2 * 6.2215701E-07 * T &
                 + 3 * 2.0747825E-09 * T**2 - 4 * 9.484024E-13 * T**3 + 4.1635019 / T
      else
        dLnPws = 5.8002206E+03 / T**2 - 4.8640239E-02 + 2 * 4.1764768E-05 * T &
                 - 3 * 1.4452093E-08 * T**2 + 6.5459673 / T
      end if
    end if
  end function dLnPws_