16 subroutine mfpblt(im,ix,km,kmpbl,ntcw,ntrac1,delt, &
17 & cnvflg,zl,zm,q1,t1,u1,v1,plyr,pix,thlx,thvx, &
18 & gdx,hpbl,kpbl,vpert,buo,xmf, &
19 & tcko,qcko,ucko,vcko,xlamue)
21 use machine ,
only : kind_phys
22 use funcphys ,
only : fpvs
23 use physcons, grav => con_g, cp => con_cp &
24 &, rv => con_rv, hvap => con_hvap &
26 &, eps => con_eps, epsm1 => con_epsm1
30 integer im, ix, km, kmpbl, ntcw, ntrac1
34 real(kind=kind_phys) delt
35 real(kind=kind_phys) q1(ix,km,ntrac1), &
36 & t1(ix,km), u1(ix,km), v1(ix,km), &
37 & plyr(im,km),pix(im,km),thlx(im,km), &
38 & thvx(im,km),zl(im,km), zm(im,km), &
40 & hpbl(im), vpert(im), &
41 & buo(im,km), xmf(im,km), &
42 & tcko(im,km),qcko(im,km,ntrac1), &
43 & ucko(im,km),vcko(im,km), &
46c local variables and arrays
48 integer i, j, k, n, ndc
49 integer kpblx(im), kpbly(im)
51 real(kind=kind_phys) dt2, dz, ce0, cm,
56 & qmin, qlmin, xmmx, rbint,
60 real(kind=kind_phys) elocp, el2orc, qs, es,
64 real(kind=kind_phys) rbdn(im), rbup(im), hpblx(im),
67 real(kind=kind_phys) wu2(im,km), thlu(im,km),
68 & qtx(im,km), qtu(im,km)
70 real(kind=kind_phys) xlamavg(im), sigma(im),
71 & scaldfunc(im), sumx(im)
73 logical totflg, flg(im)
78 parameter(elocp=hvap/cp,el2orc=hvap*hvap/(rv*cp))
79 parameter(ce0=0.4,cm=1.0)
80 parameter(qmin=1.e-8,qlmin=1.e-12)
81 parameter(alp=1.0,pgcon=0.55)
82 parameter(a1=0.13,b1=0.5,f1=0.15)
88 totflg = totflg .and. (.not. cnvflg(i))
99 qtx(i,k) = q1(i,k,1) + q1(i,k,ntcw)
108 ptem = alp * vpert(i)
109 ptem = min(ptem, 3.0)
110 thlu(i,1)= thlx(i,1) + ptem
112 buo(i,1) = g * ptem / thvx(i,1)
121 dz = zl(i,k+1) - zl(i,k)
123 ptem = 1./(zm(i,k)+dz)
124 tem = max((hpbl(i)-zm(i,k)+dz) ,dz)
126 xlamue(i,k) = ce0 * (ptem+ptem1)
128 xlamue(i,k) = ce0 / dz
130 xlamuem(i,k) = cm * xlamue(i,k)
140 dz = zl(i,k) - zl(i,k-1)
141 tem = 0.5 * xlamue(i,k-1) * dz
144 thlu(i,k) = ((1.-tem)*thlu(i,k-1)+tem*
145 & (thlx(i,k-1)+thlx(i,k)))/factor
146 qtu(i,k) = ((1.-tem)*qtu(i,k-1)+tem*
147 & (qtx(i,k-1)+qtx(i,k)))/factor
149 tlu = thlu(i,k) / pix(i,k)
150 es = 0.01 * fpvs(tlu)
151 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
155 gamma = el2orc * qs / (tlu**2)
156 qlu = dq / (1. + gamma)
158 tem1 = 1. + fv * qs - qlu
159 thup = thlu(i,k) + pix(i,k) * elocp * qlu
162 tem1 = 1. + fv * qtu(i,k)
163 thvu = thlu(i,k) * tem1
165 buo(i,k) = g * (thvu / thvx(i,k) - 1.)
192 tem = 0.5*bb1*xlamue(i,1)*dz
193 tem1 = bb2 * buo(i,1) * dz
195 wu2(i,1) = tem1 / ptem1
201 dz = zm(i,k) - zm(i,k-1)
202 tem = 0.25*bb1*(xlamue(i,k)+xlamue(i,k-1))*dz
203 tem1 = bb2 * buo(i,k) * dz
204 ptem = (1. - tem) * wu2(i,k-1)
206 wu2(i,k) = (ptem + tem1) / ptem1
227 flg(i) = rbup(i).le.0.
234 if(rbdn(i) <= 0.)
then
236 elseif(rbup(i) >= 0.)
then
239 rbint = rbdn(i)/(rbdn(i)-rbup(i))
241 hpblx(i) = zm(i,k-1) + rbint*(zm(i,k)-zm(i,k-1))
247 if(kpbl(i) > kpblx(i))
then
258 if(cnvflg(i) .and. kpbly(i) > kpblx(i))
then
259 dz = zl(i,k+1) - zl(i,k)
261 ptem = 1./(zm(i,k)+dz)
262 tem = max((hpbl(i)-zm(i,k)+dz) ,dz)
264 xlamue(i,k) = ce0 * (ptem+ptem1)
266 xlamue(i,k) = ce0 / dz
268 xlamuem(i,k) = cm * xlamue(i,k)
281 if (cnvflg(i) .and. k < kpbl(i))
then
282 dz = zl(i,k+1) - zl(i,k)
283 xlamavg(i) = xlamavg(i) + xlamue(i,k) * dz
284 sumx(i) = sumx(i) + dz
290 xlamavg(i) = xlamavg(i) / sumx(i)
299 if (cnvflg(i) .and. k < kpbl(i))
then
300 if(wu2(i,k) > 0.)
then
315 tem = 0.2 / xlamavg(i)
316 tem1 = 3.14 * tem * tem
317 sigma(i) = tem1 / (gdx(i) * gdx(i))
318 sigma(i) = max(sigma(i), 0.001)
319 sigma(i) = min(sigma(i), 0.999)
328 if (sigma(i) > a1)
then
329 scaldfunc(i) = (1.-sigma(i)) * (1.-sigma(i))
330 scaldfunc(i) = max(min(scaldfunc(i), 1.0), 0.)
341 if (cnvflg(i) .and. k < kpbl(i))
then
342 xmf(i,k) = scaldfunc(i) * xmf(i,k)
343 dz = zl(i,k+1) - zl(i,k)
345 xmf(i,k) = min(xmf(i,k),xmmx)
369 if(cnvflg(i) .and. k <= kpbl(i))
then
370 dz = zl(i,k) - zl(i,k-1)
371 tem = 0.5 * xlamue(i,k-1) * dz
374 thlu(i,k) = ((1.-tem)*thlu(i,k-1)+tem*
375 & (thlx(i,k-1)+thlx(i,k)))/factor
376 qtu(i,k) = ((1.-tem)*qtu(i,k-1)+tem*
377 & (qtx(i,k-1)+qtx(i,k)))/factor
379 tlu = thlu(i,k) / pix(i,k)
380 es = 0.01 * fpvs(tlu)
381 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
385 gamma = el2orc * qs / (tlu**2)
386 qlu = dq / (1. + gamma)
390 tcko(i,k) = tlu + elocp * qlu
392 qcko(i,k,1) = qtu(i,k)
403 if (cnvflg(i) .and. k <= kpbl(i))
then
404 dz = zl(i,k) - zl(i,k-1)
405 tem = 0.5 * xlamuem(i,k-1) * dz
409 ucko(i,k) = ((1.-tem)*ucko(i,k-1)+ptem*u1(i,k)
410 & +ptem1*u1(i,k-1))/factor
411 vcko(i,k) = ((1.-tem)*vcko(i,k-1)+ptem*v1(i,k)
412 & +ptem1*v1(i,k-1))/factor
422 if (cnvflg(i) .and. k <= kpbl(i))
then
423 dz = zl(i,k) - zl(i,k-1)
424 tem = 0.5 * xlamue(i,k-1) * dz
427 qcko(i,k,n) = ((1.-tem)*qcko(i,k-1,n)+tem*
428 & (q1(i,k,n)+q1(i,k-1,n)))/factor
440 do n = ntcw+1, ntrac1
443 if (cnvflg(i) .and. k <= kpbl(i))
then
444 dz = zl(i,k) - zl(i,k-1)
445 tem = 0.5 * xlamue(i,k-1) * dz
448 qcko(i,k,n) = ((1.-tem)*qcko(i,k-1,n)+tem*
449 & (q1(i,k,n)+q1(i,k-1,n)))/factor