1 SUBROUTINE memslp(TPRES,QPRES,FIPRES)
51 use vrbls3d, only: pint, zint, t, q
54 use params_mod, only: overrc, ad05, cft0, g, rd, d608, h1, kslpd
55 use ctlblk_mod
, only: jend, jsta, spval, spl, num_procs, mpi_comm_comp, lsmp1, &
56 jsta_m, jend_m, lm, im, jsta_2l, jend_2u, lsm, jm,&
63 integer,
PARAMETER :: nfill=0,nrlx1=500,nrlx2=100
64 real,
parameter:: def_of_mountain=2.0
66 real,
dimension(IM,JSTA_2L:JEND_2U,LSM),
intent(in) :: qpres
67 real,
dimension(IM,JSTA_2L:JEND_2U,LSM),
intent(inout) :: tpres,fipres
68 REAL :: ttv(im,jsta_2l:jend_2u),tnew(im,jsta_2l:jend_2u) &
69 , p1(im,jsta_2l:jend_2u),htm2d(im,jsta_2l:jend_2u)
70 REAL :: htmo(im,jsta_2l:jend_2u,lsm)
71 real :: p2,tlyr,gz1,gz2,spll,psfc,pchk,slope,tvrtc,dis,tvrt,tem
74 INTEGER :: kmntm(lsm),imnt(im_jm,lsm),jmnt(im_jm,lsm) &
75 , lmho(im,jsta_2l:jend_2u)
76 INTEGER :: ihe(jm),ihw(jm),ive(jm),ivw(jm),ihs(jm),ihn(jm)
77 integer ii,jj,i,j,l,n,llmh,km,ks,ihh2,kount,kmn,nrlx,lhmnt, &
78 lmhij,lmap1,kmm,lp,lxxx,ierr
80 real a1,a2,a3,a4,a5,a6,a7,a8
82 LOGICAL :: done(im,jsta_2l:jend_2u)
106 llmh = nint(lmh(i,j))
107 pslp(i,j) = pint(i,j,llmh+1)
133 if(pslp(i,j)<spval)
then
138 pchk = pint(i,j,nint(lmh(i,j))+1-nfill)
140 IF(fis(i,j) < 1.) pchk = psfc
146 IF(l > 1 .AND. htmo(i,j,l-1) > 0.5) lmho(i,j) = l-1
148 IF(l == lsm .AND. htmo(i,j,l) > 0.5) lmho(i,j) = lsm
176 loop210:
DO l=lsm,1,-1
180 if(pslp(i,j)<spval)
then
181 IF(htmo(i,j,l) < 0.5) cycle loop210
193 if ( num_procs > 1 )
then
195 (lhmnt,lxxx,1,mpi_integer,mpi_min,mpi_comm_comp,ierr)
199 IF(lhmnt == lsmp1) go to 325
213 if(pslp(i,j)<spval)
then
217 IF(htmo(i,j,l) > 0.5) cycle
246 ttv(i,j) = tpres(i,j,l)
247 htm2d(i,j) = htmo(i,j,l)
258 CALL exch(htm2d(1,jsta_2l))
264 if(pslp(i,j)<spval)
then
273 tem = htm2d(i-1,j)*htm2d(i+1,j)*htm2d(i,j-1)*htm2d(i,j+1) &
274 * htm2d(i-1,j-1)*htm2d(i+1,j-1)*htm2d(i-1,j+1)*htm2d(i+1,j+1)
275 IF(htm2d(i,j) > 0.5 .AND. tem < 0.5)
then
276 ttv(i,j) = tpres(i,j,l)*(1.+0.608*qpres(i,j,l))
288 CALL exch(ttv(1,jsta_2l))
294 if(pslp(i,j)<spval)
then
326 if ((a1 < spval) .and. &
333 (a8 < spval) .and. (ttv(i,j) < spval))
then
339 tnew(i,j) = ad05*(4.*(ttv(i-1,j) +ttv(i+1,j) +ttv(i,j-1) &
340 +ttv(i,j+1)) +ttv(i-1,j-1) +ttv(i+1,j-1) &
341 +ttv(i-1,j+1)+ttv(i+1,j+1))-ttv(i,j)*cft0
365 if(pslp(i,j)<spval .and. tnew(i,j)< spval/100.)
then
376 if(pslp(i,j)<spval)
then
379 tpres(i,j,l) = ttv(i,j)
406 if(pslp(i,j)<spval)
then
410 IF(abs(fis(i,j)) < 1.)
THEN
411 pslp(i,j) = pint(i,j,nint(lmh(i,j))+1)
416 ELSE IF(fis(i,j) < -1.0)
THEN
418 IF(zint(i,j,l) > 0.)
THEN
422 tem = 0.5*(t(i,j,l)+t(i,j,l-1))*(1.0+0.5*d608*(q(i,j,l)+q(i,j,l-1)))
423 pslp(i,j) = pint(i,j,l-1)/exp(-zint(i,j,l-1)*g/(rd*tem))
444 if(pslp(i,j)<spval)
then
448 gz1 = fipres(i,j,lmhij)
454 tlyr = 0.5*(tpres(i,j,l)+tpres(i,j,l-1))
455 gz2 = gz1 + rd*tlyr*log(p1(i,j)/p2)
459 pslp(i,j) = p1(i,j)/exp(-gz1/(rd*tpres(i,j,l-1)))
471 tlyr = tpres(i,j,lp)-0.5*fipres(i,j,lp)*slope
472 pslp(i,j) = spl(lp)/exp(-fipres(i,j,lp)/(rd*tlyr))
502 if(pslp(i,j)<spval)
then
522 IF(pint(i,j,nint(lmh(i,j))+1) > spl(lp))
THEN
523 llmh = nint(lmh(i,j))
524 tvrt = t(i,j,llmh)*(h1+d608*q(i,j,llmh))
525 dis = zint(i,j,llmh+1)-zint(i,j,llmh)+0.5*zint(i,j,llmh+1)
526 tlyr = tvrt-dis*g*slope
527 pslp(i,j) = pint(i,j,llmh+1)*exp(zint(i,j,llmh+1)*g &
532 tlyr=tpres(i,j,lp)-0.5*fipres(i,j,lp)*slope
533 pslp(i,j)=spl(lp)/exp(-fipres(i,j,lp)/(rd*tlyr))