Q_FN_T_ENTH Function

public function Q_FN_T_ENTH(PT, PENTH) result(PQ)

Uses

Arguments

Type IntentOptional AttributesName
real, intent(in) :: PT
real, intent(in) :: PENTH

Return Value real


Contents

Source Code


Source Code

FUNCTION Q_FN_T_ENTH(PT,PENTH) RESULT(PQ)
!     ######################################
!
!!
!!    PURPOSE
!!    -------
!       The purpose of this function is to compute the humidity content
!       as a function of temperature and enthalpy
!      
!
!!**  METHOD
!!    ------
!!  
!!
!!    EXTERNAL
!!    --------
!!      NONE
!!
!!    IMPLICIT ARGUMENTS
!!    ------------------  
!!      
!!    REFERENCE
!!    ---------
!!      
!!
!!
!!    AUTHOR
!!    ------
!!	
!!
!!    MODIFICATIONS
!!    -------------
!!      Original    12/04/11 
!!      D.Meyer and R. Schoetter 2018: see a9c4c46889dca998ea9ca40e5e0edc62ecc75715
!
!-------------------------------------------------------------------------------
!
!*       0.    DECLARATIONS
!              ------------
!
USE MODD_CSTS, ONLY: XTT
!
IMPLICIT NONE
!
!*       0.1   Declarations of arguments and results
!
!
REAL, INTENT(IN)                :: PT     ! Temperature (K)
REAL, INTENT(IN)                :: PENTH  ! Enthalpy (J/kg)
REAL                           :: PQ     ! Humidity content (kg/kg)
!
!*       0.2   Declarations of local variables
!
REAL        :: ZT                          ! Temperature (C)
REAL        :: ZRV                         ! Mixing ratio (kg/kg_da)
REAL(KIND=JPRB) :: ZHOOK_HANDLE
!
IF (LHOOK) CALL DR_HOOK('MODE_PSYCHRO:Q_FN_T_ENTH',0,ZHOOK_HANDLE)
!
ZT = PT - XTT
!
!    calculate mixing ratio
ZRV=(PENTH-1.00484E3*ZT)/(2.50094E6+1.85895E3*ZT)
!
!    validity test
IF (ZRV .LT. 0.0) ZRV=1.E-5
!
!    calculate humidity content
PQ = ZRV/(1.0+ZRV)
!
IF (LHOOK) CALL DR_HOOK('MODE_PSYCHRO:Q_FN_T_ENTH',1,ZHOOK_HANDLE)
!
!-------------------------------------------------------------------------------
!
END FUNCTION Q_FN_T_ENTH