QSATI_2D Function

public function QSATI_2D(PT, PP, KMASK, KL) result(PQSAT)

Arguments

Type IntentOptional AttributesName
real, intent(in), DIMENSION(:,:):: PT
real, intent(in), DIMENSION(:,:):: PP
integer, intent(in), optional DIMENSION(:):: KMASK
integer, intent(in), optional :: KL

Return Value real, DIMENSION(SIZE(PT,1),SIZE(PT,2))


Contents

Source Code


Source Code

      FUNCTION QSATI_2D(PT,PP,KMASK,KL) RESULT(PQSAT)
!     ######################################
!
!!****  *QSATI * - function to compute saturation vapor humidity from
!!                 temperature
!!
!!    PURPOSE
!!    -------
!       The purpose of this function is to compute the saturation vapor 
!     pressure from temperature 
!      
!
!!**  METHOD
!!    ------
!!       Given temperature T (PT), the saturation vapor pressure es(T)
!!    (FOES(PT)) is computed by integration of the Clapeyron equation
!!    from the triple point temperature Tt (XTT) and the saturation vapor 
!!    pressure of the triple point es(Tt) (XESTT), i.e  
!!     
!!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
!!  
!!     with :
!!       alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
!!       betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
!!       gammaw (XGAMI) = (Cl -Cpv) /Rv
!!
!!      Then, the specific humidity at saturation is deduced.
!!  
!!
!!    EXTERNAL
!!    --------
!!      NONE
!!
!!    IMPLICIT ARGUMENTS
!!    ------------------
!!      Module MODD_CST : comtains physical constants
!!        XALPI   : Constant for saturation vapor pressure function
!!        XBETAI  : Constant for saturation vapor pressure function
!!        XGAMI   : Constant for saturation vapor pressure function  
!!      
!!    REFERENCE
!!    ---------
!!      Book2 of documentation of Meso-NH 
!!
!!
!!    AUTHOR
!!    ------
!!      V. Masson       * Meteo France *
!!
!!    MODIFICATIONS
!!    -------------
!!      Original    21/09/98 
!-------------------------------------------------------------------------------
!
!*       0.    DECLARATIONS
!              ------------
!
USE MODD_SURF_PAR,  ONLY : XUNDEF
USE MODD_CSTS       
!
IMPLICIT NONE
!
!*       0.1   Declarations of arguments and results
!
!
REAL, DIMENSION(:,:), INTENT(IN)            :: PT     ! Temperature
                                                      ! (Kelvin)
REAL, DIMENSION(:,:), INTENT(IN)            :: PP     ! Pressure
                                                      ! (Pa)
!                                                        
INTEGER, DIMENSION(:), INTENT(IN), OPTIONAL   :: KMASK
!                                                KMASK = Number of soil moisture layers (DIF option)
INTEGER,               INTENT(IN), OPTIONAL   :: KL
!                                                KL = Max number of soil moisture layers (DIF option)
!                                                      
REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2))      :: PQSAT  ! saturation vapor 
                                                      ! specific humidity
                                                      ! with respect to
                                                      ! water (kg/kg)
!
!*       0.2   Declarations of local variables
!
REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2))      :: ZFOES  ! saturation vapor pressure (Pascal) 
!
INTEGER, DIMENSION(SIZE(PT,1)) :: IMASK
!
INTEGER         :: INL
REAL(KIND=JPRB) :: ZHOOK_HANDLE
!-------------------------------------------------------------------------------
!
IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_2D',0,ZHOOK_HANDLE)
!
IF(PRESENT(KMASK))THEN
  IMASK(:)=KMASK(:)    
  INL=KL
ELSE
  IMASK(:)=SIZE(PT,2)  
  INL=SIZE(PT,2)
ENDIF
!
PQSAT(:,:)=XUNDEF
ZFOES(:,:)=0.0
!
!  
!*       1.    COMPUTE SATURATION VAPOR PRESSURE
!              ---------------------------------
!
ZFOES(:,1:INL) = PSAT(PT(:,1:INL),IMASK(:))
!
!*       2.    COMPUTE SATURATION HUMIDITY
!              ---------------------------
!
PQSAT(:,:) = XRD/XRV*ZFOES(:,:)/PP(:,:) / (1.+(XRD/XRV-1.)*ZFOES(:,:)/PP(:,:))  
!
IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_2D',1,ZHOOK_HANDLE)
!-------------------------------------------------------------------------------
!
END FUNCTION QSATI_2D