1 | ! (C) Copyright 1988- 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 | !* |
---|
11 | ! ------------------------------------------------------------------ |
---|
12 | |
---|
13 | ! This COMDECK includes the Thermodynamical functions for the cy39 |
---|
14 | ! ECMWF Physics package. |
---|
15 | ! Consistent with YOMCST Basic physics constants, assuming the |
---|
16 | ! partial pressure of water vapour is given by a first order |
---|
17 | ! Taylor expansion of Qs(T) w.r.t. to Temperature, using constants |
---|
18 | ! in YOETHF |
---|
19 | ! Two sets of functions are available. In the first set only the |
---|
20 | ! cases water or ice are distinguished by temperature. This set |
---|
21 | ! consists of the functions FOEDELTA,FOEEW,FOEDE and FOELH. |
---|
22 | ! The second set considers, besides the two cases water and ice |
---|
23 | ! also a mix of both for the temperature range RTICE < T < RTWAT. |
---|
24 | ! This set contains FOEALFA,FOEEWM,FOEDEM,FOELDCPM and FOELHM. |
---|
25 | ! FKOOP modifies the ice saturation mixing ratio for homogeneous |
---|
26 | ! nucleation. FOE_DEWM_DT provides an approximate first derivative |
---|
27 | ! of FOEEWM. |
---|
28 | |
---|
29 | ! Depending on the consideration of mixed phases either the first |
---|
30 | ! set (e.g. surface, post-processing) or the second set |
---|
31 | ! (e.g. clouds, condensation, convection) should be used. |
---|
32 | |
---|
33 | ! ------------------------------------------------------------------ |
---|
34 | ! ***************************************************************** |
---|
35 | |
---|
36 | ! NO CONSIDERATION OF MIXED PHASES |
---|
37 | |
---|
38 | ! ***************************************************************** |
---|
39 | REAL(KIND=JPRB) :: FOEDELTA |
---|
40 | REAL(KIND=JPRB) :: PTARE |
---|
41 | FOEDELTA (PTARE) = MAX (0.0_JPRB,SIGN(1.0_JPRB,PTARE-RTT)) |
---|
42 | |
---|
43 | ! FOEDELTA = 1 water |
---|
44 | ! FOEDELTA = 0 ice |
---|
45 | |
---|
46 | ! THERMODYNAMICAL FUNCTIONS . |
---|
47 | |
---|
48 | ! Pressure of water vapour at saturation |
---|
49 | ! INPUT : PTARE = TEMPERATURE |
---|
50 | REAL(KIND=JPRB) :: FOEEW,FOEDE,FOEDESU,FOELH,FOELDCP |
---|
51 | FOEEW ( PTARE ) = R2ES*EXP (& |
---|
52 | &(R3LES*FOEDELTA(PTARE)+R3IES*(1.0_JPRB-FOEDELTA(PTARE)))*(PTARE-RTT)& |
---|
53 | &/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(1.0_JPRB-FOEDELTA(PTARE))))) |
---|
54 | |
---|
55 | FOEDE ( PTARE ) = & |
---|
56 | &(FOEDELTA(PTARE)*R5ALVCP+(1.0_JPRB-FOEDELTA(PTARE))*R5ALSCP)& |
---|
57 | &/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(1.0_JPRB-FOEDELTA(PTARE))))**2 |
---|
58 | |
---|
59 | FOEDESU ( PTARE ) = & |
---|
60 | &(FOEDELTA(PTARE)*R5LES+(1.0_JPRB-FOEDELTA(PTARE))*R5IES)& |
---|
61 | &/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(1.0_JPRB-FOEDELTA(PTARE))))**2 |
---|
62 | |
---|
63 | FOELH ( PTARE ) =& |
---|
64 | &FOEDELTA(PTARE)*RLVTT + (1.0_JPRB-FOEDELTA(PTARE))*RLSTT |
---|
65 | |
---|
66 | FOELDCP ( PTARE ) = & |
---|
67 | &FOEDELTA(PTARE)*RALVDCP + (1.0_JPRB-FOEDELTA(PTARE))*RALSDCP |
---|
68 | |
---|
69 | ! ***************************************************************** |
---|
70 | |
---|
71 | ! CONSIDERATION OF MIXED PHASES |
---|
72 | |
---|
73 | ! ***************************************************************** |
---|
74 | |
---|
75 | ! FOEALFA is calculated to distinguish the three cases: |
---|
76 | |
---|
77 | ! FOEALFA=1 water phase |
---|
78 | ! FOEALFA=0 ice phase |
---|
79 | ! 0 < FOEALFA < 1 mixed phase |
---|
80 | |
---|
81 | ! INPUT : PTARE = TEMPERATURE |
---|
82 | REAL(KIND=JPRB) :: FOEALFA |
---|
83 | FOEALFA (PTARE) = MIN(1.0_JPRB,((MAX(RTICE,MIN(RTWAT,PTARE))-RTICE)& |
---|
84 | &*RTWAT_RTICE_R)**2) |
---|
85 | |
---|
86 | |
---|
87 | ! Pressure of water vapour at saturation |
---|
88 | ! INPUT : PTARE = TEMPERATURE |
---|
89 | REAL(KIND=JPRB) :: FOEEWM,FOEDEM,FOELDCPM,FOELHM,FOE_DEWM_DT |
---|
90 | FOEEWM ( PTARE ) = R2ES *& |
---|
91 | &(FOEALFA(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+& |
---|
92 | &(1.0_JPRB-FOEALFA(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES))) |
---|
93 | |
---|
94 | FOE_DEWM_DT( PTARE ) = R2ES * ( & |
---|
95 | & R3LES*FOEALFA(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES)) & |
---|
96 | & *(RTT-R4LES)/(PTARE-R4LES)**2 + & |
---|
97 | & R3IES*(1.0-FOEALFA(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)) & |
---|
98 | & *(RTT-R4IES)/(PTARE-R4IES)**2) |
---|
99 | |
---|
100 | FOEDEM ( PTARE ) = FOEALFA(PTARE)*R5ALVCP*(1.0_JPRB/(PTARE-R4LES)**2)+& |
---|
101 | &(1.0_JPRB-FOEALFA(PTARE))*R5ALSCP*(1.0_JPRB/(PTARE-R4IES)**2) |
---|
102 | |
---|
103 | FOELDCPM ( PTARE ) = FOEALFA(PTARE)*RALVDCP+& |
---|
104 | &(1.0_JPRB-FOEALFA(PTARE))*RALSDCP |
---|
105 | |
---|
106 | FOELHM ( PTARE ) =& |
---|
107 | &FOEALFA(PTARE)*RLVTT+(1.0_JPRB-FOEALFA(PTARE))*RLSTT |
---|
108 | |
---|
109 | |
---|
110 | ! Temperature normalization for humidity background change of variable |
---|
111 | ! INPUT : PTARE = TEMPERATURE |
---|
112 | REAL(KIND=JPRB) :: FOETB |
---|
113 | FOETB ( PTARE )=FOEALFA(PTARE)*R3LES*(RTT-R4LES)*(1.0_JPRB/(PTARE-R4LES)**2)+& |
---|
114 | &(1.0_JPRB-FOEALFA(PTARE))*R3IES*(RTT-R4IES)*(1.0_JPRB/(PTARE-R4IES)**2) |
---|
115 | |
---|
116 | ! ------------------------------------------------------------------ |
---|
117 | ! ***************************************************************** |
---|
118 | |
---|
119 | ! CONSIDERATION OF DIFFERENT MIXED PHASE FOR CONV |
---|
120 | |
---|
121 | ! ***************************************************************** |
---|
122 | |
---|
123 | ! FOEALFCU is calculated to distinguish the three cases: |
---|
124 | |
---|
125 | ! FOEALFCU=1 water phase |
---|
126 | ! FOEALFCU=0 ice phase |
---|
127 | ! 0 < FOEALFCU < 1 mixed phase |
---|
128 | |
---|
129 | ! INPUT : PTARE = TEMPERATURE |
---|
130 | REAL(KIND=JPRB) :: FOEALFCU |
---|
131 | FOEALFCU (PTARE) = MIN(1.0_JPRB,((MAX(RTICECU,MIN(RTWAT,PTARE))& |
---|
132 | &-RTICECU)*RTWAT_RTICECU_R)**2) |
---|
133 | |
---|
134 | |
---|
135 | ! Pressure of water vapour at saturation |
---|
136 | ! INPUT : PTARE = TEMPERATURE |
---|
137 | REAL(KIND=JPRB) :: FOEEWMCU,FOEDEMCU,FOELDCPMCU,FOELHMCU |
---|
138 | FOEEWMCU ( PTARE ) = R2ES *& |
---|
139 | &(FOEALFCU(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+& |
---|
140 | &(1.0_JPRB-FOEALFCU(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES))) |
---|
141 | |
---|
142 | FOEDEMCU ( PTARE )=FOEALFCU(PTARE)*R5ALVCP*(1.0_JPRB/(PTARE-R4LES)**2)+& |
---|
143 | &(1.0_JPRB-FOEALFCU(PTARE))*R5ALSCP*(1.0_JPRB/(PTARE-R4IES)**2) |
---|
144 | |
---|
145 | FOELDCPMCU ( PTARE ) = FOEALFCU(PTARE)*RALVDCP+& |
---|
146 | &(1.0_JPRB-FOEALFCU(PTARE))*RALSDCP |
---|
147 | |
---|
148 | FOELHMCU ( PTARE ) =& |
---|
149 | &FOEALFCU(PTARE)*RLVTT+(1.0_JPRB-FOEALFCU(PTARE))*RLSTT |
---|
150 | ! ------------------------------------------------------------------ |
---|
151 | |
---|
152 | ! Pressure of water vapour at saturation |
---|
153 | ! This one is for the WMO definition of saturation, i.e. always |
---|
154 | ! with respect to water. |
---|
155 | ! |
---|
156 | ! Duplicate to FOEELIQ and FOEEICE for separate ice variable |
---|
157 | ! FOEELIQ always respect to water |
---|
158 | ! FOEEICE always respect to ice |
---|
159 | ! FOEELIQ2ICE is the ratio of vapour pressures over water and ice |
---|
160 | ! (analytically simplified to avoid a suspected Cray compiler bug and using a single call to exp) |
---|
161 | ! (could use FOEEW and FOEEWMO, but naming convention unclear) |
---|
162 | ! FOELSON returns e wrt liquid water using D Sonntag (1994, Met. Zeit.) |
---|
163 | ! - now recommended for use with radiosonde data (WMO CIMO guide, 2014) |
---|
164 | ! unlike the FOEE functions does not include 1/(RETV+1.0_JPRB) factor |
---|
165 | |
---|
166 | REAL(KIND=JPRB) :: FOEEWMO, FOEELIQ, FOEEICE, FOEELIQ2ICE, FOELSON |
---|
167 | FOEEWMO( PTARE ) = R2ES*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES)) |
---|
168 | FOEELIQ( PTARE ) = R2ES*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES)) |
---|
169 | FOEEICE( PTARE ) = R2ES*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)) |
---|
170 | FOEELIQ2ICE( PTARE ) = EXP( (PTARE-RTT)*(R3LES/(PTARE-R4LES) - R3IES/(PTARE-R4IES))) |
---|
171 | FOELSON( PTARE ) = EXP( -6096.9385_JPRB/PTARE + 21.2409642_JPRB & |
---|
172 | - 2.711193E-2_JPRB * PTARE & |
---|
173 | + 1.673952E-5_JPRB * PTARE**2 & |
---|
174 | + 2.433502_JPRB * LOG(PTARE)) |
---|
175 | |
---|
176 | REAL(KIND=JPRB) :: FOEEWM_V,FOEEWMCU_V,FOELES_V,FOEIES_V |
---|
177 | REAL(KIND=JPRB) :: EXP1,EXP2 |
---|
178 | FOELES_V(PTARE)=R3LES*(PTARE-RTT)/(PTARE-R4LES) |
---|
179 | FOEIES_V(PTARE)=R3IES*(PTARE-RTT)/(PTARE-R4IES) |
---|
180 | FOEEWM_V( PTARE,EXP1,EXP2 )=R2ES*(FOEALFA(PTARE)*EXP1+ & |
---|
181 | & (1.0_JPRB-FOEALFA(PTARE))*EXP2) |
---|
182 | FOEEWMCU_V ( PTARE,EXP1,EXP2 ) = R2ES*(FOEALFCU(PTARE)*EXP1+& |
---|
183 | &(1.0_JPRB-FOEALFCU(PTARE))*EXP2) |
---|
184 | |
---|