      SUBROUTINE CNIGGE(WETRN,RC,SC,WETR,BK,TSCL,SV,AK, &
                        SVI,RATP0,IRDS,DRYR,DT,ILGA,LEVA,ISEC, &
                        IMOD1,IMOD2,IMOD3)
!-----------------------------------------------------------------------
!     PURPOSE:
!     --------
!     NUMERICAL INTEGRATION OF DROPLET GROWTH EQUATION BASED ON SCALED
!     VERSION OF DROPLET GROWTH EQUATION.
!
!     HISTORY:
!     --------
!     * AUG 11/2006 - K.VONSALZEN   NEW.
!
!-----------------------------------------------------------------------
!
      USE CNPARM
!
      IMPLICIT REAL (A-H,O-Z), INTEGER (I-N)
!
      LOGICAL, PARAMETER :: KOV=.FALSE.
      INTEGER, INTENT(IN) :: ILGA,LEVA,ISEC
      REAL, INTENT(IN), DIMENSION(ILGA,LEVA) :: DT,SV,SVI
      REAL, INTENT(IN), DIMENSION(ISEC) :: DRYR
      INTEGER, INTENT(IN), DIMENSION(ILGA,LEVA,ISEC) :: IRDS
      REAL, INTENT(IN), DIMENSION(ILGA,LEVA,ISEC) :: TSCL,RATP0
      REAL, INTENT(INOUT), DIMENSION(ILGA,LEVA) :: AK
      REAL, INTENT(INOUT), DIMENSION(ILGA,LEVA,ISEC) :: BK,WETR
      INTEGER, INTENT(INOUT), DIMENSION(ILGA,LEVA,ISEC) :: IMOD1,IMOD2, &
                                                           IMOD3
      REAL, INTENT(OUT), DIMENSION(ILGA,LEVA,ISEC) :: WETRN,RC,SC
      REAL, ALLOCATABLE, DIMENSION(:,:) :: AKT,SVE
      REAL, ALLOCATABLE, DIMENSION(:,:,:) :: WETRT,XP,XPN, &
                                             DU,BKT,BSP,SVT
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:) :: XPS,TPS
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:) :: IRS,IRGS,IBS
      LOGICAL, ALLOCATABLE, DIMENSION(:,:,:) :: KOP,KGR
      INTEGER, ALLOCATABLE, DIMENSION(:,:) :: IRSMAX
!
!-----------------------------------------------------------------------
!     * ALLOCATE TEMPORARY ARRAYS.
!
      ALLOCATE(WETRT (ILGA,LEVA,ISEC))
      ALLOCATE(BKT   (ILGA,LEVA,ISEC))
      ALLOCATE(BSP   (ILGA,LEVA,ISEC))
      ALLOCATE(XP    (ILGA,LEVA,ISEC))
      ALLOCATE(XPN   (ILGA,LEVA,ISEC))
      ALLOCATE(DU    (ILGA,LEVA,ISEC))
      ALLOCATE(SVT   (ILGA,LEVA,ISEC))
      ALLOCATE(KGR   (ILGA,LEVA,ISEC))
      ALLOCATE(KOP   (ILGA,LEVA,ISEC))
      ALLOCATE(IRS   (ILGA,LEVA,ISEC))
      ALLOCATE(IRGS  (ILGA,LEVA,ISEC))
      ALLOCATE(IBS   (ILGA,LEVA,ISEC))
      ALLOCATE(AKT   (ILGA,LEVA))
      ALLOCATE(SVE   (ILGA,LEVA))
      ALLOCATE(IRSMAX(LEVA,ISEC))
!
!-----------------------------------------------------------------------
!     * EFFECTIVE SUPERSATURATION VALUE FOR DROPLET GROWTH FROM
!     * WEIGHTING OF VALUE FOR CURRENT AND PREVIOUS MODEL TIME STEP.
!
!      WEIGH=0.1
      WEIGH=0.
      SVE=WEIGH*SVI+(1.-WEIGH)*SV
!
!     * DEFINE GROWTH REGIME AND CALCULATE KEY PARAMETERS.
!
      CALL CNEXTRP(WETRT,SVT,AKT,BKT,XP,RC,SC,KGR,BSP,IRS,IRSMAX, &
                   WETR,SVE,AK,BK,RATP0,IRDS,IRGS,IBS,ILGA,LEVA, &
                   ISEC,IRSTMAX,IMOD1,IMOD2,IMOD3)
!
!       * ALLOCATE SHARED ARRAYS THAT WILL CONTAIN THE SCALED PARTICLE
!       * SIZES AND GROWTH TIMES AFTER INTERPOLATION.
!
      ALLOCATE(XPS(ILGA,LEVA,ISEC,IRSTMAX))
      ALLOCATE(TPS(ILGA,LEVA,ISEC,IRSTMAX))
      XPS=YNA
      TPS=YNA
!
!     * EXTRACT CHARACTERISTIC GROWTH CURVE.
!
      CALL CNEXTR(BSP,XP,XPS,TPS,KOP,IRS,IRSMAX,IRDS,IRGS,IBS, &
                  ILGA,LEVA,ISEC,IRSTMAX)
!
!-----------------------------------------------------------------------
!     * ADJUST INITIAL PARTICLE SIZE AND SUPERSATURATION, IF INITIAL
!     * VALUES ARE OUTSIDE THE CONSIDERED DOMAIN.
!
      IF ( KOV ) THEN
        WETR=WETRT
        AK=AKT
        BK=BKT
      ENDIF
!
!     * NORMALIZED TIME INTERVAL FOR PARICLE GROWTH (DU).
!
      DO IS=1,ISEC
      DO L=1,LEVA
      DO IL=1,ILGA
        DU(IL,L,IS)=ABS(SVT(IL,L,IS))*DT(IL,L)/TSCL(IL,L,IS)
      ENDDO
      ENDDO
      ENDDO
!
!-----------------------------------------------------------------------
!     * WET PARTICLE SIZE.
!
      CALL CNRCAL(XPN,XP,DU,XPS,TPS,KOP,KGR,IRS,IRSMAX,ILGA, &
                  LEVA,ISEC,IRSTMAX)
      DO IS=1,ISEC
      DO L=1,LEVA
      DO IL=1,ILGA
        IF ( ABS(BK(IL,L,IS)-YNA) > YSMALL ) THEN
          WETRN(IL,L,IS)=SQRT(2.*XPN(IL,L,IS))
        ELSE
          WETRN(IL,L,IS)=DRYR(IS)
        ENDIF
      ENDDO
      ENDDO
      ENDDO
!
!-----------------------------------------------------------------------
!     * DEALLOCATE TEMPORARY ARRAYS.
!
      DEALLOCATE(XPS)
      DEALLOCATE(TPS)
      DEALLOCATE(WETRT)
      DEALLOCATE(BKT)
      DEALLOCATE(BSP)
      DEALLOCATE(XP)
      DEALLOCATE(XPN)
      DEALLOCATE(DU)
      DEALLOCATE(SVT)
      DEALLOCATE(KGR)
      DEALLOCATE(KOP)
      DEALLOCATE(IRS)
      DEALLOCATE(IRGS)
      DEALLOCATE(IBS)
      DEALLOCATE(AKT)
      DEALLOCATE(SVE)
      DEALLOCATE(IRSMAX)
!
      END SUBROUTINE CNIGGE
