24 use vrbls3d,
only: pmid, q, t, uh, vh, zmid
25 use vrbls2d,
only: fis
27 use params_mod,
only: h10e5, capa, d608, h1, g, gi
28 use ctlblk_mod,
only: lm, im, jsta, jend, spval, jsta_m, jsta_2l, jend_2u, jend_m, &
29 ista, iend, ista_m, ista_2l, iend_2u, iend_m
30 use gridspec_mod,
only: gridtype
36 real,
dimension(ista_2l:iend_2u,jsta_2l:jend_2u),
intent(inout) :: PBLRI
38 REAL,
ALLOCATABLE :: THV(:,:,:)
39 INTEGER IFRSTLEV(ista_2l:iend_2u,jsta_2l:jend_2u),ICALPBL(ista_2l:iend_2u,jsta_2l:jend_2u) &
40 ,lvlp(ista_2l:iend_2u,jsta_2l:jend_2u)
41 REAL RIF(ista_2l:iend_2u,jsta_2l:jend_2u) &
42 ,ribp(ista_2l:iend_2u,jsta_2l:jend_2u),ubot1(ista_2l:iend_2u,jsta_2l:jend_2u) &
43 ,vbot1(ista_2l:iend_2u,jsta_2l:jend_2u),zbot1(ista_2l:iend_2u,jsta_2l:jend_2u) &
44 ,thvbot1(ista_2l:iend_2u,jsta_2l:jend_2u)
46 real APE,BETTA,RICR,USTARR,WMIN,UHKL,ULKL,VHKL,VLKL,WNDSL,WNDSLP, &
47 ubot,vbot,vtop,utop,thvtop,ztop,wdl2,rib
52 ALLOCATE ( thv(ista_2l:iend_2u,jsta_2l:jend_2u,lm) )
69 if( pmid(i,j,l)<spval)
then
70 ape = (h10e5/pmid(i,j,l))**capa
71 thv(i,j,l) = (q(i,j,l)*d608+h1)*t(i,j,l)*ape
111 call exch(vtm(ista_2l,jsta_2l,l))
112 call exch(uh(ista_2l,jsta_2l,l))
113 call exch(vh(ista_2l,jsta_2l,l))
114 call exch(vtm(ista_2l,jsta_2l,l-1))
115 call exch(uh(ista_2l,jsta_2l,l-1))
116 call exch(vh(ista_2l,jsta_2l,l-1))
122 if( pmid(i,j,l)<spval)
then
125 IF(ifrstlev(i,j) == 0)
THEN
129 IF(gridtype ==
'A')
THEN
134 ELSE IF(gridtype ==
'E')
THEN
144 wndsl = vtm(i,j-1,l)+vtm(iw,j,l)+vtm(ie,j,l)+vtm(i,j+1,l)
145 wndslp = vtm(i,j-1,l-1)+vtm(iw,j,l-1)+ &
146 vtm(ie,j,l-1)+vtm(i,j+1,l-1)
147 IF(wndsl == 0. .OR. wndslp == 0.) cycle
148 ubot = (uh(i,j-1,l)+uh(iw,j,l)+uh(ie,j,l)+uh(i,j+1,l))/wndsl
149 utop = (uh(i,j-1,l-1)+uh(iw,j,l-1)+uh(ie,j,l-1)+ &
150 uh(i,j+1,l-1))/wndslp
151 vbot = (vh(i,j-1,l)+vh(iw,j,l)+vh(ie,j,l)+vh(i,j+1,l))/wndsl
152 vtop = (vh(i,j-1,l-1)+vh(iw,j,l-1)+vh(ie,j,l-1)+ &
153 vh(i,j+1,l-1))/wndslp
154 ELSE IF(gridtype ==
'B')
THEN
157 ubot = (uh(iw,j-1,l)+uh(iw,j,l)+uh(ie,j-1,l)+uh(i,j,l))*0.25
158 utop = (uh(iw,j-1,l-1)+uh(iw,j,l-1)+uh(ie,j-1,l-1)+ &
160 vbot = (vh(iw,j-1,l)+vh(iw,j,l)+vh(ie,j-1,l)+vh(i,j,l))*0.25
161 vtop = (vh(iw,j-1,l-1)+vh(iw,j,l-1)+vh(ie,j-1,l-1)+ &
165 IF(ifrstlev(i,j) == 0)
THEN
168 zbot1(i,j) = zmid(i,j,l)
169 thvbot1(i,j) = thv(i,j,l)
173 thvtop = thv(i,j,l-1)
181 wdl2 = (utop-ubot1(i,j))**2 + (vtop-vbot1(i,j))**2 + wmin**2
182 rib = (g/thvbot1(i,j))*(thvtop-thvbot1(i,j))* &
183 (ztop-zbot1(i,j))/(wdl2+betta*(ustarr**2))
193 IF (rib>=ricr.AND.icalpbl(i,j)==0)
THEN
194 pblri(i,j) = zmid(i,j,l)+(zmid(i,j,l-1)-zmid(i,j,l))* &
195 (ricr-ribp(i,j))/(rib-ribp(i,j))
200 pblri(i,j) = pblri(i,j)-fis(i,j)*gi