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

Annotation of /MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_r.F

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


Revision 1.5 - (hide annotations) (download)
Tue Oct 18 16:03:55 2005 UTC (18 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.4: +30 -11 lines
change it to work with low tracer concentrations; add upper bound to slope
ratio theta.

1 jmc 1.5 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3fl_adv_r.F,v 1.4 2002/03/06 01:29:36 jmc Exp $
2 adcroft 1.3 C $Name: $
3 adcroft 1.1
4     #include "GAD_OPTIONS.h"
5    
6     SUBROUTINE GAD_DST3FL_ADV_R(
7     I bi_arg,bj_arg,k,dTarg,
8     I rTrans, wVel,
9     I tracer,
10     O wT,
11     I myThid )
12     C /==========================================================\
13     C | SUBROUTINE GAD_DST3_ADV_R |
14     C | o Compute Vertical advective Flux of Tracer using |
15     C | 3rd Order DST Sceheme with flux limiting |
16     C |==========================================================|
17     IMPLICIT NONE
18    
19     C == GLobal variables ==
20     #include "SIZE.h"
21     #include "GRID.h"
22     #include "EEPARAMS.h"
23     #include "PARAMS.h"
24     #include "GAD.h"
25    
26     C == Routine arguments ==
27     INTEGER bi_arg,bj_arg,k
28     _RL dTarg
29     _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30     _RL wVel(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
31     _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
32     _RL wT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
33     INTEGER myThid
34    
35     C == Local variables ==
36 jmc 1.4 C wFld :: velocity, vertical component
37 adcroft 1.1 INTEGER i,j,kp1,km1,km2,bi,bj
38     _RL Rjm,Rj,Rjp,cfl,d0,d1
39     _RL psiP,psiM,thetaP,thetaM
40 jmc 1.4 _RL wFld
41 jmc 1.5 _RL thetaMax
42     PARAMETER( thetaMax = 1.D+20 )
43 adcroft 1.1
44     IF (.NOT. multiDimAdvection) THEN
45     C If using the standard time-stepping/advection schemes (ie. AB-II)
46     C then the data-structures are all global arrays
47     bi=bi_arg
48     bj=bj_arg
49     ELSE
50     C otherwise if using the multi-dimensional advection schemes
51     C then the data-structures are all local arrays except
52     C for maskC(...) and wVel(...)
53     bi=1
54     bj=1
55     ENDIF
56    
57     km2=MAX(1,k-2)
58     km1=MAX(1,k-1)
59     kp1=MIN(Nr,k+1)
60    
61     DO j=1-Oly,sNy+Oly
62     DO i=1-Olx,sNx+Olx
63     Rjp=(tracer(i,j,k,bi,bj)-tracer(i,j,kp1,bi,bj))
64 adcroft 1.3 & *maskC(i,j,kp1,bi_arg,bj_arg)
65 adcroft 1.1 Rj =(tracer(i,j,km1,bi,bj)-tracer(i,j,k,bi,bj))
66 adcroft 1.3 & *maskC(i,j,k,bi_arg,bj_arg)*maskC(i,j,km1,bi_arg,bj_arg)
67 adcroft 1.1 Rjm=(tracer(i,j,km2,bi,bj)-tracer(i,j,km1,bi,bj))
68 adcroft 1.3 & *maskC(i,j,km1,bi_arg,bj_arg)
69 adcroft 1.1
70 jmc 1.4 c wFld = wVel(i,j,k,bi_arg,bj_arg)
71     wFld = rTrans(i,j)*recip_rA(i,j,bi_arg,bj_arg)
72     cfl=abs(wFld*dTarg*recip_drC(k))
73 jmc 1.5 d0=(2. _d 0 -cfl)*(1. _d 0 -cfl)*oneSixth
74     d1=(1. _d 0 -cfl*cfl)*oneSixth
75    
76     C- the old version: can produce overflow, division by zero,
77     C and is wrong for tracer with low concentration:
78     c thetaP=Rjm/(1.D-20+Rj)
79     c thetaM=Rjp/(1.D-20+Rj)
80     C- the right expression, but not bounded:
81 heimbach 1.2 c thetaP=0.D0
82 jmc 1.5 c thetaM=0.D0
83 heimbach 1.2 c IF (Rj.NE.0.D0) thetaP=Rjm/Rj
84 jmc 1.5 c IF (Rj.NE.0.D0) thetaM=Rjp/Rj
85     C- prevent |thetaP,M| to reach too big value:
86     IF ( ABS(Rj)*thetaMax .LE. ABS(Rjm) ) THEN
87     thetaP=SIGN(thetaMax,Rjm*Rj)
88     ELSE
89     thetaP=Rjm/Rj
90     ENDIF
91     IF ( ABS(Rj)*thetaMax .LE. ABS(Rjp) ) THEN
92     thetaM=SIGN(thetaMax,Rjp*Rj)
93     ELSE
94     thetaM=Rjp/Rj
95     ENDIF
96    
97 adcroft 1.1 psiP=d0+d1*thetaP
98 jmc 1.5 psiP=MAX(0. _d 0,MIN(MIN(1. _d 0,psiP),
99     & thetaP*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
100 adcroft 1.1 psiM=d0+d1*thetaM
101 jmc 1.5 psiM=MAX(0. _d 0,MIN(MIN(1. _d 0,psiM),
102     & thetaM*(1. _d 0 -cfl)/(cfl+1. _d -20) ))
103    
104 adcroft 1.1 wT(i,j)=
105     & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
106     & *( Tracer(i,j, k ,bi,bj) + psiM*Rj )
107     & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
108     & *( Tracer(i,j,km1,bi,bj) - psiP*Rj )
109    
110     ENDDO
111     ENDDO
112    
113     RETURN
114     END

  ViewVC Help
Powered by ViewVC 1.1.22