        subroutine SEDADV
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      include 'LOCAL1.INC'
      include 'LOCAL2.INC'
      include 'LOCAL3.INC'
        integer I, J, K
      do 170 J = 1, KOUNT
         if (TYPEG(J).eq.'B') go to 120
         SEDOUL(J) = WATOUL(J)*SEDCOL(J)
         do 110 I = 1, KOUNT
            do 100 K = 1, KCHEM
               if (TYPEG(I).ne.'B') SEDFL(I,J,K) = WATFL(I,J)*SEDCOL(J)
100         continue
110      continue
         go to 170
120      continue
         if (J-1) 140, 130, 140
130      continue
         write (TTYOUT(MACHNO),5000)
         go to 180
140      continue
         if (TYPEG(J-1).ne.'B') SEDOUL(J) = WATOUL(J)*SEDCOL(J)
         do 160 I = 1, KOUNT
            do 150 K = 1, KCHEM
               if (TYPEG(I).eq.'B'.and.iabs(J-I).gt.1) SEDFL(I,J,K) =
     &             WATFL(I,J)*SEDCOL(J)
150         continue
160      continue
170   continue
5000  format (1X,'The system elements have not been properly',' numbered
     &:'/1X,'segment 1 has been designated a benthic ','sediment.'/1X,'S
     &imulation aborted.')
      go to 190
180   continue
      IFLAG = 8
190   return
      end
