t36(0:nlon,0:nlat) = 0.25*f(0:nlon,0:nlat)*(hxt(0:nlon,0:nlat)*hy
     .  t(0:nlon,0:nlat)+hxt(0:nlon,1:nlat+1)*hyt(0:nlon,1:nlat+1)+hxt(
     .  1:nlon+1,0:nlat)*hyt(1:nlon+1,0:nlat)+hxt(1:nlon+1,1:nlat+1)*hy
     .  t(1:nlon+1,1:nlat+1))
      e(1:nlon+1,1:nlat+1,1:nlev) = 0.25*((PVZ(1:nlon+1,0:nlat,1:nlev)*
     .  *2*spread(hxv(1:nlon+1,0:nlat),3,nlev)+PVZ(1:nlon+1,1:nlat+1,1:
     .  nlev)**2*spread(hxv(1:nlon+1,1:nlat+1),3,nlev))/spread(hxt(1:nl
     .  on+1,1:nlat+1),3,nlev)+(PUZ(0:nlon,1:nlat+1,1:nlev)**2*spread(h
     .  yu(0:nlon,1:nlat+1),3,nlev)+PUZ(1:nlon+1,1:nlat+1,1:nlev)**2*sp
     .  read(hyu(1:nlon+1,1:nlat+1),3,nlev))/spread(hyt(1:nlon+1,1:nlat
     .  +1),3,nlev))
CMIC$ DO ALL
      DO 1000 k = 1,nlev+1
         p(0:nlon+2,0:nlat+2,k) = spread(spread(AHYB(k),2,nlat+3),1,nlo
     .  n+3)+spread(spread(BHYB(k),2,nlat+3),1,nlon+3)*PS(0:nlon+2,0:nl
     .  at+2)
1000  CONTINUE
      t13(0:nlon+1,0:nlat+1,2:nlev+1) = LOG(p(0:nlon+1,0:nlat+1,2:nlev+
     .  1))*p(0:nlon+1,0:nlat+1,2:nlev+1)
CMIC$ DO ALL
      DO 1010 k = 1,nlev
CMIC$    DO ALL
         DO 1020 j = 0,nlat+1
CMIC$       DO ALL
            DO 1030 i = 0,nlon+1
               IF (k.LE.1) THEN
                  lnp(i,j,k) = t13(i,j,2)/(p(i,j,k+1)-p(i,j,k))
               ELSE
                  lnp(i,j,k) = (t13(i,j,k+1)-t13(i,j,k))/(p(i,j,k+1)-p(
     .  i,j,k))
               ENDIF
1030        CONTINUE
1020     CONTINUE
1010  CONTINUE
      t18(1:nlon+1,1:nlat+1,2:nlev) = LOG(p(1:nlon+1,1:nlat+1,2:nlev)/p
     .  (1:nlon+1,1:nlat+1,3:nlev+1))
      t20(1:nlon+1,1:nlat+1,nlev) = 0
      DO 1040 k = nlev,2,-1
         t20(1:nlon+1,1:nlat+1,k-1) = t20(1:nlon+1,1:nlat+1,k)+PTZ(1:nl
     .  on+1,1:nlat+1,k)*t18(1:nlon+1,1:nlat+1,k)*(0.607824693422519*PQ
     .  Z(1:nlon+1,1:nlat+1,k)+1)
1040  CONTINUE
      t26(1:nlon+1,1:nlat+1,2:nlev) = p(1:nlon+1,1:nlat+1,2:nlev)*t18(1
     .  :nlon+1,1:nlat+1,2:nlev)/(p(1:nlon+1,1:nlat+1,3:nlev+1)-p(1:nlo
     .  n+1,1:nlat+1,2:nlev))+1
CMIC$ DO ALL
      DO 1050 k = 1,nlev
CMIC$    DO ALL
         DO 1060 j = 1,nlat+1
CMIC$       DO ALL
            DO 1070 i = 1,nlon+1
               IF (k.LE.1) THEN
                  phi(i,j,k) = phis(i,j)+198.960966707927*PTZ(i,j,k)*(0
     .  .607824693422519*PQZ(i,j,1)+1)-287.04*t20(i,j,1)
               ELSE
                  phi(i,j,k) = phis(i,j)-287.04*(t20(i,j,k)-PTZ(i,j,k)*
     .  t26(i,j,k)*(0.607824693422519*PQZ(i,j,k)+1))
               ENDIF
1070        CONTINUE
1060     CONTINUE
1050  CONTINUE
      t31(0:nlon+1,0:nlat+1,1:nlev) = spread(hxt(0:nlon+1,0:nlat+1),3,n
     .  lev)*spread(hyt(0:nlon+1,0:nlat+1),3,nlev)*(p(0:nlon+1,0:nlat+1
     .  ,2:nlev+1)-p(0:nlon+1,0:nlat+1,1:nlev))
      z(0:nlon,0:nlat,1:nlev) = 4*((spread(t36(0:nlon,0:nlat),3,nlev)-1
     .  .56961230576048E-7*(rdlam*(spread(hyv(0:nlon,0:nlat),3,nlev)*PV
     .  Z(0:nlon,0:nlat,1:nlev)-spread(hyv(1:nlon+1,0:nlat),3,nlev)*PVZ
     .  (1:nlon+1,0:nlat,1:nlev))-rdth*(spread(hxu(0:nlon,0:nlat),3,nle
     .  v)*PUZ(0:nlon,0:nlat,1:nlev)-spread(hxu(0:nlon,1:nlat+1),3,nlev
     .  )*PUZ(0:nlon,1:nlat+1,1:nlev))))/(t31(0:nlon,0:nlat,1:nlev)+t31
     .  (0:nlon,1:nlat+1,1:nlev)+t31(1:nlon+1,0:nlat,1:nlev)+t31(1:nlon
     .  +1,1:nlat+1,1:nlev)))
      t47(0:nlon+1,1:nlat+1,1:nlev) = p(0:nlon+1,1:nlat+1,1:nlev)+p(1:n
     .  lon+2,1:nlat+1,1:nlev)-p(0:nlon+1,1:nlat+1,2:nlev+1)-p(1:nlon+2
     .  ,1:nlat+1,2:nlev+1)
      t102(1:nlon+1,1:nlat,1:nlev) = 0.5*spread(hyu(0:nlon,1:nlat),3,nl
     .  ev)*t47(0:nlon,1:nlat,1:nlev)*PUZ(0:nlon,1:nlat,1:nlev)*(lnp(0:
     .  nlon,1:nlat,1:nlev)-lnp(1:nlon+1,1:nlat,1:nlev))
      t103(1:nlon+1,1:nlat,1:nlev) = t102(1:nlon+1,1:nlat,1:nlev)*(PTZ(
     .  0:nlon,1:nlat,1:nlev)*PQZ(0:nlon,1:nlat,1:nlev)+PTZ(1:nlon+1,1:
     .  nlat,1:nlev)*PQZ(1:nlon+1,1:nlat,1:nlev))
      t116(1:nlon+1,1:nlat,1:nlev) = 0.5*spread(hyu(0:nlon,1:nlat),3,nl
     .  ev)*t47(0:nlon,1:nlat,1:nlev)*PUZ(0:nlon,1:nlat,1:nlev)*(PTZ(0:
     .  nlon,1:nlat,1:nlev)-PTZ(1:nlon+1,1:nlat,1:nlev))
      t151(1:nlon+1,1:nlat,1:nlev) = 0.5*spread(hyu(0:nlon,1:nlat),3,nl
     .  ev)*t47(0:nlon,1:nlat,1:nlev)*PUZ(0:nlon,1:nlat,1:nlev)*(PQZ(0:
     .  nlon,1:nlat,1:nlev)-PQZ(1:nlon+1,1:nlat,1:nlev))
      t49(1:nlon+1,0:nlat+1,1:nlev) = p(1:nlon+1,0:nlat+1,1:nlev)+p(1:n
     .  lon+1,1:nlat+2,1:nlev)-p(1:nlon+1,0:nlat+1,2:nlev+1)-p(1:nlon+1
     .  ,1:nlat+2,2:nlev+1)
      t107(1:nlon,1:nlat+1,1:nlev) = 0.5*spread(hxv(1:nlon,0:nlat),3,nl
     .  ev)*t49(1:nlon,0:nlat,1:nlev)*PVZ(1:nlon,0:nlat,1:nlev)*(lnp(1:
     .  nlon,0:nlat,1:nlev)-lnp(1:nlon,1:nlat+1,1:nlev))
      t108(1:nlon,1:nlat+1,1:nlev) = t107(1:nlon,1:nlat+1,1:nlev)*(PTZ(
     .  1:nlon,0:nlat,1:nlev)*PQZ(1:nlon,0:nlat,1:nlev)+PTZ(1:nlon,1:nl
     .  at+1,1:nlev)*PQZ(1:nlon,1:nlat+1,1:nlev))
      t120(1:nlon,1:nlat+1,1:nlev) = 0.5*spread(hxv(1:nlon,0:nlat),3,nl
     .  ev)*t49(1:nlon,0:nlat,1:nlev)*PVZ(1:nlon,0:nlat,1:nlev)*(PTZ(1:
     .  nlon,0:nlat,1:nlev)-PTZ(1:nlon,1:nlat+1,1:nlev))
      t155(1:nlon,1:nlat+1,1:nlev) = 0.5*spread(hxv(1:nlon,0:nlat),3,nl
     .  ev)*t49(1:nlon,0:nlat,1:nlev)*PVZ(1:nlon,0:nlat,1:nlev)*(PQZ(1:
     .  nlon,0:nlat,1:nlev)-PQZ(1:nlon,1:nlat+1,1:nlev))
      t61(1:nlon+2,1:nlat+1,nlev+1) = 0
      DO 1080 k = nlev,1,-1
         t61(1:nlon+2,1:nlat+1,k) = t61(1:nlon+2,1:nlat+1,k+1)+t47(0:nl
     .  on+1,1:nlat+1,k)*PUZ(0:nlon+1,1:nlat+1,k)
1080  CONTINUE
      t61(1:nlon+2,1:nlat+1,1:nlev+1) = -0.5*t61(1:nlon+2,1:nlat+1,1:nl
     .  ev+1)
      t65(1:nlon+1,1:nlat+2,nlev+1) = 0
      DO 1090 k = nlev,1,-1
         t65(1:nlon+1,1:nlat+2,k) = t65(1:nlon+1,1:nlat+2,k+1)+t49(1:nl
     .  on+1,0:nlat+1,k)*PVZ(1:nlon+1,0:nlat+1,k)
1090  CONTINUE
      t65(1:nlon+1,1:nlat+2,1:nlev+1) = -0.5*t65(1:nlon+1,1:nlat+2,1:nl
     .  ev+1)
      t70(1:nlon+1,1:nlat+1,1:nlev+1) = 1.56961230576048E-7*((rdlam*(sp
     .  read(hyu(1:nlon+1,1:nlat+1),3,nlev+1)*t61(2:nlon+2,1:nlat+1,1:n
     .  lev+1)-spread(hyu(0:nlon,1:nlat+1),3,nlev+1)*t61(1:nlon+1,1:nla
     .  t+1,1:nlev+1))+rdth*(spread(hxv(1:nlon+1,1:nlat+1),3,nlev+1)*t6
     .  5(1:nlon+1,2:nlat+2,1:nlev+1)-spread(hxv(1:nlon+1,0:nlat),3,nle
     .  v+1)*t65(1:nlon+1,1:nlat+1,1:nlev+1)))/(spread(hxt(1:nlon+1,1:n
     .  lat+1),3,nlev+1)*spread(hyt(1:nlon+1,1:nlat+1),3,nlev+1)))
      PDPSDT(1:nlon+1,1:nlat+1) = -t70(1:nlon+1,1:nlat+1,1)
CMIC$ DO ALL
      DO 1100 k = 1,nlev
         etap(1:nlon+1,1:nlat+1,k) = t70(1:nlon+1,1:nlat+1,k)+PDPSDT(1:
     .  nlon+1,1:nlat+1)*(1-spread(spread(BHYB(k),2,nlat+1),1,nlon+1))
1100  CONTINUE
      t144(1:nlon,1:nlat,2:nlev) = etap(1:nlon,1:nlat,2:nlev)*(PTZ(1:nl
     .  on,1:nlat,1:nlev-1)-PTZ(1:nlon,1:nlat,2:nlev))
      t166(1:nlon,1:nlat,2:MAX(2,nlev)) = etap(1:nlon,1:nlat,2:MAX(2,nl
     .  ev))*(PQZ(1:nlon,1:nlat,2:MAX(2,nlev))-PQZ(1:nlon,1:nlat,1:MAX(
     .  2,nlev)-1))
CMIC$ DO ALL
      DO 1110 k = 1,nlev
CMIC$    DO ALL
         DO 1120 j = 1,nlat
CMIC$       DO ALL
            DO 1130 i = 1,nlon
               IF (nlev.LE.k) THEN
                  PDQDT(i,j,k) = (7.84806152880239E-8*((rdlam*((-t151(i
     .  ,j,nlev))-t151(i+1,j,nlev))+rdth*((-t155(i,j,nlev))-t155(i,j+1,
     .  nlev)))/(hxt(i,j)*hyt(i,j)))-0.5*t166(i,j,nlev))/(p(i,j,k+1)-p(
     .  i,j,k))
               ELSE IF (k.LE.1) THEN
                  PDQDT(i,j,k) = (7.84806152880239E-8*((rdlam*((-t151(i
     .  ,j,1))-t151(i+1,j,1))+rdth*((-t155(i,j,1))-t155(i,j+1,1)))/(hxt
     .  (i,j)*hyt(i,j)))-0.5*t166(i,j,2))/(p(i,j,k+1)-p(i,j,k))
               ELSE
                  PDQDT(i,j,k) = (7.84806152880239E-8*((rdlam*((-t151(i
     .  ,j,k))-t151(i+1,j,k))+rdth*((-t155(i,j,k))-t155(i,j+1,k)))/(hxt
     .  (i,j)*hyt(i,j)))-0.5*(t166(i,j,k)+t166(i,j,k+1)))/(p(i,j,k+1)-p
     .  (i,j,k))
               ENDIF
1130        CONTINUE
1120     CONTINUE
1110  CONTINUE
      t192(1:nlon,1:nlat,2:MAX(2,nlev)) = (PUZ(1:nlon,1:nlat,2:MAX(2,nl
     .  ev))-PUZ(1:nlon,1:nlat,1:MAX(2,nlev)-1))*(etap(1:nlon,1:nlat,2:
     .  MAX(2,nlev))+etap(2:nlon+1,1:nlat,2:MAX(2,nlev)))
      t219(1:nlon,1:nlat,2:MAX(2,nlev)) = (PVZ(1:nlon,1:nlat,2:MAX(2,nl
     .  ev))-PVZ(1:nlon,1:nlat,1:MAX(2,nlev)-1))*(etap(1:nlon,1:nlat,2:
     .  MAX(2,nlev))+etap(1:nlon,2:nlat+1,2:MAX(2,nlev)))
      t90(1:nlon+1,1:nlat,1:nlev) = t102(1:nlon+1,1:nlat,1:nlev)*(PTZ(0
     .  :nlon,1:nlat,1:nlev)*(1-PQZ(0:nlon,1:nlat,1:nlev))+PTZ(1:nlon+1
     .  ,1:nlat,1:nlev)*(1-PQZ(1:nlon+1,1:nlat,1:nlev)))
      t95(1:nlon,1:nlat+1,1:nlev) = t107(1:nlon,1:nlat+1,1:nlev)*(PTZ(1
     .  :nlon,0:nlat,1:nlev)*(1-PQZ(1:nlon,0:nlat,1:nlev))+PTZ(1:nlon,1
     .  :nlat+1,1:nlev)*(1-PQZ(1:nlon,1:nlat+1,1:nlev)))
CMIC$ DO ALL
      DO 1140 k = 1,nlev
CMIC$    DO ALL
         DO 1150 j = 1,nlat
CMIC$       DO ALL
            DO 1160 i = 1,nlon
               IF (k.LE.1) THEN
                  PDTDT(i,j,k) = (0.5*t144(i,j,2)+(1.55424620615724E-8*
     .  PTZ(i,j,k)*(1/(0.860825768434464*PQZ(i,j,1)+1)+0.60782469342251
     .  9*(PQZ(i,j,1)/(0.860825768434464*PQZ(i,j,1)+1)))*(rdlam*(hyu(i,
     .  j)*t47(i,j,1)*PUZ(i,j,1)-hyu(i-1,j)*t47(i-1,j,1)*PUZ(i-1,j,1))+
     .  rdth*(hxv(i,j)*t49(i,j,1)*PVZ(i,j,1)-hxv(i,j-1)*t49(i,j-1,1)*PV
     .  Z(i,j-1,1)))+7.84806152880239E-8*(rdlam*((-t116(i,j,1))-t116(i+
     .  1,j,1))+rdth*((-t120(i,j,1))-t120(i,j+1,1)))-0.285714285714286*
     .  ((3.92403076440119E-8*(rdlam*((-t90(i,j,1))-t90(i+1,j,1))+rdth*
     .  ((-t95(i,j,1))-t95(i,j+1,1)))+6.30915356075388E-8*(rdlam*((-t10
     .  3(i,j,1))-t103(i+1,j,1))+rdth*((-t108(i,j,1))-t108(i,j+1,1))))/
     .  (0.860825768434464*PQZ(i,j,1)+1)))/(hxt(i,j)*hyt(i,j)))/(p(i,j,
     .  k+1)-p(i,j,k))
               ELSE IF (nlev.LE.k) THEN
                  PDTDT(i,j,k) = (0.285714285714286*PTZ(i,j,k)*(7.84806
     .  152880239E-8*((t18(i,j,nlev)+t26(i,j,nlev))*(rdlam*(hyu(i,j)*t4
     .  7(i,j,nlev)*PUZ(i,j,nlev)-hyu(i-1,j)*t47(i-1,j,nlev)*PUZ(i-1,j,
     .  nlev))+rdth*(hxv(i,j)*t49(i,j,nlev)*PVZ(i,j,nlev)-hxv(i,j-1)*t4
     .  9(i,j-1,nlev)*PVZ(i,j-1,nlev)))/(hxt(i,j)*hyt(i,j)))-t18(i,j,nl
     .  ev)*(PDPSDT(i,j)+t70(i,j,nlev+1)))*(1/(0.860825768434464*PQZ(i,
     .  j,nlev)+1)+0.607824693422519*(PQZ(i,j,nlev)/(0.860825768434464*
     .  PQZ(i,j,nlev)+1)))+0.5*t144(i,j,nlev)+(7.84806152880239E-8*(rdl
     .  am*((-t116(i,j,nlev))-t116(i+1,j,nlev))+rdth*((-t120(i,j,nlev))
     .  -t120(i,j+1,nlev)))-0.285714285714286*((3.92403076440119E-8*(rd
     .  lam*((-t90(i,j,nlev))-t90(i+1,j,nlev))+rdth*((-t95(i,j,nlev))-t
     .  95(i,j+1,nlev)))+6.30915356075388E-8*(rdlam*((-t103(i,j,nlev))-
     .  t103(i+1,j,nlev))+rdth*((-t108(i,j,nlev))-t108(i,j+1,nlev))))/(
     .  0.860825768434464*PQZ(i,j,nlev)+1)))/(hxt(i,j)*hyt(i,j)))/(p(i,
     .  j,k+1)-p(i,j,k))
               ELSE
                  PDTDT(i,j,k) = (0.285714285714286*PTZ(i,j,k)*(7.84806
     .  152880239E-8*((t18(i,j,k)+t26(i,j,k))*(rdlam*(hyu(i,j)*t47(i,j,
     .  k)*PUZ(i,j,k)-hyu(i-1,j)*t47(i-1,j,k)*PUZ(i-1,j,k))+rdth*(hxv(i
     .  ,j)*t49(i,j,k)*PVZ(i,j,k)-hxv(i,j-1)*t49(i,j-1,k)*PVZ(i,j-1,k))
     .  )/(hxt(i,j)*hyt(i,j)))-t18(i,j,k)*(PDPSDT(i,j)+t70(i,j,k+1)))*(
     .  1/(0.860825768434464*PQZ(i,j,k)+1)+0.607824693422519*(PQZ(i,j,k
     .  )/(0.860825768434464*PQZ(i,j,k)+1)))+0.5*(t144(i,j,k)+t144(i,j,
     .  k+1))+(7.84806152880239E-8*(rdlam*((-t116(i,j,k))-t116(i+1,j,k)
     .  )+rdth*((-t120(i,j,k))-t120(i,j+1,k)))-0.285714285714286*((3.92
     .  403076440119E-8*(rdlam*((-t90(i,j,k))-t90(i+1,j,k))+rdth*((-t95
     .  (i,j,k))-t95(i,j+1,k)))+6.30915356075388E-8*(rdlam*((-t103(i,j,
     .  k))-t103(i+1,j,k))+rdth*((-t108(i,j,k))-t108(i,j+1,k))))/(0.860
     .  825768434464*PQZ(i,j,k)+1)))/(hxt(i,j)*hyt(i,j)))/(p(i,j,k+1)-p
     .  (i,j,k))
               ENDIF
1160        CONTINUE
1150     CONTINUE
1140  CONTINUE
CMIC$ DO ALL
      DO 1170 k = 1,nlev
CMIC$    DO ALL
         DO 1180 j = 1,nlat
CMIC$       DO ALL
            DO 1190 i = 1,nlon
               IF (nlev.LE.k) THEN
                  PDUDT(i,j,k) = 0.5*(t192(i,j,nlev)/t47(i,j,nlev))+(rd
     .  lam*(1.56961230576048E-7*(e(i,j,k)+phi(i,j,nlev)-e(i+1,j,k)-phi
     .  (i+1,j,nlev))+2.25270758122744E-5*(0.30391234671126*(PQZ(i,j,nl
     .  ev)+PQZ(i+1,j,nlev))+1)*(lnp(i,j,k)-lnp(i+1,j,k))*(PTZ(i,j,k)+P
     .  TZ(i+1,j,k)))-0.0625*(z(i,j,k)+z(i,j-1,k))*(hyv(i,j)*t49(i,j,nl
     .  ev)*PVZ(i,j,nlev)+hyv(i,j-1)*t49(i,j-1,nlev)*PVZ(i,j-1,nlev)+hy
     .  v(i+1,j)*t49(i+1,j,nlev)*PVZ(i+1,j,nlev)+hyv(i+1,j-1)*t49(i+1,j
     .  -1,nlev)*PVZ(i+1,j-1,nlev)))/hxu(i,j)
               ELSE IF (k.LE.1) THEN
                  PDUDT(i,j,k) = 0.5*(t192(i,j,2)/t47(i,j,1))+(rdlam*(1
     .  .56961230576048E-7*(e(i,j,k)+phi(i,j,1)-e(i+1,j,k)-phi(i+1,j,1)
     .  )+2.25270758122744E-5*(0.30391234671126*(PQZ(i,j,1)+PQZ(i+1,j,1
     .  ))+1)*(lnp(i,j,k)-lnp(i+1,j,k))*(PTZ(i,j,k)+PTZ(i+1,j,k)))-0.06
     .  25*(z(i,j,k)+z(i,j-1,k))*(hyv(i,j)*t49(i,j,1)*PVZ(i,j,1)+hyv(i,
     .  j-1)*t49(i,j-1,1)*PVZ(i,j-1,1)+hyv(i+1,j)*t49(i+1,j,1)*PVZ(i+1,
     .  j,1)+hyv(i+1,j-1)*t49(i+1,j-1,1)*PVZ(i+1,j-1,1)))/hxu(i,j)
               ELSE
                  PDUDT(i,j,k) = 0.5*((t192(i,j,k)+t192(i,j,k+1))/t47(i
     .  ,j,k))+(rdlam*(1.56961230576048E-7*(e(i,j,k)+phi(i,j,k)-e(i+1,j
     .  ,k)-phi(i+1,j,k))+2.25270758122744E-5*(0.30391234671126*(PQZ(i,
     .  j,k)+PQZ(i+1,j,k))+1)*(lnp(i,j,k)-lnp(i+1,j,k))*(PTZ(i,j,k)+PTZ
     .  (i+1,j,k)))-0.0625*(z(i,j,k)+z(i,j-1,k))*(hyv(i,j)*t49(i,j,k)*P
     .  VZ(i,j,k)+hyv(i,j-1)*t49(i,j-1,k)*PVZ(i,j-1,k)+hyv(i+1,j)*t49(i
     .  +1,j,k)*PVZ(i+1,j,k)+hyv(i+1,j-1)*t49(i+1,j-1,k)*PVZ(i+1,j-1,k)
     .  ))/hxu(i,j)
               ENDIF
1190        CONTINUE
1180     CONTINUE
1170  CONTINUE
CMIC$ DO ALL
      DO 1200 k = 1,nlev
CMIC$    DO ALL
         DO 1210 j = 1,nlat
CMIC$       DO ALL
            DO 1220 i = 1,nlon
               IF (nlev.LE.k) THEN
                  PDVDT(i,j,k) = 0.5*(t219(i,j,nlev)/t49(i,j,nlev))+(rd
     .  th*(1.56961230576048E-7*(e(i,j,k)+phi(i,j,nlev)-e(i,j+1,k)-phi(
     .  i,j+1,nlev))+2.25270758122744E-5*(0.30391234671126*(PQZ(i,j,nle
     .  v)+PQZ(i,j+1,nlev))+1)*(lnp(i,j,k)-lnp(i,j+1,k))*(PTZ(i,j,k)+PT
     .  Z(i,j+1,k)))+0.0625*(z(i,j,k)+z(i-1,j,k))*(hxu(i,j)*t47(i,j,nle
     .  v)*PUZ(i,j,nlev)+hxu(i,j+1)*t47(i,j+1,nlev)*PUZ(i,j+1,nlev)+hxu
     .  (i-1,j)*t47(i-1,j,nlev)*PUZ(i-1,j,nlev)+hxu(i-1,j+1)*t47(i-1,j+
     .  1,nlev)*PUZ(i-1,j+1,nlev)))/hyv(i,j)
               ELSE IF (k.LE.1) THEN
                  PDVDT(i,j,k) = 0.5*(t219(i,j,2)/t49(i,j,1))+(rdth*(1.
     .  56961230576048E-7*(e(i,j,k)+phi(i,j,1)-e(i,j+1,k)-phi(i,j+1,1))
     .  +2.25270758122744E-5*(0.30391234671126*(PQZ(i,j,1)+PQZ(i,j+1,1)
     .  )+1)*(lnp(i,j,k)-lnp(i,j+1,k))*(PTZ(i,j,k)+PTZ(i,j+1,k)))+0.062
     .  5*(z(i,j,k)+z(i-1,j,k))*(hxu(i,j)*t47(i,j,1)*PUZ(i,j,1)+hxu(i,j
     .  +1)*t47(i,j+1,1)*PUZ(i,j+1,1)+hxu(i-1,j)*t47(i-1,j,1)*PUZ(i-1,j
     .  ,1)+hxu(i-1,j+1)*t47(i-1,j+1,1)*PUZ(i-1,j+1,1)))/hyv(i,j)
               ELSE
                  PDVDT(i,j,k) = 0.5*((t219(i,j,k)+t219(i,j,k+1))/t49(i
     .  ,j,k))+(rdth*(1.56961230576048E-7*(e(i,j,k)+phi(i,j,k)-e(i,j+1,
     .  k)-phi(i,j+1,k))+2.25270758122744E-5*(0.30391234671126*(PQZ(i,j
     .  ,k)+PQZ(i,j+1,k))+1)*(lnp(i,j,k)-lnp(i,j+1,k))*(PTZ(i,j,k)+PTZ(
     .  i,j+1,k)))+0.0625*(z(i,j,k)+z(i-1,j,k))*(hxu(i,j)*t47(i,j,k)*PU
     .  Z(i,j,k)+hxu(i,j+1)*t47(i,j+1,k)*PUZ(i,j+1,k)+hxu(i-1,j)*t47(i-
     .  1,j,k)*PUZ(i-1,j,k)+hxu(i-1,j+1)*t47(i-1,j+1,k)*PUZ(i-1,j+1,k))
     .  )/hyv(i,j)
               ENDIF
1220        CONTINUE
1210     CONTINUE
1200  CONTINUE