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

Contents 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.10 - (show annotations) (download)
Tue Mar 29 15:47:19 2011 UTC (13 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint63g, checkpoint63, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c
Changes since 1.9: +4 -2 lines
only includes EEPARAMS.h & PARAMS.h if needed

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

  ViewVC Help
Powered by ViewVC 1.1.22