homere_partel.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\utils\partel\homere_partel.f
00002 !
00051                      PROGRAM HOMERE_PARTEL
00052 !                    **************
00053 !
00054 !
00055 !***********************************************************************
00056 ! PARALLEL   V6P2                                   21/08/2010
00057 !***********************************************************************
00058 !
00059 !
00060 !
00061 !
00062 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00063 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00064 !
00065       USE DECLARATIONS_PARTEL
00066       IMPLICIT NONE
00067 !
00068       INTEGER :: LNG,LU,LI
00069       COMMON /INFO/ LNG,LU,LI
00070 !
00071 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00072 !
00073       LOGICAL :: FOUND
00074       CHARACTER(LEN=MAXLENHARD) :: NAMEINP
00075       CHARACTER(LEN=MAXLENHARD) :: NAMECLI
00076       INTEGER :: NPARTS
00077       INTEGER :: PMETHOD
00078       LOGICAL :: WITH_SECTIONS, DONE_SECTIONS
00079       CHARACTER(LEN=MAXLENHARD) :: NAMESEC
00080       LOGICAL :: WITH_ZONES, DONE_ZONES
00081       CHARACTER(LEN=MAXLENHARD) :: NAMEZFI
00082 !
00083       LOGICAL :: IS
00084       INTEGER :: I, J, K, L , M, N, ERR, ISO, IDUM
00085       INTEGER :: ISEG, II, ILOOP
00086       INTEGER :: I_LEN, I_S, I_SP, I_LENCLI, I_LENINP
00087       INTEGER :: JJ, IPAR, ICAS, IOS
00088 !
00089       CHARACTER(LEN=11) :: EXTENS
00090       EXTERNAL EXTENS
00091 !
00092       CHARACTER(LEN=43) :: LINE, LINE_ADJ
00093       CHARACTER(LEN=38) :: KEY_FORMAT
00094       LOGICAL :: FORMAT_MED
00095 !
00096 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00097 !
00098 !
00099       LNG=2 ! JE NE PARLE FRANCAIS, JE SUIS BARBARIEN
00100       LU=6  ! FORTRAN STANDARD OUPUT CHANNEL
00101       LI=5  ! FORTRAN STANDARD INPUT CHANNEL
00102 !
00103 !     FILE DESCRIPTOR
00104       IPAR = 72
00105       ICAS = 73
00106 !
00107 !     ALLOCATE(NULLTABLE(0))
00108       WITH_SECTIONS = .FALSE.
00109       DONE_SECTIONS = .FALSE.
00110       WITH_ZONES = .FALSE.
00111       DONE_ZONES = .FALSE.
00112 !
00113 !----------------------------------------------------------------------
00114 ! INTRODUCE YOURSELF
00115 !
00116       WRITE(LU,*) ' '
00117       WRITE(LU,*) '+-------------------------------------------------+'
00118       WRITE(LU,*) '  PARTEL: TELEMAC SELAFIN METISOLOGIC PARTITIONER'
00119       WRITE(LU,*) '                                                   '
00120       WRITE(LU,*) '  REBEKKA KOPMANN & JACEK A. JANKOWSKI (BAW)'
00121       WRITE(LU,*) '                 JEAN-MICHEL HERVOUET (LNHE)'
00122       WRITE(LU,*) '                 CHRISTOPHE DENIS     (SINETICS) '
00123       WRITE(LU,*) '                 YOANN AUDOUIN        (LNHE) '
00124       WRITE(LU,*) '  PARTEL (C) COPYRIGHT 2000-2002 '
00125       WRITE(LU,*) '  BUNDESANSTALT FUER WASSERBAU, KARLSRUHE'
00126       WRITE(LU,*) ' '
00127       WRITE(LU,*) '  METIS 5.0.2 (C) COPYRIGHT 2012 '
00128       WRITE(LU,*) '  REGENTS OF THE UNIVERSITY OF MINNESOTA '
00129       WRITE(LU,*) ' '
00130       WRITE(LU,*) '  BIEF 6.2 (C) COPYRIGHT 2012 EDF'
00131       WRITE(LU,*) '+-------------------------------------------------+'
00132       WRITE(LU,*) ' '
00133       WRITE(LU,*) ' '
00134       WRITE(LU,*) '  MAXIMUM NUMBER OF PARTITIONS: ',MAXNPROC
00135       WRITE(LU,*) ' '
00136       WRITE(LU,*) '+--------------------------------------------------+'
00137       WRITE(LU,*) ' '
00138 !
00139 !----------------------------------------------------------------------
00140 ! NAMES OF THE INPUT FILES:
00141 !
00142       INQUIRE(FILE='PARTEL.PAR',EXIST=FOUND)
00143       IF( FOUND ) OPEN(UNIT=IPAR,FILE='PARTEL.PAR')
00144 
00145       IF (FOUND) REWIND(IPAR)
00146       DO
00147         IF( FOUND ) THEN
00148            WRITE(LU, FMT='(/,'' SELAFIN INPUT NAME <INPUT_NAME>: '')')
00149            READ(IPAR,*) NAMEINP
00150         ELSE
00151            WRITE(LU, ADVANCE='NO', FMT=
00152      &         '(/,'' SELAFIN INPUT NAME <INPUT_NAME>: '')')
00153            READ(LI,'(A)') NAMEINP
00154         ENDIF
00155         IF (NAMEINP.EQ.' ') THEN
00156           WRITE (LU,'('' NO FILENAME'')')
00157         ELSE
00158 ! CONTINUE WITH TELEMAC CODES
00159           WRITE(LU,*) 'INPUT: ',NAMEINP
00160           EXIT
00161         END IF
00162       END DO
00163 
00164       INQUIRE (FILE=NAMEINP,EXIST=IS)
00165       IF (.NOT.IS) THEN
00166         WRITE (LU,'('' FILE DOES NOT EXIST: '',A30)') NAMEINP
00167         CALL PLANTE(1)
00168         STOP
00169       END IF
00170 !
00171       DO
00172         IF( FOUND ) THEN
00173            WRITE(LU, FMT='(/,'' BOUNDARY CONDITIONS FILE NAME : '')')
00174            READ(IPAR,*) NAMECLI
00175         ELSE
00176            WRITE(LU, ADVANCE='NO', FMT=
00177      &           '(/,'' BOUNDARY CONDITIONS FILE NAME : '')')
00178            READ(LI,'(A)') NAMECLI
00179         ENDIF
00180         IF (NAMECLI.EQ.' ') THEN
00181           WRITE (LU,'('' NO FILENAME'')')
00182         ELSE
00183           WRITE(LU,*) 'INPUT: ',NAMECLI
00184           EXIT
00185         END IF
00186       END DO
00187 !
00188       INQUIRE (FILE=NAMECLI,EXIST=IS)
00189       IF (.NOT.IS) THEN
00190         WRITE (LU,'('' FILE DOES NOT EXIST: '',A30)') NAMECLI
00191         CALL PLANTE(1)
00192         STOP
00193       END IF
00194 !
00195       DO
00196         IF( FOUND ) THEN
00197            WRITE(LU,FMT=
00198      &    '(/,'' NUMBER OF PARTITIONS <NPARTS> [2 -'',I6,'']: '')')
00199      &        MAXNPROC
00200            READ(IPAR,*) NPARTS
00201         ELSE
00202            WRITE(LU, ADVANCE='NO',FMT=
00203      &    '(/,'' NUMBER OF PARTITIONS <NPARTS> [2 -'',I6,'']: '')')
00204      &        MAXNPROC
00205            READ(LI,*) NPARTS
00206         ENDIF
00207         IF ( (NPARTS > MAXNPROC) .OR. (NPARTS < 2) ) THEN
00208           WRITE(LU,
00209      &    '('' NUMBER OF PARTITIONS MUST BE IN [2 -'',I6,'']'')')
00210      &      MAXNPROC
00211         ELSE
00212           WRITE(LU,'('' INPUT: '',I4)') NPARTS
00213           EXIT
00214         END IF
00215       END DO
00216 !
00217       WRITE(LU,FMT='(/,'' PARTITIONING OPTIONS: '')')
00218 
00219       DO
00220         IF( FOUND ) THEN
00221            WRITE(LU, FMT=
00222      &    '(/,'
00223 ' PARTITIONING METHOD <PMETHOD>     &    [1 (METIS) OR 2 (SCOTCH)]: '')')
00224            READ(IPAR,*) PMETHOD
00225         ELSE
00226            WRITE(LU, ADVANCE='NO',FMT=
00227      &    '(/,'
00228 ' PARTITIONING METHOD <PMETHOD>     &    [1 (METIS) OR 2 (SCOTCH)]: '')')
00229            READ(LI,*) PMETHOD
00230         ENDIF
00231         IF ( (PMETHOD > 2) .OR. (PMETHOD < 1) ) THEN
00232           WRITE(LU,
00233      &    '('' PARTITIONING METHOD MUST BE 1 OR 2'')')
00234         ELSE
00235           WRITE(LU,'('' INPUT: '',I3)') PMETHOD
00236           EXIT
00237         END IF
00238       END DO
00239 !
00240 ! #### THE SECTIONS FILE NAME
00241 !
00242       DO
00243         IF( FOUND ) THEN
00244            WRITE(LU, FMT=
00245      &    '(/,'' WITH SECTIONS? [1:YES 0:NO]: '')')
00246            READ(IPAR,*) I
00247         ELSE
00248            WRITE(LU, ADVANCE='NO',FMT=
00249      &    '(/,'' WITH SECTIONS? [1:YES 0:NO]: '')')
00250            READ(LI,*) I
00251         ENDIF
00252         IF ( I<0 .OR. I>1 ) THEN
00253           WRITE(LU,'('' PLEASE ANSWER 1:YES OR 0:NO '')')
00254         ELSE
00255           WRITE(LU,'('' INPUT: '',I4)') I
00256           EXIT
00257         END IF
00258       END DO
00259       IF (I==1) WITH_SECTIONS=.TRUE.
00260 !
00261       IF (WITH_SECTIONS) THEN
00262         DO
00263           WRITE(LU, ADVANCE='NO', FMT=
00264      &      '(/,'' CONTROL SECTIONS FILE NAME (OR RETURN) : '')')
00265           IF(FOUND) THEN
00266             READ(IPAR,'(A)') NAMESEC
00267           ELSE
00268             READ(LI,'(A)') NAMESEC
00269           ENDIF
00270           IF (NAMESEC.EQ.' ') THEN
00271             WRITE (LU,'('' NO FILENAME '')')
00272           ELSE
00273             WRITE(LU,*) 'INPUT: ',NAMESEC
00274             EXIT
00275           ENDIF
00276         ENDDO
00277 !
00278         INQUIRE (FILE=NAMESEC,EXIST=IS)
00279         IF (.NOT.IS) THEN
00280           WRITE (LU,'('' FILE DOES NOT EXIST: '',A30)') NAMESEC
00281           CALL PLANTE(1)
00282           STOP
00283         ENDIF
00284       ENDIF
00285       ! Not recalculating section if already done in previous run of partel
00286       INQUIRE(FILE=TRIM(NAMESEC)//EXTENS(NPARTS,0),EXIST=DONE_SECTIONS)
00287       WITH_SECTIONS = WITH_SECTIONS .AND. (.NOT. DONE_SECTIONS)
00288 !
00289 ! #### THE ZONES FILE NAME
00290 !
00291       DO
00292         IF( FOUND ) THEN
00293            WRITE(LU, FMT=
00294      &    '(/,'' WITH ZONES? [1:YES 0:NO]: '')')
00295            READ(IPAR,*) I
00296         ELSE
00297            WRITE(LU, ADVANCE='NO',FMT=
00298      &    '(/,'' WITH ZONES? [1:YES 0:NO]: '')')
00299            READ(LI,*) I
00300         ENDIF
00301         IF ( I<0 .OR. I>1 ) THEN
00302           WRITE(LU,'('' PLEASE ANSWER 1:YES OR 0:NO '')')
00303         ELSE
00304           WRITE(LU,'('' INPUT: '',I4)') I
00305           EXIT
00306         END IF
00307       END DO
00308       IF (I==1) WITH_ZONES=.TRUE.
00309 !
00310       IF (WITH_ZONES) THEN
00311         DO
00312           WRITE(LU, ADVANCE='NO', FMT=
00313      &      '(/,'' FRICTION ZONES FILE NAME (OR RETURN) : '')')
00314           IF(FOUND) THEN
00315             READ(IPAR,'(A)') NAMEZFI
00316           ELSE
00317             READ(LI,'(A)') NAMEZFI
00318           ENDIF
00319           IF (NAMEZFI.EQ.' ') THEN
00320             WRITE (LU,'('' NO FILENAME '')')
00321           ELSE
00322             WRITE(LU,*) 'INPUT: ',NAMEZFI
00323             EXIT
00324           ENDIF
00325         ENDDO
00326 !
00327         INQUIRE (FILE=NAMEZFI,EXIST=IS)
00328         IF (.NOT.IS) THEN
00329           WRITE (LU,'('' FILE DOES NOT EXIST: '',A30)') NAMEZFI
00330           CALL PLANTE(1)
00331           STOP
00332         ENDIF
00333       ENDIF
00334       ! Not recalculating zone if already done in previous run of partel
00335       INQUIRE(FILE=TRIM(NAMEZFI)//EXTENS(NPARTS-1,0),EXIST=DONE_ZONES)
00336       WITH_ZONES = WITH_ZONES .AND. (.NOT. DONE_ZONES)
00337 !
00338       IF( FOUND ) CLOSE(IPAR)
00339 !
00340 !
00341 ! FIND THE INPUT FILE CORE NAME LENGTH
00342 !
00343       I_S  = LEN(NAMEINP)
00344       I_SP = I_S + 1
00345       DO I=1,I_S
00346         IF (NAMEINP(I_SP-I:I_SP-I) .NE. ' ') EXIT
00347       ENDDO
00348       I_LEN = I_SP - I
00349       I_LENINP = I_LEN
00350 !
00351       IF (I_LENINP > MAXLENSOFT) THEN
00352         WRITE(LU,*) ' '
00353         WRITE(LU,*) 'ATTENTION:'
00354         WRITE(LU,*) 'THE NAME OF THE INPUT FILE:'
00355         WRITE(LU,*) NAMEINP
00356         WRITE(LU,*) 'IS LONGER THAN ',MAXLENSOFT,' CHARACTERS'
00357         WRITE(LU,*) 'WHICH IS THE LONGEST APPLICABLE NAME FOR TELEMAC '
00358         WRITE(LU,*) 'INPUT AND OUTPUT FILES. STOPPED. '
00359         CALL PLANTE(1)
00360         STOP
00361       ENDIF
00362 !
00363 ! CORE NAME LENGTH
00364 !
00365       I_S  = LEN(NAMECLI)
00366       I_SP = I_S + 1
00367       DO I=1,I_S
00368         IF (NAMECLI(I_SP-I:I_SP-I) .NE. ' ') EXIT
00369       ENDDO
00370       I_LEN = I_SP - I
00371       I_LENCLI = I_LEN
00372 !
00373       IF (I_LENCLI > MAXLENSOFT) THEN
00374         WRITE(LU,*) ' '
00375         WRITE(LU,*) 'ATTENTION:'
00376         WRITE(LU,*) 'THE NAME OF THE BOUNDARY CONDITIONS FILE:'
00377         WRITE(LU,*) NAMECLI
00378         WRITE(LU,*) 'IS LONGER THAN ',MAXLENSOFT,' CHARACTERS'
00379         WRITE(LU,*) 'WHICH IS THE LONGEST APPLICABLE NAME FOR TELEMAC '
00380         WRITE(LU,*) 'INPUT AND OUTPUT FILES. STOPPED. '
00381         CALL PLANTE(1)
00382         STOP
00383       ENDIF
00384 !
00385 !     READ THE FORMAT OF THE MESH (ONLY FOR ESTEL FOR NOW)
00386       FORMAT_MED = .FALSE.
00387       INQUIRE(FILE='ES3CAS',EXIST=FOUND)
00388 !
00389       IF (FOUND) THEN
00390 !
00391 !       OPEN THE FILE CASE FILE FOR ESTEL
00392         OPEN(UNIT=ICAS,FILE='ES3CAS')
00393         REWIND(ICAS)
00394 !
00395 !       DEFINITION OF THE KEY WORD AND ITS SIZE
00396         KEY_FORMAT = 'FILE FORMAT FOR THE 3D INPUT MESH FILE'
00397         I_LEN = LEN(KEY_FORMAT)
00398 !
00399 !       LOOP ON THE LINE OF THE INPUT FILE
00400         IOS = 0
00401         DO WHILE (IOS .EQ. 0)
00402           READ(UNIT=ICAS,FMT='(A43)',IOSTAT=IOS) LINE
00403 !
00404 !         SECURITY TO ERASE SPACE AT THE BEGINNING OF THE LINE
00405           LINE_ADJ=ADJUSTL(LINE)
00406 !
00407 !         LOOP TO FIND THE NUMBER OF THE FORMAT
00408           IF (LINE_ADJ(1:I_LEN) .EQ. KEY_FORMAT(1:I_LEN)) THEN
00409             DO I=I_LEN+1,43
00410               IF (LINE_ADJ(I:I).EQ.'4') FORMAT_MED = .TRUE.
00411             ENDDO
00412             EXIT
00413           ENDIF
00414         ENDDO
00415 !
00416         CLOSE (ICAS)
00417       ENDIF
00418 !
00419       IF(NAMEINP(1:3) .EQ. 'ES3') THEN
00420         CALL PARES3D(NAMEINP, NAMECLI, NPARTS, PMETHOD, FORMAT_MED)
00421       ELSE
00422         CALL PARTEL(NAMEINP, NAMECLI, NPARTS, PMETHOD,
00423      &              WITH_SECTIONS, NAMESEC,
00424      &              WITH_ZONES, NAMEZFI)
00425       ENDIF
00426       END PROGRAM

Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using doxygen 1.7.0