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, |
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) |
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 |
|
|
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 |
uLoc = uFld(i,j) |
uCFL = uFld(i,j) |
55 |
c uLoc = uTrans(i,j)*recip_dyG(i,j,bi,bj) |
IF ( calcCFL ) uCFL = ABS( uFld(i,j)*deltaTloc |
56 |
c & *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: |
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 |