      SUBROUTINE FILL(LEN, LENC, KM, PII, QOI, CNV, DSG, FIL
Status: R

     *,                                   TX1, TX2, TX3, DT)
C
C
C
C*********************************************************************
C*********************** ARIES   MODEL *******************************
C********************* SUBROUTINE  FILL  *****************************
C********************** 16 MARCH   1988 ******************************
C*********************************************************************
C
C
      PARAMETER (ZERO=0.0, ONE=1.0, DAYLEN=86400.0)
      DIMENSION  PII(LEN), QOI(LEN,KM), TX1(LENC), CNV(KM), DSG(KM)
      DIMENSION  IA(LENC), TX2(LENC), TX3(LENC)
      DIMENSION  FIL(LEN)
C
C     FILL NEGATIVE VALUES OF Q
C
      KMM1 = KM - 1
      DO 100 L=1,KMM1
      LENA = 0
      DO 10 I=1,LENC
      IF (QOI(I,L) .LT. ZERO) THEN
         LENA = LENA + 1
         IA (LENA) = I
         TX1(LENA) = QOI(I,L)
      ENDIF
10    CONTINUE
C
      IF (LENA .LE. 0) GO TO 100
C
      DO 30 I=1,LENA
      II = IA(I)
      TX2(I) = QOI(II,L)   - TX1(I)
      TX3(I) = QOI(II,L+1) + TX1(I)*(DSG(L)/DSG(L+1))
C
30    CONTINUE
      DO 35 I=1,LENA
      II = IA(I)
      QOI(II,L)   = TX2(I)
      QOI(II,L+1) = TX3(I)
C
35    CONTINUE
100   CONTINUE
C
      LENA = 0
      DO 110 I=1,LENC
      IF (QOI(I,KM) .LT. ZERO) THEN
         LENA = LENA + 1
         IA (LENA) = I
         TX1(LENA) = QOI(I,KM)
      ENDIF
110   CONTINUE
      IF (LENA .EQ. 0) RETURN
C
      DO 130 I=1,LENA
      II = IA(I)
      TX2(I) = QOI(II,KM) - TX1(I)
      TX1(I) = FIL(II) - TX1(I) * PII(II) * (CNV(KM)*DAYLEN/DT)
130   CONTINUE
      DO 140 I=1,LENA
      II = IA(I)
      QOI(II,KM) = TX2(I)
      FIL(II)    = TX1(I)
140   CONTINUE
C
      RETURN
      END

