!wrf:model_layer:physics ! ! ! module module_bl_ysu contains ! !------------------------------------------------------------------- ! subroutine ysu(u3d,v3d,th3d,t3d,qv3d,qc3d,qi3d,p3d,pi3d, & rublten,rvblten,rthblten, & rqvblten,rqcblten,rqiblten, & cp,g,rovcp,rd,rovg, & dz8w,z,xlv,rv,psfc, & znt,ust,zol,hol,hpbl,psim,psih, & xland,hfx,qfx,tsk,gz1oz0,wspd,br, & dt,dtmin,kpbl2d, & svp1,svp2,svp3,svpt0,ep1,ep2,karman,eomeg,stbolt,& exch_h, & ids,ide, jds,jde, kds,kde, & ims,ime, jms,jme, kms,kme, & its,ite, jts,jte, kts,kte, & !optional regime ) !------------------------------------------------------------------- implicit none !------------------------------------------------------------------- !-- u3d 3d u-velocity interpolated to theta points (m/s) !-- v3d 3d v-velocity interpolated to theta points (m/s) !-- th3d 3d potential temperature (k) !-- t3d temperature (k) !-- qv3d 3d water vapor mixing ratio (kg/kg) !-- qc3d 3d cloud mixing ratio (kg/kg) !-- qi3d 3d ice mixing ratio (kg/kg) ! (note: if P_QI= 1. ) then do i = its,ite kmin(i) = 1 do k = kte-1,kts,-1 if( zq(i,k) <= hpblmin ) then kmin(i) = k exit end if end do end do end if ! !-----initialize vertical tendencies and ! do i = its,ite do k = kts,kte utnp(i,k) = 0. vtnp(i,k) = 0. ttnp(i,k) = 0. enddo enddo ! do k = kts,kte do i = its,ite qtnp(i,k) = 0. enddo enddo ! do k = kts,kte do i = its,ite qctnp(i,k) = 0. qitnp(i,k) = 0. enddo enddo ! do i = its,ite wspd1(i) = sqrt(ux(i,1)*ux(i,1)+vx(i,1)*vx(i,1))+1.e-9 enddo ! !---- compute vertical diffusion ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! compute preliminary variables ! dtstep = dt dt2 = 2.*dtstep rdt = 1./dt2 ! do i = its,ite bfxpbl(i) = 0.0 hfxpbl(i) = 0.0 qfxpbl(i) = 0.0 ufxpbl(i) = 0.0 vfxpbl(i) = 0.0 hgamu(i) = 0.0 hgamv(i) = 0.0 delta(i) = 0.0 enddo ! do k = kts,klpbl do i = its,ite wscalek(i,k) = 0.0 enddo enddo ! do k = kts,klpbl do i = its,ite zfac(i,k) = 0.0 enddo enddo ! do i = its,ite hgamt(i) = 0. hgamq(i) = 0. wscale(i) = 0. kpbl(i) = 1 hpbl(i) = zq(i,1) zl1(i) = za(i,1) thermal(i)= thvx(i,1) pblflg(i) = .true. sfcflg(i) = .true. !wig 12-aug-2004: Turn off check for sfc stability if using a minimum ! pbl height > 0. if(br(i).gt.0.0 .and. hpblmin<=1.) sfcflg(i) = .false. enddo ! ! compute the first guess of pbl height ! do i = its,ite stable(i) = .false. brup(i) = br(i) enddo ! do k = 2,klpbl do i = its,ite if(.not.stable(i))then brdn(i) = brup(i) spdk2 = max(ux(i,k)**2+vx(i,k)**2,1.) brup(i) = (thvx(i,k)-thermal(i))*(g*za(i,k)/thvx(i,1))/spdk2 kpbl(i) = k stable(i) = brup(i).gt.brcr endif enddo enddo ! do i = its,ite k = kpbl(i) if(brdn(i).ge.brcr)then brint = 0. elseif(brup(i).le.brcr)then brint = 1. else brint = (brcr-brdn(i))/(brup(i)-brdn(i)) endif hpbl(i) = za(i,k-1)+brint*(za(i,k)-za(i,k-1)) !wig 16-sep-2005: rig a minimum PBL heigt if( hpblmin >= 1. .and. hpbl(i).lt.hpblmin) then kpbl(i) = kmin(i) hpbl(i) = hpblmin else if(hpbl(i).lt.zq(i,2)) kpbl(i) = 1 end if if(kpbl(i).le.1) pblflg(i) = .false. enddo ! do i = its,ite fm = gz1oz0(i)-psim(i) fh = gz1oz0(i)-psih(i) hol(i) = max(br(i)*fm*fm/fh,rimin) if(sfcflg(i))then hol(i) = min(hol(i),-zfmin) else hol(i) = max(hol(i),zfmin) endif ! hol1 = hol(i)*hpbl(i)/zl1(i)*sfcfrac hol(i) = -hol(i)*hpbl(i)/zl1(i) if(sfcflg(i))then phim(i) = (1.-aphi16*hol1)**(-1./4.) phih(i) = (1.-aphi16*hol1)**(-1./2.) bfx0 = max(hfx(i)/rhox(i)/cpm(i) & +ep1*thx(i,1)*qfx(i)/rhox(i),0.) hfx0 = max(hfx(i)/rhox(i)/cpm(i),0.) qfx0 = max(ep1*thx(i,1)*qfx(i)/rhox(i),0.) wstar3(i) = (govrth(i)*bfx0*hpbl(i)) wstar(i) = (wstar3(i))**h1 else phim(i) = (1.+aphi5*hol1) phih(i) = phim(i) wstar(i) = 0. wstar3(i) = 0. endif ust3(i) = ust(i)**3. wscale(i) = (ust3(i)+phifac*karman*wstar3(i)*0.5)**h1 wscale(i) = min(wscale(i),ust(i)*aphi16) wscale(i) = max(wscale(i),ust(i)/aphi5) enddo ! ! compute the surface variables for pbl height estimation ! under unstable conditions ! do i = its,ite if(sfcflg(i))then gamfac = bfac/rhox(i)/wscale(i) hgamt(i) = min(gamfac*hfx(i)/cpm(i),gamcrt) hgamq(i) = min(gamfac*qfx(i),gamcrq) vpert = (hgamt(i)+ep1*thx(i,1)*hgamq(i))/bfac*afac thermal(i) = thermal(i)+max(vpert,0.) hgamt(i) = max(hgamt(i),0.0) hgamq(i) = 0.0 brint = -15.9*ust(i)*ust(i)/wspd(i)*wstar3(i) & /(wscale(i)**4.) hgamu(i) = brint*ux(i,1) hgamv(i) = brint*vx(i,1) else pblflg(i) = .false. endif enddo ! ! enhance the pbl height by considering the thermal ! do i = its,ite if(pblflg(i))then kpbl(i) = 1 hpbl(i) = zq(i,1) endif enddo ! do i = its,ite if(pblflg(i))then stable(i) = .false. brup(i) = br(i) endif enddo ! do k = 2,klpbl do i = its,ite if(.not.stable(i).and.pblflg(i))then brdn(i) = brup(i) spdk2 = max((ux(i,k)**2+vx(i,k)**2),1.) brup(i) = (thvx(i,k)-thermal(i))*(g*za(i,k)/thvx(i,1))/spdk2 kpbl(i) = k stable(i) = brup(i).gt.brcr endif enddo enddo ! do i = its,ite if(pblflg(i))then k = kpbl(i) if(brdn(i).ge.brcr)then brint = 0. elseif(brup(i).le.brcr)then brint = 1. else brint = (brcr-brdn(i))/(brup(i)-brdn(i)) endif hpbl(i) = za(i,k-1)+brint*(za(i,k)-za(i,k-1)) !wig 16-sep-2005: rig a minimum PBL heigt if(hpblmin >= 1. .and. hpbl(i).lt.hpblmin) then kpbl(i) = kmin(i) hpbl(i) = hpblmin else if(hpbl(i).lt.zq(i,2)) kpbl(i) = 1 end if if(kpbl(i).le.1) pblflg(i) = .false. endif enddo ! ! estimate the entrainment parameters ! do i = its,ite if(pblflg(i)) then k = kpbl(i) - 1 ss = ((ux(i,k+1)-ux(i,k))*(ux(i,k+1)-ux(i,k))+(vx(i,k+1)- & vx(i,k))*(vx(i,k+1)-vx(i,k)))/(dza(i,k+1)*dza(i,k+1))+ & 1.e-9 govrthv = g/(0.5*(thvx(i,k+1)+thvx(i,k))) ri = govrthv*(thvx(i,k+1)-thvx(i,k))/(ss*dza(i,k+1)) if(imvdif.eq.1)then if((qcx(i,k)+qix(i,k)).gt.0.01e-3.and.(qcx(i,k+1)+ & qix(i,k+1)).gt.0.01e-3)then ! in cloud qmean = 0.5*(qx(i,k)+qx(i,k+1)) tmean = 0.5*(tx(i,k)+tx(i,k+1)) alph = xlv*qmean/rd/tmean chi = xlv*xlv*qmean/cp/rv/tmean/tmean ri = (1.+alph)*(ri-g*g/ss/tmean/cp*((chi-alph)/(1.+chi))) endif endif prpbl(i) = 1.0 wm3 = wstar3(i) + 5. * ust3(i) wm2(i) = wm3**h2 bfxpbl(i) = -0.15*thvx(i,1)/g*wm3/hpbl(i) dthvx(i) = max(thvx(i,k+1)-thvx(i,k),qmin) dthx = max(thx(i,k+1)-thx(i,k),qmin) dqx = min(qx(i,k+1)-qx(i,k),0.0) we(i) = max(bfxpbl(i)/dthvx(i),-sqrt(wm2(i))) hfxpbl(i) = we(i)*dthx qfxpbl(i) = we(i)*dqx ! dux = ux(i,k+1)-ux(i,k) dvx = vx(i,k+1)-vx(i,k) if(dux.gt.qmin) then ufxpbl(i) = max(prpbl(i)*we(i)*dux,-ust(i)*ust(i)) elseif(dux.lt.-qmin) then ufxpbl(i) = min(prpbl(i)*we(i)*dux,ust(i)*ust(i)) else ufxpbl(i) = 0.0 endif if(dvx.gt.qmin) then vfxpbl(i) = max(prpbl(i)*we(i)*dvx,-ust(i)*ust(i)) elseif(dvx.lt.-qmin) then vfxpbl(i) = min(prpbl(i)*we(i)*dvx,ust(i)*ust(i)) else vfxpbl(i) = 0.0 endif delb = govrth(i)*d3*hpbl(i) delta(i) = min(d1*hpbl(i) + d2*wm2(i)/delb,100.) endif enddo ! do k = kts,klpbl do i = its,ite if(pblflg(i).and.k.ge.kpbl(i))then entfac(i,k) = ((zq(i,k+1)-hpbl(i))/delta(i))**2. else entfac(i,k) = 1.e30 endif enddo enddo ! ! compute diffusion coefficients below pbl ! do k = kts,klpbl do i = its,ite if(k.lt.kpbl(i)) then zfac(i,k) = min(max((1.-(zq(i,k+1)-zl1(i)) & /(hpbl(i)-zl1(i))),zfmin),1.) xkzo = ckz*dza(i,k+1) zfacent(i,k) = (1.-zfac(i,k))**3. prnumfac = -3.*(max(zq(i,k+1)-sfcfrac*hpbl(i),0.))**2. & /hpbl(i)**2. prnum = (phih(i)/phim(i)+bfac*karman*sfcfrac) prnum = 1. + (prnum-1.)*exp(prnumfac) prnum = min(prnum,prmax) prnum = max(prnum,prmin) wscalek(i,k) = (ust3(i)+phifac*karman*wstar3(i) & *(1.-zfac(i,k)))**h1 xkzm(i,k) = xkzo+wscalek(i,k)*karman*zq(i,k+1) & *zfac(i,k)**pfac xkzh(i,k) = xkzm(i,k)/prnum xkzm(i,k) = min(xkzm(i,k),xkzmax) xkzm(i,k) = max(xkzm(i,k),xkzmin) xkzh(i,k) = min(xkzh(i,k),xkzmax) xkzh(i,k) = max(xkzh(i,k),xkzmin) !wig 16-sep-2005: This code is unnecessary. exch_hx will get overwritten ! with the same values further down in this routine ! exch_hx(i,k) = xkzh(i,k) endif enddo enddo ! ! compute diffusion coefficients over pbl (free atmosphere) ! do k = kts,kte-1 do i = its,ite xkzo = ckz*dza(i,k+1) if(k.ge.kpbl(i)) then ss = ((ux(i,k+1)-ux(i,k))*(ux(i,k+1)-ux(i,k))+(vx(i,k+1)- & vx(i,k))*(vx(i,k+1)-vx(i,k)))/(dza(i,k+1)*dza(i,k+1))+ & 1.e-9 govrthv = g/(0.5*(thvx(i,k+1)+thvx(i,k))) ri = govrthv*(thvx(i,k+1)-thvx(i,k))/(ss*dza(i,k+1)) if(imvdif.eq.1)then if((qcx(i,k)+qix(i,k)).gt.0.01e-3.and.(qcx(i,k+1)+ & qix(i,k+1)).gt.0.01e-3)then ! in cloud qmean = 0.5*(qx(i,k)+qx(i,k+1)) tmean = 0.5*(tx(i,k)+tx(i,k+1)) alph = xlv*qmean/rd/tmean chi = xlv*xlv*qmean/cp/rv/tmean/tmean ri = (1.+alph)*(ri-g*g/ss/tmean/cp*((chi-alph)/(1.+chi))) endif endif zk = karman*zq(i,k+1) rl2 = (zk*rlam/(rlam+zk))**2 dk = rl2*sqrt(ss) if(ri.lt.0.)then ! unstable regime sri = sqrt(-ri) xkzm(i,k) = xkzo+dk*(1+8.*(-ri)/(1+1.746*sri)) xkzh(i,k) = xkzo+dk*(1+8.*(-ri)/(1+1.286*sri)) else ! stable regime xkzh(i,k) = xkzo+dk/(1+5.*ri)**2 prnum = 1.0+2.1*ri prnum = min(prnum,prmax) xkzm(i,k) = (xkzh(i,k)-xkzo)*prnum+xkzo endif ! xkzm(i,k) = min(xkzm(i,k),xkzmax) xkzm(i,k) = max(xkzm(i,k),xkzmin) xkzh(i,k) = min(xkzh(i,k),xkzmax) xkzh(i,k) = max(xkzh(i,k),xkzmin) xkzml(i,k) = xkzm(i,k) xkzhl(i,k) = xkzh(i,k) !wig 16-sep-2005: This code is unnecessary. exch_hx will get overwritten ! further down in this routine after adjustments are made ! for entrainment. ! exch_hx(i,k) = xkzh(i,k) endif enddo enddo ! ! compute tridiagonal matrix elements for heat and moisture, and clouds ! do i = its,ite do k = kts,kte au(i,k) = 0. al(i,k) = 0. ad(i,k) = 0. f1(i,k) = 0. enddo enddo ! do ic = 1,ncloud do i = its,ite do k = kts,kte f3(i,k,ic) = 0. enddo enddo enddo ! do i = its,ite ad(i,1) = 1. f1(i,1) = thx(i,1)+hfx(i)/(rhox(i)*cpm(i))/zq(i,2)*dt2 f3(i,1,1) = qx(i,1)+qfx(i)/(rhox(i))/zq(i,2)*dt2 enddo ! if(ncloud.ge.2) then do ic = 2,ncloud do i = its,ite if(ic.eq.2) then f3(i,1,ic) = qcx(i,1) elseif(ic.eq.3) then f3(i,1,ic) = qix(i,1) endif enddo enddo endif ! do k = kts,kte-1 do i = its,ite dtodsd = dt2/dz8w2d(i,k) dtodsu = dt2/dz8w2d(i,k+1) rdz = 1./dza(i,k+1) if(pblflg(i).and.k.lt.kpbl(i)) then dsdzt = xkzh(i,k)*(-hgamt(i)/hpbl(i) & -hfxpbl(i)*zfacent(i,k)/xkzh(i,k)) dsdzq = xkzh(i,k)*(-hgamq(i)/hpbl(i) & -qfxpbl(i)*zfacent(i,k)/xkzh(i,k)) f1(i,k) = f1(i,k)+dtodsd*dsdzt f1(i,k+1) = thx(i,k+1)-dtodsu*dsdzt f3(i,k,1) = f3(i,k,1)+dtodsd*dsdzq f3(i,k+1,1) = qx(i,k+1)-dtodsu*dsdzq elseif(pblflg(i).and.k.ge.kpbl(i).and.entfac(i,k).lt.4.6) then xkzh(i,k) = -we(i)*dza(i,kpbl(i))*exp(-entfac(i,k)) xkzh(i,k) = sqrt(xkzh(i,k)*xkzhl(i,k)) xkzh(i,k) = min(xkzh(i,k),xkzmax) xkzh(i,k) = max(xkzh(i,k),xkzmin) f1(i,k+1) = thx(i,k+1) f3(i,k+1,1) = qx(i,k+1) else f1(i,k+1) = thx(i,k+1) f3(i,k+1,1) = qx(i,k+1) endif dsdz2 = xkzh(i,k)*rdz au(i,k) = -dtodsd*dsdz2 al(i,k) = -dtodsu*dsdz2 ad(i,k) = ad(i,k)-au(i,k) ad(i,k+1) = 1.-al(i,k) exch_hx(i,k) = xkzh(i,k) enddo enddo ! if(ncloud.ge.2) then do ic = 2,ncloud do k = kts,kte-1 do i = its,ite if(ic.eq.2) then f3(i,k+1,ic) = qcx(i,k+1) elseif(ic.eq.3) then f3(i,k+1,ic) = qix(i,k+1) endif enddo enddo enddo endif ! copies here to avoid duplicate input args for tridin do k = kts,kte do i = its,ite cu(i,k) = au(i,k) r1(i,k) = f1(i,k) enddo enddo ! do ic = 1,ncloud do k = kts,kte do i = its,ite r3(i,k,ic) = f3(i,k,ic) enddo enddo enddo ! ! ! solve tridiagonal problem for heat and moisture, and clouds ! call tridin(al,ad,cu,r1,r3,au,f1,f3, & its,ite,kts,kte,ncloud ) ! ! recover tendencies of heat and moisture ! do k = kte,kts,-1 do i = its,ite ttend = (f1(i,k)-thx(i,k))*rdt*(tx(i,k)/thx(i,k)) qtend = (f3(i,k,1)-qx(i,k))*rdt ttnp(i,k) = ttnp(i,k)+ttend qtnp(i,k) = qtnp(i,k)+qtend enddo enddo ! if(ncloud.ge.2) then do ic = 2,ncloud do k = kte,kts,-1 do i = its,ite if(ic.eq.2) then qctend = (f3(i,k,ic)-qcx(i,k))*rdt qctnp(i,k) = qctnp(i,k)+qctend elseif(ic.eq.3) then qitend = (f3(i,k,ic)-qix(i,k))*rdt qitnp(i,k) = qitnp(i,k)+qitend endif enddo enddo enddo endif ! ! compute tridiagonal matrix elements for momentum ! do i = its,ite do k = kts,kte au(i,k) = 0. al(i,k) = 0. ad(i,k) = 0. f1(i,k) = 0. f2(i,k) = 0. enddo enddo ! do i = its,ite ad(i,1) = 1. f1(i,1) = ux(i,1)-ux(i,1)/wspd1(i)*ust(i)*ust(i)/zq(i,2)*dt2 & *(wspd1(i)/wspd(i))**2 f2(i,1) = vx(i,1)-vx(i,1)/wspd1(i)*ust(i)*ust(i)/zq(i,2)*dt2 & *(wspd1(i)/wspd(i))**2 enddo ! do k = kts,kte-1 do i = its,ite dtodsd = dt2/dz8w2d(i,k) dtodsu = dt2/dz8w2d(i,k+1) rdz = 1./dza(i,k+1) if(pblflg(i).and.k.lt.kpbl(i))then dsdzu=xkzm(i,k)*(-hgamu(i)/hpbl(i) & -ufxpbl(i)*zfacent(i,k)/xkzm(i,k)) dsdzv=xkzm(i,k)*(-hgamv(i)/hpbl(i) & -vfxpbl(i)*zfacent(i,k)/xkzm(i,k)) f1(i,k) = f1(i,k)+dtodsd*dsdzu f1(i,k+1) = ux(i,k+1)-dtodsu*dsdzu f2(i,k) = f2(i,k)+dtodsd*dsdzv f2(i,k+1) = vx(i,k+1)-dtodsu*dsdzv elseif(pblflg(i).and.k.ge.kpbl(i).and.entfac(i,k).lt.4.6) then xkzm(i,k) = prpbl(i)*xkzh(i,k) xkzm(i,k) = sqrt(xkzm(i,k)*xkzml(i,k)) xkzm(i,k)=min(xkzm(i,k),xkzmax) xkzm(i,k)=max(xkzm(i,k),xkzmin) f1(i,k+1)=ux(i,k+1) f2(i,k+1)=vx(i,k+1) else f1(i,k+1) = ux(i,k+1) f2(i,k+1) = vx(i,k+1) endif dsdz2 = xkzm(i,k)*rdz au(i,k) = -dtodsd*dsdz2 al(i,k) = -dtodsu*dsdz2 ad(i,k) = ad(i,k)-au(i,k) ad(i,k+1) = 1.-al(i,k) enddo enddo ! copies here to avoid duplicate input args for tridin do k = kts,kte do i = its,ite cu(i,k) = au(i,k) r1(i,k) = f1(i,k) r2(i,k) = f2(i,k) enddo enddo ! ! ! solve tridiagonal problem for momentum ! call tridin(al,ad,cu,r1,r2,au,f1,f2, & its,ite,kts,kte,1 ) ! ! recover tendencies of momentum ! do k = kte,kts,-1 do i = its,ite utend = (f1(i,k)-ux(i,k))*rdt vtend = (f2(i,k)-vx(i,k))*rdt utnp(i,k) = utnp(i,k)+utend vtnp(i,k) = vtnp(i,k)+vtend enddo enddo ! !---- end of vertical diffusion ! do i = its,ite kpbl1d(i) = kpbl(i) enddo ! end subroutine ysu2d ! subroutine tridin(cl,cm,cu,r1,r2,au,f1,f2, & its,ite,kts,kte,nt ) !---------------------------------------------------------------- implicit none !---------------------------------------------------------------- ! integer, intent(in ) :: its,ite, kts,kte, nt ! real, dimension( its:ite, kts+1:kte+1 ) , & intent(in ) :: cl ! real, dimension( its:ite, kts:kte ) , & intent(in ) :: cm, & r1 real, dimension( its:ite, kts:kte,nt ) , & intent(in ) :: r2 ! real, dimension( its:ite, kts:kte ) , & intent(inout) :: au, & cu, & f1 real, dimension( its:ite, kts:kte,nt ) , & intent(inout) :: f2 ! real :: fk integer :: i,k,l,n,it ! !---------------------------------------------------------------- ! l = ite n = kte ! do i = its,l fk = 1./cm(i,1) au(i,1) = fk*cu(i,1) f1(i,1) = fk*r1(i,1) enddo do it = 1,nt do i = its,l fk = 1./cm(i,1) f2(i,1,it) = fk*r2(i,1,it) enddo enddo do k = kts+1,n-1 do i = its,l fk = 1./(cm(i,k)-cl(i,k)*au(i,k-1)) au(i,k) = fk*cu(i,k) f1(i,k) = fk*(r1(i,k)-cl(i,k)*f1(i,k-1)) enddo enddo do it = 1,nt do k = kts+1,n-1 do i = its,l fk = 1./(cm(i,k)-cl(i,k)*au(i,k-1)) f2(i,k,it) = fk*(r2(i,k,it)-cl(i,k)*f2(i,k-1,it)) enddo enddo enddo do i = its,l fk = 1./(cm(i,n)-cl(i,n)*au(i,n-1)) f1(i,n) = fk*(r1(i,n)-cl(i,n)*f1(i,n-1)) enddo do it = 1,nt do i = its,l fk = 1./(cm(i,n)-cl(i,n)*au(i,n-1)) f2(i,n,it) = fk*(r2(i,n,it)-cl(i,n)*f2(i,n-1,it)) enddo enddo do k = n-1,kts,-1 do i = its,l f1(i,k) = f1(i,k)-au(i,k)*f1(i,k+1) enddo enddo do it = 1,nt do k = n-1,kts,-1 do i = its,l f2(i,k,it) = f2(i,k,it)-au(i,k)*f2(i,k+1,it) enddo enddo enddo ! end subroutine tridin ! subroutine ysuinit(rublten,rvblten,rthblten,rqvblten, & rqcblten,rqiblten,p_qi,p_first_scalar, & restart, allowed_to_read, & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & its, ite, jts, jte, kts, kte ) !------------------------------------------------------------------- implicit none !------------------------------------------------------------------- ! logical , intent(in) :: restart, allowed_to_read integer , intent(in) :: ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & its, ite, jts, jte, kts, kte integer , intent(in) :: p_qi,p_first_scalar real , dimension( ims:ime , kms:kme , jms:jme ), intent(out) :: & rublten, & rvblten, & rthblten, & rqvblten, & rqcblten, & rqiblten integer :: i, j, k, itf, jtf, ktf ! jtf = min0(jte,jde-1) ktf = min0(kte,kde-1) itf = min0(ite,ide-1) ! if(.not.restart)then do j = jts,jtf do k = kts,ktf do i = its,itf rublten(i,k,j) = 0. rvblten(i,k,j) = 0. rthblten(i,k,j) = 0. rqvblten(i,k,j) = 0. rqcblten(i,k,j) = 0. enddo enddo enddo endif ! if (p_qi .ge. p_first_scalar .and. .not.restart) then do j = jts,jtf do k = kts,ktf do i = its,itf rqiblten(i,k,j) = 0. enddo enddo enddo endif ! end subroutine ysuinit !------------------------------------------------------------------- end module module_bl_ysu