C***********************************************************
C
      SUBROUTINE FOPEN ( IRUN )
C
C***********************************************************
C
C
      LOGICAL      IFLEX(100)
      CHARACTER*20 FNAME(100)
      CHARACTER*36 CNUM
      CHARACTER*4  FNIN
      CHARACTER*4  FNOUT
      CHARACTER*2  SNAME
C
C==========================================================
C
      CNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
C
      SNAME = 'T1'
C
C
      FNIN  = '@' // SNAME // CNUM(IRUN  :IRUN  )
      FNOUT = '@' // SNAME // CNUM(IRUN+1:IRUN+1)
C
C---------------------------------------------------------
C
C
C
      FNAME(31) = FNIN // '.TPOT.DATA'
      FNAME(32) = FNIN // '.TEMP.DATA'
      FNAME(33) = FNIN // '.TURB.DATA'
      FNAME(34) = FNIN // '.QRAD.DATA'
      FNAME(35) = FNIN // '.QDIF.DATA'
C
C
      IF ( IRUN .GT. 1 ) THEN
         DO 31 IR = 31, 35
         OPEN ( IR, FILE = FNAME(IR), STATUS = 'OLD' ,
     \           FORM='UNFORMATTED' )
   31    CONTINUE
      END IF
C
C---------------------------------------------------------
C
      FNAME(16) = FNOUT // '.VB.DATA'
C
      INQUIRE ( FILE = FNAME(16), EXIST = IFLEX(16) )
      IF ( IFLEX(16) ) THEN
         OPEN ( 16, FILE = FNAME(16), STATUS='OLD' )
         CLOSE ( 16, STATUS = 'DELETE' )
      END IF
C
      OPEN ( 16, FILE = FNAME(16), STATUS='NEW'  )
C
C---------------------------------------------------------
C
      FNAME(72) = FNOUT // '.TSFC.DATA'
C
      INQUIRE ( FILE = FNAME(72), EXIST = IFLEX(72) )
      IF ( IFLEX(72) ) THEN
         OPEN ( 72, FILE = FNAME(72), STATUS='OLD' )
         CLOSE ( 72, STATUS = 'DELETE' )
      END IF
C
      OPEN ( 72, FILE = FNAME(72), STATUS='NEW', FORM='UNFORMATTED' )
C
C---------------------------------------------------------
C
      FNAME(81) = FNOUT // '.TPOT.DATA'
      FNAME(82) = FNOUT // '.TEMP.DATA'
      FNAME(83) = FNOUT // '.TURB.DATA'
      FNAME(84) = FNOUT // '.QRAD.DATA'
      FNAME(85) = FNOUT // '.QDIF.DATA'
C
C
      DO 81 IW = 81, 85
C
      INQUIRE ( FILE = FNAME(IW), EXIST = IFLEX(IW) )
      IF ( IFLEX(IW) ) THEN
         OPEN ( IW, FILE = FNAME(IW), STATUS='OLD' )
         CLOSE ( IW, STATUS = 'DELETE' )
      END IF
C
      OPEN ( IW, FILE = FNAME(IW), STATUS='NEW', FORM='UNFORMATTED' )
C
   81 CONTINUE
C
C---------------------------------------------------------
C
      WRITE(6,*) 'IRUN=', IRUN
C
      ID = 16
      WRITE(6,*) 'DDNAME=', ID, 'FNAME=', FNAME(ID)
C
      ID = 72
      WRITE(6,*) 'DDNAME=', ID, 'FNAME=', FNAME(ID)
C
      DO 931 ID = 31, 35
      WRITE(6,*) 'DDNAME=', ID, 'FNAME=', FNAME(ID)
  931 CONTINUE
C
      DO 981 ID = 81, 85
      WRITE(6,*) 'DDNAME=', ID, 'FNAME=', FNAME(ID)
  981 CONTINUE
C
C--------------------------------------------------------
C
      RETURN
      END
