interpmeteo.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\telemac2d\interpmeteo.f
00002 !
00044                      SUBROUTINE INTERPMETEO
00045 !                    **********************
00046 !
00047      &(WW,WINDX,WINDY,TAIR,PATM,HREL,NEBU,RAINFALL,AT,NFO)
00048 !
00049 !***********************************************************************
00050 ! TELEMAC2D   V7P0                                   09/07/2014
00051 !***********************************************************************
00052 !
00053 !
00054 !
00055 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00056 !| AT             |-->| TIME OF TIME STEP
00057 !| HREL           |<--| RELATIVE HUMIDITY
00058 !| NEBU           |<--| NEBULOSITY
00059 !| NFO            |-->| LOGICAL UNIT OF THE FORMATTED DATA FILE
00060 !| PATM           |<--| ATMOSPHERIC PRESSURE
00061 !| RAINFALL       |<--| RAINFALL
00062 !| TAIR           |<--| AIR TEMPERATURE
00063 !| WINDX          |<--| WIND ALONG X
00064 !| WINDY          |<--| WIND ALONG Y
00065 !| WW             |<--| MAGNITUDE OF WIND VELOCITY
00066 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00067 !
00068       IMPLICIT NONE
00069 !
00070       INTEGER LNG,LU
00071       COMMON/INFO/LNG,LU
00072 !
00073 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00074 !
00075       INTEGER, INTENT(IN)           :: NFO
00076       DOUBLE PRECISION, INTENT(IN)  :: AT
00077       DOUBLE PRECISION, INTENT(OUT) :: WW,WINDX,WINDY,TAIR,PATM,HREL
00078       DOUBLE PRECISION, INTENT(OUT) :: NEBU,RAINFALL
00079 !
00080 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00081 !
00082       INTEGER POSTAB,I,NBENR
00083 !     NUMBER OF VARIABLES IN THE ASCII FILE NFO
00084       INTEGER, PARAMETER :: NINPUTVAR = 8
00085       INTEGER, PARAMETER :: NLINESTOSKIP = 2
00086 !
00087       DOUBLE PRECISION DELTAT,ALPHA
00088       DOUBLE PRECISION DTR
00089       DOUBLE PRECISION, ALLOCATABLE :: TABENT(:,:)
00090       DOUBLE PRECISION, ALLOCATABLE :: DUMMY(:)
00091 !
00092       LOGICAL DEJA
00093       DATA    DEJA /.FALSE./
00094 !
00095       SAVE
00096 !
00097 !-----------------------------------------------------------------------
00098 !
00099       DTR = ATAN(1.D0)/45.D0
00100 !
00101 !-----------------------------------------------------------------------
00102 !
00103 !  READS INPUT DATA FILE
00104 !  AT THE FIRST TIME STEP AND FILLS IN TABENT ARRAY
00105 !
00106       IF (.NOT.DEJA) THEN
00107 !
00108         IF(LNG.EQ.1) THEN
00109           WRITE(LU,*)'====================================='
00110           WRITE(LU,*)'DEBUT DE LECTURE DU FICHIER D''ENTREE'
00111           WRITE(LU,*)'====================================='
00112         ENDIF
00113         IF(LNG.EQ.2) THEN
00114           WRITE(LU,*)'=================================='
00115           WRITE(LU,*)'BEGINNING OF READING OF INPUT FILE'
00116           WRITE(LU,*)'=================================='
00117         ENDIF
00118 !
00119         REWIND NFO
00120 !
00121 !  READS THE HEADLINE OF THE DATA FILE
00122 !
00123         DO I=1,NLINESTOSKIP
00124           READ(NFO,*)
00125         ENDDO
00126 !
00127         NBENR = 0
00128 !
00129         IF(.NOT.DEJA) ALLOCATE(DUMMY(NINPUTVAR))
00130 !
00131 !  READS VARIABLES AND FILLS IN TABENT ARRAY
00132 !
00133  100    READ(NFO,*,END=20) DUMMY(1:NINPUTVAR)
00134         NBENR = NBENR + 1
00135         GO TO 100
00136 !
00137  20     CONTINUE
00138 !
00139         IF(.NOT.DEJA) THEN
00140 !  +2 TO STORE 2 EXTRA DATA (THE X AND Y COMPONENTS OF WIND VELOCITY)
00141           ALLOCATE(TABENT(NBENR,NINPUTVAR+2))
00142           DEJA = .TRUE.
00143         ENDIF
00144 !
00145 !-----------------------------------------------------------------------
00146 !
00147         REWIND NFO
00148 !
00149 !  READS THE HEADLINE OF THE DATA FILE
00150 !
00151         DO I=1,NLINESTOSKIP
00152           READ(NFO,*)
00153         ENDDO
00154 !
00155 !  READS VARIABLES AND FILLS IN TABENT ARRAY
00156 !
00157         DO I=1,NBENR
00158           READ(NFO,*)TABENT(I,1:NINPUTVAR)
00159         ENDDO
00160 !
00161         IF(LNG.EQ.1) THEN
00162           WRITE(LU,*)'======================================='
00163           WRITE(LU,*)'  FIN DE LECTURE DU FICHIER D''ENTREE  '
00164           WRITE(LU,*)'     IL Y A ',NBENR,' ENREGISTREMENTS  '
00165           WRITE(LU,*)'  DE T = ',TABENT(1,1), ' A  = ',
00166      &               TABENT(NBENR,1),' SECONDES '
00167           WRITE(LU,*)'======================================='
00168         ENDIF
00169         IF(LNG.EQ.2) THEN
00170           WRITE(LU,*)'======================================='
00171           WRITE(LU,*)'  END OF READING OF INPUT DATA         '
00172           WRITE(LU,*)'  THERE ARE ',NBENR,' RECORDS          '
00173           WRITE(LU,*)'  FROM T = ',TABENT(1,1), ' TO = ',
00174      &               TABENT(NBENR,1),' SECONDS '
00175           WRITE(LU,*)'======================================='
00176         ENDIF
00177 !
00178 !  FILLS IN WITH X AND Y COMPONENTS OF WIND VELOCITY
00179 !
00180         DO I=1,NBENR
00181           TABENT(I,9)  = -TABENT(I,2)*SIN(TABENT(I,3)*DTR)
00182           TABENT(I,10) = -TABENT(I,2)*COS(TABENT(I,3)*DTR)
00183         ENDDO
00184 !
00185 !  END TO FILL IN TABENT ARRAY
00186 !  INITIALISATION OF THE POINTER POSTAB
00187 !
00188         POSTAB = 1
00189 !
00190       ENDIF
00191 !
00192 !-----------------------------------------------------------------------
00193 !
00194 !  INTERPOLATES DATA AT EACH TIME STEP
00195 !  POINTER POSTAB POSITIONNED AT EACH TIME STEP
00196 !
00197 120   IF(AT.LT.TABENT(POSTAB,1).OR.AT.GE.TABENT(POSTAB+1,1)) THEN
00198         IF(AT.LT.TABENT(POSTAB,1))   POSTAB = POSTAB - 1
00199         IF(AT.GE.TABENT(POSTAB+1,1)) POSTAB = POSTAB + 1
00200         IF(POSTAB.GT.NBENR) THEN
00201           IF(LNG.EQ.1) THEN
00202             WRITE(LU,*)'==============================================='
00203             WRITE(LU,*)'ATTENTION : LE TEMPS DU CALCUL AT = ', AT
00204             WRITE(LU,*)'EST SUPERIEUR AU TEMPS MAXIMUM DE VOTRE FICHIER'
00205             WRITE(LU,*)'DE DONNEES D''ENTREE T = ', TABENT(NBENR,1)
00206             WRITE(LU,*)'==============================================='
00207           ENDIF
00208           IF(LNG.EQ.2) THEN
00209             WRITE(LU,*)'==============================================='
00210             WRITE(LU,*)'WARNING: TIME OF CALCULATION AT = ', AT
00211             WRITE(LU,*)'IS BIGGER THAN MAXIMUM TIME IN YOUR INPUT DATA '
00212             WRITE(LU,*)'FILE T = ', TABENT(NBENR,1)
00213             WRITE(LU,*)'==============================================='
00214           ENDIF
00215           CALL PLANTE(1)
00216         ELSEIF(POSTAB.LT.1) THEN
00217           IF(LNG.EQ.1) THEN
00218             WRITE(LU,*)'==============================================='
00219             WRITE(LU,*)'ATTENTION : LE TEMPS DU CALCUL AT = ', AT
00220             WRITE(LU,*)'EST INFERIEUR AU TEMPS MINIMUM DE VOTRE FICHIER'
00221             WRITE(LU,*)'DE DONNEES D''ENTREE T = ', TABENT(1,1)
00222             WRITE(LU,*)'==============================================='
00223           ENDIF
00224           IF(LNG.EQ.2) THEN
00225             WRITE(LU,*)'==============================================='
00226             WRITE(LU,*)'WARNING: TIME OF CALCULATION AT = ', AT
00227             WRITE(LU,*)'IS LOWER THAN MINIMUM TIME IN YOUR INPUT DATA '
00228             WRITE(LU,*)'FILE T = ', TABENT(1,1)
00229             WRITE(LU,*)'==============================================='
00230           ENDIF
00231           CALL PLANTE(1)
00232         ENDIF
00233         GO TO 120
00234       ENDIF
00235 !
00236       DELTAT = TABENT(POSTAB+1,1)-TABENT(POSTAB,1)
00237       ALPHA  = (AT-TABENT(POSTAB,1))/DELTAT
00238 !
00239 !-----------------------------------------------------------------------
00240 !
00241       WW    =  TABENT(POSTAB,2)
00242      &      + (TABENT(POSTAB+1,2)-TABENT(POSTAB,2))*ALPHA
00243 !
00244       WINDX =  TABENT(POSTAB,9)
00245      &      + (TABENT(POSTAB+1,9)-TABENT(POSTAB,9))*ALPHA
00246       WINDY =  TABENT(POSTAB,10)
00247      &      + (TABENT(POSTAB+1,10)-TABENT(POSTAB,10))*ALPHA
00248 !
00249       TAIR  =  TABENT(POSTAB,4)
00250      &      + (TABENT(POSTAB+1,4)-TABENT(POSTAB,4))*ALPHA
00251       PATM  =  TABENT(POSTAB,5)
00252      &      + (TABENT(POSTAB+1,5)-TABENT(POSTAB,5))*ALPHA
00253       HREL  =  TABENT(POSTAB,6)
00254      &      + (TABENT(POSTAB+1,6)-TABENT(POSTAB,6))*ALPHA
00255 
00256       NEBU  =  TABENT(POSTAB,7)
00257      &      + (TABENT(POSTAB+1,7)-TABENT(POSTAB,7))*ALPHA
00258 !
00259       RAINFALL = TABENT(POSTAB+1,8)/DELTAT
00260 !
00261 !-----------------------------------------------------------------------
00262 !
00263       RETURN
00264       END

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