12 USE module_model_constants, only : RE_QC_BG, RE_QI_BG, RE_QS_BG
14 REAL, PARAMETER, PRIVATE :: dtcldcr = 120. ! maximum time step for minor loops
15 REAL, PARAMETER, PRIVATE :: n0r = 8.e6 ! intercept parameter rain
16 REAL, PARAMETER, PRIVATE :: n0g = 4.e6 ! intercept parameter graupel
17 REAL, PARAMETER, PRIVATE :: n0h = 4.e4 ! intercept parameter hail
18 REAL, PARAMETER, PRIVATE :: avtr = 841.9 ! a constant for terminal velocity of rain
19 REAL, PARAMETER, PRIVATE :: bvtr = 0.8 ! a constant for terminal velocity of rain
20 REAL, PARAMETER, PRIVATE :: r0 = .8e-5 ! 8 microm in contrast to 10 micro m
21 REAL, PARAMETER, PRIVATE :: peaut = .55 ! collection efficiency
22 REAL, PARAMETER, PRIVATE :: xncr = 3.e8 ! maritime cloud in contrast to 3.e8 in tc80
23 REAL, PARAMETER, PRIVATE :: xmyu = 1.718e-5 ! the dynamic viscosity kgm-1s-1
24 REAL, PARAMETER, PRIVATE :: avts = 11.72 ! a constant for terminal velocity of snow
25 REAL, PARAMETER, PRIVATE :: bvts = .41 ! a constant for terminal velocity of snow
26 REAL, PARAMETER, PRIVATE :: avtg = 330. ! a constant for terminal velocity of graupel
27 REAL, PARAMETER, PRIVATE :: bvtg = 0.8 ! a constant for terminal velocity of graupel
28 REAL, PARAMETER, PRIVATE :: deng = 500. ! density of graupel
29 REAL, PARAMETER, PRIVATE :: avth = 285. ! a constant for terminal velocity of hail
30 REAL, PARAMETER, PRIVATE :: bvth = 0.8 ! a constant for terminal velocity of hail
31 REAL, PARAMETER, PRIVATE :: denh = 912. ! density of hail
32 REAL, PARAMETER, PRIVATE :: n0smax = 1.e11 ! maximum n0s (t=-90C unlimited)
33 REAL, PARAMETER, PRIVATE :: lamdarmax = 8.e4 ! limited maximum value for slope parameter of rain
34 REAL, PARAMETER, PRIVATE :: lamdasmax = 1.e5 ! limited maximum value for slope parameter of snow
35 REAL, PARAMETER, PRIVATE :: lamdagmax = 6.e4 ! limited maximum value for slope parameter of graupel
36 REAL, PARAMETER, PRIVATE :: lamdahmax = 2.e4 ! limited maximum value for slope parameter of hail
37 REAL, PARAMETER, PRIVATE :: dicon = 11.9 ! constant for the cloud-ice diamter
38 REAL, PARAMETER, PRIVATE :: dimax = 500.e-6 ! limited maximum value for the cloud-ice diamter
39 REAL, PARAMETER, PRIVATE :: n0s = 2.e6 ! temperature dependent intercept parameter snow
40 REAL, PARAMETER, PRIVATE :: alpha = .12 ! .122 exponen factor for n0s
41 REAL, PARAMETER, PRIVATE :: pfrz1 = 100. ! constant in Biggs freezing
42 REAL, PARAMETER, PRIVATE :: pfrz2 = 0.66 ! constant in Biggs freezing
43 REAL, PARAMETER, PRIVATE :: qcrmin = 1.e-9 ! minimun values for qr, qs, and qg
44 REAL, PARAMETER, PRIVATE :: eacrc = 1.0 ! Snow/cloud-water collection efficiency
45 REAL, PARAMETER, PRIVATE :: eachr = 1.0 ! Hail/rain collection efficiency
46 REAL, PARAMETER, PRIVATE :: eachs = 1.0 ! Hail/snow collection efficiency
47 REAL, PARAMETER, PRIVATE :: eachg = 0.5 ! Hail/graupel collection efficiency
48 REAL, PARAMETER, PRIVATE :: dens = 100.0 ! Density of snow
49 REAL, PARAMETER, PRIVATE :: qs0 = 6.e-4 ! threshold amount for aggretion to occur
50 REAL, PARAMETER, PRIVATE :: t00 = 238.16
51 REAL, PARAMETER, PRIVATE :: t01 = 273.16
52 REAL, PARAMETER, PRIVATE :: cd = 0.6 ! drag coefficient for hailsone
55 bvtr1,bvtr2,bvtr3,bvtr4,g1pbr, &
56 g3pbr,g4pbr,g5pbro2,pvtr,eacrr,pacrr, &
58 precr1,precr2,roqimax,bvts1, &
59 bvts2,bvts3,bvts4,g1pbs,g3pbs,g4pbs, &
60 g5pbso2,pvts,pacrs,precs1,precs2,pidn0r, &
61 pidn0s,xlv1,pacrc,pi, &
62 bvtg1,bvtg2,bvtg3,bvtg4,g1pbg, &
63 g3pbg,g4pbg,g5pbgo2,g6pbgh,pvtg,pacrg, &
64 precg1,precg2,precg3,pidn0g, &
66 g3pbh,g4pbh,g5pbho2,pvth,pacrh, &
67 prech1,prech2,prech3,pidn0h, &
68 rslopermax,rslopesmax,rslopegmax,rslopehmax, &
69 rsloperbmax,rslopesbmax,rslopegbmax,rslopehbmax, &
70 rsloper2max,rslopes2max,rslopeg2max,rslopeh2max, &
71 rsloper3max,rslopes3max,rslopeg3max,rslopeh3max
73 !===================================================================
75 SUBROUTINE wsm7(th, q, qc, qr, qi, qs, qg, qh &
77 ,delt,g, cpd, cpv, rd, rv, t0c &
79 ,XLS, XLV0, XLF0, den0, denr &
84 ,refl_10cm, diagflag, do_radar_ref &
85 ,graupel, graupelncv &
87 ,has_reqc, has_reqi, has_reqs & ! for radiation
88 ,re_cloud, re_ice, re_snow & ! for radiation
89 ,ids,ide, jds,jde, kds,kde &
90 ,ims,ime, jms,jme, kms,kme &
91 ,its,ite, jts,jte, kts,kte &
93 !-------------------------------------------------------------------
95 !-------------------------------------------------------------------
96 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
97 ims,ime, jms,jme, kms,kme , &
98 its,ite, jts,jte, kts,kte
99 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
109 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
115 REAL, INTENT(IN ) :: delt, &
133 REAL, DIMENSION( ims:ime , jms:jme ), &
134 INTENT(INOUT) :: rain, &
138 ! for radiation connecting
140 INTEGER, INTENT(IN):: &
144 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), &
149 !+---+-----------------------------------------------------------------+
150 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT):: & ! GT
152 !+---+-----------------------------------------------------------------+
154 REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, &
155 INTENT(INOUT) :: snow, &
157 REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, &
158 INTENT(INOUT) :: graupel, &
160 REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, &
161 INTENT(INOUT) :: hail, &
166 REAL, DIMENSION( its:ite , kts:kte ) :: t
167 REAL, DIMENSION( its:ite , kts:kte, 2 ) :: qci
168 REAL, DIMENSION( its:ite , kts:kte, 4 ) :: qrs
171 !+---+-----------------------------------------------------------------+
172 REAL, DIMENSION(kts:kte):: qv1d, t1d, p1d, qr1d, qs1d, qg1d, dBZ
173 LOGICAL, OPTIONAL, INTENT(IN) :: diagflag
174 INTEGER, OPTIONAL, INTENT(IN) :: do_radar_ref
176 ! to calculate effective radius for radiation
178 REAL, DIMENSION( kts:kte ) :: den1d
179 REAL, DIMENSION( kts:kte ) :: qc1d
180 REAL, DIMENSION( kts:kte ) :: qi1d
181 REAL, DIMENSION( kts:kte ) :: re_qc, re_qi, re_qs
182 !------------------------------------------------------------------------------
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 qrs(i,k,3) = qg(i,k,j)
192 qrs(i,k,4) = qh(i,k,j)
195 ! Sending array starting locations of optional variables may cause
196 ! troubles, so we explicitly change the call.
197 CALL wsm72D(t, q(ims,kms,j), qci, qrs &
199 ,p(ims,kms,j), delz(ims,kms,j) &
200 ,delt,g, cpd, cpv, rd, rv, t0c &
202 ,XLS, XLV0, XLF0, den0, denr &
205 ,rain(ims,j),rainncv(ims,j) &
207 ,ids,ide, jds,jde, kds,kde &
208 ,ims,ime, jms,jme, kms,kme &
209 ,its,ite, jts,jte, kts,kte &
211 ,graupel,graupelncv &
216 th(i,k,j)=t(i,k)/pii(i,k,j)
217 qc(i,k,j) = qci(i,k,1)
218 qi(i,k,j) = qci(i,k,2)
219 qr(i,k,j) = qrs(i,k,1)
220 qs(i,k,j) = qrs(i,k,2)
221 qg(i,k,j) = qrs(i,k,3)
222 qh(i,k,j) = qrs(i,k,4)
225 !------------------------------------------------------------------------------
226 IF ( PRESENT (diagflag) ) THEN
227 if (diagflag .and. do_radar_ref == 1) then
230 t1d(k)=th(i,k,j)*pii(i,k,j)
237 call refl10cm_wsm7 (qv1d, qr1d, qs1d, qg1d, &
238 t1d, p1d, dBZ, kts, kte, i, j)
240 refl_10cm(i,k,j) = MAX(-35., dBZ(k))
246 if (has_reqc.ne.0 .and. has_reqi.ne.0 .and. has_reqs.ne.0) then
253 t1d(k) = th(i,k,j)*pii(i,k,j)
260 call effectRad_wsm7(t1d, qc1d, qi1d, qs1d, den1d, &
261 qmin, t0c, re_qc, re_qi, re_qs, &
265 re_cloud(i,k,j) = MAX(RE_QC_BG, MIN(re_qc(k), 50.E-6))
266 re_ice(i,k,j) = MAX(RE_QI_BG, MIN(re_qi(k), 125.E-6))
267 re_snow(i,k,j) = MAX(RE_QS_BG, MIN(re_qs(k), 999.E-6))
270 endif ! if has_reqc ne 0 end
274 !===================================================================
276 SUBROUTINE wsm72D(t, q &
277 ,qci, qrs, den, p, delz &
278 ,delt,g, cpd, cpv, rd, rv, t0c &
280 ,XLS, XLV0, XLF0, den0, denr &
285 ,ids,ide, jds,jde, kds,kde &
286 ,ims,ime, jms,jme, kms,kme &
287 ,its,ite, jts,jte, kts,kte &
289 ,graupel,graupelncv &
292 !-------------------------------------------------------------------
294 !-------------------------------------------------------------------
296 ! This code is a 7-class hail phase microphyiscs scheme (WSM7) of the
297 ! Single-Moment MicroPhyiscs (WSMMP, Bae et al. 2018). The WSMMP assumes
298 ! assumes that ice nuclei number concentration is a function of temperature,
299 ! and seperate assumption is developed, in which ice crystal number
300 ! concentration is a function of ice amount. A theoretical background of
301 ! the ice-microphysics and related processes in the WSMMPs are described
302 ! in Hong et al. (2004).
303 ! All production terms in the WSM7 scheme are described in Bae et al (2018).
304 ! All units are in m.k.s. and source/sink terms in kgkg-1s-1.
308 ! Coded by Soo Ya Bae (KIAPS) Winter 2015
310 ! Implemented by Soo Ya Bae (KIAPS) Winter 2018
312 ! further modifications :
313 ! semi-lagrangian sedimentation (JH,2010),hong, aug 2009
314 ! ==> higher accuracy and efficient at lower resolutions
315 ! reflectivity computation from greg thompson, lim, jun 2011
316 ! ==> only diagnostic, but with removal of too large drops
317 ! add hail option from afwa, aug 2014
318 ! ==> switch graupel or hail by changing no, den, fall vel.
319 ! effective radius of hydrometeors, bae from kiaps, jan 2015
320 ! ==> consistency in solar insolation of rrtmg radiation
323 ! Bae, Hong, Tao (BHT, 2018) Asia-Pacific J. Atmos. Sci.
324 ! Hong, Dudhia, Chen (HDC, 2004) Mon. Wea. Rev.
325 ! Hong and Lim (HL, 2006) J. Korean Meteor. Soc.
326 ! Dudhia, Hong and Lim (DHL, 2008) J. Meteor. Soc. Japan
327 ! Lin, Farley, Orville (LFO, 1983) J. Appl. Meteor.
328 ! Rutledge, Hobbs (RH83, 1983) J. Atmos. Sci.
329 ! Rutledge, Hobbs (RH84, 1984) J. Atmos. Sci.
330 ! Juang and Hong (JH, 2010) Mon. Wea. Rev.
332 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
333 ims,ime, jms,jme, kms,kme , &
334 its,ite, jts,jte, kts,kte, &
336 REAL, DIMENSION( its:ite , kts:kte ), &
339 REAL, DIMENSION( its:ite , kts:kte, 2 ), &
342 REAL, DIMENSION( its:ite , kts:kte, 4 ), &
345 REAL, DIMENSION( ims:ime , kms:kme ), &
348 REAL, DIMENSION( ims:ime , kms:kme ), &
353 REAL, INTENT(IN ) :: delt, &
371 REAL, DIMENSION( ims:ime ), &
372 INTENT(INOUT) :: rain, &
375 REAL, DIMENSION( ims:ime, jms:jme ), OPTIONAL, &
376 INTENT(INOUT) :: snow, &
378 REAL, DIMENSION( ims:ime, jms:jme ), OPTIONAL, &
379 INTENT(INOUT) :: graupel, &
381 REAL, DIMENSION( ims:ime, jms:jme ), OPTIONAL, &
382 INTENT(INOUT) :: hail, &
387 REAL, DIMENSION( its:ite , kts:kte , 3) :: &
390 REAL, DIMENSION( its:ite , kts:kte, 4) :: &
399 REAL, DIMENSION( its:ite , kts:kte ) :: &
407 REAL, DIMENSION( its:ite , kts:kte ) :: &
410 REAL, DIMENSION( its:ite , kts:kte ) :: &
454 REAL, DIMENSION( its:ite , kts:kte ) :: &
457 REAL, DIMENSION( its:ite , kts:kte ) :: &
470 REAL, DIMENSION( its:ite ) :: delqrs1, &
475 REAL, DIMENSION( its:ite ) :: tstepsnow, &
478 INTEGER, DIMENSION( its:ite ) :: mstep, &
480 LOGICAL, DIMENSION( its:ite ) :: flgcld
482 cpmcal, xlcal, diffus, &
483 viscos, xka, venfac, conden, diffac, &
484 x, y, z, a, b, c, d, e, &
485 qdt, holdrr, holdrs, holdrg, supcol, supcolt, pvt, &
486 coeres, supsat, dtcld, xmi, eacrs, satdt, &
487 qimax, diameter, xni0, roqi0, &
488 fallsum, fallsum_qsi, fallsum_qg, fallsum_qh, &
489 vt2i,vt2r,vt2s,vt2g,vt2h,acrfac, &
491 xlwork2, factor, source, value, &
492 xlf, pfrzdtc, pfrzdtr, supice, alpha2, delta2, delta3
495 REAL :: rs0, ghw1, ghw2, ghw3, ghw4
496 REAL :: holdc, holdci
497 INTEGER :: i, j, k, mstepmax, &
498 iprt, latd, lond, loop, loops, ifsat, n, idim, kdim
500 ! Temporaries used for inlining fpvs function
502 REAL :: dldti, xb, xai, tr, xbi, xa, hvap, cvap, hsub, dldt, ttp
504 ! variables for optimization
506 REAL, DIMENSION( its:ite ) :: tvec1
508 !------------------------------------------------------------------------------
509 ! compute internal functions
511 cpmcal(x) = cpd*(1.-max(x,qmin))+max(x,qmin)*cpv
512 xlcal(x) = xlv0-xlv1*(x-t0c)
514 ! diffus: diffusion coefficient of the water vapor
515 ! viscos: kinematic viscosity(m2s-1)
516 ! Optimizatin : A**B => exp(log(A)*(B))
518 diffus(x,y) = 8.794e-5 * exp(log(x)*(1.81)) / y ! 8.794e-5*x**1.81/y
519 viscos(x,y) = 1.496e-6 * (x*sqrt(x)) /(x+120.)/y ! 1.496e-6*x**1.5/(x+120.)/y
520 xka(x,y) = 1.414e3*viscos(x,y)*y
521 diffac(a,b,c,d,e) = d*a*a/(xka(c,d)*rv*c*c)+1./(e*diffus(c,b))
522 venfac(a,b,c) = exp(log((viscos(b,c)/diffus(b,a)))*((.3333333))) &
523 /sqrt(viscos(b,c))*sqrt(sqrt(den0/c))
524 conden(a,b,c,d,e) = (max(b,qmin)-c)/(1.+d*d/(rv*e)*c/(a*a))
529 ! paddint 0 for negative values generated by dynamics
533 qci(i,k,1) = max(qci(i,k,1),0.0)
534 qrs(i,k,1) = max(qrs(i,k,1),0.0)
535 qci(i,k,2) = max(qci(i,k,2),0.0)
536 qrs(i,k,2) = max(qrs(i,k,2),0.0)
537 qrs(i,k,3) = max(qrs(i,k,3),0.0)
538 qrs(i,k,4) = max(qrs(i,k,4),0.0)
542 ! latent heat for phase changes and heat capacity. neglect the
543 ! changes during microphysical process calculation
548 cpm(i,k) = cpmcal(q(i,k))
549 xl(i,k) = xlcal(t(i,k))
555 delz_tmp(i,k) = delz(i,k)
556 den_tmp(i,k) = den(i,k)
560 ! initialize the surface rain, snow, graupel, hail
564 if(PRESENT (snowncv) .AND. PRESENT (snow)) snowncv(i,lat) = 0.
565 if(PRESENT (graupelncv) .AND. PRESENT (graupel)) graupelncv(i,lat) = 0.
566 if(PRESENT (hailncv) .AND. PRESENT (hail)) hailncv(i,lat) = 0.
569 ! new local array to catch step snow, graupel, and hail
576 ! compute the minor time steps.
578 loops = max(nint(delt/dtcldcr),1)
580 if(delt.le.dtcldcr) dtcld = delt
584 ! initialize the large scale variables
593 ! denfac(i,k) = sqrt(den0/den(i,k))
597 CALL VREC( tvec1(its), den(its,k), ite-its+1)
599 tvec1(i) = tvec1(i)*den0
601 CALL VSQRT( denfac(its,k), tvec1(its), ite-its+1)
604 ! Inline expansion for fpvs
605 ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
606 ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
616 xbi=xai+hsub/(rv*ttp)
620 qs(i,k,1)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
621 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
622 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
623 qs(i,k,1) = max(qs(i,k,1),qmin)
624 rh(i,k,1) = max(q(i,k) / qs(i,k,1),qmin)
626 if(t(i,k).lt.ttp) then
627 qs(i,k,2)=psat*exp(log(tr)*(xai))*exp(xbi*(1.-tr))
629 qs(i,k,2)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
631 qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k))
632 qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2))
633 qs(i,k,2) = max(qs(i,k,2),qmin)
634 rh(i,k,2) = max(q(i,k) / qs(i,k,2),qmin)
638 ! initialize the variables for microphysical physics
701 ! Ni: ice crystal number concentraiton [HDC 5c]
705 temp = (den(i,k)*max(qci(i,k,2),qmin))
706 temp = sqrt(sqrt(temp*temp*temp))
707 xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6)
711 ! compute the fallout term:
712 ! first, vertical terminal velosity for minor loops
716 qrs_tmp(i,k,1) = qrs(i,k,1)
717 qrs_tmp(i,k,2) = qrs(i,k,2)
718 qrs_tmp(i,k,3) = qrs(i,k,3)
719 qrs_tmp(i,k,4) = qrs(i,k,4)
723 call slope_wsm7(qrs_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2,rslope3, &
724 work1,its,ite,kts,kte)
728 workr(i,k) = work1(i,k,1)
729 workh(i,k) = work1(i,k,4)
730 qsum(i,k) = max( (qrs(i,k,2)+qrs(i,k,3)), 1.E-15)
732 if ( qsum(i,k) .gt. 1.e-15 ) THEN
733 worka(i,k) = (work1(i,k,2)*qrs(i,k,2) + work1(i,k,3)*qrs(i,k,3)) &
739 denqrs1(i,k) = den(i,k)*qrs(i,k,1)
740 denqrs2(i,k) = den(i,k)*qrs(i,k,2)
741 denqrs3(i,k) = den(i,k)*qrs(i,k,3)
742 denqrs4(i,k) = den(i,k)*qrs(i,k,4)
743 if(qrs(i,k,1).le.0.0) workr(i,k) = 0.0
744 if(qrs(i,k,4).le.0.0) workh(i,k) = 0.0
748 call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,workr,denqrs1, &
750 call nislfv_rain_plm6(idim,kdim,den_tmp,denfac,t,delz_tmp,worka, &
751 denqrs2,denqrs3,delqrs2,delqrs3,dtcld,1,1)
752 call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,workh,denqrs4, &
757 qrs(i,k,1) = max(denqrs1(i,k)/den(i,k),0.)
758 qrs(i,k,2) = max(denqrs2(i,k)/den(i,k),0.)
759 qrs(i,k,3) = max(denqrs3(i,k)/den(i,k),0.)
760 qrs(i,k,4) = max(denqrs4(i,k)/den(i,k),0.)
761 fall(i,k,1) = denqrs1(i,k)*workr(i,k)/delz(i,k)
762 fall(i,k,2) = denqrs2(i,k)*worka(i,k)/delz(i,k)
763 fall(i,k,3) = denqrs3(i,k)*worka(i,k)/delz(i,k)
764 fall(i,k,4) = denqrs4(i,k)*workh(i,k)/delz(i,k)
769 fall(i,1,1) = delqrs1(i)/delz(i,1)/dtcld
770 fall(i,1,2) = delqrs2(i)/delz(i,1)/dtcld
771 fall(i,1,3) = delqrs3(i)/delz(i,1)/dtcld
772 fall(i,1,4) = delqrs4(i)/delz(i,1)/dtcld
777 qrs_tmp(i,k,1) = qrs(i,k,1)
778 qrs_tmp(i,k,2) = qrs(i,k,2)
779 qrs_tmp(i,k,3) = qrs(i,k,3)
780 qrs_tmp(i,k,4) = qrs(i,k,4)
784 call slope_wsm7(qrs_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2,rslope3, &
785 work1,its,ite,kts,kte)
790 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
791 if(t(i,k).gt.t0c) then
793 ! psmlt: melting of snow [HL A33] [RH83 A25]
797 work2(i,k) = venfac(p(i,k),t(i,k),den(i,k))
798 if(qrs(i,k,2).gt.0.) then
799 coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2))
800 psmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*pi/2. &
801 *n0sfac(i,k)*(precs1*rslope2(i,k,2) &
802 +precs2*work2(i,k)*coeres)/den(i,k)
803 psmlt(i,k) = min(max(psmlt(i,k)*dtcld/mstep(i), &
804 -qrs(i,k,2)/mstep(i)),0.)
805 qrs(i,k,2) = qrs(i,k,2) + psmlt(i,k)
806 qrs(i,k,1) = qrs(i,k,1) - psmlt(i,k)
807 t(i,k) = t(i,k) + xlf/cpm(i,k)*psmlt(i,k)
810 ! pgmlt: melting of graupel [HL A23] [LFO 47]
813 if(qrs(i,k,3).gt.0.) then
814 coeres = rslope2(i,k,3)*sqrt(rslope(i,k,3)*rslopeb(i,k,3))
815 pgmlt(i,k) = xka(t(i,k),den(i,k))/xlf &
816 *(t0c-t(i,k))*(precg1*rslope2(i,k,3) &
817 +precg2*work2(i,k)*coeres)/den(i,k)
818 pgmlt(i,k) = min(max(pgmlt(i,k)*dtcld/mstep(i), &
819 -qrs(i,k,3)/mstep(i)),0.)
820 qrs(i,k,3) = qrs(i,k,3) + pgmlt(i,k)
821 qrs(i,k,1) = qrs(i,k,1) - pgmlt(i,k)
822 t(i,k) = t(i,k) + xlf/cpm(i,k)*pgmlt(i,k)
825 ! phmlt: melting of hail [BHT A22]
828 if(qrs(i,k,4).gt.0.) then
829 coeres = rslope2(i,k,4)*sqrt(rslope(i,k,4)*rslopeb(i,k,4))
830 phmlt(i,k) = xka(t(i,k),den(i,k))/xlf &
831 *(t0c-t(i,k))*(prech1*rslope2(i,k,4) &
832 +prech2*work2(i,k)*coeres)/den(i,k)
833 phmlt(i,k) = min(max(phmlt(i,k)*dtcld/mstep(i), &
834 -qrs(i,k,4)/mstep(i)),0.)
835 qrs(i,k,4) = qrs(i,k,4) + phmlt(i,k)
836 qrs(i,k,1) = qrs(i,k,1) - phmlt(i,k)
837 t(i,k) = t(i,k) + xlf/cpm(i,k)*phmlt(i,k)
843 ! Vice [ms-1] : fallout of ice crystal [HDC 5a]
847 if(qci(i,k,2).le.0.) then
850 xmi = den(i,k)*qci(i,k,2)/xni(i,k)
851 diameter = max(min(dicon * sqrt(xmi),dimax), 1.e-25)
852 work1c(i,k) = 1.49e4*exp(log(diameter)*(1.31))
857 ! forward semi-laglangian scheme (JH), PCM (piecewise constant), (linear)
861 denqci(i,k) = den(i,k)*qci(i,k,2)
865 call nislfv_rain_plm(idim,kdim,den_tmp,denfac,t,delz_tmp,work1c,denqci, &
870 qci(i,k,2) = max(denqci(i,k)/den(i,k),0.)
875 fallc(i,1) = delqi(i)/delz(i,1)/dtcld
878 ! rain (unit is mm/sec;kgm-2s-1: /1000*delt ===> m)==> mm for wrf
881 fallsum = fall(i,kts,1)+fall(i,kts,2)+fall(i,kts,3)+fall(i,kts,4)+ &
883 fallsum_qsi = fall(i,kts,2)+fallc(i,kts)
884 fallsum_qg = fall(i,kts,3)
885 fallsum_qh = fall(i,kts,4)
886 if(fallsum.gt.0.) then
887 rainncv(i) = fallsum*delz(i,kts)/denr*dtcld*1000. + rainncv(i)
888 rain(i) = fallsum*delz(i,kts)/denr*dtcld*1000. + rain(i)
891 if(fallsum_qsi.gt.0.) then
892 tstepsnow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. &
894 if ( PRESENT (snowncv) .AND. PRESENT (snow)) THEN
895 snowncv(i,lat) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. &
897 snow(i,lat) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + snow(i,lat)
901 if(fallsum_qg.gt.0.) then
902 tstepgraup(i) = fallsum_qg*delz(i,kts)/denr*dtcld*1000. &
904 if ( PRESENT (graupelncv) .AND. PRESENT (graupel)) THEN
905 graupelncv(i,lat) = fallsum_qg*delz(i,kts)/denr*dtcld*1000. &
907 graupel(i,lat) = fallsum_qg*delz(i,kts)/denr*dtcld*1000. + graupel(i,lat)
911 if(fallsum_qh.gt.0.) then
912 tstephail(i) = fallsum_qh*delz(i,kts)/denr*dtcld*1000. &
914 if ( PRESENT (hailncv) .AND. PRESENT (hail)) THEN
915 hailncv(i,lat) = fallsum_qh*delz(i,kts)/denr*dtcld*1000. &
917 hail(i,lat) = fallsum_qh*delz(i,kts)/denr*dtcld*1000. + hail(i,lat)
921 if(fallsum.gt.0.)sr(i)=(tstepsnow(i) + tstepgraup(i) + tstephail(i)) &
925 ! pimlt: instantaneous melting of cloud ice [HL A47] [RH83 A28]
932 if(supcol.lt.0.) xlf = xlf0
933 if(supcol.lt.0.and.qci(i,k,2).gt.0.) then
934 qci(i,k,1) = qci(i,k,1) + qci(i,k,2)
935 t(i,k) = t(i,k) - xlf/cpm(i,k)*qci(i,k,2)
939 ! pihmf: homogeneous freezing of cloud water below -40c [HL A45]
942 if(supcol.gt.40..and.qci(i,k,1).gt.0.) then
943 qci(i,k,2) = qci(i,k,2) + qci(i,k,1)
944 t(i,k) = t(i,k) + xlf/cpm(i,k)*qci(i,k,1)
948 ! pihtf: heterogeneous freezing of cloud water [HL A44]
951 if(supcol.gt.0..and.qci(i,k,1).gt.qmin) then
952 supcolt=min(supcol,50.)
953 pfrzdtc = min(pfrz1*(exp(pfrz2*supcolt)-1.) &
954 *den(i,k)/denr/xncr*qci(i,k,1)*qci(i,k,1)*dtcld,qci(i,k,1))
955 qci(i,k,2) = qci(i,k,2) + pfrzdtc
956 t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtc
957 qci(i,k,1) = qci(i,k,1)-pfrzdtc
960 ! pgfrz: freezing of rain water [HL A20] [LFO 45]
963 if(supcol.gt.0..and.qrs(i,k,1).gt.0.) then
964 temp = rslope3(i,k,1)
965 temp = temp*temp*rslope(i,k,1)
966 supcolt=min(supcol,50.)
967 pfrzdtr = min(20.*(pi*pi)*pfrz1*n0r*denr/den(i,k) &
968 *(exp(pfrz2*supcolt)-1.)*temp*dtcld, &
970 qrs(i,k,3) = qrs(i,k,3) + pfrzdtr
971 t(i,k) = t(i,k) + xlf/cpm(i,k)*pfrzdtr
972 qrs(i,k,1) = qrs(i,k,1) - pfrzdtr
977 ! update the slope parameters for microphysics computation
981 qrs_tmp(i,k,1) = qrs(i,k,1)
982 qrs_tmp(i,k,2) = qrs(i,k,2)
983 qrs_tmp(i,k,3) = qrs(i,k,3)
984 qrs_tmp(i,k,4) = qrs(i,k,4)
988 call slope_wsm7(qrs_tmp,den_tmp,denfac,t,rslope,rslopeb,rslope2,rslope3, &
989 work1,its,ite,kts,kte)
991 ! work1: the thermodynamic term in the denominator associated with
992 ! heat conduction and vapor diffusion
994 ! work2: parameter associated with the ventilation effects(y93)
998 work1(i,k,1) = diffac(xl(i,k),p(i,k),t(i,k),den(i,k),qs(i,k,1))
999 work1(i,k,2) = diffac(xls,p(i,k),t(i,k),den(i,k),qs(i,k,2))
1000 work2(i,k) = venfac(p(i,k),t(i,k),den(i,k))
1004 !===============================================================
1006 ! warm rain processes
1008 ! - follows the processes in RH83 and LFO except for autoconcersion
1010 !===============================================================
1014 supsat = max(q(i,k),qmin)-qs(i,k,1)
1015 satdt = supsat/dtcld
1017 ! praut: auto conversion rate from cloud to rain [HDC 16]
1020 if(qci(i,k,1).gt.qc0) then
1021 praut(i,k) = qck1*qci(i,k,1)**(7./3.)
1022 praut(i,k) = min(praut(i,k),qci(i,k,1)/dtcld)
1025 ! pracw: accretion of cloud water by rain [HL A40] [LFO 51]
1028 if(qrs(i,k,1).gt.qcrmin.and.qci(i,k,1).gt.qmin) then
1029 pracw(i,k) = min(pacrr*rslope3(i,k,1)*rslopeb(i,k,1) &
1030 *qci(i,k,1)*denfac(i,k),qci(i,k,1)/dtcld)
1033 ! prevp: evaporation/condensation rate of rain [HDC 14]
1036 if(qrs(i,k,1).gt.0.) then
1037 coeres = rslope2(i,k,1)*sqrt(rslope(i,k,1)*rslopeb(i,k,1))
1038 prevp(i,k) = (rh(i,k,1)-1.)*(precr1*rslope2(i,k,1) &
1039 +precr2*work2(i,k)*coeres)/work1(i,k,1)
1040 if(prevp(i,k).lt.0.) then
1041 prevp(i,k) = max(prevp(i,k),-qrs(i,k,1)/dtcld)
1042 prevp(i,k) = max(prevp(i,k),satdt/2)
1044 prevp(i,k) = min(prevp(i,k),satdt/2)
1050 !===============================================================
1052 ! cold rain processes
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)
1061 !===============================================================
1066 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
1067 supsat = max(q(i,k),qmin)-qs(i,k,2)
1068 satdt = supsat/dtcld
1071 ! Ni: ice crystal number concentraiton [HDC 5c]
1073 temp = (den(i,k)*max(qci(i,k,2),qmin))
1074 temp = sqrt(sqrt(temp*temp*temp))
1075 xni(i,k) = min(max(5.38e7*temp,1.e3),1.e6)
1076 eacrs = exp(0.07*(-supcol))
1078 xmi = den(i,k)*qci(i,k,2)/xni(i,k)
1079 diameter = min(dicon * sqrt(xmi),dimax)
1080 vt2i = 1.49e4*diameter**1.31
1081 vt2r=pvtr*rslopeb(i,k,1)*denfac(i,k)
1082 vt2s=pvts*rslopeb(i,k,2)*denfac(i,k)
1083 vt2g=pvtg*rslopeb(i,k,3)*denfac(i,k)
1084 vt2h=pvth*rslopeb(i,k,4)*denfac(i,k)
1085 qsum(i,k) = max( (qrs(i,k,2)+qrs(i,k,3)), 1.E-15)
1086 if(qsum(i,k) .gt. 1.e-15) then
1087 vt2ave=(vt2s*qrs(i,k,2)+vt2g*qrs(i,k,3))/(qsum(i,k))
1091 if(supcol.gt.0.and.qci(i,k,2).gt.qmin) then
1092 if(qrs(i,k,1).gt.qcrmin) then
1094 ! praci: Accretion of cloud ice by rain [HL A15] [LFO 25]
1097 acrfac = 2.*rslope3(i,k,1)+2.*diameter*rslope2(i,k,1) &
1098 +diameter**2*rslope(i,k,1)
1099 praci(i,k) = pi*qci(i,k,2)*n0r*abs(vt2r-vt2i)*acrfac/4.
1100 ! reduce collection efficiency (suggested by B. Wilt)
1101 praci(i,k) = praci(i,k)*min(max(0.0,qrs(i,k,1)/qci(i,k,2)),1.)**2
1102 praci(i,k) = min(praci(i,k),qci(i,k,2)/dtcld)
1104 ! piacr: Accretion of rain by cloud ice [HL A19] [LFO 26]
1105 ! (T<T0: R->S or R->G)
1107 piacr(i,k) = pi**2*avtr*n0r*denr*xni(i,k)*denfac(i,k) &
1108 *g6pbr*rslope3(i,k,1)*rslope3(i,k,1) &
1109 *rslopeb(i,k,1)/24./den(i,k)
1110 ! reduce collection efficiency (suggested by B. Wilt)
1111 piacr(i,k) = piacr(i,k)*min(max(0.0,qci(i,k,2)/qrs(i,k,1)),1.)**2
1112 piacr(i,k) = min(piacr(i,k),qrs(i,k,1)/dtcld)
1115 ! psaci: Accretion of cloud ice by snow [HDC 10]
1118 if(qrs(i,k,2).gt.qcrmin) then
1119 acrfac = 2.*rslope3(i,k,2)+2.*diameter*rslope2(i,k,2) &
1120 +diameter**2*rslope(i,k,2)
1121 psaci(i,k) = pi*qci(i,k,2)*eacrs*n0s*n0sfac(i,k) &
1122 *abs(vt2ave-vt2i)*acrfac/4.
1123 psaci(i,k) = min(psaci(i,k),qci(i,k,2)/dtcld)
1126 ! pgaci: Accretion of cloud ice by graupel [HL A17] [LFO 41]
1129 if(qrs(i,k,3).gt.qcrmin) then
1130 egi = exp(0.07*(-supcol))
1131 acrfac = 2.*rslope3(i,k,3)+2.*diameter*rslope2(i,k,3) &
1132 +diameter**2*rslope(i,k,3)
1133 pgaci(i,k) = pi*egi*qci(i,k,2)*n0g*abs(vt2ave-vt2i)*acrfac/4.
1134 pgaci(i,k) = min(pgaci(i,k),qci(i,k,2)/dtcld)
1137 ! phaci: Accretion of cloud ice by hail [BHT ]
1140 if(qrs(i,k,4).gt.qcrmin) then
1141 ehi = exp(0.07*(-supcol))
1142 acrfac = 2.*rslope3(i,k,4)+2.*diameter*rslope2(i,k,4) &
1143 +diameter**2*rslope(i,k,4)
1144 phaci(i,k) = pi*ehi*qci(i,k,2)*n0h*abs(vt2h-vt2i)*acrfac/4.
1145 phaci(i,k) = min(phaci(i,k),qci(i,k,2)/dtcld)
1149 ! psacw: Accretion of cloud water by snow [HL A7] [LFO 24]
1150 ! (T<T0: C->S, and T>=T0: C->R)
1152 if(qrs(i,k,2).gt.qcrmin.and.qci(i,k,1).gt.qmin) then
1153 psacw(i,k) = min(pacrc*n0sfac(i,k)*rslope3(i,k,2)*rslopeb(i,k,2) &
1154 ! reduce collection efficiency (suggested by B. Wilt)
1155 *min(max(0.0,qrs(i,k,2)/qci(i,k,1)),1.)**2 &
1156 *qci(i,k,1)*denfac(i,k),qci(i,k,1)/dtcld)
1159 ! pgacw: Accretion of cloud water by graupel [HL A6] [LFO 40]
1160 ! (T<T0: C->G, and T>=T0: C->R)
1162 if(qrs(i,k,3).gt.qcrmin.and.qci(i,k,1).gt.qmin) then
1163 pgacw(i,k) = min(pacrg*rslope3(i,k,3)*rslopeb(i,k,3) &
1164 ! reduce collection efficiency (suggested by B. Wilt)
1165 *min(max(0.0,qrs(i,k,3)/qci(i,k,1)),1.)**2 &
1166 *qci(i,k,1)*denfac(i,k),qci(i,k,1)/dtcld)
1169 ! paacw: Accretion of cloud water by averaged snow/graupel
1170 ! (T<T0: C->G or S, and T>=T0: C->R)
1172 if(qsum(i,k) .gt. 1.e-15) then
1173 paacw(i,k) = (qrs(i,k,2)*psacw(i,k)+qrs(i,k,3)*pgacw(i,k)) &
1177 ! phacw: Accretion of cloud water by hail [BHT A08]
1178 ! (T<T0: C->H, and T>=T0: C->R)
1180 if(qrs(i,k,4).gt.qcrmin.and.qci(i,k,1).gt.qmin) then
1181 phacw(i,k) = min(pacrh*rslope3(i,k,4)*rslopeb(i,k,4) &
1182 ! reduce collection efficiency (suggested by B. Wilt)
1183 *min(max(0.0,qrs(i,k,4)/qci(i,k,1)),1.)**2 &
1184 *qci(i,k,1)*denfac(i,k),qci(i,k,1)/dtcld)
1187 ! pracs: Accretion of snow by rain [HL A11] [LFO 27]
1190 if(qrs(i,k,2).gt.qcrmin.and.qrs(i,k,1).gt.qcrmin) then
1191 if(supcol.gt.0) then
1192 acrfac = 5.*rslope3(i,k,2)*rslope3(i,k,2)*rslope(i,k,1) &
1193 +2.*rslope3(i,k,2)*rslope2(i,k,2)*rslope2(i,k,1) &
1194 +.5*rslope2(i,k,2)*rslope2(i,k,2)*rslope3(i,k,1)
1195 pracs(i,k) = pi**2*n0r*n0s*n0sfac(i,k)*abs(vt2r-vt2ave) &
1196 *(dens/den(i,k))*acrfac
1197 ! reduce collection efficiency (suggested by B. Wilt)
1198 pracs(i,k) = pracs(i,k)*min(max(0.0,qrs(i,k,1)/qrs(i,k,2)),1.)**2
1199 pracs(i,k) = min(pracs(i,k),qrs(i,k,2)/dtcld)
1202 ! psacr: Accretion of rain by snow [HL A10] [LFO 28]
1203 ! (T<T0:R->S or R->G) (T>=T0: enhance melting of snow)
1205 acrfac = 5.*rslope3(i,k,1)*rslope3(i,k,1)*rslope(i,k,2) &
1206 +2.*rslope3(i,k,1)*rslope2(i,k,1)*rslope2(i,k,2) &
1207 +.5*rslope2(i,k,1)*rslope2(i,k,1)*rslope3(i,k,2)
1208 psacr(i,k) = pi**2*n0r*n0s*n0sfac(i,k)*abs(vt2ave-vt2r) &
1209 *(denr/den(i,k))*acrfac
1210 ! reduce collection efficiency (suggested by B. Wilt)
1211 psacr(i,k) = psacr(i,k)*min(max(0.0,qrs(i,k,2)/qrs(i,k,1)),1.)**2
1212 psacr(i,k) = min(psacr(i,k),qrs(i,k,1)/dtcld)
1215 ! pracg: Accretion of graupel by rain [BHT A17]
1218 if(qrs(i,k,3).gt.qcrmin.and.qrs(i,k,1).gt.qcrmin) then
1219 if(supcol.gt.0) then
1220 acrfac = 5.*rslope3(i,k,3)*rslope3(i,k,3)*rslope(i,k,1) &
1221 +2.*rslope3(i,k,3)*rslope2(i,k,3)*rslope2(i,k,1) &
1222 +.5*rslope2(i,k,3)*rslope2(i,k,3)*rslope3(i,k,1)
1223 pracg(i,k) = pi**2*n0r*n0g*abs(vt2r-vt2ave) &
1224 *(deng/den(i,k))*acrfac
1225 ! reduce collection efficiency (suggested by B. Wilt)
1226 pracg(i,k) = pracg(i,k)*min(max(0.0,qrs(i,k,1)/qrs(i,k,3)),1.)**2
1227 pracg(i,k) = min(pracg(i,k),qrs(i,k,3)/dtcld)
1230 ! pgacr: Accretion of rain by graupel [HL A12] [LFO 42]
1231 ! (T<T0: R->G) (T>=T0: enhance melting of graupel)
1233 acrfac = 5.*rslope3(i,k,1)*rslope3(i,k,1)*rslope(i,k,3) &
1234 +2.*rslope3(i,k,1)*rslope2(i,k,1)*rslope2(i,k,3) &
1235 +.5*rslope2(i,k,1)*rslope2(i,k,1)*rslope3(i,k,3)
1236 pgacr(i,k) = pi**2*n0r*n0g*abs(vt2ave-vt2r)*(denr/den(i,k)) &
1238 ! reduce collection efficiency (suggested by B. Wilt)
1239 pgacr(i,k) = pgacr(i,k)*min(max(0.0,qrs(i,k,3)/qrs(i,k,1)),1.)**2
1240 pgacr(i,k) = min(pgacr(i,k),qrs(i,k,1)/dtcld)
1243 ! pgacs: Accretion of snow by graupel [HL A13] [LFO 29]
1244 ! (S->G): This process is eliminated in V3.0 with the
1245 ! new combined snow/graupel fall speeds
1247 if(qrs(i,k,3).gt.qcrmin.and.qrs(i,k,2).gt.qcrmin) then
1251 ! phacr: Accretion of rain by hail [BHT A13]
1252 ! (T<T0: R->H) (T>=T0: enhance melting of hail)
1254 if(qrs(i,k,4).gt.qcrmin.and.qrs(i,k,1).gt.qcrmin) then
1255 acrfac = 5.*rslope3(i,k,1)*rslope3(i,k,1)*rslope(i,k,4) &
1256 +2.*rslope3(i,k,1)*rslope2(i,k,1)*rslope2(i,k,4) &
1257 +.5*rslope2(i,k,1)*rslope2(i,k,1)*rslope3(i,k,4)
1258 phacr(i,k) = pi**2*n0r*n0h*abs(vt2h-vt2r)*(denr/den(i,k)) &
1260 ! reduce collection efficiency (suggested by B. Wilt)
1261 phacr(i,k) = phacr(i,k)*min(max(0.0,qrs(i,k,4)/qrs(i,k,1)),1.)**2
1262 phacr(i,k) = min(phacr(i,k),qrs(i,k,1)/dtcld)
1265 ! phacs: Accretion of snow by hail [BHT A14]
1268 if(qrs(i,k,4).gt.qcrmin.and.qrs(i,k,2).gt.qcrmin) then
1269 acrfac = 5.*rslope3(i,k,2)*rslope3(i,k,2)*rslope(i,k,4) &
1270 +2.*rslope3(i,k,2)*rslope2(i,k,2)*rslope2(i,k,4) &
1271 +.5*rslope2(i,k,2)*rslope2(i,k,2)*rslope3(i,k,4)
1272 phacs(i,k) = pi**2*eachs*n0s*n0sfac(i,k)*n0h*abs(vt2h-vt2ave) &
1273 *(dens/den(i,k))*acrfac
1274 phacs(i,k) = min(phacs(i,k),qrs(i,k,2)/dtcld)
1277 ! phacg: Accretion of snow by hail [BHT A15]
1280 if(qrs(i,k,4).gt.qcrmin.and.qrs(i,k,3).gt.qcrmin) then
1281 acrfac = 5.*rslope3(i,k,3)*rslope3(i,k,3)*rslope(i,k,4) &
1282 +2.*rslope3(i,k,3)*rslope2(i,k,3)*rslope2(i,k,4) &
1283 +.5*rslope2(i,k,3)*rslope2(i,k,3)*rslope3(i,k,4)
1284 phacg(i,k) = pi**2*eachg*n0g*n0h*abs(vt2h-vt2ave) &
1285 *(deng/den(i,k))*acrfac
1286 phacg(i,k) = min(phacg(i,k),qrs(i,k,3)/dtcld)
1289 ! pgwet: wet growth of graupel [LFO 43]
1292 rs0 = psat*exp(log(ttp/t0c)*xa)*exp(xb*(1.-ttp/t0c))
1293 rs0 = min(rs0,0.99*p(i,k))
1294 rs0 = ep2*rs0/(p(i,k)-rs0)
1296 ghw1 = den(i,k)*hvap*diffus(t(i,k),p(i,k))*(rs0-q(i,k)) &
1297 - xka(t(i,k),den(i,k))*(-supcol)
1298 ghw2 = den(i,k)*(xlf0+cliq*(-supcol))
1299 ghw3 = venfac(p(i,k),t(i,k),den(i,k))*sqrt(sqrt(g*den(i,k)/den0))
1300 ghw4 = den(i,k)*(xlf0-cliq*supcol+cice*supcol)
1301 if(qrs(i,k,3).gt.qcrmin) then
1302 if(pgaci(i,k).gt.0.0) then
1303 egi = exp(0.07*(-supcol))
1304 pgaci_w(i,k) = pgaci(i,k)/egi
1308 pgwet(i,k) = ghw1/ghw2*(precg1*rslope2(i,k,3) &
1309 +precg3*ghw3*rslope(i,k,4)**(2.75) &
1310 +ghw4*(pgaci_w(i,k)+pgacs(i,k)))
1311 pgwet(i,k) = max(pgwet(i,k), 0.0)
1314 ! phwet: wet growth of hail [LFO 43]
1317 if(qrs(i,k,4).gt.qcrmin) then
1318 if(phaci(i,k).gt.0.0) then
1319 ehi = exp(0.07*(-supcol))
1320 phaci_w(i,k) = phaci(i,k)/ehi
1325 phwet(i,k) = ghw1/ghw2*(prech1*rslope2(i,k,4) &
1326 +prech3*ghw3*rslope(i,k,4)**(2.75) &
1327 +ghw4*(phaci_w(i,k)+phacs(i,k)))
1328 phwet(i,k) = max(phwet(i,k), 0.0)
1330 if(phacw(i,k)+phacr(i,k).lt.0.95*phwet(i,k)) then
1336 if(supcol.le.0) then
1339 ! pseml: Enhanced melting of snow by accretion of water [HL A34]
1342 if(qrs(i,k,2).gt.0.) &
1343 pseml(i,k) = min(max(cliq*supcol*(paacw(i,k)+psacr(i,k)) &
1344 /xlf,-qrs(i,k,2)/dtcld),0.)
1346 ! pgeml: Enhanced melting of graupel by accretion of water [HL A24] [RH84 A21-A22]
1349 if(qrs(i,k,3).gt.0.) &
1350 pgeml(i,k) = min(max(cliq*supcol*(paacw(i,k)+pgacr(i,k)) &
1351 /xlf,-qrs(i,k,3)/dtcld),0.)
1353 ! pheml: Enhanced melting of hail by accretion of water [BHT A23]
1356 if(qrs(i,k,4).gt.0.) &
1357 pheml(i,k) = min(max(cliq*supcol*(phacw(i,k)+phacr(i,k)) &
1358 /xlf,-qrs(i,k,4)/dtcld),0.)
1361 if(supcol.gt.0) then
1363 ! pidep: Deposition/Sublimation rate of ice [HDC 9]
1364 ! (T<T0: V->I or I->V)
1366 if(qci(i,k,2).gt.0.and.ifsat.ne.1) then
1367 pidep(i,k) = 4.*diameter*xni(i,k)*(rh(i,k,2)-1.)/work1(i,k,2)
1368 supice = satdt-prevp(i,k)
1369 if(pidep(i,k).lt.0.) then
1370 pidep(i,k) = max(max(pidep(i,k),satdt/2),supice)
1371 pidep(i,k) = max(pidep(i,k),-qci(i,k,2)/dtcld)
1373 pidep(i,k) = min(min(pidep(i,k),satdt/2),supice)
1375 if(abs(prevp(i,k)+pidep(i,k)).ge.abs(satdt)) ifsat = 1
1378 ! psdep: deposition/sublimation rate of snow [HDC 14]
1379 ! (T<T0: V->S or S->V)
1381 if(qrs(i,k,2).gt.0..and.ifsat.ne.1) then
1382 coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2))
1383 psdep(i,k) = (rh(i,k,2)-1.)*n0sfac(i,k)*(precs1*rslope2(i,k,2) &
1384 + precs2*work2(i,k)*coeres)/work1(i,k,2)
1385 supice = satdt-prevp(i,k)-pidep(i,k)
1386 if(psdep(i,k).lt.0.) then
1387 psdep(i,k) = max(psdep(i,k),-qrs(i,k,2)/dtcld)
1388 psdep(i,k) = max(max(psdep(i,k),satdt/2),supice)
1390 psdep(i,k) = min(min(psdep(i,k),satdt/2),supice)
1392 if(abs(prevp(i,k)+pidep(i,k)+psdep(i,k)).ge.abs(satdt)) &
1396 ! pgdep: deposition/sublimation rate of graupel [HL A21] [LFO 46]
1397 ! (T<T0: V->G or G->V)
1399 if(qrs(i,k,3).gt.0..and.ifsat.ne.1) then
1400 coeres = rslope2(i,k,3)*sqrt(rslope(i,k,3)*rslopeb(i,k,3))
1401 pgdep(i,k) = (rh(i,k,2)-1.)*(precg1*rslope2(i,k,3) &
1402 +precg2*work2(i,k)*coeres)/work1(i,k,2)
1403 supice = satdt-prevp(i,k)-pidep(i,k)-psdep(i,k)
1404 if(pgdep(i,k).lt.0.) then
1405 pgdep(i,k) = max(pgdep(i,k),-qrs(i,k,3)/dtcld)
1406 pgdep(i,k) = max(max(pgdep(i,k),satdt/2),supice)
1408 pgdep(i,k) = min(min(pgdep(i,k),satdt/2),supice)
1410 if(abs(prevp(i,k)+pidep(i,k)+psdep(i,k)+pgdep(i,k)).ge. &
1411 abs(satdt)) ifsat = 1
1414 ! phdep: deposition/sublimation rate of hail [BHT A19]
1415 ! (T<T0: V->H or H->V)
1417 if(qrs(i,k,4).gt.0..and.ifsat.ne.1) then
1418 coeres = rslope2(i,k,4)*sqrt(rslope(i,k,4)*rslopeb(i,k,4))
1419 phdep(i,k) = (rh(i,k,2)-1.)*(prech1*rslope2(i,k,4) &
1420 +prech2*work2(i,k)*coeres)/work1(i,k,2)
1421 supice = satdt-prevp(i,k)-pidep(i,k)-psdep(i,k)-pgdep(i,k)
1422 if(phdep(i,k).lt.0.) then
1423 phdep(i,k) = max(phdep(i,k),-qrs(i,k,4)/dtcld)
1424 phdep(i,k) = max(max(phdep(i,k),satdt/2),supice)
1426 phdep(i,k) = min(min(phdep(i,k),satdt/2),supice)
1428 if(abs(prevp(i,k)+pidep(i,k)+psdep(i,k)+pgdep(i,k)+phdep(i,k)) &
1429 .ge. abs(satdt)) ifsat = 1
1432 ! pigen: generation(nucleation) of ice from vapor [HL 50] [HDC 7-8]
1435 if(supsat.gt.0.and.ifsat.ne.1) then
1436 supice = satdt-prevp(i,k)-pidep(i,k)-psdep(i,k)-pgdep(i,k)
1437 xni0 = 1.e3*exp(0.1*supcol)
1438 roqi0 = 4.92e-11*xni0**1.33
1439 pigen(i,k) = max(0.,(roqi0/den(i,k)-max(qci(i,k,2),0.))/dtcld)
1440 pigen(i,k) = min(min(pigen(i,k),satdt),supice)
1443 ! psaut: conversion(aggregation) of ice to snow [HDC 12]
1446 if(qci(i,k,2).gt.0.) then
1447 qimax = roqimax/den(i,k)
1448 psaut(i,k) = max(0.,(qci(i,k,2)-qimax)/dtcld)
1451 ! pgaut: conversion(aggregation) of snow to graupel [HL A4] [LFO 37]
1454 if(qrs(i,k,2).gt.0.) then
1455 alpha2 = 1.e-3*exp(0.09*(-supcol))
1456 pgaut(i,k) = min(max(0.,alpha2*(qrs(i,k,2)-qs0)),qrs(i,k,2)/dtcld)
1460 ! phaut: conversion(aggregation) of grauple to hail [BHT A18]
1463 if(qrs(i,k,3).gt.0.) then
1464 alpha2 = 1.e-3*exp(0.09*(-supcol))
1465 phaut(i,k) = min(max(0.,alpha2*(qrs(i,k,3)-qs0)),qrs(i,k,3)/dtcld)
1468 ! psevp: Evaporation of melting snow [HL A35] [RH83 A27]
1471 if(supcol.lt.0.) then
1472 if(qrs(i,k,2).gt.0..and.rh(i,k,1).lt.1.) then
1473 coeres = rslope2(i,k,2)*sqrt(rslope(i,k,2)*rslopeb(i,k,2))
1474 psevp(i,k) = (rh(i,k,1)-1.)*n0sfac(i,k)*(precs1 &
1475 *rslope2(i,k,2)+precs2*work2(i,k) &
1476 *coeres)/work1(i,k,1)
1477 psevp(i,k) = min(max(psevp(i,k),-qrs(i,k,2)/dtcld),0.)
1480 ! pgevp: Evaporation of melting graupel [HL A25] [RH84 A19]
1483 if(qrs(i,k,3).gt.0..and.rh(i,k,1).lt.1.) then
1484 coeres = rslope2(i,k,3)*sqrt(rslope(i,k,3)*rslopeb(i,k,3))
1485 pgevp(i,k) = (rh(i,k,1)-1.)*(precg1*rslope2(i,k,3) &
1486 +precg2*work2(i,k)*coeres)/work1(i,k,1)
1487 pgevp(i,k) = min(max(pgevp(i,k),-qrs(i,k,3)/dtcld),0.)
1490 ! phevp: Evaporation of melting hail [BHT A20]
1493 if(qrs(i,k,4).gt.0..and.rh(i,k,1).lt.1.) then
1494 coeres = rslope2(i,k,4)*sqrt(rslope(i,k,4)*rslopeb(i,k,4))
1495 phevp(i,k) = (rh(i,k,1)-1.)*(prech1*rslope2(i,k,4) &
1496 +prech2*work2(i,k)*coeres)/work1(i,k,1)
1497 phevp(i,k) = min(max(phevp(i,k),-qrs(i,k,4)/dtcld),0.)
1503 ! check mass conservation of generation terms and feedback to the
1511 if(qrs(i,k,1).lt.1.e-4.and.qrs(i,k,2).lt.1.e-4) delta2=1.
1512 if(qrs(i,k,1).lt.1.e-4) delta3=1.
1513 if(t(i,k).le.t0c) then
1517 value = max(qmin,qci(i,k,1))
1518 source = (praut(i,k)+pracw(i,k)+paacw(i,k)+paacw(i,k)+phacw(i,k)) &
1520 if (source.gt.value) then
1521 factor = value/source
1522 praut(i,k) = praut(i,k)*factor
1523 pracw(i,k) = pracw(i,k)*factor
1524 paacw(i,k) = paacw(i,k)*factor
1525 phacw(i,k) = phacw(i,k)*factor
1530 value = max(qmin,qci(i,k,2))
1531 source = (psaut(i,k)-pigen(i,k)-pidep(i,k)+praci(i,k)+psaci(i,k) &
1532 +pgaci(i,k)+phaci(i,k))*dtcld
1533 if (source.gt.value) then
1534 factor = value/source
1535 psaut(i,k) = psaut(i,k)*factor
1536 pigen(i,k) = pigen(i,k)*factor
1537 pidep(i,k) = pidep(i,k)*factor
1538 praci(i,k) = praci(i,k)*factor
1539 psaci(i,k) = psaci(i,k)*factor
1540 pgaci(i,k) = pgaci(i,k)*factor
1541 phaci(i,k) = phaci(i,k)*factor
1546 value = max(qmin,qrs(i,k,1))
1547 source = (-praut(i,k)-prevp(i,k)-pracw(i,k)+piacr(i,k)+psacr(i,k) &
1548 +pgacr(i,k)+phacr(i,k))*dtcld
1549 if (source.gt.value) then
1550 factor = value/source
1551 praut(i,k) = praut(i,k)*factor
1552 prevp(i,k) = prevp(i,k)*factor
1553 pracw(i,k) = pracw(i,k)*factor
1554 piacr(i,k) = piacr(i,k)*factor
1555 psacr(i,k) = psacr(i,k)*factor
1556 pgacr(i,k) = pgacr(i,k)*factor
1557 phacr(i,k) = phacr(i,k)*factor
1562 value = max(qmin,qrs(i,k,2))
1563 source = -(psdep(i,k)+psaut(i,k)+paacw(i,k)+pvapg(i,k)+pvaph(i,k) &
1564 +psaci(i,k)-pgaut(i,k)-pracs(i,k)*(1.-delta2) &
1565 +piacr(i,k)*delta3+praci(i,k)*delta3 &
1566 +psacr(i,k)*delta2 &
1567 -pgacs(i,k)-phacs(i,k) )*dtcld
1568 if (source.gt.value) then
1569 factor = value/source
1570 psdep(i,k) = psdep(i,k)*factor
1571 psaut(i,k) = psaut(i,k)*factor
1572 pgaut(i,k) = pgaut(i,k)*factor
1573 paacw(i,k) = paacw(i,k)*factor
1574 pvapg(i,k) = pvapg(i,k)*factor
1575 pvaph(i,k) = pvaph(i,k)*factor
1576 psaci(i,k) = psaci(i,k)*factor
1577 piacr(i,k) = piacr(i,k)*factor
1578 praci(i,k) = praci(i,k)*factor
1579 psacr(i,k) = psacr(i,k)*factor
1580 pracs(i,k) = pracs(i,k)*factor
1581 pgacs(i,k) = pgacs(i,k)*factor
1582 phacs(i,k) = phacs(i,k)*factor
1587 value = max(qmin,qrs(i,k,3))
1588 source = -(pgdep(i,k)+pgaut(i,k)+pgaci(i,k)+paacw(i,k)+pgacs(i,k) &
1589 +piacr(i,k)*(1.-delta3)+praci(i,k)*(1.-delta3) &
1590 +psacr(i,k)*(1.-delta2)+pgacr(i,k)*delta2 &
1591 +pracs(i,k)*(1.-delta2)-pracg(i,k)*(1.-delta2) &
1592 -phaut(i,k)-pvapg(i,k)-phacg(i,k)+primh(i,k))*dtcld
1593 if (source.gt.value) then
1594 factor = value/source
1595 pgdep(i,k) = pgdep(i,k)*factor
1596 pgaut(i,k) = pgaut(i,k)*factor
1597 phaut(i,k) = phaut(i,k)*factor
1598 piacr(i,k) = piacr(i,k)*factor
1599 praci(i,k) = praci(i,k)*factor
1600 pracs(i,k) = pracs(i,k)*factor
1601 pracg(i,k) = pracg(i,k)*factor
1602 psacr(i,k) = psacr(i,k)*factor
1603 paacw(i,k) = paacw(i,k)*factor
1604 pgaci(i,k) = pgaci(i,k)*factor
1605 pgacr(i,k) = pgacr(i,k)*factor
1606 pgacs(i,k) = pgacs(i,k)*factor
1607 pvapg(i,k) = pvapg(i,k)*factor
1608 phacg(i,k) = phacg(i,k)*factor
1609 primh(i,k) = primh(i,k)*factor
1614 value = max(qmin,qrs(i,k,4))
1615 source = -(phdep(i,k)+phaut(i,k) &
1616 +pgacr(i,k)*(1.-delta2)+pracg(i,k)*(1.-delta2) &
1617 +phacw(i,k)+phacr(i,k)+phaci(i,k)+phacs(i,k) &
1618 +phacg(i,k)-pvaph(i,k)-primh(i,k))*dtcld
1619 if (source.gt.value) then
1620 factor = value/source
1621 phdep(i,k) = phdep(i,k)*factor
1622 phaut(i,k) = phaut(i,k)*factor
1623 pracg(i,k) = pracg(i,k)*factor
1624 pgacr(i,k) = pgacr(i,k)*factor
1625 phacw(i,k) = phacw(i,k)*factor
1626 phaci(i,k) = phaci(i,k)*factor
1627 phacr(i,k) = phacr(i,k)*factor
1628 phacs(i,k) = phacs(i,k)*factor
1629 phacg(i,k) = phacg(i,k)*factor
1630 pvaph(i,k) = pvaph(i,k)*factor
1631 primh(i,k) = primh(i,k)*factor
1634 work2(i,k)=-(prevp(i,k)+psdep(i,k)+pgdep(i,k)+phdep(i,k) &
1635 +pigen(i,k)+pidep(i,k))
1639 q(i,k) = q(i,k)+work2(i,k)*dtcld
1640 qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k) &
1641 +paacw(i,k)+paacw(i,k)+phacw(i,k))*dtcld,0.)
1642 qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k) &
1643 +prevp(i,k)-piacr(i,k)-pgacr(i,k) &
1644 -psacr(i,k)-phacr(i,k))*dtcld,0.)
1645 qci(i,k,2) = max(qci(i,k,2)-(psaut(i,k)+praci(i,k)+psaci(i,k) &
1646 +pgaci(i,k)+phaci(i,k)-pigen(i,k)-pidep(i,k)) &
1648 qrs(i,k,2) = max(qrs(i,k,2)+(psdep(i,k)+psaut(i,k)+paacw(i,k) &
1649 +pvapg(i,k)+pvaph(i,k)-pgaut(i,k) &
1650 +psaci(i,k)-pgacs(i,k)-phacs(i,k) &
1651 +piacr(i,k)*delta3+praci(i,k)*delta3 &
1652 +psacr(i,k)*delta2 &
1653 -pracs(i,k)*(1.-delta2)) &
1655 qrs(i,k,3) = max(qrs(i,k,3)+(pgdep(i,k)+pgaut(i,k) &
1656 +piacr(i,k)*(1.-delta3)+praci(i,k)*(1.-delta3) &
1657 +psacr(i,k)*(1.-delta2)+pgacr(i,k)*delta2 &
1658 +pgaci(i,k)+paacw(i,k)+pgacs(i,k)+primh(i,k) &
1659 +pracs(i,k)*(1.-delta2)-pracg(i,k)*(1.-delta2) &
1660 -phaut(i,k)-pvapg(i,k)-phacg(i,k)) &
1662 qrs(i,k,4) = max(qrs(i,k,4)+(phdep(i,k)+phaut(i,k) &
1663 +pgacr(i,k)*(1.-delta2)+pracg(i,k)*(1.-delta2) &
1664 +phacw(i,k)+phacr(i,k)+phaci(i,k)+phacs(i,k) &
1665 +phacg(i,k)-pvaph(i,k)-primh(i,k)) &
1668 xlwork2 = -xls*(psdep(i,k)+pgdep(i,k)+phdep(i,k)+pidep(i,k) &
1669 +pigen(i,k))-xl(i,k)*prevp(i,k) &
1670 -xlf*(piacr(i,k)+paacw(i,k)+paacw(i,k)+phacw(i,k) &
1671 +phacr(i,k)+pgacr(i,k)+psacr(i,k))
1672 t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld
1677 value = max(qmin,qci(i,k,1))
1678 source=(praut(i,k)+pracw(i,k)+paacw(i,k)+paacw(i,k)+phacw(i,k)) &
1680 if (source.gt.value) then
1681 factor = value/source
1682 praut(i,k) = praut(i,k)*factor
1683 pracw(i,k) = pracw(i,k)*factor
1684 paacw(i,k) = paacw(i,k)*factor
1685 phacw(i,k) = phacw(i,k)*factor
1690 value = max(qmin,qrs(i,k,1))
1691 source = (pseml(i,k)+pgeml(i,k)+pheml(i,k) &
1692 -pracw(i,k)-paacw(i,k)-paacw(i,k)-phacw(i,k) &
1693 -prevp(i,k)-praut(i,k))*dtcld
1694 if (source.gt.value) then
1695 factor = value/source
1696 praut(i,k) = praut(i,k)*factor
1697 prevp(i,k) = prevp(i,k)*factor
1698 pracw(i,k) = pracw(i,k)*factor
1699 paacw(i,k) = paacw(i,k)*factor
1700 phacw(i,k) = phacw(i,k)*factor
1701 pseml(i,k) = pseml(i,k)*factor
1702 pgeml(i,k) = pgeml(i,k)*factor
1703 pheml(i,k) = pheml(i,k)*factor
1708 value = max(qcrmin,qrs(i,k,2))
1709 source=(pgacs(i,k)+phacs(i,k)-pseml(i,k)-psevp(i,k))*dtcld
1710 if (source.gt.value) then
1711 factor = value/source
1712 pgacs(i,k) = pgacs(i,k)*factor
1713 phacs(i,k) = phacs(i,k)*factor
1714 psevp(i,k) = psevp(i,k)*factor
1715 pseml(i,k) = pseml(i,k)*factor
1720 value = max(qcrmin,qrs(i,k,3))
1721 source=-(pgacs(i,k)+pgevp(i,k)+pgeml(i,k)-phacg(i,k))*dtcld
1722 if (source.gt.value) then
1723 factor = value/source
1724 pgacs(i,k) = pgacs(i,k)*factor
1725 pgevp(i,k) = pgevp(i,k)*factor
1726 pgeml(i,k) = pgeml(i,k)*factor
1727 phacg(i,k) = phacg(i,k)*factor
1732 value = max(qcrmin,qrs(i,k,4))
1733 source=-(phacs(i,k)+phacg(i,k)+phevp(i,k)+pheml(i,k))*dtcld
1734 if (source.gt.value) then
1735 factor = value/source
1736 phacs(i,k) = phacs(i,k)*factor
1737 phacg(i,k) = phacg(i,k)*factor
1738 phevp(i,k) = phevp(i,k)*factor
1739 pheml(i,k) = pheml(i,k)*factor
1741 work2(i,k)=-(prevp(i,k)+psevp(i,k)+pgevp(i,k)+phevp(i,k))
1745 q(i,k) = q(i,k)+work2(i,k)*dtcld
1746 qci(i,k,1) = max(qci(i,k,1)-(praut(i,k)+pracw(i,k) &
1747 +paacw(i,k)+paacw(i,k)+phacw(i,k))*dtcld,0.)
1748 qrs(i,k,1) = max(qrs(i,k,1)+(praut(i,k)+pracw(i,k) &
1749 +prevp(i,k)+paacw(i,k)+paacw(i,k)+phacw(i,k) &
1750 -pseml(i,k)-pgeml(i,k)-pheml(i,k))*dtcld,0.)
1751 qrs(i,k,2) = max(qrs(i,k,2)+(psevp(i,k)+pseml(i,k) &
1752 -pgacs(i,k)-phacs(i,k))*dtcld,0.)
1753 qrs(i,k,3) = max(qrs(i,k,3)+(pgacs(i,k)+pgevp(i,k)+pgeml(i,k) &
1754 -phacg(i,k))*dtcld,0.)
1755 qrs(i,k,4) = max(qrs(i,k,4)+(phacs(i,k)+phacg(i,k)+phevp(i,k) &
1756 +pheml(i,k))*dtcld,0.)
1758 xlwork2 = -xl(i,k)*(prevp(i,k)+psevp(i,k)+pgevp(i,k)+phevp(i,k)) &
1759 -xlf*(pseml(i,k)+pgeml(i,k)+pheml(i,k))
1760 t(i,k) = t(i,k)-xlwork2/cpm(i,k)*dtcld
1765 ! Inline expansion for fpvs
1766 ! qs(i,k,1) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
1767 ! qs(i,k,2) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
1778 xbi=xai+hsub/(rv*ttp)
1782 qs(i,k,1)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
1783 qs(i,k,1) = min(qs(i,k,1),0.99*p(i,k))
1784 qs(i,k,1) = ep2 * qs(i,k,1) / (p(i,k) - qs(i,k,1))
1785 qs(i,k,1) = max(qs(i,k,1),qmin)
1787 if(t(i,k).lt.ttp) then
1788 qs(i,k,2)=psat*exp(log(tr)*(xai))*exp(xbi*(1.-tr))
1790 qs(i,k,2)=psat*exp(log(tr)*(xa))*exp(xb*(1.-tr))
1792 qs(i,k,2) = min(qs(i,k,2),0.99*p(i,k))
1793 qs(i,k,2) = ep2 * qs(i,k,2) / (p(i,k) - qs(i,k,2))
1794 qs(i,k,2) = max(qs(i,k,2),qmin)
1798 ! pcond: condensational/evaporational rate of cloud water [HL A46] [RH83 A6]
1799 ! if there exists additional water vapor condensated/if
1800 ! evaporation of cloud water is not enough to remove subsaturation
1804 work1(i,k,1) = conden(t(i,k),q(i,k),qs(i,k,1),xl(i,k),cpm(i,k))
1805 work2(i,k) = qci(i,k,1)+work1(i,k,1)
1806 pcond(i,k) = min(max(work1(i,k,1)/dtcld,0.),max(q(i,k),0.)/dtcld)
1807 if(qci(i,k,1).gt.0..and.work1(i,k,1).lt.0.) &
1808 pcond(i,k) = max(work1(i,k,1),-qci(i,k,1))/dtcld
1809 q(i,k) = q(i,k)-pcond(i,k)*dtcld
1810 qci(i,k,1) = max(qci(i,k,1)+pcond(i,k)*dtcld,0.)
1811 t(i,k) = t(i,k)+pcond(i,k)*xl(i,k)/cpm(i,k)*dtcld
1815 ! padding for small values
1819 if(qci(i,k,1).le.qmin) qci(i,k,1) = 0.0
1820 if(qci(i,k,2).le.qmin) qci(i,k,2) = 0.0
1824 END SUBROUTINE wsm72d
1825 ! ...................................................................
1826 REAL FUNCTION rgmma(x)
1827 !-------------------------------------------------------------------
1829 !-------------------------------------------------------------------
1830 ! rgmma function: use infinite product form
1832 PARAMETER (euler=0.577215664901532)
1838 rgmma=x*exp(euler*x)
1841 rgmma=rgmma*(1.000+x/y)*exp(-x/y)
1847 !--------------------------------------------------------------------------
1848 REAL FUNCTION fpvs(t,ice,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c)
1849 !--------------------------------------------------------------------------
1851 !--------------------------------------------------------------------------
1852 REAL t,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c,dldt,xa,xb,dldti, &
1855 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1862 xbi=xai+hsub/(rv*ttp)
1864 if(t.lt.ttp.and.ice.eq.1) then
1865 fpvs=psat*(tr**xai)*exp(xbi*(1.-tr))
1867 fpvs=psat*(tr**xa)*exp(xb*(1.-tr))
1869 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1871 !-------------------------------------------------------------------
1872 SUBROUTINE wsm7init(den0,denr,dens,cl,cpv,allowed_to_read)
1873 !-------------------------------------------------------------------
1875 !-------------------------------------------------------------------
1876 !.... constants which may not be tunable
1877 REAL, INTENT(IN) :: den0,denr,dens,cl,cpv
1878 LOGICAL, INTENT(IN) :: allowed_to_read
1883 qc0 = 4./3.*pi*denr*r0**3*xncr/den0 ! 0.419e-3 -- .61e-3
1884 qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03
1892 g1pbr = rgmma(bvtr1)
1893 g3pbr = rgmma(bvtr3)
1894 g4pbr = rgmma(bvtr4) ! 17.837825
1895 g6pbr = rgmma(bvtr6)
1896 g5pbro2 = rgmma(bvtr2) ! 1.8273
1897 pvtr = avtr*g4pbr/6.
1899 pacrr = pi*n0r*avtr*g3pbr*.25*eacrr
1900 precr1 = 2.*pi*n0r*.78
1901 precr2 = 2.*pi*n0r*.31*avtr**.5*g5pbro2
1902 roqimax = 2.08e22*dimax**8
1908 g1pbs = rgmma(bvts1) !.8875
1909 g3pbs = rgmma(bvts3)
1910 g4pbs = rgmma(bvts4) ! 12.0786
1911 g5pbso2 = rgmma(bvts2)
1912 pvts = avts*g4pbs/6.
1913 pacrs = pi*n0s*avts*g3pbs*.25
1915 precs2 = 4.*n0s*.44*avts**.5*g5pbso2
1916 pidn0r = pi*denr*n0r
1917 pidn0s = pi*dens*n0s
1919 pacrc = pi*n0s*avts*g3pbs*.25*eacrc
1925 g1pbg = rgmma(bvtg1)
1926 g3pbg = rgmma(bvtg3)
1927 g4pbg = rgmma(bvtg4)
1928 pacrg = pi*n0g*avtg*g3pbg*.25
1929 g5pbgo2 = rgmma(bvtg2)
1930 g6pbgh = rgmma(2.75)
1931 pvtg = avtg*g4pbg/6.
1932 precg1 = 2.*pi*n0g*.78
1933 precg2 = 2.*pi*n0g*.31*avtg**.5*g5pbgo2
1934 precg3 = 2.*pi*n0g*.31*g6pbgh*sqrt(sqrt(4.*deng/3./cd))
1935 pidn0g = pi*deng*n0g
1940 g3pbh = rgmma(bvth3)
1941 g4pbh = rgmma(bvth4)
1942 g5pbho2 = rgmma(bvth2)
1943 pacrh = pi*n0h*avth*g3pbh*.25
1944 pvth = avth*g4pbh/6.
1945 prech1 = 2.*pi*n0h*.78
1946 prech2 = 2.*pi*n0h*.31*avth**.5*g5pbho2
1947 prech3 = 2.*pi*n0h*.31*g6pbgh*sqrt(sqrt(4.*denh/3./cd))
1948 pidn0h = pi*denh*n0h
1950 rslopermax = 1./lamdarmax
1951 rslopesmax = 1./lamdasmax
1952 rslopegmax = 1./lamdagmax
1953 rslopehmax = 1./lamdahmax
1954 rsloperbmax = rslopermax ** bvtr
1955 rslopesbmax = rslopesmax ** bvts
1956 rslopegbmax = rslopegmax ** bvtg
1957 rslopehbmax = rslopehmax ** bvth
1958 rsloper2max = rslopermax * rslopermax
1959 rslopes2max = rslopesmax * rslopesmax
1960 rslopeg2max = rslopegmax * rslopegmax
1961 rslopeh2max = rslopehmax * rslopehmax
1962 rsloper3max = rsloper2max * rslopermax
1963 rslopes3max = rslopes2max * rslopesmax
1964 rslopeg3max = rslopeg2max * rslopegmax
1965 rslopeh3max = rslopeh2max * rslopehmax
1967 !+---+-----------------------------------------------------------------+
1968 !..Set these variables needed for computing radar reflectivity. These
1969 !.. get used within radar_init to create other variables used in the
1982 !+---+-----------------------------------------------------------------+
1985 END SUBROUTINE wsm7init
1986 !------------------------------------------------------------------------------
1988 !------------------------------------------------------------------------------
1989 subroutine slope_wsm7(qrs,den,denfac,t,rslope,rslopeb,rslope2,rslope3, &
1992 INTEGER :: its,ite, jts,jte, kts,kte
1993 REAL, DIMENSION( its:ite , kts:kte,4) :: &
2000 REAL, DIMENSION( its:ite , kts:kte) :: &
2004 REAL, PARAMETER :: t0c = 273.15
2005 REAL, DIMENSION( its:ite , kts:kte ) :: &
2007 REAL :: lamdar, lamdas, lamdag, lamdah, x, y, z, supcol
2009 !-------------------------------------------------------------------------------
2010 ! size distributions: (x=mixing ratio, y=air density):
2011 ! valid for mixing ratio > 1.e-9 kg/kg.
2012 lamdar(x,y)= sqrt(sqrt(pidn0r/(x*y))) ! (pidn0r/(x*y))**.25
2013 lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25
2014 lamdag(x,y)= sqrt(sqrt(pidn0g/(x*y))) ! (pidn0g/(x*y))**.25
2015 lamdah(x,y)= sqrt(sqrt(pidn0h/(x*y))) ! (pidn0h/(x*y))**.25
2021 ! n0s: Intercept parameter for snow [m-4] [HDC 6]
2023 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
2024 if(qrs(i,k,1).le.qcrmin)then
2025 rslope(i,k,1) = rslopermax
2026 rslopeb(i,k,1) = rsloperbmax
2027 rslope2(i,k,1) = rsloper2max
2028 rslope3(i,k,1) = rsloper3max
2030 rslope(i,k,1) = 1./lamdar(qrs(i,k,1),den(i,k))
2031 rslopeb(i,k,1) = rslope(i,k,1)**bvtr
2032 rslope2(i,k,1) = rslope(i,k,1)*rslope(i,k,1)
2033 rslope3(i,k,1) = rslope2(i,k,1)*rslope(i,k,1)
2035 if(qrs(i,k,2).le.qcrmin)then
2036 rslope(i,k,2) = rslopesmax
2037 rslopeb(i,k,2) = rslopesbmax
2038 rslope2(i,k,2) = rslopes2max
2039 rslope3(i,k,2) = rslopes3max
2041 rslope(i,k,2) = 1./lamdas(qrs(i,k,2),den(i,k),n0sfac(i,k))
2042 rslopeb(i,k,2) = rslope(i,k,2)**bvts
2043 rslope2(i,k,2) = rslope(i,k,2)*rslope(i,k,2)
2044 rslope3(i,k,2) = rslope2(i,k,2)*rslope(i,k,2)
2046 if(qrs(i,k,3).le.qcrmin)then
2047 rslope(i,k,3) = rslopegmax
2048 rslopeb(i,k,3) = rslopegbmax
2049 rslope2(i,k,3) = rslopeg2max
2050 rslope3(i,k,3) = rslopeg3max
2052 rslope(i,k,3) = 1./lamdag(qrs(i,k,3),den(i,k))
2053 rslopeb(i,k,3) = rslope(i,k,3)**bvtg
2054 rslope2(i,k,3) = rslope(i,k,3)*rslope(i,k,3)
2055 rslope3(i,k,3) = rslope2(i,k,3)*rslope(i,k,3)
2057 if(qrs(i,k,4).le.qcrmin)then
2058 rslope(i,k,4) = rslopehmax
2059 rslopeb(i,k,4) = rslopehbmax
2060 rslope2(i,k,4) = rslopeh2max
2061 rslope3(i,k,4) = rslopeh3max
2063 rslope(i,k,4) = 1./lamdah(qrs(i,k,4),den(i,k))
2064 rslopeb(i,k,4) = rslope(i,k,4)**bvth
2065 rslope2(i,k,4) = rslope(i,k,4)*rslope(i,k,4)
2066 rslope3(i,k,4) = rslope2(i,k,4)*rslope(i,k,4)
2068 vt(i,k,1) = pvtr*rslopeb(i,k,1)*denfac(i,k)
2069 vt(i,k,2) = pvts*rslopeb(i,k,2)*denfac(i,k)
2070 vt(i,k,3) = pvtg*rslopeb(i,k,3)*denfac(i,k)
2071 vt(i,k,4) = pvth*rslopeb(i,k,4)*denfac(i,k)
2072 if(qrs(i,k,1).le.0.0) vt(i,k,1) = 0.0
2073 if(qrs(i,k,2).le.0.0) vt(i,k,2) = 0.0
2074 if(qrs(i,k,3).le.0.0) vt(i,k,3) = 0.0
2075 if(qrs(i,k,4).le.0.0) vt(i,k,4) = 0.0
2078 END subroutine slope_wsm7
2079 !------------------------------------------------------------------------------
2081 !-----------------------------------------------------------------------------
2082 subroutine slope_rain(qrs,den,denfac,rslope,rslopeb,rslope2,rslope3, &
2085 INTEGER :: its,ite, jts,jte, kts,kte
2086 REAL, DIMENSION( its:ite , kts:kte) :: &
2095 REAL :: lamdar, x, y
2097 !------------------------------------------------------------------------------
2098 ! size distributions: (x=mixing ratio, y=air density):
2099 ! valid for mixing ratio > 1.e-9 kg/kg.
2100 lamdar(x,y)= sqrt(sqrt(pidn0r/(x*y))) ! (pidn0r/(x*y))**.25
2104 if(qrs(i,k).le.qcrmin)then
2105 rslope(i,k) = rslopermax
2106 rslopeb(i,k) = rsloperbmax
2107 rslope2(i,k) = rsloper2max
2108 rslope3(i,k) = rsloper3max
2110 rslope(i,k) = 1./lamdar(qrs(i,k),den(i,k))
2111 rslopeb(i,k) = rslope(i,k)**bvtr
2112 rslope2(i,k) = rslope(i,k)*rslope(i,k)
2113 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
2115 vt(i,k) = pvtr*rslopeb(i,k)*denfac(i,k)
2116 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
2119 END subroutine slope_rain
2120 !------------------------------------------------------------------------------
2122 !------------------------------------------------------------------------------
2123 subroutine slope_snow(qrs,den,denfac,t,rslope,rslopeb,rslope2,rslope3, &
2126 INTEGER :: its,ite, jts,jte, kts,kte
2127 REAL, DIMENSION( its:ite , kts:kte) :: &
2137 REAL, PARAMETER :: t0c = 273.15
2138 REAL, DIMENSION( its:ite , kts:kte ) :: &
2140 REAL :: lamdas, x, y, z, supcol
2142 !------------------------------------------------------------------------------
2143 ! size distributions: (x=mixing ratio, y=air density):
2144 ! valid for mixing ratio > 1.e-9 kg/kg.
2145 lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25
2151 ! n0s: Intercept parameter for snow [m-4] [HDC 6]
2153 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
2154 if(qrs(i,k).le.qcrmin)then
2155 rslope(i,k) = rslopesmax
2156 rslopeb(i,k) = rslopesbmax
2157 rslope2(i,k) = rslopes2max
2158 rslope3(i,k) = rslopes3max
2160 rslope(i,k) = 1./lamdas(qrs(i,k),den(i,k),n0sfac(i,k))
2161 rslopeb(i,k) = rslope(i,k)**bvts
2162 rslope2(i,k) = rslope(i,k)*rslope(i,k)
2163 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
2165 vt(i,k) = pvts*rslopeb(i,k)*denfac(i,k)
2166 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
2169 END subroutine slope_snow
2170 !----------------------------------------------------------------------------------
2172 !----------------------------------------------------------------------------------
2173 subroutine slope_graup(qrs,den,denfac,rslope,rslopeb,rslope2,rslope3, &
2176 INTEGER :: its,ite, jts,jte, kts,kte
2177 REAL, DIMENSION( its:ite , kts:kte) :: &
2187 REAL :: lamdag, x, y
2189 !------------------------------------------------------------------------------
2190 ! size distributions: (x=mixing ratio, y=air density):
2191 ! valid for mixing ratio > 1.e-9 kg/kg.
2192 lamdag(x,y)= sqrt(sqrt(pidn0g/(x*y))) ! (pidn0g/(x*y))**.25
2196 if(qrs(i,k).le.qcrmin)then
2197 rslope(i,k) = rslopegmax
2198 rslopeb(i,k) = rslopegbmax
2199 rslope2(i,k) = rslopeg2max
2200 rslope3(i,k) = rslopeg3max
2202 rslope(i,k) = 1./lamdag(qrs(i,k),den(i,k))
2203 rslopeb(i,k) = rslope(i,k)**bvtg
2204 rslope2(i,k) = rslope(i,k)*rslope(i,k)
2205 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
2207 vt(i,k) = pvtg*rslopeb(i,k)*denfac(i,k)
2208 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
2211 END subroutine slope_graup
2212 !---------------------------------------------------------------------------------
2214 !-----------------------------------------------------------------------------
2215 subroutine slope_hail(qrs,den,denfac,rslope,rslopeb,rslope2,rslope3, &
2218 INTEGER :: its,ite, jts,jte, kts,kte
2219 REAL, DIMENSION( its:ite , kts:kte) :: &
2229 REAL :: lamdah, x, y
2231 !------------------------------------------------------------------------------
2232 ! size distributions: (x=mixing ratio, y=air density):
2233 ! valid for mixing ratio > 1.e-9 kg/kg.
2234 lamdah(x,y)= sqrt(sqrt(pidn0h/(x*y))) ! (pidn0h/(x*y))**.25
2238 if(qrs(i,k).le.qcrmin)then
2239 rslope(i,k) = rslopehmax
2240 rslopeb(i,k) = rslopehbmax
2241 rslope2(i,k) = rslopeh2max
2242 rslope3(i,k) = rslopeh3max
2244 rslope(i,k) = 1./lamdah(qrs(i,k),den(i,k))
2245 rslopeb(i,k) = rslope(i,k)**bvth
2246 rslope2(i,k) = rslope(i,k)*rslope(i,k)
2247 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
2249 vt(i,k) = pvth*rslopeb(i,k)*denfac(i,k)
2250 if(qrs(i,k).le.0.0) vt(i,k) = 0.0
2253 END subroutine slope_hail
2254 !------------------------------------------------------------------------------
2256 !------------------------------------------------------------------------------
2257 SUBROUTINE nislfv_rain_plm(im,km,denl,denfacl,tkl,dzl,wwl,rql,precip,dt,id,iter)
2258 !-------------------------------------------------------------------
2260 ! for non-iteration semi-Lagrangain forward advection for cloud
2261 ! with mass conservation and positive definite advection
2262 ! 2nd order interpolation with monotonic piecewise linear method
2263 ! this routine is under assumption of decfl < 1 for semi_Lagrangian
2265 ! dzl depth of model layer in meter
2266 ! wwl terminal velocity at model layer m/s
2267 ! rql cloud density*mixing ration
2268 ! precip precipitation
2270 ! id kind of precip: 0 test case; 1 raindrop; 2 hail
2271 ! iter how many time to guess mean terminal velocity: 0 pure forward.
2272 ! 0 : use departure wind for advection
2273 ! 1 : use mean wind for advection
2274 ! > 1 : use mean wind after iter-1 iterations
2276 ! author: hann-ming henry juang <henry.juang@noaa.gov>
2277 ! implemented by song-you hong
2279 !------------------------------------------------------------------------------
2281 !------------------------------------------------------------------------------
2284 real dzl(im,km),wwl(im,km),rql(im,km),precip(im)
2285 real denl(im,km),denfacl(im,km),tkl(im,km)
2287 integer i,k,n,m,kk,kb,kt,iter
2288 real tl,tl2,qql,dql,qqd
2290 real zsum,qsum,dim,dip,c1,con1,fa1,fa2
2291 real allold, allnew, zz, dzamin, cflmax, decfl
2292 real dz(km), ww(km), qq(km), wd(km), wa(km), was(km)
2293 real den(km), denfac(km), tk(km)
2294 real wi(km+1), zi(km+1), za(km+1)
2295 real qn(km), qr(km),tmp(km),tmp1(km),tmp2(km),tmp3(km)
2296 real dza(km+1), qa(km+1), qmi(km+1), qpi(km+1)
2297 !------------------------------------------------------------------------------
2301 ! -----------------------------------
2306 denfac(:) = denfacl(i,:)
2309 ! skip for no precipitation for all layers
2313 allold = allold + qq(k)
2315 if(allold.le.0.0) then
2319 ! compute interface values
2323 zi(k+1) = zi(k)+dz(k)
2326 ! save departure wind
2332 ! 3rd order interpolation to get wi
2337 wi(2) = 0.5*(ww(2)+ww(1))
2339 wi(k) = fa1*(ww(k)+ww(k-1))-fa2*(ww(k+1)+ww(k-2))
2341 wi(km) = 0.5*(ww(km)+ww(km-1))
2344 ! terminate of top of raingroup
2347 if( ww(k).eq.0.0 ) wi(k)=ww(k-1)
2354 decfl = (wi(k+1)-wi(k))*dt/dz(k)
2355 if( decfl .gt. con1 ) then
2356 wi(k) = wi(k+1) - con1*dz(k)/dt
2360 ! compute arrival point
2363 za(k) = zi(k) - wi(k)*dt
2367 dza(k) = za(k+1)-za(k)
2369 dza(km+1) = zi(km+1) - za(km+1)
2371 ! computer deformation at arrival point
2374 qa(k) = qq(k)*dz(k)/dza(k)
2375 qr(k) = qa(k)/den(k)
2378 ! call maxmin(km,1,qa,' arrival points ')
2380 ! compute arrival terminal velocity, and estimate mean terminal velocity
2381 ! then back to use mean terminal velocity
2383 if( n.le.iter ) then
2385 call slope_rain(qr,den,denfac,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km)
2386 else if(id.eq.2) then
2387 call slope_hail(qr,den,denfac,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km)
2389 if( n.ge.2 ) wa(1:km)=0.5*(wa(1:km)+was(1:km))
2392 ! print*,' slope_wsm3 ',qr(k)*1000.,den(k),denfac(k),tk(k),tmp(k),tmp1(k),tmp2(k),ww(k),wa(k)
2394 ! mean wind is average of departure and new arrival winds
2395 ww(k) = 0.5* ( wd(k)+wa(k) )
2402 ! estimate values at arrival cell interface with monotone
2405 dip=(qa(k+1)-qa(k))/(dza(k+1)+dza(k))
2406 dim=(qa(k)-qa(k-1))/(dza(k-1)+dza(k))
2407 if( dip*dim.le.0.0 ) then
2411 qpi(k)=qa(k)+0.5*(dip+dim)*dza(k)
2412 qmi(k)=2.0*qa(k)-qpi(k)
2413 if( qpi(k).lt.0.0 .or. qmi(k).lt.0.0 ) then
2424 ! interpolation to regular point
2435 if( zi(k).ge.za(km+1) ) then
2438 find_kb : do kk=kb,km
2439 if( zi(k).le.za(kk+1) ) then
2446 find_kt : do kk=kt,km
2447 if( zi(k+1).le.za(kk) ) then
2456 ! compute q with piecewise constant method
2459 tl=(zi(k)-za(kb))/dza(kb)
2460 th=(zi(k+1)-za(kb))/dza(kb)
2463 qqd=0.5*(qpi(kb)-qmi(kb))
2464 qqh=qqd*th2+qmi(kb)*th
2465 qql=qqd*tl2+qmi(kb)*tl
2466 qn(k) = (qqh-qql)/(th-tl)
2467 else if( kt.gt.kb ) then
2468 tl=(zi(k)-za(kb))/dza(kb)
2470 qqd=0.5*(qpi(kb)-qmi(kb))
2471 qql=qqd*tl2+qmi(kb)*tl
2473 zsum = (1.-tl)*dza(kb)
2475 if( kt-kb.gt.1 ) then
2477 zsum = zsum + dza(m)
2478 qsum = qsum + qa(m) * dza(m)
2481 th=(zi(k+1)-za(kt))/dza(kt)
2483 qqd=0.5*(qpi(kt)-qmi(kt))
2484 dqh=qqd*th2+qmi(kt)*th
2485 zsum = zsum + th*dza(kt)
2486 qsum = qsum + dqh*dza(kt)
2496 sum_precip: do k=1,km
2497 if( za(k).lt.0.0 .and. za(k+1).lt.0.0 ) then
2498 precip(i) = precip(i) + qa(k)*dza(k)
2500 else if ( za(k).lt.0.0 .and. za(k+1).ge.0.0 ) then
2501 precip(i) = precip(i) + qa(k)*(0.0-za(k))
2507 ! replace the new values
2511 ! ----------------------------------
2514 END SUBROUTINE nislfv_rain_plm
2515 !------------------------------------------------------------------------------
2517 !-------------------------------------------------------------------------------
2518 SUBROUTINE nislfv_rain_plm6(im,km,denl,denfacl,tkl,dzl,wwl, &
2519 rql,rql2,precip1,precip2,dt,id,iter)
2520 !------------------------------------------------------------------------------
2522 ! for non-iteration semi-Lagrangain forward advection for cloud
2523 ! with mass conservation and positive definite advection
2524 ! 2nd order interpolation with monotonic piecewise linear method
2525 ! this routine is under assumption of decfl < 1 for semi_Lagrangian
2527 ! dzl depth of model layer in meter
2528 ! wwl terminal velocity at model layer m/s
2529 ! rql cloud density*mixing ration
2530 ! precip precipitation
2532 ! id kind of precip: 0 test case; 1 raindrop
2533 ! iter how many time to guess mean terminal velocity: 0 pure forward.
2534 ! 0 : use departure wind for advection
2535 ! 1 : use mean wind for advection
2536 ! > 1 : use mean wind after iter-1 iterations
2538 ! author: hann-ming henry juang <henry.juang@noaa.gov>
2539 ! implemented by song-you hong
2541 !-------------------------------------------------------------------------------
2543 !-------------------------------------------------------------------------------
2546 real dzl(im,km),wwl(im,km)
2547 real rql(im,km),rql2(im,km)
2548 real precip(im),precip1(im),precip2(im)
2549 real denl(im,km),denfacl(im,km),tkl(im,km)
2551 integer i,k,n,m,kk,kb,kt,iter,ist
2552 real tl,tl2,qql,dql,qqd
2554 real zsum,qsum,dim,dip,c1,con1,fa1,fa2
2555 real allold, allnew, zz, dzamin, cflmax, decfl
2556 real dz(km), ww(km), qq(km), qq2(km)
2557 real wd(km), wa(km), wa2(km), was(km)
2558 real den(km), denfac(km), tk(km)
2559 real wi(km+1), zi(km+1), za(km+1)
2560 real qn(km), qr(km),qr2(km),tmp(km),tmp1(km),tmp2(km),tmp3(km)
2561 real dza(km+1), qa(km+1), qa2(km+1),qmi(km+1), qpi(km+1)
2568 ! -----------------------------------
2574 denfac(:) = denfacl(i,:)
2576 ! skip for no precipitation for all layers
2579 allold = allold + qq(k) + qq2(k)
2581 if(allold.le.0.0) then
2585 ! compute interface values
2588 zi(k+1) = zi(k)+dz(k)
2591 ! save departure wind
2595 ! 3rd order interpolation to get wi
2599 wi(2) = 0.5*(ww(2)+ww(1))
2601 wi(k) = fa1*(ww(k)+ww(k-1))-fa2*(ww(k+1)+ww(k-2))
2603 wi(km) = 0.5*(ww(km)+ww(km-1))
2606 ! terminate of top of raingroup
2608 if( ww(k).eq.0.0 ) wi(k)=ww(k-1)
2614 decfl = (wi(k+1)-wi(k))*dt/dz(k)
2615 if( decfl .gt. con1 ) then
2616 wi(k) = wi(k+1) - con1*dz(k)/dt
2619 ! compute arrival point
2621 za(k) = zi(k) - wi(k)*dt
2625 dza(k) = za(k+1)-za(k)
2627 dza(km+1) = zi(km+1) - za(km+1)
2629 ! computer deformation at arrival point
2631 qa(k) = qq(k)*dz(k)/dza(k)
2632 qa2(k) = qq2(k)*dz(k)/dza(k)
2633 qr(k) = qa(k)/den(k)
2634 qr2(k) = qa2(k)/den(k)
2638 ! call maxmin(km,1,qa,' arrival points ')
2640 ! compute arrival terminal velocity, and estimate mean terminal velocity
2641 ! then back to use mean terminal velocity
2642 if( n.le.iter ) then
2643 call slope_snow(qr,den,denfac,tk,tmp,tmp1,tmp2,tmp3,wa,1,1,1,km)
2644 call slope_graup(qr2,den,denfac,tmp,tmp1,tmp2,tmp3,wa2,1,1,1,km)
2646 tmp(k) = max((qr(k)+qr2(k)), 1.E-15)
2647 IF ( tmp(k) .gt. 1.e-15 ) THEN
2648 wa(k) = (wa(k)*qr(k) + wa2(k)*qr2(k))/tmp(k)
2653 if( n.ge.2 ) wa(1:km)=0.5*(wa(1:km)+was(1:km))
2656 ! print*,' slope_wsm3 ',qr(k)*1000.,den(k),denfac(k),tk(k),tmp(k),tmp1(k),tmp2(k), &
2659 ! mean wind is average of departure and new arrival winds
2660 ww(k) = 0.5* ( wd(k)+wa(k) )
2666 ist_loop : do ist = 1, 2
2673 ! estimate values at arrival cell interface with monotone
2675 dip=(qa(k+1)-qa(k))/(dza(k+1)+dza(k))
2676 dim=(qa(k)-qa(k-1))/(dza(k-1)+dza(k))
2677 if( dip*dim.le.0.0 ) then
2681 qpi(k)=qa(k)+0.5*(dip+dim)*dza(k)
2682 qmi(k)=2.0*qa(k)-qpi(k)
2683 if( qpi(k).lt.0.0 .or. qmi(k).lt.0.0 ) then
2694 ! interpolation to regular point
2702 if( zi(k).ge.za(km+1) ) then
2705 find_kb : do kk=kb,km
2706 if( zi(k).le.za(kk+1) ) then
2713 find_kt : do kk=kt,km
2714 if( zi(k+1).le.za(kk) ) then
2722 ! compute q with piecewise constant method
2724 tl=(zi(k)-za(kb))/dza(kb)
2725 th=(zi(k+1)-za(kb))/dza(kb)
2728 qqd=0.5*(qpi(kb)-qmi(kb))
2729 qqh=qqd*th2+qmi(kb)*th
2730 qql=qqd*tl2+qmi(kb)*tl
2731 qn(k) = (qqh-qql)/(th-tl)
2732 else if( kt.gt.kb ) then
2733 tl=(zi(k)-za(kb))/dza(kb)
2735 qqd=0.5*(qpi(kb)-qmi(kb))
2736 qql=qqd*tl2+qmi(kb)*tl
2738 zsum = (1.-tl)*dza(kb)
2740 if( kt-kb.gt.1 ) then
2742 zsum = zsum + dza(m)
2743 qsum = qsum + qa(m) * dza(m)
2746 th=(zi(k+1)-za(kt))/dza(kt)
2748 qqd=0.5*(qpi(kt)-qmi(kt))
2749 dqh=qqd*th2+qmi(kt)*th
2750 zsum = zsum + th*dza(kt)
2751 qsum = qsum + dqh*dza(kt)
2760 sum_precip: do k=1,km
2761 if( za(k).lt.0.0 .and. za(k+1).lt.0.0 ) then
2762 precip(i) = precip(i) + qa(k)*dza(k)
2764 else if ( za(k).lt.0.0 .and. za(k+1).ge.0.0 ) then
2765 precip(i) = precip(i) + qa(k)*(0.0-za(k))
2771 ! replace the new values
2774 precip1(i) = precip(i)
2777 precip2(i) = precip(i)
2781 ! ----------------------------------
2784 END SUBROUTINE nislfv_rain_plm6
2786 !+---+-----------------------------------------------------------------+
2788 subroutine refl10cm_wsm7 (qv1d, qr1d, qs1d, qg1d, &
2789 t1d, p1d, dBZ, kts, kte, ii, jj)
2794 INTEGER, INTENT(IN):: kts, kte, ii, jj
2795 REAL, DIMENSION(kts:kte), INTENT(IN):: &
2796 qv1d, qr1d, qs1d, qg1d, t1d, p1d
2797 REAL, DIMENSION(kts:kte), INTENT(INOUT):: dBZ
2800 REAL, DIMENSION(kts:kte):: temp, pres, qv, rho
2801 REAL, DIMENSION(kts:kte):: rr, rs, rg
2804 DOUBLE PRECISION, DIMENSION(kts:kte):: ilamr, ilams, ilamg
2805 DOUBLE PRECISION, DIMENSION(kts:kte):: N0_r, N0_s, N0_g
2806 DOUBLE PRECISION:: lamr, lams, lamg
2807 LOGICAL, DIMENSION(kts:kte):: L_qr, L_qs, L_qg
2809 REAL, DIMENSION(kts:kte):: ze_rain, ze_snow, ze_graupel
2810 DOUBLE PRECISION:: fmelt_s, fmelt_g
2812 INTEGER:: i, k, k_0, kbot, n
2815 DOUBLE PRECISION:: cback, x, eta, f_d
2816 REAL, PARAMETER:: R=287.
2824 !+---+-----------------------------------------------------------------+
2825 !..Put column of data into local arrays.
2826 !+---+-----------------------------------------------------------------+
2829 temp_C = min(-0.001, temp(K)-273.15)
2830 qv(k) = MAX(1.E-10, qv1d(k))
2832 rho(k) = 0.622*pres(k)/(R*temp(k)*(qv(k)+0.622))
2834 if (qr1d(k) .gt. 1.E-9) then
2835 rr(k) = qr1d(k)*rho(k)
2837 lamr = (xam_r*xcrg(3)*N0_r(k)/rr(k))**(1./xcre(1))
2845 if (qs1d(k) .gt. 1.E-9) then
2846 rs(k) = qs1d(k)*rho(k)
2847 N0_s(k) = min(n0smax, n0s*exp(-alpha*temp_C))
2848 lams = (xam_s*xcsg(3)*N0_s(k)/rs(k))**(1./xcse(1))
2856 if (qg1d(k) .gt. 1.E-9) then
2857 rg(k) = qg1d(k)*rho(k)
2859 lamg = (xam_g*xcgg(3)*N0_g(k)/rg(k))**(1./xcge(1))
2868 !+---+-----------------------------------------------------------------+
2869 !..Locate K-level of start of melting (k_0 is level above).
2870 !+---+-----------------------------------------------------------------+
2873 do k = kte-1, kts, -1
2874 if ( (temp(k).gt.273.15) .and. L_qr(k) &
2875 .and. (L_qs(k+1).or.L_qg(k+1)) ) then
2883 !+---+-----------------------------------------------------------------+
2884 !..Assume Rayleigh approximation at 10 cm wavelength. Rain (all temps)
2885 !.. and non-water-coated snow and graupel when below freezing are
2886 !.. simple. Integrations of m(D)*m(D)*N(D)*dD.
2887 !+---+-----------------------------------------------------------------+
2892 ze_graupel(k) = 1.e-22
2893 if (L_qr(k)) ze_rain(k) = N0_r(k)*xcrg(4)*ilamr(k)**xcre(4)
2894 if (L_qs(k)) ze_snow(k) = (0.176/0.93) * (6.0/PI)*(6.0/PI) &
2895 * (xam_s/900.0)*(xam_s/900.0) &
2896 * N0_s(k)*xcsg(4)*ilams(k)**xcse(4)
2897 if (L_qg(k)) ze_graupel(k) = (0.176/0.93) * (6.0/PI)*(6.0/PI) &
2898 * (xam_g/900.0)*(xam_g/900.0) &
2899 * N0_g(k)*xcgg(4)*ilamg(k)**xcge(4)
2903 !+---+-----------------------------------------------------------------+
2904 !..Special case of melting ice (snow/graupel) particles. Assume the
2905 !.. ice is surrounded by the liquid water. Fraction of meltwater is
2906 !.. extremely simple based on amount found above the melting level.
2907 !.. Uses code from Uli Blahak (rayleigh_soak_wetgraupel and supporting
2909 !+---+-----------------------------------------------------------------+
2911 if (melti .and. k_0.ge.kts+1) then
2912 do k = k_0-1, kts, -1
2914 !..Reflectivity contributed by melting snow
2915 if (L_qs(k) .and. L_qs(k_0) ) then
2916 fmelt_s = MAX(0.005d0, MIN(1.0d0-rs(k)/rs(k_0), 0.99d0))
2920 x = xam_s * xxDs(n)**xbm_s
2921 call rayleigh_soak_wetgraupel (x,DBLE(xocms),DBLE(xobms), &
2922 fmelt_s, melt_outside_s, m_w_0, m_i_0, lamda_radar, &
2923 CBACK, mixingrulestring_s, matrixstring_s, &
2924 inclusionstring_s, hoststring_s, &
2925 hostmatrixstring_s, hostinclusionstring_s)
2926 f_d = N0_s(k)*xxDs(n)**xmu_s * DEXP(-lams*xxDs(n))
2927 eta = eta + f_d * CBACK * simpson(n) * xdts(n)
2929 ze_snow(k) = SNGL(lamda4 / (pi5 * K_w) * eta)
2933 !..Reflectivity contributed by melting graupel
2935 if (L_qg(k) .and. L_qg(k_0) ) then
2936 fmelt_g = MAX(0.005d0, MIN(1.0d0-rg(k)/rg(k_0), 0.99d0))
2940 x = xam_g * xxDg(n)**xbm_g
2941 call rayleigh_soak_wetgraupel (x,DBLE(xocmg),DBLE(xobmg), &
2942 fmelt_g, melt_outside_g, m_w_0, m_i_0, lamda_radar, &
2943 CBACK, mixingrulestring_g, matrixstring_g, &
2944 inclusionstring_g, hoststring_g, &
2945 hostmatrixstring_g, hostinclusionstring_g)
2946 f_d = N0_g(k)*xxDg(n)**xmu_g * DEXP(-lamg*xxDg(n))
2947 eta = eta + f_d * CBACK * simpson(n) * xdtg(n)
2949 ze_graupel(k) = SNGL(lamda4 / (pi5 * K_w) * eta)
2956 dBZ(k) = 10.*log10((ze_rain(k)+ze_snow(k)+ze_graupel(k))*1.d18)
2960 end subroutine refl10cm_wsm7
2961 !+---+-----------------------------------------------------------------+
2963 !-----------------------------------------------------------------------
2964 subroutine effectRad_wsm7 (t, qc, qi, qs, rho, qmin, t0c, &
2965 re_qc, re_qi, re_qs, kts, kte, ii, jj)
2967 !-----------------------------------------------------------------------
2968 ! Compute radiation effective radii of cloud water, ice, and snow for
2969 ! single-moment microphysics.
2970 ! These are entirely consistent with microphysics assumptions, not
2971 ! constant or otherwise ad hoc as is internal to most radiation
2973 ! Coded and implemented by Soo ya Bae, KIAPS, January 2015.
2974 !-----------------------------------------------------------------------
2976 !-----------------------------------------------------------------------
2980 integer, intent(in) :: kts, kte, ii, jj
2981 real, intent(in) :: qmin
2982 real, intent(in) :: t0c
2983 real, dimension( kts:kte ), intent(in):: t
2984 real, dimension( kts:kte ), intent(in):: qc
2985 real, dimension( kts:kte ), intent(in):: qi
2986 real, dimension( kts:kte ), intent(in):: qs
2987 real, dimension( kts:kte ), intent(in):: rho
2988 real, dimension( kts:kte ), intent(inout):: re_qc
2989 real, dimension( kts:kte ), intent(inout):: re_qi
2990 real, dimension( kts:kte ), intent(inout):: re_qs
2996 real, dimension( kts:kte ):: ni
2997 real, dimension( kts:kte ):: rqc
2998 real, dimension( kts:kte ):: rqi
2999 real, dimension( kts:kte ):: rni
3000 real, dimension( kts:kte ):: rqs
3003 real :: supcol, n0sfac, lamdas
3004 real :: diai ! diameter of ice in m
3005 logical :: has_qc, has_qi, has_qs
3007 ! Minimum microphys values
3009 real, parameter :: R1 = 1.E-12
3010 real, parameter :: R2 = 1.E-6
3012 ! Mass power law relations: mass = am*D**bm
3014 real, parameter :: bm_r = 3.0
3015 real, parameter :: obmr = 1.0/bm_r
3016 real, parameter :: nc0 = 3.E8
3017 !-----------------------------------------------------------------------
3024 rqc(k) = max(R1, qc(k)*rho(k))
3025 if (rqc(k).gt.R1) has_qc = .true.
3027 rqi(k) = max(R1, qi(k)*rho(k))
3028 temp = (rho(k)*max(qi(k),qmin))
3029 temp = sqrt(sqrt(temp*temp*temp))
3030 ni(k) = min(max(5.38e7*temp,1.e3),1.e6)
3031 rni(k)= max(R2, ni(k)*rho(k))
3032 if (rqi(k).gt.R1 .and. rni(k).gt.R2) has_qi = .true.
3034 rqs(k) = max(R1, qs(k)*rho(k))
3035 if (rqs(k).gt.R1) has_qs = .true.
3040 if (rqc(k).le.R1) CYCLE
3041 lamdac = (pidnc*nc0/rqc(k))**obmr
3042 re_qc(k) = max(2.51E-6,min(1.5*(1.0/lamdac),50.E-6))
3048 if (rqi(k).le.R1 .or. rni(k).le.R2) CYCLE
3049 diai = 11.9*sqrt(rqi(k)/ni(k))
3050 re_qi(k) = max(10.01E-6,min(0.75*0.163*diai,125.E-6))
3056 if (rqs(k).le.R1) CYCLE
3058 n0sfac = max(min(exp(alpha*supcol),n0smax/n0s),1.)
3059 lamdas = sqrt(sqrt(pidn0s*n0sfac/rqs(k)))
3060 re_qs(k) = max(25.E-6,min(0.5*(1./lamdas), 999.E-6))
3064 end subroutine effectRad_wsm7
3065 !-----------------------------------------------------------------------
3067 END MODULE module_mp_wsm7