/[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.13 - (show annotations) (download)
Fri Jun 27 01:55:08 2003 UTC (20 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint52l_pre, hrcube4, hrcube5, checkpoint52d_pre, checkpoint52j_pre, checkpoint51o_pre, checkpoint54d_post, checkpoint54e_post, checkpoint51l_post, checkpoint52l_post, checkpoint52k_post, checkpoint54, checkpoint53, checkpoint52, checkpoint52f_post, checkpoint54f_post, checkpoint51f_post, checkpoint51d_post, checkpoint51t_post, checkpoint51n_post, checkpoint52i_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint51j_post, checkpoint52e_pre, checkpoint52e_post, checkpoint51n_pre, checkpoint53d_post, checkpoint52b_pre, checkpoint54b_post, checkpoint51l_pre, checkpoint52m_post, checkpoint51q_post, checkpoint52b_post, checkpoint52c_post, checkpoint51h_pre, checkpoint52f_pre, checkpoint54a_pre, checkpoint53c_post, branchpoint-genmake2, checkpoint54a_post, checkpoint51r_post, checkpoint51i_post, checkpoint51b_post, checkpoint51c_post, checkpoint53a_post, checkpoint52d_post, checkpoint53g_post, checkpoint52a_pre, checkpoint52i_post, checkpoint51i_pre, checkpoint52h_pre, checkpoint53f_post, checkpoint52j_post, branch-netcdf, checkpoint52n_post, checkpoint53b_pre, checkpoint51e_post, checkpoint51o_post, checkpoint51f_pre, checkpoint53b_post, checkpoint52a_post, checkpoint51g_post, ecco_c52_e35, checkpoint51m_post, checkpoint53d_pre, checkpoint54c_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-genmake2, branch-nonh, tg2-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.12: +5 -3 lines
updated wraning

1 C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_xtransport.F,v 1.12 2003/01/21 19:34:13 heimbach 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 #endif /* ALLOW_AUTODIFF_TAMC */
30
31 C == Routine arguments ==
32 C iMin,iMax,jMin, - Range of points for which calculation
33 C jMax,bi,bj,k results will be set.
34 C xA - Area of X face
35 C Tracer - 3D Tracer field
36 C df - Diffusive flux component work array.
37 INTEGER iMin,iMax,jMin,jMax,bi,bj,k
38 _RS xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
39 _RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
40 integer tracerIdentity
41 _RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
42 INTEGER myThid
43
44 #ifdef ALLOW_GMREDI
45
46 C == Local variables ==
47 C I, J - Loop counters
48 INTEGER I, J
49 INTEGER km1,kp1
50 _RL maskp1
51 #ifdef GM_EXTRA_DIAGONAL
52 _RL dTdz (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53 #endif
54 #ifdef GM_BOLUS_ADVEC
55 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
56 #endif
57
58 #ifdef ALLOW_AUTODIFF_TAMC
59 act0 = tracerIdentity - 1
60 max0 = maxpass
61 act1 = bi - myBxLo(myThid)
62 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
63 act2 = bj - myByLo(myThid)
64 max2 = myByHi(myThid) - myByLo(myThid) + 1
65 act3 = myThid - 1
66 max3 = nTx*nTy
67 act4 = ikey_dynamics - 1
68 igadkey = (act0 + 1)
69 & + act1*max0
70 & + act2*max0*max1
71 & + act3*max0*max1*max2
72 & + act4*max0*max1*max2*max3
73 kkey = (igadkey-1)*Nr + k
74 if (tracerIdentity.GT.maxpass) then
75 print *, 'ph-pass gmredi_xtrans ', maxpass, tracerIdentity
76 STOP 'maxpass seems smaller than tracerIdentity'
77 endif
78 #endif /* ALLOW_AUTODIFF_TAMC */
79
80 IF (useGMRedi) THEN
81
82 #ifdef ALLOW_AUTODIFF_TAMC
83 # ifdef GM_NON_UNITY_DIAGONAL
84 CADJ STORE Kux(:,:,k,bi,bj) =
85 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
86 # endif
87 # ifdef GM_EXTRA_DIAGONAL
88 CADJ STORE Kuz(:,:,k,bi,bj) =
89 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
90 # endif
91 #endif
92
93 C-- Area integrated zonal flux
94 DO j=jMin,jMax
95 DO i=iMin,iMax
96 df(i,j) = df(i,j)
97 & -xA(i,j)
98 #ifdef GM_NON_UNITY_DIAGONAL
99 & *Kux(i,j,k,bi,bj)
100 #else
101 & *(GM_isopycK
102 #ifdef GM_VISBECK_VARIABLE_K
103 & +op5*(VisbeckK(i,j,bi,bj)+VisbeckK(i-1,j,bi,bj))
104 #endif
105 & )
106 #endif /* GM_NON_UNITY_DIAGONAL */
107 & *_recip_dxC(i,j,bi,bj)
108 & *(Tracer(i,j,k,bi,bj)-Tracer(i-1,j,k,bi,bj))
109 ENDDO
110 ENDDO
111
112 #ifdef GM_EXTRA_DIAGONAL
113 IF (GM_ExtraDiag) THEN
114 km1 = MAX(k-1,1)
115 kp1 = MIN(k+1,Nr)
116
117 DO j=jMin,jMax
118 DO i=iMin,iMax
119 C- Vertical gradients interpolated to U points
120 dTdz(i,j) = op5*(
121 & +op5*recip_drC(k)*
122 & ( maskC(i-1,j,k,bi,bj)*
123 & (Tracer(i-1,j,km1,bi,bj)-Tracer(i-1,j,k,bi,bj))
124 & +maskC( i ,j,k,bi,bj)*
125 & (Tracer( i ,j,km1,bi,bj)-Tracer( i ,j,k,bi,bj))
126 & )
127 & +op5*recip_drC(kp1)*
128 & ( maskC(i-1,j,kp1,bi,bj)*
129 & (Tracer(i-1,j,k,bi,bj)-Tracer(i-1,j,kp1,bi,bj))
130 & +maskC( i ,j,kp1,bi,bj)*
131 & (Tracer( i ,j,k,bi,bj)-Tracer( i ,j,kp1,bi,bj))
132 & ) )
133
134
135 ENDDO
136 ENDDO
137 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
138 CADJ STORE dtdz(:,:) =
139 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
140 #endif
141 DO j=jMin,jMax
142 DO i=iMin,iMax
143 C- Off-diagonal components of horizontal flux
144 df(i,j) = df(i,j) - xA(i,j)*Kuz(i,j,k,bi,bj)*dTdz(i,j)
145 ENDDO
146 ENDDO
147 ENDIF
148 #endif /* GM_EXTRA_DIAGONAL */
149
150 #ifdef GM_BOLUS_ADVEC
151 IF (GM_AdvForm .AND. GM_AdvSeparate) THEN
152 kp1 = MIN(k+1,Nr)
153 maskp1 = 1.
154 IF (k.GE.Nr) maskp1 = 0.
155 DO j=jMin,jMax
156 DO i=iMin,iMax
157 uTrans(i,j) = dyG(i,j,bi,bj)*( GM_PsiX(i,j,kp1,bi,bj)*maskp1
158 & -GM_PsiX(i,j,k,bi,bj) )
159 & *maskW(i,j,k,bi,bj)
160 ENDDO
161 ENDDO
162 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
163 CADJ STORE utrans(:,:) =
164 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
165 #endif
166 DO j=jMin,jMax
167 DO i=iMin,iMax
168 df(i,j) = df(i,j)
169 & +uTrans(i,j)*op5*(Tracer(i,j,k,bi,bj)+Tracer(i-1,j,k,bi,bj))
170 ENDDO
171 ENDDO
172 ENDIF
173 #endif /* GM_BOLUS_ADVEC */
174
175 ENDIF
176 #endif /* ALLOW_GMREDI */
177
178 RETURN
179 END

  ViewVC Help
Powered by ViewVC 1.1.22