1 | #if ( RWORDSIZE == 4 ) |
---|
2 | # define VREC vsrec |
---|
3 | # define VSQRT vssqrt |
---|
4 | #else |
---|
5 | # define VREC vrec |
---|
6 | # define VSQRT vsqrt |
---|
7 | #endif |
---|
8 | ! |
---|
9 | !Including inline expansion statistical function |
---|
10 | MODULE module_mp_wdm5 |
---|
11 | ! |
---|
12 | ! |
---|
13 | REAL, PARAMETER, PRIVATE :: dtcldcr = 120. ! maximum time step for minor loops |
---|
14 | REAL, PARAMETER, PRIVATE :: n0r = 8.e6 ! intercept parameter rain |
---|
15 | REAL, PARAMETER, PRIVATE :: avtr = 841.9 ! a constant for terminal velocity of rain |
---|
16 | REAL, PARAMETER, PRIVATE :: bvtr = 0.8 ! a constant for terminal velocity of rain |
---|
17 | REAL, PARAMETER, PRIVATE :: r0 = .8e-5 ! 8 microm in contrast to 10 micro m |
---|
18 | REAL, PARAMETER, PRIVATE :: peaut = .55 ! collection efficiency |
---|
19 | REAL, PARAMETER, PRIVATE :: xncr = 3.e8 ! maritime cloud in contrast to 3.e8 in tc80 |
---|
20 | REAL, PARAMETER, PRIVATE :: xmyu = 1.718e-5 ! the dynamic viscosity kgm-1s-1 |
---|
21 | REAL, PARAMETER, PRIVATE :: avts = 11.72 ! a constant for terminal velocity of snow |
---|
22 | REAL, PARAMETER, PRIVATE :: bvts = .41 ! a constant for terminal velocity of snow |
---|
23 | REAL, PARAMETER, PRIVATE :: n0smax = 1.e11 ! maximum n0s (t=-90C unlimited) |
---|
24 | REAL, PARAMETER, PRIVATE :: lamdacmax = 1.e10 ! limited maximum value for slope parameter of cloud water |
---|
25 | REAL, PARAMETER, PRIVATE :: lamdarmax = 1.e8 ! limited maximum value for slope parameter of rain |
---|
26 | REAL, PARAMETER, PRIVATE :: lamdasmax = 1.e5 ! limited maximum value for slope parameter of snow |
---|
27 | REAL, PARAMETER, PRIVATE :: lamdagmax = 6.e4 ! limited maximum value for slope parameter of graupel |
---|
28 | REAL, PARAMETER, PRIVATE :: dicon = 11.9 ! constant for the cloud-ice diamter |
---|
29 | REAL, PARAMETER, PRIVATE :: dimax = 500.e-6 ! limited maximum value for the cloud-ice diamter |
---|
30 | REAL, PARAMETER, PRIVATE :: n0s = 2.e6 ! temperature dependent intercept parameter snow |
---|
31 | REAL, PARAMETER, PRIVATE :: alpha = .12 ! .122 exponen factor for n0s |
---|
32 | REAL, PARAMETER, PRIVATE :: pfrz1 = 100. ! constant in Biggs freezing |
---|
33 | REAL, PARAMETER, PRIVATE :: pfrz2 = 0.66 ! constant in Biggs freezing |
---|
34 | REAL, PARAMETER, PRIVATE :: qcrmin = 1.e-9 ! minimun values for qr, qs, and qg |
---|
35 | REAL, PARAMETER, PRIVATE :: ncmin = 1.e1 ! minimum value for Nc |
---|
36 | REAL, PARAMETER, PRIVATE :: nrmin = 1.e-2 ! minimum value for Nr |
---|
37 | REAL, PARAMETER, PRIVATE :: eacrc = 1.0 ! Snow/cloud-water collection efficiency |
---|
38 | ! |
---|
39 | REAL, PARAMETER, PRIVATE :: satmax = 1.0048 ! maximum saturation value for CCN activation |
---|
40 | ! 1.008 for maritime air mass /1.0048 for conti |
---|
41 | REAL, PARAMETER, PRIVATE :: actk = 0.6 ! parameter for the CCN activation |
---|
42 | REAL, PARAMETER, PRIVATE :: actr = 1.5 ! radius of activated CCN drops |
---|
43 | REAL, PARAMETER, PRIVATE :: ncrk1 = 3.03e3 ! Long's collection kernel coefficient |
---|
44 | REAL, PARAMETER, PRIVATE :: ncrk2 = 2.59e15 ! Long's collection kernel coefficient |
---|
45 | REAL, PARAMETER, PRIVATE :: di100 = 1.e-4 ! parameter related with accretion and collection of cloud drops |
---|
46 | REAL, PARAMETER, PRIVATE :: di600 = 6.e-4 ! parameter related with accretion and collection of cloud drops |
---|
47 | REAL, PARAMETER, PRIVATE :: di2000 = 20.e-4 ! parameter related with accretion and collection of cloud drops |
---|
48 | REAL, PARAMETER, PRIVATE :: di82 = 82.e-6 ! dimater related with raindrops evaporation |
---|
49 | REAL, PARAMETER, PRIVATE :: di15 = 15.e-6 ! auto conversion takes place beyond this diameter |
---|
50 | REAL, SAVE :: & |
---|
51 | qc0, qck1,pidnc,bvtr1,bvtr2,bvtr3,bvtr4, & |
---|
52 | bvtr5,bvtr7,bvtr2o5,bvtr3o5,g1pbr,g2pbr, & |
---|
53 | g3pbr,g4pbr,g5pbr,g7pbr,g5pbro2,g7pbro2, & |
---|
54 | pvtr,pvtrn,eacrr,pacrr, pi, & |
---|
55 | precr1,precr2,xmmax,roqimax,bvts1, & |
---|
56 | bvts2,bvts3,bvts4,g1pbs,g3pbs,g4pbs, & |
---|
57 | g5pbso2,pvts,pacrs,precs1,precs2,pidn0r, & |
---|
58 | pidn0s,pidnr,xlv1,pacrc, & |
---|
59 | rslopecmax,rslopec2max,rslopec3max, & |
---|
60 | rslopermax,rslopesmax,rslopegmax, & |
---|
61 | rsloperbmax,rslopesbmax,rslopegbmax, & |
---|
62 | rsloper2max,rslopes2max,rslopeg2max, & |
---|
63 | rsloper3max,rslopes3max,rslopeg3max |
---|
64 | ! |
---|
65 | ! Specifies code-inlining of fpvs function in WDM52D below. JM 20040507 |
---|
66 | ! |
---|
67 | CONTAINS |
---|
68 | !=================================================================== |
---|
69 | ! |
---|
70 | SUBROUTINE wdm5(th, q, qc, qr, qi, qs & |
---|
71 | ,nn, nc, nr & |
---|
72 | ,den, pii, p, delz & |
---|
73 | ,delt,g, cpd, cpv, ccn0, rd, rv, t0c & |
---|
74 | ,ep1, ep2, qmin & |
---|
75 | ,XLS, XLV0, XLF0, den0, denr & |
---|
76 | ,cliq,cice,psat & |
---|
77 | ,rain, rainncv & |
---|
78 | ,snow, snowncv & |
---|
79 | ,sr & |
---|
80 | ,itimestep & |
---|
81 | ,ids,ide, jds,jde, kds,kde & |
---|
82 | ,ims,ime, jms,jme, kms,kme & |
---|
83 | ,its,ite, jts,jte, kts,kte & |
---|
84 | ) |
---|
85 | !------------------------------------------------------------------- |
---|
86 | IMPLICIT NONE |
---|
87 | !------------------------------------------------------------------- |
---|
88 | ! |
---|
89 | ! This code is a WRF double-moment 5-class mixed ice |
---|
90 | ! microphyiscs scheme (WDM5). The WDM microphysics scheme predicts |
---|
91 | ! number concentrations for warm rain species including clouds and |
---|
92 | ! rain. cloud condensation nuclei (CCN) is also predicted. |
---|
93 | ! The cold rain species including ice, snow, graupel follow the |
---|
94 | ! WRF single-moment 5-class microphysics (WSM5) |
---|
95 | ! in which theoretical background for WSM ice phase microphysics is |
---|
96 | ! based on Hong et al. (2004). |
---|
97 | ! The WDM scheme is described in Lim and Hong (2010). |
---|
98 | ! All units are in m.k.s. and source/sink terms in kgkg-1s-1. |
---|
99 | ! |
---|
100 | ! WDM5 cloud scheme |
---|
101 | ! |
---|
102 | ! Coded by Kyo-Sun Lim and Song-You Hong (Yonsei Univ.) Fall 2008 |
---|
103 | ! |
---|
104 | ! Implemented by Kyo-Sun Lim and Jimy Dudhia (NCAR) Winter 2008 |
---|
105 | ! |
---|
106 | ! Reference) Lim and Hong (LH, 2010) Mon. Wea. Rev. |
---|
107 | ! Hong, Dudhia, Chen (HDC, 2004) Mon. Wea. Rev. |
---|
108 | ! Hong and Lim (HL, 2006) J. Korean Meteor. Soc. |
---|
109 | ! Cohard and Pinty (CP, 2000) Quart. J. Roy. Meteor. Soc. |
---|
110 | ! Khairoutdinov and Kogan (KK, 2000) Mon. Wea. Rev. |
---|
111 | ! Dudhia, Hong and Lim (DHL, 2008) J. Meteor. Soc. Japan |
---|
112 | ! |
---|
113 | ! Lin, Farley, Orville (LFO, 1983) J. Appl. Meteor. |
---|
114 | ! Rutledge, Hobbs (RH83, 1983) J. Atmos. Sci. |
---|
115 | ! Rutledge, Hobbs (RH84, 1984) J. Atmos. Sci. |
---|
116 | ! |
---|
117 | INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , & |
---|
118 | ims,ime, jms,jme, kms,kme , & |
---|
119 | its,ite, jts,jte, kts,kte |
---|
120 | REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), & |
---|
121 | INTENT(INOUT) :: & |
---|
122 | th, & |
---|
123 | q, & |
---|
124 | qc, & |
---|
125 | qi, & |
---|
126 | qr, & |
---|
127 | qs, & |
---|
128 | nn, & |
---|
129 | nc, & |
---|
130 | nr |
---|
131 | REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), & |
---|
132 | INTENT(IN ) :: & |
---|
133 | den, & |
---|
134 | pii, & |
---|
135 | p, & |
---|
136 | delz |
---|
137 | REAL, INTENT(IN ) :: delt, & |
---|
138 | g, & |
---|
139 | rd, & |
---|
140 | rv, & |
---|
141 | t0c, & |
---|
142 | den0, & |
---|
143 | cpd, & |
---|
144 | cpv, & |
---|
145 | ccn0, & |
---|
146 | ep1, & |
---|
147 | ep2, & |
---|
148 | qmin, & |
---|
149 | XLS, & |
---|
150 | XLV0, & |
---|
151 | XLF0, & |
---|
152 | cliq, & |
---|
153 | cice, & |
---|
154 | psat, & |
---|
155 | denr |
---|
156 | INTEGER, INTENT(IN ) :: itimestep |
---|
157 | REAL, DIMENSION( ims:ime , jms:jme ), & |
---|
158 | INTENT(INOUT) :: rain, & |
---|
159 | rainncv, & |
---|
160 | sr |
---|
161 | REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, & |
---|
162 | INTENT(INOUT) :: snow, & |
---|
163 | snowncv |
---|
164 | ! LOCAL VAR |
---|
165 | REAL, DIMENSION( its:ite , kts:kte ) :: t |
---|
166 | REAL, DIMENSION( its:ite , kts:kte, 2 ) :: qci, qrs |
---|
167 | REAL, DIMENSION( its:ite , kts:kte, 3 ) :: ncr |
---|
168 | CHARACTER*256 :: emess |
---|
169 | INTEGER :: mkx_test |
---|
170 | INTEGER :: i,j,k |
---|
171 | !------------------------------------------------------------------- |
---|
172 | #ifndef RUN_ON_GPU |
---|
173 | IF (itimestep .eq. 1) THEN |
---|
174 | DO j=jms,jme |
---|
175 | DO k=kms,kme |
---|
176 | DO i=ims,ime |
---|
177 | nn(i,k,j) = ccn0 |
---|
178 | ENDDO |
---|
179 | ENDDO |
---|
180 | ENDDO |
---|
181 | ENDIF |
---|
182 | ! |
---|
183 | DO j=jts,jte |
---|
184 | DO k=kts,kte |
---|
185 | DO i=its,ite |
---|
186 | t(i,k)=th(i,k,j)*pii(i,k,j) |
---|
187 | qci(i,k,1) = qc(i,k,j) |
---|
188 | qci(i,k,2) = qi(i,k,j) |
---|
189 | qrs(i,k,1) = qr(i,k,j) |
---|
190 | qrs(i,k,2) = qs(i,k,j) |
---|
191 | ncr(i,k,1) = nn(i,k,j) |
---|
192 | ncr(i,k,2) = nc(i,k,j) |
---|
193 | ncr(i,k,3) = nr(i,k,j) |
---|
194 | ENDDO |
---|
195 | ENDDO |
---|
196 | ! Sending array starting locations of optional variables may cause |
---|
197 | ! troubles, so we explicitly change the call. |
---|
198 | CALL wdm52D(t, q(ims,kms,j), qci, qrs, ncr & |
---|
199 | ,den(ims,kms,j) & |
---|
200 | ,p(ims,kms,j), delz(ims,kms,j) & |
---|
201 | ,delt,g, cpd, cpv, ccn0, rd, rv, t0c & |
---|
202 | ,ep1, ep2, qmin & |
---|
203 | ,XLS, XLV0, XLF0, den0, denr & |
---|
204 | ,cliq,cice,psat & |
---|
205 | ,j & |
---|
206 | ,rain(ims,j),rainncv(ims,j) & |
---|
207 | ,sr(ims,j) & |
---|
208 | ,ids,ide, jds,jde, kds,kde & |
---|
209 | ,ims,ime, jms,jme, kms,kme & |
---|
210 | ,its,ite, jts,jte, kts,kte & |
---|
211 | ,snow(ims,j),snowncv(ims,j) & |
---|
212 | ) |
---|
213 | DO K=kts,kte |
---|
214 | DO I=its,ite |
---|
215 | th(i,k,j)=t(i,k)/pii(i,k,j) |
---|
216 | qc(i,k,j) = qci(i,k,1) |
---|
217 | qi(i,k,j) = qci(i,k,2) |
---|
218 | qr(i,k,j) = qrs(i,k,1) |
---|
219 | qs(i,k,j) = qrs(i,k,2) |
---|
220 | nn(i,k,j) = ncr(i,k,1) |
---|
221 | nc(i,k,j) = ncr(i,k,2) |
---|
222 | nr(i,k,j) = ncr(i,k,3) |
---|
223 | ENDDO |
---|
224 | ENDDO |
---|
225 | ENDDO |
---|
226 | #else |
---|
227 | CALL get_wsm5_gpu_levels ( mkx_test ) |
---|
228 | IF ( mkx_test .LT. kte ) THEN |
---|
229 | WRITE(emess,*)'Number of levels compiled for GPU WSM5 too small. ', & |
---|
230 | mkx_test,' < ',kte |
---|
231 | CALL wrf_error_fatal(emess) |
---|
232 | ENDIF |
---|
233 | CALL wsm5_host ( & |
---|
234 | th(its:ite,kts:kte,jts:jte), pii(its:ite,kts:kte,jts:jte) & |
---|
235 | ,q(its:ite,kts:kte,jts:jte), qc(its:ite,kts:kte,jts:jte) & |
---|
236 | ,qi(its:ite,kts:kte,jts:jte), qr(its:ite,kts:kte,jts:jte) & |
---|
237 | ,qs(its:ite,kts:kte,jts:jte), den(its:ite,kts:kte,jts:jte) & |
---|
238 | ,p(its:ite,kts:kte,jts:jte), delz(its:ite,kts:kte,jts:jte) & |
---|
239 | ,delt & |
---|
240 | ,rain(its:ite,jts:jte),rainncv(its:ite,jts:jte) & |
---|
241 | ,snow(its:ite,jts:jte),snowncv(its:ite,jts:jte) & |
---|
242 | ,sr(its:ite,jts:jte) & |
---|
243 | ,its, ite, jts, jte, kts, kte & |
---|
244 | ,its, ite, jts, jte, kts, kte & |
---|
245 | ,its, ite, jts, jte, kts, kte & |
---|
246 | ) |
---|
247 | #endif |
---|
248 | END SUBROUTINE wdm5 |
---|
249 | !=================================================================== |
---|
250 | ! |
---|
251 | SUBROUTINE wdm52D(t, q, qci, qrs, ncr, den, p, delz & |
---|
252 | ,delt,g, cpd, cpv, ccn0, rd, rv, t0c & |
---|
253 | ,ep1, ep2, qmin & |
---|
254 | ,XLS, XLV0, XLF0, den0, denr & |
---|
255 | ,cliq,cice,psat & |
---|
256 | ,lat & |
---|
257 | ,rain,rainncv & |
---|
258 | ,sr & |
---|
259 | ,ids,ide, jds,jde, kds,kde & |
---|
260 | ,ims,ime, jms,jme, kms,kme & |
---|
261 | ,its,ite, jts,jte, kts,kte & |
---|
262 | ,snow,snowncv & |
---|
263 | ) |
---|
264 | !------------------------------------------------------------------- |
---|
265 | IMPLICIT NONE |
---|
266 | !------------------------------------------------------------------- |
---|
267 | INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , & |
---|
268 | ims,ime, jms,jme, kms,kme , & |
---|
269 | its,ite, jts,jte, kts,kte, & |
---|
270 | lat |
---|
271 | REAL, DIMENSION( its:ite , kts:kte ), & |
---|
272 | INTENT(INOUT) :: & |
---|
273 | t |
---|
274 | REAL, DIMENSION( its:ite , kts:kte, 2 ), & |
---|
275 | INTENT(INOUT) :: & |
---|
276 | qci, & |
---|
277 | qrs |
---|
278 | REAL, DIMENSION( its:ite , kts:kte, 3 ), & |
---|
279 | INTENT(INOUT) :: & |
---|
280 | ncr |
---|
281 | REAL, DIMENSION( ims:ime , kms:kme ), & |
---|
282 | INTENT(INOUT) :: & |
---|
283 | q |
---|
284 | REAL, DIMENSION( ims:ime , kms:kme ), & |
---|
285 | INTENT(IN ) :: & |
---|
286 | den, & |
---|
287 | p, & |
---|
288 | delz |
---|
289 | REAL, INTENT(IN ) :: delt, & |
---|
290 | g, & |
---|
291 | cpd, & |
---|
292 | cpv, & |
---|
293 | ccn0, & |
---|
294 | t0c, & |
---|
295 | den0, & |
---|
296 | rd, & |
---|
297 | rv, & |
---|
298 | ep1, & |
---|
299 | ep2, & |
---|
300 | qmin, & |
---|
301 | XLS, & |
---|
302 | XLV0, & |
---|
303 | XLF0, & |
---|
304 | cliq, & |
---|
305 | cice, & |
---|
306 | psat, & |
---|
307 | denr |
---|
308 | REAL, DIMENSION( ims:ime ), & |
---|
309 | INTENT(INOUT) :: rain, & |
---|
310 | rainncv, & |
---|
311 | sr |
---|
312 | REAL, DIMENSION( ims:ime ), OPTIONAL, & |
---|
313 | INTENT(INOUT) :: snow, & |
---|
314 | snowncv |
---|
315 | ! LOCAL VAR |
---|
316 | REAL, DIMENSION( its:ite , kts:kte , 2) :: & |
---|
317 | rh, qs, rslope, rslope2, rslope3, rslopeb, & |
---|
318 | falk, fall, work1, qrs_tmp |
---|
319 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
320 | rslopec, rslopec2,rslopec3 |
---|
321 | REAL, DIMENSION( its:ite , kts:kte, 2) :: & |
---|
322 | avedia |
---|
323 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
324 | workn,falln,falkn |
---|
325 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
326 | works |
---|
327 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
328 | den_tmp, delz_tmp, ncr_tmp |
---|
329 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
330 | falkc, work1c, work2c, fallc |
---|
331 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
332 | pcact, praut, psaut, prevp, psdep, pracw, psaci, psacw, & |
---|
333 | pigen, pidep, pcond, & |
---|
334 | xl, cpm, work2, psmlt, psevp, denfac, xni, & |
---|
335 | n0sfac, denqrs2, denqci |
---|
336 | REAL, DIMENSION( its:ite ) :: & |
---|
337 | delqrs2, delqi |
---|
338 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
339 | nraut, nracw, ncevp, nccol, nrcol, & |
---|
340 | nsacw, nseml, ncact |
---|
341 | REAL :: ifac, sfac |
---|
342 | REAL, DIMENSION(its:ite) :: tstepsnow |
---|
343 | ! |
---|
344 | #define WSM_NO_CONDITIONAL_IN_VECTOR |
---|
345 | #ifdef WSM_NO_CONDITIONAL_IN_VECTOR |
---|
346 | REAL, DIMENSION(its:ite) :: xal, xbl |
---|
347 | #endif |
---|
348 | ! variables for optimization |
---|
349 | REAL, DIMENSION( its:ite ) :: tvec1 |
---|
350 | INTEGER, DIMENSION( its:ite ) :: mnstep, numndt |
---|
351 | INTEGER, DIMENSION( its:ite ) :: mstep, numdt |
---|
352 | REAL, DIMENSION(its:ite) :: rmstep |
---|
353 | REAL dtcldden, rdelz, rdtcld |
---|
354 | LOGICAL, DIMENSION( its:ite ) :: flgcld |
---|
355 | REAL :: & |
---|
356 | cpmcal, xlcal, lamdac, diffus, & |
---|
357 | viscos, xka, venfac, conden, diffac, & |
---|
358 | x, y, z, a, b, c, d, e, & |
---|
359 | ndt, qdt, holdrr, holdrs, supcol, supcolt, pvt, & |
---|
360 | coeres, supsat, dtcld, xmi, eacrs, satdt, & |
---|
361 | vt2i,vt2s,acrfac, coecol, & |
---|
362 | nfrzdtr, nfrzdtc, & |
---|
363 | taucon, lencon, lenconcr, & |
---|
364 | qimax, diameter, xni0, roqi0, & |
---|
365 | fallsum, fallsum_qsi, xlwork2, factor, source, & |
---|
366 | value, xlf, pfrzdtc, pfrzdtr, supice |
---|
367 | REAL :: temp |
---|
368 | REAL :: holdc, holdci |
---|
369 | INTEGER :: i, j, k, mstepmax, & |
---|
370 | iprt, latd, lond, loop, loops, ifsat, n, idim, kdim |
---|
371 | ! Temporaries used for inlining fpvs function |
---|
372 | REAL :: dldti, xb, xai, tr, xbi, xa, hvap, cvap, hsub, dldt, ttp |
---|
373 | REAL :: logtr |
---|
374 | ! |
---|
375 | !================================================================= |
---|
376 | ! compute internal functions |
---|
377 | ! |
---|
378 | cpmcal(x) = cpd*(1.-max(x,qmin))+max(x,qmin)*cpv |
---|
379 | xlcal(x) = xlv0-xlv1*(x-t0c) |
---|
380 | !---------------------------------------------------------------- |
---|
381 | ! size distributions: (x=mixing ratio, y=air density): |
---|
382 | ! valid for mixing ratio > 1.e-9 kg/kg. |
---|
383 | ! |
---|
384 | ! Optimizatin : A**B => exp(log(A)*(B)) |
---|
385 | lamdac(x,y,z)= exp(log(((pidnc*z)/(x*y)))*((.33333333))) |
---|
386 | ! |
---|
387 | !---------------------------------------------------------------- |
---|
388 | ! diffus: diffusion coefficient of the water vapor |
---|
389 | ! viscos: kinematic viscosity(m2s-1) |
---|
390 | ! diffus(x,y) = 8.794e-5 * exp(log(x)*(1.81)) / y |
---|
391 | ! viscos(x,y) = 1.496e-6 * (x*sqrt(x)) /(x+120.)/y |
---|
392 | ! xka(x,y) = 1.414e3*viscos(x,y)*y |
---|
393 | ! diffac(a,b,c,d,e) = d*a*a/(xka(c,d)*rv*c*c)+1./(e*diffus(c,b)) |
---|
394 | ! venfac(a,b,c) = exp(log((viscos(b,c)/diffus(b,a)))*((.3333333))) & |
---|
395 | ! /sqrt(viscos(b,c))*sqrt(sqrt(den0/c)) |
---|
396 | ! conden(a,b,c,d,e) = (max(b,qmin)-c)/(1.+d*d/(rv*e)*c/(a*a)) |
---|
397 | ! |
---|
398 | ! |
---|
399 | idim = ite-its+1 |
---|
400 | kdim = kte-kts+1 |
---|
401 | ! |
---|
402 | !---------------------------------------------------------------- |
---|
403 | ! paddint 0 for negative values generated by dynamics |
---|
404 | ! |
---|
405 | do k = kts, kte |
---|
406 | do i = its, ite |
---|
407 | qci(i,k,1) = max(qci(i,k,1),0.0) |
---|
408 | qrs(i,k,1) = max(qrs(i,k,1),0.0) |
---|
409 | qci(i,k,2) = max(qci(i,k,2),0.0) |
---|
410 | qrs(i,k,2) = max(qrs(i,k,2),0.0) |
---|
411 | ncr(i,k,1) = max(ncr(i,k,1),0.) |
---|
412 | ncr(i,k,2) = max(ncr(i,k,2),0.) |
---|
413 | ncr(i,k,3) = max(ncr(i,k,3),0.) |
---|
414 | enddo |
---|
415 | enddo |
---|
416 | ! |
---|
417 | ! latent heat for phase changes and heat capacity. neglect the |
---|
418 | ! changes during microphysical process calculation |
---|
419 | ! emanuel(1994) |
---|
420 | ! |
---|
421 | do k = kts, kte |
---|
422 | do i = its, ite |
---|
423 | cpm(i,k) = cpmcal(q(i,k)) |
---|
424 | xl(i,k) = xlcal(t(i,k)) |
---|
425 | delz_tmp(i,k) = delz(i,k) |
---|
426 | den_tmp(i,k) = den(i,k) |
---|
427 | enddo |
---|
428 | enddo |
---|
429 | ! |
---|
430 | !---------------------------------------------------------------- |
---|
431 | ! initialize the surface rain, snow |
---|
432 | ! |
---|
433 | do i = its, ite |
---|
434 | rainncv(i) = 0. |
---|
435 | if(PRESENT (snowncv) .AND. PRESENT (snow)) snowncv(i) = 0. |
---|
436 | sr(i) = 0. |
---|
437 | ! new local array to catch step snow |
---|
438 | tstepsnow(i) = 0. |
---|
439 | enddo |
---|
440 | ! |
---|
441 | !---------------------------------------------------------------- |
---|
442 | ! compute the minor time steps. |
---|
443 | ! |
---|
444 | loops = max(nint(delt/dtcldcr),1) |
---|
445 | dtcld = delt/loops |
---|
446 | if(delt.le.dtcldcr) dtcld = delt |
---|
447 | ! |
---|
448 | do loop = 1,loops |
---|
449 | ! |
---|
450 | !---------------------------------------------------------------- |
---|
451 | ! initialize the large scale variables |
---|
452 | ! |
---|
453 | do i = its, ite |
---|
454 | mstep(i) = 1 |
---|
455 | mnstep(i) = 1 |
---|
456 | flgcld(i) = .true. |
---|
457 | enddo |
---|
458 | ! |
---|
459 | ! do k = kts, kte |
---|
460 | ! do i = its, ite |
---|
461 | ! denfac(i,k) = sqrt(den0/den(i,k)) |
---|
462 | ! enddo |
---|
463 | ! enddo |
---|
464 | do k = kts, kte |
---|
465 | CALL VREC( tvec1(its), den(its,k), ite-its+1) |
---|
466 | do i = its, ite |
---|
467 | tvec1(i) = tvec1(i)*den0 |
---|
468 | enddo |
---|
469 | CALL VSQRT( denfac(its,k), tvec1(its), ite-its+1) |
---|
470 | enddo |
---|
471 | ! |
---|
472 | ! Inline expansion for fpvs |
---|
473 | ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c) |
---|
474 | ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c) |
---|
475 | hsub = xls |
---|
476 | hvap = xlv0 |
---|
477 | cvap = cpv |
---|
478 | ttp=t0c+0.01 |
---|
479 | dldt=cvap-cliq |
---|
480 | xa=-dldt/rv |
---|
481 | xb=xa+hvap/(rv*ttp) |
---|
482 | dldti=cvap-cice |
---|
483 | xai=-dldti/rv |
---|
484 | xbi=xai+hsub/(rv*ttp) |
---|
485 | ! this is for compilers where the conditional inhibits vectorization |
---|
486 | #ifdef WSM_NO_CONDITIONAL_IN_VECTOR |
---|
487 | do k = kts, kte |
---|
488 | do i = its, ite |
---|
489 | if(t(i,k).lt.ttp) then |
---|
490 | xal(i) = xai |
---|
491 | xbl(i) = xbi |
---|
492 | else |
---|
493 | xal(i) = xa |
---|
494 | xbl(i) = xb |
---|
495 | endif |
---|
496 | enddo |
---|
497 | do i = its, ite |
---|
498 | tr=ttp/t(i,k) |
---|
499 | logtr=log(tr) |
---|
500 | qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr)) |
---|
501 | qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k)) |
---|
502 | qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1)) |
---|
503 | qs(i,k,1) = max(qs(i,k,1),qmin) |
---|
504 | rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin) |
---|
505 | qs(i,k,2)=psat*exp(logtr*(xal(i))+xbl(i)*(1.-tr)) |
---|
506 | qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k)) |
---|
507 | qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2)) |
---|
508 | qs(i,k,2) = max(qs(i,k,2),qmin) |
---|
509 | rh(i,k,2) = max(q(i,k) / qs(i,k,2),qmin) |
---|
510 | enddo |
---|
511 | enddo |
---|
512 | #else |
---|
513 | do k = kts, kte |
---|
514 | do i = its, ite |
---|
515 | tr=ttp/t(i,k) |
---|
516 | logtr=log(tr) |
---|
517 | qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr)) |
---|
518 | qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k)) |
---|
519 | qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1)) |
---|
520 | qs(i,k,1) = max(qs(i,k,1),qmin) |
---|
521 | rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin) |
---|
522 | if(t(i,k).lt.ttp) then |
---|
523 | qs(i,k,2)=psat*exp(logtr*(xai)+xbi*(1.-tr)) |
---|
524 | else |
---|
525 | qs(i,k,2)=psat*exp(logtr*(xa)+xb*(1.-tr)) |
---|
526 | endif |
---|
527 | qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k)) |
---|
528 | qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2)) |
---|
529 | qs(i,k,2) = max(qs(i,k,2),qmin) |
---|
530 | rh(i,k,2) = max(q(i,k) / qs(i,k,2),qmin) |
---|
531 | enddo |
---|
532 | enddo |
---|
533 | #endif |
---|
534 | ! |
---|
535 | !---------------------------------------------------------------- |
---|
536 | ! initialize the variables for microphysical physics |
---|
537 | ! |
---|
538 | ! |
---|
539 | do k = kts, kte |
---|
540 | do i = its, ite |
---|
541 | prevp(i,k) = 0. |
---|
542 | psdep(i,k) = 0. |
---|
543 | praut(i,k) = 0. |
---|
544 | psaut(i,k) = 0. |
---|
545 | pracw(i,k) = 0. |
---|
546 | psaci(i,k) = 0. |
---|
547 | psacw(i,k) = 0. |
---|
548 | pigen(i,k) = 0. |
---|
549 | pidep(i,k) = 0. |
---|
550 | pcond(i,k) = 0. |
---|
551 | psmlt(i,k) = 0. |
---|
552 | psevp(i,k) = 0. |
---|
553 | pcact(i,k) = 0. |
---|
554 | falk(i,k,1) = 0. |
---|
555 | falk(i,k,2) = 0. |
---|
556 | fall(i,k,1) = 0. |
---|
557 | fall(i,k,2) = 0. |
---|
558 | fallc(i,k) = 0. |
---|
559 | falkc(i,k) = 0. |
---|
560 | falln(i,k) = 0. |
---|
561 | falkn(i,k) = 0. |
---|
562 | xni(i,k) = 1.e3 |
---|
563 | nsacw(i,k) = 0. |
---|
564 | nseml(i,k) = 0. |
---|
565 | nracw(i,k) = 0. |
---|
566 | nccol(i,k) = 0. |
---|
567 | nrcol(i,k) = 0. |
---|
568 | ncact(i,k) = 0. |
---|
569 | nraut(i,k) = 0. |
---|
570 | ncevp(i,k) = 0. |
---|
571 | enddo |
---|
572 | enddo |
---|
573 | ! |
---|
574 | !---------------------------------------------------------------- |
---|
575 | ! compute the fallout term: |
---|
576 | ! first, vertical terminal velosity for minor loops |
---|
577 | ! |
---|
578 | do k = kts, kte |
---|
579 | do i = its, ite |
---|
580 | if(qci(i,k,1).le.qmin .or. ncr(i,k,2).le.ncmin)then |
---|
581 | rslopec(i,k) = rslopecmax |
---|
582 | rslopec2(i,k) = rslopec2max |
---|
583 | rslopec3(i,k) = rslopec3max |
---|
584 | else |
---|
585 | rslopec(i,k) = 1./lamdac(qci(i,k,1),den(i,k),ncr(i,k,2)) |
---|
586 | rslopec2(i,k) = rslopec(i,k)*rslopec(i,k) |
---|
587 | rslopec3(i,k) = rslopec2(i,k)*rslopec(i,k) |
---|
588 | endif |
---|
589 | !------------------------------------------------------------- |
---|
590 | ! Ni: ice crystal number concentraiton [HDC 5c] |
---|
591 | !------------------------------------------------------------- |
---|
592 | ! xni(i,k) = min(max(5.38e7*(den(i,k) & |
---|
593 | ! *max(qci(i,k,2),qmin))**0.75,1.e3),1.e6) |
---|
594 | temp = (den(i,k)*max(qci(i,k,2),qmin)) |
---|
595 | temp = sqrt(sqrt(temp*temp*temp)) |
---|
596 | xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6) |
---|
597 | enddo |
---|
598 | enddo |
---|
599 | do k = kts, kte |
---|
600 | do i = its, ite |
---|
601 | qrs_tmp(i,k,1) = qrs(i,k,1) |
---|
602 | qrs_tmp(i,k,2) = qrs(i,k,2) |
---|
603 | ncr_tmp(i,k) = ncr(i,k,3) |
---|
604 | enddo |
---|
605 | enddo |
---|
606 | call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, & |
---|
607 | rslope3,work1,workn,its,ite,kts,kte) |
---|
608 | !---------------------------------------------------------------- |
---|
609 | ! compute the fallout term: |
---|
610 | ! first, vertical terminal velosity for minor loops |
---|
611 | !---------------------------------------------------------------- |
---|
612 | ! |
---|
613 | ! vt update for qr and nr |
---|
614 | mstepmax = 1 |
---|
615 | numdt = 1 |
---|
616 | do k = kte, kts, -1 |
---|
617 | do i = its, ite |
---|
618 | work1(i,k,1) = work1(i,k,1)/delz(i,k) |
---|
619 | workn(i,k) = workn(i,k)/delz(i,k) |
---|
620 | numdt(i) = max(nint(max(work1(i,k,1),workn(i,k))*dtcld+.5),1) |
---|
621 | if(numdt(i).ge.mstep(i)) mstep(i) = numdt(i) |
---|
622 | enddo |
---|
623 | enddo |
---|
624 | do i = its, ite |
---|
625 | if(mstepmax.le.mstep(i)) mstepmax = mstep(i) |
---|
626 | enddo |
---|
627 | ! |
---|
628 | do n = 1, mstepmax |
---|
629 | k = kte |
---|
630 | do i = its, ite |
---|
631 | if(n.le.mstep(i)) then |
---|
632 | falk(i,k,1) = den(i,k)*qrs(i,k,1)*work1(i,k,1)/mstep(i) |
---|
633 | falkn(i,k) = ncr(i,k,3)*workn(i,k)/mstep(i) |
---|
634 | fall(i,k,1) = fall(i,k,1)+falk(i,k,1) |
---|
635 | falln(i,k) = falln(i,k)+falkn(i,k) |
---|
636 | qrs(i,k,1) = max(qrs(i,k,1)-falk(i,k,1)*dtcld/den(i,k),0.) |
---|
637 | ncr(i,k,3) = max(ncr(i,k,3)-falkn(i,k)*dtcld,0.) |
---|
638 | endif |
---|
639 | enddo |
---|
640 | do k = kte-1, kts, -1 |
---|
641 | do i = its, ite |
---|
642 | if(n.le.mstep(i)) then |
---|
643 | falk(i,k,1) = den(i,k)*qrs(i,k,1)*work1(i,k,1)/mstep(i) |
---|
644 | falkn(i,k) = ncr(i,k,3)*workn(i,k)/mstep(i) |
---|
645 | fall(i,k,1) = fall(i,k,1)+falk(i,k,1) |
---|
646 | falln(i,k) = falln(i,k)+falkn(i,k) |
---|
647 | qrs(i,k,1) = max(qrs(i,k,1)-(falk(i,k,1)-falk(i,k+1,1) & |
---|
648 | *delz(i,k+1)/delz(i,k))*dtcld/den(i,k),0.) |
---|
649 | ncr(i,k,3) = max(ncr(i,k,3)-(falkn(i,k)-falkn(i,k+1)*delz(i,k+1) & |
---|
650 | /delz(i,k))*dtcld,0.) |
---|
651 | endif |
---|
652 | enddo |
---|
653 | enddo |
---|
654 | do k = kts, kte |
---|
655 | do i = its, ite |
---|
656 | qrs_tmp(i,k,1) = qrs(i,k,1) |
---|
657 | ncr_tmp(i,k) = ncr(i,k,3) |
---|
658 | enddo |
---|
659 | enddo |
---|
660 | call slope_rain(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, & |
---|
661 | rslope3,work1,workn,its,ite,kts,kte) |
---|
662 | do k = kte, kts, -1 |
---|
663 | do i = its, ite |
---|
664 | work1(i,k,1) = work1(i,k,1)/delz(i,k) |
---|
665 | workn(i,k) = workn(i,k)/delz(i,k) |
---|
666 | enddo |
---|
667 | enddo |
---|
668 | enddo |
---|
669 | ! for semi |
---|
670 | do k = kte, kts, -1 |
---|
671 | do i = its, ite |
---|
672 | works(i,k) = work1(i,k,2) |
---|
673 | denqrs2(i,k) = den(i,k)*qrs(i,k,2) |
---|
674 | if(qrs(i,k,2).le.0.0) works(i,k) = 0.0 |
---|
675 | enddo |
---|
676 | enddo |
---|
677 | call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,works,denqrs2, & |
---|
678 | delqrs2,dtcld,2,1) |
---|
679 | do k = kts, kte |
---|
680 | do i = its, ite |
---|
681 | qrs(i,k,2) = max(denqrs2(i,k)/den(i,k),0.) |
---|
682 | fall(i,k,2) = denqrs2(i,k)*works(i,k)/delz(i,k) |
---|
683 | enddo |
---|
684 | enddo |
---|
685 | do i = its, ite |
---|
686 | fall(i,1,2) = delqrs2(i)/delz(i,1)/dtcld |
---|
687 | enddo |
---|
688 | do k = kts, kte |
---|
689 | do i = its, ite |
---|
690 | qrs_tmp(i,k,1) = qrs(i,k,1) |
---|
691 | qrs_tmp(i,k,2) = qrs(i,k,2) |
---|
692 | ncr_tmp(i,k) = ncr(i,k,3) |
---|
693 | enddo |
---|
694 | enddo |
---|
695 | call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, & |
---|
696 | rslope3,work1,workn,its,ite,kts,kte) |
---|
697 | ! |
---|
698 | do k = kte, kts, -1 |
---|
699 | do i = its, ite |
---|
700 | supcol = t0c-t(i,k) |
---|
701 | n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.) |
---|
702 | if(t(i,k).gt.t0c.and.qrs(i,k,2).gt.0.) then |
---|
703 | !---------------------------------------------------------------- |
---|
704 | ! psmlt: melting of snow [HL A33] [RH83 A25] |
---|
705 | ! (T>T0: QS->QR) |
---|
706 | !---------------------------------------------------------------- |
---|
707 | xlf = xlf0 |
---|
708 | ! work2(i,k)= venfac(p(i,k),t(i,k),den(i,k)) |
---|
709 | work2(i,k)= (exp(log(((1.496e-6*((t(i,k))*sqrt(t(i,k))) & |
---|
710 | /((t(i,k))+120.)/(den(i,k)))/(8.794e-5 & |
---|
711 | *exp(log(t(i,k))*(1.81))/p(i,k)))) & |
---|
712 | *((.3333333)))/sqrt((1.496e-6*((t(i,k)) & |
---|
713 | *sqrt(t(i,k)))/((t(i,k))+120.)/(den(i,k)))) & |
---|
714 | *sqrt(sqrt(den0/(den(i,k))))) |
---|
715 | coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2)) |
---|
716 | ! psmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*pi/2. & |
---|
717 | ! *n0sfac(i,k)*(precs1*rslope2(i,k,2)+precs2 & |
---|
718 | ! *work2(i,k)*coeres) |
---|
719 | psmlt(i,k) = (1.414e3*(1.496e-6 * ((t(i,k))*sqrt(t(i,k))) & |
---|
720 | /((t(i,k))+120.)/(den(i,k)))*(den(i,k)))/xlf & |
---|
721 | *(t0c-t(i,k))*pi/2.*n0sfac(i,k) & |
---|
722 | *(precs1*rslope2(i,k,2)+precs2*work2(i,k)*coeres) |
---|
723 | psmlt(i,k) = min(max(psmlt(i,k)*dtcld/mstep(i),-qrs(i,k,2) & |
---|
724 | /mstep(i)),0.) |
---|
725 | !------------------------------------------------------------------- |
---|
726 | ! nsmlt: melgin of snow [LH A27] |
---|
727 | ! (T>T0: ->NR) |
---|
728 | !------------------------------------------------------------------- |
---|
729 | if(qrs(i,k,2).gt.qcrmin) then |
---|
730 | sfac = rslope(i,k,2)*n0s*n0sfac(i,k)*mstep(i)/qrs(i,k,2) |
---|
731 | ncr(i,k,3) = ncr(i,k,3) - sfac*psmlt(i,k) |
---|
732 | endif |
---|
733 | qrs(i,k,2) = qrs(i,k,2) + psmlt(i,k) |
---|
734 | qrs(i,k,1) = qrs(i,k,1) - psmlt(i,k) |
---|
735 | t(i,k) = t(i,k) + xlf/cpm(i,k)*psmlt(i,k) |
---|
736 | endif |
---|
737 | enddo |
---|
738 | enddo |
---|
739 | !--------------------------------------------------------------- |
---|
740 | ! Vice [ms-1] : fallout of ice crystal [HDC 5a] |
---|
741 | !--------------------------------------------------------------- |
---|
742 | do k = kte, kts, -1 |
---|
743 | do i = its, ite |
---|
744 | if(qci(i,k,2).le.0.) then |
---|
745 | work1c(i,k) = 0. |
---|
746 | else |
---|
747 | xmi = den(i,k)*qci(i,k,2)/xni(i,k) |
---|
748 | diameter = max(min(dicon * sqrt(xmi),dimax), 1.e-25) |
---|
749 | work1c(i,k) = 1.49e4*exp(log(diameter)*(1.31)) |
---|
750 | endif |
---|
751 | enddo |
---|
752 | enddo |
---|
753 | ! |
---|
754 | ! forward semi-laglangian scheme (JH), PCM (piecewise constant), (linear) |
---|
755 | ! |
---|
756 | do k = kte, kts, -1 |
---|
757 | do i = its, ite |
---|
758 | denqci(i,k) = den(i,k)*qci(i,k,2) |
---|
759 | enddo |
---|
760 | enddo |
---|
761 | call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,work1c,denqci, & |
---|
762 | delqi,dtcld,1,0) |
---|
763 | do k = kts, kte |
---|
764 | do i = its, ite |
---|
765 | qci(i,k,2) = max(denqci(i,k)/den(i,k),0.) |
---|
766 | enddo |
---|
767 | enddo |
---|
768 | do i = its, ite |
---|
769 | fallc(i,1) = delqi(i)/delz(i,1)/dtcld |
---|
770 | enddo |
---|
771 | ! |
---|
772 | !---------------------------------------------------------------- |
---|
773 | ! rain (unit is mm/sec;kgm-2s-1: /1000*delt ===> m)==> mm for wrf |
---|
774 | ! |
---|
775 | do i = its, ite |
---|
776 | fallsum = fall(i,1,1)+fall(i,1,2)+fallc(i,1) |
---|
777 | fallsum_qsi = fall(i,1,2)+fallc(i,1) |
---|
778 | if(fallsum.gt.0.) then |
---|
779 | rainncv(i) = fallsum*delz(i,1)/denr*dtcld*1000. + rainncv(i) |
---|
780 | rain(i) = fallsum*delz(i,1)/denr*dtcld*1000.+rain(i) |
---|
781 | endif |
---|
782 | if(fallsum_qsi.gt.0.) then |
---|
783 | tstepsnow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + tstepsnow(i) |
---|
784 | if (PRESENT (snowncv) .and. PRESENT (snow)) then |
---|
785 | snowncv(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + snowncv(i) |
---|
786 | snow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000.+snow(i) |
---|
787 | endif |
---|
788 | endif |
---|
789 | ! if(fallsum.gt.0.)sr(i)= snowncv(i)/(rainncv(i)+1.e-12) |
---|
790 | if(fallsum.gt.0.)sr(i)= tstepsnow(i)/(rainncv(i)+1.e-12) |
---|
791 | enddo |
---|
792 | ! |
---|
793 | !--------------------------------------------------------------- |
---|
794 | ! pimlt: instantaneous melting of cloud ice [HL A47] [RH83 A28] |
---|
795 | ! (T>T0: QI->QC) |
---|
796 | !--------------------------------------------------------------- |
---|
797 | do k = kts, kte |
---|
798 | do i = its, ite |
---|
799 | supcol = t0c-t(i,k) |
---|
800 | xlf = xls-xl(i,k) |
---|
801 | if(supcol.lt.0.) xlf = xlf0 |
---|
802 | if(supcol.lt.0 .and. qci(i,k,2).gt.0.) then |
---|
803 | qci(i,k,1) = qci(i,k,1)+qci(i,k,2) |
---|
804 | !--------------------------------------------------------------- |
---|
805 | ! nimlt: instantaneous melting of cloud ice [LH A18] |
---|
806 | ! (T>T0: ->NC) |
---|
807 | !-------------------------------------------------------------- |
---|
808 | ncr(i,k,2) = ncr(i,k,2) + xni(i,k) |
---|
809 | t(i,k) = t(i,k) - xlf/cpm(i,k)*qci(i,k,2) |
---|
810 | qci(i,k,2) = 0. |
---|
811 | endif |
---|
812 | !--------------------------------------------------------------- |
---|
813 | ! pihmf: homogeneous freezing of cloud water below -40c [HL A45] |
---|
814 | ! (T<-40C: QC->QI) |
---|
815 | !--------------------------------------------------------------- |
---|
816 | if(supcol.gt.40. .and. qci(i,k,1).gt.0.) then |
---|
817 | qci(i,k,2) = qci(i,k,2) + qci(i,k,1) |
---|
818 | !--------------------------------------------------------------- |
---|
819 | ! nihmf: homogeneous of cloud water below -40c [LH A17] |
---|
820 | ! (T<-40C: NC->) |
---|
821 | !--------------------------------------------------------------- |
---|
822 | if(ncr(i,k,2).gt.0.) ncr(i,k,2) = 0. |
---|
823 | t(i,k) = t(i,k) + xlf/cpm(i,k)*qci(i,k,1) |
---|
824 | qci(i,k,1) = 0. |
---|
825 | endif |
---|
826 | !--------------------------------------------------------------- |
---|
827 | ! pihtf: heterogeneous freezing of cloud water [HL A44] |
---|
828 | ! (T0>T>-40C: QC->QI) |
---|
829 | !--------------------------------------------------------------- |
---|
830 | if(supcol.gt.0. .and. qci(i,k,1).gt.0.) then |
---|
831 | supcolt=min(supcol,70.) |
---|
832 | pfrzdtc = min(pi*pi*pfrz1*(exp(pfrz2*supcolt)-1.)*denr/den(i,k) & |
---|
833 | *ncr(i,k,2)*rslopec3(i,k)*rslopec3(i,k)/18.*dtcld,qci(i,k,1)) |
---|
834 | !--------------------------------------------------------------- |
---|
835 | ! nihtf: heterogeneous of cloud water [LH A16] |
---|
836 | ! (T0>T>-40C: NC->) |
---|
837 | !--------------------------------------------------------------- |
---|
838 | if(ncr(i,k,2).gt.ncmin) then |
---|
839 | nfrzdtc = min(pi*pfrz1*(exp(pfrz2*supcolt)-1.)*ncr(i,k,2) & |
---|
840 | *rslopec3(i,k)/6.*dtcld,ncr(i,k,2)) |
---|
841 | ncr(i,k,2) = ncr(i,k,2) - nfrzdtc |
---|
842 | endif |
---|
843 | qci(i,k,2) = qci(i,k,2) + pfrzdtc |
---|
844 | t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtc |
---|
845 | qci(i,k,1) = qci(i,k,1)-pfrzdtc |
---|
846 | endif |
---|
847 | !--------------------------------------------------------------- |
---|
848 | ! psfrz: freezing of rain water [HL A20] [LFO 45] |
---|
849 | ! (T<T0, QR->QS) |
---|
850 | !--------------------------------------------------------------- |
---|
851 | if(supcol.gt.0. .and. qrs(i,k,1).gt.0.) then |
---|
852 | supcolt=min(supcol,70.) |
---|
853 | pfrzdtr = min(140.*(pi*pi)*pfrz1*ncr(i,k,3)*denr/den(i,k) & |
---|
854 | *(exp(pfrz2*supcolt)-1.)*rslope3(i,k,1)*rslope3(i,k,1) & |
---|
855 | *dtcld,qrs(i,k,1)) |
---|
856 | !--------------------------------------------------------------- |
---|
857 | ! nsfrz: freezing of rain water [LH A26] |
---|
858 | ! (T<T0, NR-> ) |
---|
859 | !--------------------------------------------------------------- |
---|
860 | if(ncr(i,k,3).gt.nrmin) then |
---|
861 | nfrzdtr = min(4.*pi*pfrz1*ncr(i,k,3)*(exp(pfrz2*supcolt)-1.) & |
---|
862 | *rslope3(i,k,1)*dtcld,ncr(i,k,3)) |
---|
863 | ncr(i,k,3) = ncr(i,k,3)-nfrzdtr |
---|
864 | endif |
---|
865 | qrs(i,k,2) = qrs(i,k,2) + pfrzdtr |
---|
866 | t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtr |
---|
867 | qrs(i,k,1) = qrs(i,k,1)-pfrzdtr |
---|
868 | endif |
---|
869 | enddo |
---|
870 | enddo |
---|
871 | ! |
---|
872 | do k = kts, kte |
---|
873 | do i = its, ite |
---|
874 | ncr(i,k,2) = max(ncr(i,k,2),0.0) |
---|
875 | ncr(i,k,3) = max(ncr(i,k,3),0.0) |
---|
876 | enddo |
---|
877 | enddo |
---|
878 | !---------------------------------------------------------------- |
---|
879 | ! update the slope parameters for microphysics computation |
---|
880 | ! |
---|
881 | do k = kts, kte |
---|
882 | do i = its, ite |
---|
883 | qrs_tmp(i,k,1) = qrs(i,k,1) |
---|
884 | qrs_tmp(i,k,2) = qrs(i,k,2) |
---|
885 | ncr_tmp(i,k) = ncr(i,k,3) |
---|
886 | enddo |
---|
887 | enddo |
---|
888 | call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, & |
---|
889 | rslope3,work1,workn,its,ite,kts,kte) |
---|
890 | do k = kts, kte |
---|
891 | do i = its, ite |
---|
892 | !----------------------------------------------------------------- |
---|
893 | ! compute the mean-volume drop diameter [LH A10] |
---|
894 | ! for raindrop distribution |
---|
895 | !----------------------------------------------------------------- |
---|
896 | avedia(i,k,2) = rslope(i,k,1)*((24.)**(.3333333)) |
---|
897 | if(qci(i,k,1).le.qmin .or. ncr(i,k,2).le.ncmin) then |
---|
898 | rslopec(i,k) = rslopecmax |
---|
899 | rslopec2(i,k) = rslopec2max |
---|
900 | rslopec3(i,k) = rslopec3max |
---|
901 | else |
---|
902 | rslopec(i,k) = 1./lamdac(qci(i,k,1),den(i,k),ncr(i,k,2)) |
---|
903 | rslopec2(i,k) = rslopec(i,k)*rslopec(i,k) |
---|
904 | rslopec3(i,k) = rslopec2(i,k)*rslopec(i,k) |
---|
905 | endif |
---|
906 | !-------------------------------------------------------------------- |
---|
907 | ! compute the mean-volume drop diameter [LH A7] |
---|
908 | ! for cloud-droplet distribution |
---|
909 | !-------------------------------------------------------------------- |
---|
910 | avedia(i,k,1) = rslopec(i,k) |
---|
911 | enddo |
---|
912 | enddo |
---|
913 | !---------------------------------------------------------------- |
---|
914 | ! work1: the thermodynamic term in the denominator associated with |
---|
915 | ! heat conduction and vapor diffusion |
---|
916 | ! (ry88, y93, h85) |
---|
917 | ! work2: parameter associated with the ventilation effects(y93) |
---|
918 | ! |
---|
919 | do k = kts, kte |
---|
920 | do i = its, ite |
---|
921 | ! work1(i,k,1) = diffac(xl(i,k),p(i,k),t(i,k),den(i,k),qs(i,k,1)) |
---|
922 | work1(i,k,1) = ((((den(i,k))*(xl(i,k))*(xl(i,k)))*((t(i,k))+120.) & |
---|
923 | *(den(i,k)))/(1.414e3*(1.496e-6*((t(i,k))*sqrt(t(i,k))))& |
---|
924 | *(den(i,k))*(rv*(t(i,k))*(t(i,k))))) & |
---|
925 | + p(i,k)/((qs(i,k,1))*(8.794e-5*exp(log(t(i,k))*(1.81)))) |
---|
926 | ! work1(i,k,2) = diffac(xls,p(i,k),t(i,k),den(i,k),qs(i,k,2)) |
---|
927 | work1(i,k,2) = ((((den(i,k))*(xls)*(xls))*((t(i,k))+120.)*(den(i,k)))& |
---|
928 | /(1.414e3*(1.496e-6*((t(i,k))*sqrt(t(i,k))))*(den(i,k)) & |
---|
929 | *(rv*(t(i,k))*(t(i,k)))) & |
---|
930 | + p(i,k)/(qs(i,k,2)*(8.794e-5*exp(log(t(i,k))*(1.81))))) |
---|
931 | ! work2(i,k) = venfac(p(i,k),t(i,k),den(i,k)) |
---|
932 | work2(i,k) = (exp(.3333333*log(((1.496e-6 * ((t(i,k))*sqrt(t(i,k)))) & |
---|
933 | *p(i,k))/(((t(i,k))+120.)*den(i,k)*(8.794e-5 & |
---|
934 | *exp(log(t(i,k))*(1.81))))))*sqrt(sqrt(den0/(den(i,k))))) & |
---|
935 | /sqrt((1.496e-6*((t(i,k))*sqrt(t(i,k)))) & |
---|
936 | /(((t(i,k))+120.)*den(i,k))) |
---|
937 | enddo |
---|
938 | enddo |
---|
939 | ! |
---|
940 | !=============================================================== |
---|
941 | ! |
---|
942 | ! warm rain processes |
---|
943 | ! |
---|
944 | ! - follows the processes in RH83 and LFO except for autoconcersion |
---|
945 | ! |
---|
946 | !=============================================================== |
---|
947 | ! |
---|
948 | do k = kts, kte |
---|
949 | do i = its, ite |
---|
950 | supsat = max(q(i,k),qmin)-qs(i,k,1) |
---|
951 | satdt = supsat/dtcld |
---|
952 | !--------------------------------------------------------------- |
---|
953 | ! praut: auto conversion rate from cloud to rain [LH 9] [CP 17] |
---|
954 | ! (QC->QR) |
---|
955 | !--------------------------------------------------------------- |
---|
956 | lencon = 2.7e-2*den(i,k)*qci(i,k,1)*(1.e20/16.*rslopec2(i,k) & |
---|
957 | *rslopec2(i,k)-0.4) |
---|
958 | lenconcr = max(1.2*lencon,qcrmin) |
---|
959 | if(avedia(i,k,1).gt.di15) then |
---|
960 | taucon = 3.7/den(i,k)/qci(i,k,1)/(0.5e6*rslopec(i,k)-7.5) |
---|
961 | praut(i,k) = lencon/taucon |
---|
962 | praut(i,k) = min(max(praut(i,k),0.),qci(i,k,1)/dtcld) |
---|
963 | !--------------------------------------------------------------- |
---|
964 | ! nraut: auto conversion rate from cloud to rain [LH A6][CP 18 & 19] |
---|
965 | ! (NC->NR) |
---|
966 | !--------------------------------------------------------------- |
---|
967 | nraut(i,k) = 3.5e9*den(i,k)*praut(i,k) |
---|
968 | if(qrs(i,k,1).gt.lenconcr) & |
---|
969 | nraut(i,k) = ncr(i,k,3)/qrs(i,k,1)*praut(i,k) |
---|
970 | nraut(i,k) = min(nraut(i,k),ncr(i,k,2)/dtcld) |
---|
971 | endif |
---|
972 | !--------------------------------------------------------------- |
---|
973 | ! pracw: accretion of cloud water by rain [LH 10][CP 22 & 23] |
---|
974 | ! (QC->QR) |
---|
975 | ! nracw: accretion of cloud water by rain [LH A9] |
---|
976 | ! (NC->) |
---|
977 | !--------------------------------------------------------------- |
---|
978 | if(qrs(i,k,1).ge.lenconcr) then |
---|
979 | if(avedia(i,k,2).ge.di100) then |
---|
980 | nracw(i,k) = min(ncrk1*ncr(i,k,2)*ncr(i,k,3)*(rslopec3(i,k) & |
---|
981 | + 24.*rslope3(i,k,1)),ncr(i,k,2)/dtcld) |
---|
982 | pracw(i,k) = min(pi/6.*(denr/den(i,k))*ncrk1*ncr(i,k,2) & |
---|
983 | *ncr(i,k,3)*rslopec3(i,k)*(2.*rslopec3(i,k) & |
---|
984 | + 24.*rslope3(i,k,1)),qci(i,k,1)/dtcld) |
---|
985 | else |
---|
986 | nracw(i,k) = min(ncrk2*ncr(i,k,2)*ncr(i,k,3)*(2.*rslopec3(i,k) & |
---|
987 | *rslopec3(i,k)+5040.*rslope3(i,k,1) & |
---|
988 | *rslope3(i,k,1)),ncr(i,k,2)/dtcld) |
---|
989 | pracw(i,k) = min(pi/6.*(denr/den(i,k))*ncrk2*ncr(i,k,2) & |
---|
990 | *ncr(i,k,3)*rslopec3(i,k)*(6.*rslopec3(i,k) & |
---|
991 | *rslopec3(i,k)+5040.*rslope3(i,k,1) & |
---|
992 | *rslope3(i,k,1)),qci(i,k,1)/dtcld) |
---|
993 | endif |
---|
994 | endif |
---|
995 | !---------------------------------------------------------------- |
---|
996 | ! nccol: self collection of cloud water [LH A8][CP 24 & 25] |
---|
997 | ! (NC->) |
---|
998 | !---------------------------------------------------------------- |
---|
999 | if(avedia(i,k,1).ge.di100) then |
---|
1000 | nccol(i,k) = ncrk1*ncr(i,k,2)*ncr(i,k,2)*rslopec3(i,k) |
---|
1001 | else |
---|
1002 | nccol(i,k) = 2.*ncrk2*ncr(i,k,2)*ncr(i,k,2)*rslopec3(i,k) & |
---|
1003 | *rslopec3(i,k) |
---|
1004 | endif |
---|
1005 | !---------------------------------------------------------------- |
---|
1006 | ! nrcol: self collection of rain-drops and break-up [LH A21][CP 24 & 25] |
---|
1007 | ! (NR->) |
---|
1008 | !---------------------------------------------------------------- |
---|
1009 | if(qrs(i,k,1).ge.lenconcr) then |
---|
1010 | if(avedia(i,k,2).lt.di100) then |
---|
1011 | nrcol(i,k) = 5040.*ncrk2*ncr(i,k,3)*ncr(i,k,3)*rslope3(i,k,1) & |
---|
1012 | *rslope3(i,k,1) |
---|
1013 | elseif(avedia(i,k,2).ge.di100 .and. avedia(i,k,2).lt.di600) then |
---|
1014 | nrcol(i,k) = 24.*ncrk1*ncr(i,k,3)*ncr(i,k,3)*rslope3(i,k,1) |
---|
1015 | elseif(avedia(i,k,2).ge.di600 .and. avedia(i,k,2).lt.di2000) then |
---|
1016 | coecol = -2.5e3*(avedia(i,k,2)-di600) |
---|
1017 | nrcol(i,k) = 24.*exp(coecol)*ncrk1*ncr(i,k,3)*ncr(i,k,3) & |
---|
1018 | *rslope3(i,k,1) |
---|
1019 | else |
---|
1020 | nrcol(i,k) = 0. |
---|
1021 | endif |
---|
1022 | endif |
---|
1023 | !--------------------------------------------------------------- |
---|
1024 | ! prevp: evaporation/condensation rate of rain [HL A41] |
---|
1025 | ! (QV->QR or QR->QV) |
---|
1026 | !--------------------------------------------------------------- |
---|
1027 | if(qrs(i,k,1).gt.0.) then |
---|
1028 | coeres = rslope(i,k,1)*sqrt(rslope(i,k,1)*rslopeb(i,k,1)) |
---|
1029 | prevp(i,k) = (rh(i,k,1)-1.)*ncr(i,k,3)*(precr1*rslope(i,k,1) & |
---|
1030 | +precr2*work2(i,k)*coeres)/work1(i,k,1) |
---|
1031 | if(prevp(i,k).lt.0.) then |
---|
1032 | prevp(i,k) = max(prevp(i,k),-qrs(i,k,1)/dtcld) |
---|
1033 | prevp(i,k) = max(prevp(i,k),satdt/2) |
---|
1034 | !---------------------------------------------------------------- |
---|
1035 | ! Nrevp: evaporation/condensation rate of rain [LH A14] |
---|
1036 | ! (NR->NCCN) |
---|
1037 | !---------------------------------------------------------------- |
---|
1038 | if(prevp(i,k).eq.-qrs(i,k,1)/dtcld) then |
---|
1039 | ncr(i,k,1) = ncr(i,k,1) + ncr(i,k,3) |
---|
1040 | ncr(i,k,3) = 0. |
---|
1041 | endif |
---|
1042 | else |
---|
1043 | ! |
---|
1044 | prevp(i,k) = min(prevp(i,k),satdt/2) |
---|
1045 | endif |
---|
1046 | endif |
---|
1047 | enddo |
---|
1048 | enddo |
---|
1049 | ! |
---|
1050 | !=============================================================== |
---|
1051 | ! |
---|
1052 | ! cold rain processes |
---|
1053 | ! |
---|
1054 | ! - follows the revised ice microphysics processes in HDC |
---|
1055 | ! - the processes same as in RH83 and RH84 and LFO behave |
---|
1056 | ! following ice crystal hapits defined in HDC, inclduing |
---|
1057 | ! intercept parameter for snow (n0s), ice crystal number |
---|
1058 | ! concentration (ni), ice nuclei number concentration |
---|
1059 | ! (n0i), ice diameter (d) |
---|
1060 | ! |
---|
1061 | !=============================================================== |
---|
1062 | ! |
---|
1063 | rdtcld = 1./dtcld |
---|
1064 | do k = kts, kte |
---|
1065 | do i = its, ite |
---|
1066 | supcol = t0c-t(i,k) |
---|
1067 | n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.) |
---|
1068 | supsat = max(q(i,k),qmin)-qs(i,k,2) |
---|
1069 | satdt = supsat/dtcld |
---|
1070 | ifsat = 0 |
---|
1071 | !------------------------------------------------------------- |
---|
1072 | ! Ni: ice crystal number concentraiton [HDC 5c] |
---|
1073 | !------------------------------------------------------------- |
---|
1074 | ! xni(i,k) = min(max(5.38e7*(den(i,k) & |
---|
1075 | ! *max(qci(i,k,2),qmin))**0.75,1.e3),1.e6) |
---|
1076 | temp = (den(i,k)*max(qci(i,k,2),qmin)) |
---|
1077 | temp = sqrt(sqrt(temp*temp*temp)) |
---|
1078 | xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6) |
---|
1079 | eacrs = exp(0.07*(-supcol)) |
---|
1080 | ! |
---|
1081 | if(supcol.gt.0) then |
---|
1082 | if(qrs(i,k,2).gt.qcrmin .and. qci(i,k,2).gt.qmin) then |
---|
1083 | xmi = den(i,k)*qci(i,k,2)/xni(i,k) |
---|
1084 | diameter = min(dicon * sqrt(xmi),dimax) |
---|
1085 | vt2i = 1.49e4*diameter**1.31 |
---|
1086 | vt2s = pvts*rslopeb(i,k,2)*denfac(i,k) |
---|
1087 | !------------------------------------------------------------- |
---|
1088 | ! psaci: Accretion of cloud ice by rain [HDC 10] |
---|
1089 | ! (T<T0: QI->QS) |
---|
1090 | !------------------------------------------------------------- |
---|
1091 | acrfac = 2.*rslope3(i,k,2)+2.*diameter*rslope2(i,k,2) & |
---|
1092 | + diameter**2*rslope(i,k,2) |
---|
1093 | psaci(i,k) = pi*qci(i,k,2)*eacrs*n0s*n0sfac(i,k)*abs(vt2s-vt2i) & |
---|
1094 | *acrfac/4. |
---|
1095 | endif |
---|
1096 | endif |
---|
1097 | !------------------------------------------------------------- |
---|
1098 | ! psacw: Accretion of cloud water by snow [HL A7] [LFO 24] |
---|
1099 | ! (T<T0: QC->QS, and T>=T0: QC->QR) |
---|
1100 | !------------------------------------------------------------- |
---|
1101 | if(qrs(i,k,2).gt.qcrmin .and. qci(i,k,1).gt.qmin) then |
---|
1102 | psacw(i,k) = min(pacrc*n0sfac(i,k)*rslope3(i,k,2)*rslopeb(i,k,2) & |
---|
1103 | *qci(i,k,1)*denfac(i,k),qci(i,k,1)*rdtcld) |
---|
1104 | endif |
---|
1105 | !------------------------------------------------------------- |
---|
1106 | ! nsacw: Accretion of cloud water by snow [LH A12] |
---|
1107 | ! (NC ->) |
---|
1108 | !------------------------------------------------------------- |
---|
1109 | if(qrs(i,k,2).gt.qcrmin .and. ncr(i,k,2).gt.ncmin) then |
---|
1110 | nsacw(i,k) = min(pacrc*n0sfac(i,k)*rslope3(i,k,2)*rslopeb(i,k,2) & |
---|
1111 | *ncr(i,k,2)*denfac(i,k),ncr(i,k,2)/dtcld) |
---|
1112 | endif |
---|
1113 | if(supcol.le.0) then |
---|
1114 | xlf = xlf0 |
---|
1115 | !-------------------------------------------------------------- |
---|
1116 | ! nseml: Enhanced melting of snow by accretion of water [LH A29] |
---|
1117 | ! (T>=T0: ->NR) |
---|
1118 | !-------------------------------------------------------------- |
---|
1119 | if (qrs(i,k,2).gt.qcrmin) then |
---|
1120 | sfac = rslope(i,k,2)*n0s*n0sfac(i,k)/qrs(i,k,2) |
---|
1121 | nseml(i,k) = -sfac*min(max(cliq*supcol*(psacw(i,k))/xlf & |
---|
1122 | ,-qrs(i,k,2)/dtcld),0.) |
---|
1123 | endif |
---|
1124 | endif |
---|
1125 | if(supcol.gt.0) then |
---|
1126 | !------------------------------------------------------------- |
---|
1127 | ! pidep: Deposition/Sublimation rate of ice [HDC 9] |
---|
1128 | ! (T<T0: QV->QI or QI->QV) |
---|
1129 | !------------------------------------------------------------- |
---|
1130 | if(qci(i,k,2).gt.0 .and. ifsat.ne.1) then |
---|
1131 | xmi = den(i,k)*qci(i,k,2)/xni(i,k) |
---|
1132 | diameter = dicon * sqrt(xmi) |
---|
1133 | pidep(i,k) = 4.*diameter*xni(i,k)*(rh(i,k,2)-1.)/work1(i,k,2) |
---|
1134 | supice = satdt-prevp(i,k) |
---|
1135 | if(pidep(i,k).lt.0.) then |
---|
1136 | ! pidep(i,k) = max(max(pidep(i,k),satdt/2),supice) |
---|
1137 | ! pidep(i,k) = max(pidep(i,k),-qci(i,k,2)/dtcld) |
---|
1138 | pidep(i,k) = max(max(pidep(i,k),satdt*.5),supice) |
---|
1139 | pidep(i,k) = max(pidep(i,k),-qci(i,k,2)*rdtcld) |
---|
1140 | else |
---|
1141 | ! pidep(i,k) = min(min(pidep(i,k),satdt/2),supice) |
---|
1142 | pidep(i,k) = min(min(pidep(i,k),satdt*.5),supice) |
---|
1143 | endif |
---|
1144 | if(abs(prevp(i,k)+pidep(i,k)).ge.abs(satdt)) ifsat = 1 |
---|
1145 | endif |
---|
1146 | !------------------------------------------------------------- |
---|
1147 | ! psdep: deposition/sublimation rate of snow [HDC 14] |
---|
1148 | ! (QV->QS or QS->QV) |
---|
1149 | !------------------------------------------------------------- |
---|
1150 | if(qrs(i,k,2).gt.0. .and. ifsat.ne.1) then |
---|
1151 | coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2)) |
---|
1152 | psdep(i,k) = (rh(i,k,2)-1.)*n0sfac(i,k)*(precs1*rslope2(i,k,2) & |
---|
1153 | + precs2*work2(i,k)*coeres)/work1(i,k,2) |
---|
1154 | supice = satdt-prevp(i,k)-pidep(i,k) |
---|
1155 | if(psdep(i,k).lt.0.) then |
---|
1156 | ! psdep(i,k) = max(psdep(i,k),-qrs(i,k,2)/dtcld) |
---|
1157 | ! psdep(i,k) = max(max(psdep(i,k),satdt/2),supice) |
---|
1158 | psdep(i,k) = max(psdep(i,k),-qrs(i,k,2)*rdtcld) |
---|
1159 | psdep(i,k) = max(max(psdep(i,k),satdt*.5),supice) |
---|
1160 | else |
---|
1161 | ! psdep(i,k) = min(min(psdep(i,k),satdt/2),supice) |
---|
1162 | psdep(i,k) = min(min(psdep(i,k),satdt*.5),supice) |
---|
1163 | endif |
---|
1164 | if(abs(prevp(i,k)+pidep(i,k)+psdep(i,k)).ge.abs(satdt)) ifsat = 1 |
---|
1165 | endif |
---|
1166 | !------------------------------------------------------------- |
---|
1167 | ! pigen: generation(nucleation) of ice from vapor [HL A50] [HDC 7-8] |
---|
1168 | ! (T<T0: QV->QI) |
---|
1169 | !------------------------------------------------------------- |
---|
1170 | if(supsat.gt.0 .and. ifsat.ne.1) then |
---|
1171 | supice = satdt-prevp(i,k)-pidep(i,k)-psdep(i,k) |
---|
1172 | xni0 = 1.e3*exp(0.1*supcol) |
---|
1173 | roqi0 = 4.92e-11*exp(log(xni0)*(1.33)) |
---|
1174 | pigen(i,k) = max(0.,(roqi0/den(i,k)-max(qci(i,k,2),0.))*rdtcld) |
---|
1175 | pigen(i,k) = min(min(pigen(i,k),satdt),supice) |
---|
1176 | endif |
---|
1177 | ! |
---|
1178 | !------------------------------------------------------------- |
---|
1179 | ! psaut: conversion(aggregation) of ice to snow [HDC 12] |
---|
1180 | ! (T<T0: QI->QS) |
---|
1181 | !------------------------------------------------------------- |
---|
1182 | if(qci(i,k,2).gt.0.) then |
---|
1183 | qimax = roqimax/den(i,k) |
---|
1184 | ! psaut(i,k) = max(0.,(qci(i,k,2)-qimax)/dtcld) |
---|
1185 | psaut(i,k) = max(0.,(qci(i,k,2)-qimax)*rdtcld) |
---|
1186 | endif |
---|
1187 | endif |
---|
1188 | !------------------------------------------------------------- |
---|
1189 | ! psevp: Evaporation of melting snow [HL A35] [RH83 A27] |
---|
1190 | ! (T>T0: QS->QV) |
---|
1191 | !------------------------------------------------------------- |
---|
1192 | if(supcol.lt.0.) then |
---|
1193 | if(qrs(i,k,2).gt.0. .and. rh(i,k,1).lt.1.) & |
---|
1194 | psevp(i,k) = psdep(i,k)*work1(i,k,2)/work1(i,k,1) |
---|
1195 | ! psevp(i,k) = min(max(psevp(i,k),-qrs(i,k,2)/dtcld),0.) |
---|
1196 | psevp(i,k) = min(max(psevp(i,k),-qrs(i,k,2)*rdtcld),0.) |
---|
1197 | endif |
---|
1198 | enddo |
---|
1199 | enddo |
---|
1200 | ! |
---|
1201 | ! |
---|
1202 | !---------------------------------------------------------------- |
---|
1203 | ! check mass conservation of generation terms and feedback to the |
---|
1204 | ! large scale |
---|
1205 | ! |
---|
1206 | do k = kts, kte |
---|
1207 | do i = its, ite |
---|
1208 | if(t(i,k).le.t0c) then |
---|
1209 | ! |
---|
1210 | ! Q_cloud water |
---|
1211 | ! |
---|
1212 | value = max(qmin,qci(i,k,1)) |
---|
1213 | source = (praut(i,k)+pracw(i,k)+psacw(i,k))*dtcld |
---|
1214 | if (source.gt.value) then |
---|
1215 | factor = value/source |
---|
1216 | praut(i,k) = praut(i,k)*factor |
---|
1217 | pracw(i,k) = pracw(i,k)*factor |
---|
1218 | psacw(i,k) = psacw(i,k)*factor |
---|
1219 | endif |
---|
1220 | ! |
---|
1221 | ! Q_cloud ice |
---|
1222 | ! |
---|
1223 | value = max(qmin,qci(i,k,2)) |
---|
1224 | source = (psaut(i,k)+psaci(i,k)-pigen(i,k)-pidep(i,k))*dtcld |
---|
1225 | if (source.gt.value) then |
---|
1226 | factor = value/source |
---|
1227 | psaut(i,k) = psaut(i,k)*factor |
---|
1228 | psaci(i,k) = psaci(i,k)*factor |
---|
1229 | pigen(i,k) = pigen(i,k)*factor |
---|
1230 | pidep(i,k) = pidep(i,k)*factor |
---|
1231 | endif |
---|
1232 | ! |
---|
1233 | ! Q_rain |
---|
1234 | ! |
---|
1235 | ! |
---|
1236 | value = max(qmin,qrs(i,k,1)) |
---|
1237 | source = (-praut(i,k)-pracw(i,k)-prevp(i,k))*dtcld |
---|
1238 | if (source.gt.value) then |
---|
1239 | factor = value/source |
---|
1240 | praut(i,k) = praut(i,k)*factor |
---|
1241 | pracw(i,k) = pracw(i,k)*factor |
---|
1242 | prevp(i,k) = prevp(i,k)*factor |
---|
1243 | endif |
---|
1244 | ! |
---|
1245 | ! Q_snow |
---|
1246 | ! |
---|
1247 | value = max(qmin,qrs(i,k,2)) |
---|
1248 | source = (-psdep(i,k)-psaut(i,k)-psaci(i,k)-psacw(i,k))*dtcld |
---|
1249 | if (source.gt.value) then |
---|
1250 | factor = value/source |
---|
1251 | psdep(i,k) = psdep(i,k)*factor |
---|
1252 | psaut(i,k) = psaut(i,k)*factor |
---|
1253 | psaci(i,k) = psaci(i,k)*factor |
---|
1254 | psacw(i,k) = psacw(i,k)*factor |
---|
1255 | endif |
---|
1256 | ! |
---|
1257 | ! N_cloud |
---|
1258 | ! |
---|
1259 | value = max(ncmin,ncr(i,k,2)) |
---|
1260 | source = (+nraut(i,k)+nccol(i,k)+nracw(i,k)+nsacw(i,k))*dtcld |
---|
1261 | if (source.gt.value) then |
---|
1262 | factor = value/source |
---|
1263 | nraut(i,k) = nraut(i,k)*factor |
---|
1264 | nccol(i,k) = nccol(i,k)*factor |
---|
1265 | nracw(i,k) = nracw(i,k)*factor |
---|
1266 | nsacw(i,k) = nsacw(i,k)*factor |
---|
1267 | endif |
---|
1268 | ! |
---|
1269 | ! N_rain |
---|
1270 | ! |
---|
1271 | value = max(nrmin,ncr(i,k,3)) |
---|
1272 | source = (-nraut(i,k)+nrcol(i,k))*dtcld |
---|
1273 | if (source.gt.value) then |
---|
1274 | factor = value/source |
---|
1275 | nraut(i,k) = nraut(i,k)*factor |
---|
1276 | nrcol(i,k) = nrcol(i,k)*factor |
---|
1277 | endif |
---|
1278 | ! |
---|
1279 | work2(i,k)=-(prevp(i,k)+psdep(i,k)+pigen(i,k)+pidep(i,k)) |
---|
1280 | ! update |
---|
1281 | q(i,k) = q(i,k)+work2(i,k)*dtcld |
---|
1282 | qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k)+psacw(i,k) & |
---|
1283 | )*dtcld,0.) |
---|
1284 | qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k)+prevp(i,k) & |
---|
1285 | )*dtcld,0.) |
---|
1286 | qci(i,k,2) = max(qci(i,k,2)-(psaut(i,k)+psaci(i,k)-pigen(i,k) & |
---|
1287 | -pidep(i,k))*dtcld,0.) |
---|
1288 | qrs(i,k,2) = max(qrs(i,k,2)+(psdep(i,k)+psaut(i,k)+psaci(i,k) & |
---|
1289 | +psacw(i,k))*dtcld,0.) |
---|
1290 | ncr(i,k,2) = max(ncr(i,k,2)+(-nraut(i,k)-nccol(i,k)-nracw(i,k) & |
---|
1291 | -nsacw(i,k))*dtcld,0.) |
---|
1292 | ncr(i,k,3) = max(ncr(i,k,3)+(nraut(i,k)-nrcol(i,k)) & |
---|
1293 | *dtcld,0.) |
---|
1294 | xlf = xls-xl(i,k) |
---|
1295 | xlwork2 = -xls*(psdep(i,k)+pidep(i,k)+pigen(i,k)) & |
---|
1296 | -xl(i,k)*prevp(i,k)-xlf*psacw(i,k) |
---|
1297 | t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld |
---|
1298 | else |
---|
1299 | ! |
---|
1300 | ! Q_cloud water |
---|
1301 | ! |
---|
1302 | value = max(qmin,qci(i,k,1)) |
---|
1303 | source=(praut(i,k)+pracw(i,k)+psacw(i,k))*dtcld |
---|
1304 | if (source.gt.value) then |
---|
1305 | factor = value/source |
---|
1306 | praut(i,k) = praut(i,k)*factor |
---|
1307 | pracw(i,k) = pracw(i,k)*factor |
---|
1308 | psacw(i,k) = psacw(i,k)*factor |
---|
1309 | endif |
---|
1310 | ! |
---|
1311 | ! Q_rain |
---|
1312 | ! |
---|
1313 | value = max(qmin,qrs(i,k,1)) |
---|
1314 | source = (-praut(i,k)-pracw(i,k)-prevp(i,k) & |
---|
1315 | -psacw(i,k))*dtcld |
---|
1316 | if (source.gt.value) then |
---|
1317 | factor = value/source |
---|
1318 | praut(i,k) = praut(i,k)*factor |
---|
1319 | pracw(i,k) = pracw(i,k)*factor |
---|
1320 | prevp(i,k) = prevp(i,k)*factor |
---|
1321 | psacw(i,k) = psacw(i,k)*factor |
---|
1322 | endif |
---|
1323 | ! |
---|
1324 | ! Q_snow |
---|
1325 | ! |
---|
1326 | value = max(qcrmin,qrs(i,k,2)) |
---|
1327 | source=(-psevp(i,k))*dtcld |
---|
1328 | if (source.gt.value) then |
---|
1329 | factor = value/source |
---|
1330 | psevp(i,k) = psevp(i,k)*factor |
---|
1331 | endif |
---|
1332 | ! |
---|
1333 | ! N_cloud |
---|
1334 | ! |
---|
1335 | value = max(ncmin,ncr(i,k,2)) |
---|
1336 | source = (+nraut(i,k)+nccol(i,k)+nracw(i,k)+nsacw(i,k))*dtcld |
---|
1337 | if (source.gt.value) then |
---|
1338 | factor = value/source |
---|
1339 | nraut(i,k) = nraut(i,k)*factor |
---|
1340 | nccol(i,k) = nccol(i,k)*factor |
---|
1341 | nracw(i,k) = nracw(i,k)*factor |
---|
1342 | nsacw(i,k) = nsacw(i,k)*factor |
---|
1343 | endif |
---|
1344 | ! |
---|
1345 | ! N_rain |
---|
1346 | ! |
---|
1347 | value = max(nrmin,ncr(i,k,3)) |
---|
1348 | source = (-nraut(i,k)-nseml(i,k)+nrcol(i,k))*dtcld |
---|
1349 | if (source.gt.value) then |
---|
1350 | factor = value/source |
---|
1351 | nraut(i,k) = nraut(i,k)*factor |
---|
1352 | nseml(i,k) = nseml(i,k)*factor |
---|
1353 | nrcol(i,k) = nrcol(i,k)*factor |
---|
1354 | endif |
---|
1355 | work2(i,k)=-(prevp(i,k)+psevp(i,k)) |
---|
1356 | ! update |
---|
1357 | q(i,k) = q(i,k)+work2(i,k)*dtcld |
---|
1358 | qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k)+psacw(i,k) & |
---|
1359 | )*dtcld,0.) |
---|
1360 | qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k)+prevp(i,k) & |
---|
1361 | +psacw(i,k))*dtcld,0.) |
---|
1362 | qrs(i,k,2) = max(qrs(i,k,2)+psevp(i,k)*dtcld,0.) |
---|
1363 | ncr(i,k,2) = max(ncr(i,k,2)+(-nraut(i,k)-nccol(i,k)-nracw(i,k) & |
---|
1364 | -nsacw(i,k))*dtcld,0.) |
---|
1365 | ncr(i,k,3) = max(ncr(i,k,3)+(nraut(i,k)+nseml(i,k)-nrcol(i,k) & |
---|
1366 | )*dtcld,0.) |
---|
1367 | xlf = xls-xl(i,k) |
---|
1368 | xlwork2 = -xl(i,k)*(prevp(i,k)+psevp(i,k)) |
---|
1369 | t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld |
---|
1370 | endif |
---|
1371 | enddo |
---|
1372 | enddo |
---|
1373 | ! |
---|
1374 | ! Inline expansion for fpvs |
---|
1375 | ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c) |
---|
1376 | ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c) |
---|
1377 | hsub = xls |
---|
1378 | hvap = xlv0 |
---|
1379 | cvap = cpv |
---|
1380 | ttp=t0c+0.01 |
---|
1381 | dldt=cvap-cliq |
---|
1382 | xa=-dldt/rv |
---|
1383 | xb=xa+hvap/(rv*ttp) |
---|
1384 | dldti=cvap-cice |
---|
1385 | xai=-dldti/rv |
---|
1386 | xbi=xai+hsub/(rv*ttp) |
---|
1387 | do k = kts, kte |
---|
1388 | do i = its, ite |
---|
1389 | tr=ttp/t(i,k) |
---|
1390 | logtr = log(tr) |
---|
1391 | qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr)) |
---|
1392 | qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k)) |
---|
1393 | qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1)) |
---|
1394 | qs(i,k,1) = max(qs(i,k,1),qmin) |
---|
1395 | rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin) |
---|
1396 | enddo |
---|
1397 | enddo |
---|
1398 | ! |
---|
1399 | call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, & |
---|
1400 | rslope3,work1,workn,its,ite,kts,kte) |
---|
1401 | do k = kts, kte |
---|
1402 | do i = its, ite |
---|
1403 | !----------------------------------------------------------------- |
---|
1404 | ! re-compute the mean-volume drop diameter [LH A10] |
---|
1405 | ! for raindrop distribution |
---|
1406 | !----------------------------------------------------------------- |
---|
1407 | avedia(i,k,2) = rslope(i,k,1)*((24.)**(.3333333)) |
---|
1408 | !---------------------------------------------------------------- |
---|
1409 | ! Nrevp_s: evaporation/condensation rate of rain [LH A14] |
---|
1410 | ! (NR->NC) |
---|
1411 | !---------------------------------------------------------------- |
---|
1412 | if(avedia(i,k,2).le.di82) then |
---|
1413 | ncr(i,k,2) = ncr(i,k,2)+ncr(i,k,3) |
---|
1414 | ncr(i,k,3) = 0. |
---|
1415 | !---------------------------------------------------------------- |
---|
1416 | ! Prevp_s: evaporation/condensation rate of rain [LH A15] [KK 23] |
---|
1417 | ! (QR->QC) |
---|
1418 | !---------------------------------------------------------------- |
---|
1419 | qci(i,k,1) = qci(i,k,1)+qrs(i,k,1) |
---|
1420 | qrs(i,k,1) = 0. |
---|
1421 | endif |
---|
1422 | enddo |
---|
1423 | enddo |
---|
1424 | ! |
---|
1425 | do k = kts, kte |
---|
1426 | do i = its, ite |
---|
1427 | !------------------------------------------------------------------- |
---|
1428 | ! rate of change of cloud drop concentration due to CCN activation |
---|
1429 | ! pcact: QV -> QC [LH 8] [KK 14] |
---|
1430 | ! ncact: NCCN -> NC [LH A2] [KK 12] |
---|
1431 | !------------------------------------------------------------------- |
---|
1432 | if(rh(i,k,1).gt.1.) then |
---|
1433 | ncact(i,k) = max(0.,((ncr(i,k,1)+ncr(i,k,2)) & |
---|
1434 | *min(1.,(rh(i,k,1)/satmax)**actk) - ncr(i,k,2)))/dtcld |
---|
1435 | ncact(i,k) =min(ncact(i,k),max(ncr(i,k,1),0.)/dtcld) |
---|
1436 | pcact(i,k) = min(4.*pi*denr*(actr*1.E-6)**3*ncact(i,k)/ & |
---|
1437 | (3.*den(i,k)),max(q(i,k),0.)/dtcld) |
---|
1438 | q(i,k) = max(q(i,k)-pcact(i,k)*dtcld,0.) |
---|
1439 | qci(i,k,1) = max(qci(i,k,1)+pcact(i,k)*dtcld,0.) |
---|
1440 | ncr(i,k,1) = max(ncr(i,k,1)-ncact(i,k)*dtcld,0.) |
---|
1441 | ncr(i,k,2) = max(ncr(i,k,2)+ncact(i,k)*dtcld,0.) |
---|
1442 | t(i,k) = t(i,k)+pcact(i,k)*xl(i,k)/cpm(i,k)*dtcld |
---|
1443 | endif |
---|
1444 | !--------------------------------------------------------------------- |
---|
1445 | ! pcond:condensational/evaporational rate of cloud water [HL A46] [RH83 A6] |
---|
1446 | ! if there exists additional water vapor condensated/if |
---|
1447 | ! evaporation of cloud water is not enough to remove subsaturation |
---|
1448 | ! (QV->QC or QC->QV) |
---|
1449 | !--------------------------------------------------------------------- |
---|
1450 | tr=ttp/t(i,k) |
---|
1451 | qs(i,k,1)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr)) |
---|
1452 | qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k)) |
---|
1453 | qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1)) |
---|
1454 | qs(i,k,1) = max(qs(i,k,1),qmin) |
---|
1455 | work1(i,k,1) = ((max(q(i,k),qmin)-(qs(i,k,1)))/(1.+(xl(i,k)) & |
---|
1456 | *(xl(i,k))/(rv*(cpm(i,k)))*(qs(i,k,1))/((t(i,k)) & |
---|
1457 | *(t(i,k))))) |
---|
1458 | work2(i,k) = qci(i,k,1)+work1(i,k,1) |
---|
1459 | pcond(i,k) = min(max(work1(i,k,1)/dtcld,0.),max(q(i,k),0.)/dtcld) |
---|
1460 | if(qci(i,k,1).gt.0. .and. work1(i,k,1).lt.0.) & |
---|
1461 | pcond(i,k) = max(work1(i,k,1),-qci(i,k,1))/dtcld |
---|
1462 | !---------------------------------------------------------------------- |
---|
1463 | ! ncevp: evpration of Cloud number concentration [LH A3] |
---|
1464 | ! (NC->NCCN) |
---|
1465 | !---------------------------------------------------------------------- |
---|
1466 | if(pcond(i,k).eq.-qci(i,k,1)/dtcld) then |
---|
1467 | ncr(i,k,2) = 0. |
---|
1468 | ncr(i,k,1) = ncr(i,k,1)+ncr(i,k,2) |
---|
1469 | endif |
---|
1470 | ! |
---|
1471 | q(i,k) = q(i,k)-pcond(i,k)*dtcld |
---|
1472 | qci(i,k,1) = max(qci(i,k,1)+pcond(i,k)*dtcld,0.) |
---|
1473 | t(i,k) = t(i,k)+pcond(i,k)*xl(i,k)/cpm(i,k)*dtcld |
---|
1474 | enddo |
---|
1475 | enddo |
---|
1476 | ! |
---|
1477 | !---------------------------------------------------------------- |
---|
1478 | ! padding for small values |
---|
1479 | ! |
---|
1480 | do k = kts, kte |
---|
1481 | do i = its, ite |
---|
1482 | if(qci(i,k,1).le.qmin) qci(i,k,1) = 0.0 |
---|
1483 | if(qci(i,k,2).le.qmin) qci(i,k,2) = 0.0 |
---|
1484 | enddo |
---|
1485 | enddo |
---|
1486 | enddo ! big loops |
---|
1487 | END SUBROUTINE wdm52d |
---|
1488 | ! ................................................................... |
---|
1489 | REAL FUNCTION rgmma(x) |
---|
1490 | !------------------------------------------------------------------- |
---|
1491 | IMPLICIT NONE |
---|
1492 | !------------------------------------------------------------------- |
---|
1493 | ! rgmma function: use infinite product form |
---|
1494 | REAL :: euler |
---|
1495 | PARAMETER (euler=0.577215664901532) |
---|
1496 | REAL :: x, y |
---|
1497 | INTEGER :: i |
---|
1498 | if(x.eq.1.)then |
---|
1499 | rgmma=0. |
---|
1500 | else |
---|
1501 | rgmma=x*exp(euler*x) |
---|
1502 | do i=1,10000 |
---|
1503 | y=float(i) |
---|
1504 | rgmma=rgmma*(1.000+x/y)*exp(-x/y) |
---|
1505 | enddo |
---|
1506 | rgmma=1./rgmma |
---|
1507 | endif |
---|
1508 | END FUNCTION rgmma |
---|
1509 | ! |
---|
1510 | !-------------------------------------------------------------------------- |
---|
1511 | REAL FUNCTION fpvs(t,ice,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c) |
---|
1512 | !-------------------------------------------------------------------------- |
---|
1513 | IMPLICIT NONE |
---|
1514 | !-------------------------------------------------------------------------- |
---|
1515 | REAL t,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c,dldt,xa,xb,dldti, & |
---|
1516 | xai,xbi,ttp,tr |
---|
1517 | INTEGER ice |
---|
1518 | ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
---|
1519 | ttp=t0c+0.01 |
---|
1520 | dldt=cvap-cliq |
---|
1521 | xa=-dldt/rv |
---|
1522 | xb=xa+hvap/(rv*ttp) |
---|
1523 | dldti=cvap-cice |
---|
1524 | xai=-dldti/rv |
---|
1525 | xbi=xai+hsub/(rv*ttp) |
---|
1526 | tr=ttp/t |
---|
1527 | if(t.lt.ttp .and. ice.eq.1) then |
---|
1528 | fpvs=psat*exp(log(tr)*(xai))*exp(xbi*(1.-tr)) |
---|
1529 | else |
---|
1530 | fpvs=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr)) |
---|
1531 | endif |
---|
1532 | ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
---|
1533 | END FUNCTION fpvs |
---|
1534 | !------------------------------------------------------------------- |
---|
1535 | SUBROUTINE wdm5init(den0,denr,dens,cl,cpv,ccn0,allowed_to_read) |
---|
1536 | !------------------------------------------------------------------- |
---|
1537 | IMPLICIT NONE |
---|
1538 | !------------------------------------------------------------------- |
---|
1539 | !.... constants which may not be tunable |
---|
1540 | REAL, INTENT(IN) :: den0,denr,dens,cl,cpv,ccn0 |
---|
1541 | LOGICAL, INTENT(IN) :: allowed_to_read |
---|
1542 | ! |
---|
1543 | pi = 4.*atan(1.) |
---|
1544 | xlv1 = cl-cpv |
---|
1545 | ! |
---|
1546 | qc0 = 4./3.*pi*denr*r0**3*xncr/den0 ! 0.419e-3 -- .61e-3 |
---|
1547 | qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03 |
---|
1548 | pidnc = pi*denr/6. |
---|
1549 | ! |
---|
1550 | bvtr1 = 1.+bvtr |
---|
1551 | bvtr2 = 2.+bvtr |
---|
1552 | bvtr3 = 3.+bvtr |
---|
1553 | bvtr4 = 4.+bvtr |
---|
1554 | bvtr5 = 5.+bvtr |
---|
1555 | bvtr7 = 7.+bvtr |
---|
1556 | bvtr2o5 = 2.5+.5*bvtr |
---|
1557 | bvtr3o5 = 3.5+.5*bvtr |
---|
1558 | g1pbr = rgmma(bvtr1) |
---|
1559 | g2pbr = rgmma(bvtr2) |
---|
1560 | g3pbr = rgmma(bvtr3) |
---|
1561 | g4pbr = rgmma(bvtr4) ! 17.837825 |
---|
1562 | g5pbr = rgmma(bvtr5) |
---|
1563 | g7pbr = rgmma(bvtr7) |
---|
1564 | g5pbro2 = rgmma(bvtr2o5) |
---|
1565 | g7pbro2 = rgmma(bvtr3o5) |
---|
1566 | pvtr = avtr*g5pbr/24. |
---|
1567 | pvtrn = avtr*g2pbr |
---|
1568 | eacrr = 1.0 |
---|
1569 | pacrr = pi*n0r*avtr*g3pbr*.25*eacrr |
---|
1570 | precr1 = 2.*pi*1.56 |
---|
1571 | precr2 = 2.*pi*.31*avtr**.5*g7pbro2 |
---|
1572 | pidn0r = pi*denr*n0r |
---|
1573 | pidnr = 4.*pi*denr |
---|
1574 | xmmax = (dimax/dicon)**2 |
---|
1575 | roqimax = 2.08e22*dimax**8 |
---|
1576 | ! |
---|
1577 | bvts1 = 1.+bvts |
---|
1578 | bvts2 = 2.5+.5*bvts |
---|
1579 | bvts3 = 3.+bvts |
---|
1580 | bvts4 = 4.+bvts |
---|
1581 | g1pbs = rgmma(bvts1) !.8875 |
---|
1582 | g3pbs = rgmma(bvts3) |
---|
1583 | g4pbs = rgmma(bvts4) ! 12.0786 |
---|
1584 | g5pbso2 = rgmma(bvts2) |
---|
1585 | pvts = avts*g4pbs/6. |
---|
1586 | pacrs = pi*n0s*avts*g3pbs*.25 |
---|
1587 | precs1 = 4.*n0s*.65 |
---|
1588 | precs2 = 4.*n0s*.44*avts**.5*g5pbso2 |
---|
1589 | pidn0s = pi*dens*n0s |
---|
1590 | pacrc = pi*n0s*avts*g3pbs*.25*eacrc |
---|
1591 | ! |
---|
1592 | rslopecmax = 1./lamdacmax |
---|
1593 | rslopermax = 1./lamdarmax |
---|
1594 | rslopesmax = 1./lamdasmax |
---|
1595 | rsloperbmax = rslopermax ** bvtr |
---|
1596 | rslopesbmax = rslopesmax ** bvts |
---|
1597 | rslopec2max = rslopecmax * rslopecmax |
---|
1598 | rsloper2max = rslopermax * rslopermax |
---|
1599 | rslopes2max = rslopesmax * rslopesmax |
---|
1600 | rslopec3max = rslopec2max * rslopecmax |
---|
1601 | rsloper3max = rsloper2max * rslopermax |
---|
1602 | rslopes3max = rslopes2max * rslopesmax |
---|
1603 | ! |
---|
1604 | END SUBROUTINE wdm5init |
---|
1605 | !------------------------------------------------------------------------------ |
---|
1606 | subroutine slope_wdm5(qrs,ncr,den,denfac,t,rslope,rslopeb,rslope2,rslope3, & |
---|
1607 | vt,vtn,its,ite,kts,kte) |
---|
1608 | IMPLICIT NONE |
---|
1609 | INTEGER :: its,ite, jts,jte, kts,kte |
---|
1610 | REAL, DIMENSION( its:ite , kts:kte,2) :: & |
---|
1611 | qrs, & |
---|
1612 | rslope, & |
---|
1613 | rslopeb, & |
---|
1614 | rslope2, & |
---|
1615 | rslope3, & |
---|
1616 | vt |
---|
1617 | REAL, DIMENSION( its:ite , kts:kte) :: & |
---|
1618 | ncr, & |
---|
1619 | vtn, & |
---|
1620 | den, & |
---|
1621 | denfac, & |
---|
1622 | t |
---|
1623 | REAL, PARAMETER :: t0c = 273.15 |
---|
1624 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
1625 | n0sfac |
---|
1626 | REAL :: lamdar, lamdas, x, y, z, supcol |
---|
1627 | integer :: i, j, k |
---|
1628 | !---------------------------------------------------------------- |
---|
1629 | ! size distributions: (x=mixing ratio, y=air density): |
---|
1630 | ! valid for mixing ratio > 1.e-9 kg/kg. |
---|
1631 | ! |
---|
1632 | ! Optimizatin : A**B => exp(log(A)*(B)) |
---|
1633 | lamdar(x,y,z)= exp(log(((pidnr*z)/(x*y)))*((.33333333))) |
---|
1634 | lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25 |
---|
1635 | ! |
---|
1636 | do k = kts, kte |
---|
1637 | do i = its, ite |
---|
1638 | supcol = t0c-t(i,k) |
---|
1639 | !--------------------------------------------------------------- |
---|
1640 | ! n0s: Intercept parameter for snow [m-4] [HDC 6] |
---|
1641 | !--------------------------------------------------------------- |
---|
1642 | n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.) |
---|
1643 | if(qrs(i,k,1).le.qcrmin .or. ncr(i,k).le.nrmin ) then |
---|
1644 | rslope(i,k,1) = rslopermax |
---|
1645 | rslopeb(i,k,1) = rsloperbmax |
---|
1646 | rslope2(i,k,1) = rsloper2max |
---|
1647 | rslope3(i,k,1) = rsloper3max |
---|
1648 | else |
---|
1649 | rslope(i,k,1) = min(1./lamdar(qrs(i,k,1),den(i,k),ncr(i,k)),1.e-3) |
---|
1650 | rslopeb(i,k,1) = rslope(i,k,1)**bvtr |
---|
1651 | rslope2(i,k,1) = rslope(i,k,1)*rslope(i,k,1) |
---|
1652 | rslope3(i,k,1) = rslope2(i,k,1)*rslope(i,k,1) |
---|
1653 | endif |
---|
1654 | if(qrs(i,k,2).le.qcrmin) then |
---|
1655 | rslope(i,k,2) = rslopesmax |
---|
1656 | rslopeb(i,k,2) = rslopesbmax |
---|
1657 | rslope2(i,k,2) = rslopes2max |
---|
1658 | rslope3(i,k,2) = rslopes3max |
---|
1659 | else |
---|
1660 | rslope(i,k,2) = 1./lamdas(qrs(i,k,2),den(i,k),n0sfac(i,k)) |
---|
1661 | rslopeb(i,k,2) = rslope(i,k,2)**bvts |
---|
1662 | rslope2(i,k,2) = rslope(i,k,2)*rslope(i,k,2) |
---|
1663 | rslope3(i,k,2) = rslope2(i,k,2)*rslope(i,k,2) |
---|
1664 | endif |
---|
1665 | vt(i,k,1) = pvtr*rslopeb(i,k,1)*denfac(i,k) |
---|
1666 | vt(i,k,2) = pvts*rslopeb(i,k,2)*denfac(i,k) |
---|
1667 | vtn(i,k) = pvtrn*rslopeb(i,k,1)*denfac(i,k) |
---|
1668 | if(qrs(i,k,1).le.0.0) vt(i,k,1) = 0.0 |
---|
1669 | if(qrs(i,k,2).le.0.0) vt(i,k,2) = 0.0 |
---|
1670 | if(ncr(i,k).le.0.0) vtn(i,k) = 0.0 |
---|
1671 | enddo |
---|
1672 | enddo |
---|
1673 | END subroutine slope_wdm5 |
---|
1674 | !----------------------------------------------------------------------------- |
---|
1675 | subroutine slope_rain(qrs,ncr,den,denfac,t,rslope,rslopeb,rslope2,rslope3, & |
---|
1676 | vt,vtn,its,ite,kts,kte) |
---|
1677 | IMPLICIT NONE |
---|
1678 | INTEGER :: its,ite, jts,jte, kts,kte |
---|
1679 | REAL, DIMENSION( its:ite , kts:kte) :: & |
---|
1680 | qrs, & |
---|
1681 | ncr, & |
---|
1682 | rslope, & |
---|
1683 | rslopeb, & |
---|
1684 | rslope2, & |
---|
1685 | rslope3, & |
---|
1686 | vt, & |
---|
1687 | vtn, & |
---|
1688 | den, & |
---|
1689 | denfac, & |
---|
1690 | t |
---|
1691 | REAL, PARAMETER :: t0c = 273.15 |
---|
1692 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
1693 | n0sfac |
---|
1694 | REAL :: lamdar, x, y, z, supcol |
---|
1695 | integer :: i, j, k |
---|
1696 | !---------------------------------------------------------------- |
---|
1697 | ! size distributions: (x=mixing ratio, y=air density): |
---|
1698 | ! valid for mixing ratio > 1.e-9 kg/kg. |
---|
1699 | lamdar(x,y,z)= exp(log(((pidnr*z)/(x*y)))*((.33333333))) |
---|
1700 | ! |
---|
1701 | do k = kts, kte |
---|
1702 | do i = its, ite |
---|
1703 | if(qrs(i,k).le.qcrmin .or. ncr(i,k).le.nrmin) then |
---|
1704 | rslope(i,k) = rslopermax |
---|
1705 | rslopeb(i,k) = rsloperbmax |
---|
1706 | rslope2(i,k) = rsloper2max |
---|
1707 | rslope3(i,k) = rsloper3max |
---|
1708 | else |
---|
1709 | rslope(i,k) = min(1./lamdar(qrs(i,k),den(i,k),ncr(i,k)),1.e-3) |
---|
1710 | rslopeb(i,k) = rslope(i,k)**bvtr |
---|
1711 | rslope2(i,k) = rslope(i,k)*rslope(i,k) |
---|
1712 | rslope3(i,k) = rslope2(i,k)*rslope(i,k) |
---|
1713 | endif |
---|
1714 | vt(i,k) = pvtr*rslopeb(i,k)*denfac(i,k) |
---|
1715 | vtn(i,k) = pvtrn*rslopeb(i,k)*denfac(i,k) |
---|
1716 | if(qrs(i,k).le.0.0) vt(i,k) = 0.0 |
---|
1717 | if(ncr(i,k).le.0.0) vtn(i,k) = 0.0 |
---|
1718 | enddo |
---|
1719 | enddo |
---|
1720 | END subroutine slope_rain |
---|
1721 | !------------------------------------------------------------------------------ |
---|
1722 | subroutine slope_snow(qrs,den,denfac,t,rslope,rslopeb,rslope2,rslope3, & |
---|
1723 | vt,its,ite,kts,kte) |
---|
1724 | IMPLICIT NONE |
---|
1725 | INTEGER :: its,ite, jts,jte, kts,kte |
---|
1726 | REAL, DIMENSION( its:ite , kts:kte) :: & |
---|
1727 | qrs, & |
---|
1728 | rslope, & |
---|
1729 | rslopeb, & |
---|
1730 | rslope2, & |
---|
1731 | rslope3, & |
---|
1732 | vt, & |
---|
1733 | den, & |
---|
1734 | denfac, & |
---|
1735 | t |
---|
1736 | REAL, PARAMETER :: t0c = 273.15 |
---|
1737 | REAL, DIMENSION( its:ite , kts:kte ) :: & |
---|
1738 | n0sfac |
---|
1739 | REAL :: lamdas, x, y, z, supcol |
---|
1740 | integer :: i, j, k |
---|
1741 | !---------------------------------------------------------------- |
---|
1742 | ! size distributions: (x=mixing ratio, y=air density): |
---|
1743 | ! valid for mixing ratio > 1.e-9 kg/kg. |
---|
1744 | lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25 |
---|
1745 | ! |
---|
1746 | do k = kts, kte |
---|
1747 | do i = its, ite |
---|
1748 | supcol = t0c-t(i,k) |
---|
1749 | !--------------------------------------------------------------- |
---|
1750 | ! n0s: Intercept parameter for snow [m-4] [HDC 6] |
---|
1751 | !--------------------------------------------------------------- |
---|
1752 | n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.) |
---|
1753 | if(qrs(i,k).le.qcrmin)then |
---|
1754 | rslope(i,k) = rslopesmax |
---|
1755 | rslopeb(i,k) = rslopesbmax |
---|
1756 | rslope2(i,k) = rslopes2max |
---|
1757 | rslope3(i,k) = rslopes3max |
---|
1758 | else |
---|
1759 | rslope(i,k) = 1./lamdas(qrs(i,k),den(i,k),n0sfac(i,k)) |
---|
1760 | rslopeb(i,k) = rslope(i,k)**bvts |
---|
1761 | rslope2(i,k) = rslope(i,k)*rslope(i,k) |
---|
1762 | rslope3(i,k) = rslope2(i,k)*rslope(i,k) |
---|
1763 | endif |
---|
1764 | vt(i,k) = pvts*rslopeb(i,k)*denfac(i,k) |
---|
1765 | if(qrs(i,k).le.0.0) vt(i,k) = 0.0 |
---|
1766 | enddo |
---|
1767 | enddo |
---|
1768 | END subroutine slope_snow |
---|
1769 | !------------------------------------------------------------------- |
---|
1770 | SUBROUTINE nislfv_rain_plm(im,km,denl,denfacl,tkl,dzl,wwl,rql,precip,dt,id,iter) |
---|
1771 | !------------------------------------------------------------------- |
---|
1772 | ! |
---|
1773 | ! for non-iteration semi-Lagrangain forward advection for cloud |
---|
1774 | ! with mass conservation and positive definite advection |
---|
1775 | ! 2nd order interpolation with monotonic piecewise linear method |
---|
1776 | ! this routine is under assumption of decfl < 1 for semi_Lagrangian |
---|
1777 | ! |
---|
1778 | ! dzl depth of model layer in meter |
---|
1779 | ! wwl terminal velocity at model layer m/s |
---|
1780 | ! rql cloud density*mixing ration |
---|
1781 | ! precip precipitation |
---|
1782 | ! dt time step |
---|
1783 | ! id kind of precip: 0 test case; 1 raindrop 2: snow |
---|
1784 | ! iter how many time to guess mean terminal velocity: 0 pure forward. |
---|
1785 | ! 0 : use departure wind for advection |
---|
1786 | ! 1 : use mean wind for advection |
---|
1787 | ! > 1 : use mean wind after iter-1 iterations |
---|
1788 | ! |
---|
1789 | ! author: hann-ming henry juang <henry.juang@noaa.gov> |
---|
1790 | ! implemented by song-you hong |
---|
1791 | ! |
---|
1792 | implicit none |
---|
1793 | integer im,km,id |
---|
1794 | real dt |
---|
1795 | real dzl(im,km),wwl(im,km),rql(im,km),precip(im) |
---|
1796 | real denl(im,km),denfacl(im,km),tkl(im,km) |
---|
1797 | ! |
---|
1798 | integer i,k,n,m,kk,kb,kt,iter |
---|
1799 | real tl,tl2,qql,dql,qqd |
---|
1800 | real th,th2,qqh,dqh |
---|
1801 | real zsum,qsum,dim,dip,c1,con1,fa1,fa2 |
---|
1802 | real allold, allnew, zz, dzamin, cflmax, decfl |
---|
1803 | real dz(km), ww(km), qq(km), wd(km), wa(km), was(km) |
---|
1804 | real den(km), denfac(km), tk(km) |
---|
1805 | real wi(km+1), zi(km+1), za(km+1) |
---|
1806 | real qn(km), qr(km),tmp(km),tmp1(km),tmp2(km),tmp3(km) |
---|
1807 | real dza(km+1), qa(km+1), qmi(km+1), qpi(km+1) |
---|
1808 | ! |
---|
1809 | precip(:) = 0.0 |
---|
1810 | ! |
---|
1811 | i_loop : do i=1,im |
---|
1812 | ! ----------------------------------- |
---|
1813 | dz(:) = dzl(i,:) |
---|
1814 | qq(:) = rql(i,:) |
---|
1815 | ww(:) = wwl(i,:) |
---|
1816 | den(:) = denl(i,:) |
---|
1817 | denfac(:) = denfacl(i,:) |
---|
1818 | tk(:) = tkl(i,:) |
---|
1819 | ! skip for no precipitation for all layers |
---|
1820 | allold = 0.0 |
---|
1821 | do k=1,km |
---|
1822 | allold = allold + qq(k) |
---|
1823 | enddo |
---|
1824 | if(allold.le.0.0) then |
---|
1825 | cycle i_loop |
---|
1826 | endif |
---|
1827 | ! |
---|
1828 | ! compute interface values |
---|
1829 | zi(1)=0.0 |
---|
1830 | do k=1,km |
---|
1831 | zi(k+1) = zi(k)+dz(k) |
---|
1832 | enddo |
---|
1833 | ! |
---|
1834 | ! save departure wind |
---|
1835 | wd(:) = ww(:) |
---|
1836 | n=1 |
---|
1837 | 100 continue |
---|
1838 | ! plm is 2nd order, we can use 2nd order wi or 3rd order wi |
---|
1839 | ! 2nd order interpolation to get wi |
---|
1840 | wi(1) = ww(1) |
---|
1841 | wi(km+1) = ww(km) |
---|
1842 | do k=2,km |
---|
1843 | wi(k) = (ww(k)*dz(k-1)+ww(k-1)*dz(k))/(dz(k-1)+dz(k)) |
---|
1844 | enddo |
---|
1845 | ! 3rd order interpolation to get wi |
---|
1846 | fa1 = 9./16. |
---|
1847 | fa2 = 1./16. |
---|
1848 | wi(1) = ww(1) |
---|
1849 | wi(2) = 0.5*(ww(2)+ww(1)) |
---|
1850 | do k=3,km-1 |
---|
1851 | wi(k) = fa1*(ww(k)+ww(k-1))-fa2*(ww(k+1)+ww(k-2)) |
---|
1852 | enddo |
---|
1853 | wi(km) = 0.5*(ww(km)+ww(km-1)) |
---|
1854 | wi(km+1) = ww(km) |
---|
1855 | ! |
---|
1856 | ! terminate of top of raingroup |
---|
1857 | do k=2,km |
---|
1858 | if( ww(k).eq.0.0 ) wi(k)=ww(k-1) |
---|
1859 | enddo |
---|
1860 | ! |
---|
1861 | ! diffusivity of wi |
---|
1862 | con1 = 0.05 |
---|
1863 | do k=km,1,-1 |
---|
1864 | decfl = (wi(k+1)-wi(k))*dt/dz(k) |
---|
1865 | if( decfl .gt. con1 ) then |
---|
1866 | wi(k) = wi(k+1) - con1*dz(k)/dt |
---|
1867 | endif |
---|
1868 | enddo |
---|
1869 | ! compute arrival point |
---|
1870 | do k=1,km+1 |
---|
1871 | za(k) = zi(k) - wi(k)*dt |
---|
1872 | enddo |
---|
1873 | ! |
---|
1874 | do k=1,km |
---|
1875 | dza(k) = za(k+1)-za(k) |
---|
1876 | enddo |
---|
1877 | dza(km+1) = zi(km+1) - za(km+1) |
---|
1878 | ! |
---|
1879 | ! computer deformation at arrival point |
---|
1880 | do k=1,km |
---|
1881 | qa(k) = qq(k)*dz(k)/dza(k) |
---|
1882 | qr(k) = qa(k)/den(k) |
---|
1883 | enddo |
---|
1884 | qa(km+1) = 0.0 |
---|
1885 | ! call maxmin(km,1,qa,' arrival points ') |
---|
1886 | ! |
---|
1887 | ! compute arrival terminal velocity, and estimate mean terminal velocity |
---|
1888 | ! then back to use mean terminal velocity |
---|
1889 | if( n.le.iter ) then |
---|
1890 | ! if (id.eq.1) then |
---|
1891 | ! |
---|
1892 | ! call slope_rain(qr,den,denfac,tk,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km) |
---|
1893 | ! else |
---|
1894 | call slope_snow(qr,den,denfac,tk,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km) |
---|
1895 | ! endif |
---|
1896 | if( n.ge.2 ) wa(1:km)=0.5*(wa(1:km)+was(1:km)) |
---|
1897 | do k=1,km |
---|
1898 | !#ifdef DEBUG |
---|
1899 | ! print*,' slope_wsm3 ',qr(k)*1000.,den(k),denfac(k),tk(k),tmp(k),tmp1(k),tmp2(k),ww(k),wa(k) |
---|
1900 | !#endif |
---|
1901 | ! mean wind is average of departure and new arrival winds |
---|
1902 | ww(k) = 0.5* ( wd(k)+wa(k) ) |
---|
1903 | enddo |
---|
1904 | was(:) = wa(:) |
---|
1905 | n=n+1 |
---|
1906 | go to 100 |
---|
1907 | endif |
---|
1908 | ! |
---|
1909 | ! estimate values at arrival cell interface with monotone |
---|
1910 | do k=2,km |
---|
1911 | dip=(qa(k+1)-qa(k))/(dza(k+1)+dza(k)) |
---|
1912 | dim=(qa(k)-qa(k-1))/(dza(k-1)+dza(k)) |
---|
1913 | if( dip*dim.le.0.0 ) then |
---|
1914 | qmi(k)=qa(k) |
---|
1915 | qpi(k)=qa(k) |
---|
1916 | else |
---|
1917 | qpi(k)=qa(k)+0.5*(dip+dim)*dza(k) |
---|
1918 | qmi(k)=2.0*qa(k)-qpi(k) |
---|
1919 | if( qpi(k).lt.0.0 .or. qmi(k).lt.0.0 ) then |
---|
1920 | qpi(k) = qa(k) |
---|
1921 | qmi(k) = qa(k) |
---|
1922 | endif |
---|
1923 | endif |
---|
1924 | enddo |
---|
1925 | qpi(1)=qa(1) |
---|
1926 | qmi(1)=qa(1) |
---|
1927 | qmi(km+1)=qa(km+1) |
---|
1928 | qpi(km+1)=qa(km+1) |
---|
1929 | ! |
---|
1930 | ! interpolation to regular point |
---|
1931 | qn = 0.0 |
---|
1932 | kb=1 |
---|
1933 | kt=1 |
---|
1934 | intp : do k=1,km |
---|
1935 | kb=max(kb-1,1) |
---|
1936 | kt=max(kt-1,1) |
---|
1937 | ! find kb and kt |
---|
1938 | if( zi(k).ge.za(km+1) ) then |
---|
1939 | exit intp |
---|
1940 | else |
---|
1941 | find_kb : do kk=kb,km |
---|
1942 | if( zi(k).le.za(kk+1) ) then |
---|
1943 | kb = kk |
---|
1944 | exit find_kb |
---|
1945 | else |
---|
1946 | cycle find_kb |
---|
1947 | endif |
---|
1948 | enddo find_kb |
---|
1949 | find_kt : do kk=kt,km |
---|
1950 | if( zi(k+1).le.za(kk) ) then |
---|
1951 | kt = kk |
---|
1952 | exit find_kt |
---|
1953 | else |
---|
1954 | cycle find_kt |
---|
1955 | endif |
---|
1956 | enddo find_kt |
---|
1957 | kt = kt - 1 |
---|
1958 | ! compute q with piecewise constant method |
---|
1959 | if( kt.eq.kb ) then |
---|
1960 | tl=(zi(k)-za(kb))/dza(kb) |
---|
1961 | th=(zi(k+1)-za(kb))/dza(kb) |
---|
1962 | tl2=tl*tl |
---|
1963 | th2=th*th |
---|
1964 | qqd=0.5*(qpi(kb)-qmi(kb)) |
---|
1965 | qqh=qqd*th2+qmi(kb)*th |
---|
1966 | qql=qqd*tl2+qmi(kb)*tl |
---|
1967 | qn(k) = (qqh-qql)/(th-tl) |
---|
1968 | else if( kt.gt.kb ) then |
---|
1969 | tl=(zi(k)-za(kb))/dza(kb) |
---|
1970 | tl2=tl*tl |
---|
1971 | qqd=0.5*(qpi(kb)-qmi(kb)) |
---|
1972 | qql=qqd*tl2+qmi(kb)*tl |
---|
1973 | dql = qa(kb)-qql |
---|
1974 | zsum = (1.-tl)*dza(kb) |
---|
1975 | qsum = dql*dza(kb) |
---|
1976 | if( kt-kb.gt.1 ) then |
---|
1977 | do m=kb+1,kt-1 |
---|
1978 | zsum = zsum + dza(m) |
---|
1979 | qsum = qsum + qa(m) * dza(m) |
---|
1980 | enddo |
---|
1981 | endif |
---|
1982 | th=(zi(k+1)-za(kt))/dza(kt) |
---|
1983 | th2=th*th |
---|
1984 | qqd=0.5*(qpi(kt)-qmi(kt)) |
---|
1985 | dqh=qqd*th2+qmi(kt)*th |
---|
1986 | zsum = zsum + th*dza(kt) |
---|
1987 | qsum = qsum + dqh*dza(kt) |
---|
1988 | qn(k) = qsum/zsum |
---|
1989 | endif |
---|
1990 | cycle intp |
---|
1991 | endif |
---|
1992 | ! |
---|
1993 | enddo intp |
---|
1994 | ! |
---|
1995 | ! rain out |
---|
1996 | sum_precip: do k=1,km |
---|
1997 | if( za(k).lt.0.0 .and. za(k+1).lt.0.0 ) then |
---|
1998 | precip(i) = precip(i) + qa(k)*dza(k) |
---|
1999 | cycle sum_precip |
---|
2000 | else if ( za(k).lt.0.0 .and. za(k+1).ge.0.0 ) then |
---|
2001 | precip(i) = precip(i) + qa(k)*(0.0-za(k)) |
---|
2002 | exit sum_precip |
---|
2003 | endif |
---|
2004 | exit sum_precip |
---|
2005 | enddo sum_precip |
---|
2006 | ! |
---|
2007 | ! replace the new values |
---|
2008 | rql(i,:) = qn(:) |
---|
2009 | ! |
---|
2010 | ! ---------------------------------- |
---|
2011 | enddo i_loop |
---|
2012 | ! |
---|
2013 | END SUBROUTINE nislfv_rain_plm |
---|
2014 | END MODULE module_mp_wdm5 |
---|