PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
modd_tiwmx.F90
Go to the documentation of this file.
1!@no_insert_drhook
2! ######spl
3 MODULE modd_tiwmx
4
5!$ACDC methods
6
7! ###############
8!
9!!**** *MODD_TIWMX* -
10!!
11!! PURPOSE
12!! -------
13! Lookup tables (saturation pressures and their derivatives, ice crystal and water
14! droplet growth functions...) as a function of temperature, and their initialisation
15! (INI_TIWMX). The functions reading the tables are in tiwmx.func.h.
16!
17!!
18!! REFERENCE
19!! ---------
20!! Book2 of documentation of Meso-NH (ha ha)
21!!
22!! AUTHOR
23!! ------
24!! K. I. Ivarsson *SMHI*
25!!
26!! MODIFICATIONS
27!! -------------
28!! Original 20/11/14
29!! S. Riette Nov. 2026: INI_TIWMX (formerly in mode_ini_tiwmx.F90) and the analytic formulas
30!! (formerly in mode_tiwmx_fun.F90) moved here
31!-------------------------------------------------------------------------------
32!
33!* 0. DECLARATIONS
34! ------------
35!
36IMPLICIT NONE
37
38REAL, PARAMETER :: xndegr = 100.0
39INTEGER, PARAMETER :: nstart = 13200 ! A too small value may result into a FPE in single precision mode. REK.
40INTEGER, PARAMETER :: nstop = 37316
41
43! Saturation tables and derivatives
44REAL :: estabw(nstart:nstop)
45REAL :: destabw(nstart:nstop)
46REAL :: estabi(nstart:nstop)
47REAL :: destabi(nstart:nstop)
48
49! Ice crystal- or water droplet tables
50REAL :: a2tab(nstart:nstop)
51REAL :: bb3tab(nstart:nstop)
52REAL :: am3tab(nstart:nstop)
53REAL :: af3tab(nstart:nstop)
54REAL :: a2wtab(nstart:nstop)
55REAL :: bb3wtab(nstart:nstop)
56REAL :: redintab(nstart:nstop)
57END TYPE tiwmx_t
58
59TYPE(tiwmx_t), SAVE, TARGET :: tiwmx
60!
61CONTAINS
62!
63SUBROUTINE ini_tiwmx
64! Fills the tables with the analytic formulas (internal functions below)
65 USE yomhook, ONLY : lhook, dr_hook, jphook
66 IMPLICIT NONE
67
68 INTEGER :: JK
69 REAL :: ZTEMP
70
71 REAL(KIND=jphook) :: zhook_handle
72
73 IF (lhook) CALL dr_hook('INI_TIWMX',0,zhook_handle)
74
75 DO jk=nstart,nstop
76 ztemp = real(jk)/xndegr
77
78 tiwmx%ESTABW(jk) = esatw(ztemp)
79 tiwmx%DESTABW(jk) = desdtw(ztemp)
80
81 tiwmx%ESTABI(jk) = esati(ztemp)
82 tiwmx%DESTABI(jk) = desdti(ztemp)
83
84! Functions for ice crystals or water droplets:
85 tiwmx%A2TAB(jk) = aa2(ztemp)
86 tiwmx%A2WTAB(jk) = aa2w(ztemp)
87 tiwmx%AM3TAB(jk) = am3(ztemp)
88 tiwmx%AF3TAB(jk) = af3(ztemp)
89 tiwmx%BB3TAB(jk) = bb3(ztemp)
90 tiwmx%BB3WTAB(jk) = bb3w(ztemp)
91 tiwmx%REDINTAB(jk) = redin(ztemp)
92
93 IF (ztemp.GT.273.15) THEN
94! Avoid ice calculation above freezing level:
95 tiwmx%ESTABI(jk) = esatw(ztemp)
96 tiwmx%DESTABI(jk) = desdtw(ztemp)
97
98! Functions for ice crystal growth:
99 tiwmx%A2TAB(jk) = aa2(ztemp)
100 tiwmx%A2WTAB(jk) = aa2w(ztemp)
101 tiwmx%AM3TAB(jk) = 0.
102 tiwmx%AF3TAB(jk) = 0.
103 tiwmx%BB3TAB(jk) = bb3(ztemp)
104 tiwmx%BB3WTAB(jk) = bb3w(ztemp)
105 ENDIF
106 END DO
107
108 IF (lhook) CALL dr_hook('INI_TIWMX',1,zhook_handle)
109
110!
111CONTAINS
112!
113! Analytic formulas, used only to fill the tables (the functions used during the simulation,
114! which read the tables, are in tiwmx.func.h)
115!
116!
117 ELEMENTAL REAL FUNCTION esatw(TT)
118 USE modd_cst, ONLY : xalpw, xbetaw, xgamw
119 REAL,INTENT(IN) :: tt
120 esatw = exp( xalpw - xbetaw/tt - xgamw*log(tt) )
121 END FUNCTION esatw
122!
123! pure saturation pressure over ice for tt <0 C,
124! esatw otherwise.
125!
126 ELEMENTAL REAL FUNCTION esati(TT)
128 REAL,INTENT(IN) :: tt
129 esati = ( 0.5 + sign(0.5,tt-xtt) )*exp( xalpw - xbetaw/tt - xgamw*log(tt) ) - &
130 & ( sign(0.5,tt-xtt) - 0.5)*exp( xalpi - xbetai/tt - xgami*log(tt) )
131 END FUNCTION esati
132!
133! pure saturation pressure over water
134 ELEMENTAL REAL FUNCTION desdtw(TT)
135 USE modd_cst, ONLY : xbetaw, xgamw
136 REAL,INTENT(IN) :: tt
137 desdtw = esatw(tt)*(xbetaw/tt - xgamw)/tt
138 END FUNCTION desdtw
139
140 ELEMENTAL REAL FUNCTION desdti(TT)
141 USE modd_cst, ONLY : xbetai, xgami, xtt
142 REAL,INTENT(IN) :: tt
143 desdti = ( 0.5 + sign(0.5,tt-xtt) )*desdtw(tt) - &
144 & ( sign(0.5,tt-xtt) - 0.5)*esati(tt)*(xbetai/tt - xgami)/tt
145 END FUNCTION desdti
146
147! Ice crystal function:
148 ELEMENTAL REAL FUNCTION aa2(TT)
149 USE modd_cst, ONLY : xlstt, xcpv, xci, xtt, xrv
150 REAL,INTENT(IN) :: tt
151 aa2 = ( xlstt + (xcpv-xci)*(tt-xtt) )**2 / &
152 & (2.38e-2 + 0.0071e-2 *(tt - xtt))/(tt**2*xrv)
153 END FUNCTION aa2
154
155! Water droplet function:
156 ELEMENTAL REAL FUNCTION aa2w(TT)
157 USE modd_cst, ONLY : xlvtt, xcpv, xcl, xtt, xrv
158 REAL,INTENT(IN) :: tt
159 aa2w = ( (xlvtt+ (xcpv-xcl)*(tt-xtt))**2)/ &
160 & (2.38e-2 + 0.0071e-2 *(tt - xtt))/(tt**2*xrv)
161 END FUNCTION aa2w
162
163! Ice crystal function:
164 ELEMENTAL REAL FUNCTION bb3(TT)
165 USE modd_cst, ONLY : xtt, xrv, xp00
166 REAL,INTENT(IN) :: tt
167 bb3 = xrv/(0.211e-4 * (tt/xtt)**1.94 * xp00)*tt/esati(tt)
168 END FUNCTION bb3
169
170! Water droplet function:
171 ELEMENTAL REAL FUNCTION bb3w(TT)
172 USE modd_cst, ONLY : xtt, xrv, xp00
173 REAL,INTENT(IN) :: tt
174 bb3w = xrv/(0.211e-4 * (tt/xtt)**1.94 * xp00)*tt/esatw(tt)
175 END FUNCTION bb3w
176
177! Meyers IN concentration function:
178 ELEMENTAL REAL FUNCTION am3(TT)
179 REAL,INTENT(IN) :: tt
180 am3 = 1000.*exp(12.96*(esatw(tt)/esati(tt) -1.) -0.639)
181 END FUNCTION am3
182
183! Fletchers IN concentration function:
184 ELEMENTAL REAL FUNCTION af3(TT)
185 USE modd_cst, ONLY : xtt
186 REAL,INTENT(IN) :: tt
187 af3 = 0.01*exp(0.6*(xtt-tt))
188 END FUNCTION af3
189
190! Function for IN concentration reduction between 0 and -20 C:
191 ELEMENTAL REAL FUNCTION redin(TT)
192 USE modd_cst, ONLY : xtt
193 REAL,INTENT(IN) :: tt
194 REAL zzt
195 zzt = max(0., min(1.,(xtt - tt)/20.))
196 redin = 1.- (1.-zzt)/(zzt**3 + (1.-zzt)**3)**.333
197 END FUNCTION redin
198END SUBROUTINE ini_tiwmx
199!
200END MODULE modd_tiwmx
elemental real function esatw(tt)
real, pointer xgamw
Definition modd_cst.F90:163
real, pointer xci
Definition modd_cst.F90:157
real, pointer xalpi
Definition modd_cst.F90:164
real, pointer xrv
Definition modd_cst.F90:153
real, pointer xbetaw
Definition modd_cst.F90:163
real, pointer xlstt
Definition modd_cst.F90:160
real, pointer xtt
Definition modd_cst.F90:158
real, pointer xalpw
Definition modd_cst.F90:163
real, pointer xcpv
Definition modd_cst.F90:155
real, pointer xbetai
Definition modd_cst.F90:164
real, pointer xp00
Definition modd_cst.F90:148
real, pointer xgami
Definition modd_cst.F90:164
real, pointer xlvtt
Definition modd_cst.F90:159
real, pointer xcl
Definition modd_cst.F90:157
integer, parameter nstart
real, parameter xndegr
integer, parameter nstop
subroutine ini_tiwmx
type(tiwmx_t), target, save tiwmx