9 !Including inline expansion statistical function
13 USE module_model_constants, only : RE_QC_BG, RE_QI_BG, RE_QS_BG
15 REAL, PARAMETER, PRIVATE :: dtcldcr = 120. ! maximum time step for minor loops
16 REAL, PARAMETER, PRIVATE :: n0r = 8.e6 ! intercept parameter rain
17 REAL, PARAMETER, PRIVATE :: avtr = 841.9 ! a constant for terminal velocity of rain
18 REAL, PARAMETER, PRIVATE :: bvtr = 0.8 ! a constant for terminal velocity of rain
19 REAL, PARAMETER, PRIVATE :: r0 = .8e-5 ! 8 microm in contrast to 10 micro m
20 REAL, PARAMETER, PRIVATE :: peaut = .55 ! collection efficiency
21 REAL, PARAMETER, PRIVATE :: xncr = 3.e8 ! maritime cloud in contrast to 3.e8 in tc80
22 REAL, PARAMETER, PRIVATE :: xmyu = 1.718e-5 ! the dynamic viscosity kgm-1s-1
23 REAL, PARAMETER, PRIVATE :: avts = 11.72 ! a constant for terminal velocity of snow
24 REAL, PARAMETER, PRIVATE :: bvts = .41 ! a constant for terminal velocity of snow
25 REAL, PARAMETER, PRIVATE :: n0smax = 1.e11 ! maximum n0s (t=-90C unlimited)
26 REAL, PARAMETER, PRIVATE :: lamdacmax = 5.0e5 ! limited maximum value for slope parameter of cloud water
27 REAL, PARAMETER, PRIVATE :: lamdacmin = 2.0e4 ! limited minimum value for slope parameter of cloud water
28 REAL, PARAMETER, PRIVATE :: lamdarmax = 5.0e4 ! limited maximum value for slope parameter of rain
29 REAL, PARAMETER, PRIVATE :: lamdarmin = 2.0e3 ! limited minimum value for slope parameter of rain
30 REAL, PARAMETER, PRIVATE :: lamdasmax = 1.e5 ! limited maximum value for slope parameter of snow
31 REAL, PARAMETER, PRIVATE :: lamdagmax = 6.e4 ! limited maximum value for slope parameter of graupel
32 REAL, PARAMETER, PRIVATE :: dicon = 11.9 ! constant for the cloud-ice diamter
33 REAL, PARAMETER, PRIVATE :: dimax = 500.e-6 ! limited maximum value for the cloud-ice diamter
34 REAL, PARAMETER, PRIVATE :: n0s = 2.e6 ! temperature dependent intercept parameter snow
35 REAL, PARAMETER, PRIVATE :: alpha = .12 ! .122 exponen factor for n0s
36 REAL, PARAMETER, PRIVATE :: pfrz1 = 100. ! constant in Biggs freezing
37 REAL, PARAMETER, PRIVATE :: pfrz2 = 0.66 ! constant in Biggs freezing
38 REAL, PARAMETER, PRIVATE :: qcrmin = 1.e-9 ! minimun values for qr, qs, and qg
39 REAL, PARAMETER, PRIVATE :: ncmin = 1.e1 ! minimum value for Nc
40 REAL, PARAMETER, PRIVATE :: nrmin = 1.e-2 ! minimum value for Nr
41 REAL, PARAMETER, PRIVATE :: eacrc = 1.0 ! Snow/cloud-water collection efficiency
43 REAL, PARAMETER, PRIVATE :: satmax = 1.0048 ! maximum saturation value for CCN activation
44 ! 1.008 for maritime air mass /1.0048 for conti
45 REAL, PARAMETER, PRIVATE :: actk = 0.6 ! parameter for the CCN activation
46 REAL, PARAMETER, PRIVATE :: actr = 1.5 ! radius of activated CCN drops
47 REAL, PARAMETER, PRIVATE :: ncrk1 = 3.03e3 ! Long's collection kernel coefficient
48 REAL, PARAMETER, PRIVATE :: ncrk2 = 2.59e15 ! Long's collection kernel coefficient
49 REAL, PARAMETER, PRIVATE :: di100 = 1.e-4 ! parameter related with accretion and collection of cloud drops
50 REAL, PARAMETER, PRIVATE :: di600 = 6.e-4 ! parameter related with accretion and collection of cloud drops
51 REAL, PARAMETER, PRIVATE :: di2000 = 20.e-4 ! parameter related with accretion and collection of cloud drops
52 REAL, PARAMETER, PRIVATE :: di82 = 82.e-6 ! dimater related with raindrops evaporation
53 REAL, PARAMETER, PRIVATE :: di15 = 15.e-6 ! auto conversion takes place beyond this diameter
55 qc0, qck1,pidnc,bvtr1,bvtr2,bvtr3,bvtr4, &
56 bvtr5,bvtr7,bvtr2o5,bvtr3o5,g1pbr,g2pbr, &
57 g3pbr,g4pbr,g5pbr,g7pbr,g5pbro2,g7pbro2, &
58 pvtr,pvtrn,eacrr,pacrr, pi, &
59 precr1,precr2,xmmax,roqimax,bvts1, &
60 bvts2,bvts3,bvts4,g1pbs,g3pbs,g4pbs, &
61 g5pbso2,pvts,pacrs,precs1,precs2,pidn0r, &
62 pidn0s,pidnr,xlv1,pacrc, &
63 rslopecmax,rslopec2max,rslopec3max, &
64 rslopermax,rslopesmax,rslopegmax, &
65 rsloperbmax,rslopesbmax,rslopegbmax, &
66 rsloper2max,rslopes2max,rslopeg2max, &
67 rsloper3max,rslopes3max,rslopeg3max
69 ! Specifies code-inlining of fpvs function in WDM52D below. JM 20040507
72 !===================================================================
74 SUBROUTINE wdm5(th, q, qc, qr, qi, qs &
77 ,delt,g, cpd, cpv, ccn0, rd, rv, t0c &
79 ,XLS, XLV0, XLF0, den0, denr &
84 ,has_reqc, has_reqi, has_reqs & ! for radiation
85 ,re_cloud, re_ice, re_snow & ! for radiation
86 ,refl_10cm, diagflag, do_radar_ref &
88 ,ids,ide, jds,jde, kds,kde &
89 ,ims,ime, jms,jme, kms,kme &
90 ,its,ite, jts,jte, kts,kte &
92 !-------------------------------------------------------------------
94 !-------------------------------------------------------------------
96 ! This code is a WRF double-moment 5-class mixed ice
97 ! microphyiscs scheme (WDM5). The WDM microphysics scheme predicts
98 ! number concentrations for warm rain species including clouds and
99 ! rain. cloud condensation nuclei (CCN) is also predicted.
100 ! The cold rain species including ice, snow, graupel follow the
101 ! WRF single-moment 5-class microphysics (WSM5)
102 ! in which theoretical background for WSM ice phase microphysics is
103 ! based on Hong et al. (2004).
104 ! The WDM scheme is described in Lim and Hong (2010).
105 ! All units are in m.k.s. and source/sink terms in kgkg-1s-1.
109 ! Coded by Kyo-Sun Lim and Song-You Hong (Yonsei Univ.) Fall 2008
111 ! Implemented by Kyo-Sun Lim and Jimy Dudhia (NCAR) Winter 2008
113 ! further modifications :
114 ! semi-lagrangian sedimentation (JH,2010),hong, aug 2009
115 ! ==> higher accuracy and efficient at lower resolutions
116 ! reflectivity computation from greg thompson, lim, jun 2011
117 ! ==> only diagnostic, but with removal of too large drops
118 ! effective radius of hydrometeors, bae from kiaps, jan 2015
119 ! ==> consistency in solar insolation of rrtmg radiation
120 ! bug fix in melting terms, bae from kiaps, nov 2015
121 ! ==> density of air is divided, which has not been
123 ! Reference) Lim and Hong (LH, 2010) Mon. Wea. Rev.
124 ! Juang and Hong (JH, 2010) Mon. Wea. Rev.
125 ! Hong, Dudhia, Chen (HDC, 2004) Mon. Wea. Rev.
126 ! Hong and Lim (HL, 2006) J. Korean Meteor. Soc.
127 ! Cohard and Pinty (CP, 2000) Quart. J. Roy. Meteor. Soc.
128 ! Khairoutdinov and Kogan (KK, 2000) Mon. Wea. Rev.
129 ! Dudhia, Hong and Lim (DHL, 2008) J. Meteor. Soc. Japan
131 ! Lin, Farley, Orville (LFO, 1983) J. Appl. Meteor.
132 ! Rutledge, Hobbs (RH83, 1983) J. Atmos. Sci.
133 ! Rutledge, Hobbs (RH84, 1984) J. Atmos. Sci.
135 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
136 ims,ime, jms,jme, kms,kme , &
137 its,ite, jts,jte, kts,kte
138 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
149 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
155 REAL, INTENT(IN ) :: delt, &
174 INTEGER, INTENT(IN ) :: itimestep
175 REAL, DIMENSION( ims:ime , jms:jme ), &
176 INTENT(INOUT) :: rain, &
179 ! for radiation connecting
180 INTEGER, INTENT(IN):: &
184 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), &
189 !+---+-----------------------------------------------------------------+
190 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: & ! GT
192 !+---+-----------------------------------------------------------------+
194 REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, &
195 INTENT(INOUT) :: snow, &
198 REAL, DIMENSION( its:ite , kts:kte ) :: t
199 REAL, DIMENSION( its:ite , kts:kte, 2 ) :: qci, qrs
200 REAL, DIMENSION( its:ite , kts:kte, 3 ) :: ncr
201 CHARACTER*256 :: emess
205 !+---+-----------------------------------------------------------------+
206 REAL, DIMENSION(kts:kte):: qv1d, t1d, p1d, qr1d, nr1d, qs1d, dBZ
207 LOGICAL, OPTIONAL, INTENT(IN) :: diagflag
208 INTEGER, OPTIONAL, INTENT(IN) :: do_radar_ref
209 !+---+-----------------------------------------------------------------+
210 ! to calculate effective radius for radiation
211 REAL, DIMENSION( kts:kte ) :: qc1d, nc1d, den1d
212 REAL, DIMENSION( kts:kte ) :: qi1d
213 REAL, DIMENSION( kts:kte ) :: re_qc, re_qi, re_qs
216 IF (itimestep .eq. 1) THEN
229 t(i,k)=th(i,k,j)*pii(i,k,j)
230 qci(i,k,1) = qc(i,k,j)
231 qci(i,k,2) = qi(i,k,j)
232 qrs(i,k,1) = qr(i,k,j)
233 qrs(i,k,2) = qs(i,k,j)
234 ncr(i,k,1) = nn(i,k,j)
235 ncr(i,k,2) = nc(i,k,j)
236 ncr(i,k,3) = nr(i,k,j)
239 ! Sending array starting locations of optional variables may cause
240 ! troubles, so we explicitly change the call.
241 CALL wdm52D(t, q(ims,kms,j), qci, qrs, ncr &
243 ,p(ims,kms,j), delz(ims,kms,j) &
244 ,delt,g, cpd, cpv, ccn0, rd, rv, t0c &
246 ,XLS, XLV0, XLF0, den0, denr &
249 ,rain(ims,j),rainncv(ims,j) &
251 ,ids,ide, jds,jde, kds,kde &
252 ,ims,ime, jms,jme, kms,kme &
253 ,its,ite, jts,jte, kts,kte &
254 ,snow(ims,j),snowncv(ims,j) &
258 th(i,k,j)=t(i,k)/pii(i,k,j)
259 qc(i,k,j) = qci(i,k,1)
260 qi(i,k,j) = qci(i,k,2)
261 qr(i,k,j) = qrs(i,k,1)
262 qs(i,k,j) = qrs(i,k,2)
263 nn(i,k,j) = ncr(i,k,1)
264 nc(i,k,j) = ncr(i,k,2)
265 nr(i,k,j) = ncr(i,k,3)
269 !+---+-----------------------------------------------------------------+
270 IF ( PRESENT (diagflag) ) THEN
271 if (diagflag .and. do_radar_ref == 1) then
274 t1d(k)=th(i,k,j)*pii(i,k,j)
281 call refl10cm_wdm5 (qv1d, qr1d, nr1d, qs1d, &
282 t1d, p1d, dBZ, kts, kte, i, j)
284 refl_10cm(i,k,j) = MAX(-35., dBZ(k))
290 if (has_reqc.ne.0 .and. has_reqi.ne.0 .and. has_reqs.ne.0) then
297 t1d(k) = th(i,k,j)*pii(i,k,j)
304 call effectRad_wdm5 (t1d, qc1d, nc1d, qi1d, qs1d, den1d, &
305 qmin, t0c, re_qc, re_qi, re_qs, &
308 re_cloud(i,k,j) = MAX(RE_QC_BG, MIN(re_qc(k), 50.E-6))
309 re_ice(i,k,j) = MAX(RE_QI_BG, MIN(re_qi(k), 125.E-6))
310 re_snow(i,k,j) = MAX(RE_QS_BG, MIN(re_qs(k), 999.E-6))
313 endif ! has_reqc, etc...
314 !+---+-----------------------------------------------------------------+
318 CALL get_wsm5_gpu_levels ( mkx_test )
319 IF ( mkx_test .LT. kte ) THEN
320 WRITE(emess,*)'Number of levels compiled for GPU WSM5 too small. ', &
322 CALL wrf_error_fatal(emess)
325 th(its:ite,kts:kte,jts:jte), pii(its:ite,kts:kte,jts:jte) &
326 ,q(its:ite,kts:kte,jts:jte), qc(its:ite,kts:kte,jts:jte) &
327 ,qi(its:ite,kts:kte,jts:jte), qr(its:ite,kts:kte,jts:jte) &
328 ,qs(its:ite,kts:kte,jts:jte), den(its:ite,kts:kte,jts:jte) &
329 ,p(its:ite,kts:kte,jts:jte), delz(its:ite,kts:kte,jts:jte) &
331 ,rain(its:ite,jts:jte),rainncv(its:ite,jts:jte) &
332 ,snow(its:ite,jts:jte),snowncv(its:ite,jts:jte) &
333 ,sr(its:ite,jts:jte) &
334 ,its, ite, jts, jte, kts, kte &
335 ,its, ite, jts, jte, kts, kte &
336 ,its, ite, jts, jte, kts, kte &
340 !===================================================================
342 SUBROUTINE wdm52D(t, q, qci, qrs, ncr, den, p, delz &
343 ,delt,g, cpd, cpv, ccn0, rd, rv, t0c &
345 ,XLS, XLV0, XLF0, den0, denr &
350 ,ids,ide, jds,jde, kds,kde &
351 ,ims,ime, jms,jme, kms,kme &
352 ,its,ite, jts,jte, kts,kte &
355 !-------------------------------------------------------------------
357 !-------------------------------------------------------------------
358 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
359 ims,ime, jms,jme, kms,kme , &
360 its,ite, jts,jte, kts,kte, &
362 REAL, DIMENSION( its:ite , kts:kte ), &
365 REAL, DIMENSION( its:ite , kts:kte, 2 ), &
369 REAL, DIMENSION( its:ite , kts:kte, 3 ), &
372 REAL, DIMENSION( ims:ime , kms:kme ), &
375 REAL, DIMENSION( ims:ime , kms:kme ), &
380 REAL, INTENT(IN ) :: delt, &
399 REAL, DIMENSION( ims:ime ), &
400 INTENT(INOUT) :: rain, &
403 REAL, DIMENSION( ims:ime ), OPTIONAL, &
404 INTENT(INOUT) :: snow, &
407 REAL, DIMENSION( its:ite , kts:kte , 2) :: &
408 rh, qs, rslope, rslope2, rslope3, rslopeb, &
409 falk, fall, work1, qrs_tmp
410 REAL, DIMENSION( its:ite , kts:kte ) :: &
411 rslopec, rslopec2,rslopec3
412 REAL, DIMENSION( its:ite , kts:kte, 2) :: &
414 REAL, DIMENSION( its:ite , kts:kte ) :: &
416 REAL, DIMENSION( its:ite , kts:kte ) :: &
418 REAL, DIMENSION( its:ite , kts:kte ) :: &
419 den_tmp, delz_tmp, ncr_tmp
420 REAL, DIMENSION( its:ite , kts:kte ) :: &
422 REAL, DIMENSION( its:ite , kts:kte ) :: &
424 REAL, DIMENSION( its:ite , kts:kte ) :: &
425 falkc, work1c, work2c, fallc
426 REAL, DIMENSION( its:ite , kts:kte ) :: &
427 pcact, praut, psaut, prevp, psdep, pracw, psaci, psacw, &
428 pigen, pidep, pcond, &
429 xl, cpm, work2, psmlt, psevp, denfac, xni, &
430 n0sfac, denqrs2, denqci
431 REAL, DIMENSION( its:ite ) :: &
433 REAL, DIMENSION( its:ite , kts:kte ) :: &
434 nraut, nracw, ncevp, nccol, nrcol, &
437 REAL, DIMENSION(its:ite) :: tstepsnow
439 #define WSM_NO_CONDITIONAL_IN_VECTOR
440 #ifdef WSM_NO_CONDITIONAL_IN_VECTOR
441 REAL, DIMENSION(its:ite) :: xal, xbl
443 ! variables for optimization
444 REAL, DIMENSION( its:ite ) :: tvec1
445 INTEGER, DIMENSION( its:ite ) :: mnstep, numndt
446 INTEGER, DIMENSION( its:ite ) :: mstep, numdt
447 REAL, DIMENSION(its:ite) :: rmstep
448 REAL dtcldden, rdelz, rdtcld
449 LOGICAL, DIMENSION( its:ite ) :: flgcld
451 cpmcal, xlcal, lamdac, diffus, &
452 viscos, xka, venfac, conden, diffac, &
453 x, y, z, a, b, c, d, e, &
454 ndt, qdt, holdrr, holdrs, supcol, supcolt, pvt, &
455 coeres, supsat, dtcld, xmi, eacrs, satdt, &
456 vt2i,vt2s,acrfac, coecol, &
458 taucon, lencon, lenconcr, &
459 qimax, diameter, xni0, roqi0, &
460 fallsum, fallsum_qsi, xlwork2, factor, source, &
461 value, xlf, pfrzdtc, pfrzdtr, supice
463 REAL :: holdc, holdci
464 INTEGER :: i, j, k, mstepmax, &
465 iprt, latd, lond, loop, loops, ifsat, n, idim, kdim
466 ! Temporaries used for inlining fpvs function
467 REAL :: dldti, xb, xai, tr, xbi, xa, hvap, cvap, hsub, dldt, ttp
470 !=================================================================
471 ! compute internal functions
473 cpmcal(x) = cpd*(1.-max(x,qmin))+max(x,qmin)*cpv
474 xlcal(x) = xlv0-xlv1*(x-t0c)
475 !----------------------------------------------------------------
476 ! size distributions: (x=mixing ratio, y=air density):
477 ! valid for mixing ratio > 1.e-9 kg/kg.
479 ! Optimizatin : A**B => exp(log(A)*(B))
480 lamdac(x,y,z)= exp(log(((pidnc*z)/(x*y)))*((.33333333)))
482 !----------------------------------------------------------------
483 ! diffus: diffusion coefficient of the water vapor
484 ! viscos: kinematic viscosity(m2s-1)
485 ! diffus(x,y) = 8.794e-5 * exp(log(x)*(1.81)) / y
486 ! viscos(x,y) = 1.496e-6 * (x*sqrt(x)) /(x+120.)/y
487 ! xka(x,y) = 1.414e3*viscos(x,y)*y
488 ! diffac(a,b,c,d,e) = d*a*a/(xka(c,d)*rv*c*c)+1./(e*diffus(c,b))
489 ! venfac(a,b,c) = exp(log((viscos(b,c)/diffus(b,a)))*((.3333333))) &
490 ! /sqrt(viscos(b,c))*sqrt(sqrt(den0/c))
491 ! conden(a,b,c,d,e) = (max(b,qmin)-c)/(1.+d*d/(rv*e)*c/(a*a))
497 !----------------------------------------------------------------
498 ! paddint 0 for negative values generated by dynamics
502 qci(i,k,1) = max(qci(i,k,1),0.0)
503 qrs(i,k,1) = max(qrs(i,k,1),0.0)
504 qci(i,k,2) = max(qci(i,k,2),0.0)
505 qrs(i,k,2) = max(qrs(i,k,2),0.0)
506 ncr(i,k,1) = max(ncr(i,k,1),0.)
507 ncr(i,k,2) = max(ncr(i,k,2),0.)
508 ncr(i,k,3) = max(ncr(i,k,3),0.)
512 ! latent heat for phase changes and heat capacity. neglect the
513 ! changes during microphysical process calculation
518 cpm(i,k) = cpmcal(q(i,k))
519 xl(i,k) = xlcal(t(i,k))
520 delz_tmp(i,k) = delz(i,k)
521 den_tmp(i,k) = den(i,k)
525 !----------------------------------------------------------------
526 ! initialize the surface rain, snow
530 if(PRESENT (snowncv) .AND. PRESENT (snow)) snowncv(i) = 0.
532 ! new local array to catch step snow
536 !----------------------------------------------------------------
537 ! compute the minor time steps.
539 loops = max(nint(delt/dtcldcr),1)
541 if(delt.le.dtcldcr) dtcld = delt
545 !----------------------------------------------------------------
546 ! initialize the large scale variables
556 ! denfac(i,k) = sqrt(den0/den(i,k))
560 CALL VREC( tvec1(its), den(its,k), ite-its+1)
562 tvec1(i) = tvec1(i)*den0
564 CALL VSQRT( denfac(its,k), tvec1(its), ite-its+1)
567 ! Inline expansion for fpvs
568 ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
569 ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
579 xbi=xai+hsub/(rv*ttp)
580 ! this is for compilers where the conditional inhibits vectorization
581 #ifdef WSM_NO_CONDITIONAL_IN_VECTOR
584 if(t(i,k).lt.ttp) then
595 qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr))
596 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
597 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
598 qs(i,k,1) = max(qs(i,k,1),qmin)
599 rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin)
600 qs(i,k,2)=psat*exp(logtr*(xal(i))+xbl(i)*(1.-tr))
601 qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k))
602 qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2))
603 qs(i,k,2) = max(qs(i,k,2),qmin)
604 rh(i,k,2) = max(q(i,k) / qs(i,k,2),qmin)
612 qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr))
613 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
614 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
615 qs(i,k,1) = max(qs(i,k,1),qmin)
616 rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin)
617 if(t(i,k).lt.ttp) then
618 qs(i,k,2)=psat*exp(logtr*(xai)+xbi*(1.-tr))
620 qs(i,k,2)=psat*exp(logtr*(xa)+xb*(1.-tr))
622 qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k))
623 qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2))
624 qs(i,k,2) = max(qs(i,k,2),qmin)
625 rh(i,k,2) = max(q(i,k) / qs(i,k,2),qmin)
630 !----------------------------------------------------------------
631 ! initialize the variables for microphysical physics
669 !----------------------------------------------------------------
670 ! compute the fallout term:
671 ! first, vertical terminal velosity for minor loops
675 if(qci(i,k,1).le.qmin .or. ncr(i,k,2).le.ncmin)then
676 rslopec(i,k) = rslopecmax
677 rslopec2(i,k) = rslopec2max
678 rslopec3(i,k) = rslopec3max
680 rslopec(i,k) = 1./lamdac(qci(i,k,1),den(i,k),ncr(i,k,2))
681 rslopec2(i,k) = rslopec(i,k)*rslopec(i,k)
682 rslopec3(i,k) = rslopec2(i,k)*rslopec(i,k)
684 !-------------------------------------------------------------
685 ! Ni: ice crystal number concentraiton [HDC 5c]
686 !-------------------------------------------------------------
687 ! xni(i,k) = min(max(5.38e7*(den(i,k) &
688 ! *max(qci(i,k,2),qmin))**0.75,1.e3),1.e6)
689 temp = (den(i,k)*max(qci(i,k,2),qmin))
690 temp = sqrt(sqrt(temp*temp*temp))
691 xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6)
696 qrs_tmp(i,k,1) = qrs(i,k,1)
697 qrs_tmp(i,k,2) = qrs(i,k,2)
698 ncr_tmp(i,k) = ncr(i,k,3)
701 call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, &
702 rslope3,work1,workn,its,ite,kts,kte)
703 !----------------------------------------------------------------
704 ! compute the fallout term:
705 ! first, vertical terminal velosity for minor loops
706 !----------------------------------------------------------------
708 ! vt update for qr and nr
713 work1(i,k,1) = work1(i,k,1)/delz(i,k)
714 workn(i,k) = workn(i,k)/delz(i,k)
715 numdt(i) = max(nint(max(work1(i,k,1),workn(i,k))*dtcld+.5),1)
716 if(numdt(i).ge.mstep(i)) mstep(i) = numdt(i)
720 if(mstepmax.le.mstep(i)) mstepmax = mstep(i)
726 if(n.le.mstep(i)) then
727 falk(i,k,1) = den(i,k)*qrs(i,k,1)*work1(i,k,1)/mstep(i)
728 falkn(i,k) = ncr(i,k,3)*workn(i,k)/mstep(i)
729 fall(i,k,1) = fall(i,k,1)+falk(i,k,1)
730 falln(i,k) = falln(i,k)+falkn(i,k)
731 qrs(i,k,1) = max(qrs(i,k,1)-falk(i,k,1)*dtcld/den(i,k),0.)
732 ncr(i,k,3) = max(ncr(i,k,3)-falkn(i,k)*dtcld,0.)
735 do k = kte-1, kts, -1
737 if(n.le.mstep(i)) then
738 falk(i,k,1) = den(i,k)*qrs(i,k,1)*work1(i,k,1)/mstep(i)
739 falkn(i,k) = ncr(i,k,3)*workn(i,k)/mstep(i)
740 fall(i,k,1) = fall(i,k,1)+falk(i,k,1)
741 falln(i,k) = falln(i,k)+falkn(i,k)
742 qrs(i,k,1) = max(qrs(i,k,1)-(falk(i,k,1)-falk(i,k+1,1) &
743 *delz(i,k+1)/delz(i,k))*dtcld/den(i,k),0.)
744 ncr(i,k,3) = max(ncr(i,k,3)-(falkn(i,k)-falkn(i,k+1)*delz(i,k+1) &
745 /delz(i,k))*dtcld,0.)
751 qrs_tmp(i,k,1) = qrs(i,k,1)
752 ncr_tmp(i,k) = ncr(i,k,3)
755 call slope_rain(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, &
756 rslope3,work1,workn,its,ite,kts,kte)
759 work1(i,k,1) = work1(i,k,1)/delz(i,k)
760 workn(i,k) = workn(i,k)/delz(i,k)
767 works(i,k) = work1(i,k,2)
768 denqrs2(i,k) = den(i,k)*qrs(i,k,2)
769 if(qrs(i,k,2).le.0.0) works(i,k) = 0.0
772 call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,works,denqrs2, &
776 qrs(i,k,2) = max(denqrs2(i,k)/den(i,k),0.)
777 fall(i,k,2) = denqrs2(i,k)*works(i,k)/delz(i,k)
781 fall(i,1,2) = delqrs2(i)/delz(i,1)/dtcld
785 qrs_tmp(i,k,1) = qrs(i,k,1)
786 qrs_tmp(i,k,2) = qrs(i,k,2)
787 ncr_tmp(i,k) = ncr(i,k,3)
790 call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, &
791 rslope3,work1,workn,its,ite,kts,kte)
796 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
797 if(t(i,k).gt.t0c.and.qrs(i,k,2).gt.0.) then
798 !----------------------------------------------------------------
799 ! psmlt: melting of snow [HL A33] [RH83 A25]
801 !----------------------------------------------------------------
803 ! work2(i,k)= venfac(p(i,k),t(i,k),den(i,k))
804 work2(i,k)= (exp(log(((1.496e-6*((t(i,k))*sqrt(t(i,k))) &
805 /((t(i,k))+120.)/(den(i,k)))/(8.794e-5 &
806 *exp(log(t(i,k))*(1.81))/p(i,k)))) &
807 *((.3333333)))/sqrt((1.496e-6*((t(i,k)) &
808 *sqrt(t(i,k)))/((t(i,k))+120.)/(den(i,k)))) &
809 *sqrt(sqrt(den0/(den(i,k)))))
810 coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2))
811 ! psmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*pi/2. &
812 ! *n0sfac(i,k)*(precs1*rslope2(i,k,2)+precs2 &
813 ! *work2(i,k)*coeres)
814 psmlt(i,k) = (1.414e3*(1.496e-6 * ((t(i,k))*sqrt(t(i,k))) &
815 /((t(i,k))+120.)/(den(i,k)))*(den(i,k)))/xlf &
816 *(t0c-t(i,k))*pi/2.*n0sfac(i,k) &
817 *(precs1*rslope2(i,k,2)+precs2*work2(i,k)*coeres) &
819 psmlt(i,k) = min(max(psmlt(i,k)*dtcld/mstep(i),-qrs(i,k,2) &
821 !-------------------------------------------------------------------
822 ! nsmlt: melgin of snow [LH A27]
824 !-------------------------------------------------------------------
825 if(qrs(i,k,2).gt.qcrmin) then
826 sfac = rslope(i,k,2)*n0s*n0sfac(i,k)*mstep(i)/qrs(i,k,2)
827 ncr(i,k,3) = ncr(i,k,3) - sfac*psmlt(i,k)
829 qrs(i,k,2) = qrs(i,k,2) + psmlt(i,k)
830 qrs(i,k,1) = qrs(i,k,1) - psmlt(i,k)
831 t(i,k) = t(i,k) + xlf/cpm(i,k)*psmlt(i,k)
835 !---------------------------------------------------------------
836 ! Vice [ms-1] : fallout of ice crystal [HDC 5a]
837 !---------------------------------------------------------------
840 if(qci(i,k,2).le.0.) then
843 xmi = den(i,k)*qci(i,k,2)/xni(i,k)
844 diameter = max(min(dicon * sqrt(xmi),dimax), 1.e-25)
845 work1c(i,k) = 1.49e4*exp(log(diameter)*(1.31))
850 ! forward semi-laglangian scheme (JH), PCM (piecewise constant), (linear)
854 denqci(i,k) = den(i,k)*qci(i,k,2)
857 call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,work1c,denqci, &
861 qci(i,k,2) = max(denqci(i,k)/den(i,k),0.)
865 fallc(i,1) = delqi(i)/delz(i,1)/dtcld
868 !----------------------------------------------------------------
869 ! rain (unit is mm/sec;kgm-2s-1: /1000*delt ===> m)==> mm for wrf
872 fallsum = fall(i,1,1)+fall(i,1,2)+fallc(i,1)
873 fallsum_qsi = fall(i,1,2)+fallc(i,1)
874 if(fallsum.gt.0.) then
875 rainncv(i) = fallsum*delz(i,1)/denr*dtcld*1000. + rainncv(i)
876 rain(i) = fallsum*delz(i,1)/denr*dtcld*1000.+rain(i)
878 if(fallsum_qsi.gt.0.) then
879 tstepsnow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + tstepsnow(i)
880 if (PRESENT (snowncv) .and. PRESENT (snow)) then
881 snowncv(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + snowncv(i)
882 snow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000.+snow(i)
885 IF ( PRESENT (snowncv) ) THEN
886 if(fallsum.gt.0.) sr(i) = snowncv(i)/(rainncv(i)+1.e-12)
888 if(fallsum.gt.0.)sr(i)= tstepsnow(i)/(rainncv(i)+1.e-12)
892 !---------------------------------------------------------------
893 ! pimlt: instantaneous melting of cloud ice [HL A47] [RH83 A28]
895 !---------------------------------------------------------------
900 if(supcol.lt.0.) xlf = xlf0
901 if(supcol.lt.0 .and. qci(i,k,2).gt.0.) then
902 qci(i,k,1) = qci(i,k,1)+qci(i,k,2)
903 !---------------------------------------------------------------
904 ! nimlt: instantaneous melting of cloud ice [LH A18]
906 !--------------------------------------------------------------
907 ncr(i,k,2) = ncr(i,k,2) + xni(i,k)
908 t(i,k) = t(i,k) - xlf/cpm(i,k)*qci(i,k,2)
911 !---------------------------------------------------------------
912 ! pihmf: homogeneous freezing of cloud water below -40c [HL A45]
914 !---------------------------------------------------------------
915 if(supcol.gt.40. .and. qci(i,k,1).gt.0.) then
916 qci(i,k,2) = qci(i,k,2) + qci(i,k,1)
917 !---------------------------------------------------------------
918 ! nihmf: homogeneous of cloud water below -40c [LH A17]
920 !---------------------------------------------------------------
921 if(ncr(i,k,2).gt.0.) ncr(i,k,2) = 0.
922 t(i,k) = t(i,k) + xlf/cpm(i,k)*qci(i,k,1)
925 !---------------------------------------------------------------
926 ! pihtf: heterogeneous freezing of cloud water [HL A44]
927 ! (T0>T>-40C: QC->QI)
928 !---------------------------------------------------------------
929 if(supcol.gt.0. .and. qci(i,k,1).gt.0.) then
930 supcolt=min(supcol,70.)
931 pfrzdtc = min(pi*pi*pfrz1*(exp(pfrz2*supcolt)-1.)*denr/den(i,k) &
932 *ncr(i,k,2)*rslopec3(i,k)*rslopec3(i,k)/18.*dtcld,qci(i,k,1))
933 !---------------------------------------------------------------
934 ! nihtf: heterogeneous of cloud water [LH A16]
936 !---------------------------------------------------------------
937 if(ncr(i,k,2).gt.ncmin) then
938 nfrzdtc = min(pi*pfrz1*(exp(pfrz2*supcolt)-1.)*ncr(i,k,2) &
939 *rslopec3(i,k)/6.*dtcld,ncr(i,k,2))
940 ncr(i,k,2) = ncr(i,k,2) - nfrzdtc
942 qci(i,k,2) = qci(i,k,2) + pfrzdtc
943 t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtc
944 qci(i,k,1) = qci(i,k,1)-pfrzdtc
946 !---------------------------------------------------------------
947 ! psfrz: freezing of rain water [HL A20] [LFO 45]
949 !---------------------------------------------------------------
950 if(supcol.gt.0. .and. qrs(i,k,1).gt.0.) then
951 supcolt=min(supcol,70.)
952 pfrzdtr = min(140.*(pi*pi)*pfrz1*ncr(i,k,3)*denr/den(i,k) &
953 *(exp(pfrz2*supcolt)-1.)*rslope3(i,k,1)*rslope3(i,k,1) &
955 !---------------------------------------------------------------
956 ! nsfrz: freezing of rain water [LH A26]
958 !---------------------------------------------------------------
959 if(ncr(i,k,3).gt.nrmin) then
960 nfrzdtr = min(4.*pi*pfrz1*ncr(i,k,3)*(exp(pfrz2*supcolt)-1.) &
961 *rslope3(i,k,1)*dtcld,ncr(i,k,3))
962 ncr(i,k,3) = ncr(i,k,3)-nfrzdtr
964 qrs(i,k,2) = qrs(i,k,2) + pfrzdtr
965 t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtr
966 qrs(i,k,1) = qrs(i,k,1)-pfrzdtr
973 ncr(i,k,2) = max(ncr(i,k,2),0.0)
974 ncr(i,k,3) = max(ncr(i,k,3),0.0)
977 !----------------------------------------------------------------
978 ! update the slope parameters for microphysics computation
982 qrs_tmp(i,k,1) = qrs(i,k,1)
983 qrs_tmp(i,k,2) = qrs(i,k,2)
984 ncr_tmp(i,k) = ncr(i,k,3)
987 call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, &
988 rslope3,work1,workn,its,ite,kts,kte)
991 !-----------------------------------------------------------------
992 ! compute the mean-volume drop diameter [LH A10]
993 ! for raindrop distribution
994 !-----------------------------------------------------------------
995 avedia(i,k,2) = rslope(i,k,1)*((24.)**(.3333333))
996 if(qci(i,k,1).le.qmin .or. ncr(i,k,2).le.ncmin) then
997 rslopec(i,k) = rslopecmax
998 rslopec2(i,k) = rslopec2max
999 rslopec3(i,k) = rslopec3max
1001 rslopec(i,k) = 1./lamdac(qci(i,k,1),den(i,k),ncr(i,k,2))
1002 rslopec2(i,k) = rslopec(i,k)*rslopec(i,k)
1003 rslopec3(i,k) = rslopec2(i,k)*rslopec(i,k)
1005 !--------------------------------------------------------------------
1006 ! compute the mean-volume drop diameter [LH A7]
1007 ! for cloud-droplet distribution
1008 !--------------------------------------------------------------------
1009 avedia(i,k,1) = rslopec(i,k)
1012 !----------------------------------------------------------------
1013 ! work1: the thermodynamic term in the denominator associated with
1014 ! heat conduction and vapor diffusion
1016 ! work2: parameter associated with the ventilation effects(y93)
1020 ! work1(i,k,1) = diffac(xl(i,k),p(i,k),t(i,k),den(i,k),qs(i,k,1))
1021 work1(i,k,1) = ((((den(i,k))*(xl(i,k))*(xl(i,k)))*((t(i,k))+120.) &
1022 *(den(i,k)))/(1.414e3*(1.496e-6*((t(i,k))*sqrt(t(i,k))))&
1023 *(den(i,k))*(rv*(t(i,k))*(t(i,k))))) &
1024 + p(i,k)/((qs(i,k,1))*(8.794e-5*exp(log(t(i,k))*(1.81))))
1025 ! work1(i,k,2) = diffac(xls,p(i,k),t(i,k),den(i,k),qs(i,k,2))
1026 work1(i,k,2) = ((((den(i,k))*(xls)*(xls))*((t(i,k))+120.)*(den(i,k)))&
1027 /(1.414e3*(1.496e-6*((t(i,k))*sqrt(t(i,k))))*(den(i,k)) &
1028 *(rv*(t(i,k))*(t(i,k)))) &
1029 + p(i,k)/(qs(i,k,2)*(8.794e-5*exp(log(t(i,k))*(1.81)))))
1030 ! work2(i,k) = venfac(p(i,k),t(i,k),den(i,k))
1031 work2(i,k) = (exp(.3333333*log(((1.496e-6 * ((t(i,k))*sqrt(t(i,k)))) &
1032 *p(i,k))/(((t(i,k))+120.)*den(i,k)*(8.794e-5 &
1033 *exp(log(t(i,k))*(1.81))))))*sqrt(sqrt(den0/(den(i,k))))) &
1034 /sqrt((1.496e-6*((t(i,k))*sqrt(t(i,k)))) &
1035 /(((t(i,k))+120.)*den(i,k)))
1039 !===============================================================
1041 ! warm rain processes
1043 ! - follows the processes in RH83 and LFO except for autoconcersion
1045 !===============================================================
1049 supsat = max(q(i,k),qmin)-qs(i,k,1)
1050 satdt = supsat/dtcld
1051 !---------------------------------------------------------------
1052 ! praut: auto conversion rate from cloud to rain [LH 9] [CP 17]
1054 !---------------------------------------------------------------
1055 lencon = 2.7e-2*den(i,k)*qci(i,k,1)*(1.e20/16.*rslopec2(i,k) &
1057 lenconcr = max(1.2*lencon,qcrmin)
1058 if(avedia(i,k,1).gt.di15) then
1059 taucon = 3.7/den(i,k)/qci(i,k,1)/(0.5e6*rslopec(i,k)-7.5)
1060 taucon = max(taucon, 1.e-12)
1061 praut(i,k) = lencon/(taucon*den(i,k))
1062 praut(i,k) = min(max(praut(i,k),0.),qci(i,k,1)/dtcld)
1063 !---------------------------------------------------------------
1064 ! nraut: auto conversion rate from cloud to rain [LH A6][CP 18 & 19]
1066 !---------------------------------------------------------------
1067 nraut(i,k) = 3.5e9*den(i,k)*praut(i,k)
1068 if(qrs(i,k,1).gt.lenconcr) &
1069 nraut(i,k) = ncr(i,k,3)/qrs(i,k,1)*praut(i,k)
1070 nraut(i,k) = min(nraut(i,k),ncr(i,k,2)/dtcld)
1072 !---------------------------------------------------------------
1073 ! pracw: accretion of cloud water by rain [LH 10][CP 22 & 23]
1075 ! nracw: accretion of cloud water by rain [LH A9]
1077 !---------------------------------------------------------------
1078 if(qrs(i,k,1).ge.lenconcr) then
1079 if(avedia(i,k,2).ge.di100) then
1080 nracw(i,k) = min(ncrk1*ncr(i,k,2)*ncr(i,k,3)*(rslopec3(i,k) &
1081 + 24.*rslope3(i,k,1)),ncr(i,k,2)/dtcld)
1082 pracw(i,k) = min(pi/6.*(denr/den(i,k))*ncrk1*ncr(i,k,2) &
1083 *ncr(i,k,3)*rslopec3(i,k)*(2.*rslopec3(i,k) &
1084 + 24.*rslope3(i,k,1)),qci(i,k,1)/dtcld)
1086 nracw(i,k) = min(ncrk2*ncr(i,k,2)*ncr(i,k,3)*(2.*rslopec3(i,k) &
1087 *rslopec3(i,k)+5040.*rslope3(i,k,1) &
1088 *rslope3(i,k,1)),ncr(i,k,2)/dtcld)
1089 pracw(i,k) = min(pi/6.*(denr/den(i,k))*ncrk2*ncr(i,k,2) &
1090 *ncr(i,k,3)*rslopec3(i,k)*(6.*rslopec3(i,k) &
1091 *rslopec3(i,k)+5040.*rslope3(i,k,1) &
1092 *rslope3(i,k,1)),qci(i,k,1)/dtcld)
1095 !----------------------------------------------------------------
1096 ! nccol: self collection of cloud water [LH A8][CP 24 & 25]
1098 !----------------------------------------------------------------
1099 if(avedia(i,k,1).ge.di100) then
1100 nccol(i,k) = ncrk1*ncr(i,k,2)*ncr(i,k,2)*rslopec3(i,k)
1102 nccol(i,k) = 2.*ncrk2*ncr(i,k,2)*ncr(i,k,2)*rslopec3(i,k) &
1105 !----------------------------------------------------------------
1106 ! nrcol: self collection of rain-drops and break-up [LH A21][CP 24 & 25]
1108 !----------------------------------------------------------------
1109 if(qrs(i,k,1).ge.lenconcr) then
1110 if(avedia(i,k,2).lt.di100) then
1111 nrcol(i,k) = 5040.*ncrk2*ncr(i,k,3)*ncr(i,k,3)*rslope3(i,k,1) &
1113 elseif(avedia(i,k,2).ge.di100 .and. avedia(i,k,2).lt.di600) then
1114 nrcol(i,k) = 24.*ncrk1*ncr(i,k,3)*ncr(i,k,3)*rslope3(i,k,1)
1115 elseif(avedia(i,k,2).ge.di600 .and. avedia(i,k,2).lt.di2000) then
1116 coecol = -2.5e3*(avedia(i,k,2)-di600)
1117 nrcol(i,k) = 24.*exp(coecol)*ncrk1*ncr(i,k,3)*ncr(i,k,3) &
1123 !---------------------------------------------------------------
1124 ! prevp: evaporation/condensation rate of rain [HL A41]
1125 ! (QV->QR or QR->QV)
1126 !---------------------------------------------------------------
1127 if(qrs(i,k,1).gt.0.) then
1128 coeres = rslope(i,k,1)*sqrt(rslope(i,k,1)*rslopeb(i,k,1))
1129 prevp(i,k) = (rh(i,k,1)-1.)*ncr(i,k,3)*(precr1*rslope(i,k,1) &
1130 +precr2*work2(i,k)*coeres)/work1(i,k,1)
1131 if(prevp(i,k).lt.0.) then
1132 prevp(i,k) = max(prevp(i,k),-qrs(i,k,1)/dtcld)
1133 prevp(i,k) = max(prevp(i,k),satdt/2)
1134 !----------------------------------------------------------------
1135 ! Nrevp: evaporation/condensation rate of rain [LH A14]
1137 !----------------------------------------------------------------
1138 if(prevp(i,k).eq.-qrs(i,k,1)/dtcld) then
1139 ncr(i,k,1) = ncr(i,k,1) + ncr(i,k,3)
1144 prevp(i,k) = min(prevp(i,k),satdt/2)
1150 !===============================================================
1152 ! cold rain processes
1154 ! - follows the revised ice microphysics processes in HDC
1155 ! - the processes same as in RH83 and RH84 and LFO behave
1156 ! following ice crystal hapits defined in HDC, inclduing
1157 ! intercept parameter for snow (n0s), ice crystal number
1158 ! concentration (ni), ice nuclei number concentration
1159 ! (n0i), ice diameter (d)
1161 !===============================================================
1167 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
1168 supsat = max(q(i,k),qmin)-qs(i,k,2)
1169 satdt = supsat/dtcld
1171 !-------------------------------------------------------------
1172 ! Ni: ice crystal number concentraiton [HDC 5c]
1173 !-------------------------------------------------------------
1174 ! xni(i,k) = min(max(5.38e7*(den(i,k) &
1175 ! *max(qci(i,k,2),qmin))**0.75,1.e3),1.e6)
1176 temp = (den(i,k)*max(qci(i,k,2),qmin))
1177 temp = sqrt(sqrt(temp*temp*temp))
1178 xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6)
1179 eacrs = exp(0.07*(-supcol))
1181 if(supcol.gt.0) then
1182 if(qrs(i,k,2).gt.qcrmin .and. qci(i,k,2).gt.qmin) then
1183 xmi = den(i,k)*qci(i,k,2)/xni(i,k)
1184 diameter = min(dicon * sqrt(xmi),dimax)
1185 vt2i = 1.49e4*diameter**1.31
1186 vt2s = pvts*rslopeb(i,k,2)*denfac(i,k)
1187 !-------------------------------------------------------------
1188 ! psaci: Accretion of cloud ice by rain [HDC 10]
1190 !-------------------------------------------------------------
1191 acrfac = 2.*rslope3(i,k,2)+2.*diameter*rslope2(i,k,2) &
1192 + diameter**2*rslope(i,k,2)
1193 psaci(i,k) = pi*qci(i,k,2)*eacrs*n0s*n0sfac(i,k)*abs(vt2s-vt2i) &
1197 !-------------------------------------------------------------
1198 ! psacw: Accretion of cloud water by snow [HL A7] [LFO 24]
1199 ! (T<T0: QC->QS, and T>=T0: QC->QR)
1200 !-------------------------------------------------------------
1201 if(qrs(i,k,2).gt.qcrmin .and. qci(i,k,1).gt.qmin) then
1202 psacw(i,k) = min(pacrc*n0sfac(i,k)*rslope3(i,k,2)*rslopeb(i,k,2) &
1203 *qci(i,k,1)*denfac(i,k),qci(i,k,1)*rdtcld)
1205 !-------------------------------------------------------------
1206 ! nsacw: Accretion of cloud water by snow [LH A12]
1208 !-------------------------------------------------------------
1209 if(qrs(i,k,2).gt.qcrmin .and. ncr(i,k,2).gt.ncmin) then
1210 nsacw(i,k) = min(pacrc*n0sfac(i,k)*rslope3(i,k,2)*rslopeb(i,k,2) &
1211 *ncr(i,k,2)*denfac(i,k),ncr(i,k,2)/dtcld)
1213 if(supcol.le.0) then
1215 !--------------------------------------------------------------
1216 ! nseml: Enhanced melting of snow by accretion of water [LH A29]
1218 !--------------------------------------------------------------
1219 if (qrs(i,k,2).gt.qcrmin) then
1220 sfac = rslope(i,k,2)*n0s*n0sfac(i,k)/qrs(i,k,2)
1221 nseml(i,k) = -sfac*min(max(cliq*supcol*(psacw(i,k))/xlf &
1222 ,-qrs(i,k,2)/dtcld),0.)
1225 if(supcol.gt.0) then
1226 !-------------------------------------------------------------
1227 ! pidep: Deposition/Sublimation rate of ice [HDC 9]
1228 ! (T<T0: QV->QI or QI->QV)
1229 !-------------------------------------------------------------
1230 if(qci(i,k,2).gt.0 .and. ifsat.ne.1) then
1231 xmi = den(i,k)*qci(i,k,2)/xni(i,k)
1232 diameter = dicon * sqrt(xmi)
1233 pidep(i,k) = 4.*diameter*xni(i,k)*(rh(i,k,2)-1.)/work1(i,k,2)
1234 supice = satdt-prevp(i,k)
1235 if(pidep(i,k).lt.0.) then
1236 ! pidep(i,k) = max(max(pidep(i,k),satdt/2),supice)
1237 ! pidep(i,k) = max(pidep(i,k),-qci(i,k,2)/dtcld)
1238 pidep(i,k) = max(max(pidep(i,k),satdt*.5),supice)
1239 pidep(i,k) = max(pidep(i,k),-qci(i,k,2)*rdtcld)
1241 ! pidep(i,k) = min(min(pidep(i,k),satdt/2),supice)
1242 pidep(i,k) = min(min(pidep(i,k),satdt*.5),supice)
1244 if(abs(prevp(i,k)+pidep(i,k)).ge.abs(satdt)) ifsat = 1
1246 !-------------------------------------------------------------
1247 ! psdep: deposition/sublimation rate of snow [HDC 14]
1248 ! (QV->QS or QS->QV)
1249 !-------------------------------------------------------------
1250 if(qrs(i,k,2).gt.0. .and. ifsat.ne.1) then
1251 coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2))
1252 psdep(i,k) = (rh(i,k,2)-1.)*n0sfac(i,k)*(precs1*rslope2(i,k,2) &
1253 + precs2*work2(i,k)*coeres)/work1(i,k,2)
1254 supice = satdt-prevp(i,k)-pidep(i,k)
1255 if(psdep(i,k).lt.0.) then
1256 ! psdep(i,k) = max(psdep(i,k),-qrs(i,k,2)/dtcld)
1257 ! psdep(i,k) = max(max(psdep(i,k),satdt/2),supice)
1258 psdep(i,k) = max(psdep(i,k),-qrs(i,k,2)*rdtcld)
1259 psdep(i,k) = max(max(psdep(i,k),satdt*.5),supice)
1261 ! psdep(i,k) = min(min(psdep(i,k),satdt/2),supice)
1262 psdep(i,k) = min(min(psdep(i,k),satdt*.5),supice)
1264 if(abs(prevp(i,k)+pidep(i,k)+psdep(i,k)).ge.abs(satdt)) ifsat = 1
1266 !-------------------------------------------------------------
1267 ! pigen: generation(nucleation) of ice from vapor [HL A50] [HDC 7-8]
1269 !-------------------------------------------------------------
1270 if(supsat.gt.0 .and. ifsat.ne.1) then
1271 supice = satdt-prevp(i,k)-pidep(i,k)-psdep(i,k)
1272 xni0 = 1.e3*exp(0.1*supcol)
1273 roqi0 = 4.92e-11*exp(log(xni0)*(1.33))
1274 pigen(i,k) = max(0.,(roqi0/den(i,k)-max(qci(i,k,2),0.))*rdtcld)
1275 pigen(i,k) = min(min(pigen(i,k),satdt),supice)
1278 !-------------------------------------------------------------
1279 ! psaut: conversion(aggregation) of ice to snow [HDC 12]
1281 !-------------------------------------------------------------
1282 if(qci(i,k,2).gt.0.) then
1283 qimax = roqimax/den(i,k)
1284 ! psaut(i,k) = max(0.,(qci(i,k,2)-qimax)/dtcld)
1285 psaut(i,k) = max(0.,(qci(i,k,2)-qimax)*rdtcld)
1288 !-------------------------------------------------------------
1289 ! psevp: Evaporation of melting snow [HL A35] [RH83 A27]
1291 !-------------------------------------------------------------
1292 if(supcol.lt.0.) then
1293 if(qrs(i,k,2).gt.0. .and. rh(i,k,1).lt.1.) &
1294 psevp(i,k) = psdep(i,k)*work1(i,k,2)/work1(i,k,1)
1295 ! psevp(i,k) = min(max(psevp(i,k),-qrs(i,k,2)/dtcld),0.)
1296 psevp(i,k) = min(max(psevp(i,k),-qrs(i,k,2)*rdtcld),0.)
1302 !----------------------------------------------------------------
1303 ! check mass conservation of generation terms and feedback to the
1308 if(t(i,k).le.t0c) then
1312 value = max(qmin,qci(i,k,1))
1313 source = (praut(i,k)+pracw(i,k)+psacw(i,k))*dtcld
1314 if (source.gt.value) then
1315 factor = value/source
1316 praut(i,k) = praut(i,k)*factor
1317 pracw(i,k) = pracw(i,k)*factor
1318 psacw(i,k) = psacw(i,k)*factor
1323 value = max(qmin,qci(i,k,2))
1324 source = (psaut(i,k)+psaci(i,k)-pigen(i,k)-pidep(i,k))*dtcld
1325 if (source.gt.value) then
1326 factor = value/source
1327 psaut(i,k) = psaut(i,k)*factor
1328 psaci(i,k) = psaci(i,k)*factor
1329 pigen(i,k) = pigen(i,k)*factor
1330 pidep(i,k) = pidep(i,k)*factor
1336 value = max(qmin,qrs(i,k,1))
1337 source = (-praut(i,k)-pracw(i,k)-prevp(i,k))*dtcld
1338 if (source.gt.value) then
1339 factor = value/source
1340 praut(i,k) = praut(i,k)*factor
1341 pracw(i,k) = pracw(i,k)*factor
1342 prevp(i,k) = prevp(i,k)*factor
1347 value = max(qmin,qrs(i,k,2))
1348 source = (-psdep(i,k)-psaut(i,k)-psaci(i,k)-psacw(i,k))*dtcld
1349 if (source.gt.value) then
1350 factor = value/source
1351 psdep(i,k) = psdep(i,k)*factor
1352 psaut(i,k) = psaut(i,k)*factor
1353 psaci(i,k) = psaci(i,k)*factor
1354 psacw(i,k) = psacw(i,k)*factor
1359 value = max(ncmin,ncr(i,k,2))
1360 source = (+nraut(i,k)+nccol(i,k)+nracw(i,k)+nsacw(i,k))*dtcld
1361 if (source.gt.value) then
1362 factor = value/source
1363 nraut(i,k) = nraut(i,k)*factor
1364 nccol(i,k) = nccol(i,k)*factor
1365 nracw(i,k) = nracw(i,k)*factor
1366 nsacw(i,k) = nsacw(i,k)*factor
1371 value = max(nrmin,ncr(i,k,3))
1372 source = (-nraut(i,k)+nrcol(i,k))*dtcld
1373 if (source.gt.value) then
1374 factor = value/source
1375 nraut(i,k) = nraut(i,k)*factor
1376 nrcol(i,k) = nrcol(i,k)*factor
1379 work2(i,k)=-(prevp(i,k)+psdep(i,k)+pigen(i,k)+pidep(i,k))
1381 q(i,k) = q(i,k)+work2(i,k)*dtcld
1382 qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k)+psacw(i,k) &
1384 qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k)+prevp(i,k) &
1386 qci(i,k,2) = max(qci(i,k,2)-(psaut(i,k)+psaci(i,k)-pigen(i,k) &
1387 -pidep(i,k))*dtcld,0.)
1388 qrs(i,k,2) = max(qrs(i,k,2)+(psdep(i,k)+psaut(i,k)+psaci(i,k) &
1389 +psacw(i,k))*dtcld,0.)
1390 ncr(i,k,2) = max(ncr(i,k,2)+(-nraut(i,k)-nccol(i,k)-nracw(i,k) &
1391 -nsacw(i,k))*dtcld,0.)
1392 ncr(i,k,3) = max(ncr(i,k,3)+(nraut(i,k)-nrcol(i,k)) &
1395 xlwork2 = -xls*(psdep(i,k)+pidep(i,k)+pigen(i,k)) &
1396 -xl(i,k)*prevp(i,k)-xlf*psacw(i,k)
1397 t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld
1402 value = max(qmin,qci(i,k,1))
1403 source=(praut(i,k)+pracw(i,k)+psacw(i,k))*dtcld
1404 if (source.gt.value) then
1405 factor = value/source
1406 praut(i,k) = praut(i,k)*factor
1407 pracw(i,k) = pracw(i,k)*factor
1408 psacw(i,k) = psacw(i,k)*factor
1413 value = max(qmin,qrs(i,k,1))
1414 source = (-praut(i,k)-pracw(i,k)-prevp(i,k) &
1416 if (source.gt.value) then
1417 factor = value/source
1418 praut(i,k) = praut(i,k)*factor
1419 pracw(i,k) = pracw(i,k)*factor
1420 prevp(i,k) = prevp(i,k)*factor
1421 psacw(i,k) = psacw(i,k)*factor
1426 value = max(qcrmin,qrs(i,k,2))
1427 source=(-psevp(i,k))*dtcld
1428 if (source.gt.value) then
1429 factor = value/source
1430 psevp(i,k) = psevp(i,k)*factor
1435 value = max(ncmin,ncr(i,k,2))
1436 source = (+nraut(i,k)+nccol(i,k)+nracw(i,k)+nsacw(i,k))*dtcld
1437 if (source.gt.value) then
1438 factor = value/source
1439 nraut(i,k) = nraut(i,k)*factor
1440 nccol(i,k) = nccol(i,k)*factor
1441 nracw(i,k) = nracw(i,k)*factor
1442 nsacw(i,k) = nsacw(i,k)*factor
1447 value = max(nrmin,ncr(i,k,3))
1448 source = (-nraut(i,k)-nseml(i,k)+nrcol(i,k))*dtcld
1449 if (source.gt.value) then
1450 factor = value/source
1451 nraut(i,k) = nraut(i,k)*factor
1452 nseml(i,k) = nseml(i,k)*factor
1453 nrcol(i,k) = nrcol(i,k)*factor
1455 work2(i,k)=-(prevp(i,k)+psevp(i,k))
1457 q(i,k) = q(i,k)+work2(i,k)*dtcld
1458 qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k)+psacw(i,k) &
1460 qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k)+prevp(i,k) &
1461 +psacw(i,k))*dtcld,0.)
1462 qrs(i,k,2) = max(qrs(i,k,2)+psevp(i,k)*dtcld,0.)
1463 ncr(i,k,2) = max(ncr(i,k,2)+(-nraut(i,k)-nccol(i,k)-nracw(i,k) &
1464 -nsacw(i,k))*dtcld,0.)
1465 ncr(i,k,3) = max(ncr(i,k,3)+(nraut(i,k)+nseml(i,k)-nrcol(i,k) &
1468 xlwork2 = -xl(i,k)*(prevp(i,k)+psevp(i,k))
1469 t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld
1474 ! Inline expansion for fpvs
1475 ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
1476 ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
1486 xbi=xai+hsub/(rv*ttp)
1491 qs(i,k,1)=psat*exp(logtr*(xa)+xb*(1.-tr))
1492 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
1493 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
1494 qs(i,k,1) = max(qs(i,k,1),qmin)
1495 rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin)
1499 call slope_wdm5(qrs_tmp,ncr_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2, &
1500 rslope3,work1,workn,its,ite,kts,kte)
1503 !-----------------------------------------------------------------
1504 ! re-compute the mean-volume drop diameter [LH A10]
1505 ! for raindrop distribution
1506 !-----------------------------------------------------------------
1507 avedia(i,k,2) = rslope(i,k,1)*((24.)**(.3333333))
1508 !----------------------------------------------------------------
1509 ! Nrevp_s: evaporation/condensation rate of rain [LH A14]
1511 !----------------------------------------------------------------
1512 if(avedia(i,k,2).le.di82) then
1513 ncr(i,k,2) = ncr(i,k,2)+ncr(i,k,3)
1515 !----------------------------------------------------------------
1516 ! Prevp_s: evaporation/condensation rate of rain [LH A15] [KK 23]
1518 !----------------------------------------------------------------
1519 qci(i,k,1) = qci(i,k,1)+qrs(i,k,1)
1527 !-------------------------------------------------------------------
1528 ! rate of change of cloud drop concentration due to CCN activation
1529 ! pcact: QV -> QC [LH 8] [KK 14]
1530 ! ncact: NCCN -> NC [LH A2] [KK 12]
1531 !-------------------------------------------------------------------
1532 if(rh(i,k,1).gt.1.) then
1533 ncact(i,k) = max(0.,((ncr(i,k,1)+ncr(i,k,2)) &
1534 *min(1.,(rh(i,k,1)/satmax)**actk) - ncr(i,k,2)))/dtcld
1535 ncact(i,k) =min(ncact(i,k),max(ncr(i,k,1),0.)/dtcld)
1536 pcact(i,k) = min(4.*pi*denr*(actr*1.E-6)**3*ncact(i,k)/ &
1537 (3.*den(i,k)),max(q(i,k),0.)/dtcld)
1538 q(i,k) = max(q(i,k)-pcact(i,k)*dtcld,0.)
1539 qci(i,k,1) = max(qci(i,k,1)+pcact(i,k)*dtcld,0.)
1540 ncr(i,k,1) = max(ncr(i,k,1)-ncact(i,k)*dtcld,0.)
1541 ncr(i,k,2) = max(ncr(i,k,2)+ncact(i,k)*dtcld,0.)
1542 t(i,k) = t(i,k)+pcact(i,k)*xl(i,k)/cpm(i,k)*dtcld
1544 !---------------------------------------------------------------------
1545 ! pcond:condensational/evaporational rate of cloud water [HL A46] [RH83 A6]
1546 ! if there exists additional water vapor condensated/if
1547 ! evaporation of cloud water is not enough to remove subsaturation
1548 ! (QV->QC or QC->QV)
1549 !---------------------------------------------------------------------
1551 qs(i,k,1)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
1552 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
1553 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
1554 qs(i,k,1) = max(qs(i,k,1),qmin)
1555 work1(i,k,1) = ((max(q(i,k),qmin)-(qs(i,k,1)))/(1.+(xl(i,k)) &
1556 *(xl(i,k))/(rv*(cpm(i,k)))*(qs(i,k,1))/((t(i,k)) &
1558 work2(i,k) = qci(i,k,1)+work1(i,k,1)
1559 pcond(i,k) = min(max(work1(i,k,1)/dtcld,0.),max(q(i,k),0.)/dtcld)
1560 if(qci(i,k,1).gt.0. .and. work1(i,k,1).lt.0.) &
1561 pcond(i,k) = max(work1(i,k,1),-qci(i,k,1))/dtcld
1562 !----------------------------------------------------------------------
1563 ! ncevp: evpration of Cloud number concentration [LH A3]
1565 !----------------------------------------------------------------------
1566 if(pcond(i,k).eq.-qci(i,k,1)/dtcld) then
1567 ncr(i,k,1) = ncr(i,k,1)+ncr(i,k,2)
1571 q(i,k) = q(i,k)-pcond(i,k)*dtcld
1572 qci(i,k,1) = max(qci(i,k,1)+pcond(i,k)*dtcld,0.)
1573 t(i,k) = t(i,k)+pcond(i,k)*xl(i,k)/cpm(i,k)*dtcld
1577 !----------------------------------------------------------------
1578 ! padding for small values
1582 if(qci(i,k,1).le.qmin) qci(i,k,1) = 0.0
1583 if(qci(i,k,2).le.qmin) qci(i,k,2) = 0.0
1584 if(qrs(i,k,1).ge.qcrmin .and. ncr(i,k,3) .ge. nrmin) then
1585 lamdr_tmp(i,k) = exp(log(((pidnr*ncr(i,k,3)) &
1586 /(den(i,k)*qrs(i,k,1))))*((.33333333)))
1587 if(lamdr_tmp(i,k) .le. lamdarmin) then
1588 lamdr_tmp(i,k) = lamdarmin
1589 ncr(i,k,3) = den(i,k)*qrs(i,k,1)*lamdr_tmp(i,k)**3/pidnr
1590 elseif(lamdr_tmp(i,k) .ge. lamdarmax) then
1591 lamdr_tmp(i,k) = lamdarmax
1592 ncr(i,k,3) = den(i,k)*qrs(i,k,1)*lamdr_tmp(i,k)**3/pidnr
1595 if(qci(i,k,1).ge.qmin .and. ncr(i,k,2) .ge. ncmin ) then
1596 lamdc_tmp(i,k) = exp(log(((pidnc*ncr(i,k,2)) &
1597 /(den(i,k)*qci(i,k,1))))*((.33333333)))
1598 if(lamdc_tmp(i,k) .le. lamdacmin) then
1599 lamdc_tmp(i,k) = lamdacmin
1600 ncr(i,k,2) = den(i,k)*qci(i,k,1)*lamdc_tmp(i,k)**3/pidnc
1601 elseif(lamdc_tmp(i,k) .ge. lamdacmax) then
1602 lamdc_tmp(i,k) = lamdacmax
1603 ncr(i,k,2) = den(i,k)*qci(i,k,1)*lamdc_tmp(i,k)**3/pidnc
1609 END SUBROUTINE wdm52d
1610 ! ...................................................................
1611 REAL FUNCTION rgmma(x)
1612 !-------------------------------------------------------------------
1614 !-------------------------------------------------------------------
1615 ! rgmma function: use infinite product form
1617 PARAMETER (euler=0.577215664901532)
1623 rgmma=x*exp(euler*x)
1626 rgmma=rgmma*(1.000+x/y)*exp(-x/y)
1632 !--------------------------------------------------------------------------
1633 REAL FUNCTION fpvs(t,ice,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c)
1634 !--------------------------------------------------------------------------
1636 !--------------------------------------------------------------------------
1637 REAL t,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c,dldt,xa,xb,dldti, &
1640 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1647 xbi=xai+hsub/(rv*ttp)
1649 if(t.lt.ttp .and. ice.eq.1) then
1650 fpvs=psat*exp(log(tr)*(xai))*exp(xbi*(1.-tr))
1652 fpvs=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
1654 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1656 !-------------------------------------------------------------------
1657 SUBROUTINE wdm5init(den0,denr,dens,cl,cpv,ccn0,allowed_to_read)
1658 !-------------------------------------------------------------------
1660 !-------------------------------------------------------------------
1661 !.... constants which may not be tunable
1662 REAL, INTENT(IN) :: den0,denr,dens,cl,cpv,ccn0
1663 LOGICAL, INTENT(IN) :: allowed_to_read
1668 qc0 = 4./3.*pi*denr*r0**3*xncr/den0 ! 0.419e-3 -- .61e-3
1669 qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03
1678 bvtr2o5 = 2.5+.5*bvtr
1679 bvtr3o5 = 3.5+.5*bvtr
1680 g1pbr = rgmma(bvtr1)
1681 g2pbr = rgmma(bvtr2)
1682 g3pbr = rgmma(bvtr3)
1683 g4pbr = rgmma(bvtr4) ! 17.837825
1684 g5pbr = rgmma(bvtr5)
1685 g7pbr = rgmma(bvtr7)
1686 g5pbro2 = rgmma(bvtr2o5)
1687 g7pbro2 = rgmma(bvtr3o5)
1688 pvtr = avtr*g5pbr/24.
1691 pacrr = pi*n0r*avtr*g3pbr*.25*eacrr
1693 precr2 = 2.*pi*.31*avtr**.5*g7pbro2
1694 pidn0r = pi*denr*n0r
1696 xmmax = (dimax/dicon)**2
1697 roqimax = 2.08e22*dimax**8
1703 g1pbs = rgmma(bvts1) !.8875
1704 g3pbs = rgmma(bvts3)
1705 g4pbs = rgmma(bvts4) ! 12.0786
1706 g5pbso2 = rgmma(bvts2)
1707 pvts = avts*g4pbs/6.
1708 pacrs = pi*n0s*avts*g3pbs*.25
1710 precs2 = 4.*n0s*.44*avts**.5*g5pbso2
1711 pidn0s = pi*dens*n0s
1712 pacrc = pi*n0s*avts*g3pbs*.25*eacrc
1714 rslopecmax = 1./lamdacmax
1715 rslopermax = 1./lamdarmax
1716 rslopesmax = 1./lamdasmax
1717 rsloperbmax = rslopermax ** bvtr
1718 rslopesbmax = rslopesmax ** bvts
1719 rslopec2max = rslopecmax * rslopecmax
1720 rsloper2max = rslopermax * rslopermax
1721 rslopes2max = rslopesmax * rslopesmax
1722 rslopec3max = rslopec2max * rslopecmax
1723 rsloper3max = rsloper2max * rslopermax
1724 rslopes3max = rslopes2max * rslopesmax
1726 !+---+-----------------------------------------------------------------+
1727 !..Set these variables needed for computing radar reflectivity. These
1728 !.. get used within radar_init to create other variables used in the
1736 xam_g = PI*dens/6. ! These 3 variables for graupel are set but unused.
1741 !+---+-----------------------------------------------------------------+
1743 END SUBROUTINE wdm5init
1744 !------------------------------------------------------------------------------
1745 subroutine slope_wdm5(qrs,ncr,den,denfac,t,rslope,rslopeb,rslope2,rslope3, &
1746 vt,vtn,its,ite,kts,kte)
1748 INTEGER :: its,ite, jts,jte, kts,kte
1749 REAL, DIMENSION( its:ite , kts:kte,2) :: &
1756 REAL, DIMENSION( its:ite , kts:kte) :: &
1762 REAL, PARAMETER :: t0c = 273.15
1763 REAL, DIMENSION( its:ite , kts:kte ) :: &
1765 REAL :: lamdar, lamdas, x, y, z, supcol
1767 !----------------------------------------------------------------
1768 ! size distributions: (x=mixing ratio, y=air density):
1769 ! valid for mixing ratio > 1.e-9 kg/kg.
1771 ! Optimizatin : A**B => exp(log(A)*(B))
1772 lamdar(x,y,z)= exp(log(((pidnr*z)/(x*y)))*((.33333333)))
1773 lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25
1778 !---------------------------------------------------------------
1779 ! n0s: Intercept parameter for snow [m-4] [HDC 6]
1780 !---------------------------------------------------------------
1781 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
1782 if(qrs(i,k,1).le.qcrmin .or. ncr(i,k).le.nrmin ) then
1783 rslope(i,k,1) = rslopermax
1784 rslopeb(i,k,1) = rsloperbmax
1785 rslope2(i,k,1) = rsloper2max
1786 rslope3(i,k,1) = rsloper3max
1788 rslope(i,k,1) = min(1./lamdar(qrs(i,k,1),den(i,k),ncr(i,k)),1.e-3)
1789 rslopeb(i,k,1) = rslope(i,k,1)**bvtr
1790 rslope2(i,k,1) = rslope(i,k,1)*rslope(i,k,1)
1791 rslope3(i,k,1) = rslope2(i,k,1)*rslope(i,k,1)
1793 if(qrs(i,k,2).le.qcrmin) then
1794 rslope(i,k,2) = rslopesmax
1795 rslopeb(i,k,2) = rslopesbmax
1796 rslope2(i,k,2) = rslopes2max
1797 rslope3(i,k,2) = rslopes3max
1799 rslope(i,k,2) = 1./lamdas(qrs(i,k,2),den(i,k),n0sfac(i,k))
1800 rslopeb(i,k,2) = rslope(i,k,2)**bvts
1801 rslope2(i,k,2) = rslope(i,k,2)*rslope(i,k,2)
1802 rslope3(i,k,2) = rslope2(i,k,2)*rslope(i,k,2)
1804 vt(i,k,1) = pvtr*rslopeb(i,k,1)*denfac(i,k)
1805 vt(i,k,2) = pvts*rslopeb(i,k,2)*denfac(i,k)
1806 vtn(i,k) = pvtrn*rslopeb(i,k,1)*denfac(i,k)
1807 if(qrs(i,k,1).le.0.0) vt(i,k,1) = 0.0
1808 if(qrs(i,k,2).le.0.0) vt(i,k,2) = 0.0
1809 if(ncr(i,k).le.0.0) vtn(i,k) = 0.0
1812 END subroutine slope_wdm5
1813 !-----------------------------------------------------------------------------
1814 subroutine slope_rain(qrs,ncr,den,denfac,t,rslope,rslopeb,rslope2,rslope3, &
1815 vt,vtn,its,ite,kts,kte)
1817 INTEGER :: its,ite, jts,jte, kts,kte
1818 REAL, DIMENSION( its:ite , kts:kte) :: &
1830 REAL, PARAMETER :: t0c = 273.15
1831 REAL, DIMENSION( its:ite , kts:kte ) :: &
1833 REAL :: lamdar, x, y, z, supcol
1835 !----------------------------------------------------------------
1836 ! size distributions: (x=mixing ratio, y=air density):
1837 ! valid for mixing ratio > 1.e-9 kg/kg.
1838 lamdar(x,y,z)= exp(log(((pidnr*z)/(x*y)))*((.33333333)))
1842 if(qrs(i,k).le.qcrmin .or. ncr(i,k).le.nrmin) then
1843 rslope(i,k) = rslopermax
1844 rslopeb(i,k) = rsloperbmax
1845 rslope2(i,k) = rsloper2max
1846 rslope3(i,k) = rsloper3max
1848 rslope(i,k) = min(1./lamdar(qrs(i,k),den(i,k),ncr(i,k)),1.e-3)
1849 rslopeb(i,k) = rslope(i,k)**bvtr
1850 rslope2(i,k) = rslope(i,k)*rslope(i,k)
1851 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
1853 vt(i,k) = pvtr*rslopeb(i,k)*denfac(i,k)
1854 vtn(i,k) = pvtrn*rslopeb(i,k)*denfac(i,k)
1855 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
1856 if(ncr(i,k).le.0.0) vtn(i,k) = 0.0
1859 END subroutine slope_rain
1860 !------------------------------------------------------------------------------
1861 subroutine slope_snow(qrs,den,denfac,t,rslope,rslopeb,rslope2,rslope3, &
1864 INTEGER :: its,ite, jts,jte, kts,kte
1865 REAL, DIMENSION( its:ite , kts:kte) :: &
1875 REAL, PARAMETER :: t0c = 273.15
1876 REAL, DIMENSION( its:ite , kts:kte ) :: &
1878 REAL :: lamdas, x, y, z, supcol
1880 !----------------------------------------------------------------
1881 ! size distributions: (x=mixing ratio, y=air density):
1882 ! valid for mixing ratio > 1.e-9 kg/kg.
1883 lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25
1888 !---------------------------------------------------------------
1889 ! n0s: Intercept parameter for snow [m-4] [HDC 6]
1890 !---------------------------------------------------------------
1891 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
1892 if(qrs(i,k).le.qcrmin)then
1893 rslope(i,k) = rslopesmax
1894 rslopeb(i,k) = rslopesbmax
1895 rslope2(i,k) = rslopes2max
1896 rslope3(i,k) = rslopes3max
1898 rslope(i,k) = 1./lamdas(qrs(i,k),den(i,k),n0sfac(i,k))
1899 rslopeb(i,k) = rslope(i,k)**bvts
1900 rslope2(i,k) = rslope(i,k)*rslope(i,k)
1901 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
1903 vt(i,k) = pvts*rslopeb(i,k)*denfac(i,k)
1904 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
1907 END subroutine slope_snow
1908 !-------------------------------------------------------------------
1909 SUBROUTINE nislfv_rain_plm(im,km,denl,denfacl,tkl,dzl,wwl,rql,precip,dt,id,iter)
1910 !-------------------------------------------------------------------
1912 ! for non-iteration semi-Lagrangain forward advection for cloud
1913 ! with mass conservation and positive definite advection
1914 ! 2nd order interpolation with monotonic piecewise linear method
1915 ! this routine is under assumption of decfl < 1 for semi_Lagrangian
1917 ! dzl depth of model layer in meter
1918 ! wwl terminal velocity at model layer m/s
1919 ! rql cloud density*mixing ration
1920 ! precip precipitation
1922 ! id kind of precip: 0 test case; 1 raindrop 2: snow
1923 ! iter how many time to guess mean terminal velocity: 0 pure forward.
1924 ! 0 : use departure wind for advection
1925 ! 1 : use mean wind for advection
1926 ! > 1 : use mean wind after iter-1 iterations
1928 ! author: hann-ming henry juang <henry.juang@noaa.gov>
1929 ! implemented by song-you hong
1934 real dzl(im,km),wwl(im,km),rql(im,km),precip(im)
1935 real denl(im,km),denfacl(im,km),tkl(im,km)
1937 integer i,k,n,m,kk,kb,kt,iter
1938 real tl,tl2,qql,dql,qqd
1940 real zsum,qsum,dim,dip,c1,con1,fa1,fa2
1941 real allold, allnew, zz, dzamin, cflmax, decfl
1942 real dz(km), ww(km), qq(km), wd(km), wa(km), was(km)
1943 real den(km), denfac(km), tk(km)
1944 real wi(km+1), zi(km+1), za(km+1)
1945 real qn(km), qr(km),tmp(km),tmp1(km),tmp2(km),tmp3(km)
1946 real dza(km+1), qa(km+1), qmi(km+1), qpi(km+1)
1951 ! -----------------------------------
1956 denfac(:) = denfacl(i,:)
1958 ! skip for no precipitation for all layers
1961 allold = allold + qq(k)
1963 if(allold.le.0.0) then
1967 ! compute interface values
1970 zi(k+1) = zi(k)+dz(k)
1973 ! save departure wind
1977 ! plm is 2nd order, we can use 2nd order wi or 3rd order wi
1978 ! 2nd order interpolation to get wi
1982 wi(k) = (ww(k)*dz(k-1)+ww(k-1)*dz(k))/(dz(k-1)+dz(k))
1984 ! 3rd order interpolation to get wi
1988 wi(2) = 0.5*(ww(2)+ww(1))
1990 wi(k) = fa1*(ww(k)+ww(k-1))-fa2*(ww(k+1)+ww(k-2))
1992 wi(km) = 0.5*(ww(km)+ww(km-1))
1995 ! terminate of top of raingroup
1997 if( ww(k).eq.0.0 ) wi(k)=ww(k-1)
2003 decfl = (wi(k+1)-wi(k))*dt/dz(k)
2004 if( decfl .gt. con1 ) then
2005 wi(k) = wi(k+1) - con1*dz(k)/dt
2008 ! compute arrival point
2010 za(k) = zi(k) - wi(k)*dt
2014 dza(k) = za(k+1)-za(k)
2016 dza(km+1) = zi(km+1) - za(km+1)
2018 ! computer deformation at arrival point
2020 qa(k) = qq(k)*dz(k)/dza(k)
2021 qr(k) = qa(k)/den(k)
2024 ! call maxmin(km,1,qa,' arrival points ')
2026 ! compute arrival terminal velocity, and estimate mean terminal velocity
2027 ! then back to use mean terminal velocity
2028 if( n.le.iter ) then
2031 ! call slope_rain(qr,den,denfac,tk,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km)
2033 call slope_snow(qr,den,denfac,tk,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km)
2035 if( n.ge.2 ) wa(1:km)=0.5*(wa(1:km)+was(1:km))
2038 ! print*,' slope_wsm3 ',qr(k)*1000.,den(k),denfac(k),tk(k),tmp(k),tmp1(k),tmp2(k),ww(k),wa(k)
2040 ! mean wind is average of departure and new arrival winds
2041 ww(k) = 0.5* ( wd(k)+wa(k) )
2048 ! estimate values at arrival cell interface with monotone
2050 dip=(qa(k+1)-qa(k))/(dza(k+1)+dza(k))
2051 dim=(qa(k)-qa(k-1))/(dza(k-1)+dza(k))
2052 if( dip*dim.le.0.0 ) then
2056 qpi(k)=qa(k)+0.5*(dip+dim)*dza(k)
2057 qmi(k)=2.0*qa(k)-qpi(k)
2058 if( qpi(k).lt.0.0 .or. qmi(k).lt.0.0 ) then
2069 ! interpolation to regular point
2077 if( zi(k).ge.za(km+1) ) then
2080 find_kb : do kk=kb,km
2081 if( zi(k).le.za(kk+1) ) then
2088 find_kt : do kk=kt,km
2089 if( zi(k+1).le.za(kk) ) then
2097 ! compute q with piecewise constant method
2099 tl=(zi(k)-za(kb))/dza(kb)
2100 th=(zi(k+1)-za(kb))/dza(kb)
2103 qqd=0.5*(qpi(kb)-qmi(kb))
2104 qqh=qqd*th2+qmi(kb)*th
2105 qql=qqd*tl2+qmi(kb)*tl
2106 qn(k) = (qqh-qql)/(th-tl)
2107 else if( kt.gt.kb ) then
2108 tl=(zi(k)-za(kb))/dza(kb)
2110 qqd=0.5*(qpi(kb)-qmi(kb))
2111 qql=qqd*tl2+qmi(kb)*tl
2113 zsum = (1.-tl)*dza(kb)
2115 if( kt-kb.gt.1 ) then
2117 zsum = zsum + dza(m)
2118 qsum = qsum + qa(m) * dza(m)
2121 th=(zi(k+1)-za(kt))/dza(kt)
2123 qqd=0.5*(qpi(kt)-qmi(kt))
2124 dqh=qqd*th2+qmi(kt)*th
2125 zsum = zsum + th*dza(kt)
2126 qsum = qsum + dqh*dza(kt)
2135 sum_precip: do k=1,km
2136 if( za(k).lt.0.0 .and. za(k+1).lt.0.0 ) then
2137 precip(i) = precip(i) + qa(k)*dza(k)
2139 else if ( za(k).lt.0.0 .and. za(k+1).ge.0.0 ) then
2140 precip(i) = precip(i) + qa(k)*(0.0-za(k))
2146 ! replace the new values
2149 ! ----------------------------------
2152 END SUBROUTINE nislfv_rain_plm
2155 !+---+-----------------------------------------------------------------+
2156 subroutine refl10cm_wdm5 (qv1d, qr1d, nr1d, qs1d, &
2157 t1d, p1d, dBZ, kts, kte, ii, jj)
2162 INTEGER, INTENT(IN):: kts, kte, ii, jj
2163 REAL, DIMENSION(kts:kte), INTENT(IN):: &
2164 qv1d, qr1d, nr1d, qs1d, t1d, p1d
2165 REAL, DIMENSION(kts:kte), INTENT(INOUT):: dBZ
2168 REAL, DIMENSION(kts:kte):: temp, pres, qv, rho
2169 REAL, DIMENSION(kts:kte):: rr, nr, rs
2172 DOUBLE PRECISION, DIMENSION(kts:kte):: ilamr, ilams
2173 DOUBLE PRECISION, DIMENSION(kts:kte):: N0_r, N0_s
2174 DOUBLE PRECISION:: lamr, lams
2175 LOGICAL, DIMENSION(kts:kte):: L_qr, L_qs
2177 REAL, DIMENSION(kts:kte):: ze_rain, ze_snow
2178 DOUBLE PRECISION:: fmelt_s
2180 INTEGER:: i, k, k_0, kbot, n
2183 DOUBLE PRECISION:: cback, x, eta, f_d
2184 REAL, PARAMETER:: R=287.
2192 !+---+-----------------------------------------------------------------+
2193 !..Put column of data into local arrays.
2194 !+---+-----------------------------------------------------------------+
2197 temp_C = min(-0.001, temp(K)-273.15)
2198 qv(k) = MAX(1.E-10, qv1d(k))
2200 rho(k) = 0.622*pres(k)/(R*temp(k)*(qv(k)+0.622))
2202 if (qr1d(k) .gt. 1.E-9) then
2203 rr(k) = qr1d(k)*rho(k)
2204 nr(k) = nr1d(k)*rho(k)
2205 lamr = (xam_r*xcrg(3)*xorg2*nr(k)/rr(k))**xobmr
2207 N0_r(k) = nr(k)*xorg2*lamr**xcre(2)
2215 if (qs1d(k) .gt. 1.E-9) then
2216 rs(k) = qs1d(k)*rho(k)
2217 N0_s(k) = min(n0smax, n0s*exp(-alpha*temp_C))
2218 lams = (xam_s*xcsg(3)*N0_s(k)/rs(k))**(1./xcse(1))
2228 !+---+-----------------------------------------------------------------+
2229 !..Locate K-level of start of melting (k_0 is level above).
2230 !+---+-----------------------------------------------------------------+
2233 do k = kte-1, kts, -1
2234 if ( (temp(k).gt.273.15) .and. L_qr(k) .and. L_qs(k+1) ) then
2242 !+---+-----------------------------------------------------------------+
2243 !..Assume Rayleigh approximation at 10 cm wavelength. Rain (all temps)
2244 !.. and non-water-coated snow and graupel when below freezing are
2245 !.. simple. Integrations of m(D)*m(D)*N(D)*dD.
2246 !+---+-----------------------------------------------------------------+
2251 if (L_qr(k)) ze_rain(k) = N0_r(k)*xcrg(4)*ilamr(k)**xcre(4)
2252 if (L_qs(k)) ze_snow(k) = (0.176/0.93) * (6.0/PI)*(6.0/PI) &
2253 * (xam_s/900.0)*(xam_s/900.0) &
2254 * N0_s(k)*xcsg(4)*ilams(k)**xcse(4)
2258 !+---+-----------------------------------------------------------------+
2259 !..Special case of melting ice (snow/graupel) particles. Assume the
2260 !.. ice is surrounded by the liquid water. Fraction of meltwater is
2261 !.. extremely simple based on amount found above the melting level.
2262 !.. Uses code from Uli Blahak (rayleigh_soak_wetgraupel and supporting
2264 !+---+-----------------------------------------------------------------+
2266 if (melti .and. k_0.ge.kts+1) then
2267 do k = k_0-1, kts, -1
2269 !..Reflectivity contributed by melting snow
2270 if (L_qs(k) .and. L_qs(k_0) ) then
2271 fmelt_s = MAX(0.005d0, MIN(1.0d0-rs(k)/rs(k_0), 0.99d0))
2275 x = xam_s * xxDs(n)**xbm_s
2276 call rayleigh_soak_wetgraupel (x,DBLE(xocms),DBLE(xobms), &
2277 fmelt_s, melt_outside_s, m_w_0, m_i_0, lamda_radar, &
2278 CBACK, mixingrulestring_s, matrixstring_s, &
2279 inclusionstring_s, hoststring_s, &
2280 hostmatrixstring_s, hostinclusionstring_s)
2281 f_d = N0_s(k)*xxDs(n)**xmu_s * DEXP(-lams*xxDs(n))
2282 eta = eta + f_d * CBACK * simpson(n) * xdts(n)
2284 ze_snow(k) = SNGL(lamda4 / (pi5 * K_w) * eta)
2290 dBZ(k) = 10.*log10((ze_rain(k)+ze_snow(k))*1.d18)
2294 end subroutine refl10cm_wdm5
2295 !+---+-----------------------------------------------------------------+
2297 !-----------------------------------------------------------------------
2298 subroutine effectRad_wdm5 (t, qc, nc, qi, qs, rho, qmin, t0c, &
2299 re_qc, re_qi, re_qs, kts, kte, ii, jj)
2301 !-----------------------------------------------------------------------
2302 ! Compute radiation effective radii of cloud water, ice, and snow for
2303 ! double-moment microphysics..
2304 ! These are entirely consistent with microphysics assumptions, not
2305 ! constant or otherwise ad hoc as is internal to most radiation
2307 ! Coded and implemented by Soo Ya Bae, KIAPS, January 2015.
2308 !-----------------------------------------------------------------------
2312 integer, intent(in) :: kts, kte, ii, jj
2313 real, intent(in) :: qmin
2314 real, intent(in) :: t0c
2315 real, dimension( kts:kte ), intent(in):: t
2316 real, dimension( kts:kte ), intent(in):: qc
2317 real, dimension( kts:kte ), intent(in):: nc
2318 real, dimension( kts:kte ), intent(in):: qi
2319 real, dimension( kts:kte ), intent(in):: qs
2320 real, dimension( kts:kte ), intent(in):: rho
2321 real, dimension( kts:kte ), intent(inout):: re_qc
2322 real, dimension( kts:kte ), intent(inout):: re_qi
2323 real, dimension( kts:kte ), intent(inout):: re_qs
2327 real, dimension( kts:kte ):: ni
2328 real, dimension( kts:kte ):: rqc
2329 real, dimension( kts:kte ):: rnc
2330 real, dimension( kts:kte ):: rqi
2331 real, dimension( kts:kte ):: rni
2332 real, dimension( kts:kte ):: rqs
2335 real :: supcol, n0sfac, lamdas
2336 real :: diai ! diameter of ice in m
2337 double precision :: lamc
2338 logical :: has_qc, has_qi, has_qs
2339 !..Minimum microphys values
2340 real, parameter :: R1 = 1.E-12
2341 real, parameter :: R2 = 1.E-6
2342 real, parameter :: pi = 3.1415926536
2343 real, parameter :: bm_r = 3.0
2344 real, parameter :: obmr = 1.0/bm_r
2345 real, parameter :: cdm = 5./3.
2355 rqc(k) = max(R1, qc(k)*rho(k))
2356 rnc(k) = max(R2, nc(k)*rho(k))
2357 if (rqc(k).gt.R1 .and. rnc(k).gt.R2) has_qc = .true.
2359 rqi(k) = max(R1, qi(k)*rho(k))
2360 temp = (rho(k)*max(qi(k),qmin))
2361 temp = sqrt(sqrt(temp*temp*temp))
2362 ni(k) = min(max(5.38e7*temp,1.e3),1.e6)
2363 rni(k)= max(R2, ni(k)*rho(k))
2364 if (rqi(k).gt.R1 .and. rni(k).gt.R2) has_qi = .true.
2366 rqs(k) = max(R1, qs(k)*rho(k))
2367 if (rqs(k).gt.R1) has_qs = .true.
2372 if (rqc(k).le.R1 .or. rnc(k).le.R2) CYCLE
2373 lamc = 2.*cdm2*(pidnc*nc(k)/rqc(k))**obmr
2374 re_qc(k) = max(2.51e-6,min(sngl(1.0d0/lamc),50.e-6))
2380 if (rqi(k).le.R1 .or. rni(k).le.R2) CYCLE
2381 diai = 11.9*sqrt(rqi(k)/ni(k))
2382 re_qi(k) = max(10.01e-6,min(0.75*0.163*diai,125.e-6))
2388 if (rqs(k).le.R1) CYCLE
2390 n0sfac = max(min(exp(alpha*supcol),n0smax/n0s),1.)
2391 lamdas = sqrt(sqrt(pidn0s*n0sfac/rqs(k)))
2392 re_qs(k) = max(25.e-6,min(0.5*(1./lamdas),999.e-6))
2396 end subroutine effectRad_wdm5
2397 !-----------------------------------------------------------------------
2399 END MODULE module_mp_wdm5