C
C
      SUBROUTINE  DISP (MARKX,ISQC,IBB)
C
C     ------------------------------------------------------------------
C
C       SUBROUTINE PURPOSES:
C       1) DISCARDING THE TENTATIVELY OBTAINED DATA IN THE PREVIOUS
C          ITERATION TO AVOID UNNECESSARY RECORDS.
C       2) RESTORATION OF INITIAL CONDITIONS EXCEPT FOR AIRFLOW RATES.
C
C     ------------------------------------------------------------------
C
      INCLUDE 'CMMNW.DAT'
C
C  ** ABANDON THE DATA FOR AIRWAYS WHICH GOT THEIR DETAILED DATA RECORDS
C     IN THE PREVIOUS ITERATION.
C
      DO 40 LRW=1,NB
         IF (IBTN(LRW).GT.0.AND.NSACB(LRW,1).EQ.0) THEN
            ISQCX=IBTN(LRW)
            DO 5 IX=ISQCX,ISQC
               DO 5 IY=1,NB
                  IF (IBTN(IY).EQ.IX) NSEQE(IX)=NSEQE(IX+1)-NSP(IY)
                  IF (NSEQE(IX).LT.0) NSEQE(IX)=0
5           CONTINUE
            DO 10 IV=1,NB
               IF (IBTN(IV).GE.ISQCX) THEN
                  IBTN(IV)=IBTN(IV)-1
               ENDIF
10          CONTINUE
            DO 20 IV=ISQCX,ISQC
               TAUXC(IV)=TAUXC(IV+1)
               DO 20 IU=1,10
                  IF (NHM.GT.0) THEN
                     STV(IV,IU)=STV(IV+1,IU)
                     HABS(IV,IU)=HABS(IV+1,IU)
                     TDA(IV,IU)=TDA(IV+1,IU)
                     WMTR(IV,IU)=WMTR(IV+1,IU)
                  ENDIF
                  TAUXA(IV,IU)=TAUXA(IV+1,IU)
                  DO 20 IW=1,5
                     DPPA(IV,IU,IW)=DPPA(IV+1,IU,IW)
20          CONTINUE
            IBTN(LRW)=0
            NSAC(LRW,1)=0
            NSAC(LRW,2)=0
            ISQC=ISQC-1
         ENDIF
40    CONTINUE
C
C  ** RESTORATION OF INITIAL CONDITIONS FOR THE PRESENT TIME INTERVAL
C     EXCEPT FOR AIRFLOW DISTRIBUTION.
C
      DO 60 I=1,NB
         TJS(I)=TTJS(I)
         TRD(I)=TTRD(I)
         RDPROP(I)=RDOP(I)
         RDCH4(I)=RCH4(I)
         RDH2O(I)=RH2O(I)
C
C     Q(I): AIRFLOW RATE IN AIRWAY NO(I) AT THE END OF THE PRESENT
C           INTERVAL.
C     QTP(I): INITIAL AIRFLOW RATE IN AIRWAY NO(I), CONSTANT WITHIN
C             EACH TIME INCREMENT.
C     QQ(I): TIME AVERAGED AIRFLOW RATE IN AIRWAY NO(I).
C
         QQA=0.55*Q(I)+0.45*QTP(I)
         QQ(I)=0.85*QQA+0.15*QQ(I)
         QQA2=0.55*ABS(Q(I))+0.45*ABS(QTP(I))
C        ====================================
         QQ2(I)=0.85*ABS(QQA2)+0.15*ABS(QQ(I))
C        =====================================
         NSAC(I,1)=NSACB(I,1)
         NSAC(I,2)=NSACB(I,2)
         IQ=IBTN(I)
         IF (IQ.GT.0) THEN
            TAUXC(IQ)=TAUXD(IQ)
            DO 50 J=1,10
               TAUXA(IQ,J)=TAUXB(IQ,J)
               DO 50 JJ=1,5
                  DPPA(IQ,J,JJ)=DPPB(IQ,J,JJ)
50          CONTINUE
         ENDIF
60    CONTINUE
      DO 65 I=1,NJ
         T(I)=TAS(I)
         PROP(I)=PROPS(I)
         PRCH4(I)=PRCH4S(I)
         PRH2O(I)=PRH2OS(I)
65    CONTINUE
      DO 70 I=1,IMX
         HTAD(I)=0.0
70    CONTINUE
      IBB=0
      CALL BASE (NSTOP)
      CALL MSLIST
C
      RETURN
      END
