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

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

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


Revision 1.5 - (hide annotations) (download)
Fri Oct 14 21:51:05 2005 UTC (18 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.4: +15 -2 lines
check-in Samar's version (all changes are within #ifdef ALLOW_MATRIX)

1 jmc 1.5 C $Header: /u/gcmpack/MITgcm/verification/matrix_example/code/gad_dst3_adv_r.F,v 1.1 2005/04/18 20:17:44 spk Exp $
2 adcroft 1.2 C $Name: $
3 adcroft 1.1
4     #include "GAD_OPTIONS.h"
5    
6     SUBROUTINE GAD_DST3_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 |
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.3 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.3 _RL wFld
41 heimbach 1.4 _RL smallNo
42 jmc 1.5 c _RL Rjjm,Rjjp
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 heimbach 1.4 IF (inAdMode) THEN
58     smallNo = 1.0D-20
59     ELSE
60     smallNo = 1.0D-20
61     ENDIF
62    
63 adcroft 1.1 km2=MAX(1,k-2)
64     km1=MAX(1,k-1)
65     kp1=MIN(Nr,k+1)
66    
67     DO j=1-Oly,sNy+Oly
68     DO i=1-Olx,sNx+Olx
69     Rjp=(tracer(i,j,k,bi,bj)-tracer(i,j,kp1,bi,bj))
70 adcroft 1.2 & *maskC(i,j,kp1,bi_arg,bj_arg)
71 adcroft 1.1 Rj =(tracer(i,j,km1,bi,bj)-tracer(i,j,k,bi,bj))
72 adcroft 1.2 & *maskC(i,j,k,bi_arg,bj_arg)*maskC(i,j,km1,bi_arg,bj_arg)
73 adcroft 1.1 Rjm=(tracer(i,j,km2,bi,bj)-tracer(i,j,km1,bi,bj))
74 adcroft 1.2 & *maskC(i,j,km1,bi_arg,bj_arg)
75 adcroft 1.1
76 jmc 1.3 c wFld = wVel(i,j,k,bi_arg,bj_arg)
77     wFld = rTrans(i,j)*recip_rA(i,j,bi_arg,bj_arg)
78     cfl=abs(wFld*dTarg*recip_drC(k))
79 adcroft 1.1 d0=(2.-cfl)*(1.-cfl)*oneSixth
80     d1=(1.-cfl*cfl)*oneSixth
81 jmc 1.5 #ifdef ALLOW_MATRIX
82     IF (.NOT.useMATRIX) THEN
83     #endif /* ALLOW_MATRIX */
84 heimbach 1.4 IF ( ABS(Rj).LT.smallNo .OR.
85     & ABS(Rjm).LT.smallNo ) THEN
86     thetaP=0.
87     psiP=0.
88     ELSE
89     thetaP=(Rjm+smallNo)/(smallNo+Rj)
90     psiP=d0+d1*thetaP
91     ENDIF
92     IF ( ABS(Rj).LT.smallNo .OR.
93     & ABS(Rjp).LT.smallNo ) THEN
94     thetaM=0.
95     psiM=0.
96     ELSE
97     thetaM=(Rjp+smallNo)/(smallNo+Rj)
98     psiM=d0+d1*thetaM
99     ENDIF
100     wT(i,j)=
101     & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
102     & *( Tracer(i,j, k ,bi,bj) + psiM*Rj )
103     & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
104     & *( Tracer(i,j,km1,bi,bj) - psiP*Rj )
105 jmc 1.5 #ifdef ALLOW_MATRIX
106     ELSE
107     wT(i,j)=
108     & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
109     & *( Tracer(i,j, k ,bi,bj) + (d0*Rj+d1*Rjp) )
110     & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
111     & *( Tracer(i,j,km1,bi,bj) - (d0*Rj+d1*Rjm) )
112     ENDIF
113     #endif /* ALLOW_MATRIX */
114    
115 adcroft 1.1 ENDDO
116     ENDDO
117    
118     RETURN
119     END

  ViewVC Help
Powered by ViewVC 1.1.22