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

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

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

revision 1.7 by heimbach, Fri Aug 19 22:19:35 2005 UTC revision 1.8 by jmc, Tue Oct 18 16:03:55 2005 UTC
# Line 36  C     vFld    :: velocity [m/s], meridio Line 36  C     vFld    :: velocity [m/s], meridio
36        INTEGER i,j        INTEGER i,j
37        _RL Rjm,Rj,Rjp,cfl,d0,d1,psiP,psiM,thetaP,thetaM        _RL Rjm,Rj,Rjp,cfl,d0,d1,psiP,psiM,thetaP,thetaM
38        _RL vFld        _RL vFld
39          _RL thetaMax
40          PARAMETER( thetaMax = 1.D+20 )
41    
42        DO i=1-Olx,sNx+Olx        DO i=1-Olx,sNx+Olx
43         vT(i,1-Oly)=0.D0         vT(i,1-Oly)=0. _d 0
44         vT(i,2-Oly)=0.D0         vT(i,2-Oly)=0. _d 0
45         vT(i,sNy+Oly)=0.D0         vT(i,sNy+Oly)=0. _d 0
46        ENDDO        ENDDO
47        DO j=1-Oly+2,sNy+Oly-1        DO j=1-Oly+2,sNy+Oly-1
48         DO i=1-Olx,sNx+Olx         DO i=1-Olx,sNx+Olx
# Line 52  c       vFld = vVel(i,j,k,bi,bj) Line 54  c       vFld = vVel(i,j,k,bi,bj)
54          vFld = vTrans(i,j)*recip_dxG(i,j,bi,bj)          vFld = vTrans(i,j)*recip_dxG(i,j,bi,bj)
55       &       *recip_drF(k)*recip_hFacS(i,j,k,bi,bj)       &       *recip_drF(k)*recip_hFacS(i,j,k,bi,bj)
56          cfl=abs(vFld*deltaTloc*recip_dyC(i,j,bi,bj))          cfl=abs(vFld*deltaTloc*recip_dyC(i,j,bi,bj))
57          d0=(2.D0-cfl)*(1.D0-cfl)*oneSixth          d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth
58          d1=(1.D0-cfl*cfl)*oneSixth          d1=(1. _d 0 -cfl*cfl)*oneSixth
59    
60    C-      the old version: can produce overflow, division by zero,
61    c       and is wrong for tracer with low concentration:
62    c       thetaP=Rjm/(1.D-20+Rj)
63    c       thetaM=Rjp/(1.D-20+Rj)
64    C-      the right expression, but not bounded:
65  c       thetaP=0.D0  c       thetaP=0.D0
 c       IF (Rj.NE.0.D0) thetaP=Rjm/Rj  
         thetaP=Rjm/(1.D-20+Rj)  
         psiP=d0+d1*thetaP  
         psiP=max(0.D0, min(min(1.D0,psiP),  
      &       (1.D0-cfl)/(1.D-20+cfl)*thetaP))  
         thetaM=Rjp/(1.D-20+Rj)  
66  c       thetaM=0.D0  c       thetaM=0.D0
67    c       IF (Rj.NE.0.D0) thetaP=Rjm/Rj
68  c       IF (Rj.NE.0.D0) thetaM=Rjp/Rj  c       IF (Rj.NE.0.D0) thetaM=Rjp/Rj
69    C-      prevent |thetaP,M| to reach too big value:
70            IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
71              thetaP=SIGN(thetaMax,Rjm*Rj)
72            ELSE
73              thetaP=Rjm/Rj
74            ENDIF
75            IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
76              thetaM=SIGN(thetaMax,Rjp*Rj)
77            ELSE
78              thetaM=Rjp/Rj
79            ENDIF
80    
81            psiP=d0+d1*thetaP
82            psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP),
83         &                        thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
84          psiM=d0+d1*thetaM          psiM=d0+d1*thetaM
85          psiM=max(0.D0, min(min(1.D0,psiM),          psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM),
86       &       (1.D0-cfl)/(1.D-20+cfl)*thetaM))       &                        thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
87    
88          vT(i,j)=          vT(i,j)=
89       &   0.5*(vTrans(i,j)+abs(vTrans(i,j)))       &   0.5*(vTrans(i,j)+abs(vTrans(i,j)))
90       &      *( Tracer(i,j-1) + psiP*Rj )       &      *( Tracer(i,j-1) + psiP*Rj )

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22