47 SUBROUTINE bndlyr(PBND,TBND,QBND,RHBND,UBND,VBND, &
48 wbnd,omgbnd,pwtbnd,qcnvbnd,lvlbnd)
52 use vrbls3d, only: pint, q, uh, vh, pmid, t, omga, wh, cwm
55 use ctlblk_mod
, only: jsta_2l, jend_2u, lm, jsta, jend, modelname, &
56 jsta_m, jend_m, im, nbnd, spval
58 use gridspec_mod
, only: gridtype
65 real,
PARAMETER :: dpbnd=30.e2
66 integer,
dimension(IM,jsta:jend,NBND),
intent(inout) :: lvlbnd
67 real,
dimension(IM,jsta:jend,NBND),
intent(inout) :: pbnd,tbnd, &
68 qbnd,rhbnd,ubnd,vbnd,wbnd,omgbnd,pwtbnd,qcnvbnd
70 REAL q1d(im,jsta_2l:jend_2u),v1d(im,jsta_2l:jend_2u), &
71 u1d(im,jsta_2l:jend_2u),qcnv1d(im,jsta_2l:jend_2u)
73 REAL,
ALLOCATABLE :: pbint(:,:,:),qsbnd(:,:,:)
74 REAL,
ALLOCATABLE :: psum(:,:,:), qcnvg(:,:,:)
75 REAL,
ALLOCATABLE :: pvsum(:,:,:),nsum(:,:,:)
77 integer i,j,l,ie,iw,ll,lv,lbnd
78 real dp,qsat,pv1,pv2,pmv,rpsum,rpvsum,pmin,pm,delp,pminv,delpv
84 ALLOCATE (pbint(im,jsta_2l:jend_2u,nbnd+1))
85 ALLOCATE (qsbnd(im,jsta_2l:jend_2u,nbnd))
86 ALLOCATE (psum(im,jsta_2l:jend_2u,nbnd))
87 ALLOCATE (qcnvg(im,jsta_2l:jend_2u,lm))
88 ALLOCATE (pvsum(im,jsta_2l:jend_2u,nbnd))
89 ALLOCATE (nsum(im,jsta_2l:jend_2u,nbnd))
97 pbint(i,j,1) = pint(i,j,nint(lmh(i,j))+1)
105 pbint(i,j,lbnd) = pbint(i,j,lbnd-1) - dpbnd
120 CALL calmcvg(q1d,u1d,v1d,qcnv1d)
124 qcnvg(i,j,l)=qcnv1d(i,j)
143 qsbnd(i,j,lbnd) = d00
144 rhbnd(i,j,lbnd) = d00
148 omgbnd(i,j,lbnd) = d00
152 pvsum(i,j,lbnd) = d00
153 pwtbnd(i,j,lbnd) = d00
154 qcnvbnd(i,j,lbnd)= d00
166 IF((pbint(i,j,lbnd) >= pm).AND. &
167 (pbint(i,j,lbnd+1) <= pm))
THEN
168 dp = pint(i,j,l+1) - pint(i,j,l)
169 psum(i,j,lbnd) = psum(i,j,lbnd) + dp
170 nsum(i,j,lbnd) = nsum(i,j,lbnd) + 1
171 lvlbnd(i,j,lbnd) = lvlbnd(i,j,lbnd) + l
172 tbnd(i,j,lbnd) = tbnd(i,j,lbnd) + t(i,j,l)*dp
173 qbnd(i,j,lbnd) = qbnd(i,j,lbnd) + q(i,j,l)*dp
174 omgbnd(i,j,lbnd) = omgbnd(i,j,lbnd) + omga(i,j,l)*dp
175 IF(gridtype ==
'A')
THEN
176 ubnd(i,j,lbnd) = ubnd(i,j,lbnd) + uh(i,j,l)*dp
177 vbnd(i,j,lbnd) = vbnd(i,j,lbnd) + vh(i,j,l)*dp
179 wbnd(i,j,lbnd) = wbnd(i,j,lbnd) + wh(i,j,l)*dp
180 qcnvbnd(i,j,lbnd) = qcnvbnd(i,j,lbnd) + qcnvg(i,j,l)*dp
181 pwtbnd(i,j,lbnd) = pwtbnd(i,j,lbnd) &
182 + ( q(i,j,l)+cwm(i,j,l))*dp*gi
183 IF(modelname ==
'GFS')
THEN
185 qsat = con_eps*es/(pm+con_epsm1*es)
187 qsat = pq0/pm*exp(a2*(t(i,j,l)-a3)/(t(i,j,l)-a4))
189 qsbnd(i,j,lbnd) = qsbnd(i,j,lbnd) + qsat*dp
197 omgbnd(i,j,lbnd)=spval
198 qcnvbnd(i,j,lbnd)=spval
199 pwtbnd(i,j,lbnd)=spval
201 qsbnd(i,j,lbnd)=spval
202 rhbnd(i,j,lbnd)=spval
209 IF(gridtype==
'E')
THEN
210 CALL exch(pint(1:im,jsta_2l:jend_2u,1))
212 CALL exch(pint(1:im,jsta_2l:jend_2u,l+1))
218 pv1 = 0.25*(pint(iw,j,l) + pint(ie,j,l) &
219 +pint(i,j+1,l) + pint(i,j-1,l))
220 pv2 = 0.25*(pint(iw,j,l+1) + pint(ie,j,l+1) &
221 +pint(i,j+1,l+1) + pint(i,j-1,l+1))
224 IF((pbint(iw,j,lbnd)>=pmv).AND. &
225 (pbint(iw,j,lbnd+1)<=pmv))
THEN
226 pvsum(i,j,lbnd) = pvsum(i,j,lbnd) + dp
227 ubnd(i,j,lbnd) = ubnd(i,j,lbnd) + dp* uh(i,j,l)
228 vbnd(i,j,lbnd) = vbnd(i,j,lbnd) + dp*vh(i,j,l)
234 ELSE IF (gridtype==
'B')
THEN
235 CALL exch(pint(1:im,jsta_2l:jend_2u,1))
237 CALL exch(pint(1:im,jsta_2l:jend_2u,l+1))
243 pv1 = 0.25*(pint(iw,j,l) + pint(ie,j,l) &
244 +pint(iw,j+1,l) + pint(ie,j+1,l))
245 pv2 = 0.25*(pint(iw,j,l+1) + pint(ie,j,l+1) &
246 +pint(iw,j+1,l+1) + pint(ie,j+1,l+1))
249 IF((pbint(iw,j,lbnd)>=pmv).AND. &
250 (pbint(iw,j,lbnd+1)<=pmv))
THEN
251 pvsum(i,j,lbnd) = pvsum(i,j,lbnd)+dp
252 ubnd(i,j,lbnd) = ubnd(i,j,lbnd)+uh(i,j,l)*dp
253 vbnd(i,j,lbnd) = vbnd(i,j,lbnd)+vh(i,j,l)*dp
268 IF(psum(i,j,lbnd)/=0..AND.tbnd(i,j,lbnd)<spval)
THEN
269 rpsum = 1./psum(i,j,lbnd)
270 lvlbnd(i,j,lbnd)= lvlbnd(i,j,lbnd)/nsum(i,j,lbnd)
271 pbnd(i,j,lbnd) = (pbint(i,j,lbnd)+pbint(i,j,lbnd+1))*0.5
272 tbnd(i,j,lbnd) = tbnd(i,j,lbnd)*rpsum
273 qbnd(i,j,lbnd) = qbnd(i,j,lbnd)*rpsum
274 qsbnd(i,j,lbnd) = qsbnd(i,j,lbnd)*rpsum
275 omgbnd(i,j,lbnd)= omgbnd(i,j,lbnd)*rpsum
276 IF(gridtype==
'A')
THEN
277 ubnd(i,j,lbnd) = ubnd(i,j,lbnd)*rpsum
278 vbnd(i,j,lbnd) = vbnd(i,j,lbnd)*rpsum
280 wbnd(i,j,lbnd) = wbnd(i,j,lbnd)*rpsum
281 IF(qcnvbnd(i,j,lbnd)<spval) &
282 qcnvbnd(i,j,lbnd) = qcnvbnd(i,j,lbnd)*rpsum
287 IF(gridtype==
'E' .or. gridtype==
'B')
THEN
290 IF(pvsum(i,j,lbnd)/=0.)
THEN
291 rpvsum = 1./pvsum(i,j,lbnd)
292 ubnd(i,j,lbnd) = ubnd(i,j,lbnd)*rpvsum
293 vbnd(i,j,lbnd) = vbnd(i,j,lbnd)*rpvsum
309 IF(psum(i,j,lbnd)==0..AND.pbnd(i,j,lbnd)<spval)
THEN
312 pbnd(i,j,lbnd) = (pbint(i,j,lbnd)+pbint(i,j,lbnd+1))*0.5
316 delp = abs(pm-pbnd(i,j,lbnd))
323 dp = pint(i,j,l+1)-pint(i,j,l)
326 tbnd(i,j,lbnd) = t(i,j,l)
327 qbnd(i,j,lbnd) = q(i,j,l)
328 IF(gridtype ==
'A')
THEN
329 ubnd(i,j,lbnd) = uh(i,j,l)
330 vbnd(i,j,lbnd) = vh(i,j,l)
332 wbnd(i,j,lbnd) = wh(i,j,l)
333 qcnvbnd(i,j,lbnd) = qcnvg(i,j,l)
334 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
337 qsat = con_eps*es/(pm+con_epsm1*es)
339 qsat=pq0/pm*exp(a2*(t(i,j,l)-a3)/(t(i,j,l)-a4))
341 qsbnd(i,j,lbnd) = qsat
342 omgbnd(i,j,lbnd) = omga(i,j,l)
343 pwtbnd(i,j,lbnd) = (q(i,j,l)+cwm(i,j,l))*dp*gi
348 IF(qsbnd(i,j,lbnd)/=0..AND.qbnd(i,j,lbnd)<spval)
THEN
349 rhbnd(i,j,lbnd) = qbnd(i,j,lbnd)/qsbnd(i,j,lbnd)
350 IF (rhbnd(i,j,lbnd)>1.0)
THEN
351 rhbnd(i,j,lbnd) = 1.0
352 qbnd(i,j,lbnd) = rhbnd(i,j,lbnd)*qsbnd(i,j,lbnd)
354 IF (rhbnd(i,j,lbnd)<0.01)
THEN
355 rhbnd(i,j,lbnd) = 0.01
356 qbnd(i,j,lbnd) = rhbnd(i,j,lbnd)*qsbnd(i,j,lbnd)
362 IF(gridtype ==
'E')
THEN
365 IF(pvsum(i,j,lbnd)==0.)
THEN
374 pmv = 0.125*(pint(iw,j,ll) + pint(ie,j,ll) + &
375 pint(i,j+1,ll) + pint(i,j-1,ll) + &
376 pint(iw,j,ll+1) + pint(ie,j,ll+1) + &
377 pint(i,j+1,ll+1) + pint(i,j-1,ll+1))
378 delpv = abs(pmv-pbnd(i,j,lbnd))
385 ubnd(i,j,lbnd) = uh(i,j,lv)
386 vbnd(i,j,lbnd) = vh(i,j,lv)
392 ELSE IF(gridtype==
'B')
THEN
395 IF(pvsum(i,j,lbnd)==0.)
THEN
404 pmv=0.125*(pint(iw,j,ll)+pint(ie,j,ll)+ &
405 pint(iw,j+1,ll)+pint(ie,j+1,ll)+ &
406 pint(iw,j,ll+1)+pint(ie,j,ll+1)+ &
407 pint(iw,j+1,ll+1)+pint(ie,j+1,ll+1))
408 delpv=abs(pmv-pbnd(i,j,lbnd))
415 ubnd(i,j,lbnd) = uh(i,j,lv)
416 vbnd(i,j,lbnd) = vh(i,j,lv)
423 DEALLOCATE (pbint, qsbnd, psum, pvsum, qcnvg, nsum)
elemental real function, public fpvsnew(t)
calcape() computes CAPE/CINS and other storm related variables.