C
C
      SUBROUTINE  RECIRC (MRC,JUMPBK,NSTART,L)
C
C     ------------------------------------------------------------------
C
C       SUBROUTINE PURPOSE:
C       EVALUATION OF AIR TEMP., CONTAMINANT CONTENT AT AIRWAY ENDINGS
C     UNDER RECIRCULATION CONDITIONS.
C
C     ------------------------------------------------------------------
C
      INCLUDE 'CMMNW.DAT'
C
      NREC=1
10    L=0
      DO 60 I=1,NJ
         IF (JNO(I).LE.0) THEN
C
C       JUNCTION JNO(I) IS COMPLETED WITH THE NECESSARY CALCULATIONS
C     IF JNO(I)<0.
C
            L=L+1
         ELSE
            N=0
            M=0
            SRPR=0.0
            SRCH4=0.0
            STRD=0.0
            QIN=0.0
            QREC=0.0
            DO 20 J=1,NB
               IF (JNO(I).EQ.(-JF(J))) THEN
C
C     AIRWAY NO(J) IS COMPLETED WITH NECESSARY CALCULATIONS.
C
                  N=N+1
                  SRPR=SRPR+RDPROP(J)*Q(J)
                  SRCH4=SRCH4+RDCH4(J)
                  STRD=STRD+TRD(J)
                  QIN=QIN+Q(J)
               ELSE IF (JNO(I).EQ.JF(J)) THEN
C
C       JF(J)>0 INDICATES THAT THE CALCULATION FOR AIRWAY NO(J) HAS
C     NOT BEEN COMPLETED.
C     MEMREC: TEMPORARY LIST OF AIRWAYS CARRYING RECIRC. AIR.
C
                  M=M+1
                  MEMREC(M)=J
                  QREC=QREC+Q(J)
               ENDIF
20          CONTINUE
            IF (N.LE.0) GO TO 60
            AVRPR=SRPR/QIN
            AVRCH4=SRCH4/N
            AVTRD=STRD/N
C
C       NREC SERVES AS FILTER TO FIND OUT THE JUNCTION WHICH HAS THE
C     LEAST NON-ZERO CIRCULATING TO UNCIRCULATING AIRFLOW RATIO.
C
            IF ((QREC*2.0/QIN).LE.NREC) THEN
               DO 30 L=1,M
                  MRC=MRC+1
                  K=MEMREC(L)
                  NOREC(MRC)=K
                  ESTPR(MRC)=AVRPR
                  RDPROP(K)=ESTPR(MRC)
                  ESTCH4(MRC)=AVRCH4
                  RDCH4(K)=ESTCH4(MRC)
                  ESTTR(MRC)=AVTRD
                  TRD(K)=ESTTR(MRC)
                  JF(K)=-JF(K)
30             CONTINUE
               CALL CDJUNC (NSTART,JUMPBK,L,I,1)
               RETURN
            ENDIF
         ENDIF
60    CONTINUE
      IF (L.LT.NJ) THEN
         NREC=NREC+1
         GO TO 10
      ENDIF
C
      RETURN
      END

