source: LMDZ5/branches/IPSLCM6.0.8/libf/phymar/fcttre.h @ 5455

Last change on this file since 5455 was 2160, checked in by Laurent Fairhead, 10 years ago

Merged trunk changes -r2070:2158 into testing branch. Compilation problems introduced by revision r2155 have been corrected by hand

File size: 5.0 KB
Line 
1!*
2!     ------------------------------------------------------------------
3#ifdef DOC
4
5!     This COMDECK includes the Thermodynamical functions for the cy39
6!       ECMWF Physics package.
7!       Consistent with YOMCST Basic physics constants, assuming the
8!       partial pressure of water vapour is given by a first order
9!       Taylor expansion of Qs(T) w.r.t. to Temperature, using constants
10!       in YOETHF
11!       Two sets of functions are available. In the first set only the
12!       cases water or ice are distinguished by temperature.  This set
13!       consists of the functions FOEDELTA,FOEEW,FOEDE and FOELH.
14!       The second set considers, besides the two cases water and ice
15!       also a mix of both for the temperature range RTICE < T < RTWAT.
16!       This set contains FOEALFA,FOEEWM,FOEDEM,FOELDCPM and FOELHM.
17
18!       Depending on the consideration of mixed phases either the first
19!       set (e.g. surface, post-processing) or the second set
20!       (e.g. clouds, condensation, convection) should be used.
21
22!     ------------------------------------------------------------------
23!     *****************************************************************
24
25!                NO CONSIDERATION OF MIXED PHASES
26
27!     *****************************************************************
28#endif
29REAL_B :: FOEDELTA
30REAL_B :: PTARE
31FOEDELTA (PTARE) = MAX (_ZERO_,SIGN(_ONE_,PTARE-RTT))
32#ifdef DOC
33
34!                  FOEDELTA = 1    water
35!                  FOEDELTA = 0    ice
36
37!     THERMODYNAMICAL FUNCTIONS .
38
39!     Pressure of water vapour at saturation
40!        INPUT : PTARE = TEMPERATURE
41#endif
42REAL_B :: FOEEW,FOEDE,FOEDESU,FOELH,FOELDCP
43FOEEW ( PTARE ) = R2ES*EXP (&
44  &(R3LES*FOEDELTA(PTARE)+R3IES*(_ONE_-FOEDELTA(PTARE)))*(PTARE-RTT)&
45&/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(_ONE_-FOEDELTA(PTARE)))))
46
47FOEDE ( PTARE ) = &
48  &(FOEDELTA(PTARE)*R5ALVCP+(_ONE_-FOEDELTA(PTARE))*R5ALSCP)&
49&/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(_ONE_-FOEDELTA(PTARE))))**2
50
51FOEDESU ( PTARE ) = &
52  &(FOEDELTA(PTARE)*R5LES+(_ONE_-FOEDELTA(PTARE))*R5IES)&
53&/ (PTARE-(R4LES*FOEDELTA(PTARE)+R4IES*(_ONE_-FOEDELTA(PTARE))))**2
54
55FOELH ( PTARE ) =&
56         &FOEDELTA(PTARE)*RLVTT + (_ONE_-FOEDELTA(PTARE))*RLSTT
57
58FOELDCP ( PTARE ) = &
59         &FOEDELTA(PTARE)*RALVDCP + (_ONE_-FOEDELTA(PTARE))*RALSDCP
60#ifdef DOC
61
62!     *****************************************************************
63
64!           CONSIDERATION OF MIXED PHASES
65
66!     *****************************************************************
67
68!     FOEALFA is calculated to distinguish the three cases:
69
70!                       FOEALFA=1            water phase
71!                       FOEALFA=0            ice phase
72!                       0 < FOEALFA < 1      mixed phase
73
74!               INPUT : PTARE = TEMPERATURE
75#endif
76REAL_B :: FOEALFA
77FOEALFA (PTARE) = MIN(_ONE_,((MAX(RTICE,MIN(RTWAT,PTARE))-RTICE)&
78 &/(RTWAT-RTICE))**2) 
79
80#ifdef DOC
81
82!     Pressure of water vapour at saturation
83!        INPUT : PTARE = TEMPERATURE
84#endif
85REAL_B :: FOEEWM,FOEDEM,FOELDCPM,FOELHM
86FOEEWM ( PTARE ) = R2ES *&
87     &(FOEALFA(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+&
88  &(_ONE_-FOEALFA(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)))
89
90FOEDEM ( PTARE ) = FOEALFA(PTARE)*R5ALVCP*(_ONE_/(PTARE-R4LES)**2)+&
91             &(_ONE_-FOEALFA(PTARE))*R5ALSCP*(_ONE_/(PTARE-R4IES)**2)
92
93FOELDCPM ( PTARE ) = FOEALFA(PTARE)*RALVDCP+&
94            &(_ONE_-FOEALFA(PTARE))*RALSDCP
95
96FOELHM ( PTARE ) =&
97         &FOEALFA(PTARE)*RLVTT+(_ONE_-FOEALFA(PTARE))*RLSTT
98#ifdef DOC
99!     ------------------------------------------------------------------
100!     *****************************************************************
101
102!           CONSIDERATION OF DIFFERENT MIXED PHASE FOR CONV
103
104!     *****************************************************************
105
106!     FOEALFCU is calculated to distinguish the three cases:
107
108!                       FOEALFCU=1            water phase
109!                       FOEALFCU=0            ice phase
110!                       0 < FOEALFCU < 1      mixed phase
111
112!               INPUT : PTARE = TEMPERATURE
113#endif
114REAL_B :: FOEALFCU
115FOEALFCU (PTARE) = MIN(_ONE_,((MAX(RTICECU,MIN(RTWAT,PTARE))&
116&-RTICECU)/(RTWAT-RTICECU))**2) 
117
118#ifdef DOC
119
120!     Pressure of water vapour at saturation
121!        INPUT : PTARE = TEMPERATURE
122#endif
123REAL_B :: FOEEWMCU,FOEDEMCU,FOELDCPMCU,FOELHMCU
124FOEEWMCU ( PTARE ) = R2ES *&
125     &(FOEALFCU(PTARE)*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))+&
126  &(_ONE_-FOEALFCU(PTARE))*EXP(R3IES*(PTARE-RTT)/(PTARE-R4IES)))
127
128FOEDEMCU ( PTARE )=FOEALFCU(PTARE)*R5ALVCP*(_ONE_/(PTARE-R4LES)**2)+&
129             &(_ONE_-FOEALFCU(PTARE))*R5ALSCP*(_ONE_/(PTARE-R4IES)**2)
130
131FOELDCPMCU ( PTARE ) = FOEALFCU(PTARE)*RALVDCP+&
132            &(_ONE_-FOEALFCU(PTARE))*RALSDCP
133
134FOELHMCU ( PTARE ) =&
135         &FOEALFCU(PTARE)*RLVTT+(_ONE_-FOEALFCU(PTARE))*RLSTT
136!     ------------------------------------------------------------------
137#ifdef DOC
138
139!     Pressure of water vapour at saturation
140!     This one is for the WMO definition of saturation, i.e. always
141!     with respect to water.
142#endif
143REAL_B :: FOEEWMO
144FOEEWMO( PTARE ) = R2ES*EXP(R3LES*(PTARE-RTT)/(PTARE-R4LES))
Note: See TracBrowser for help on using the repository browser.