12 REAL, PARAMETER, PRIVATE :: dtcldcr = 120.
13 REAL, PARAMETER, PRIVATE :: n0r = 8.e6
14 REAL, PARAMETER, PRIVATE :: avtr = 841.9
15 REAL, PARAMETER, PRIVATE :: bvtr = 0.8
16 REAL, PARAMETER, PRIVATE :: r0 = .8e-5 ! 8 microm in contrast to 10 micro m
17 REAL, PARAMETER, PRIVATE :: peaut = .55 ! collection efficiency
18 REAL, PARAMETER, PRIVATE :: xncr = 3.e8 ! maritime cloud in contrast to 3.e8 in tc80
19 REAL, PARAMETER, PRIVATE :: xmyu = 1.718e-5 ! the dynamic viscosity kgm-1s-1
20 REAL, PARAMETER, PRIVATE :: avts = 11.72
21 REAL, PARAMETER, PRIVATE :: bvts = .41
22 REAL, PARAMETER, PRIVATE :: n0smax = 1.e11 ! t=-90C unlimited
23 REAL, PARAMETER, PRIVATE :: lamdarmax = 8.e4
24 REAL, PARAMETER, PRIVATE :: lamdasmax = 1.e5
25 REAL, PARAMETER, PRIVATE :: lamdagmax = 6.e4
26 REAL, PARAMETER, PRIVATE :: betai = .6
27 REAL, PARAMETER, PRIVATE :: xn0 = 1.e-2
28 REAL, PARAMETER, PRIVATE :: dicon = 11.9
29 REAL, PARAMETER, PRIVATE :: di0 = 12.9e-6
30 REAL, PARAMETER, PRIVATE :: dimax = 500.e-6
31 REAL, PARAMETER, PRIVATE :: n0s = 2.e6 ! temperature dependent n0s
32 REAL, PARAMETER, PRIVATE :: alpha = .12 ! .122 exponen factor for n0s
33 REAL, PARAMETER, PRIVATE :: qcrmin = 1.e-9
35 qc0, qck1,bvtr1,bvtr2,bvtr3,bvtr4,g1pbr,&
36 g3pbr,g4pbr,g5pbro2,pvtr,eacrr,pacrr, &
37 precr1,precr2,xm0,xmmax,roqimax,bvts1, &
38 bvts2,bvts3,bvts4,g1pbs,g3pbs,g4pbs, &
39 g5pbso2,pvts,pacrs,precs1,precs2,pidn0r,&
41 rslopermax,rslopesmax,rslopegmax, &
42 rsloperbmax,rslopesbmax,rslopegbmax, &
43 rsloper2max,rslopes2max,rslopeg2max, &
44 rsloper3max,rslopes3max,rslopeg3max
46 ! Specifies code-inlining of fpvs function in WSM32D below. JM 20040507
49 !===================================================================
51 SUBROUTINE wsm3(th, q, qci, qrs &
52 , w, den, pii, p, delz &
53 , delt,g, cpd, cpv, rd, rv, t0c &
55 , XLS, XLV0, XLF0, den0, denr &
60 , ids,ide, jds,jde, kds,kde &
61 , ims,ime, jms,jme, kms,kme &
62 , its,ite, jts,jte, kts,kte &
64 !-------------------------------------------------------------------
66 !-------------------------------------------------------------------
69 ! This code is a 3-class simple ice microphyiscs scheme (WSM3) of the WRF
70 ! Single-Moment MicroPhyiscs (WSMMP). The WSMMP assumes that ice nuclei
71 ! number concentration is a function of temperature, and seperate assumption
72 ! is developed, in which ice crystal number concentration is a function
73 ! of ice amount. A theoretical background of the ice-microphysics and related
74 ! processes in the WSMMPs are described in Hong et al. (2004).
75 ! Production terms in the WSM6 scheme are described in Hong and Lim (2006).
76 ! All units are in m.k.s. and source/sink terms in kgkg-1s-1.
80 ! Coded by Song-You Hong (Yonsei Univ.)
81 ! Jimy Dudhia (NCAR) and Shu-Hua Chen (UC Davis)
84 ! Implemented by Song-You Hong (Yonsei Univ.) and Jimy Dudhia (NCAR)
87 ! Reference) Hong, Dudhia, Chen (HDC, 2004) Mon. Wea. Rev.
88 ! Dudhia (D89, 1989) J. Atmos. Sci.
89 ! Hong and Lim (HL, 2006) J. Korean Meteor. Soc.
91 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
92 ims,ime, jms,jme, kms,kme , &
93 its,ite, jts,jte, kts,kte
94 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
100 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
106 REAL, INTENT(IN ) :: delt, &
124 REAL, DIMENSION( ims:ime , jms:jme ), &
125 INTENT(INOUT) :: rain, &
129 REAL, DIMENSION( ims:ime , jms:jme ), OPTIONAL, &
130 INTENT(INOUT) :: snow, &
134 REAL, DIMENSION( its:ite , kts:kte ) :: t
136 !-------------------------------------------------------------------
140 t(i,k)=th(i,k,j)*pii(i,k,j)
143 CALL wsm32D(t, q(ims,kms,j), qci(ims,kms,j) &
144 ,qrs(ims,kms,j),w(ims,kms,j), den(ims,kms,j) &
145 ,p(ims,kms,j), delz(ims,kms,j) &
146 ,delt,g, cpd, cpv, rd, rv, t0c &
148 ,XLS, XLV0, XLF0, den0, denr &
151 ,rain(ims,j), rainncv(ims,j) &
153 ,ids,ide, jds,jde, kds,kde &
154 ,ims,ime, jms,jme, kms,kme &
155 ,its,ite, jts,jte, kts,kte &
156 ,snow(ims,j),snowncv(ims,j) &
160 th(i,k,j)=t(i,k)/pii(i,k,j)
165 !===================================================================
167 SUBROUTINE wsm32D(t, q, qci, qrs,w, den, p, delz &
168 ,delt,g, cpd, cpv, rd, rv, t0c &
170 ,XLS, XLV0, XLF0, den0, denr &
175 ,ids,ide, jds,jde, kds,kde &
176 ,ims,ime, jms,jme, kms,kme &
177 ,its,ite, jts,jte, kts,kte &
180 !-------------------------------------------------------------------
182 !-------------------------------------------------------------------
183 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
184 ims,ime, jms,jme, kms,kme , &
185 its,ite, jts,jte, kts,kte, &
187 REAL, DIMENSION( its:ite , kts:kte ), &
190 REAL, DIMENSION( ims:ime , kms:kme ), &
195 REAL, DIMENSION( ims:ime , kms:kme ), &
200 REAL, INTENT(IN ) :: delt, &
218 REAL, DIMENSION( ims:ime ), &
219 INTENT(INOUT) :: rain, &
223 REAL, DIMENSION( ims:ime ), OPTIONAL, &
224 INTENT(INOUT) :: snow, &
227 REAL, DIMENSION( its:ite , kts:kte ) :: &
228 rh, qs, denfac, rslope, rslope2, rslope3, rslopeb, &
229 pgen, paut, pacr, pisd, pres, pcon, fall, falk, &
230 xl, cpm, work1, work2, xni, qs0, n0sfac
231 INTEGER, DIMENSION( its:ite ) :: kwork1, kwork2
232 REAL, DIMENSION( its:ite , kts:kte ) :: &
233 falkc, work1c, work2c, fallc
234 ! variables for optimization
235 REAL, DIMENSION( its:ite ) :: tvec1
236 INTEGER, DIMENSION( its:ite ) :: mstep, numdt
237 LOGICAL, DIMENSION( its:ite ) :: flgcld
239 cpmcal, xlcal, lamdar, lamdas, diffus, &
240 viscos, xka, venfac, conden, diffac, &
241 x, y, z, a, b, c, d, e, &
242 fallsum, fallsum_qsi, vt2i,vt2s,acrfac, &
243 qdt, pvt, qik, delq, facq, qrsci, frzmlt, &
244 snomlt, hold, holdrs, facqci, supcol, coeres, &
245 supsat, dtcld, xmi, qciik, delqci, eacrs, satdt, &
246 qimax, diameter, xni0, roqi0, supice
247 REAL :: holdc, holdci
248 INTEGER :: i, j, k, mstepmax, &
249 iprt, latd, lond, loop, loops, ifsat, kk, n
250 ! Temporaries used for inlining fpvs function
251 REAL :: dldti, xb, xai, tr, xbi, xa, hvap, cvap, hsub, dldt, ttp
253 !=================================================================
254 ! compute internal functions
256 cpmcal(x) = cpd*(1.-max(x,qmin))+max(x,qmin)*cpv
257 xlcal(x) = xlv0-xlv1*(x-t0c)
258 !----------------------------------------------------------------
259 ! size distributions: (x=mixing ratio, y=air density):
260 ! valid for mixing ratio > 1.e-9 kg/kg.
262 ! Optimizatin : A**B => exp(log(A)*(B))
263 lamdar(x,y)= sqrt(sqrt(pidn0r/(x*y))) ! (pidn0r/(x*y))**.25
264 lamdas(x,y,z)= sqrt(sqrt(pidn0s*z/(x*y))) ! (pidn0s*z/(x*y))**.25
266 !----------------------------------------------------------------
267 ! diffus: diffusion coefficient of the water vapor
268 ! viscos: kinematic viscosity(m2s-1)
270 diffus(x,y) = 8.794e-5 * exp(log(x)*(1.81)) / y ! 8.794e-5*x**1.81/y
271 viscos(x,y) = 1.496e-6 * (x*sqrt(x)) /(x+120.)/y ! 1.496e-6*x**1.5/(x+120.)/y
272 xka(x,y) = 1.414e3*viscos(x,y)*y
273 diffac(a,b,c,d,e) = d*a*a/(xka(c,d)*rv*c*c)+1./(e*diffus(c,b))
274 ! venfac(a,b,c) = (viscos(b,c)/diffus(b,a))**(.3333333) &
275 ! /viscos(b,c)**(.5)*(den0/c)**0.25
276 venfac(a,b,c) = exp(log((viscos(b,c)/diffus(b,a)))*((.3333333))) &
277 /sqrt(viscos(b,c))*sqrt(sqrt(den0/c))
278 conden(a,b,c,d,e) = (max(b,qmin)-c)/(1.+d*d/(rv*e)*c/(a*a))
282 !----------------------------------------------------------------
283 ! paddint 0 for negative values generated by dynamics
287 qci(i,k) = max(qci(i,k),0.0)
288 qrs(i,k) = max(qrs(i,k),0.0)
292 !----------------------------------------------------------------
293 ! latent heat for phase changes and heat capacity. neglect the
294 ! changes during microphysical process calculation
299 cpm(i,k) = cpmcal(q(i,k))
300 xl(i,k) = xlcal(t(i,k))
304 !----------------------------------------------------------------
305 ! compute the minor time steps.
307 loops = max(nint(delt/dtcldcr),1)
309 if(delt.le.dtcldcr) dtcld = delt
313 !----------------------------------------------------------------
314 ! initialize the large scale variables
323 ! denfac(i,k) = sqrt(den0/den(i,k))
327 CALL VREC( tvec1(its), den(its,k), ite-its+1)
329 tvec1(i) = tvec1(i)*den0
331 CALL VSQRT( denfac(its,k), tvec1(its), ite-its+1)
334 ! Inline expansion for fpvs
335 ! qs(i,k) = fpvs(t(i,k),1,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
336 ! qs0(i,k) = fpvs(t(i,k),0,rd,rv,cpv,cliq,cice,xlv0,xls,psat,t0c)
346 xbi=xai+hsub/(rv*ttp)
350 ! if(t(i,k).lt.ttp) then
351 ! qs(i,k) =psat*(tr**xai)*exp(xbi*(1.-tr))
353 ! qs(i,k) =psat*(tr**xa)*exp(xb*(1.-tr))
355 ! qs0(i,k) =psat*(tr**xa)*exp(xb*(1.-tr))
357 if(t(i,k).lt.ttp) then
358 qs(i,k) =psat*(exp(log(tr)*(xai)))*exp(xbi*(1.-tr))
360 qs(i,k) =psat*(exp(log(tr)*(xa)))*exp(xb*(1.-tr))
362 qs0(i,k) =psat*(exp(log(tr)*(xa)))*exp(xb*(1.-tr))
363 qs0(i,k) = (qs0(i,k)-qs(i,k))/qs(i,k)
364 qs(i,k) = ep2 * qs(i,k) / (p(i,k) - qs(i,k))
365 qs(i,k) = max(qs(i,k),qmin)
366 rh(i,k) = max(q(i,k) / qs(i,k),qmin)
370 !----------------------------------------------------------------
371 ! initialize the variables for microphysical physics
390 !----------------------------------------------------------------
391 ! compute the fallout term:
392 ! first, vertical terminal velosity for minor loops
393 !---------------------------------------------------------------
394 ! n0s: Intercept parameter for snow [m-4] [HDC 6]
395 !---------------------------------------------------------------
399 n0sfac(i,k) = max(min(exp(alpha*supcol),n0smax/n0s),1.)
400 if(t(i,k).ge.t0c) then
401 if(qrs(i,k).le.qcrmin)then
402 rslope(i,k) = rslopermax
403 rslopeb(i,k) = rsloperbmax
404 rslope2(i,k) = rsloper2max
405 rslope3(i,k) = rsloper3max
407 rslope(i,k) = 1./lamdar(qrs(i,k),den(i,k))
408 ! rslopeb(i,k) = rslope(i,k)**bvtr
409 rslopeb(i,k) = exp(log(rslope(i,k))*(bvtr))
410 rslope2(i,k) = rslope(i,k)*rslope(i,k)
411 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
414 if(qrs(i,k).le.qcrmin)then
415 rslope(i,k) = rslopesmax
416 rslopeb(i,k) = rslopesbmax
417 rslope2(i,k) = rslopes2max
418 rslope3(i,k) = rslopes3max
420 rslope(i,k) = 1./lamdas(qrs(i,k),den(i,k),n0sfac(i,k))
421 ! rslopeb(i,k) = rslope(i,k)**bvts
422 rslopeb(i,k) = exp(log(rslope(i,k))*(bvts))
423 rslope2(i,k) = rslope(i,k)*rslope(i,k)
424 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
427 !-------------------------------------------------------------
428 ! Ni: ice crystal number concentraiton [HDC 5c]
429 !-------------------------------------------------------------
430 ! xni(i,k) = min(max(5.38e7*(den(i,k) &
431 ! *max(qci(i,k),qmin))**0.75,1.e3),1.e6)
432 xni(i,k) = min(max(5.38e7*exp(log((den(i,k)*max(qci(i,k),qmin)))*(0.75)),1.e3),1.e6)
440 if(t(i,k).lt.t0c) then
445 work1(i,k) = pvt*rslopeb(i,k)*denfac(i,k)
446 work2(i,k) = work1(i,k)/delz(i,k)
447 numdt(i) = max(nint(work2(i,k)*dtcld+.5),1)
448 if(numdt(i).ge.mstep(i)) mstep(i) = numdt(i)
452 if(mstepmax.le.mstep(i)) mstepmax = mstep(i)
458 if(n.le.mstep(i)) then
459 falk(i,k) = den(i,k)*qrs(i,k)*work2(i,k)/mstep(i)
461 fall(i,k) = fall(i,k)+falk(i,k)
463 qrs(i,k) = max(qrs(i,k)-falk(i,k)*dtcld/den(i,k),0.)
466 do k = kte-1, kts, -1
468 if(n.le.mstep(i)) then
469 falk(i,k) = den(i,k)*qrs(i,k)*work2(i,k)/mstep(i)
471 fall(i,k) = fall(i,k)+falk(i,k)
473 qrs(i,k) = max(qrs(i,k)-(falk(i,k) &
474 -falk(i,k+1)*delz(i,k+1)/delz(i,k))*dtcld/den(i,k),0.)
479 !---------------------------------------------------------------
480 ! Vice [ms-1] : fallout of ice crystal [HDC 5a]
481 !---------------------------------------------------------------
487 if(t(i,k).lt.t0c.and.qci(i,k).gt.0.) then
488 xmi = den(i,k)*qci(i,k)/xni(i,k)
489 ! diameter = dicon * sqrt(xmi)
490 ! work1c(i,k) = 1.49e4*diameter**1.31
491 diameter = max(dicon * sqrt(xmi), 1.e-25)
492 work1c(i,k) = 1.49e4*exp(log(diameter)*(1.31))
496 if(qci(i,k).le.0.) then
499 work2c(i,k) = work1c(i,k)/delz(i,k)
501 numdt(i) = max(nint(work2c(i,k)*dtcld+.5),1)
502 if(numdt(i).ge.mstep(i)) mstep(i) = numdt(i)
506 if(mstepmax.le.mstep(i)) mstepmax = mstep(i)
512 if (n.le.mstep(i)) then
513 falkc(i,k) = den(i,k)*qci(i,k)*work2c(i,k)/mstep(i)
515 fallc(i,k) = fallc(i,k)+falkc(i,k)
517 qci(i,k) = max(qci(i,k)-falkc(i,k)*dtcld/den(i,k),0.)
520 do k = kte-1, kts, -1
522 if (n.le.mstep(i)) then
523 falkc(i,k) = den(i,k)*qci(i,k)*work2c(i,k)/mstep(i)
525 fallc(i,k) = fallc(i,k)+falkc(i,k)
527 qci(i,k) = max(qci(i,k)-(falkc(i,k) &
528 -falkc(i,k+1)*delz(i,k+1)/delz(i,k))*dtcld/den(i,k),0.)
534 !----------------------------------------------------------------
535 ! compute the freezing/melting term. [D89 B16-B17]
536 ! freezing occurs one layer above the melting level
543 if(t(i,k).ge.t0c) then
552 if(mstep(i).ne.0) then
553 if (w(i,mstep(i)).gt.0.) then
554 kwork1(i) = mstep(i) + 1
563 qrsci = qrs(i,k) + qci(i,k)
564 if(qrsci.gt.0..or.fall(i,kk).gt.0.) then
565 frzmlt = min(max(-w(i,k)*qrsci/delz(i,k),-qrsci/dtcld), &
567 snomlt = min(max(fall(i,kk)/den(i,kk),-qrs(i,k)/dtcld), &
570 t(i,k) = t(i,k) - xlf0/cpm(i,k)*(frzmlt+snomlt)*dtcld
572 t(i,k) = t(i,k) - xlf0/cpm(i,k)*frzmlt*dtcld
573 t(i,kk) = t(i,kk) - xlf0/cpm(i,kk)*snomlt*dtcld
579 !----------------------------------------------------------------
580 ! rain (unit is mm/sec;kgm-2s-1: /1000*delt ===> m)==> mm for wrf
585 if((t0c-t(i,1)).gt.0) then
586 fallsum = fallsum+fallc(i,1)
587 fallsum_qsi = fall(i,1)+fallc(i,1)
590 if(fallsum.gt.0.) then
591 rainncv(i) = fallsum*delz(i,1)/denr*dtcld*1000.
592 rain(i) = fallsum*delz(i,1)/denr*dtcld*1000. &
595 IF ( PRESENT (snowncv) .AND. PRESENT (snow)) THEN
597 if(fallsum_qsi.gt.0.) then
598 snowncv(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000.
599 snow(i) = fallsum_qsi*delz(i,kts)/denr*dtcld*1000. + snow(i)
603 if(fallsum.gt.0.)sr(i)=fallsum_qsi*delz(i,kts)/denr*dtcld*1000./(rainncv(i)+1.e-12)
606 !----------------------------------------------------------------
607 ! rsloper: reverse of the slope parameter of the rain(m)
608 ! xka: thermal conductivity of air(jm-1s-1k-1)
609 ! work1: the thermodynamic term in the denominator associated with
610 ! heat conduction and vapor diffusion
612 ! work2: parameter associated with the ventilation effects(y93)
616 if(t(i,k).ge.t0c) then
617 if(qrs(i,k).le.qcrmin)then
618 rslope(i,k) = rslopermax
619 rslopeb(i,k) = rsloperbmax
620 rslope2(i,k) = rsloper2max
621 rslope3(i,k) = rsloper3max
623 rslope(i,k) = 1./lamdar(qrs(i,k),den(i,k))
624 rslopeb(i,k) = exp(log(rslope(i,k))*(bvtr))
625 rslope2(i,k) = rslope(i,k)*rslope(i,k)
626 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
629 if(qrs(i,k).le.qcrmin)then
630 rslope(i,k) = rslopesmax
631 rslopeb(i,k) = rslopesbmax
632 rslope2(i,k) = rslopes2max
633 rslope3(i,k) = rslopes3max
635 rslope(i,k) = 1./lamdas(qrs(i,k),den(i,k),n0sfac(i,k))
636 rslopeb(i,k) = exp(log(rslope(i,k))*(bvts))
637 rslope2(i,k) = rslope(i,k)*rslope(i,k)
638 rslope3(i,k) = rslope2(i,k)*rslope(i,k)
646 if(t(i,k).ge.t0c) then
647 work1(i,k) = diffac(xl(i,k),p(i,k),t(i,k),den(i,k),qs(i,k))
649 work1(i,k) = diffac(xls,p(i,k),t(i,k),den(i,k),qs(i,k))
651 work2(i,k) = venfac(p(i,k),t(i,k),den(i,k))
657 supsat = max(q(i,k),qmin)-qs(i,k)
659 if(t(i,k).ge.t0c) then
661 !===============================================================
663 ! warm rain processes
665 ! - follows the processes in RH83 and LFO except for autoconcersion
667 !===============================================================
668 !---------------------------------------------------------------
669 ! praut: auto conversion rate from cloud to rain [HDC 16]
671 !---------------------------------------------------------------
672 if(qci(i,k).gt.qc0) then
673 ! paut(i,k) = qck1*qci(i,k)**(7./3.)
674 paut(i,k) = qck1*exp(log(qci(i,k))*((7./3.)))
675 paut(i,k) = min(paut(i,k),qci(i,k)/dtcld)
677 !---------------------------------------------------------------
678 ! pracw: accretion of cloud water by rain [HL A40] [D89 B15]
680 !---------------------------------------------------------------
681 if(qrs(i,k).gt.qcrmin.and.qci(i,k).gt.qmin) then
682 pacr(i,k) = min(pacrr*rslope3(i,k)*rslopeb(i,k) &
683 *qci(i,k)*denfac(i,k),qci(i,k)/dtcld)
685 !---------------------------------------------------------------
686 ! prevp: evaporation/condensation rate of rain [HDC 14]
688 !---------------------------------------------------------------
689 if(qrs(i,k).gt.0.) then
690 coeres = rslope2(i,k)*sqrt(rslope(i,k)*rslopeb(i,k))
691 pres(i,k) = (rh(i,k)-1.)*(precr1*rslope2(i,k) &
692 +precr2*work2(i,k)*coeres)/work1(i,k)
693 if(pres(i,k).lt.0.) then
694 pres(i,k) = max(pres(i,k),-qrs(i,k)/dtcld)
695 pres(i,k) = max(pres(i,k),satdt/2)
697 pres(i,k) = min(pres(i,k),satdt/2)
702 !===============================================================
704 ! cold rain processes
706 ! - follows the revised ice microphysics processes in HDC
707 ! - the processes same as in RH83 and LFO behave
708 ! following ice crystal hapits defined in HDC, inclduing
709 ! intercept parameter for snow (n0s), ice crystal number
710 ! concentration (ni), ice nuclei number concentration
711 ! (n0i), ice diameter (d)
713 !===============================================================
717 !-------------------------------------------------------------
718 ! Ni: ice crystal number concentraiton [HDC 5c]
719 !-------------------------------------------------------------
720 ! xni(i,k) = min(max(5.38e7*(den(i,k) &
721 ! *max(qci(i,k),qmin))**0.75,1.e3),1.e6)
722 xni(i,k) = min(max(5.38e7*exp(log((den(i,k)*max(qci(i,k),qmin)))*(0.75)),1.e3),1.e6)
723 eacrs = exp(0.07*(-supcol))
725 if(qrs(i,k).gt.qcrmin.and.qci(i,k).gt.qmin) then
726 xmi = den(i,k)*qci(i,k)/xni(i,k)
727 diameter = min(dicon * sqrt(xmi),dimax)
728 vt2i = 1.49e4*diameter**1.31
729 vt2s = pvts*rslopeb(i,k)*denfac(i,k)
730 !-------------------------------------------------------------
731 ! praci: Accretion of cloud ice by rain [HL A15] [LFO 25]
733 !-------------------------------------------------------------
734 acrfac = 2.*rslope3(i,k)+2.*diameter*rslope2(i,k) &
735 +diameter**2*rslope(i,k)
736 pacr(i,k) = min(pi*qci(i,k)*eacrs*n0s*n0sfac(i,k) &
737 *abs(vt2s-vt2i)*acrfac/4.,qci(i,k)/dtcld)
739 !-------------------------------------------------------------
740 ! pidep: Deposition/Sublimation rate of ice [HDC 9]
741 ! (T<T0: V->I or I->V)
742 !-------------------------------------------------------------
743 if(qci(i,k).gt.0.) then
744 xmi = den(i,k)*qci(i,k)/xni(i,k)
745 diameter = dicon * sqrt(xmi)
746 pisd(i,k) = 4.*diameter*xni(i,k)*(rh(i,k)-1.)/work1(i,k)
747 if(pisd(i,k).lt.0.) then
748 pisd(i,k) = max(pisd(i,k),satdt/2)
749 pisd(i,k) = max(pisd(i,k),-qci(i,k)/dtcld)
751 pisd(i,k) = min(pisd(i,k),satdt/2)
753 if(abs(pisd(i,k)).ge.abs(satdt)) ifsat = 1
755 !-------------------------------------------------------------
756 ! psdep: deposition/sublimation rate of snow [HDC 14]
758 !-------------------------------------------------------------
759 if(qrs(i,k).gt.0..and.ifsat.ne.1) then
760 coeres = rslope2(i,k)*sqrt(rslope(i,k)*rslopeb(i,k))
761 pres(i,k) = (rh(i,k)-1.)*n0sfac(i,k)*(precs1*rslope2(i,k) &
762 +precs2*work2(i,k)*coeres)/work1(i,k)
763 supice = satdt-pisd(i,k)
764 if(pres(i,k).lt.0.) then
765 pres(i,k) = max(pres(i,k),-qrs(i,k)/dtcld)
766 pres(i,k) = max(max(pres(i,k),satdt/2),supice)
768 pres(i,k) = min(min(pres(i,k),satdt/2),supice)
770 if(abs(pisd(i,k)+pres(i,k)).ge.abs(satdt)) ifsat = 1
772 !-------------------------------------------------------------
773 ! pigen: generation(nucleation) of ice from vapor [HDC 7-8]
775 !-------------------------------------------------------------
776 if(supsat.gt.0.and.ifsat.ne.1) then
777 supice = satdt-pisd(i,k)-pres(i,k)
778 xni0 = 1.e3*exp(0.1*supcol)
779 ! roqi0 = 4.92e-11*xni0**1.33
780 roqi0 = 4.92e-11*exp(log(xni0)*(1.33))
781 pgen(i,k) = max(0.,(roqi0/den(i,k)-max(qci(i,k),0.))/dtcld)
782 pgen(i,k) = min(min(pgen(i,k),satdt),supice)
784 !-------------------------------------------------------------
785 ! psaut: conversion(aggregation) of ice to snow [HDC 12]
787 !-------------------------------------------------------------
788 if(qci(i,k).gt.0.) then
789 qimax = roqimax/den(i,k)
790 paut(i,k) = max(0.,(qci(i,k)-qimax)/dtcld)
796 !----------------------------------------------------------------
797 ! check mass conservation of generation terms and feedback to the
802 qciik = max(qmin,qci(i,k))
803 delqci = (paut(i,k)+pacr(i,k)-pgen(i,k)-pisd(i,k))*dtcld
804 if(delqci.ge.qciik) then
805 facqci = qciik/delqci
806 paut(i,k) = paut(i,k)*facqci
807 pacr(i,k) = pacr(i,k)*facqci
808 pgen(i,k) = pgen(i,k)*facqci
809 pisd(i,k) = pisd(i,k)*facqci
811 qik = max(qmin,q(i,k))
812 delq = (pres(i,k)+pgen(i,k)+pisd(i,k))*dtcld
815 pres(i,k) = pres(i,k)*facq
816 pgen(i,k) = pgen(i,k)*facq
817 pisd(i,k) = pisd(i,k)*facq
819 work2(i,k) = -pres(i,k)-pgen(i,k)-pisd(i,k)
820 q(i,k) = q(i,k)+work2(i,k)*dtcld
821 qci(i,k) = max(qci(i,k)-(paut(i,k)+pacr(i,k)-pgen(i,k) &
822 -pisd(i,k))*dtcld,0.)
823 qrs(i,k) = max(qrs(i,k)+(paut(i,k)+pacr(i,k) &
824 +pres(i,k))*dtcld,0.)
825 if(t(i,k).lt.t0c) then
826 t(i,k) = t(i,k)-xls*work2(i,k)/cpm(i,k)*dtcld
828 t(i,k) = t(i,k)-xl(i,k)*work2(i,k)/cpm(i,k)*dtcld
842 xbi=xai+hsub/(rv*ttp)
846 ! qs(i,k)=psat*(tr**xa)*exp(xb*(1.-tr))
847 qs(i,k)=psat*(exp(log(tr)*(xa)))*exp(xb*(1.-tr))
848 qs(i,k) = ep2 * qs(i,k) / (p(i,k) - qs(i,k))
849 qs(i,k) = max(qs(i,k),qmin)
850 denfac(i,k) = sqrt(den0/den(i,k))
854 !----------------------------------------------------------------
855 ! pcond: condensational/evaporational rate of cloud water [HL A46] [RH83 A6]
856 ! if there exists additional water vapor condensated/if
857 ! evaporation of cloud water is not enough to remove subsaturation
861 work1(i,k) = conden(t(i,k),q(i,k),qs(i,k),xl(i,k),cpm(i,k))
862 work2(i,k) = qci(i,k)+work1(i,k)
863 pcon(i,k) = min(max(work1(i,k),0.),max(q(i,k),0.))/dtcld
864 if(qci(i,k).gt.0..and.work1(i,k).lt.0.and.t(i,k).gt.t0c) &
865 pcon(i,k) = max(work1(i,k),-qci(i,k))/dtcld
866 q(i,k) = q(i,k)-pcon(i,k)*dtcld
867 qci(i,k) = max(qci(i,k)+pcon(i,k)*dtcld,0.)
868 t(i,k) = t(i,k)+pcon(i,k)*xl(i,k)/cpm(i,k)*dtcld
872 !----------------------------------------------------------------
873 ! padding for small values
877 if(qci(i,k).le.qmin) qci(i,k) = 0.0
882 END SUBROUTINE wsm32D
883 ! ...................................................................
884 REAL FUNCTION rgmma(x)
885 !-------------------------------------------------------------------
887 !-------------------------------------------------------------------
888 ! rgmma function: use infinite product form
890 PARAMETER (euler=0.577215664901532)
899 rgmma=rgmma*(1.000+x/y)*exp(-x/y)
905 !--------------------------------------------------------------------------
906 REAL FUNCTION fpvs(t,ice,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c)
907 !--------------------------------------------------------------------------
909 !--------------------------------------------------------------------------
910 REAL t,rd,rv,cvap,cliq,cice,hvap,hsub,psat,t0c,dldt,xa,xb,dldti, &
913 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
920 xbi=xai+hsub/(rv*ttp)
922 if(t.lt.ttp.and.ice.eq.1) then
923 fpvs=psat*(tr**xai)*exp(xbi*(1.-tr))
925 fpvs=psat*(tr**xa)*exp(xb*(1.-tr))
927 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
929 !-------------------------------------------------------------------
930 SUBROUTINE wsm3init(den0,denr,dens,cl,cpv,allowed_to_read)
931 !-------------------------------------------------------------------
933 !-------------------------------------------------------------------
934 !.... constants which may not be tunable
935 REAL, INTENT(IN) :: den0,denr,dens,cl,cpv
936 LOGICAL, INTENT(IN) :: allowed_to_read
942 qc0 = 4./3.*pi*denr*r0**3*xncr/den0 ! 0.419e-3 -- .61e-3
943 qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03
951 g4pbr = rgmma(bvtr4) ! 17.837825
952 g5pbro2 = rgmma(bvtr2) ! 1.8273
955 pacrr = pi*n0r*avtr*g3pbr*.25*eacrr
956 precr1 = 2.*pi*n0r*.78
957 precr2 = 2.*pi*n0r*.31*avtr**.5*g5pbro2
959 xmmax = (dimax/dicon)**2
960 roqimax = 2.08e22*dimax**8
966 g1pbs = rgmma(bvts1) !.8875
968 g4pbs = rgmma(bvts4) ! 12.0786
969 g5pbso2 = rgmma(bvts2)
971 pacrs = pi*n0s*avts*g3pbs*.25
973 precs2 = 4.*n0s*.44*avts**.5*g5pbso2
977 rslopermax = 1./lamdarmax
978 rslopesmax = 1./lamdasmax
979 rsloperbmax = rslopermax ** bvtr
980 rslopesbmax = rslopesmax ** bvts
981 rsloper2max = rslopermax * rslopermax
982 rslopes2max = rslopesmax * rslopesmax
983 rsloper3max = rsloper2max * rslopermax
984 rslopes3max = rslopes2max * rslopesmax
986 END SUBROUTINE wsm3init
987 END MODULE module_mp_wsm3