/[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.11 by jmc, Mon Jun 19 14:40:43 2006 UTC revision 1.14 by mlosch, Thu Feb 28 23:15:18 2008 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 47  C       with no need to compute thetaM ( Line 46  C       with no need to compute thetaM (
46         uT(1-Olx,j)=0. _d 0         uT(1-Olx,j)=0. _d 0
47         uT(2-Olx,j)=0. _d 0         uT(2-Olx,j)=0. _d 0
48         uT(sNx+Olx,j)=0. _d 0         uT(sNx+Olx,j)=0. _d 0
49          ENDDO
50          DO j=1-Oly,sNy+Oly
51         DO i=1-Olx+2,sNx+Olx-1         DO i=1-Olx+2,sNx+Olx-1
52          Rjp=(tracer(i+1,j)-tracer( i ,j))*maskLocW(i+1,j)          Rjp=(tracer(i+1,j)-tracer( i ,j))*maskLocW(i+1,j)
53          Rj =(tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j)          Rj =(tracer( i ,j)-tracer(i-1,j))*maskLocW( i ,j)
54          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)
55    
56          uLoc = uFld(i,j)          uCFL = uFld(i,j)
57  c       uLoc = uTrans(i,j)*recip_dyG(i,j,bi,bj)          IF ( calcCFL ) uCFL = ABS( uFld(i,j)*deltaTloc
58  c    &       *recip_drF(k)*_recip_hFacW(i,j,k,bi,bj)       &                  *recip_dxC(i,j,bi,bj)*recip_deepFacC(k) )
59          cfl=abs(uLoc*deltaTloc*recip_dxC(i,j,bi,bj))          d0=(2. _d 0 -uCFL)*(1. _d 0 -uCFL)*oneSixth
60          d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth          d1=(1. _d 0 -uCFL*uCFL)*oneSixth
         d1=(1. _d 0 -cfl*cfl)*oneSixth  
61    
62  C-      the old version: can produce overflow, division by zero,  C-      the old version: can produce overflow, division by zero,
63  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 81  C-      prevent |thetaP,M| to reach too
81          ENDIF          ENDIF
82    
83          psiP=d0+d1*thetaP          psiP=d0+d1*thetaP
84          psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP),          psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
85       &                        thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))       &                       thetaP*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
86          psiM=d0+d1*thetaM          psiM=d0+d1*thetaM
87          psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM),          psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
88       &                        thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))       &                       thetaM*(1. _d 0 -uCFL)/(uCFL+1. _d -20) ))
89    
90          uT(i,j)=          uT(i,j)=
91       &   0.5*(uTrans(i,j)+abs(uTrans(i,j)))       &   0.5*(uTrans(i,j)+ABS(uTrans(i,j)))
92       &      *( Tracer(i-1,j) + psiP*Rj )       &      *( Tracer(i-1,j) + psiP*Rj )
93       &  +0.5*(uTrans(i,j)-abs(uTrans(i,j)))       &  +0.5*(uTrans(i,j)-ABS(uTrans(i,j)))
94       &      *( Tracer( i ,j) - psiM*Rj )       &      *( Tracer( i ,j) - psiM*Rj )
95    
96         ENDDO         ENDDO

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22