1 | ! (C) Copyright 1996- ECMWF. |
---|
2 | ! |
---|
3 | ! This software is licensed under the terms of the Apache Licence Version 2.0 |
---|
4 | ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
---|
5 | ! |
---|
6 | ! In applying this licence, ECMWF does not waive the privileges and immunities |
---|
7 | ! granted to it by virtue of its status as an intergovernmental organisation |
---|
8 | ! nor does it submit to any jurisdiction. |
---|
9 | |
---|
10 | SUBROUTINE SATUR ( KIDIA , KFDIA , KLON , KTDIA , KLEV, LDPHYLIN, & |
---|
11 | & PAPRSF, PT , PQSAT , KFLAG) |
---|
12 | |
---|
13 | !*** |
---|
14 | |
---|
15 | ! ** *SATUR* - COMPUTES SPECIFIC HUMIDITY AT SATURATION |
---|
16 | |
---|
17 | ! J.F. MAHFOUF E.C.M.W.F. 15/05/96 |
---|
18 | |
---|
19 | ! Modified J. HAGUE 13/01/03 MASS Vector Functions |
---|
20 | |
---|
21 | ! PURPOSE. |
---|
22 | ! -------- |
---|
23 | |
---|
24 | ! SPECIFIC HUMIDITY AT SATURATION IS USED BY THE |
---|
25 | ! DIAGNOSTIC CLOUD SCHEME TO COMPUTE RELATIVE HUMIDITY |
---|
26 | ! AND LIQUID WATER CONTENT |
---|
27 | |
---|
28 | ! INTERFACE |
---|
29 | ! --------- |
---|
30 | |
---|
31 | ! THIS ROUTINE IS CALLED FROM *CALLPAR*. |
---|
32 | |
---|
33 | ! PARAMETER DESCRIPTION UNITS |
---|
34 | ! --------- ----------- ----- |
---|
35 | ! INPUT PARAMETERS (INTEGER): |
---|
36 | |
---|
37 | ! *KIDIA* START POINT |
---|
38 | ! *KFDIA* END POINT |
---|
39 | ! *KLON* NUMBER OF GRID POINTS PER PACKET |
---|
40 | ! *KTDIA* START OF THE VERTICAL LOOP |
---|
41 | ! *KLEV* NUMBER OF LEVELS |
---|
42 | |
---|
43 | ! INPUT PARAMETERS (REAL): |
---|
44 | |
---|
45 | ! *PAPRSF* PRESSURE ON FULL LEVELS PA |
---|
46 | ! *PT* TEMPERATURE AT T-DT K |
---|
47 | |
---|
48 | ! INPUT PARAMETERS (INTEGER): |
---|
49 | |
---|
50 | ! *KFLAG* FLAG TO DETECT CALL FROM |
---|
51 | |
---|
52 | ! CONVECTION KFLAG=1 |
---|
53 | ! OTHER KFLAG=2 |
---|
54 | |
---|
55 | ! OUTPUT PARAMETER (REAL): |
---|
56 | |
---|
57 | ! *PQSAT* SATURATION SPECIFIC HUMIDITY KG/KG |
---|
58 | |
---|
59 | !------------------------------------------------------------------------- |
---|
60 | |
---|
61 | USE PARKIND1 ,ONLY : JPIM ,JPRB |
---|
62 | USE YOMHOOK ,ONLY : LHOOK, DR_HOOK, JPHOOK |
---|
63 | |
---|
64 | USE YOMCST , ONLY : RETV ,RLVTT ,RLSTT ,RTT |
---|
65 | USE YOETHF , ONLY : R2ES ,R3LES ,R3IES ,R4LES ,& |
---|
66 | & R4IES ,R5LES ,R5IES ,R5ALVCP ,R5ALSCP ,& |
---|
67 | & RALVDCP ,RALSDCP ,RTWAT ,RTICE ,RTICECU ,& |
---|
68 | & RTWAT_RTICE_R ,RTWAT_RTICECU_R |
---|
69 | |
---|
70 | IMPLICIT NONE |
---|
71 | |
---|
72 | INTEGER(KIND=JPIM),INTENT(IN) :: KLON |
---|
73 | INTEGER(KIND=JPIM),INTENT(IN) :: KLEV |
---|
74 | INTEGER(KIND=JPIM),INTENT(IN) :: KIDIA |
---|
75 | INTEGER(KIND=JPIM),INTENT(IN) :: KFDIA |
---|
76 | INTEGER(KIND=JPIM),INTENT(IN) :: KTDIA |
---|
77 | LOGICAL ,INTENT(IN) :: LDPHYLIN |
---|
78 | REAL(KIND=JPRB) ,INTENT(IN) :: PAPRSF(KLON,KLEV) |
---|
79 | REAL(KIND=JPRB) ,INTENT(IN) :: PT(KLON,KLEV) |
---|
80 | REAL(KIND=JPRB) ,INTENT(OUT) :: PQSAT(KLON,KLEV) |
---|
81 | INTEGER(KIND=JPIM),INTENT(IN) :: KFLAG |
---|
82 | INTEGER(KIND=JPIM) :: JK, JL |
---|
83 | |
---|
84 | REAL(KIND=JPRB) :: ZCOR, ZEW, ZFOEEW, ZQMAX, ZQS, ZTARG |
---|
85 | REAL(KIND=JPRB) :: ZALFA, ZFOEEWL, ZFOEEWI |
---|
86 | REAL(KIND=JPHOOK) :: ZHOOK_HANDLE |
---|
87 | |
---|
88 | !DIR$ VFUNCTION EXPHF |
---|
89 | |
---|
90 | #include "fcttre.func.h" |
---|
91 | |
---|
92 | !---------------------------------------------------------------------- |
---|
93 | |
---|
94 | !* 1. DEFINE CONSTANTS |
---|
95 | ! ---------------- |
---|
96 | |
---|
97 | IF (LHOOK) CALL DR_HOOK('SATUR',0,ZHOOK_HANDLE) |
---|
98 | ZQMAX=0.5_JPRB |
---|
99 | |
---|
100 | ! * |
---|
101 | !---------------------------------------------------------------------- |
---|
102 | |
---|
103 | ! * 2. CALCULATE SATURATION SPECIFIC HUMIDITY |
---|
104 | ! -------------------------------------- |
---|
105 | |
---|
106 | IF (LDPHYLIN) THEN |
---|
107 | DO JK=KTDIA,KLEV |
---|
108 | DO JL=KIDIA, KFDIA |
---|
109 | ZTARG = PT(JL,JK) |
---|
110 | ZALFA = FOEALFA(ZTARG) |
---|
111 | |
---|
112 | ZFOEEWL = R2ES*EXP(R3LES*(ZTARG-RTT)/(ZTARG-R4LES)) |
---|
113 | ZFOEEWI = R2ES*EXP(R3IES*(ZTARG-RTT)/(ZTARG-R4IES)) |
---|
114 | ZFOEEW = ZALFA*ZFOEEWL+(1.0_JPRB-ZALFA)*ZFOEEWI |
---|
115 | |
---|
116 | ZQS = ZFOEEW/PAPRSF(JL,JK) |
---|
117 | IF (ZQS > ZQMAX) THEN |
---|
118 | ZQS=ZQMAX |
---|
119 | ENDIF |
---|
120 | ZCOR = 1.0_JPRB/(1.0_JPRB-RETV*ZQS) |
---|
121 | PQSAT(JL,JK)=ZQS*ZCOR |
---|
122 | ENDDO |
---|
123 | ENDDO |
---|
124 | ELSE |
---|
125 | |
---|
126 | DO JK=KTDIA,KLEV |
---|
127 | DO JL=KIDIA, KFDIA |
---|
128 | IF(KFLAG == 1) THEN |
---|
129 | ZEW = FOEEWMCU(PT(JL,JK)) |
---|
130 | ELSE |
---|
131 | ZEW = FOEEWM(PT(JL,JK)) |
---|
132 | ENDIF |
---|
133 | ZQS = ZEW/PAPRSF(JL,JK) |
---|
134 | ZQS = MIN(ZQMAX,ZQS) |
---|
135 | ZCOR = 1.0_JPRB/(1.0_JPRB-RETV*ZQS) |
---|
136 | PQSAT(JL,JK)=ZQS*ZCOR |
---|
137 | ENDDO |
---|
138 | ENDDO |
---|
139 | |
---|
140 | ENDIF |
---|
141 | |
---|
142 | IF (LHOOK) CALL DR_HOOK('SATUR',1,ZHOOK_HANDLE) |
---|
143 | END SUBROUTINE SATUR |
---|