C***********************************************************
C***********************************************************
C
      SUBROUTINE  ADDIF1
     I   (   QADV,
     I       UFLX, WFLX,
     I       CD1 ,
     I       IAD, IDF,
     W       FLQX , FLQZ ,
     O       DTQADV, DTQDIF,
     B       DENS0,
     G       DX, FDZ, FDZM,
     D       NX, NZ, NXB, NZB, NROT )
C
C***********************************************************
      IMPLICIT REAL*8 ( A-H, O-Z )
C***********************************************************
C
      DIMENSION
     \     QADV ( -2:NXB, -2:NZB, NROT ),
     \     DTQADV( -2:NXB, -2:NZB ),
     \     DTQDIF( -2:NXB, -2:NZB ),
     \     UFLX ( -2:NXB, -2:NZB ),
     \     WFLX ( -2:NXB, -2:NZB ),
     \     FLQX ( -2:NXB, -2:NZB ),
     \     FLQZ ( -2:NXB, -2:NZB ),
     \     CD1  ( -2:NXB, -2:NZB )
C
      DIMENSION
     \     DENS0( -2:NZB ),
     \     FDZ ( -2:NZB ),
     \     FDZM( -2:NZB )
C
C===========================================================
C
      DO 101 IZ = 0, NZ-1
      DO 101 IX = 1, NX
         FLQX(IX,IZ) =   UFLX(IX,IZ) / 16.0D0
     \  * (   9.0D0 * ( QADV(IX-1,IZ,IAD) + QADV(IX  ,IZ,IAD) )
     \      -         ( QADV(IX-2,IZ,IAD) + QADV(IX+1,IZ,IAD) ) )
         FLQZ(IX,IZ) =   WFLX(IX,IZ) / 16.0D0
     \  * (   9.0D0 * ( QADV(IX,IZ-1,IAD) + QADV(IX,IZ  ,IAD) )
     \      -         ( QADV(IX,IZ-2,IAD) + QADV(IX,IZ+1,IAD) ) )
  101 CONTINUE

      do 102 ix = 1, nx
         flqz(ix,nz) = 0.0d0
 102  continue
C
      CALL BOUND ( FLQX, NX, NZ, NXB, NZB, 1, 1, 1, 1 )
      CALL BOUND ( FLQZ, NX, NZ, NXB, NZB, 1,-1, 0, 1 )
C
C
      DO 11 IZ = 0, NZ-1
      DO 11 IX = 1, NX
C
         DTQADV(IX,IZ) =
     \     (  - 1.125D0 * ( FLQX(IX+1,IZ) - FLQX(IX  ,IZ) )
     \        + 0.125D0 * ( FLQX(IX+2,IZ) - FLQX(IX-1,IZ) ) / 3.0D0
     \        - 1.125D0 * ( FLQZ(IX,IZ+1) - FLQZ(IX,IZ  ) )
     \        + 0.125D0 * ( FLQZ(IX,IZ+2) - FLQZ(IX,IZ-1) ) / 3.0D0 )
     \    / DENS0(IZ) / FDZ(IZ) / DX
C
   11 CONTINUE
C
      CALL BOUND ( DTQADV, NX, NZ, NXB, NZB, 1, 1, 1, 1 )
C
C --------------------------------------------------------------------
C     DIFFUSION TERM
C --------------------------------------------------------------------
C
      DO 31 IZ = 0, NZ-1
      DO 31 IX = 1, NX
C
         DQDIFX = 1.0d0 / DX **2
     \    * (    ( CD1(IX+1,IZ) + CD1(IX+1,IZ+1) ) / 2.0D0
     \         * ( QADV(IX+1,IZ,IDF) - QADV(IX,IZ,IDF) )
     \        -  ( CD1(IX  ,IZ) + CD1(IX  ,IZ+1) ) / 2.0D0
     \         * ( QADV(IX,IZ,IDF) - QADV(IX-1,IZ,IDF) )     )
C
         DQDIFZ =
     \    (  ( DENS0(IZ+1) + DENS0(IZ) ) / 2.0D0 / DX**2
     \         *   ( CD1(IX+1,IZ+1) + CD1(IX,IZ+1) ) / 2.0D0
     \         * ( QADV(IX,IZ+1,IDF) - QADV(IX,IZ,IDF) ) / FDZM(IZ+1)
     \     - ( DENS0(IZ-1) + DENS0(IZ) ) / 2.0D0 / DX**2
     \         *   ( CD1(IX+1,IZ  ) + CD1(IX  ,IZ) ) / 2.0D0
     \         * ( QADV(IX,IZ,IDF) - QADV(IX,IZ-1,IDF) ) / FDZM(IZ) )
     \    / DENS0(IZ) / FDZ(IZ)
C
         DTQDIF(IX,IZ) = DQDIFX + DQDIFZ
C
   31 CONTINUE
C
      CALL BOUND( DTQDIF, NX, NZ, NXB, NZB, 1, 1, 1, 1 )
C
C================================================================
C
      RETURN
      E N D
