14 subroutine mfscuq(im,ix,km,kmscu,ntcw,ntrac1,delt,
15 & cnvflg,zl,zm,q1,t1,u1,v1,plyr,pix,
16 & thlx,thvx,thlvx,gdx,thetae,
17 & krad,mrad,radmin,buo,wush,tkemean,vez0fun,xmfd,
18 & tcdo,qcdo,ucdo,vcdo,xlamdeq,a1)
20 use machine ,
only : kind_phys
21 use funcphys ,
only : fpvs
22 use physcons, grav => con_g, cp => con_cp
23 &, rv => con_rv, hvap => con_hvap
25 &, eps => con_eps, epsm1 => con_epsm1
29 integer im, ix, km, kmscu, ntcw, ntrac1
31 integer krad(im), mrad(im)
34 real(kind=kind_phys) delt
35 real(kind=kind_phys) q1(ix,km,ntrac1),t1(ix,km),
36 & u1(ix,km), v1(ix,km),
37 & plyr(im,km), pix(im,km),
39 & thvx(im,km), thlvx(im,km),
41 & zl(im,km), zm(im,km),
42 & thetae(im,km), radmin(im),
43 & buo(im,km), wush(im,km),
44 & tkemean(im),vez0fun(im),xmfd(im,km),
45 & tcdo(im,km),qcdo(im,km,ntrac1),
46 & ucdo(im,km),vcdo(im,km),
52 integer i,j,indx, k, n, kk, ndc
55 real(kind=kind_phys) dt2, dz, ce0,
58 & gocp, factor, g, tau,
63 & xmmx, tem, tem1, tem2,
66 real(kind=kind_phys) elocp, el2orc, qs, es,
67 & tld, gamma, qld, thdn,
70 real(kind=kind_phys) wd2(im,km), thld(im,km),
71 & qtx(im,km), qtd(im,km),
72 & thlvd(im), hrad(im), xlamde(im,km-1),
73 & xlamdem(im,km-1), ra1(im)
74 real(kind=kind_phys) delz(im), xlamax(im), ce0t(im)
76 real(kind=kind_phys) xlamavg(im), sigma(im),
77 & scaldfunc(im), sumx(im)
79 logical totflg, flg(im)
81 real(kind=kind_phys) actei, cldtime
86 parameter(elocp=hvap/cp,el2orc=hvap*hvap/(rv*cp))
87 parameter(ce0=0.4,cm=1.0,cq=1.0,pgcon=0.55)
88 parameter(tkcrt=2.,cmxfac=5.)
89 parameter(qmin=1.e-8,qlmin=1.e-12)
90 parameter(b1=0.45,f1=0.15)
92 parameter(cldtime=500.)
93 parameter(actei = 0.7)
100 totflg = totflg .and. (.not. cnvflg(i))
111 qtx(i,k) = q1(i,k,1) + q1(i,k,ntcw)
118 hrad(i) = zm(i,krad(i))
126 tem = zm(i,k+1)-zm(i,k)
127 tem1 = cldtime*radmin(i)/tem
128 tem1 = max(tem1, -3.0)
129 thld(i,k)= thlx(i,k) + tem1
131 thlvd(i) = thlvx(i,k) + tem1
132 buo(i,k) = - g * tem1 / thvx(i,k)
150 tem = thetae(i,k) - thetae(i,k+1)
151 tem1 = qtx(i,k) - qtx(i,k+1)
152 if (tem > 0. .and. tem1 > 0.)
then
153 cteit= cp*tem/(hvap*tem1)
154 if(cteit > actei)
then
169 if(flg(i) .and. k < krad(i))
then
170 if(thlvd(i) <= thlvx(i,k))
then
181 if(kk < 1) cnvflg(i)=.false.
187 totflg = totflg .and. (.not. cnvflg(i))
198 ce0t(i) = ce0 * vez0fun(i)
199 if(tkemean(i) > tkcrt)
then
200 tem = sqrt(tkemean(i)/tkcrt)
201 tem1 = min(tem, cmxfac)
203 ce0t(i) = max(ce0t(i), tem2)
210 k = mrad(i) + (krad(i)-mrad(i)) / 2
212 delz(i) = zl(i,k+1) - zl(i,k)
213 xlamax(i) = ce0t(i) / delz(i)
220 if(k >= mrad(i) .and. k < krad(i))
then
221 if(mrad(i) == 1)
then
222 ptem = 1./(zm(i,k)+delz(i))
224 ptem = 1./(zm(i,k)-zm(i,mrad(i)-1)+delz(i))
226 tem = max((hrad(i)-zm(i,k)+delz(i)) ,delz(i))
228 xlamde(i,k) = ce0t(i) * (ptem+ptem1)
230 xlamde(i,k) = xlamax(i)
233 xlamdeq(i,k) = cq * xlamde(i,k)
234 xlamdem(i,k) = cm * xlamde(i,k)
243 if(cnvflg(i) .and. k < krad(i))
then
244 dz = zl(i,k+1) - zl(i,k)
245 tem = 0.5 * xlamde(i,k) * dz
248 thld(i,k) = ((1.-tem)*thld(i,k+1)+tem*
249 & (thlx(i,k)+thlx(i,k+1)))/factor
251 tem = 0.5 * xlamdeq(i,k) * dz
253 qtd(i,k) = ((1.-tem)*qtd(i,k+1)+tem*
254 & (qtx(i,k)+qtx(i,k+1)))/factor
256 tld = thld(i,k) / pix(i,k)
257 es = 0.01 * fpvs(tld)
258 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
262 gamma = el2orc * qs / (tld**2)
263 qld = dq / (1. + gamma)
265 tem1 = 1. + fv * qs - qld
266 thdn = thld(i,k) + pix(i,k) * elocp * qld
269 tem1 = 1. + fv * qtd(i,k)
270 thvd = thld(i,k) * tem1
272 buo(i,k) = g * (1. - thvd / thvx(i,k))
298 dz = zm(i,k+1) - zm(i,k)
300 tem = 0.5*bb1*xlamde(i,k)*dz
301 tem1 = bb2 * buo(i,k+1) * dz
303 wd2(i,k) = tem1 / ptem1
308 if(cnvflg(i) .and. k < krad1(i))
then
309 dz = zm(i,k+1) - zm(i,k)
310 tem = 0.25*bb1*(xlamde(i,k)+xlamde(i,k+1))*dz
311 tem1 = max(wd2(i,k+1), 0.)
312 tem1 = bb2*buo(i,k+1) - wush(i,k+1)*sqrt(tem1)
314 ptem = (1. - tem) * wd2(i,k+1)
316 wd2(i,k) = (ptem + tem2) / ptem1
323 if(flg(i)) mrad(i) = krad(i)
327 if(flg(i) .and. k < krad(i))
then
328 if(wd2(i,k) > 0.)
then
340 if(kk < 1) cnvflg(i)=.false.
346 totflg = totflg .and. (.not. cnvflg(i))
355 k = mrad(i) + (krad(i)-mrad(i)) / 2
357 delz(i) = zl(i,k+1) - zl(i,k)
358 xlamax(i) = ce0t(i) / delz(i)
365 if(k >= mrad(i) .and. k < krad(i))
then
366 if(mrad(i) == 1)
then
367 ptem = 1./(zm(i,k)+delz(i))
369 ptem = 1./(zm(i,k)-zm(i,mrad(i)-1)+delz(i))
371 tem = max((hrad(i)-zm(i,k)+delz(i)) ,delz(i))
373 xlamde(i,k) = ce0t(i) * (ptem+ptem1)
375 xlamde(i,k) = xlamax(i)
378 xlamdeq(i,k) = cq * xlamde(i,k)
379 xlamdem(i,k) = cm * xlamde(i,k)
393 & (k >= mrad(i) .and. k < krad(i)))
then
394 dz = zl(i,k+1) - zl(i,k)
395 xlamavg(i) = xlamavg(i) + xlamde(i,k) * dz
396 sumx(i) = sumx(i) + dz
402 xlamavg(i) = xlamavg(i) / sumx(i)
411 & (k >= mrad(i) .and. k < krad(i)))
then
412 xmfd(i,k) = ra1(i) * sqrt(wd2(i,k))
422 tem = 0.2 / xlamavg(i)
423 tem1 = 3.14 * tem * tem
424 sigma(i) = tem1 / (gdx(i) * gdx(i))
425 sigma(i) = max(sigma(i), 0.001)
426 sigma(i) = min(sigma(i), 0.999)
435 if (sigma(i) > ra1(i))
then
436 scaldfunc(i) = (1.-sigma(i)) * (1.-sigma(i))
437 scaldfunc(i) = max(min(scaldfunc(i), 1.0), 0.)
449 & (k >= mrad(i) .and. k < krad(i)))
then
450 xmfd(i,k) = scaldfunc(i) * xmfd(i,k)
451 dz = zl(i,k+1) - zl(i,k)
453 xmfd(i,k) = min(xmfd(i,k),xmmx)
482 & (k >= mrad(i) .and. k < krad(i)))
then
483 dz = zl(i,k+1) - zl(i,k)
484 tem = 0.5 * xlamde(i,k) * dz
487 thld(i,k) = ((1.-tem)*thld(i,k+1)+tem*
488 & (thlx(i,k)+thlx(i,k+1)))/factor
490 tem = 0.5 * xlamdeq(i,k) * dz
492 qtd(i,k) = ((1.-tem)*qtd(i,k+1)+tem*
493 & (qtx(i,k)+qtx(i,k+1)))/factor
495 tld = thld(i,k) / pix(i,k)
496 es = 0.01 * fpvs(tld)
497 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
501 gamma = el2orc * qs / (tld**2)
502 qld = dq / (1. + gamma)
506 tcdo(i,k) = tld + elocp * qld
508 qcdo(i,k,1) = qtd(i,k)
519 if (cnvflg(i) .and. k < krad(i))
then
520 if(k >= mrad(i))
then
521 dz = zl(i,k+1) - zl(i,k)
522 tem = 0.5 * xlamdem(i,k) * dz
527 ucdo(i,k) = ((1.-tem)*ucdo(i,k+1)+ptem*u1(i,k+1)
528 & +ptem1*u1(i,k))/factor
529 vcdo(i,k) = ((1.-tem)*vcdo(i,k+1)+ptem*v1(i,k+1)
530 & +ptem1*v1(i,k))/factor
541 if (cnvflg(i) .and. k < krad(i))
then
542 if(k >= mrad(i))
then
543 dz = zl(i,k+1) - zl(i,k)
544 tem = 0.5 * xlamdeq(i,k) * dz
547 qcdo(i,k,n) = ((1.-tem)*qcdo(i,k+1,n)+tem*
548 & (q1(i,k,n)+q1(i,k+1,n)))/factor
561 do n = ntcw+1, ntrac1
564 if (cnvflg(i) .and. k < krad(i))
then
565 if(k >= mrad(i))
then
566 dz = zl(i,k+1) - zl(i,k)
567 tem = 0.5 * xlamdeq(i,k) * dz
570 qcdo(i,k,n) = ((1.-tem)*qcdo(i,k+1,n)+tem*
571 & (q1(i,k,n)+q1(i,k+1,n)))/factor