16 subroutine mfpbltq(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,wush,tkemean,vez0fun,xmf,
19 & tcko,qcko,ucko,vcko,xlamueq,a1)
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),
39 & gdx(im), hpbl(im), vpert(im),
40 & buo(im,km), wush(im,km),
41 & tkemean(im),vez0fun(im),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,
53 & factor, gocp, cmxfac,
56 & alp, vpertmax,a1, pgcon,
57 & qmin, qlmin, xmmx, rbint,
61 real(kind=kind_phys) elocp, el2orc, qs, es,
65 real(kind=kind_phys) rbdn(im), rbup(im), hpblx(im),
66 & xlamue(im,km-1), xlamuem(im,km-1)
67 real(kind=kind_phys) delz(im), xlamax(im), ce0t(im)
69 real(kind=kind_phys) wu2(im,km), thlu(im,km),
70 & qtx(im,km), qtu(im,km)
72 real(kind=kind_phys) xlamavg(im), sigma(im),
73 & scaldfunc(im), sumx(im)
75 logical totflg, flg(im)
80 parameter(elocp=hvap/cp,el2orc=hvap*hvap/(rv*cp))
81 parameter(ce0=0.4,cm=1.0,cq=1.0,tkcrt=2.,cmxfac=5.)
82 parameter(qmin=1.e-8,qlmin=1.e-12)
83 parameter(alp=1.5,vpertmax=3.0,pgcon=0.55)
84 parameter(b1=0.5,f1=0.15)
90 totflg = totflg .and. (.not. cnvflg(i))
102 qtx(i,k) = q1(i,k,1) + q1(i,k,ntcw)
111 ptem = alp * vpert(i)
112 ptem = min(ptem, vpertmax)
113 thlu(i,1)= thlx(i,1) + ptem
115 buo(i,1) = g * ptem / thvx(i,1)
125 ce0t(i) = ce0 * vez0fun(i)
126 if(tkemean(i) > tkcrt)
then
127 tem = sqrt(tkemean(i)/tkcrt)
128 tem1 = min(tem, cmxfac)
130 ce0t(i) = max(ce0t(i), tem2)
139 delz(i) = zl(i,k+1) - zl(i,k)
140 xlamax(i) = ce0t(i) / delz(i)
148 ptem = 1./(zm(i,k)+delz(i))
149 tem = max((hpbl(i)-zm(i,k)+delz(i)) ,delz(i))
151 xlamue(i,k) = ce0t(i) * (ptem+ptem1)
153 xlamue(i,k) = xlamax(i)
156 xlamueq(i,k) = cq * xlamue(i,k)
157 xlamuem(i,k) = cm * xlamue(i,k)
167 dz = zl(i,k) - zl(i,k-1)
168 tem = 0.5 * xlamue(i,k-1) * dz
171 thlu(i,k) = ((1.-tem)*thlu(i,k-1)+tem*
172 & (thlx(i,k-1)+thlx(i,k)))/factor
174 tem = 0.5 * xlamueq(i,k-1) * dz
176 qtu(i,k) = ((1.-tem)*qtu(i,k-1)+tem*
177 & (qtx(i,k-1)+qtx(i,k)))/factor
179 tlu = thlu(i,k) / pix(i,k)
180 es = 0.01 * fpvs(tlu)
181 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
185 gamma = el2orc * qs / (tlu**2)
186 qlu = dq / (1. + gamma)
188 tem1 = 1. + fv * qs - qlu
189 thup = thlu(i,k) + pix(i,k) * elocp * qlu
192 tem1 = 1. + fv * qtu(i,k)
193 thvu = thlu(i,k) * tem1
195 buo(i,k) = g * (thvu / thvx(i,k) - 1.)
222 tem = 0.5*bb1*xlamue(i,1)*dz
223 tem1 = bb2 * buo(i,1) * dz
225 wu2(i,1) = tem1 / ptem1
231 dz = zm(i,k) - zm(i,k-1)
232 tem = 0.25*bb1*(xlamue(i,k-1)+xlamue(i,k))*dz
233 tem1 = max(wu2(i,k-1), 0.)
234 tem1 = bb2 * buo(i,k) - wush(i,k) * sqrt(tem1)
236 ptem = (1. - tem) * wu2(i,k-1)
238 wu2(i,k) = (ptem + tem2) / ptem1
260 flg(i) = rbup(i).le.0.
267 if(rbdn(i) <= 0.)
then
269 elseif(rbup(i) >= 0.)
then
272 rbint = rbdn(i)/(rbdn(i)-rbup(i))
274 hpblx(i) = zm(i,k-1) + rbint*(zm(i,k)-zm(i,k-1))
280 if(kpblx(i) < kpbl(i))
then
284 if(kpbl(i) <= 1) cnvflg(i)=.false.
294 delz(i) = zl(i,k+1) - zl(i,k)
295 xlamax(i) = ce0t(i) / delz(i)
301 if(cnvflg(i) .and. kpblx(i) < kpbly(i))
then
304 ptem = 1./(zm(i,k)+delz(i))
305 tem = max((hpbl(i)-zm(i,k)+delz(i)) ,delz(i))
307 xlamue(i,k) = ce0t(i) * (ptem+ptem1)
309 xlamue(i,k) = xlamax(i)
312 xlamueq(i,k) = cq * xlamue(i,k)
313 xlamuem(i,k) = cm * xlamue(i,k)
326 if (cnvflg(i) .and. k < kpbl(i))
then
327 dz = zl(i,k+1) - zl(i,k)
328 xlamavg(i) = xlamavg(i) + xlamue(i,k) * dz
329 sumx(i) = sumx(i) + dz
335 xlamavg(i) = xlamavg(i) / sumx(i)
343 if (cnvflg(i) .and. k < kpbl(i))
then
344 xmf(i,k) = a1 * sqrt(wu2(i,k))
354 tem = 0.2 / xlamavg(i)
355 tem1 = 3.14 * tem * tem
356 sigma(i) = tem1 / (gdx(i) * gdx(i))
357 sigma(i) = max(sigma(i), 0.001)
358 sigma(i) = min(sigma(i), 0.999)
367 if (sigma(i) > a1)
then
368 scaldfunc(i) = (1.-sigma(i)) * (1.-sigma(i))
369 scaldfunc(i) = max(min(scaldfunc(i), 1.0), 0.)
380 if (cnvflg(i) .and. k < kpbl(i))
then
381 xmf(i,k) = scaldfunc(i) * xmf(i,k)
382 dz = zl(i,k+1) - zl(i,k)
384 xmf(i,k) = min(xmf(i,k),xmmx)
408 if(cnvflg(i) .and. k <= kpbl(i))
then
409 dz = zl(i,k) - zl(i,k-1)
410 tem = 0.5 * xlamue(i,k-1) * dz
413 thlu(i,k) = ((1.-tem)*thlu(i,k-1)+tem*
414 & (thlx(i,k-1)+thlx(i,k)))/factor
416 tem = 0.5 * xlamueq(i,k-1) * dz
418 qtu(i,k) = ((1.-tem)*qtu(i,k-1)+tem*
419 & (qtx(i,k-1)+qtx(i,k)))/factor
421 tlu = thlu(i,k) / pix(i,k)
422 es = 0.01 * fpvs(tlu)
423 qs = max(qmin, eps * es / (plyr(i,k)+epsm1*es))
427 gamma = el2orc * qs / (tlu**2)
428 qlu = dq / (1. + gamma)
432 tcko(i,k) = tlu + elocp * qlu
434 qcko(i,k,1) = qtu(i,k)
445 if (cnvflg(i) .and. k <= kpbl(i))
then
446 dz = zl(i,k) - zl(i,k-1)
447 tem = 0.5 * xlamuem(i,k-1) * dz
451 ucko(i,k) = ((1.-tem)*ucko(i,k-1)+ptem*u1(i,k)
452 & +ptem1*u1(i,k-1))/factor
453 vcko(i,k) = ((1.-tem)*vcko(i,k-1)+ptem*v1(i,k)
454 & +ptem1*v1(i,k-1))/factor
464 if (cnvflg(i) .and. k <= kpbl(i))
then
465 dz = zl(i,k) - zl(i,k-1)
466 tem = 0.5 * xlamueq(i,k-1) * dz
469 qcko(i,k,n) = ((1.-tem)*qcko(i,k-1,n)+tem*
470 & (q1(i,k,n)+q1(i,k-1,n)))/factor
482 do n = ntcw+1, ntrac1
485 if (cnvflg(i) .and. k <= kpbl(i))
then
486 dz = zl(i,k) - zl(i,k-1)
487 tem = 0.5 * xlamueq(i,k-1) * dz
490 qcko(i,k,n) = ((1.-tem)*qcko(i,k-1,n)+tem*
491 & (q1(i,k,n)+q1(i,k-1,n)))/factor