/[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.8 - (hide annotations) (download)
Mon Jun 19 14:40:43 2006 UTC (17 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58m_post, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58n_post, checkpoint58k_post, checkpoint58l_post
Changes since 1.7: +3 -3 lines
DST advection S/R : use local copy of velocity to compute CFL

1 jmc 1.8 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_dst3_adv_r.F,v 1.7 2006/06/18 23:31:35 jmc Exp $
2 adcroft 1.2 C $Name: $
3 adcroft 1.1
4     #include "GAD_OPTIONS.h"
5    
6 jmc 1.6 CBOP
7     C !ROUTINE: GAD_DST3_ADV_R
8    
9     C !INTERFACE: ==========================================================
10 jmc 1.7 SUBROUTINE GAD_DST3_ADV_R(
11 jmc 1.6 I bi,bj,k,dTarg,
12 jmc 1.7 I rTrans, wFld,
13 adcroft 1.1 I tracer,
14     O wT,
15     I myThid )
16 jmc 1.6
17     C !DESCRIPTION:
18     C Calculates the area integrated vertical flux due to advection of a tracer
19     C using 3rd-order Direct Space and Time (DST-3) Advection Scheme
20    
21     C !USES: ===============================================================
22 adcroft 1.1 IMPLICIT NONE
23    
24     C == GLobal variables ==
25     #include "SIZE.h"
26     #include "GRID.h"
27     #include "EEPARAMS.h"
28     #include "PARAMS.h"
29     #include "GAD.h"
30    
31     C == Routine arguments ==
32 jmc 1.6 C !INPUT PARAMETERS: ===================================================
33     C bi,bj :: tile indices
34     C k :: vertical level
35     C deltaTloc :: local time-step (s)
36     C rTrans :: vertical volume transport
37 jmc 1.7 C wFld :: vertical flow
38 jmc 1.6 C tracer :: tracer field
39     C myThid :: thread number
40     INTEGER bi,bj,k
41 adcroft 1.1 _RL dTarg
42     _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
43 jmc 1.7 _RL wFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44 jmc 1.6 _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
45     INTEGER myThid
46    
47     C !OUTPUT PARAMETERS: ==================================================
48     C wT :: vertical advective flux
49 adcroft 1.1 _RL wT (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
50    
51     C == Local variables ==
52 jmc 1.6 C !LOCAL VARIABLES: ====================================================
53     C i,j :: loop indices
54     C km1 :: =max( k-1 , 1 )
55     C rLimit :: centered (vs upwind) fraction
56 jmc 1.7 C wLoc :: velocity, vertical component
57 jmc 1.6 C wCFL :: Courant-Friedrich-Levy number
58     INTEGER i,j,kp1,km1,km2
59 adcroft 1.1 _RL Rjm,Rj,Rjp,cfl,d0,d1
60     _RL psiP,psiM,thetaP,thetaM
61 jmc 1.7 _RL wLoc
62 heimbach 1.4 _RL smallNo
63 adcroft 1.1
64 heimbach 1.4 IF (inAdMode) THEN
65     smallNo = 1.0D-20
66     ELSE
67     smallNo = 1.0D-20
68     ENDIF
69    
70 adcroft 1.1 km2=MAX(1,k-2)
71     km1=MAX(1,k-1)
72     kp1=MIN(Nr,k+1)
73    
74     DO j=1-Oly,sNy+Oly
75     DO i=1-Olx,sNx+Olx
76 jmc 1.6 Rjp=(tracer(i,j,k)-tracer(i,j,kp1))
77     & *maskC(i,j,kp1,bi,bj)
78     Rj =(tracer(i,j,km1)-tracer(i,j,k))
79     & *maskC(i,j,k,bi,bj)*maskC(i,j,km1,bi,bj)
80     Rjm=(tracer(i,j,km2)-tracer(i,j,km1))
81     & *maskC(i,j,km1,bi,bj)
82 adcroft 1.1
83 jmc 1.8 wLoc = wFld(i,j)
84     c wLoc = rTrans(i,j)*recip_rA(i,j,bi,bj)
85 jmc 1.7 cfl=abs(wLoc*dTarg*recip_drC(k))
86 adcroft 1.1 d0=(2.-cfl)*(1.-cfl)*oneSixth
87     d1=(1.-cfl*cfl)*oneSixth
88 jmc 1.5 #ifdef ALLOW_MATRIX
89     IF (.NOT.useMATRIX) THEN
90 jmc 1.7 #endif /* ALLOW_MATRIX */
91 heimbach 1.4 IF ( ABS(Rj).LT.smallNo .OR.
92     & ABS(Rjm).LT.smallNo ) THEN
93     thetaP=0.
94     psiP=0.
95     ELSE
96     thetaP=(Rjm+smallNo)/(smallNo+Rj)
97     psiP=d0+d1*thetaP
98     ENDIF
99     IF ( ABS(Rj).LT.smallNo .OR.
100     & ABS(Rjp).LT.smallNo ) THEN
101     thetaM=0.
102     psiM=0.
103     ELSE
104     thetaM=(Rjp+smallNo)/(smallNo+Rj)
105     psiM=d0+d1*thetaM
106     ENDIF
107     wT(i,j)=
108     & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
109 jmc 1.6 & *( tracer(i,j, k ) + psiM*Rj )
110 heimbach 1.4 & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
111 jmc 1.6 & *( tracer(i,j,km1) - psiP*Rj )
112 jmc 1.5 #ifdef ALLOW_MATRIX
113     ELSE
114     wT(i,j)=
115     & 0.5*(rTrans(i,j)+abs(rTrans(i,j)))
116 jmc 1.6 & *( tracer(i,j, k ) + (d0*Rj+d1*Rjp) )
117 jmc 1.5 & +0.5*(rTrans(i,j)-abs(rTrans(i,j)))
118 jmc 1.6 & *( tracer(i,j,km1) - (d0*Rj+d1*Rjm) )
119 jmc 1.5 ENDIF
120     #endif /* ALLOW_MATRIX */
121    
122 adcroft 1.1 ENDDO
123     ENDDO
124    
125     RETURN
126     END

  ViewVC Help
Powered by ViewVC 1.1.22