1 SUBROUTINE memslp(TPRES,QPRES,FIPRES)
52 use vrbls3d,
only: pint, zint, t, q
53 use vrbls2d,
only: pslp, fis
55 use params_mod,
only: overrc, ad05, cft0, g, rd, d608, h1, kslpd
56 use ctlblk_mod,
only: jend, jsta, spval, spl, num_procs, mpi_comm_comp, lsmp1, &
57 jsta_m, jend_m, lm, im, jsta_2l, jend_2u, lsm, jm,&
58 im_jm, iend, ista, ista_m, iend_m, ista_2l, iend_2u
64 integer,
PARAMETER :: NFILL=0,nrlx1=500,nrlx2=100
65 real,
parameter:: def_of_mountain=2.0
67 real,
dimension(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U,LSM),
intent(in) :: QPRES
68 real,
dimension(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U,LSM),
intent(inout) :: TPRES,FIPRES
69 REAL :: TTV(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U),TNEW(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U) &
70 , p1(ista_2l:iend_2u,jsta_2l:jend_2u),htm2d(ista_2l:iend_2u,jsta_2l:jend_2u)
71 REAL :: HTMO(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U,LSM)
72 real :: P2,TLYR,GZ1,GZ2,SPLL,PSFC,PCHK,SLOPE,TVRTC,DIS,TVRT,tem
75 INTEGER :: KMNTM(LSM),IMNT(IM_JM,LSM),JMNT(IM_JM,LSM) &
76 , lmho(ista_2l:iend_2u,jsta_2l:jend_2u)
77 INTEGER :: IHE(JM),IHW(JM),IVE(JM),IVW(JM),IHS(JM),IHN(JM)
78 integer ii,jj,I,J,L,N,LLMH,KM,KS,IHH2,KOUNT,KMN,NRLX,LHMNT, &
79 lmhij,lmap1,kmm,lp,lxxx,ierr
81 real a1,a2,a3,a4,a5,a6,a7,a8
83 LOGICAL :: DONE(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U)
107 llmh = nint(lmh(i,j))
108 pslp(i,j) = pint(i,j,llmh+1)
134 if(pslp(i,j)<spval)
then
139 pchk = pint(i,j,nint(lmh(i,j))+1-nfill)
141 IF(fis(i,j) < 1.) pchk = psfc
147 IF(l > 1 .AND. htmo(i,j,l-1) > 0.5) lmho(i,j) = l-1
149 IF(l == lsm .AND. htmo(i,j,l) > 0.5) lmho(i,j) = lsm
177 loop210:
DO l=lsm,1,-1
181 if(pslp(i,j)<spval)
then
182 IF(htmo(i,j,l) < 0.5) cycle loop210
194 if ( num_procs > 1 )
then
196 (lhmnt,lxxx,1,mpi_integer,mpi_min,mpi_comm_comp,ierr)
200 IF(lhmnt == lsmp1)
GO TO 325
214 if(pslp(i,j)<spval)
then
218 IF(htmo(i,j,l) > 0.5) cycle
247 ttv(i,j) = tpres(i,j,l)
248 htm2d(i,j) = htmo(i,j,l)
259 CALL exch(htm2d(ista_2l,jsta_2l))
265 if(pslp(i,j)<spval)
then
274 tem = htm2d(i-1,j)*htm2d(i+1,j)*htm2d(i,j-1)*htm2d(i,j+1) &
275 * htm2d(i-1,j-1)*htm2d(i+1,j-1)*htm2d(i-1,j+1)*htm2d(i+1,j+1)
276 IF(htm2d(i,j) > 0.5 .AND. tem < 0.5)
then
277 ttv(i,j) = tpres(i,j,l)*(1.+0.608*qpres(i,j,l))
289 CALL exch(ttv(ista_2l,jsta_2l))
295 if(pslp(i,j)<spval)
then
327 if ((a1 < spval) .and. &
334 (a8 < spval) .and. (ttv(i,j) < spval))
then
340 tnew(i,j) = ad05*(4.*(ttv(i-1,j) +ttv(i+1,j) +ttv(i,j-1) &
341 +ttv(i,j+1)) +ttv(i-1,j-1) +ttv(i+1,j-1) &
342 +ttv(i-1,j+1)+ttv(i+1,j+1))-ttv(i,j)*cft0
366 if(pslp(i,j)<spval .and. tnew(i,j)< spval/100.)
then
377 if(pslp(i,j)<spval)
then
380 tpres(i,j,l) = ttv(i,j)
407 if(pslp(i,j)<spval)
then
411 IF(abs(fis(i,j)) < 1.)
THEN
412 pslp(i,j) = pint(i,j,nint(lmh(i,j))+1)
417 ELSE IF(fis(i,j) < -1.0)
THEN
419 IF(zint(i,j,l) > 0.)
THEN
423 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)))
424 pslp(i,j) = pint(i,j,l-1)/exp(-zint(i,j,l-1)*g/(rd*tem))
445 if(pslp(i,j)<spval)
then
449 gz1 = fipres(i,j,lmhij)
454 IF(gz1<spval .AND. p1(i,j)<spval .AND. tpres(i,j,l)<spval .AND. tpres(i,j,l-1)<spval)
THEN
456 tlyr = 0.5*(tpres(i,j,l)+tpres(i,j,l-1))
457 gz2 = gz1 + rd*tlyr*log(p1(i,j)/p2)
461 pslp(i,j) = p1(i,j)/exp(-gz1/(rd*tpres(i,j,l-1)))
474 IF(tpres(i,j,lp)<spval .AND. fipres(i,j,lp)<spval .AND. spl(lp)<spval )
THEN
475 tlyr = tpres(i,j,lp)-0.5*fipres(i,j,lp)*slope
476 pslp(i,j) = spl(lp)/exp(-fipres(i,j,lp)/(rd*tlyr))
506 if(pslp(i,j)<spval)
then
527 IF(pint(i,j,nint(lmh(i,j))+1) > spl(lp))
THEN
528 llmh = nint(lmh(i,j))
529 IF(t(i,j,llmh)<spval .AND. q(i,j,llmh)<spval .AND. &
530 zint(i,j,llmh)<spval .AND. zint(i,j,llmh+1)<spval .AND. &
531 pint(i,j,llmh+1)<spval)
THEN
532 tvrt = t(i,j,llmh)*(h1+d608*q(i,j,llmh))
533 dis = zint(i,j,llmh+1)-zint(i,j,llmh)+0.5*zint(i,j,llmh+1)
534 tlyr = tvrt-dis*g*slope
535 pslp(i,j) = pint(i,j,llmh+1)*exp(zint(i,j,llmh+1)*g &
541 IF(tpres(i,j,lp)<spval .AND. fipres(i,j,lp)<spval .AND. spl(lp)<spval )
THEN
542 tlyr=tpres(i,j,lp)-0.5*fipres(i,j,lp)*slope
543 pslp(i,j)=spl(lp)/exp(-fipres(i,j,lp)/(rd*tlyr))
subroutine exch(a)
exch() Subroutine that exchanges one halo row.