       SUBROUTINE CNSLD(NRM,ID,N,NELI,NEL)
C
C  CONSOLIDATE ENCLOSURE ELEMENTS (CALLED BY CONSLD)
C  NRM  ZONE NO.
C  ID   IDEXP VALUE
C  N    NO. OF ENCLOSURE ELEMENTS TO CONSOLIDATE INTO FIRST ELEMENT
C  NELI NL INDICE OF NEL ARRAY FOR EACH N ELEMENTS
C  NEL  ENCLOSURE SEQUENCE NOL. (K2 VALUE -- SEE CONSLD(FIRST PAGE))
C
C - - - CONSTANTS
CMDK NKONST
CMDK NWL
CMDK NWN
CMDK NWZN
CMDK NZW
CMDK NZN
      PARAMETER (NLMX=10)
C      NOTE::  IF NLMX NEEDS CHANGING, CHANGE IT IN CONSLD ALSO!      
C - - - -COMMON BLOCKS
CMDK CNSTRK
CMDK ENCBK1
CMDK ENCBLK
CMDK SURFAR
CMDK WNDBLK
C
      DIMENSION KONI(NLMX),NLMPI(NLMX),AR(NLMX),ARAT(NLMX),NELI(NLMX),
     +          NEL(10,NLMX),KONQ(NLMX),NENQ(NLMX),IZWPR(NLMX)
      IF(N.GT.NLMX)STOP 'CNSLF: N GT NLMX'
      IDBG=0
C
C  GET AREA RATIOS FOR WEIGHTING
      AREAT=0.
      DO 10 I=1,N
      NL=NELI(I)
      K2=NEL(ID,NL)
      IZW=NENC(NRM,K2)
      IZWPR(I)=IZW
      AR(I)=AWALLA(IZW)
      AREAT=AREAT+AR(I)
   10 CONTINUE
      WRITE(60,*)' BELOW IS A LIST OF IZW ELEMENTS THAT ARE BEING',
     +          ' CONSOLIDATED INTO 1ST ELEMENT'
      WRITE(60,*) (IZWPR(I),I=1,N)
      WRITE(60,*)' '
C
      DO 20 I=1,N
      ARAT(I)=AR(I)/AREAT
   20 CONTINUE
      IF(IDBG.NE.0)WRITE(60,510)(ARAT(I),I=1,N)
C
C  CHECK TO SEE IF ALL ELEMENTS HAVE SAME CONSTRUCT NO.  IF SO,
C  A NEW COMPOSITE CONSTRUCT NO. DOES NOT HAVE TO BE GENERATED.
      DO 30 I=1,N
      NL=NELI(I)
      K2=NEL(ID,NL)
      IZW=NENC(NRM,K2)
      KON=KONSTA(IZW)
      KONI(I)=KON
      NLMPI(I)=NLMP(KON)
   30 CONTINUE
      NLM=NLMPI(1)
      KON=KONI(1)
      KONSV=KON
      IFG=0
C
      DO 40 I=2,N
      IF(KON.NE.KONI(I))IFG=1
   40 CONTINUE
      IF(IFG.EQ.0)GO TO 52
C  A NEW CONSTRUCT MUST BE GENERATED
C
C  PROPERTIES FOR NEW CONSTRUCT WILL BE WEIGHTED BY AREA
C
C  NOW CREATE A NEW CONSTRUCT
      NCONS=NCONS+1
      KONSV=NCONS
      IF(NCONS.GT.NKONST)STOP 'CNSLD:MUST INCR NO. OF CONSTRCTS,NKONST'
      IF(IDBG.NE.0)WRITE(60,508)NCONS
      IF(IDBG.NE.0)WRITE(60,507)NLM
      NLMP(NCONS)=NLM
C  SET IFXL ARRAY
      DO 42 I=1,4
      IFXL(I,KONSV)=IFXL(I,KON)
   42 CONTINUE
C
      DO 50 J=1,NLM
      WK(J,NCONS)=0.
      WX(J,NCONS)=0.
      WRHO(J,NCONS)=0.
      WCP(J,NCONS)=0.
C
      DO 50 I=1,N
      NL=NELI(I)
      K2=NEL(ID,NL)
      IZW=NENC(NRM,K2)
      KON=KONSTA(IZW)
      WKI=WK(J,KON)
      WXI=WX(J,KON)
      WRHOI=WRHO(J,KON)
      WCPI=WCP(J,KON)
      KONQ(I)=KON
      WK(J,NCONS)=WK(J,NCONS)+ARAT(I)*WKI
      WX(J,NCONS)=WX(J,NCONS)+ARAT(I)*WXI
      WRHO(J,NCONS)=WRHO(J,NCONS)+ARAT(I)*WRHOI
      WCP(J,NCONS)=WCP(J,NCONS)+ARAT(I)*WCPI
      IF(IDBG.NE.0)WRITE(60,509)J,NRM,IZW,WKI,WXI,WRHOI,WCPI
   50 CONTINUE
      IF(IDBG.NE.0)WRITE(60,501)NRM,ID,(KONQ(I),I=1,N)
      IF(IDBG.NE.0)WRITE(60,502)NCONS
C
C  WEIGHT OR SUM OTHER VALUES FOR THIS CONSOLIDATED ENCLOSURE ELEMENT
   52 NL=NELI(1)
      K2=NEL(ID,NL)
      IZW=NENC(NRM,K2)
      IF(IDBG.NE.0)WRITE(60,511)NRM,IZW,KONSV
      DO 54 J=1,NLM
      IF(IDBG.NE.0)THEN
      WRITE(60,512)J,WK(J,KONSV),WX(J,KONSV),WRHO(J,KONSV),WCP(J,KONSV)
          ENDIF
   54 CONTINUE
      IZWSV=IZW
      NENCS=IZW
      HGT=HGTA(IZW)
      NZON=NZNC(IZW)-8
      HHANG=HHANGA(IZW)
      SLEN=0.
      SAWALA=0.
      SALEAK=0.
      SWDLEK=0.
      SHNPL=0.
      WALFI=0.
      WALFO=WALLFO(IZW)
      OHG=OHANGA(IZW)
C
      NNU=0
      DO 60 I=1,N
      NL=NELI(I)
      K2=NEL(ID,NL)
      NENQ(I)=NENC(NRM,K2)
      IZW=NENQ(I)
C  HEIGHT OF COMPOSITE ENCLOSURE WILL BE KEPT THE SAME FOR COMPOSITE
C     AS FOR FIRST ENCLOSURE, SO MUST SCALE LENGTHS WITH HEIGHT RATIOS
      SLEN=SLEN+XLENA(IZW)*HGTA(IZW)/HGT
      SAWALA=SAWALA+AWALLA(IZW)
      IF(ID.NE.5.AND.ID.NE.6.AND.NZON.NE.NRM)THEN
C      INCREASE WIDTH BUT NOT HEIGHT OF LEAKAGE AREA
          SALEAK=SALEAK+WDLEAK(IZW)*HGTLEAK(IZW)
          SWDLEK=SWDLEK+WDLEAK(IZW)
          SHNPL=SHNPL+HNPL(IZW)
          NNU=NNU+1
          ENDIF
      WALFI=WALFI+ARAT(I)*WALLFI(IZW)
   60 CONTINUE
      IF(IDBG.NE.0)WRITE(60,503)(NENQ(I),I=1,N)
      IF(IDBG.NE.0)WRITE(60,504)NENCS
C
C  NOW OVERWRITE FIRST ENCLOSURE IN THIS IDEXP SECTION WITH COMPOSITE
C         ENCLOSURE VALUES
      KONSTA(IZWSV)=KONSV
      XLENA(IZWSV)=SLEN
      AWALLA(IZWSV)=SAWALA
      IF(ID.NE.5.AND.ID.NE.6.AND.NZON.NE.NRM)THEN
        WDLEAK(IZWSV)=SWDLEK/NNU
        IF(WDLEAK(IZWSV).EQ.0.)THEN
          HGTLEAK(IZWSV)=0.
        ELSE
          HGTLEAK(IZWSV)=SALEAK/WDLEAK(IZWSV)
        ENDIF
        HNPL(IZWSV)=SHNPL/NNU
      ENDIF
      WALLFI(IZWSV)=WALFI
      WALLFO(IZWSV)=WALFO
      HHANGA(IZWSV)=HHANG
      IF(ID.LE.4)THEN
          OHANGA(IZWSV)=OHG
C
C  RESET INDICE OF ALL WINDOWS IN COMPOSITE WALL TO INDICE
C    OF WINDOWS IN FIRST ENCLOSURE ELEMENT
C
C     FIND NO. OF WINDOWS IN FIRST ENCLOSURE ELEMENT
          NWI=NWNDA(IZWSV)
C     NOW ADD VALUES FOR WINDOWS IN OTHER ENCLOSURE ELEMENTS
C     TO ARRAYS FOR WINDOWS IN FIRST ELEMENT
          DO 70 I=2,N
          NL=NELI(I)
          K2=NEL(ID,NL)
          IZW=NENC(NRM,K2)
          NW=NWNDA(IZW)
          IF(NW.GT.0)THEN
              NWNDA(IZWSV)=NWNDA(IZWSV)+NW
              DO 62 K4=1,NW
              NWI=NWI+1
              IF(NWI.GT.NWZN)STOP 'CNSLD: NWZN MUST BE INCR'
C      NOTE: NIWND WINDOW ARRAY MUST BE ENLARGED TO HANDLE THESE
C            ADDITIONAL VALUES IN FIRST ENCLOSURE ELEMENT
              NI=NIWND(IZW,K4)
              NIWND(IZWSV,NWI)=NI
   62         CONTINUE
              ENDIF
   70     CONTINUE
          ENDIF
C
   80 CONTINUE
      RETURN
  501 FORMAT('0 IN ZONE= ',I3,' WITH ENCLOSURE ORIENTATION(ID)= ',I3,
     +', CONSTRUCTS= ',10I3)
  502 FORMAT('  WERE CONSOLIDATED INTO CONSTRUCT= ',I5/)
  503 FORMAT('0 ENCLOSURE ELEMENTS ',10I3)
  504 FORMAT('  WERE CONSOLIDATED INTO ENCLOSURE ELEMENT= ',I3)
  507 FORMAT(1X,'NLMPS FOR NEW CONSTRUCT= ',I5)
  508 FORMAT(1H0,' - - - - - NEW CONSTRUCT BEING PREPARED!!!  NO.=',
     +I5)
  509 FORMAT(1X,'CNSLD:FOR LUMP= ',I3,'   ZONE= ',I3,'  ENCL NO.= ',
     +I5/8X,'K,DX,RHO,CP= ',4G13.5)
  510 FORMAT(1H0,'CNSLD:AREA RATIOS= ',10F10.4)
  511 FORMAT(1X,'CNSLD:CONSOLIDATED CONSTRUCT VALUES FOR ZONE ',I3,
     +' ENCL.NO.= ',I3,' CONSTRUCT NO.= ',I3)
  512 FORMAT(1X,'LUMP NO.=',I4,'  K,DX,RHO,CP= ',4G13.5)
      END
