C***********************************************************
C***********************************************************
C
      SUBROUTINE  FARAIN2
     I   (  QRAI ,
     I      DTI  , ICALC ,
     M      QRAI1,
     W      DQFILL, QSUMPN,
     O      VRFALL, FXRAIN, FWPREC,
     B      DENS0,
     G      DX   , FDZ  ,
     D      NX, NZ, NXB, NZB, NROT )
C
C***********************************************************
      IMPLICIT REAL*8 ( A-H, O-Z )
C***********************************************************
C
      DIMENSION
     \   QRAI  ( -2:NXB, -2:NZB, NROT ),
     \   QRAI1 ( -2:NXB, -2:NZB ),
     \   VRFALL( -2:NXB, -2:NZB ),
     \   FXRAIN( -2:NXB, -2:NZB ),
     \   DQFILL( -2:NXB, -2:NZB ),
     \   QSUMPN( -2:NXB, -2:NZB )
C
      DIMENSION
     \   FWPREC( -2:NXB,2 )
C
      DIMENSION
     \   DENS0( -2:NZB ),
     \   FDZ ( -2:NZB )
C
C===========================================================
C
      CFRAIN = 12.2
C
      DO 11 IZ = 0, NZ
      DO 11 IX = 1, NX
         VRFALL(IX,IZ) = CFRAIN *
     \     (   ( DENS0(IZ) + DENS0(IZ-1) ) / 2.0D0
     \       * (  MAX( 0.0D0, QRAI(IX,IZ-1,ICALC) )
     \          + MAX( 0.0D0, QRAI(IX,IZ,ICALC) ) ) / 2.0D0 ) ** 0.125
   11 CONTINUE
C
      CALL BOUND ( VRFALL, NX, NZ, NXB, NZB, 1, 1, 0, 1 )
C
C
      DO 12 IZ = 0, NZ
      DO 12 IX = 1, NX
         FXRAIN(IX,IZ) =   VRFALL(IX,IZ)
     \      * ( QRAI(IX,IZ,ICALC) + QRAI(IX,IZ-1,ICALC) ) / 2.0D0
     \      * ( DENS0(IZ) + DENS0(IZ-1) ) / 2.0D0
   12 CONTINUE
C
      CALL BOUND ( FXRAIN, NX, NZ, NXB, NZB, 1,-1, 0, 1 )
C
      DO 121 IX = -2, NXB
         FXRAIN(IX,0) = 0.0D0
         FXRAIN(IX,NZ) = 0.0D0
  121 CONTINUE
C
      DO 21 IZ = 0, NZ-1
      DO 21 IX = 1, NX
         QRAI1(IX,IZ) = QRAI1(IX,IZ)
     \     + DTI / DX / FDZ(IZ) / DENS0(IZ)
     \        * ( 9.0D0 *( FXRAIN(IX,IZ+1) - FXRAIN(IX,IZ  ) )/8.0D0
     \            -      ( FXRAIN(IX,IZ+2) - FXRAIN(IX,IZ-1) )/24.0D0 )
   21 CONTINUE
C
      CALL BOUND ( QRAI1, NX, NZ, NXB, NZB, 1, 1, 1, 1 )
C
C
      CALL QNFILL
     I   ( QRAI1, 1,
     O     DQFILL,
     W     QSUMPN,
     B     DENS0, FDZ,
     D     NX, NZ, NXB, NZB, 1 )
C
      DO 22 IX = 1, NX
         QRAI1(IX,-1) = QRAI1(IX,0)
   22 CONTINUE
C
C
      DO 23 IX = 1, NX
         QRAI1(IX,0) = MIN ( QRAI1(IX,1), MAX( 0.0D0,
     \      (  MAX( 0.0D0, QRAI1(IX,2) )
     \       + (MAX(0.0D0,QRAI1(IX,1) ) - MAX(0.0D0, QRAI1(IX,3)) )
     \       + 2.0D0 * (   MAX ( 0.0D0, QRAI1(IX,1) )
     \                   + MAX ( 0.0D0, QRAI1(IX,3) )
     \               - 2.0D0 * MAX ( 0.0D0, QRAI1(IX,2) )  ))  )  )
         QRAI1(IX,NZ-1) =  0.0D0
   23 CONTINUE
C
      DO 24 IX = 1, NX
         FWPREC(IX,1) =   ( QRAI1(IX,-1)-QRAI1(IX,0) )
     \                * DX * DENS0(0) * FDZ(0)

         FWPREC(IX,2) = 0.0d0

   24 CONTINUE
C
      CALL BOUND ( QRAI1, NX, NZ, NXB, NZB, 1, 1, 1, 1 )
C
C============================================================
C
      RETURN
      E N D
