/[MITgcm]/MITgcm/pkg/gmredi/gmredi_xtransport.F
ViewVC logotype

Contents of /MITgcm/pkg/gmredi/gmredi_xtransport.F

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


Revision 1.16 - (show annotations) (download)
Sat Feb 2 02:35:53 2008 UTC (16 years, 4 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59o, checkpoint59n
Changes since 1.15: +6 -2 lines
introduce isopycnal diffusion coefficient control.

1 C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_xtransport.F,v 1.15 2007/01/30 15:17:52 dfer Exp $
2 C $Name: $
3
4 #include "GMREDI_OPTIONS.h"
5
6 subroutine GMREDI_XTRANSPORT(
7 I iMin,iMax,jMin,jMax,bi,bj,K,
8 I xA,Tracer,tracerIdentity,
9 U df,
10 I myThid)
11 C /==========================================================\
12 C | o SUBROUTINE GMREDI_XTRANSPORT |
13 C | Add horizontal x transport terms from GM/Redi |
14 C | parameterization. |
15 C |==========================================================|
16 C \==========================================================/
17 IMPLICIT NONE
18
19 C == GLobal variables ==
20 #include "SIZE.h"
21 #include "EEPARAMS.h"
22 #include "PARAMS.h"
23 #include "GRID.h"
24 #include "GMREDI.h"
25
26 #ifdef ALLOW_AUTODIFF_TAMC
27 # include "tamc.h"
28 # include "tamc_keys.h"
29 # ifdef ALLOW_PTRACERS
30 # include "PTRACERS_SIZE.h"
31 # endif
32 #endif /* ALLOW_AUTODIFF_TAMC */
33
34 C == Routine arguments ==
35 C iMin,iMax,jMin, - Range of points for which calculation
36 C jMax,bi,bj,k results will be set.
37 C xA - Area of X face
38 C Tracer - 3D Tracer field
39 C df - Diffusive flux component work array.
40 INTEGER iMin,iMax,jMin,jMax,bi,bj,k
41 _RS xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
42 _RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
43 integer tracerIdentity
44 _RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
45 INTEGER myThid
46
47 #ifdef ALLOW_GMREDI
48
49 C == Local variables ==
50 C I, J - Loop counters
51 INTEGER I, J
52 INTEGER km1,kp1
53 _RL maskp1
54 #ifdef GM_EXTRA_DIAGONAL
55 _RL dTdz (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
56 #endif
57 #ifdef GM_BOLUS_ADVEC
58 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 #endif
60 #ifdef ALLOW_DIAGNOSTICS
61 LOGICAL DIAGNOSTICS_IS_ON
62 EXTERNAL DIAGNOSTICS_IS_ON
63 _RL tmp1k(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64 #endif
65
66 #ifdef ALLOW_AUTODIFF_TAMC
67 act0 = tracerIdentity - 1
68 max0 = maxpass
69 act1 = bi - myBxLo(myThid)
70 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
71 act2 = bj - myByLo(myThid)
72 max2 = myByHi(myThid) - myByLo(myThid) + 1
73 act3 = myThid - 1
74 max3 = nTx*nTy
75 act4 = ikey_dynamics - 1
76 igadkey = (act0 + 1)
77 & + act1*max0
78 & + act2*max0*max1
79 & + act3*max0*max1*max2
80 & + act4*max0*max1*max2*max3
81 kkey = (igadkey-1)*Nr + k
82 if (tracerIdentity.GT.maxpass) then
83 print *, 'ph-pass gmredi_xtrans ', maxpass, tracerIdentity
84 STOP 'maxpass seems smaller than tracerIdentity'
85 endif
86 #endif /* ALLOW_AUTODIFF_TAMC */
87
88 IF (useGMRedi) THEN
89
90 #ifdef ALLOW_AUTODIFF_TAMC
91 # ifdef GM_NON_UNITY_DIAGONAL
92 CADJ STORE Kux(:,:,k,bi,bj) =
93 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
94 # endif
95 # ifdef GM_EXTRA_DIAGONAL
96 CADJ STORE Kuz(:,:,k,bi,bj) =
97 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
98 # endif
99 #endif
100
101 C-- Area integrated zonal flux
102 DO j=jMin,jMax
103 DO i=iMin,iMax
104 df(i,j) = df(i,j)
105 & -xA(i,j)
106 #ifdef GM_NON_UNITY_DIAGONAL
107 & *Kux(i,j,k,bi,bj)
108 #else
109 #ifdef ALLOW_KAPREDI_CONTROL
110 & *(kapredi(i,j,k,bi,bj)
111 #else
112 & *(GM_isopycK
113 #endif
114 #ifdef GM_VISBECK_VARIABLE_K
115 & +op5*(VisbeckK(i,j,bi,bj)+VisbeckK(i-1,j,bi,bj))
116 #endif
117 & )
118 #endif /* GM_NON_UNITY_DIAGONAL */
119 & *_recip_dxC(i,j,bi,bj)
120 & *(Tracer(i,j,k,bi,bj)-Tracer(i-1,j,k,bi,bj))
121 ENDDO
122 ENDDO
123
124 #ifdef GM_EXTRA_DIAGONAL
125 IF (GM_ExtraDiag) THEN
126 km1 = MAX(k-1,1)
127 kp1 = MIN(k+1,Nr)
128
129 DO j=jMin,jMax
130 DO i=iMin,iMax
131 C- Vertical gradients interpolated to U points
132 dTdz(i,j) = op5*(
133 & +op5*recip_drC(k)*
134 & ( maskC(i-1,j,k,bi,bj)*
135 & (Tracer(i-1,j,km1,bi,bj)-Tracer(i-1,j,k,bi,bj))
136 & +maskC( i ,j,k,bi,bj)*
137 & (Tracer( i ,j,km1,bi,bj)-Tracer( i ,j,k,bi,bj))
138 & )
139 & +op5*recip_drC(kp1)*
140 & ( maskC(i-1,j,kp1,bi,bj)*
141 & (Tracer(i-1,j,k,bi,bj)-Tracer(i-1,j,kp1,bi,bj))
142 & +maskC( i ,j,kp1,bi,bj)*
143 & (Tracer( i ,j,k,bi,bj)-Tracer( i ,j,kp1,bi,bj))
144 & ) )
145
146
147 ENDDO
148 ENDDO
149 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
150 CADJ STORE dtdz(:,:) =
151 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
152 #endif
153 DO j=jMin,jMax
154 DO i=iMin,iMax
155 C- Off-diagonal components of horizontal flux
156 df(i,j) = df(i,j) - xA(i,j)*Kuz(i,j,k,bi,bj)*dTdz(i,j)
157 ENDDO
158 ENDDO
159 ENDIF
160 #endif /* GM_EXTRA_DIAGONAL */
161
162 #ifdef GM_BOLUS_ADVEC
163 IF (GM_AdvForm .AND. GM_AdvSeparate) THEN
164 kp1 = MIN(k+1,Nr)
165 maskp1 = 1.
166 IF (k.GE.Nr) maskp1 = 0.
167 DO j=jMin,jMax
168 DO i=iMin,iMax
169 uTrans(i,j) = dyG(i,j,bi,bj)*( GM_PsiX(i,j,kp1,bi,bj)*maskp1
170 & -GM_PsiX(i,j,k,bi,bj) )
171 & *maskW(i,j,k,bi,bj)
172 ENDDO
173 ENDDO
174 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
175 CADJ STORE utrans(:,:) =
176 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
177 #endif
178 DO j=jMin,jMax
179 DO i=iMin,iMax
180 df(i,j) = df(i,j)
181 & +uTrans(i,j)*op5*(Tracer(i,j,k,bi,bj)+Tracer(i-1,j,k,bi,bj))
182 ENDDO
183 ENDDO
184 ENDIF
185
186 #ifdef ALLOW_DIAGNOSTICS
187 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
188 IF ( useDiagnostics
189 & .AND. DIAGNOSTICS_IS_ON('GM_ubT ', myThid )
190 & .AND. tracerIdentity .EQ. 1) THEN
191 kp1 = MIN(k+1,Nr)
192 maskp1 = 1.
193 IF (k.GE.Nr) maskp1 = 0.
194 DO j=jMin,jMax
195 DO i=iMin,iMax
196 tmp1k(i,j) = dyG(i,j,bi,bj)*( GM_PsiX(i,j,kp1,bi,bj)*maskp1
197 & -GM_PsiX(i,j,k,bi,bj) )
198 & *maskW(i,j,k,bi,bj)
199 & *op5*(Tracer(i,j,k,bi,bj)+Tracer(i-1,j,k,bi,bj))
200 ENDDO
201 ENDDO
202 CALL DIAGNOSTICS_FILL(tmp1k,'GM_ubT ', k,1,2,bi,bj,myThid)
203
204 ENDIF
205 #endif /* ALLOW_DIAGNOSTICS */
206
207 #endif /* GM_BOLUS_ADVEC */
208
209 ENDIF
210 #endif /* ALLOW_GMREDI */
211
212 RETURN
213 END

  ViewVC Help
Powered by ViewVC 1.1.22