C
C
      SUBROUTINE  INIT (IPT)
C
C     ---------------------------------------------------------------
C
C       SUBROUTINE PURPOSE:
C       INITIATION OF DATA STORAGE ARRAYS BEFORE DYNAMIC SIMULATION OR
C     BEFORE EACH TIME INCREMENT.
C
C     ---------------------------------------------------------------
C
      INCLUDE 'CMMNW.DAT'
C
C     IPT=1: INITIATION OF ARRAYS BEFORE DYNAMIC SIMULATION, ONLY BEING
C            CALLED FOR ONCE.
C
      IF (IPT.EQ.1) THEN
         DO 30 I=1,NB
            RA(I)=R(I)
            TMRDA(I)=TMRD(I)
            IF (JS(I).LT.0) JS(I)=-JS(I)
            IF (JF(I).LT.0) JF(I)=-JF(I)
C
C     NSP(I): NUMBER OF STATIONS IN AIRWAY NO(I). AT THOSE STATIONS TEMP
C             CORR. FOR WET CASE IS TO BE CALCULATED. INCREASING THE
C             NUMBER OF STATIONS WILL GENERALLY IMPROVE ACCURACY WHILE
C             LONGER COMPUTING TIME WILL RESULT. THE CURRENT CRITERIA AR
C             (1) DISTANCE BETWEEN STATIONS IS LARGER THAN OF EQUAL TO
C             150 FT, (2) NUMBER OF STATIONS IN AN AIRWAY IS EQUAL TO
C             OR LESS THAN 5.
C
               NSP(I)=1
               DO 25 J=5,2,-1
                  IF (LA(I)/J.GE.150.0) THEN
                     NSP(I)=J
                     GO TO 30
                  ENDIF
25             CONTINUE
               IF (LA(I).GT.200.0) NSP(I)=2
30       CONTINUE
C
C       THE FLAG NUMBER OF AIRWAYS IN WHICH FIRE SOURCES EXIST ARE SET
C     TO 10 TO DISTINGUISH THEM FROM OTHERS. A FIRE SOURCE MUST BE
C     PRESENT IN A REGULAR AIRWAY, OTHERWISE THE FAN CHARACTERISTICS
C     IN THAT AIRWAY WILL BE IGNORED.
C
         DO 50 I=1,INFLOW
            DO 40 J=1,NB
               IF (NCENT(I).NE.NO(J)) GO TO 40
               NWTYP(J)=10
               GO TO 50
40          CONTINUE
50       CONTINUE
      ELSE
C
C     IPT>1: INITIATION OF ARRAYS BEFORE EACH TIME INCREMENT. A SET
C            OF BACKUP ARRAYS ARE USED TO ASSUME THE RESTORATION OF
C            INITIAL CONDITIONS IN EACH TIME INTERVAL.
C
         DO 70 I=1,NJ
            TAS(I)=T(I)
            PROPS(I)=PROP(I)
            PRCH4S(I)=PRCH4(I)
            PRH2OS(I)=PRH2O(I)
70       CONTINUE
         DO 80 I=1,NMZ
            FMASS(I)=-1.0
80       CONTINUE
         DO 90 I=1,INFLOW
            HTAD(I)=0.0
90       CONTINUE
         DO 100 I=1,NB
            IF (NNREV(I).EQ.(NNREV(I)/2)*2) THEN
               NREV(I)=0
            ELSE
               NREV(I)=1
            ENDIF
            TTJS(I)=TJS(I)
            TTRD(I)=TRD(I)
            RDOP(I)=RDPROP(I)
            RCH4(I)=RDCH4(I)
            RH2O(I)=RDH2O(I)
            FFRNVP(I)=FRNVP(I)
            QQ(I)=Q(I)
            QTP(I)=Q(I)
            QQ2(I)=Q(I)
100      CONTINUE
      ENDIF
C
      RETURN
      END
