34 |
C == Local variables == |
C == Local variables == |
35 |
C uLoc :: velocity [m/s], zonal component |
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 |
38 |
_RL uLoc |
_RL uLoc |
39 |
_RL thetaMax |
_RL thetaMax |
40 |
PARAMETER( thetaMax = 1.D+20 ) |
PARAMETER( thetaMax = 1.D+20 ) |
53 |
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) |
54 |
|
|
55 |
uLoc = uFld(i,j) |
uLoc = uFld(i,j) |
56 |
c uLoc = uTrans(i,j)*recip_dyG(i,j,bi,bj) |
uCFL = ABS( uLoc*deltaTloc |
57 |
c & *recip_drF(k)*_recip_hFacW(i,j,k,bi,bj) |
& *recip_dxC(i,j,bi,bj)*recip_deepFacC(k) ) |
58 |
cfl=abs(uLoc*deltaTloc*recip_dxC(i,j,bi,bj)) |
d0=(2. _d 0 -uCFL)*(1. _d 0 -uCFL)*oneSixth |
59 |
d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth |
d1=(1. _d 0 -uCFL*uCFL)*oneSixth |
|
d1=(1. _d 0 -cfl*cfl)*oneSixth |
|
60 |
|
|
61 |
C- the old version: can produce overflow, division by zero, |
C- the old version: can produce overflow, division by zero, |
62 |
c and is wrong for tracer with low concentration: |
c and is wrong for tracer with low concentration: |
80 |
ENDIF |
ENDIF |
81 |
|
|
82 |
psiP=d0+d1*thetaP |
psiP=d0+d1*thetaP |
83 |
psiP=MAX(0. _d 0, MIN(MIN(1. _d 0,psiP), |
psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP), |
84 |
& thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) )) |
& thetaP*(1. _d 0 -uCFL)/(uCFL+1. _d -20) )) |
85 |
psiM=d0+d1*thetaM |
psiM=d0+d1*thetaM |
86 |
psiM=MAX(0. _d 0, MIN(MIN(1. _d 0,psiM), |
psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM), |
87 |
& thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) )) |
& thetaM*(1. _d 0 -uCFL)/(uCFL+1. _d -20) )) |
88 |
|
|
89 |
uT(i,j)= |
uT(i,j)= |
90 |
& 0.5*(uTrans(i,j)+abs(uTrans(i,j))) |
& 0.5*(uTrans(i,j)+ABS(uTrans(i,j))) |
91 |
& *( Tracer(i-1,j) + psiP*Rj ) |
& *( Tracer(i-1,j) + psiP*Rj ) |
92 |
& +0.5*(uTrans(i,j)-abs(uTrans(i,j))) |
& +0.5*(uTrans(i,j)-ABS(uTrans(i,j))) |
93 |
& *( Tracer( i ,j) - psiM*Rj ) |
& *( Tracer( i ,j) - psiM*Rj ) |
94 |
|
|
95 |
ENDDO |
ENDDO |