cvdftr.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\utils\bief\cvdftr.f
00002 !
00162                      SUBROUTINE CVDFTR
00163 !                    *****************
00164 !
00165      &(F,FTILD,FN,FSCEXP,DIFT,ICONVF,CONV,
00166      & H,HN,HPROP,TETAH,UCONV,VCONV,DM1,ZCONV,SOLSYS,
00167      & VISC,VISC_S,SM,SMH,YASMH,SMI,YASMI,AM1,AM2,
00168      & ZF,FBOR,AFBOR,BFBOR,LIMTRA,MASKTR,MESH,W,TB,
00169      & T1,T2,T3,T4,T5,T6,T7,T10,TE1,TE2,TE3,KDIR,KDDL,KENT,DT,ENTET,
00170      & TETAT,AGGLOT,INFOGT,BILAN,OPTADV,
00171      & ISOUSI,LT,NIT,OPDTRA,OPTBAN,MSK,MASKEL,MASKPT,MBOR,
00172      & S,MASSOU,OPTSOU,SLVTRA,FLBOR,VOLU2D,V2DPAR,UNSV2D,OPTVF,FLBORTRA,
00173      & FLULIM,YAFLULIM,DIRFLU,RAIN,PLUIE,TRAIN,
00174      & GIVEN_FLUX,FLUX_GIVEN,MAXADV)
00175 !
00176 !***********************************************************************
00177 ! BIEF   V7P0                                   21/08/2010
00178 !***********************************************************************
00179 !
00180 !
00181 !
00182 !
00183 !
00184 !
00185 !
00186 !
00187 !
00188 !
00189 !
00190 !
00191 !
00192 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00193 !| AFBOR,BFBOR    |-->| COEFFICIENTS OF NEUMANN CONDITION
00194 !|                |   | VISC*DF/DN = AFBOR*F + BFBOR
00195 !|                |   | GIVEN FOR EVERY BOUNDARY POINT
00196 !| AGGLOT         |-->| MASS-LUMPING COEFFICIENT FOR T.
00197 !| AM1            |<->| MATRIX.
00198 !| AM2            |<->| MATRIX.
00199 !| BILAN          |-->| LOGICAL, IF YES A BALANCE OF MASS EXCHANGES HAS
00200 !|                |   | TO BE DONE.
00201 !| CONV           |-->| IF YES ADVECTION OF F
00202 !| DIFT           |-->| IF YES, DIFFUSION IS DONE
00203 !| DIRFLU         |-->| 1: PRIORITY TO DIRICHLET VALUES (CALL DIRICH DONE)
00204 !|                |   | 2: PRIORITY TO FLUXES (CALL DIRICH NOT DONE)
00205 !| DM1            |-->| THE PIECE-WISE CONSTANT PART OF ADVECTION FIELD
00206 !|                |   | IS DM1*GRAD(ZCONV), SEE SOLSYS.
00207 !| DT             |-->| TIME STEP
00208 !| ENTET          |-->| LOGICAL, IF YES INFORMATION IS GIVEN ON MASS
00209 !|                |   | CONSERVATION.
00210 !| F              |<--| F AT TIME T(N+1)
00211 !| FBOR           |-->| DIRICHLET CONDITIONS ON F.
00212 !| FLBOR          |-->| FLUXES AT BOUNDARIES
00213 !| FLBORTRA       |<->| TRACER FLUXES AT BOUNDARIES
00214 !| FLUX_GIVEN     |-->| IF GIVEN_FLUX=YES, THE FLUX IS GIVEN IN
00215 !|                |   | GIVEN_FLUX
00216 !| FN             |-->| F AT TIME T(N)
00217 !| FSCEXP         |-->| EXPLICIT PART OF THE SOURCE TERM
00218 !|                |   | EQUAL TO ZERO EVERYWHERE BUT ON SOURCES
00219 !|                |   | WHERE THERE IS FSCE - (1-TETAT) FN
00220 !|                |   | SEE DIFSOU
00221 !| FTILD          |-->| F AFTER ADVECTION
00222 !| GIVEN_FLUX     |-->| IF GIVEN_FLUX=YES, THE FLUX IS GIVEN IN
00223 !|                |   | GIVEN_FLUX AND WILL NOT BE COMPUTED HERE
00224 !| HPROP          |-->| WORK ARRAY
00225 !| ICONVF         |-->| OPTION FOR ADVECTION TERMS
00226 !|                |   | ICONVF = 1 : CHARACTERISTICS.
00227 !|                |   | ICONVF = 2 : S.U.P.G.
00228 !|                |   | ICONVF = 3 : CONSERVATIVE FINITE VOLUMES
00229 !|                |   | ICONVF = 4 : IDEM
00230 !|                |   | ICONVF = 6 : NON CONSERVATIVE PSI SCHEME.
00231 !|                |   | ICONVF = 7 : NON CONSERVATIVE N SCHEME.
00232 !|                |   | ICONVF =13 : EDGE BY EDGE FORM OF 3
00233 !|                |   | ICONVF =14 : IDEM
00234 !| INFOGT         |-->| LOGICAL, IF YES INFORMATION ON SOLVER WILL BE
00235 !|                |   | PRINTED.
00236 !| ISOUSI         |-->| SUB-ITERATION NUMBER
00237 !| KDDL           |-->| CONVENTION FOR DEGREE OF FREEDOM
00238 !| KDIR           |-->| CONVENTION FOR DIRICHLET POINT
00239 !| KENT           |-->| CONVENTION FOR INFLOW POINT
00240 !| LIMTRA         |-->| BOUNDARY CONDITIONS ON BOUNDARY POINTS
00241 !| LT,NIT         |-->| CURRENT TIME-STEP, TOTAL NUMBER OF STEPS
00242 !| MASKEL         |-->| MASKING OF ELEMENTS
00243 !|                |   | =1. : NORMAL   =0. : MASKED ELEMENT
00244 !| MASKPT         |-->| MASKING PER POINT.
00245 !| MASSOU         |-->| MASS OF TRACER ADDED BY SOURCE TERM
00246 !|                |   | SEE DIFSOU
00247 !| MAXADV         |-->| MAXIMUM NUMBER OF ITERATIONS OF ADVECTION SCHEMES
00248 !| MBOR           |-->| BOUNDARY MATRIX
00249 !| MESH           |-->| MESH STRUCTURE
00250 !| MSK            |-->| IF YES, THERE IS MASKED ELEMENTS.
00251 !| OPDTRA         |-->| OPTION FOR THE DIFFUSION OF TRACERS
00252 !| OPTADV         |-->| ADVECTION SCHEME OPTION, THE MEANING DEPENDS ON
00253 !|                |   | ICONVF
00254 !|                |   | IF SCHEME IS SUPG:
00255 !|                |   | 0: NO SUPG UPWIND
00256 !|                |   | 1: CLASSIC SUPG
00257 !|                |   | 2: MODIFIED SUPG
00258 !|                |   | IF SCHEME IS PSI:
00259 !|                |   | 1: EXPLICIT
00260 !|                |   | 2: PREDICTOR-CORRECTOR
00261 !| OPTBAN         |-->| OPTION FOR THE TREATMENT OF TIDAL FLATS
00262 !|                |   | 1:NORMAL   2:WITH MASKING
00263 !| OPTSOU         |-->| TYPE OF SOURCES
00264 !|                |   | 1: NORMAL
00265 !|                |   | 2: DIRAC
00266 !| OPTVF          |-->| OPTIONS FOR FINITE VOLUMES (SEE CVTRVF)
00267 !| PLUIE          |-->| RAIN OR EVAPORATION, IN M/S
00268 !| RAIN           |-->| IF YES: RAIN OR EVAPORATION
00269 !| S              |-->| VOID STRUCTURE
00270 !| SLVTRA         |-->| SOLVER CONFIGURATION (SLVCFG) STRUCTURE
00271 !|                |   | CONTAINING DATA FOR CALLING SOLVE
00272 !| SM             |-->| SOURCE TERMS.
00273 !| SMH            |-->| SOURCE TERM IN CONTINUITY EQUATION
00274 !| SMI            |-->| IMPLICIT SOURCE TERM
00275 !| SOLSYS         |-->| 1 OR 2. IF 2 ADVECTION FIELD IS UCONV + DM1*GRAD(ZCONV)
00276 !| T1             |<->| WORK BIEF_OBJ STRUCTURE
00277 !| T10            |<->| WORK BIEF_OBJ STRUCTURE
00278 !| T2             |<->| WORK BIEF_OBJ STRUCTURE
00279 !| T3             |<->| WORK BIEF_OBJ STRUCTURE
00280 !| T4             |<->| WORK BIEF_OBJ STRUCTURE
00281 !| T5             |<->| WORK BIEF_OBJ STRUCTURE
00282 !| T6             |<->| WORK BIEF_OBJ STRUCTURE
00283 !| T7             |<->| WORK BIEF_OBJ STRUCTURE
00284 !| TB             |<->| BLOCK OF WORK BIEF_OBJ STRUCTURES (CONTAINS T1,...)
00285 !| TE1,TE2,TE3    |<->| WORK BIEF_OBJ STRUCTURE FOR ELEMENTS
00286 !| TETAH          |-->| IMPLICITATION BETWEEN H AND HN
00287 !| TETAT          |-->| IMPLICITATION COEFFICIENT OF ADVECTION
00288 !| TRAIN          |-->| VALUE OF TRACER IN THE RAIN
00289 !| UCONV,VCONV    |-->| ADVECTION VELOCITY FIELD
00290 !| UNSV2D         |-->| =1/V2DPAR
00291 !| VOLU2D         |-->| INTEGRAL OF TEST FUNCTIONS (NOT ASSEMBLED IN PARALLEL)
00292 !| V2DPAR         |-->| INTEGRAL OF TEST FUNCTIONS (ASSEMBLED IN PARALLEL)
00293 !| VISC           |-->| VISCOSITY COEFFICIENTS ALONG X,Y AND Z .
00294 !|                |   | IF P0 : PER ELEMENT
00295 !|                |   | IF P1 : PER POINT
00296 !| VISC_S         |<->| WORK ARRAY FOR SAVING VISC
00297 !| W              |-->| WORK ARRAY OF DIMENSION :
00298 !|                |   | NELMAX * (NOMBER OF POINTS IN AN ELEMENT)
00299 !| YASMH          |-->| IF YES SMH TAKEN INTO ACCOUNT
00300 !| YASMI          |-->| IF YES SMI TAKEN INTO ACCOUNT
00301 !| ZCONV          |-->| THE PIECE-WISE CONSTANT PART OF ADVECTION FIELD
00302 !|                |   | IS DM1*GRAD(ZCONV), SEE SOLSYS.
00303 !| ZF             |-->| BOTTOM ELEVATION.
00304 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00305 !
00306       USE BIEF, EX_CVDFTR => CVDFTR
00307       USE INTERFACE_PARALLEL
00308       USE DECLARATIONS_TELEMAC, ONLY : ADV_CAR,ADV_SUP,ADV_NSC,ADV_PSI,
00309      &   ADV_PSI_NC,ADV_NSC_NC,ADV_LPO,ADV_NSC_TF,ADV_PSI_TF,ADV_LPO_TF
00310 !
00311       IMPLICIT NONE
00312       INTEGER LNG,LU
00313       COMMON/INFO/LNG,LU
00314 !
00315 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00316 !
00317       INTEGER, INTENT(IN)           :: ICONVF,ISOUSI,OPTADV,OPDTRA,KENT
00318       INTEGER, INTENT(IN)           :: LT,NIT,OPTBAN,OPTSOU,KDIR,SOLSYS
00319       INTEGER, INTENT(IN)           :: KDDL,OPTVF,DIRFLU,MAXADV
00320       DOUBLE PRECISION, INTENT(IN)  :: TETAT,AGGLOT,TETAH,DT,TRAIN
00321       DOUBLE PRECISION, INTENT(INOUT)  :: MASSOU
00322       LOGICAL, INTENT(IN)           :: INFOGT,BILAN,CONV,YASMH,RAIN
00323       LOGICAL, INTENT(IN)           :: DIFT,MSK,ENTET,YASMI,YAFLULIM
00324       LOGICAL, INTENT(IN)           :: FLUX_GIVEN
00325       TYPE(SLVCFG), INTENT(INOUT)   :: SLVTRA
00326       TYPE(BIEF_OBJ), INTENT(IN)    :: MASKEL,MASKPT,H,HN,AFBOR,BFBOR
00327       TYPE(BIEF_OBJ), INTENT(INOUT) :: HPROP
00328       TYPE(BIEF_OBJ), INTENT(INOUT) :: F,SM,FLBORTRA
00329       TYPE(BIEF_OBJ), INTENT(IN)    :: UCONV,VCONV,ZF
00330       TYPE(BIEF_OBJ), INTENT(IN)    :: FTILD,FN,SMI,FLULIM,PLUIE
00331       TYPE(BIEF_OBJ), INTENT(INOUT) :: SMH,FBOR
00332       TYPE(BIEF_OBJ), INTENT(INOUT) :: TE1,TE2,TE3,W
00333       TYPE(BIEF_OBJ), INTENT(INOUT) :: T1,T2,T3,T4,T5,T6,T7,T10
00334       TYPE(BIEF_OBJ), INTENT(IN)    :: FSCEXP,DM1,ZCONV
00335       TYPE(BIEF_OBJ), INTENT(IN)    :: S,V2DPAR,UNSV2D,VOLU2D
00336       TYPE(BIEF_OBJ), INTENT(INOUT) :: FLBOR,LIMTRA
00337       TYPE(BIEF_OBJ), INTENT(INOUT) :: VISC_S,VISC
00338       TYPE(BIEF_OBJ), INTENT(INOUT) :: AM1,AM2,MBOR
00339       TYPE(BIEF_OBJ), INTENT(INOUT) :: TB
00340       TYPE(BIEF_OBJ), INTENT(IN)    :: MASKTR,GIVEN_FLUX
00341       TYPE(BIEF_MESH)               :: MESH
00342 !
00343 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00344 !
00345       DOUBLE PRECISION C,CFLMAX
00346 !
00347       INTEGER IELMF,IELMH,IELMS,MSKNEU,I,N,IOPT,DIMGLO
00348 !
00349       LOGICAL MSQ,FV_SCHEME
00350 !
00351       CHARACTER*16 FORMUL
00352 !
00353 !-----------------------------------------------------------------------
00354 !
00355       IELMF = F%ELM
00356       IELMH = H%ELM
00357       IELMS = SM%ELM
00358       DIMGLO=MESH%GLOSEG%DIM1
00359 !
00360 !-----------------------------------------------------------------------
00361 !
00362 !     IS IT A FINITE VOLUME SCHEME FOR ADVECTION ?
00363 !
00364       FV_SCHEME=.FALSE.
00365       IF(  ICONVF.EQ.ADV_LPO.OR.ICONVF.EQ.ADV_LPO_TF.OR.
00366      &     ICONVF.EQ.ADV_NSC.OR.ICONVF.EQ.ADV_NSC_TF.OR.
00367      &     ICONVF.EQ.ADV_PSI.OR.ICONVF.EQ.ADV_PSI_TF     ) THEN
00368         FV_SCHEME=.TRUE.
00369       ENDIF
00370 !
00371 !-----------------------------------------------------------------------
00372 !
00373 !     CASE WHERE H AND T DON'T HAVE THE SAME DISCRETISATION
00374 !
00375       IF(IELMF.NE.IELMS) THEN
00376         CALL CHGDIS(SM ,IELMS,IELMF,MESH)
00377       ENDIF
00378       IF(IELMF.NE.IELMH.AND.YASMH) THEN
00379         CALL CHGDIS(SMH ,IELMH,IELMF,MESH)
00380       ENDIF
00381 !
00382 !
00383 !-----------------------------------------------------------------------
00384 !
00385 !     SEMI-IMPLICITATION OF THE DEPTH
00386 !     WITH SCHEME 5 FOR H, TETAH=0
00387 !
00388       CALL OS( 'X=CY    ' , X=HPROP , Y=H     , C=      TETAH )
00389       CALL OS( 'X=X+CY  ' , X=HPROP , Y=HN    , C= 1.D0-TETAH )
00390       CALL OS( 'X=Y     ' , X=T10   , Y=HPROP )
00391       IF(IELMF.NE.IELMH) THEN
00392         CALL CHGDIS(T10,IELMH,IELMF,MESH)
00393       ENDIF
00394 !
00395 !-----------------------------------------------------------------------
00396 !
00397 !     INITIALISES THE VARIABLES
00398 !
00399 !     SOLUTION INITIALISED TO F AT TIME N
00400       IF(ISOUSI.EQ.1) CALL OS( 'X=Y     ' , X=F , Y=FN )
00401 !
00402 !-----------------------------------------------------------------------
00403 !
00404 !-----------------------------------------------------------------------
00405 !  IF SUPG, BUILDS THE SEMI-IMPLICIT MATRIX + SUPG IN AM2
00406 !
00407       IF(ICONVF.EQ.ADV_SUP.AND.CONV) THEN
00408 !
00409 !       TERM IN U.GRAD(T) CENTERED:
00410 !
00411         CALL MATRIX(AM2,'M=N     ','MATVGR          ',IELMF,IELMF,
00412      &              1.D0,S,S,S,UCONV,VCONV,S,
00413      &              MESH,MSK,MASKEL)
00414 !
00415 !       ADDS SUPG CONTRIBUTION TO AM2
00416 !
00417         IF(OPTADV.EQ.1) THEN
00418 !         CLASSICAL SUPG
00419           CALL KSUPG(TE1,TE2,1.D0,UCONV,VCONV,MESH)
00420           CALL MATRIX(AM2,'M=M+N   ','MASUPG          ',IELMF,IELMF,
00421      &                1.D0,TE1,TE2,S,UCONV,VCONV,S,MESH,MSK,MASKEL)
00422 !
00423         ELSEIF(OPTADV.EQ.2) THEN
00424 !         MODIFIED SUPG
00425           CALL MATRIX(AM2,'M=M+N   ','MAUGUG          ',IELMF,IELMF,
00426      &                0.5D0*DT,S,S,S,UCONV,VCONV,S,MESH,MSK,MASKEL)
00427         ELSEIF(OPTADV.NE.0) THEN
00428           IF(LNG.EQ.1) THEN
00429             WRITE(LU,*) 'CVDFTR : OPTION POUR SUPG INCONNUE =',OPTADV
00430           ENDIF
00431           IF(LNG.EQ.2) THEN
00432             WRITE(LU,*) 'CVDFTR: UNKNOWN OPTION FOR SUPG =',OPTADV
00433           ENDIF
00434           CALL PLANTE(1)
00435           STOP
00436         ENDIF
00437 !
00438 !     NON CONSERVATIVE, IMPLICIT N-SCHEME EQUATION
00439       ELSEIF(ICONVF.EQ.ADV_NSC_NC) THEN
00440 !
00441 !       TERM IN U.GRAD(T) (IMPLICIT N-SCHEME)
00442 !
00443         CALL MATRIX(AM2,'M=N     ','MATVGR         N',IELMF,IELMF,
00444      &              1.D0,S,S,S,UCONV,VCONV,S,MESH,MSK,MASKEL)
00445 !
00446       ENDIF
00447 !
00448 !-----------------------------------------------------------------------
00449 !
00450 !   COMPUTES AM1: MASS MATRIX MULTIPLIED BY 1/DT
00451 !
00452       IF(DIFT.OR..NOT.FV_SCHEME.OR..NOT.CONV.OR.BILAN) THEN
00453 !
00454       IF(OPTBAN.EQ.1.OR.OPTBAN.EQ.3) THEN
00455         CALL OS('X=Y+Z   ',T2,ZF,HN,C)
00456         CALL DECVRT(TE3,T2,ZF,MESH)
00457 !       MASS MATRIX LOCALLY LUMPED ON THE TIDAL FLATS
00458         FORMUL='MSLUMP          '
00459 !       WILL USE MSQ TO MASK THE DIFFUSION
00460         MSQ=.TRUE.
00461         IF(MSK) CALL OS('X=XY    ',TE3,MASKEL,MASKEL,C)
00462       ELSE
00463 !       NORMAL MASS MATRIX
00464         FORMUL='MATMAS          '
00465 !       MASK FOR THE DIFFUSION = MASKEL
00466         IF(MSK) CALL OS('X=Y     ',TE3,MASKEL,MASKEL,C)
00467         MSQ=MSK
00468       ENDIF
00469       CALL MATRIX(AM1,'M=N     ',FORMUL,IELMF,IELMF,
00470      &            1.D0/DT,TE3,S,S,S,S,S,MESH,MSK,MASKEL)
00471 !
00472 !   POSSIBLE MASS-LUMPING
00473 !
00474       IF(AGGLOT.GT.0.001D0) THEN
00475         CALL LUMP(T1,AM1,MESH,AGGLOT)
00476         CALL OM( 'M=CN    ' , AM1 , AM1 , S  , 1.D0-AGGLOT , MESH )
00477         CALL OM( 'M=M+D   ' , AM1 , AM1 , T1 , C           , MESH )
00478       ENDIF
00479 !
00480       ENDIF
00481 !
00482 !-----------------------------------------------------------------------
00483 !
00484 !     NOTE JMH ON 23/02/2012
00485 !
00486 !     THIS IMPLEMENTATION IS WRONG (AND IS MINE...)
00487 !     THE ADDED QUANTITY IS RATHER FUNCTION OF
00488 !     H(n+1)*T(n+1)-H(n)*T(n), AND THIS MAY BE 0 EVEN IF SM IS NOT 0
00489 !     FOR EXAMPLE RAIN CREATES A SOURCE TERM, BUT NO MASS OF TRACER
00490 !     SO FAR POINT SOURCES ADD THEIR QUANTITIES TO MASSOU IN DIFSOU
00491 !     AND ANY OTHER SOURCE TERM LIKE RAIN SHOULD MODIFY MASSOU ON ITS
00492 !     OWN, IN A MORE SIMPLE WAY
00493 !
00494 !     IF(BILAN) THEN
00495 !
00496 !       CALL MATVEC( 'X=AY    ',T2,AM1,SM,C,MESH)
00497 !       IF(NCSIZE.GT.1) THEN
00498 !         CALL PARCOM(T2,2,MESH)
00499 !         MASSOU = MASSOU + P_DOTS(T2,T10,MESH)
00500 !       ELSE
00501 !         MASSOU = MASSOU + DOTS(T2,T10)
00502 !       ENDIF
00503 !
00504 !     ENDIF
00505 !
00506 !-----------------------------------------------------------------------
00507 !
00508 !   COMPUTES THE SECOND MEMBERS
00509 !
00510 !     COMPUTES DT * SM IN T2
00511 !
00512 !     CVTRVF AND CVTRVF_POS WILL TREAT SM IN A DIFFERENT WAY
00513 !
00514       IF(.NOT.FV_SCHEME) THEN
00515         CALL OS( 'X=CY    ' , X=T2 , Y=SM , C=DT )
00516       ENDIF
00517 !
00518 !=======================================================================
00519 ! TREATS THE VARIOUS TYPES OF ADVECTION:
00520 !-----------------------------------------------------------------------
00521 !
00522       IF(ICONVF.EQ.ADV_CAR.OR..NOT.CONV) THEN
00523 !
00524         CALL OS( 'X=X+Y   ' , X=T2 , Y=FTILD )
00525         CALL MATVEC( 'X=AY    ',SM,AM1,T2,C,MESH)
00526 !
00527 !-----------------------------------------------------------------------
00528 !
00529       ELSEIF(ICONVF.EQ.ADV_SUP.AND.CONV) THEN
00530 !
00531 !       AM1 MADE NONSYMMETRICAL IF IT WAS NOT ALREADY
00532 !
00533         IF(AM1%TYPEXT.NE.'Q') THEN
00534           CALL OM( 'M=X(M)  ' , AM1 , AM1 , S , C , MESH )
00535         ENDIF
00536 !
00537 !       SUPG CONTRIBUTION TO THE MASS MATRIX
00538 !
00539         IF(OPTADV.EQ.1) THEN
00540 !         CLASSICAL SUPG
00541 !         TE1 AND TE2 ALREADY COMPUTED
00542           CALL MATRIX(AM1,'M=M+TN    ','MATVGR          ',IELMF,IELMF,
00543      &                1.D0/DT,S,S,S,TE1,TE2,S,MESH,MSK,MASKEL)
00544 !
00545         ELSEIF(OPTADV.EQ.2) THEN
00546 !         MODIFIED SUPG
00547           CALL MATRIX(AM1,'M=M+TN    ','MATVGR          ',IELMF,IELMF,
00548      &                0.5D0,S,S,S,UCONV,VCONV,S,MESH,MSK,MASKEL)
00549         ELSEIF(OPTADV.NE.0) THEN
00550           IF(LNG.EQ.1) THEN
00551             WRITE(LU,*) 'CVDFTR : OPTION POUR SUPG INCONNUE =',OPTADV
00552           ENDIF
00553           IF(LNG.EQ.2) THEN
00554             WRITE(LU,*) 'CVDFTR: UNKNOWN OPTION FOR SUPG =',OPTADV
00555           ENDIF
00556           CALL PLANTE(1)
00557           STOP
00558         ENDIF
00559 !
00560 !       END OF THE SUPG CONTRIBUTION TO THE MASS MATRIX
00561 !
00562         CALL OS( 'X=X+Y   ' , T2 , FN , FN , C )
00563         CALL MATVEC( 'X=AY    ',SM,AM1,T2,C,MESH)
00564 !
00565 ! EXPLICIT ADVECTION TERM:
00566 !
00567         CALL MATVEC( 'X=X+CAY ',SM,AM2,FN,TETAT-1.D0,MESH)
00568 !
00569 ! ADDS THE IMPLICIT ADVECTION PART IN AM2 TO AM1
00570 !
00571         CALL OM( 'M=M+CN  ' , AM1,AM2 , S , TETAT , MESH )
00572 !
00573 !-----------------------------------------------------------------------
00574 !
00575       ELSEIF(ICONVF.EQ.ADV_NSC_NC.AND.CONV) THEN
00576 !
00577 !       AM1 MADE NONSYMMETRICAL IF IT WAS NOT ALREADY
00578 !
00579         IF(AM1%TYPEXT.NE.'Q') THEN
00580           CALL OM( 'M=X(M)  ' , AM1 , AM1 , S , C , MESH )
00581         ENDIF
00582 !
00583         CALL OS( 'X=X+Y   ' , T2 , FN , FN , C )
00584         CALL MATVEC( 'X=AY    ',SM,AM1,T2,C,MESH)
00585 !
00586 ! EXPLICIT ADVECTION TERM:
00587 !
00588         CALL MATVEC( 'X=X+CAY ',SM,AM2,FN,TETAT-1.D0,MESH)
00589 !
00590 ! ADDS THE IMPLICIT ADVECTION PART IN AM2 TO AM1
00591 !
00592         CALL OM( 'M=M+CN  ' , AM1,AM2 , S , TETAT , MESH )
00593 !
00594 !-----------------------------------------------------------------------
00595 !
00596       ELSEIF(ICONVF.EQ.ADV_PSI_NC.AND.CONV) THEN
00597 !
00598 ! PSI SCHEME
00599 !
00600 !       TRADITIONAL AM1 * FN TERM
00601 !
00602         CALL OS( 'X=X+Y   ' , T2 , FN , FN , C )
00603         CALL MATVEC( 'X=AY    ',SM,AM1,T2,C,MESH)
00604 !
00605 !       EXPLICIT ADVECTION TERM (PSI SCHEME)
00606 !
00607         CALL VGFPSI(T5,IELMF,UCONV,VCONV,FN,DT,-1.D0,CFLMAX,
00608      &              T6,T7,MESH,MSK,MASKEL)
00609         CALL OS( 'X=X+Y   ' , SM , T5 , T5 , C )
00610 !
00611 !-----------------------------------------------------------------------
00612 !
00613       ELSEIF( (ICONVF.EQ.ADV_LPO.OR.
00614      &         ICONVF.EQ.ADV_NSC.OR.
00615      &         ICONVF.EQ.ADV_PSI    ).AND.CONV ) THEN
00616 !
00617 ! CONSERVATIVE EQUATION, DISTRIBUTIVE SCHEMES (LEO POSTMA, N AND PSI)
00618 !                        LEO POSTMA AND N-SCHEME ARE THE SAME IN 2D
00619 !
00620 !       TO BE REMOVED WHEN ALL CALLS TO CVDFTR ARE CHECKED
00621 !       OPTVF SHOULD BE 0 (VELOCITY FIELD OBEYS THE CONTINUITY EQUATION)
00622 !       OR 10 (VELOCITY FIELD DOES NOT OBEY THE CONTINUITY EQUATION)
00623         IOPT=10*(OPTVF/10)
00624 !       OPTION TO DISTRIBUTE THE FLUXES (HERE 2 OR 3)
00625         IF(ICONVF.EQ.ADV_LPO) IOPT=IOPT+2
00626         IF(ICONVF.EQ.ADV_NSC) IOPT=IOPT+2
00627         IF(ICONVF.EQ.ADV_PSI) IOPT=IOPT+3
00628 !
00629         IF(TB%N.LT.22) THEN
00630           WRITE(LU,*) 'SIZE OF TB TOO SMALL IN CVDFTR'
00631           CALL PLANTE(1)
00632           STOP
00633         ENDIF
00634         CALL CVTRVF(F,FN,FSCEXP,DIFT,CONV,H,HN,HPROP,UCONV,VCONV,
00635      &              DM1,ZCONV,SOLSYS,VISC,VISC_S,SM,SMH,YASMH,SMI,YASMI,
00636      &              FBOR,MASKTR,MESH,
00637      &              TB%ADR(13)%P,TB%ADR(14)%P,TB%ADR(15)%P,
00638      &              TB%ADR(16)%P,TB%ADR(17)%P,TB%ADR(18)%P,
00639      &              TB%ADR(19)%P,TB%ADR(20)%P,TB%ADR(21)%P,
00640      &              TB%ADR(22)%P,
00641      &              AGGLOT,TE1,DT,ENTET,BILAN,
00642      &              OPDTRA,MSK,MASKEL,S,MASSOU,OPTSOU,
00643 !                                                       YAFLBOR
00644      &              LIMTRA%I,KDIR,KDDL,MESH%NPTFR,FLBOR,.TRUE.,
00645      &              VOLU2D,V2DPAR,UNSV2D,IOPT,FLBORTRA,MASKPT,
00646      &              RAIN,PLUIE,TRAIN,OPTADV)
00647 !       IF EXITS AT THIS POINT, THE DIRICHLET ARE NOT DONE, ALSO WORKS
00648 !       CAN THEN CHECK THE MASS CONSERVATION EXACTLY
00649         IF(.NOT.DIFT) RETURN
00650         CALL MATVEC( 'X=AY    ',SM,AM1,F,C,MESH)
00651 !
00652 !-----------------------------------------------------------------------
00653 !
00654       ELSEIF( (ICONVF.EQ.ADV_LPO_TF.OR.
00655      &         ICONVF.EQ.ADV_NSC_TF.OR.
00656      &         ICONVF.EQ.ADV_PSI_TF    ).AND.CONV ) THEN
00657 !
00658 ! EDGE-BASED VERSIONS, FOR TIDAL FLATS
00659 ! CONSERVATIVE EQUATION, DISTRIBUTIVE SCHEMES (LEO POSTMA, N AND PSI)
00660 !                        LEO POSTMA AND N-SCHEME ARE THE SAME IN 2D
00661 !
00662 !       OPTION TO DISTRIBUTE THE FLUXES (HERE 2 OR 3 AND 12 OR 13)
00663         IOPT=10*(OPTVF/10)
00664         IF(ICONVF.EQ.ADV_LPO_TF) IOPT=IOPT+2
00665         IF(ICONVF.EQ.ADV_NSC_TF) IOPT=IOPT+2
00666         IF(ICONVF.EQ.ADV_PSI_TF) IOPT=IOPT+3
00667         IF(TB%N.LT.22) THEN
00668           WRITE(LU,*) 'SIZE OF TB TOO SMALL IN CVDFTR'
00669           CALL PLANTE(1)
00670           STOP
00671         ENDIF
00672         CALL CVTRVF_POS(F,FN,FSCEXP,DIFT,CONV,H,HN,HPROP,UCONV,VCONV,
00673      &              DM1,ZCONV,SOLSYS,VISC,VISC_S,SM,SMH,YASMH,SMI,YASMI,
00674      &              FBOR,MASKTR,MESH,
00675      &              TB%ADR(13)%P,TB%ADR(14)%P,TB%ADR(15)%P,
00676      &              TB%ADR(16)%P,TB%ADR(17)%P,TB%ADR(18)%P,
00677      &              TB%ADR(19)%P,TB%ADR(20)%P,TB%ADR(21)%P,
00678      &              TB%ADR(22)%P,
00679      &              AGGLOT,TE1,DT,ENTET,BILAN,
00680      &              OPDTRA,MSK,MASKEL,S,MASSOU,OPTSOU,
00681 !                                                       YAFLBOR
00682      &              LIMTRA%I,KDIR,KDDL,MESH%NPTFR,FLBOR,.TRUE.,
00683      &              V2DPAR,UNSV2D,IOPT,FLBORTRA,MASKPT,
00684      &              MESH%GLOSEG%I(       1:  DIMGLO),
00685      &              MESH%GLOSEG%I(DIMGLO+1:2*DIMGLO),
00686      &              MESH%NBOR%I,2,FLULIM%R,YAFLULIM,RAIN,PLUIE,TRAIN,
00687      &              GIVEN_FLUX,FLUX_GIVEN,MAXADV)
00688 !                               2:HARDCODED OPTION FOR ALGORITHM
00689 !                               INDEPENDENT OF SEGMENT NUMBERING.
00690 !       IF EXITS AT THIS POINT, THE DIRICHLET ARE NOT DONE, ALSO WORKS
00691 !       CAN THEN CHECK THE MASS CONSERVATION EXACTLY
00692         IF(.NOT.DIFT) RETURN
00693         CALL MATVEC( 'X=AY    ',SM,AM1,F,C,MESH)
00694       ELSE
00695 !
00696 !-----------------------------------------------------------------------
00697 !
00698         IF(LNG.EQ.1) THEN
00699           WRITE(LU,*) 'CVDFTR : OPTION DE CONVECTION INCONNUE : ',ICONVF
00700         ENDIF
00701         IF(LNG.EQ.2) THEN
00702           WRITE(LU,*) 'CVDFTR: UNKNOWN ADVECTION OPTION : ',ICONVF
00703         ENDIF
00704         CALL PLANTE(1)
00705         STOP
00706 !
00707 !-----------------------------------------------------------------------
00708 !
00709       ENDIF
00710 !
00711 ! END OF TREATMENT OF THE VARIOUS TYPES OF ADVECTION:
00712 !=======================================================================
00713 !
00714 !                   COMPUTES THE MATRICES
00715 !
00716 !-----------------------------------------------------------------------
00717 !   COMPUTES AM2 : - DIFFUSION MATRIX, AND BOUNDARY TERMS
00718 !
00719       IF(DIFT) THEN
00720 !
00721         IF(OPDTRA.EQ.2) THEN
00722 !             SAVES THE DIFFUSION
00723               CALL OS('X=Y     ',VISC_S,VISC,VISC,C)
00724 !             MULTIPLIES THE DIFFUSION BY HPROP
00725            CALL OV_2('X=XY    ',VISC%R,1,T10%R,1,T10%R,1,C,
00726      &                          VISC%MAXDIM1,VISC%DIM1)
00727            IF(VISC%DIM2.EQ.3) THEN
00728            CALL OV_2('X=XY    ',VISC%R,2,T10%R,1,T10%R,1,C,
00729      &                          VISC%MAXDIM1,VISC%DIM1)
00730            CALL OV_2('X=XY    ',VISC%R,3,T10%R,1,T10%R,1,C,
00731      &                          VISC%MAXDIM1,VISC%DIM1)
00732            ENDIF
00733         ENDIF
00734 !
00735 !       COMPUTES THE DIFFUSION MATRIX (OPTION WITH MONOTONICITY)
00736 !
00737         CALL MATRIX(AM2,'M=N     ','MATDIF       MON',IELMF,IELMF,
00738      &              1.D0,S,S,S,VISC,S,S,MESH,MSQ,TE3)
00739 !
00740         IF(OPDTRA.EQ.2) THEN
00741 !         MULTIPLIES THE MATRIX BY 1/HPROP
00742           CALL OS( 'X=1/Y   ',T4,T10,T10,C,
00743      &             IOPT=2,INFINI=0.D0,ZERO=1.D-2)
00744           CALL OM( 'M=X(M)  ' , AM2 , AM2 , S  , C , MESH )
00745           CALL OM( 'M=DM    ' , AM2 , AM2 , T4 , C , MESH )
00746 !         RETURNS THE DIFFUSION
00747           CALL OS('X=Y     ',VISC,VISC_S,VISC_S,C)
00748         ENDIF
00749 !
00750 !   TAKES THE BOUNDARY TERMS INTO ACCOUNT IN THE DIFFUSION MATRIX
00751 !
00752         MSKNEU=3
00753 !
00754         IF(MESH%NELEB.GT.0) THEN
00755           CALL MATRIX(MBOR,'M=N     ','FMATMA          ',
00756      &                IELBOR(IELMF,1),IELBOR(IELMF,1),
00757      &                -1.D0,AFBOR,S,S,S,S,S,
00758      &                MESH,.TRUE.,MASKTR%ADR(MSKNEU)%P)
00759           CALL OM( 'M=M+N   ' , AM2 , MBOR , S , C , MESH )
00760         ENDIF
00761 !
00762 !       EXPLICIT DIFFUSION TERM
00763 !
00764         CALL MATVEC( 'X=AY    ',T1,AM2,FN,C,MESH)
00765         CALL OS( 'X=X+CY  ' , SM , T1 , T1 , TETAT-1.D0 )
00766 !
00767 !       IMPLICIT DIFFUSION TERM ( AM1 + TETAT * AM2 )
00768 !
00769         IF(AM1%TYPEXT.NE.'Q'.AND.AM2%TYPEXT.EQ.'Q') THEN
00770           CALL OM( 'M=X(M)  ' , AM1 , AM1 , S , C , MESH )
00771         ENDIF
00772         CALL OM( 'M=M+CN  ' , AM1,AM2 , S , TETAT , MESH )
00773 !
00774 !       BOUNDARY STRESS TERMS
00775 !
00776         CALL VECTOR(T2,'=','MASVEC          ',IELBOR(IELMF,1),
00777      &              1.D0,BFBOR,S,S,S,S,S,MESH,
00778      &              .TRUE.,MASKTR%ADR(MSKNEU)%P)
00779         CALL OSDB( 'X=X+Y   ' , SM , T2 , T2 , C , MESH )
00780 !
00781       ENDIF
00782 !
00783 !-----------------------------------------------------------------------
00784 !
00785 !     IMPLICIT AND EXPLICIT TERM DUE TO THE SOURCES:
00786 !
00787       IF(YASMH.AND..NOT.(FV_SCHEME.AND.CONV)) THEN
00788 !
00789         IF(OPTSOU.EQ.1) THEN
00790 !         JMH MODIFICATION 23/09/98
00791           CALL VECTOR(T2,'=','MASVEC          ',IELMF,
00792      &                1.D0,SMH,S,S,S,S,S,MESH,MSK,MASKEL)
00793           CALL OS( 'X=Y/Z   ' ,T1,T2,T10,C,
00794      &              IOPT=2,INFINI=0.D0,ZERO=1.D-3)
00795 !         IMPLICIT PART OF THE POINT SOURCE TERM
00796 !         - TETAT T 1/HPROP SUM ( SCE PSI D(OMEGA)
00797           CALL OS( 'X=CX    ' , T1 , T1 , T1 , TETAT )
00798           CALL OM( 'M=M+D   ' , AM1 , AM1 , T1 , TETAT , MESH )
00799 !         PREPARES THE EXPLICIT PART
00800           CALL OS( 'X=YZ    ' , T1 , SMH , FSCEXP , C )
00801           CALL VECTOR(T2,'=','MASVEC          ',IELMF,
00802      &                1.D0,T1,S,S,S,S,S,MESH,MSK,MASKEL)
00803           CALL OS( 'X=Y/Z   ' ,T1,T2,T10,C,
00804      &             IOPT=2,INFINI=0.D0,ZERO=1.D-3)
00805           CALL OS( 'X=X+Y   ' , SM , T1 , T1 , C )
00806         ELSEIF(OPTSOU.EQ.2) THEN
00807           CALL OS( 'X=Y/Z   ' ,T1,SMH,T10,C,
00808      &              IOPT=2,INFINI=0.D0,ZERO=1.D-3)
00809 !         EXPLICIT PART OF THE POINT SOURCE TERM
00810 !         1/HPROP (FSCE-(1-TETAT)FN) SMH
00811           CALL OS( 'X=X+YZ  ' , SM , T1 , FSCEXP , C )
00812 !         IMPLICIT PART OF THE POINT SOURCE TERM
00813 !         - TETAT T 1/HPROP SUM ( SCE PSI D(OMEGA)
00814           CALL OS( 'X=CX    ' ,X=T1,C=TETAT )
00815           CALL OM( 'M=M+D   ' , AM1 , AM1 , T1 , TETAT , MESH )
00816         ENDIF
00817 !
00818       ENDIF
00819 !
00820 !     IMPLICIT AND EXPLICIT TERM DUE TO RAIN AND EVAPORATION
00821 !
00822       IF(RAIN.AND..NOT.(FV_SCHEME.AND.CONV)) THEN
00823 !
00824         CALL VECTOR(T2,'=','MASVEC          ',IELMF,
00825      &              1.D0,PLUIE,S,S,S,S,S,MESH,MSK,MASKEL)
00826         CALL OS('X=Y/Z   ' ,T1,T2,T10,C,
00827      &          IOPT=2,INFINI=0.D0,ZERO=1.D-3)
00828 !       IMPLICIT PART OF THE POINT SOURCE TERM
00829 !       - TETAT T 1/HPROP SUM ( SCE PSI D(OMEGA)
00830         CALL OS('X=CX    ',X=T1,C=TETAT)
00831         CALL OM('M=M+D   ',AM1,AM1,T1,TETAT,MESH)
00832 !       PREPARES THE EXPLICIT PART
00833         CALL OS('X=CYZ   ',T1,PLUIE,FN,TETAT-1.D0)
00834 !       VALUE OF TRACER IN RAIN CONSIDERED (ONLY EXPLICIT HENCE LIKE TETAT=0)
00835         IF(ABS(TRAIN).GT.1.D-15) THEN
00836           DO I=1,FN%DIM1
00837 !                           ONLY REAL RAIN CONSIDERED, NOT EVAPORATION
00838             T1%R(I)=T1%R(I)+MAX(PLUIE%R(I),0.D0)*TRAIN
00839           ENDDO
00840         ENDIF
00841         CALL VECTOR(T2,'=','MASVEC          ',IELMF,
00842      &              1.D0,T1,S,S,S,S,S,MESH,MSK,MASKEL)
00843         CALL OS('X=Y/Z   ',T1,T2,T10,C,
00844      &          IOPT=2,INFINI=0.D0,ZERO=1.D-3)
00845         CALL OS('X=X+Y   ',X=SM,Y=T1)
00846 !
00847       ENDIF
00848 !
00849 !   IMPLICIT TERM IF THERE IS ONE :
00850 !
00851 !   THE TREATMENT BELOW ENSURES THAT IF THE EXPLICIT SOURCE TERM
00852 !   IS IN THE FORM  K*FN/H AND SMI EQUALS -K THEN THE TWO TERMS
00853 !   WILL BE BALANCED (CASE OF EROSION AND DEPOSITION)
00854 !
00855 !                  FV_SCHEME : IMPLICIT SOURCE TERM HAS BEEN TREATED
00856 !                  AND WILL NOT BE DONE TWICE
00857       IF(YASMI.AND..NOT.(FV_SCHEME.AND.CONV)) THEN
00858         CALL MATRIX(AM2,'M=N     ','MATMAS          ',IELMF,IELMF,
00859      &              -1.D0,S,S,S,S,S,S,MESH,MSK,MASKEL)
00860 !       POSSIBLE MASS-LUMPING
00861         IF(AGGLOT.GT.0.001D0) THEN
00862           CALL LUMP(T1,AM2,MESH,AGGLOT)
00863           CALL OM( 'M=CN    ' , AM2 , AM2 , S  , 1.D0-AGGLOT , MESH )
00864           CALL OM( 'M=M+D   ' , AM2 , AM2 , T1 , C           , MESH )
00865         ENDIF
00866 !       COMPUTES SMI/H (DOES NOT CHECK IF H SIZE IS SUFFICIENT!!)
00867         IF(OPTBAN.GT.0) THEN
00868 !         DIVIDES BY H WITH HARD-CODED CLIPPING AT 1.D-4
00869           CALL CPSTVC(SMI,T4)
00870           DO I=1,SMI%DIM1
00871             T4%R(I)=SMI%R(I)/MAX(H%R(I),1.D-4)
00872           ENDDO
00873         ELSE
00874 !         DIVIDES WITHOUT CHECKING
00875           CALL OS( 'X=Y/Z   ',X=T4,Y=SMI,Z=H)
00876         ENDIF
00877         CALL OM( 'M=X(M)  ' , AM2 , AM2 , S  , C , MESH )
00878         CALL OM( 'M=MD    ' , AM2 , AM2 , T4 , C , MESH )
00879 !       ADDS TO MATRIX AM1
00880         IF(AM1%TYPEXT.NE.'Q') THEN
00881           CALL OM( 'M=X(M)  ' , AM1 , AM1 , S , C , MESH )
00882         ENDIF
00883         CALL OM( 'M=M+N   ' , AM1 , AM2 , S , C , MESH )
00884       ENDIF
00885 !
00886 !-----------------------------------------------------------------------
00887 !
00888       IF(ICONVF.EQ.ADV_CAR.AND..NOT.DIFT) THEN
00889         CALL OS( 'X=Y     ' , F , FTILD , FTILD , C )
00890       ENDIF
00891       IF(ICONVF.EQ.ADV_PSI_NC.AND.CONV) THEN
00892         CALL LUMP(T1,AM1,MESH,1.D0)
00893         IF(NCSIZE.GT.1) THEN
00894           CALL PARCOM(T1,2,MESH)
00895           CALL OS( 'X=Y     ' , T2 , SM , SM , C )
00896           CALL PARCOM(T2,2,MESH)
00897           CALL OS( 'X=Y/Z   ' , F , T2 , T1 , C ,2,0.D0,1.D-6)
00898         ELSE
00899           CALL OS( 'X=Y/Z   ' , F , SM , T1 , C ,2,0.D0,1.D-6)
00900         ENDIF
00901       ENDIF
00902 !
00903 !-----------------------------------------------------------------------
00904 !
00905 !   BOUNDARY CONDITIONS (POINTS OF THE TYPE DIRICHLET)
00906 !
00907 !     DIRICHLET BOUNDARY CONDITIONS ARE TREATED IN A WEAK FORM BY
00908 !     FINITE VOLUME SCHEMES, TO ENSURE THE CORRECT FLUX
00909 !     THEN CALL DIRICH HERE WOULD SPOIL MASS CONSERVATION. HOWEVER
00910 !     FORCING THE CALL IS ALLOWED IN THIS CASE WITH PARAMETER DIRFLU
00911 !
00912 !
00913       IF(.NOT.FV_SCHEME.OR.DIRFLU.EQ.1) THEN
00914         CALL DIRICH(F, AM1, SM,FBOR,LIMTRA%I,TB,MESH,KDIR,MSK,MASKPT)
00915       ENDIF
00916 !
00917 !-----------------------------------------------------------------------
00918 !
00919 !   SOLVES THE LINEAR SYSTEM:
00920 !
00921       CALL SOLVE(F,AM1,SM,TB,SLVTRA,INFOGT,MESH,AM2)
00922 !                                               NOT USED HERE
00923 !
00924 !-----------------------------------------------------------------------
00925 !
00926       IF(YASMI.AND.BILAN) THEN
00927         IF(YASMI.AND..NOT.(FV_SCHEME.AND.CONV)) THEN
00928 !         NOTE JMH: WE ASSUME HERE THAT AM2 HAS NOT BEEN DESTROYED IN
00929 !                   SOLVE (THIS WOULD BE THE CASE WITH SOME PRECONDITIONING
00930 !                   BUT IN THIS CASE AM2 COULD NOT BE USED BEFORE)
00931           CALL MATVEC( 'X=AY    ',T2,AM2,F,C,MESH)
00932           IF(NCSIZE.GT.1) THEN
00933             CALL PARCOM(T2,2,MESH)
00934             MASSOU = MASSOU - DT*P_DOTS(T2,HPROP,MESH)
00935           ELSE
00936             MASSOU = MASSOU - DT*DOTS(T2,HPROP)
00937           ENDIF
00938         ELSEIF(YASMI.AND.(FV_SCHEME.AND.CONV)) THEN
00939 !         THIS IS CONSISTENT WITH WHAT IS DONE
00940 !         AT THE END OF CVTRVF_POS, FOR SCHEME 14.
00941           C=0.D0
00942           DO I=1,SMI%DIM1
00943             C = C + DT*SMI%R(I)*F%R(I)*VOLU2D%R(I)
00944           ENDDO
00945           IF(NCSIZE.GT.1) C=P_DSUM(C)
00946           MASSOU=MASSOU+C
00947         ENDIF
00948       ENDIF
00949 !
00950 !-----------------------------------------------------------------------
00951 !
00952 !     COMPUTES THE TRACER FLUX AT THE BOUNDARY
00953 !
00954       IF(.NOT.FV_SCHEME) THEN
00955         DO I=1,MESH%NPTFR
00956           N=MESH%NBOR%I(I)
00957           FLBORTRA%R(I)=FLBOR%R(I)*(TETAT*F%R(N)+(1.D0-TETAT)*FN%R(N))
00958         ENDDO
00959 !     ELSE
00960 !       FLBORTRA ALREADY COMPUTED
00961       ENDIF
00962 !
00963 !-----------------------------------------------------------------------
00964 !
00965       IF(IELMF.NE.IELMS) CALL CHGDIS(SM  ,IELMF,IELMS,MESH)
00966       IF(IELMF.NE.IELMH.AND.YASMH) CALL CHGDIS(SMH ,IELMF,IELMH,MESH)
00967 !
00968 !-----------------------------------------------------------------------
00969 !
00970       RETURN
00971       END

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