source: LMDZ6/trunk/libf/phylmd/ecrad/ifs/fcttre.func.h @ 5065

Last change on this file since 5065 was 4876, checked in by idelkadi, 8 months ago

Addition of missing files following the last update (for offline mode)

File size: 7.6 KB
Line 
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!     *****************************************************************
39REAL(KIND=JPRB) :: FOEDELTA
40REAL(KIND=JPRB) :: PTARE
41FOEDELTA (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
50REAL(KIND=JPRB) :: FOEEW,FOEDE,FOEDESU,FOELH,FOELDCP
51FOEEW ( 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
55FOEDE ( PTARE ) = &
56  &(FOEDELTA(PTARE)*R5ALVCP+(1.0_JPRB-FOEDELTA(PTARE))*R5ALSCP)&
57&/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(1.0_JPRB-FOEDELTA(PTARE))))**2
58
59FOEDESU ( PTARE ) = &
60  &(FOEDELTA(PTARE)*R5LES+(1.0_JPRB-FOEDELTA(PTARE))*R5IES)&
61&/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(1.0_JPRB-FOEDELTA(PTARE))))**2
62
63FOELH ( PTARE ) =&
64         &FOEDELTA(PTARE)*RLVTT + (1.0_JPRB-FOEDELTA(PTARE))*RLSTT
65
66FOELDCP ( 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
82REAL(KIND=JPRB) :: FOEALFA
83FOEALFA (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
89REAL(KIND=JPRB) :: FOEEWM,FOEDEM,FOELDCPM,FOELHM,FOE_DEWM_DT
90FOEEWM ( PTARE ) = R2ES *&
91     &(FOEALFA(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+&
92  &(1.0_JPRB-FOEALFA(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)))
93
94FOE_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
100FOEDEM ( PTARE ) = FOEALFA(PTARE)*R5ALVCP*(1.0_JPRB/(PTARE-R4LES)**2)+&
101             &(1.0_JPRB-FOEALFA(PTARE))*R5ALSCP*(1.0_JPRB/(PTARE-R4IES)**2)
102
103FOELDCPM ( PTARE ) = FOEALFA(PTARE)*RALVDCP+&
104            &(1.0_JPRB-FOEALFA(PTARE))*RALSDCP
105
106FOELHM ( 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
112REAL(KIND=JPRB) :: FOETB
113FOETB ( 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
130REAL(KIND=JPRB) :: FOEALFCU
131FOEALFCU (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
137REAL(KIND=JPRB) :: FOEEWMCU,FOEDEMCU,FOELDCPMCU,FOELHMCU
138FOEEWMCU ( PTARE ) = R2ES *&
139     &(FOEALFCU(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+&
140  &(1.0_JPRB-FOEALFCU(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)))
141
142FOEDEMCU ( PTARE )=FOEALFCU(PTARE)*R5ALVCP*(1.0_JPRB/(PTARE-R4LES)**2)+&
143             &(1.0_JPRB-FOEALFCU(PTARE))*R5ALSCP*(1.0_JPRB/(PTARE-R4IES)**2)
144
145FOELDCPMCU ( PTARE ) = FOEALFCU(PTARE)*RALVDCP+&
146            &(1.0_JPRB-FOEALFCU(PTARE))*RALSDCP
147
148FOELHMCU ( 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
166REAL(KIND=JPRB) :: FOEEWMO, FOEELIQ, FOEEICE, FOEELIQ2ICE, FOELSON
167FOEEWMO( PTARE ) = R2ES*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))
168FOEELIQ( PTARE ) = R2ES*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))
169FOEEICE( PTARE ) = R2ES*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES))
170FOEELIQ2ICE( PTARE )  = EXP(      (PTARE-RTT)*(R3LES/(PTARE-R4LES) - R3IES/(PTARE-R4IES)))
171FOELSON( 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
176REAL(KIND=JPRB) :: FOEEWM_V,FOEEWMCU_V,FOELES_V,FOEIES_V
177REAL(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
Note: See TracBrowser for help on using the repository browser.