interpmeteo2.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\telemac2d\interpmeteo2.f
00002 !
00050                      SUBROUTINE INTERPMETEO2
00051 !                    **********************
00052 !
00053      &(WW,WINDX,WINDY,TAIR,PATM,NEBU,RAINFALL,
00054      & PVAP,RAY3,AT,NFO)
00055 !
00056 !***********************************************************************
00057 ! TELEMAC2D   V7P0                                   09/07/2014
00058 !***********************************************************************
00059 !
00060 !
00061 !
00062 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00063 !| AT             |-->| TIME OF TIME STEP
00064 !| C14_ATM        |<--|
00065 !| HREL           |<--| RELATIVE HUMIDITY
00066 !| HT0_ATM        |<--|
00067 !| I0             |<--|
00068 !| NEBU           |<--| NEBULOSITY
00069 !| NFO            |-->| LOGICAL UNIT OF THE FORMATTED DATA FILE
00070 !| PATM           |<--| ATMOSPHERIC PRESSURE
00071 !| RAINFALL       |<--| RAINFALL
00072 !| RAY3           |<--|
00073 !| TAIR           |<--| AIR TEMPERATURE
00074 !| TVAP           |<--|
00075 !| WINDX          |<--| WIND ALONG X
00076 !| WINDY          |<--| WIND ALONG Y
00077 !| WW             |<--| MAGNITUDE OF WIND VELOCITY
00078 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00079 !
00080       USE INTERFACE_TELEMAC2D, EX_INTERPMETEO2 => INTERPMETEO2
00081       IMPLICIT NONE
00082 !
00083       INTEGER LNG,LU
00084       COMMON/INFO/LNG,LU
00085 !
00086 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00087 !
00088       INTEGER, INTENT(IN)             :: NFO
00089       DOUBLE PRECISION, INTENT(IN)    :: AT
00090       DOUBLE PRECISION, INTENT(INOUT) :: WW,WINDX,WINDY,TAIR,PATM
00091       DOUBLE PRECISION, INTENT(INOUT) :: NEBU,RAINFALL,PVAP,RAY3
00092 !
00093 !      DOUBLE PRECISION, INTENT(INOUT) :: I0,PCO2,C14_ATM,HT0_ATM,HREL
00094 !
00095 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00096 !
00097       INTEGER POSTAB,I,NBENR
00098 !     NUMBER OF VARIABLES IN THE ASCII FILE NFO
00099 !       INTEGER, PARAMETER :: NINPUTVAR = 8
00100       INTEGER, PARAMETER :: NINPUTVAR = 9
00101 !     DESCRIPTION OF THE METEO FILE (GENERAL CASE)
00102 !      1-TIME 2-TAIR 3-PVAP 4- WIND MAGN 5- WIND DIR
00103 !      6 NEBULO 7-RAY3 8-PATM 9-RAIN
00104 !
00105       INTEGER, PARAMETER :: NLINESTOSKIP = 2
00106 !
00107       DOUBLE PRECISION,PARAMETER :: EPS=1.D-6
00108       DOUBLE PRECISION DELTAT,ALPHA
00109       DOUBLE PRECISION DTR,DUMMY
00110       DOUBLE PRECISION, ALLOCATABLE :: TABENT(:,:)
00111 !
00112       LOGICAL DEJA
00113       DATA    DEJA /.FALSE./
00114 !
00115       SAVE
00116 !
00117 !-----------------------------------------------------------------------
00118 !
00119       DTR = ATAN(1.D0)/45.D0
00120 !
00121 !-----------------------------------------------------------------------
00122 !
00123 !  READS INPUT DATA FILE
00124 !  AT THE FIRST TIME STEP AND FILLS IN TABENT ARRAY
00125 !
00126       IF (.NOT.DEJA) THEN
00127 !
00128         IF(LNG.EQ.1) THEN
00129           WRITE(LU,*)'====================================='
00130           WRITE(LU,*)'INTERPMETEO2.f :                     '
00131           WRITE(LU,*)'DEBUT DE LECTURE DU FICHIER D''ENTREE'
00132           WRITE(LU,*)'====================================='
00133         ENDIF
00134         IF(LNG.EQ.2) THEN
00135           WRITE(LU,*)'=================================='
00136           WRITE(LU,*)'INTERPMETEO2.f :                  '
00137           WRITE(LU,*)'BEGINNING OF READING OF INPUT FILE'
00138           WRITE(LU,*)'=================================='
00139         ENDIF
00140 !
00141         REWIND NFO
00142 !
00143 !  READS THE HEADLINE OF THE DATA FILE
00144 !
00145         DO I=1,NLINESTOSKIP
00146           READ(NFO,*)
00147         ENDDO
00148 !
00149         NBENR = 0
00150 !
00151 !  READS VARIABLES AND FILLS IN TABENT ARRAY
00152 !
00153  100    READ(NFO,*,END=20) DUMMY
00154         NBENR = NBENR + 1
00155         GO TO 100
00156 !
00157  20     CONTINUE
00158 !
00159         IF(.NOT.DEJA) THEN
00160           IF(NBENR.EQ.0)THEN
00161             IF(LNG.EQ.1) THEN
00162               WRITE(LU,*)'====================================='
00163               WRITE(LU,*)'FICHIER METEO VIDE  !                '
00164               WRITE(LU,*)'====================================='
00165             ENDIF
00166             IF(LNG.EQ.2) THEN
00167               WRITE(LU,*)'=================================='
00168               WRITE(LU,*)' METEO FILE EMPTY   !             '
00169               WRITE(LU,*)'=================================='
00170             ENDIF
00171             CALL PLANTE(1)
00172             STOP
00173           ELSE
00174 !          +2 TO CONSIDER WINDX AND WINDY
00175             ALLOCATE(TABENT(NBENR,NINPUTVAR+2))
00176             DEJA = .TRUE.
00177           ENDIF
00178         ENDIF
00179 !
00180 !-----------------------------------------------------------------------
00181 !
00182         REWIND NFO
00183 !
00184 !  READS THE HEADLINE OF THE DATA FILE
00185 !
00186         DO I=1,NLINESTOSKIP
00187           READ(NFO,*)
00188         ENDDO
00189 !
00190 !  READS VARIABLES AND FILLS IN TABENT ARRAY
00191 !
00192         DO I=1,NBENR
00193           READ(NFO,*)TABENT(I,1:NINPUTVAR)
00194         ENDDO
00195 !
00196         IF(LNG.EQ.1) THEN
00197           WRITE(LU,*)'======================================='
00198           WRITE(LU,*)'  FIN DE LECTURE DU FICHIER D''ENTREE  '
00199           WRITE(LU,*)'     IL Y A ',NBENR,' ENREGISTREMENTS  '
00200           WRITE(LU,*)'  DE T = ',TABENT(1,1), ' A  = ',
00201      &               TABENT(NBENR,1),' SECONDES '
00202           WRITE(LU,*)'======================================='
00203         ENDIF
00204         IF(LNG.EQ.2) THEN
00205           WRITE(LU,*)'======================================='
00206           WRITE(LU,*)'  END OF READING OF INPUT DATA         '
00207           WRITE(LU,*)'  THERE ARE ',NBENR,' RECORDS          '
00208           WRITE(LU,*)'  FROM T = ',TABENT(1,1), ' TO = ',
00209      &               TABENT(NBENR,1),' SECONDS '
00210           WRITE(LU,*)'======================================='
00211         ENDIF
00212 !
00213 !  FILLS IN WITH X AND Y COMPONENTS OF WIND VELOCITY
00214 !
00215         DO I=1,NBENR
00216           TABENT(I,NINPUTVAR+1) = -TABENT(I,4)*SIN(TABENT(I,5)*DTR)
00217           TABENT(I,NINPUTVAR+2) = -TABENT(I,4)*COS(TABENT(I,5)*DTR)
00218         ENDDO
00219 !
00220 !  END TO FILL IN TABENT ARRAY
00221 !  INITIALISATION OF THE POINTER POSTAB
00222 !
00223         POSTAB = 1
00224 !
00225       ENDIF
00226 !
00227 !-----------------------------------------------------------------------
00228 !
00229 !  INTERPOLATES DATA AT EACH TIME STEP
00230 !  POINTER POSTAB POSITIONNED AT EACH TIME STEP
00231 !
00232 120   IF(AT.LT.TABENT(POSTAB,1).OR.AT.GE.TABENT(POSTAB+1,1)) THEN
00233         IF(AT.LT.TABENT(POSTAB,1))   POSTAB = POSTAB - 1
00234         IF(AT.GE.TABENT(POSTAB+1,1)) POSTAB = POSTAB + 1
00235         IF(POSTAB.GT.NBENR) THEN
00236           IF(LNG.EQ.1) THEN
00237             WRITE(LU,*)'==============================================='
00238             WRITE(LU,*)'ATTENTION : LE TEMPS DU CALCUL AT = ', AT
00239             WRITE(LU,*)'EST SUPERIEUR AU TEMPS MAXIMUM DE VOTRE FICHIER'
00240             WRITE(LU,*)'DE DONNEES D''ENTREE T = ', TABENT(NBENR,1)
00241             WRITE(LU,*)'==============================================='
00242           ENDIF
00243           IF(LNG.EQ.2) THEN
00244             WRITE(LU,*)'==============================================='
00245             WRITE(LU,*)'WARNING: TIME OF CALCULATION AT = ', AT
00246             WRITE(LU,*)'IS BIGGER THAN MAXIMUM TIME IN YOUR INPUT DATA '
00247             WRITE(LU,*)'FILE T = ', TABENT(NBENR,1)
00248             WRITE(LU,*)'==============================================='
00249           ENDIF
00250           CALL PLANTE(1)
00251         ELSEIF(POSTAB.LT.1) THEN
00252           IF(LNG.EQ.1) THEN
00253             WRITE(LU,*)'==============================================='
00254             WRITE(LU,*)'ATTENTION : LE TEMPS DU CALCUL AT = ', AT
00255             WRITE(LU,*)'EST INFERIEUR AU TEMPS MINIMUM DE VOTRE FICHIER'
00256             WRITE(LU,*)'DE DONNEES D''ENTREE T = ', TABENT(1,1)
00257             WRITE(LU,*)'==============================================='
00258           ENDIF
00259           IF(LNG.EQ.2) THEN
00260             WRITE(LU,*)'==============================================='
00261             WRITE(LU,*)'WARNING: TIME OF CALCULATION AT = ', AT
00262             WRITE(LU,*)'IS LOWER THAN MINIMUM TIME IN YOUR INPUT DATA '
00263             WRITE(LU,*)'FILE T = ', TABENT(1,1)
00264             WRITE(LU,*)'==============================================='
00265           ENDIF
00266           CALL PLANTE(1)
00267         ENDIF
00268         GO TO 120
00269       ENDIF
00270 !
00271       DELTAT = TABENT(POSTAB+1,1)-TABENT(POSTAB,1)
00272       IF(DELTAT.GT.1.E-6)THEN
00273         ALPHA = (AT-TABENT(POSTAB,1))/DELTAT
00274       ELSE
00275         ALPHA = 0.D0
00276       ENDIF
00277 !
00278 !-----------------------------------------------------------------------
00279 !     TAIR
00280       TAIR  =  TABENT(POSTAB,2)
00281      &      + (TABENT(POSTAB+1,2)-TABENT(POSTAB,2))*ALPHA
00282 !     PVAP
00283       PVAP  =  TABENT(POSTAB,3)
00284      &      + (TABENT(POSTAB+1,3)-TABENT(POSTAB,3))*ALPHA
00285 !     WIND MAGNITUDE
00286       WW    =  TABENT(POSTAB,4)
00287      &      + (TABENT(POSTAB+1,4)-TABENT(POSTAB,4))*ALPHA
00288 !    WIND DIRECTION
00289 !      WW    =  TABENT(POSTAB,2)
00290 !     &      + (TABENT(POSTAB+1,2)-TABENT(POSTAB,2))*ALPHA
00291 !     WINDX AND WINDY
00292       WINDX =  TABENT(POSTAB,NINPUTVAR+1)+(TABENT(POSTAB+1,NINPUTVAR+1)
00293      &        -TABENT(POSTAB,NINPUTVAR+1))*ALPHA
00294       WINDY =  TABENT(POSTAB,NINPUTVAR+2)+(TABENT(POSTAB+1,NINPUTVAR+2)
00295      &        -TABENT(POSTAB,NINPUTVAR+2))*ALPHA
00296 !     NEBULOSITY
00297       NEBU  =  TABENT(POSTAB,6)
00298      &      + (TABENT(POSTAB+1,6)-TABENT(POSTAB,6))*ALPHA
00299 !     RAY3
00300       RAY3  =  TABENT(POSTAB,7)
00301      &      + (TABENT(POSTAB+1,7)-TABENT(POSTAB,7))*ALPHA
00302 !     PATM
00303       PATM  =  TABENT(POSTAB,8)
00304      &      + (TABENT(POSTAB+1,8)-TABENT(POSTAB,8))*ALPHA
00305 !     RAINFALL
00306       RAINFALL = TABENT(POSTAB+1,9)/MAX(DELTAT,EPS)
00307 ! !     I0
00308 !       I0  =  TABENT(POSTAB,10)
00309 !      &      + (TABENT(POSTAB+1,10)-TABENT(POSTAB,10))*ALPHA
00310 ! !     PCO2
00311 !       PCO2  =  TABENT(POSTAB,11)
00312 !      &      + (TABENT(POSTAB+1,11)-TABENT(POSTAB,11))*ALPHA
00313 !
00314 ! !     RELATIVE HUMIDITY (MOISTURE)
00315 !       HREL  =  TABENT(POSTAB,12)
00316 !      &      + (TABENT(POSTAB+1,12)-TABENT(POSTAB,12))*ALPHA
00317 !
00318 !
00319 ! !     C14_ATM
00320 !       C14_ATM  =  TABENT(POSTAB,13)
00321 !      &      + (TABENT(POSTAB+1,13)-TABENT(POSTAB,13))*ALPHA
00322 ! !     HT0_ATM
00323 !       HTO_ATM =  TABENT(POSTAB,14)
00324 !      &      + (TABENT(POSTAB+1,14)-TABENT(POSTAB,14))*ALPHA
00325 !
00326 !-----------------------------------------------------------------------
00327 !
00328       RETURN
00329       END

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