SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/mode_thermos.F90
Go to the documentation of this file.
00001 !     ######spl
00002       MODULE MODE_THERMOS
00003 !     ####################
00004 !
00005 !!****  *MODE_THERMO* -
00006 !!
00007 !!    PURPOSE
00008 !!    -------
00009 !      
00010 !
00011 !!
00012 !!**  IMPLICIT ARGUMENTS
00013 !!    ------------------
00014 !!       NONE          
00015 !!
00016 !!    REFERENCE
00017 !!    ---------
00018 !!
00019 !!
00020 !!    AUTHOR
00021 !!    ------
00022 !!      V. Ducrocq       * Meteo France *
00023 !!
00024 !!    MODIFICATIONS
00025 !!    -------------
00026 !!      Original    28/08/94 
00027 !!      Modified    01/2006 : sea flux parameterization.
00028 !--------------------------------------------------------------------------------
00029 !
00030 !*       0.    DECLARATIONS
00031 !              ------------
00032 !
00033 !-------------------------------------------------------------------------------
00034 !
00035 !
00036 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00037 USE PARKIND1  ,ONLY : JPRB
00038 !
00039 INTERFACE PSAT
00040   MODULE PROCEDURE PSAT_0D
00041   MODULE PROCEDURE PSAT_1D
00042 END INTERFACE
00043 INTERFACE QSAT
00044   MODULE PROCEDURE QSATW_0D         
00045   MODULE PROCEDURE QSATW_1D
00046   MODULE PROCEDURE QSATW_2D
00047 END INTERFACE
00048 INTERFACE QSAT_SEAWATER
00049   MODULE PROCEDURE QSATSEAW_1D
00050 END INTERFACE
00051 INTERFACE DQSAT
00052   MODULE PROCEDURE DQSATW_O_DT_1D
00053 END INTERFACE
00054 INTERFACE QSATI
00055   MODULE PROCEDURE QSATI_1D
00056   MODULE PROCEDURE QSATI_2D
00057 END INTERFACE
00058 INTERFACE DQSATI
00059   MODULE PROCEDURE DQSATI_O_DT_1D
00060 END INTERFACE
00061 CONTAINS
00062 !-------------------------------------------------------------------------------
00063 !     ######################################
00064       FUNCTION PSAT_0D(PT) RESULT(PPSAT)
00065 !     ######################################
00066 !-------------------------------------------------------------------------------
00067 !
00068 !*       0.    DECLARATIONS
00069 !              ------------
00070 !
00071 USE MODD_CSTS
00072 !
00073 IMPLICIT NONE
00074 !
00075 !*       0.1   Declarations of arguments and results
00076 !
00077 !
00078 REAL, INTENT(IN)                :: PT     ! Temperature (Kelvin)
00079 REAL                            :: PPSAT  ! saturation vapor 
00080                                           ! specific humidity
00081                                           ! with respect to
00082                                           ! water (kg/kg)
00083 REAL(KIND=JPRB) :: ZHOOK_HANDLE                                          
00084 !-------------------------------------------------------------------------------
00085 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:PSAT_0D',0,ZHOOK_HANDLE)
00086 !
00087 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00088 !              ---------------------------------
00089 !
00090 PPSAT = EXP( XALPW - XBETAW/PT - XGAMW*LOG(PT)  )
00091 !-------------------------------------------------------------------------------
00092 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:PSAT_0D',1,ZHOOK_HANDLE)
00093 !
00094 END FUNCTION PSAT_0D
00095 !-------------------------------------------------------------------------------
00096 !     ######################################
00097       FUNCTION PSAT_1D(PT) RESULT(PPSAT)
00098 !     ######################################
00099 !-------------------------------------------------------------------------------
00100 !
00101 !*       0.    DECLARATIONS
00102 !              ------------
00103 !
00104 USE MODD_CSTS
00105 !
00106 IMPLICIT NONE
00107 !
00108 !*       0.1   Declarations of arguments and results
00109 !
00110 !
00111 REAL, DIMENSION(:), INTENT(IN)                :: PT     ! Temperature (Kelvin)
00112 REAL, DIMENSION(SIZE(PT))                     :: PPSAT  ! saturation vapor pressure (Pa)
00113 !
00114 INTEGER                         :: JJ !loop index
00115 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00116 !-------------------------------------------------------------------------------
00117 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:PSAT_1D',0,ZHOOK_HANDLE)
00118 !
00119 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00120 !              ---------------------------------
00121 !
00122 !cdir nodep
00123 DO JJ=1,SIZE(PT)
00124   PPSAT(JJ) = EXP( XALPW - XBETAW/PT(JJ) - XGAMW*LOG(PT(JJ))  )
00125 ENDDO
00126 !-------------------------------------------------------------------------------
00127 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:PSAT_1D',1,ZHOOK_HANDLE)
00128 !
00129 END FUNCTION PSAT_1D
00130 !-------------------------------------------------------------------------------
00131 !     ######################################
00132       FUNCTION QSATW_0D(PT,PP) RESULT(PQSAT)
00133 !     ######################################
00134 !
00135 !!****  *QSATW * - function to compute saturation vapor humidity from
00136 !!                 temperature
00137 !!
00138 !!    PURPOSE
00139 !!    -------
00140 !       The purpose of this function is to compute the saturation vapor 
00141 !     pressure from temperature 
00142 !      
00143 !
00144 !!**  METHOD
00145 !!    ------
00146 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00147 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00148 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00149 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00150 !!     
00151 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00152 !!  
00153 !!     with :
00154 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00155 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00156 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00157 !!
00158 !!      Then, the specific humidity at saturation is deduced.
00159 !!  
00160 !!
00161 !!    EXTERNAL
00162 !!    --------
00163 !!      NONE
00164 !!
00165 !!    IMPLICIT ARGUMENTS
00166 !!    ------------------
00167 !!      Module MODD_CST : comtains physical constants
00168 !!        XALPW   : Constant for saturation vapor pressure function
00169 !!        XBETAW  : Constant for saturation vapor pressure function
00170 !!        XGAMW   : Constant for saturation vapor pressure function  
00171 !!      
00172 !!    REFERENCE
00173 !!    ---------
00174 !!      Book2 of documentation of Meso-NH 
00175 !!
00176 !!
00177 !!    AUTHOR
00178 !!    ------
00179 !!      V. Masson       * Meteo France *
00180 !!
00181 !!    MODIFICATIONS
00182 !!    -------------
00183 !!      Original    21/09/98 
00184 !-------------------------------------------------------------------------------
00185 !
00186 !*       0.    DECLARATIONS
00187 !              ------------
00188 !
00189 USE MODD_CSTS
00190 !
00191 IMPLICIT NONE
00192 !
00193 !*       0.1   Declarations of arguments and results
00194 !
00195 !
00196 REAL, INTENT(IN)                :: PT     ! Temperature (Kelvin)
00197 REAL, INTENT(IN)                :: PP     ! Pressure (Pa)
00198 REAL                            :: PQSAT  ! saturation vapor 
00199                                                         ! specific humidity
00200                                                         ! with respect to
00201                                                         ! water (kg/kg)
00202 !
00203 !*       0.2   Declarations of local variables
00204 !
00205 REAL                           :: ZFOES  ! saturation vapor 
00206                                                         ! pressure
00207                                                         ! (Pascal) 
00208 !
00209 REAL                           :: ZWORK1
00210 REAL                           :: ZWORK2
00211 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00212 !-------------------------------------------------------------------------------
00213 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_0D',0,ZHOOK_HANDLE)
00214 !
00215 ZWORK2 = XRD/XRV
00216 !
00217 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00218 !              ---------------------------------
00219 !
00220 ZFOES = EXP( XALPW - XBETAW/PT - XGAMW*LOG(PT)  )
00221 ZWORK1    = ZFOES/PP
00222 !
00223 !*       2.    COMPUTE SATURATION HUMIDITY
00224 !              ---------------------------
00225 !
00226 PQSAT = ZWORK2*ZWORK1 / (1.+(ZWORK2-1.)*ZWORK1)
00227 !
00228 !-------------------------------------------------------------------------------
00229 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_0D',1,ZHOOK_HANDLE)
00230 !
00231 END FUNCTION QSATW_0D
00232 !-------------------------------------------------------------------------------
00233 !
00234 !     ######################################
00235       FUNCTION QSATW_1D(PT,PP) RESULT(PQSAT)
00236 !     ######################################
00237 !
00238 !!****  *QSATW * - function to compute saturation vapor humidity from
00239 !!                 temperature
00240 !!
00241 !!    PURPOSE
00242 !!    -------
00243 !       The purpose of this function is to compute the saturation vapor 
00244 !     pressure from temperature 
00245 !      
00246 !
00247 !!**  METHOD
00248 !!    ------
00249 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00250 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00251 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00252 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00253 !!     
00254 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00255 !!  
00256 !!     with :
00257 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00258 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00259 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00260 !!
00261 !!      Then, the specific humidity at saturation is deduced.
00262 !!  
00263 !!
00264 !!    EXTERNAL
00265 !!    --------
00266 !!      NONE
00267 !!
00268 !!    IMPLICIT ARGUMENTS
00269 !!    ------------------
00270 !!      Module MODD_CST : comtains physical constants
00271 !!        XALPW   : Constant for saturation vapor pressure function
00272 !!        XBETAW  : Constant for saturation vapor pressure function
00273 !!        XGAMW   : Constant for saturation vapor pressure function  
00274 !!      
00275 !!    REFERENCE
00276 !!    ---------
00277 !!      Book2 of documentation of Meso-NH 
00278 !!
00279 !!
00280 !!    AUTHOR
00281 !!    ------
00282 !!      V. Masson       * Meteo France *
00283 !!
00284 !!    MODIFICATIONS
00285 !!    -------------
00286 !!      Original    21/09/98 
00287 !-------------------------------------------------------------------------------
00288 !
00289 !*       0.    DECLARATIONS
00290 !              ------------
00291 !
00292 USE MODD_CSTS
00293 !
00294 IMPLICIT NONE
00295 !
00296 !*       0.1   Declarations of arguments and results
00297 !
00298 !
00299 REAL, DIMENSION(:), INTENT(IN)                :: PT     ! Temperature
00300                                                         ! (Kelvin)
00301 REAL, DIMENSION(:), INTENT(IN)                :: PP     ! Pressure
00302                                                         ! (Pa)
00303 REAL, DIMENSION(SIZE(PT))                   :: PQSAT  ! saturation vapor 
00304                                                         ! specific humidity
00305                                                         ! with respect to
00306                                                         ! water (kg/kg)
00307 !
00308 !*       0.2   Declarations of local variables
00309 !
00310 REAL, DIMENSION(SIZE(PT))                   :: ZFOES  ! saturation vapor 
00311                                                         ! pressure
00312                                                         ! (Pascal) 
00313 !
00314 REAL, DIMENSION(SIZE(PT))                   :: ZWORK1
00315 REAL                                        :: ZWORK2 
00316 INTEGER                         :: JJ !loop index
00317 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00318 !-------------------------------------------------------------------------------
00319 !
00320 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_1D',0,ZHOOK_HANDLE)
00321 ZWORK2 = XRD/XRV
00322 !
00323 !cdir nodep
00324 DO JJ=1,SIZE(PT)
00325 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00326 !              ---------------------------------
00327 !
00328   ZFOES(JJ) = EXP( XALPW - XBETAW/PT(JJ) - XGAMW*LOG(PT(JJ))  )
00329   ZWORK1(JJ)    = ZFOES(JJ)/PP(JJ)
00330 !
00331 !*       2.    COMPUTE SATURATION HUMIDITY
00332 !              ---------------------------
00333 !
00334   PQSAT(JJ) = ZWORK2*ZWORK1(JJ) / (1.+(ZWORK2-1.)*ZWORK1(JJ))
00335 !
00336 ENDDO
00337 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_1D',1,ZHOOK_HANDLE)
00338 !
00339 !-------------------------------------------------------------------------------
00340 !
00341 END FUNCTION QSATW_1D
00342 !
00343 !-------------------------------------------------------------------------------
00344 !-------------------------------------------------------------------------------
00345 !
00346 !     ######################################
00347       FUNCTION QSATW_2D(PT,PP,KMASK,KL) RESULT(PQSAT)
00348 !     ######################################
00349 !
00350 !!****  *QSATW * - function to compute saturation vapor humidity from
00351 !!                 temperature
00352 !!
00353 !!    PURPOSE
00354 !!    -------
00355 !       The purpose of this function is to compute the saturation vapor 
00356 !     pressure from temperature 
00357 !      
00358 !
00359 !!**  METHOD
00360 !!    ------
00361 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00362 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00363 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00364 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00365 !!     
00366 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00367 !!  
00368 !!     with :
00369 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00370 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00371 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00372 !!
00373 !!      Then, the specific humidity at saturation is deduced.
00374 !!  
00375 !!
00376 !!    EXTERNAL
00377 !!    --------
00378 !!      NONE
00379 !!
00380 !!    IMPLICIT ARGUMENTS
00381 !!    ------------------
00382 !!      Module MODD_CST : comtains physical constants
00383 !!        XALPW   : Constant for saturation vapor pressure function
00384 !!        XBETAW  : Constant for saturation vapor pressure function
00385 !!        XGAMW   : Constant for saturation vapor pressure function  
00386 !!      
00387 !!    REFERENCE
00388 !!    ---------
00389 !!      Book2 of documentation of Meso-NH 
00390 !!
00391 !!
00392 !!    AUTHOR
00393 !!    ------
00394 !!      V. Masson       * Meteo France *
00395 !!
00396 !!    MODIFICATIONS
00397 !!    -------------
00398 !!      Original    21/09/98 
00399 !-------------------------------------------------------------------------------
00400 !
00401 !*       0.    DECLARATIONS
00402 !              ------------
00403 !
00404 USE MODD_SURF_PAR,  ONLY : XUNDEF
00405 USE MODD_CSTS
00406 !
00407 IMPLICIT NONE
00408 !
00409 !*       0.1   Declarations of arguments and results
00410 !
00411 !
00412 REAL, DIMENSION(:,:), INTENT(IN)              :: PT     ! Temperature
00413                                                         ! (Kelvin)
00414 REAL, DIMENSION(:,:), INTENT(IN)              :: PP     ! Pressure
00415                                                         ! (Pa)
00416 !                                                        
00417 INTEGER, DIMENSION(:), INTENT(IN), OPTIONAL   :: KMASK
00418 !                                                KMASK = Number of soil moisture layers (DIF option)
00419 INTEGER,               INTENT(IN), OPTIONAL   :: KL
00420 !                                                KL = Max number of soil moisture layers (DIF option)
00421 !
00422 REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2))        :: PQSAT  ! saturation vapor 
00423                                                         ! specific humidity
00424                                                         ! with respect to
00425                                                         ! water (kg/kg)
00426 !
00427 !*       0.2   Declarations of local variables
00428 !
00429 INTEGER, DIMENSION(SIZE(PT,1)) :: IMASK
00430 !
00431 REAL            :: ZFOES  ! saturation vapor pressure (Pascal) 
00432 INTEGER         :: JJ, JI, INL, IWORK   ! loop indexes
00433 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00434 !-------------------------------------------------------------------------------
00435 !
00436 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_2D',0,ZHOOK_HANDLE)
00437 !
00438 IF(PRESENT(KMASK).AND.PRESENT(KL))THEN
00439   IMASK(:)=KMASK(:)
00440   INL=KL
00441 ELSE
00442   IMASK(:)=SIZE(PT,2)  
00443   INL=SIZE(PT,2)
00444 ENDIF
00445 !
00446 PQSAT(:,:)=XUNDEF
00447 !
00448 DO JJ=1,INL
00449   DO JI=1,SIZE(PT,1)
00450 !
00451      IWORK=IMASK(JI)
00452      IF(JJ<=IWORK)THEN
00453 !
00454 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00455 !              ---------------------------------
00456 !
00457          ZFOES = EXP( XALPW - XBETAW/PT(JI,JJ) - XGAMW*LOG(PT(JI,JJ))  )
00458 !
00459 !*       2.    COMPUTE SATURATION HUMIDITY
00460 !              ---------------------------
00461 !
00462          PQSAT(JI,JJ) = XRD/XRV*ZFOES/PP(JI,JJ) / (1.+(XRD/XRV-1.)*ZFOES/PP(JI,JJ))  
00463 !
00464      ENDIF
00465 !
00466   ENDDO
00467 ENDDO
00468 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATW_2D',1,ZHOOK_HANDLE)
00469 !-------------------------------------------------------------------------------
00470 !
00471 END FUNCTION QSATW_2D
00472 !
00473 !-------------------------------------------------------------------------------
00474 !
00475 !-------------------------------------------------------------------------------
00476 !
00477 !     ######################################
00478       FUNCTION QSATSEAW_1D(PT,PP) RESULT(PQSAT)
00479 !     ######################################
00480 !
00481 !!****  *QSATW * - function to compute saturation vapor humidity from
00482 !!                 temperature
00483 !!
00484 !!    PURPOSE
00485 !!    -------
00486 !       The purpose of this function is to compute the saturation vapor 
00487 !     pressure from temperature over saline seawater
00488 !      
00489 !
00490 !!**  METHOD
00491 !!    ------
00492 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00493 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00494 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00495 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00496 !!    The reduction due to salinity is compute with the factor 0.98 (reduction of 2%)
00497 !!     
00498 !!         es(T)= 0.98*EXP( alphaw - betaw /T - gammaw Log(T) )
00499 !!  
00500 !!     with :
00501 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00502 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00503 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00504 !!
00505 !!      Then, the specific humidity at saturation is deduced.
00506 !!  
00507 !!
00508 !!    EXTERNAL
00509 !!    --------
00510 !!      NONE
00511 !!
00512 !!    IMPLICIT ARGUMENTS
00513 !!    ------------------
00514 !!      Module MODD_CST : comtains physical constants
00515 !!        XALPW   : Constant for saturation vapor pressure function
00516 !!        XBETAW  : Constant for saturation vapor pressure function
00517 !!        XGAMW   : Constant for saturation vapor pressure function  
00518 !!      
00519 !!    REFERENCE
00520 !!    ---------
00521 !!      Book2 of documentation of Meso-NH 
00522 !!      Zeng, X., Zhao, M., and Dickinson, R. E., 1998 : Intercomparaison of bulk
00523 !!      aerodynamic algorithm for the computation of sea surface fluxes using
00524 !!      TOGA COARE and TAO data. Journal of Climate, vol 11, n°10, pp 2628--2644
00525 !!
00526 !!
00527 !!    AUTHOR
00528 !!    ------
00529 !!      C. Lebeaupin    * Meteo France *
00530 !!
00531 !!    MODIFICATIONS
00532 !!    -------------
00533 !!      Original    6/04/2005 
00534 !-------------------------------------------------------------------------------
00535 !
00536 !*       0.    DECLARATIONS
00537 !              ------------
00538 !
00539 USE MODD_CSTS
00540 !
00541 IMPLICIT NONE
00542 !
00543 !*       0.1   Declarations of arguments and results
00544 !
00545 !
00546 REAL, DIMENSION(:), INTENT(IN)                :: PT     ! Temperature
00547                                                         ! (Kelvin)
00548 REAL, DIMENSION(:), INTENT(IN)                :: PP     ! Pressure
00549                                                         ! (Pa)
00550 REAL, DIMENSION(SIZE(PT))                   :: PQSAT  ! saturation vapor 
00551                                                         ! specific humidity
00552                                                         ! with respect to
00553                                                         ! water (kg/kg)
00554 !
00555 !*       0.2   Declarations of local variables
00556 !
00557 REAL, DIMENSION(SIZE(PT))                   :: ZFOES  ! saturation vapor 
00558                                                         ! pressure
00559                                                         ! (Pascal) 
00560 !
00561 INTEGER                         :: JJ   ! loop index
00562 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00563 !-------------------------------------------------------------------------------
00564 !
00565 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATSEAW_1D',0,ZHOOK_HANDLE)
00566 DO JJ = 1, SIZE(PT)
00567 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00568 !              ---------------------------------
00569 !
00570   ZFOES(JJ) = 0.98*EXP( XALPW - XBETAW/PT(JJ) - XGAMW*LOG(PT(JJ))  )
00571 ! vapor pressure reduction of 2% over saline seawater could have a significant 
00572 ! impact on the computation of surface latent heat flux under strong wind 
00573 ! conditions (Zeng et al, 1998). 
00574 !
00575 !*       2.    COMPUTE SATURATION HUMIDITY
00576 !              ---------------------------
00577 !
00578   PQSAT(JJ) = XRD/XRV*ZFOES(JJ)/PP(JJ)   &
00579                      / (1.+(XRD/XRV-1.)*ZFOES(JJ)/PP(JJ))  
00580 !
00581 ENDDO
00582 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATSEAW_1D',1,ZHOOK_HANDLE)
00583 !-------------------------------------------------------------------------------
00584 !
00585 END FUNCTION QSATSEAW_1D
00586 !
00587 !-------------------------------------------------------------------------------
00588 !-------------------------------------------------------------------------------
00589 !     ##############################################################
00590       FUNCTION DQSATW_O_DT_1D(PT,PP,PQSAT) RESULT(PDQSAT)
00591 !     ##############################################################
00592 !
00593 !!****  *QSATW * - function to compute saturation vapor humidity from
00594 !!                 temperature
00595 !!
00596 !!    PURPOSE
00597 !!    -------
00598 !       The purpose of this function is to compute the saturation vapor 
00599 !     pressure from temperature 
00600 !      
00601 !
00602 !!**  METHOD
00603 !!    ------
00604 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00605 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00606 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00607 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00608 !!     
00609 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00610 !!  
00611 !!     with :
00612 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00613 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00614 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00615 !!
00616 !!      Then, the specific humidity at saturation is deduced.
00617 !!
00618 !!      Finally, dqsat / dT  (T) is computed.
00619 !!  
00620 !!
00621 !!    EXTERNAL
00622 !!    --------
00623 !!      NONE
00624 !!
00625 !!    IMPLICIT ARGUMENTS
00626 !!    ------------------
00627 !!      Module MODD_CST : comtains physical constants
00628 !!        XALPW   : Constant for saturation vapor pressure function
00629 !!        XBETAW  : Constant for saturation vapor pressure function
00630 !!        XGAMW   : Constant for saturation vapor pressure function  
00631 !!      
00632 !!    REFERENCE
00633 !!    ---------
00634 !!      Book2 of documentation of Meso-NH 
00635 !!
00636 !!
00637 !!    AUTHOR
00638 !!    ------
00639 !!      V. Masson       * Meteo France *
00640 !!
00641 !!    MODIFICATIONS
00642 !!    -------------
00643 !!      Original    21/09/98 
00644 !-------------------------------------------------------------------------------
00645 !
00646 !*       0.    DECLARATIONS
00647 !              ------------
00648 !
00649 USE MODD_CSTS       
00650 !
00651 IMPLICIT NONE
00652 !
00653 !*       0.1   Declarations of arguments and results
00654 !
00655 !
00656 REAL, DIMENSION(:),  INTENT(IN)             :: PT     ! Temperature
00657                                                           ! (Kelvin)
00658 REAL, DIMENSION(:),  INTENT(IN)             :: PP     ! Pressure
00659                                                           ! (Pa)
00660 REAL, DIMENSION(:),  INTENT(IN)             :: PQSAT  ! saturation vapor 
00661                                                           ! specific humidity
00662                                                           ! with respect to
00663                                                           ! water (kg/kg))
00664 REAL, DIMENSION(SIZE(PT))                   :: PDQSAT ! derivative according
00665                                                           ! to temperature of
00666                                                           ! saturation vapor 
00667                                                           ! specific humidity
00668                                                           ! with respect to
00669                                                           ! water (kg/kg))
00670 !
00671 !*       0.2   Declarations of local variables
00672 !
00673 REAL, DIMENSION(SIZE(PT))  :: ZFOES  ! saturation vapor 
00674                                                           ! pressure
00675                                                           ! (Pascal) 
00676 !
00677 REAL                       :: ZWORK1
00678 REAL, DIMENSION(SIZE(PT))  :: ZWORK2   ! loop index
00679 INTEGER :: JJ
00680 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00681 !-------------------------------------------------------------------------------
00682 !
00683 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:DQSATW_O_DT_1D',0,ZHOOK_HANDLE)
00684 ZWORK1=XRD/XRV
00685 !
00686 DO JJ=1,SIZE(PT)
00687 !
00688 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00689 !              ---------------------------------
00690 !
00691   ZFOES(JJ) = PP(JJ) / (1.+ZWORK1*(1./PQSAT(JJ)-1.))
00692   ZWORK2(JJ) = ZFOES(JJ) / PP(JJ)
00693 !
00694 !*       2.    DERIVATION ACCORDING TO TEMPERATURE
00695 !              -----------------------------------
00696 !
00697   PDQSAT(JJ) = PQSAT(JJ) / (1.+(ZWORK1-1.)*ZWORK2(JJ) ) &
00698                      * (XBETAW/PT(JJ)**2 - XGAMW/PT(JJ))  
00699 !
00700 ENDDO
00701 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:DQSATW_O_DT_1D',1,ZHOOK_HANDLE)
00702 !
00703 !-------------------------------------------------------------------------------
00704 !
00705 END FUNCTION DQSATW_O_DT_1D
00706 !
00707 !-------------------------------------------------------------------------------
00708 !-------------------------------------------------------------------------------
00709 !     ##############################################################
00710       FUNCTION DQSATI_O_DT_1D(PT,PP,PQSAT) RESULT(PDQSAT)
00711 !     ##############################################################
00712 !
00713 !!****  *QSATW * - function to compute saturation vapor humidity from
00714 !!                 temperature (with respect to ice)
00715 !!
00716 !!    PURPOSE
00717 !!    -------
00718 !       The purpose of this function is to compute the saturation vapor 
00719 !     pressure from temperature 
00720 !      
00721 !
00722 !!**  METHOD
00723 !!    ------
00724 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00725 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00726 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00727 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00728 !!     
00729 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00730 !!  
00731 !!     with :
00732 !!       alphaw (XALPW) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00733 !!       betaw (XBETAW) = Lv(Tt)/Rv + gammaw Tt
00734 !!       gammaw (XGAMW) = (Cl -Cpv) /Rv
00735 !!
00736 !!      Then, the specific humidity at saturation is deduced.
00737 !!
00738 !!      Finally, dqsat / dT  (T) is computed.
00739 !!  
00740 !!
00741 !!    EXTERNAL
00742 !!    --------
00743 !!      NONE
00744 !!
00745 !!    IMPLICIT ARGUMENTS
00746 !!    ------------------
00747 !!      Module MODD_CST : comtains physical constants
00748 !!        XALPW   : Constant for saturation vapor pressure function
00749 !!        XBETAW  : Constant for saturation vapor pressure function
00750 !!        XGAMW   : Constant for saturation vapor pressure function  
00751 !!      
00752 !!    REFERENCE
00753 !!    ---------
00754 !!      Book2 of documentation of Meso-NH 
00755 !!
00756 !!
00757 !!    AUTHOR
00758 !!    ------
00759 !!      V. Masson       * Meteo France *
00760 !!
00761 !!    MODIFICATIONS
00762 !!    -------------
00763 !!      Original    21/09/98 
00764 !-------------------------------------------------------------------------------
00765 !
00766 !*       0.    DECLARATIONS
00767 !              ------------
00768 !
00769 USE MODD_CSTS       
00770 !
00771 IMPLICIT NONE
00772 !
00773 !*       0.1   Declarations of arguments and results
00774 !
00775 !
00776 REAL,    DIMENSION(:), INTENT(IN)               :: PT     ! Temperature
00777                                                           ! (Kelvin)
00778 REAL,    DIMENSION(:), INTENT(IN)               :: PP     ! Pressure
00779                                                           ! (Pa)
00780 REAL,    DIMENSION(:), INTENT(IN)               :: PQSAT  ! saturation vapor 
00781                                                           ! specific humidity
00782                                                           ! with respect to
00783                                                           ! water (kg/kg))
00784 REAL,    DIMENSION(SIZE(PT))                    :: PDQSAT ! derivative according
00785                                                           ! to temperature of
00786                                                           ! saturation vapor 
00787                                                           ! specific humidity
00788                                                           ! with respect to
00789                                                           ! water (kg/kg))
00790 !
00791 !*       0.2   Declarations of local variables
00792 !
00793 REAL, DIMENSION(SIZE(PT))                       :: ZFOES  ! saturation vapor 
00794                                                           ! pressure
00795                                                           ! (Pascal) 
00796 !
00797 REAL   :: ZWORK1
00798 INTEGER                 ::   JJ  ! loop index
00799 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00800 !-------------------------------------------------------------------------------
00801 !
00802 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:DQSATI_O_DT_1D',0,ZHOOK_HANDLE)
00803 ZWORK1=XRD/XRV
00804 DO JJ = 1,SIZE(PT)
00805 !
00806 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00807 !              ---------------------------------
00808 !
00809   ZFOES(JJ) = PP(JJ) / (1.+ZWORK1*(1./PQSAT(JJ)-1.))
00810 !
00811 !*       3.    DERIVATION ACCORDING TO TEMPERATURE
00812 !              -----------------------------------
00813 !
00814   PDQSAT(JJ) = PQSAT(JJ) / (1.+(ZWORK1-1.)*ZFOES(JJ)/PP(JJ) ) &
00815                      * (XBETAI/PT(JJ)**2 - XGAMI/PT(JJ))  
00816 !
00817 ENDDO
00818 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:DQSATI_O_DT_1D',1,ZHOOK_HANDLE)
00819 !-------------------------------------------------------------------------------
00820 !
00821 END FUNCTION DQSATI_O_DT_1D
00822 !
00823 !-------------------------------------------------------------------------------
00824 !-------------------------------------------------------------------------------
00825 !
00826 !     ######################################
00827       FUNCTION QSATI_1D(PT,PP) RESULT(PQSAT)
00828 !     ######################################
00829 !
00830 !!****  *QSATI * - function to compute saturation vapor humidity from
00831 !!                 temperature
00832 !!
00833 !!    PURPOSE
00834 !!    -------
00835 !       The purpose of this function is to compute the saturation vapor 
00836 !     pressure from temperature 
00837 !      
00838 !
00839 !!**  METHOD
00840 !!    ------
00841 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00842 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00843 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00844 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00845 !!     
00846 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00847 !!  
00848 !!     with :
00849 !!       alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00850 !!       betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
00851 !!       gammaw (XGAMI) = (Cl -Cpv) /Rv
00852 !!
00853 !!      Then, the specific humidity at saturation is deduced.
00854 !!  
00855 !!
00856 !!    EXTERNAL
00857 !!    --------
00858 !!      NONE
00859 !!
00860 !!    IMPLICIT ARGUMENTS
00861 !!    ------------------
00862 !!      Module MODD_CST : comtains physical constants
00863 !!        XALPI   : Constant for saturation vapor pressure function
00864 !!        XBETAI  : Constant for saturation vapor pressure function
00865 !!        XGAMI   : Constant for saturation vapor pressure function  
00866 !!      
00867 !!    REFERENCE
00868 !!    ---------
00869 !!      Book2 of documentation of Meso-NH 
00870 !!
00871 !!
00872 !!    AUTHOR
00873 !!    ------
00874 !!      V. Masson       * Meteo France *
00875 !!
00876 !!    MODIFICATIONS
00877 !!    -------------
00878 !!      Original    21/09/98 
00879 !-------------------------------------------------------------------------------
00880 !
00881 !*       0.    DECLARATIONS
00882 !              ------------
00883 !
00884 USE MODD_CSTS       
00885 !
00886 IMPLICIT NONE
00887 !
00888 !*       0.1   Declarations of arguments and results
00889 !
00890 !
00891 REAL, DIMENSION(:), INTENT(IN)                :: PT     ! Temperature
00892                                                         ! (Kelvin)
00893 REAL, DIMENSION(:), INTENT(IN)                :: PP     ! Pressure
00894                                                         ! (Pa)
00895 REAL, DIMENSION(SIZE(PT))                   :: PQSAT  ! saturation vapor 
00896                                                         ! specific humidity
00897                                                         ! with respect to
00898                                                         ! water (kg/kg)
00899 !
00900 !*       0.2   Declarations of local variables
00901 !
00902 REAL, DIMENSION(SIZE(PT))                   :: ZFOES  ! saturation vapor 
00903                                                         ! pressure
00904                                                         ! (Pascal) 
00905 !
00906 INTEGER   :: JJ !loop index
00907 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00908 !-------------------------------------------------------------------------------
00909 !
00910 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_1D',0,ZHOOK_HANDLE)
00911 DO JJ = 1, SIZE(PT)
00912 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
00913 !              ---------------------------------
00914 !
00915   ZFOES(JJ) = EXP( XALPI - XBETAI/PT(JJ) - XGAMI*LOG(PT(JJ))  )
00916 !
00917 !*       2.    COMPUTE SATURATION HUMIDITY
00918 !              ---------------------------
00919 !
00920   PQSAT(JJ) = XRD/XRV*ZFOES(JJ)/PP(JJ)   &
00921                      / (1.+(XRD/XRV-1.)*ZFOES(JJ)/PP(JJ))  
00922 !
00923 ENDDO
00924 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_1D',1,ZHOOK_HANDLE)
00925 !-------------------------------------------------------------------------------
00926 !
00927 END FUNCTION QSATI_1D
00928 !-------------------------------------------------------------------------------
00929 !-------------------------------------------------------------------------------
00930 !
00931 !     ######################################
00932       FUNCTION QSATI_2D(PT,PP,KMASK,KL) RESULT(PQSAT)
00933 !     ######################################
00934 !
00935 !!****  *QSATI * - function to compute saturation vapor humidity from
00936 !!                 temperature
00937 !!
00938 !!    PURPOSE
00939 !!    -------
00940 !       The purpose of this function is to compute the saturation vapor 
00941 !     pressure from temperature 
00942 !      
00943 !
00944 !!**  METHOD
00945 !!    ------
00946 !!       Given temperature T (PT), the saturation vapor pressure es(T)
00947 !!    (FOES(PT)) is computed by integration of the Clapeyron equation
00948 !!    from the triple point temperature Tt (XTT) and the saturation vapor 
00949 !!    pressure of the triple point es(Tt) (XESTT), i.e  
00950 !!     
00951 !!         es(T)= EXP( alphaw - betaw /T - gammaw Log(T) )
00952 !!  
00953 !!     with :
00954 !!       alphaw (XALPI) = LOG(es(Tt))+ betaw/Tt + gammaw Log(Tt) 
00955 !!       betaw (XBETAI) = Lv(Tt)/Rv + gammaw Tt
00956 !!       gammaw (XGAMI) = (Cl -Cpv) /Rv
00957 !!
00958 !!      Then, the specific humidity at saturation is deduced.
00959 !!  
00960 !!
00961 !!    EXTERNAL
00962 !!    --------
00963 !!      NONE
00964 !!
00965 !!    IMPLICIT ARGUMENTS
00966 !!    ------------------
00967 !!      Module MODD_CST : comtains physical constants
00968 !!        XALPI   : Constant for saturation vapor pressure function
00969 !!        XBETAI  : Constant for saturation vapor pressure function
00970 !!        XGAMI   : Constant for saturation vapor pressure function  
00971 !!      
00972 !!    REFERENCE
00973 !!    ---------
00974 !!      Book2 of documentation of Meso-NH 
00975 !!
00976 !!
00977 !!    AUTHOR
00978 !!    ------
00979 !!      V. Masson       * Meteo France *
00980 !!
00981 !!    MODIFICATIONS
00982 !!    -------------
00983 !!      Original    21/09/98 
00984 !-------------------------------------------------------------------------------
00985 !
00986 !*       0.    DECLARATIONS
00987 !              ------------
00988 !
00989 USE MODD_SURF_PAR,  ONLY : XUNDEF
00990 USE MODD_CSTS       
00991 !
00992 IMPLICIT NONE
00993 !
00994 !*       0.1   Declarations of arguments and results
00995 !
00996 !
00997 REAL, DIMENSION(:,:), INTENT(IN)            :: PT     ! Temperature
00998                                                       ! (Kelvin)
00999 REAL, DIMENSION(:,:), INTENT(IN)            :: PP     ! Pressure
01000                                                       ! (Pa)
01001 !                                                        
01002 INTEGER, DIMENSION(:), INTENT(IN), OPTIONAL   :: KMASK
01003 !                                                KMASK = Number of soil moisture layers (DIF option)
01004 INTEGER,               INTENT(IN), OPTIONAL   :: KL
01005 !                                                KL = Max number of soil moisture layers (DIF option)
01006 !                                                      
01007 REAL, DIMENSION(SIZE(PT,1),SIZE(PT,2))      :: PQSAT  ! saturation vapor 
01008                                                       ! specific humidity
01009                                                       ! with respect to
01010                                                       ! water (kg/kg)
01011 !
01012 !*       0.2   Declarations of local variables
01013 !
01014 REAL            :: ZFOES  ! saturation vapor pressure (Pascal) 
01015 !
01016 INTEGER, DIMENSION(SIZE(PT,1)) :: IMASK
01017 !
01018 INTEGER         :: JJ, JI, INL, IWORK   ! loop indexes
01019 REAL(KIND=JPRB) :: ZHOOK_HANDLE
01020 !-------------------------------------------------------------------------------
01021 !
01022 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_2D',0,ZHOOK_HANDLE)
01023 !
01024 IF(PRESENT(KMASK))THEN
01025   IMASK(:)=KMASK(:)    
01026   INL=KL
01027 ELSE
01028   IMASK(:)=SIZE(PT,2)  
01029   INL=SIZE(PT,2)
01030 ENDIF
01031 !
01032 PQSAT(:,:)=XUNDEF
01033 !
01034 DO JJ=1,INL
01035   DO JI=1,SIZE(PT,1)
01036 !
01037      IWORK=IMASK(JI)
01038      IF(JJ<=IWORK)THEN
01039 !  
01040 !*       1.    COMPUTE SATURATION VAPOR PRESSURE
01041 !              ---------------------------------
01042 !
01043          ZFOES = EXP( XALPI - XBETAI/PT(JI,JJ) - XGAMI*LOG(PT(JI,JJ))  )
01044 !
01045 !*       2.    COMPUTE SATURATION HUMIDITY
01046 !              ---------------------------
01047 !
01048          PQSAT(JI,JJ) = XRD/XRV*ZFOES/PP(JI,JJ) / (1.+(XRD/XRV-1.)*ZFOES/PP(JI,JJ))  
01049 !
01050      ENDIF
01051 !
01052   ENDDO
01053 ENDDO
01054 IF (LHOOK) CALL DR_HOOK('MODE_THERMOS:QSATI_2D',1,ZHOOK_HANDLE)
01055 !-------------------------------------------------------------------------------
01056 !
01057 END FUNCTION QSATI_2D
01058 !-------------------------------------------------------------------------------
01059 !-------------------------------------------------------------------------------
01060 END MODULE MODE_THERMOS