/[MITgcm]/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_x.F
ViewVC logotype

Diff of /MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_x.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by jmc, Sun Jun 18 23:31:35 2006 UTC revision 1.13 by jmc, Wed Apr 4 01:39:06 2007 UTC
# Line 4  C $Name$ Line 4  C $Name$
4  #include "GAD_OPTIONS.h"  #include "GAD_OPTIONS.h"
5    
6        SUBROUTINE GAD_DST3FL_ADV_X(        SUBROUTINE GAD_DST3FL_ADV_X(
7       I           bi,bj,k,deltaTloc,       I           bi,bj,k, calcCFL, deltaTloc,
8       I           uTrans, uFld,       I           uTrans, uFld,
9       I           maskLocW, tracer,       I           maskLocW, tracer,
10       O           uT,       O           uT,
# Line 23  C     == GLobal variables == Line 23  C     == GLobal variables ==
23    
24  C     == Routine arguments ==  C     == Routine arguments ==
25        INTEGER bi,bj,k        INTEGER bi,bj,k
26          LOGICAL calcCFL
27        _RL deltaTloc        _RL deltaTloc
28        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
29        _RL uFld  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL uFld  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 32  C     == Routine arguments == Line 33  C     == Routine arguments ==
33        INTEGER myThid        INTEGER myThid
34    
35  C     == Local variables ==  C     == Local variables ==
 C     uLoc   :: velocity [m/s], zonal component  
36        INTEGER i,j        INTEGER i,j
37        _RL Rjm,Rj,Rjp,cfl,d0,d1,psiP,psiM,thetaP,thetaM        _RL Rjm,Rj,Rjp,uCFL,d0,d1,psiP,psiM,thetaP,thetaM
       _RL uLoc  
38        _RL thetaMax        _RL thetaMax
39        PARAMETER( thetaMax = 1.D+20 )        PARAMETER( thetaMax = 1.D+20 )
40    
# Line 52  C       with no need to compute thetaM ( Line 51  C       with no need to compute thetaM (
51          Rj =(tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j)          Rj =(tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j)
52          Rjm=(tracer(i-1,j)-tracer(i-2,j))*maskLocW(i-1,j)          Rjm=(tracer(i-1,j)-tracer(i-2,j))*maskLocW(i-1,j)
53    
54  c       uLoc = uFld(i,j)          uCFL = uFld(i,j)
55          uLoc = uTrans(i,j)*recip_dyG(i,j,bi,bj)          IF ( calcCFL ) uCFL = ABS( uFld(i,j)*deltaTloc
56       &       *recip_drF(k)*_recip_hFacW(i,j,k,bi,bj)       &                  *recip_dxC(i,j,bi,bj)*recip_deepFacC(k) )
57          cfl=abs(uLoc*deltaTloc*recip_dxC(i,j,bi,bj))          d0=(2. _d 0 -uCFL)*(1. _d 0 -uCFL)*oneSixth
58          d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth          d1=(1. _d 0 -uCFL*uCFL)*oneSixth
         d1=(1. _d 0 -cfl*cfl)*oneSixth  
59    
60  C-      the old version: can produce overflow, division by zero,  C-      the old version: can produce overflow, division by zero,
61  c       and is wrong for tracer with low concentration:  c       and is wrong for tracer with low concentration:
# Line 81  C-      prevent |thetaP,M| to reach too Line 79  C-      prevent |thetaP,M| to reach too
79          ENDIF          ENDIF
80    
81          psiP=d0+d1*thetaP          psiP=d0+d1*thetaP
82          psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP),          psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
83       &                        thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))       &                       thetaP*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
84          psiM=d0+d1*thetaM          psiM=d0+d1*thetaM
85          psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM),          psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
86       &                        thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))       &                       thetaM*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
87    
88          uT(i,j)=          uT(i,j)=
89       &   0.5*(uTrans(i,j)+abs(uTrans(i,j)))       &   0.5*(uTrans(i,j)+ABS(uTrans(i,j)))
90       &      *( Tracer(i-1,j) + psiP*Rj )       &      *( Tracer(i-1,j) + psiP*Rj )
91       &  +0.5*(uTrans(i,j)-abs(uTrans(i,j)))       &  +0.5*(uTrans(i,j)-ABS(uTrans(i,j)))
92       &      *( Tracer( i ,j) - psiM*Rj )       &      *( Tracer( i ,j) - psiM*Rj )
93    
94         ENDDO         ENDDO

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.22