6 |
SUBROUTINE CALC_GT( |
SUBROUTINE CALC_GT( |
7 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
8 |
I xA,yA,uTrans,vTrans,rTrans,maskup,maskC, |
I xA,yA,uTrans,vTrans,rTrans,maskup,maskC, |
9 |
I K13,K23,KappaRT,KapGM, |
I KappaRT, |
10 |
U af,df,fZon,fMer,fVerT, |
U af,df,fZon,fMer,fVerT, |
11 |
I myCurrentTime, myThid ) |
I myCurrentTime, myThid ) |
12 |
C /==========================================================\ |
C /==========================================================\ |
43 |
#include "PARAMS.h" |
#include "PARAMS.h" |
44 |
#include "GRID.h" |
#include "GRID.h" |
45 |
#include "FFIELDS.h" |
#include "FFIELDS.h" |
46 |
|
c #include "GM_ARRAYS.h" |
47 |
|
|
48 |
|
|
49 |
C == Routine arguments == |
C == Routine arguments == |
50 |
C fZon - Work array for flux of temperature in the east-west |
C fZon - Work array for flux of temperature in the east-west |
75 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
76 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
77 |
_RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
_RL K13 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
|
|
_RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
|
78 |
_RL KappaRT(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL KappaRT(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
|
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
79 |
_RL af (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL af (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
80 |
_RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
81 |
INTEGER k,kUp,kDown,kM1 |
INTEGER k,kUp,kDown,kM1 |
91 |
_RL afFacT, dfFacT |
_RL afFacT, dfFacT |
92 |
_RL dTdx(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dTdx(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
_RL dTdy(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dTdy(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
94 |
|
_RL df4 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
95 |
|
|
96 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
97 |
|
C-- only the kUp part of fverT is set in this subroutine |
98 |
|
C-- the kDown is still required |
99 |
|
|
100 |
|
fVerT(1,1,kDown) = fVerT(1,1,kDown) |
101 |
|
DO j=1-OLy,sNy+OLy |
102 |
|
DO i=1-OLx,sNx+OLx |
103 |
|
fZon(i,j) = 0.0 |
104 |
|
fMer(i,j) = 0.0 |
105 |
|
fVerT(i,j,kUp) = 0.0 |
106 |
|
ENDDO |
107 |
|
ENDDO |
108 |
|
#endif |
109 |
|
|
110 |
afFacT = 1. _d 0 |
afFacT = 1. _d 0 |
111 |
dfFacT = 1. _d 0 |
dfFacT = 1. _d 0 |
113 |
|
|
114 |
C--- Calculate advective and diffusive fluxes between cells. |
C--- Calculate advective and diffusive fluxes between cells. |
115 |
|
|
116 |
|
#ifdef INCLUDE_T_DIFFUSION_CODE |
117 |
|
C o Zonal tracer gradient |
118 |
|
DO j=1-Oly,sNy+Oly |
119 |
|
DO i=1-Olx+1,sNx+Olx |
120 |
|
dTdx(i,j) = _recip_dxC(i,j,bi,bj)* |
121 |
|
& (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj)) |
122 |
|
ENDDO |
123 |
|
ENDDO |
124 |
|
C o Meridional tracer gradient |
125 |
|
DO j=1-Oly+1,sNy+Oly |
126 |
|
DO i=1-Olx,sNx+Olx |
127 |
|
dTdy(i,j) = _recip_dyC(i,j,bi,bj)* |
128 |
|
& (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj)) |
129 |
|
ENDDO |
130 |
|
ENDDO |
131 |
|
|
132 |
|
C-- del^2 of T, needed for bi-harmonic (del^4) term |
133 |
|
IF (diffK4T .NE. 0.) THEN |
134 |
|
DO j=1-Oly+1,sNy+Oly-1 |
135 |
|
DO i=1-Olx+1,sNx+Olx-1 |
136 |
|
df4(i,j)= _recip_hFacC(i,j,k,bi,bj) |
137 |
|
& *recip_drF(k)/_rA(i,j,bi,bj) |
138 |
|
& *( |
139 |
|
& +( xA(i+1,j)*dTdx(i+1,j)-xA(i,j)*dTdx(i,j) ) |
140 |
|
& +( yA(i,j+1)*dTdy(i,j+1)-yA(i,j)*dTdy(i,j) ) |
141 |
|
& ) |
142 |
|
ENDDO |
143 |
|
ENDDO |
144 |
|
ENDIF |
145 |
|
#endif |
146 |
|
|
147 |
C-- Zonal flux (fZon is at west face of "theta" cell) |
C-- Zonal flux (fZon is at west face of "theta" cell) |
148 |
#ifdef INCLUDE_T_ADVECTION_CODE |
#ifdef INCLUDE_T_ADVECTION_CODE |
149 |
C o Advective component of zonal flux |
C o Advective component of zonal flux |
155 |
ENDDO |
ENDDO |
156 |
#endif /* INCLUDE_T_ADVECTION_CODE */ |
#endif /* INCLUDE_T_ADVECTION_CODE */ |
157 |
#ifdef INCLUDE_T_DIFFUSION_CODE |
#ifdef INCLUDE_T_DIFFUSION_CODE |
|
C o Zonal tracer gradient |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
dTdx(i,j) = _recip_dxC(i,j,bi,bj)* |
|
|
& (theta(i,j,k,bi,bj)-theta(i-1,j,k,bi,bj)) |
|
|
ENDDO |
|
|
ENDDO |
|
158 |
C o Diffusive component of zonal flux |
C o Diffusive component of zonal flux |
159 |
DO j=jMin,jMax |
DO j=jMin,jMax |
160 |
DO i=iMin,iMax |
DO i=iMin,iMax |
161 |
df(i,j) = -(diffKhT+0.5*(KapGM(i,j)+KapGM(i-1,j)))* |
df(i,j) = -diffKhT*xA(i,j)*dTdx(i,j) |
|
& xA(i,j)*dTdx(i,j) |
|
162 |
ENDDO |
ENDDO |
163 |
ENDDO |
ENDDO |
164 |
|
#ifdef ALLOW_GMREDI |
165 |
|
IF (useGMRedi) CALL GMREDI_XTRANSPORT( |
166 |
|
I iMin,iMax,jMin,jMax,bi,bj,K, |
167 |
|
I xA,theta, |
168 |
|
U df, |
169 |
|
I myThid) |
170 |
|
#endif |
171 |
|
C o Add the bi-harmonic contribution |
172 |
|
IF (diffK4T .NE. 0.) THEN |
173 |
|
DO j=jMin,jMax |
174 |
|
DO i=iMin,iMax |
175 |
|
df(i,j) = df(i,j) + xA(i,j)* |
176 |
|
& diffK4T*(df4(i,j)-df4(i-1,j))*_recip_dxC(i,j,bi,bj) |
177 |
|
ENDDO |
178 |
|
ENDDO |
179 |
|
ENDIF |
180 |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
181 |
C o Net zonal flux |
C o Net zonal flux |
182 |
DO j=jMin,jMax |
DO j=jMin,jMax |
183 |
DO i=iMin,iMax |
DO i=iMin,iMax |
184 |
fZon(i,j) = 0. |
fZon(i,j) = 0. |
185 |
_ADT(& + afFacT*af(i,j) ) |
& _ADT( + afFacT*af(i,j) ) |
186 |
_LPT(& + dfFacT*df(i,j) ) |
& _LPT( + dfFacT*df(i,j) ) |
187 |
ENDDO |
ENDDO |
188 |
ENDDO |
ENDDO |
189 |
|
|
198 |
ENDDO |
ENDDO |
199 |
#endif /* INCLUDE_T_ADVECTION_CODE */ |
#endif /* INCLUDE_T_ADVECTION_CODE */ |
200 |
#ifdef INCLUDE_T_DIFFUSION_CODE |
#ifdef INCLUDE_T_DIFFUSION_CODE |
|
C o Meridional tracer gradient |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
dTdy(i,j) = _recip_dyC(i,j,bi,bj)* |
|
|
& (theta(i,j,k,bi,bj)-theta(i,j-1,k,bi,bj)) |
|
|
ENDDO |
|
|
ENDDO |
|
201 |
C o Diffusive component of meridional flux |
C o Diffusive component of meridional flux |
202 |
DO j=jMin,jMax |
DO j=jMin,jMax |
203 |
DO i=iMin,iMax |
DO i=iMin,iMax |
204 |
df(i,j) = -(diffKhT+0.5*(KapGM(i,j)+KapGM(i,j-1)))* |
df(i,j) = -diffKhT*yA(i,j)*dTdy(i,j) |
|
& yA(i,j)*dTdy(i,j) |
|
205 |
ENDDO |
ENDDO |
206 |
ENDDO |
ENDDO |
207 |
|
#ifdef ALLOW_GMREDI |
208 |
|
IF (useGMRedi) CALL GMREDI_YTRANSPORT( |
209 |
|
I iMin,iMax,jMin,jMax,bi,bj,K, |
210 |
|
I yA,theta, |
211 |
|
U df, |
212 |
|
I myThid) |
213 |
|
#endif |
214 |
|
C o Add the bi-harmonic contribution |
215 |
|
IF (diffK4T .NE. 0.) THEN |
216 |
|
DO j=jMin,jMax |
217 |
|
DO i=iMin,iMax |
218 |
|
df(i,j) = df(i,j) + yA(i,j)* |
219 |
|
& diffK4T*(df4(i,j)-df4(i,j-1))*_recip_dyC(i,j,bi,bj) |
220 |
|
ENDDO |
221 |
|
ENDDO |
222 |
|
ENDIF |
223 |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
224 |
C o Net meridional flux |
C o Net meridional flux |
225 |
DO j=jMin,jMax |
DO j=jMin,jMax |
226 |
DO i=iMin,iMax |
DO i=iMin,iMax |
227 |
fMer(i,j) = 0. |
fMer(i,j) = 0. |
228 |
_ADT(& + afFacT*af(i,j) ) |
& _ADT( + afFacT*af(i,j) ) |
229 |
_LPT(& + dfFacT*df(i,j) ) |
& _LPT( + dfFacT*df(i,j) ) |
230 |
ENDDO |
ENDDO |
231 |
ENDDO |
ENDDO |
232 |
|
|
286 |
C o Diffusive component of vertical flux |
C o Diffusive component of vertical flux |
287 |
C Note: For K=1 then KM1=1 and this gives a dT/dr = 0 upper |
C Note: For K=1 then KM1=1 and this gives a dT/dr = 0 upper |
288 |
C boundary condition. |
C boundary condition. |
289 |
DO j=jMin,jMax |
IF (implicitDiffusion) THEN |
290 |
DO i=iMin,iMax |
DO j=jMin,jMax |
291 |
df(i,j) = _rA(i,j,bi,bj)*( |
DO i=iMin,iMax |
292 |
& -KapGM(i,j)*K13(i,j,k)*dTdx(i,j) |
df(i,j) = 0. |
293 |
& -KapGM(i,j)*K23(i,j,k)*dTdy(i,j) |
ENDDO |
|
& ) |
|
294 |
ENDDO |
ENDDO |
295 |
ENDDO |
ELSE |
|
IF (.NOT.implicitDiffusion) THEN |
|
296 |
DO j=jMin,jMax |
DO j=jMin,jMax |
297 |
DO i=iMin,iMax |
DO i=iMin,iMax |
298 |
df(i,j) = df(i,j) + _rA(i,j,bi,bj)*( |
df(i,j) = - _rA(i,j,bi,bj)*( |
299 |
& -KappaRT(i,j,k)*recip_drC(k) |
& KappaRT(i,j,k)*recip_drC(k) |
300 |
& *(theta(i,j,kM1,bi,bj)-theta(i,j,k,bi,bj))*rkFac |
& *(theta(i,j,kM1,bi,bj)-theta(i,j,k,bi,bj))*rkFac |
301 |
& ) |
& ) |
302 |
ENDDO |
ENDDO |
303 |
ENDDO |
ENDDO |
304 |
ENDIF |
ENDIF |
305 |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
#endif /* INCLUDE_T_DIFFUSION_CODE */ |
306 |
|
|
307 |
|
#ifdef ALLOW_GMREDI |
308 |
|
IF (useGMRedi) CALL GMREDI_RTRANSPORT( |
309 |
|
I iMin,iMax,jMin,jMax,bi,bj,K, |
310 |
|
I maskUp,theta, |
311 |
|
U df, |
312 |
|
I myThid) |
313 |
|
#endif |
314 |
|
|
315 |
|
#ifdef ALLOW_KPP |
316 |
|
C-- Add non local KPP transport term (ghat) to diffusive T flux. |
317 |
|
IF (useKPP) CALL KPP_TRANSPORT_T( |
318 |
|
I iMin,iMax,jMin,jMax,bi,bj,k,km1, |
319 |
|
I maskC,KappaRT, |
320 |
|
U df ) |
321 |
|
#endif |
322 |
|
|
323 |
C o Net vertical flux |
C o Net vertical flux |
324 |
DO j=jMin,jMax |
DO j=jMin,jMax |
325 |
DO i=iMin,iMax |
DO i=iMin,iMax |
326 |
fVerT(i,j,kUp) = 0. |
fVerT(i,j,kUp) = 0. |
327 |
_ADT(& +afFacT*af(i,j)*maskUp(i,j) ) |
& _ADT( +afFacT*af(i,j)*maskUp(i,j) ) |
328 |
_LPT(& +dfFacT*df(i,j)*maskUp(i,j) ) |
& _LPT( +dfFacT*df(i,j)*maskUp(i,j) ) |
329 |
ENDDO |
ENDDO |
330 |
ENDDO |
ENDDO |
331 |
#ifdef INCLUDE_T_ADVECTION_CODE |
#ifdef INCLUDE_T_ADVECTION_CODE |
374 |
I 1, sNy, k, k, bi, bj, 1, myThid) |
I 1, sNy, k, k, bi, bj, 1, myThid) |
375 |
#endif /* INCLUDE_LAT_CIRC_FFT_FILTER_CODE */ |
#endif /* INCLUDE_LAT_CIRC_FFT_FILTER_CODE */ |
376 |
|
|
|
|
|
377 |
RETURN |
RETURN |
378 |
END |
END |