48 subroutine mfpbl(im,ix,km,ntrac,delt,cnvflg, &
49 & zl,zm,thvx,q1,t1,u1,v1,hpbl,kpbl, &
50 & sflx,ustar,wstar,xmf,tcko,qcko,ucko,vcko)
52 use machine ,
only : kind_phys
53 use physcons, grav => con_g, cp => con_cp
57 integer im, ix, km, ntrac
61 real(kind=kind_phys) delt
62 real(kind=kind_phys) q1(ix,km,ntrac), t1(ix,km), &
63 & u1(ix,km), v1(ix,km), &
65 & zl(im,km), zm(im,km+1), &
66 & hpbl(im),
sflx(im), ustar(im), &
67 & wstar(im), xmf(im,km), &
68 & tcko(im,km),qcko(im,km,ntrac), &
69 & ucko(im,km),vcko(im,km)
71c local variables and arrays
73 integer i, j, k, n, kmpbl
75 real(kind=kind_phys) dt2, dz, ce0,
79 & alp, a1, qmin, zfmin,
86 real(kind=kind_phys) sigw1(im), usws3(im), xlamax(im),
87 & rbdn(im), rbup(im), delz(im)
89 real(kind=kind_phys) wu2(im,km), xlamue(im,km),
90 & thvu(im,km), zi(im,km),
93 logical totflg, flg(im)
99 parameter(ce0=0.38,qmin=1.e-8,alp=1.0,pgcon=0.55)
100 parameter(a1=0.08,b1=0.5,f1=0.15,c1=0.3,d1=2.58,tau=500.)
101 parameter(zfmin=1.e-8,h1=0.33333333)
103c-----------------------------------------------------------------------
112 totflg = totflg .and. (.not. cnvflg(i))
129 delz(i) = zl(i,k+1) - zl(i,k)
130 xlamax(i) = ce0 / delz(i)
137 ptem = 1./(zi(i,k)+delz(i))
138 tem = max((hpbl(i)-zi(i,k)+delz(i)) ,delz(i))
140 xlamue(i,k) = ce0 * (ptem+ptem1)
142 xlamue(i,k) = xlamax(i)
148c compute thermal excess
153 tem = zl(i,1)/hpbl(i)
154 usws3(i) = (ustar(i)/wstar(i))**3.
155 tem1 = usws3(i) + 0.6*tem
156 tem2 = max((1.-tem), zfmin)
157 ptem = (tem1**h1) * sqrt(tem2)
158 sigw1(i) = 1.3 * ptem * wstar(i)
159 ptem1 = alp *
sflx(i) / sigw1(i)
160 thvu(i,1) = thvx(i,1) + ptem1
161 buo(i,1) = g * (thvu(i,1)/thvx(i,1)-1.)
165c compute potential temperature and buoyancy for updraft air parcel
175 dz = zl(i,k) - zl(i,k-1)
176 tem = xlamue(i,k-1) * dz
178 ptem1 = (2. - tem) / ptem
179 tem1 = tem * (thvx(i,k)+thvx(i,k-1)) / ptem
180 thvu(i,k) = ptem1 * thvu(i,k-1) + tem1
181 buo(i,k) = g * (thvu(i,k)/thvx(i,k)-1.)
186c compute updraft velocity square(wu2)
219 tem = 0.5*bb1*xlamue(i,1)*dz
220 tem1 = bb2 * buo(i,1) * dz
222 wu2(i,1) = tem1 / ptem1
229 dz = zi(i,k) - zi(i,k-1)
230 tem = 0.25*bb1*(xlamue(i,k)+xlamue(i,k-1))*dz
231 tem1 = bb2 * buo(i,k) * dz
232 ptem = (1. - tem) * wu2(i,k-1)
234 wu2(i,k) = (ptem + tem1) / ptem1
239c update pbl height as the height
where updraft velocity vanishes
256 flg(i) = rbup(i).le.0.
263 if(rbdn(i) <= 0.)
then
265 elseif(rbup(i) >= 0.)
then
268 rbint = rbdn(i)/(rbdn(i)-rbup(i))
270 hpbl(i) = zi(i,k-1) + rbint*(zi(i,k)-zi(i,k-1))
279 delz(i) = zl(i,k+1) - zl(i,k)
280 xlamax(i) = ce0 / delz(i)
284c update entrainment rate
305 ptem = 1./(zi(i,k)+delz(i))
306 tem = max((hpbl(i)-zi(i,k)+delz(i)) ,delz(i))
308 xlamue(i,k) = ce0 * (ptem+ptem1)
310 xlamue(i,k) = xlamax(i)
316c updraft mass flux as a
function of sigmaw
317c(0.3*sigmaw[square root of vertical turbulence variance])
333c updraft mass flux as a
function of updraft velocity profile
342 if (cnvflg(i) .and. k < kpbl(i))
then
343 xmf(i,k) = a1 * sqrt(wu2(i,k))
344 dz = zl(i,k+1) - zl(i,k)
346 xmf(i,k) = min(xmf(i,k),xmmx)
352c compute updraft property
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
376 tcko(i,k) = ((1.-tem)*tcko(i,k-1)+tem*
377 & (t1(i,k)+t1(i,k-1))-gocp*dz)/factor
378 ucko(i,k) = ((1.-tem)*ucko(i,k-1)+ptem*u1(i,k)
379 & +ptem1*u1(i,k-1))/factor
380 vcko(i,k) = ((1.-tem)*vcko(i,k-1)+ptem*v1(i,k)
381 & +ptem1*v1(i,k-1))/factor
388 if (cnvflg(i) .and. k <= kpbl(i))
then
389 dz = zl(i,k) - zl(i,k-1)
390 tem = 0.5 * xlamue(i,k-1) * dz
393 qcko(i,k,n) = ((1.-tem)*qcko(i,k-1,n)+tem*
394 & (q1(i,k,n)+q1(i,k-1,n)))/factor