caldt.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\telemac2d\caldt.f
00002 !
00069                        SUBROUTINE CALDT
00070 !                      ****************
00071 !
00072      &(NS,G,H,U,V,DTHAUT,DT,AT,TMAX,CFL,ICIN,DTVARI,LISTIN)
00073 !
00074 !***********************************************************************
00075 !TELEMAC-2D VERSION 7.0                                 30/06/13
00076 !***********************************************************************
00077 !
00078 !
00079 !
00080 !
00081 !
00082 !
00083 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00084 !| NS             |-->| TOTAL NUMBER OF NODES
00085 !| G              |-->| GRAVITY
00086 !| H              |-->| WATER DEPTHS
00087 !| U              |-->| X-COMPONENT OF VELOCITY
00088 !| V              |-->| Y-COMPONENT OF VELOCITY
00089 !| DTHAUT         |-->| CHARACTERISTIC LENTH FOR CFL (DX)
00090 !| DT             |<--| TIME STEP
00091 !| AT             |---| CURRENT TIME
00092 !| TMAX           |---| MAX SIMULATION TIME
00093 !| CFL            |-->| CFL
00094 !| ICIN           |-->| WHICH SCHEME (SEE LIST BELOW)
00095 !| DTVARI         |-->| LOGICAL: VARIABLE TIME STEP
00096 !| LISTIN         |-->| LOGICAL: OUTPUT LISTING
00097 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00098 !
00099       USE BIEF_DEF, ONLY:NCSIZE
00100       USE INTERFACE_TELEMAC2D, EX_CALDT => CALDT
00101       IMPLICIT NONE
00102       INTEGER LNG,LU
00103       COMMON/INFO/LNG,LU
00104 !
00105 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00106 !
00107       INTEGER, INTENT(IN) :: NS,ICIN
00108       DOUBLE PRECISION, INTENT(INOUT) :: DT
00109       DOUBLE PRECISION, INTENT(IN) :: H(NS),U(NS),V(NS),DTHAUT(NS)
00110       DOUBLE PRECISION, INTENT(IN) :: G,CFL,AT,TMAX
00111       LOGICAL, INTENT(IN) :: DTVARI,LISTIN
00112 !
00113 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00114 !
00115       INTEGER IS
00116       LOGICAL DEJA
00117       DOUBLE PRECISION RA3,EPSL,SIGMAX,UA2,UA3,UNORM,DTT
00118       DOUBLE PRECISION P_DMIN
00119       EXTERNAL P_DMIN
00120 !
00121 !-----------------------------------------------------------------------
00122 !
00123 !   +++++++++++++++++++++++++
00124 !     VARIABLE TIME STEP
00125       IF(DTVARI)THEN
00126 !   +++++++++++++++++++++++++
00127       DEJA=.FALSE.
00128       DT = 1.E+12
00129       EPSL = 0.01D0
00130 !
00131       IF(ICIN.EQ.1) THEN
00132 !       KINETIC SCHEME
00133 !
00134         RA3 = SQRT(1.5D0*G)
00135         DO IS=1,NS
00136           IF(H(IS).LT.0.D0.AND.LISTIN.AND..NOT.DEJA)THEN
00137             WRITE(LU,*) 'CALDT WARNING : NEGATIVE WATER DEPTH'
00138             WRITE(LU,*) ' SEE NODE:',IS,' FOR EXAMPLE'
00139             DEJA = .TRUE.
00140           ELSE
00141             SIGMAX = ABS(H(IS))
00142             UA2    = U(IS)
00143             UA3    = V(IS)
00144             UNORM=SQRT(UA2*UA2 + UA3*UA3)
00145             SIGMAX= MAX(EPSL, RA3*SQRT(SIGMAX) +UNORM )
00146             DT = MIN(DT, CFL*DTHAUT(IS)/SIGMAX)
00147           ENDIF
00148         ENDDO
00149 !
00150       ELSEIF(ICIN.EQ.0.OR.ICIN.EQ.2.OR.ICIN.EQ.3.OR.
00151      &       ICIN.EQ.4.OR.ICIN.EQ.5) THEN
00152 !     SCHEMES OF ROE, ZOKAGOA, TCHAMEN, HLLC AND WAF
00153 !
00154         DO IS=1,NS
00155           IF(H(IS).LT.0.D0.AND.LISTIN.AND..NOT.DEJA)THEN
00156             WRITE(LU,*) 'CALDT WARNING : NEGATIVE WATER DEPTH'
00157             WRITE(LU,*) ' SEE NODE:',IS,' FOR EXAMPLE'
00158             DEJA = .TRUE.
00159           ELSE
00160             UA2    = U(IS)
00161             UA3    = V(IS)
00162             UNORM=SQRT(UA2*UA2 + UA3*UA3)
00163             SIGMAX= MAX(EPSL,SQRT(G*ABS(H(IS)))+UNORM)
00164 !           DTHAUT=|Ci|/Sum(Lij)
00165             DT = MIN(DT, CFL*DTHAUT(IS)/SIGMAX)
00166           ENDIF
00167         ENDDO
00168 !
00169       ELSE
00170         IF(LNG.EQ.1) WRITE(LU,4010) ICIN
00171         IF(LNG.EQ.2) WRITE(LU,4020) ICIN
00172 4010    FORMAT(1X,'CALDT: ERREUR DANS LE CHOIX DE ICIN : ',1I6)
00173 4020    FORMAT(1X,'CALDT: ERROR IN THE CHOICE OF ICIN: ',1I6)
00174         CALL PLANTE(1)
00175         STOP
00176       ENDIF
00177       ENDIF
00178 !
00179 !*************************************************************************
00180 !     ERROR TREATMENT AND LISTING OUTPUTS
00181 !*************************************************************************
00182 !
00183 !     CASE DT <=0
00184 !
00185       IF(DT.LE.0.D0) THEN
00186         IF(LISTIN.AND.LNG.EQ.1) THEN
00187           WRITE(LU,*) 'PAS DE TEMPS NEGATIF OU NUL: ',DT
00188           WRITE(LU,*) 'PROBABLEMENT A CAUSE D UNE HAUTEUR'
00189           WRITE(LU,*) 'D EAU NULLE PARTOUT ...'
00190         ENDIF
00191         IF(LISTIN.AND.LNG.EQ.2) THEN
00192           WRITE(LU,*) 'NEGATIVE (OR NIL) TIME-STEP: ',DT
00193           WRITE(LU,*) 'PROBABLY DUE TO NIL WATER'
00194           WRITE(LU,*) 'DEPTH EVERYWHERE IN THE DOMAIN ...'
00195         ENDIF
00196         CALL PLANTE(1)
00197         STOP
00198       ENDIF
00199 !
00200       IF(DTVARI) THEN
00201 !
00202         IF(TMAX.LT.DT)DT=TMAX !REALLY CRAZY CASES
00203         DTT=TMAX-AT
00204         IF(CFL.GE.1.D0) DT=0.9D0*DT/CFL
00205         IF(DTT.LT.DT.AND.DTT.GT.0.D0) DT=DTT !LAST TIME STEP
00206         IF(AT.GT.TMAX) THEN
00207           IF(LNG.EQ.1) THEN
00208             WRITE(LU,*)'CALDT: MAUVAIS CHOIX DE PARAMETRES DE TEMPS '
00209             WRITE(LU,*)'TEMPS ET TEMPS MAX',AT,TMAX
00210           ENDIF
00211           IF(LNG.EQ.2) THEN
00212             WRITE(LU,*)'CALDT: BAD TIME PARAMETERS'
00213             WRITE(LU,*)'TIME AND TMAX',AT,TMAX
00214           ENDIF
00215           CALL PLANTE(1)
00216           STOP
00217         ENDIF
00218 !
00219 !       FOR PARALLELISM
00220 !
00221         IF(NCSIZE.GT.1) DT=P_DMIN(DT)
00222 !
00223         IF(LISTIN.AND.LNG.EQ.1) WRITE(LU,*) 'PAS DE TEMPS : ',DT
00224         IF(LISTIN.AND.LNG.EQ.2) WRITE(LU,*) 'TIME-STEP: ',DT
00225         IF(CFL.GE.1.D0) THEN
00226           IF(LISTIN.AND.LNG.EQ.1) THEN
00227             WRITE(LU,*) 'ATTENTION CFL NON FOURNI OU > 1 !...!'
00228             WRITE(LU,*) 'PAS DE TEMPS (AVEC CFL = 0.9) : ',DT
00229           ELSEIF(LISTIN.AND.LNG.EQ.2) THEN
00230             WRITE(LU,*) 'WARNING: CFL NOT GIVEN OR >1 !...! '
00231             WRITE(LU,*) 'TIME-STEP (WITH CFL = 0.9): ',DT
00232           ENDIF
00233         ENDIF
00234 !
00235       ELSE
00236 !
00237 !       DT NOT VARIABLE
00238 !
00239         IF(LISTIN.AND.LNG.EQ.1) THEN
00240           WRITE(LU,*) 'ATTENTION: PAS DE TEMPS FIXE ET CFL NON FOURNI.!'
00241           WRITE(LU,*) 'PAS DE TEMPS PEUT NE PAS VERIFIER LE CFL : ',DT
00242         ELSEIF(LISTIN.AND.LNG.EQ.2) THEN
00243           WRITE(LU,*) 'WARNING: FIXED TIME-STEP AND CFL NOT GIVEN!...! '
00244           WRITE(LU,*) 'TIME-STEP MAY NOT SATISFY CFL CONDITION: ',DT
00245         ENDIF
00246 !
00247       ENDIF
00248 !
00249 !-----------------------------------------------------------------------
00250 !
00251       RETURN
00252       END

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