lecdon.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\tomawac\lecdon.f
00002 !
00074                      SUBROUTINE LECDON
00075 !                    *****************
00076 !
00077      &(F1,NAME1FR,NAME1GB,MODE1,
00078      & F2,NAME2FR,NAME2GB,MODE2,
00079      & F3,NAME3FR,NAME3GB,MODE3,
00080      & X,Y,NPOIN2,NDON,BINDON,NBOR,NPTFR,NPTT,INDIC,CHDON,TEXTE,TROUVE)
00081 !
00082 !***********************************************************************
00083 ! TOMAWAC   V6P3                                   21/06/2011
00084 !***********************************************************************
00085 !
00086 !
00087 !
00088 !
00089 !
00090 !
00091 !
00092 !
00093 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00094 !| BINDON         |-->| BINAIRE DU FICHIER DES DONNEES  (INDIC>2)
00095 !| CHDON          |-->| NAME OF THE VARIABLE READ FROM THE DATA FILE
00096 !| F1             |<--| FIRST VARIABLE TO READ
00097 !| F2             |<--| SECOND VARIABLE TO READ
00098 !| F3             |<--| THIRD VARIABLE TO READ
00099 !| INDIC          |-->| FILE FORMAT
00100 !| MODE1          |-->| MODE: 0= DO NOT READ
00101 !|                |   |       1= READ IF PRESENT
00102 !| MODE2          |-->| LIKE MODE1 FOR SECOND VARIABLE
00103 !| MODE3          |-->| LIKE MODE1 FOR THIRD VARIABLE
00104 !| NAME1FR        |-->| FRENCH NAME OF FIRST VARIABLE
00105 !| NAME2FR        |-->| FRENCH NAME OF SECOND VARIABLE
00106 !| NAME3FR        |-->| FRENCH NAME OF THIRD VARIABLE
00107 !| NAME1GB        |-->| ENGLISH NAME OF FIRST VARIABLE
00108 !| NAME2GB        |-->| ENGLISH NAME OF SECOND VARIABLE
00109 !| NAME3GB        |-->| ENGLISH NAME OF THIRD VARIABLE
00110 !| NBOR           |-->| GLOBAL NUMBER OF BOUNDARY POINTS
00111 !| NDON           |-->| LOGICAL UNIT NUMBER OF THA DATA FILE
00112 !| NPOIN2         |-->| NUMBER OF POINTS IN 2D MESH
00113 !| NPTFR          |-->| NUMBER OF BOUNDARY POINTS
00114 !| NPTT           |-->| TIME STEP NUMBER IN TELEMAC FILE
00115 !| TEXTE          |<->| NAME OF VARIABLES IN THE SERAFIN FILE
00116 !| TROUVE         |<->| 3 LOGICAL, WILL SAY IF VARIABLES HAVE BEEN FOUND
00117 !| X              |-->| ABSCISSAE OF POINTS IN THE MESH
00118 !| Y              |-->| ORDINATES OF POINTS IN THE MESH
00119 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00120 !
00121       USE BIEF
00122       IMPLICIT NONE
00123 !
00124       INTEGER LNG,LU
00125       COMMON/INFO/ LNG,LU
00126 !
00127 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00128 !
00129       INTEGER, INTENT(IN)             :: NDON,NPOIN2,NPTFR,INDIC,NPTT
00130       INTEGER, INTENT(IN)             :: MODE1,MODE2,MODE3
00131       INTEGER, INTENT(IN)             :: NBOR(NPTFR,2)
00132       DOUBLE PRECISION, INTENT(IN)    :: X(NPOIN2),Y(NPOIN2)
00133       DOUBLE PRECISION, INTENT(INOUT) :: F1(NPOIN2),F2(NPOIN2)
00134       DOUBLE PRECISION, INTENT(INOUT) :: F3(NPOIN2)
00135       CHARACTER(LEN=3), INTENT(IN)    :: BINDON
00136       CHARACTER(LEN=7), INTENT(IN)    :: CHDON
00137       CHARACTER(LEN=32),INTENT(IN)    :: NAME1FR,NAME2FR,NAME3FR
00138       CHARACTER(LEN=32),INTENT(IN)    :: NAME1GB,NAME2GB,NAME3GB
00139       CHARACTER(LEN=32),INTENT(INOUT) :: TEXTE(30)
00140       LOGICAL, INTENT(INOUT)          :: TROUVE(3)
00141 !
00142 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00143 !
00144       INTEGER NP,I,J,NVAR,IB(10),ISTAT,MODE(3)
00145       DOUBLE PRECISION ATT,BDX(2),Z(1),T1VOID,T2VOID
00146       CHARACTER(LEN=3) C
00147       CHARACTER(LEN=32) NAMEFR(3),NAMEGB(3)
00148       CHARACTER(LEN=72) TITCAS
00149       LOGICAL VOID
00150 !
00151       INTRINSIC TRIM
00152 !
00153       REAL, ALLOCATABLE :: W(:)
00154       ALLOCATE(W(NPOIN2))
00155 !
00156 !-----------------------------------------------------------------------
00157 !
00158       MODE(1)=MODE1
00159       MODE(2)=MODE2
00160       MODE(3)=MODE3
00161       NAMEFR(1)=NAME1FR
00162       NAMEFR(2)=NAME2FR
00163       NAMEFR(3)=NAME3FR
00164       NAMEGB(1)=NAME1GB
00165       NAMEGB(2)=NAME2GB
00166       NAMEGB(3)=NAME3GB
00167 !
00168 !-----------------------------------------------------------------------
00169 !     READS THE POINTS FROM LOGICAL UNIT NDON
00170 !-----------------------------------------------------------------------
00171 !
00172       IF(INDIC.EQ.3) THEN
00173 !
00174 !     ------------------------------------------------------------------
00175 !     SERAFIN FORMAT
00176 !     ------------------------------------------------------------------
00177 !
00178 !         READS TITLE
00179 !
00180           CALL LIT(Z,W,IB,TITCAS,72,'CH',NDON,BINDON,ISTAT)
00181 !
00182 !         READS NUMBER OF VARIABLES AND THEIR NAMES
00183 !
00184           CALL LIT(Z,W,IB,C,2,'I ',NDON,BINDON,ISTAT)
00185           NVAR=IB(1)
00186           DO I=1,NVAR
00187             CALL LIT(Z,W,IB,TEXTE(I),32,'CH',NDON,BINDON,ISTAT)
00188           ENDDO
00189 !
00190 !         FORMAT AND GEOMETRY
00191 !
00192           CALL LIT(Z,W,IB,C,10,'I ',NDON,BINDON,ISTAT)
00193           IF(IB(10).EQ.1) THEN
00194 !           THIS IS THE DATE : YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
00195             CALL LIT(Z,W,IB,C,6,'I ',NDON,BINDON,ISTAT)
00196           ENDIF
00197           CALL LIT(Z,W,IB,C, 4,'I ',NDON,BINDON,ISTAT)
00198           NP=IB(2)
00199           WRITE(LU,*)
00200      &        '-----------------------------------------------------'
00201           IF (LNG.EQ.1) THEN
00202              WRITE(LU,*)'LECDON : LECTURE DU FICHIER TELEMAC'
00203              WRITE(LU,*)'         NOMBRE DE POINTS   : ',NP
00204           ELSE
00205              WRITE(LU,*)'LECDON : READING OF TELEMAC DATA FILE '
00206              WRITE(LU,*)'         NUMBER OF POINTS   : ',NP
00207           ENDIF
00208           IF(NP.NE.NPOIN2) THEN
00209             WRITE(LU,*) ' '
00210             IF(LNG.EQ.1) THEN
00211               WRITE(LU,*) 'LECDON : LE MAILLAGE DU'
00212               WRITE(LU,*) 'FICHIER DES COURANTS EST'
00213               WRITE(LU,*) 'DIFFERENT DE CELUI DU FICHIER DE GEOMETRIE'
00214             ELSEIF(LNG.EQ.2) THEN
00215               WRITE(LU,*) 'LECDON: THE MESH OF THE CURRENTS FILE'
00216               WRITE(LU,*) 'IS DIFFERENT FROM THE GEOMETRY FILE'
00217             ENDIF
00218             WRITE(LU,*) ' '
00219             CALL PLANTE(1)
00220           ENDIF
00221           READ(NDON)
00222           READ(NDON)
00223 !
00224 !         X AND Y
00225 !
00226           READ(NDON)
00227           READ(NDON)
00228 !
00229 !         TIME STEP AND VARIABLES
00230 !
00231           DO J=1,(NPTT-1)*(NVAR+1)
00232             READ(NDON)
00233           ENDDO
00234 !
00235           CALL LIT(BDX(1),W,IB,C,1,'R4',NDON,BINDON,ISTAT)
00236           ATT=BDX(1)
00237 !
00238 !         HERE THE DATE SHOULD BE TAKEN INTO ACCOUNT IF PRESENT
00239 !
00240           IF(LNG.EQ.1) THEN
00241             WRITE(LU,*)'         TITRE DU CAS TELEMAC : '
00242             WRITE(LU,*)'           ',TITCAS
00243             WRITE(LU,*)'         TEMPS DE TELEMAC : ',ATT
00244           ELSEIF(LNG.EQ.2) THEN
00245             WRITE(LU,*)'         TITLE OF TELEMAC CASE : '
00246             WRITE(LU,*)'           ',TITCAS
00247             WRITE(LU,*)'         TIME OF TELEMAC RECORD : ',ATT
00248           ENDIF
00249 !
00250           TROUVE(1)=.FALSE.
00251           TROUVE(2)=.FALSE.
00252           TROUVE(3)=.FALSE.
00253           DO I=1,NVAR
00254             VOID=.TRUE.
00255             DO J=1,3
00256               IF((TEXTE(I).EQ.NAMEFR(J).OR.TEXTE(I).EQ.NAMEGB(J)).AND.
00257      &          MODE(J).GT.0) THEN
00258                 IF(J.EQ.1) THEN
00259                   CALL LIT(F1,W,IB,C,NP,'R4',NDON,BINDON,ISTAT)
00260                 ELSEIF(J.EQ.2) THEN
00261                   CALL LIT(F2,W,IB,C,NP,'R4',NDON,BINDON,ISTAT)
00262                 ELSEIF(J.EQ.3) THEN
00263                   CALL LIT(F3,W,IB,C,NP,'R4',NDON,BINDON,ISTAT)
00264                 ENDIF
00265                 TROUVE(J)=.TRUE.
00266                 VOID=.FALSE.
00267               ENDIF
00268             ENDDO
00269             IF(VOID) READ(NDON)
00270           ENDDO
00271           DO J=1,3
00272             IF(MODE(J).EQ.2.AND..NOT.TROUVE(J)) THEN
00273               IF(LNG.EQ.1) THEN
00274                 WRITE(LU,*) 'LECDON : VARIABLE ',J,' NON TROUVEE'
00275                 WRITE(LU,*) TRIM(NAMEFR(J)(1:16)),' OU ',
00276      &                      TRIM(NAMEGB(J)(1:16))
00277               ELSEIF(LNG.EQ.2) THEN
00278                 WRITE(LU,*) 'LECDON: VARIABLE ',NAME1GB,' NOT FOUND'
00279                 WRITE(LU,*) TRIM(NAMEFR(J)(1:16)),' OR ',
00280      &                      TRIM(NAMEGB(J)(1:16))
00281               ENDIF
00282               CALL PLANTE(1)
00283               STOP
00284             ELSEIF(MODE(J).GT.0.AND.TROUVE(J)) THEN
00285               IF(LNG.EQ.1) THEN
00286                 WRITE(LU,*) 'VARIABLE ',J,' LUE (',
00287      &                      TRIM(NAMEFR(J)(1:16)),' OU ',
00288      &                      TRIM(NAMEGB(J)(1:16)),')'
00289               ELSEIF(LNG.EQ.2) THEN
00290                 WRITE(LU,*) 'VARIABLE ',J,' READ (',
00291      &                      TRIM(NAMEFR(J)(1:16)),' OR ',
00292      &                      TRIM(NAMEGB(J)(1:16)),')'
00293               ENDIF
00294             ENDIF
00295           ENDDO
00296 !
00297       ELSEIF(INDIC.EQ.4) THEN
00298 !
00299 !     ------------------------------------------------------------------
00300 !       READS A USER-DEFINED FORMAT
00301 !     ------------------------------------------------------------------
00302 !
00303         IF(CHDON(1:1).EQ.'C') THEN
00304 !         READS A CURRENT FIELD
00305           CALL COUUTI(X,Y,NPOIN2,NDON,BINDON,NBOR,NPTFR,
00306      &                0.D0,0.D0,0.D0,0.D0,F1,F2,F1,F2)
00307         ELSEIF(CHDON(1:1).EQ.'W') THEN
00308 !         READS A WIND FIELD
00309           CALL VENUTI(X,Y,NPOIN2,NDON,BINDON,NBOR,NPTFR,
00310      &                0.D0,0.D0,T1VOID,T2VOID,F1,F2,F1,F2)
00311         ELSE
00312           IF(LNG.EQ.1) THEN
00313             WRITE(LU,*) 'LE TYPE DE DONNEES A LIRE EST INCONNU'
00314           ELSE
00315             WRITE(LU,*) 'UNKNOWN DATA'
00316           ENDIF
00317           CALL PLANTE(1)
00318           STOP
00319         ENDIF
00320 !
00321       ELSE
00322         WRITE(LU,*)'***********************************************'
00323         IF(LNG.EQ.1) THEN
00324           WRITE(LU,*)'LECDON : INDICATEUR DE FORMAT INCONNU   '
00325           WRITE(LU,*)'         POUR LE FICHIER DES DONNEES :',INDIC
00326         ELSE
00327           WRITE(LU,*)'LECDON : INDICATOR OF FORMAT FOR THE   '
00328           WRITE(LU,*)'         DATA FILE UNKNOWN :',INDIC
00329         ENDIF
00330         WRITE(LU,*)'***********************************************'
00331         CALL PLANTE(1)
00332         STOP
00333       ENDIF
00334 !
00335 !-----------------------------------------------------------------------
00336 !
00337       DEALLOCATE(W)
00338 !
00339       RETURN
00340 !
00341 !     IF FAILED TO READ THE FILE ...
00342 !
00343       WRITE(LU,*)'*********************************************'
00344       IF (LNG.EQ.1) THEN
00345         WRITE(LU,*)'  ERREUR A LA LECTURE DU FICHIER DE DONNEES  '
00346         WRITE(LU,*)'      OU FIN DE FICHIER PREMATUREE           '
00347       ELSE
00348         WRITE(LU,*)'  ERROR WHILE READING DATA FILE '
00349         WRITE(LU,*)'    OR UNEXPECTED END OF FILE           '
00350       ENDIF
00351       WRITE(LU,*)'*********************************************'
00352       CALL PLANTE(1)
00353 !
00354 !-----------------------------------------------------------------------
00355 !
00356       RETURN
00357       END

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