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

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

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


Revision 1.14 - (show annotations) (download)
Fri Sep 17 23:02:01 2004 UTC (19 years, 8 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57g_pre, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint59, checkpoint58, checkpoint55, checkpoint57, checkpoint56, checkpoint58f_post, checkpoint57n_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint58y_post, checkpoint58t_post, checkpoint55i_post, checkpoint58m_post, checkpoint57l_post, checkpoint57t_post, checkpoint55c_post, checkpoint57v_post, checkpoint57f_post, checkpoint57a_post, checkpoint57h_pre, checkpoint58w_post, checkpoint57h_post, checkpoint57y_pre, checkpoint55g_post, checkpoint58o_post, checkpoint57c_post, checkpoint58p_post, checkpoint58q_post, checkpoint55d_post, checkpoint58e_post, mitgcm_mapl_00, checkpoint55d_pre, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint55h_post, checkpoint58n_post, checkpoint57e_post, checkpoint55b_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint58k_post, checkpoint58v_post, checkpoint56a_post, checkpoint58l_post, checkpoint57h_done, checkpoint57j_post, checkpoint57f_pre, checkpoint58g_post, checkpoint58x_post, checkpoint59j, checkpoint58h_post, checkpoint56c_post, checkpoint58j_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint57k_post, checkpoint57w_post, checkpoint58i_post, checkpoint57x_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post, checkpoint55e_post
Changes since 1.13: +6 -3 lines
o bringing adjoint up to date for sheduled c55

1 C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_rtransport.F,v 1.13 2003/06/27 01:55:08 heimbach Exp $
2 C $Name: $
3
4 #include "GMREDI_OPTIONS.h"
5
6 subroutine GMREDI_RTRANSPORT(
7 I iMin,iMax,jMin,jMax,bi,bj,K,
8 I Tracer,tracerIdentity,
9 U df,
10 I myThid)
11 C /==========================================================\
12 C | o SUBROUTINE GMREDI_RTRANSPORT |
13 C | Add vertical 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 _RL Tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
42 INTEGER tracerIdentity
43 _RL df (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44 INTEGER myThid
45
46 #ifdef ALLOW_GMREDI
47
48 C == Local variables ==
49 C I, J - Loop counters
50 INTEGER I, J
51 _RL dTdx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
52 _RL dTdy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53 #ifdef GM_BOLUS_ADVEC
54 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
55 #endif
56
57 #ifdef ALLOW_AUTODIFF_TAMC
58 act0 = tracerIdentity - 1
59 max0 = maxpass
60 act1 = bi - myBxLo(myThid)
61 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
62 act2 = bj - myByLo(myThid)
63 max2 = myByHi(myThid) - myByLo(myThid) + 1
64 act3 = myThid - 1
65 max3 = nTx*nTy
66 act4 = ikey_dynamics - 1
67 igadkey = (act0 + 1)
68 & + act1*max0
69 & + act2*max0*max1
70 & + act3*max0*max1*max2
71 & + act4*max0*max1*max2*max3
72 kkey = (igadkey-1)*Nr + k
73 if (tracerIdentity.GT.maxpass) then
74 print *, 'ph-pass gmredi_rtrans ', maxpass, tracerIdentity
75 STOP 'maxpass seems smaller than tracerIdentity'
76 endif
77 #endif /* ALLOW_AUTODIFF_TAMC */
78
79 C Surface flux is zero
80 IF (useGMRedi .AND. K.GT.1) THEN
81
82 C- Horizontal gradients interpolated to W points
83 DO j=jMin,jMax
84 DO i=iMin,iMax
85 dTdx(i,j) = op5*(
86 & +op5*(_maskW(i+1,j,k,bi,bj)
87 & *_recip_dxC(i+1,j,bi,bj)*
88 & (Tracer(i+1,j,k,bi,bj)-Tracer(i,j,k,bi,bj))
89 & +_maskW(i,j,k,bi,bj)
90 & *_recip_dxC(i,j,bi,bj)*
91 & (Tracer(i,j,k,bi,bj)-Tracer(i-1,j,k,bi,bj)))
92 & +op5*(_maskW(i+1,j,k-1,bi,bj)
93 & *_recip_dxC(i+1,j,bi,bj)*
94 & (Tracer(i+1,j,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj))
95 & +_maskW(i,j,k-1,bi,bj)
96 & *_recip_dxC(i,j,bi,bj)*
97 & (Tracer(i,j,k-1,bi,bj)-Tracer(i-1,j,k-1,bi,bj)))
98 & )
99
100 dTdy(i,j) = op5*(
101 & +op5*(_maskS(i,j,k,bi,bj)
102 & *_recip_dyC(i,j,bi,bj)*
103 & (Tracer(i,j,k,bi,bj)-Tracer(i,j-1,k,bi,bj))
104 & +_maskS(i,j+1,k,bi,bj)
105 & *_recip_dyC(i,j+1,bi,bj)*
106 & (Tracer(i,j+1,k,bi,bj)-Tracer(i,j,k,bi,bj)))
107 & +op5*(_maskS(i,j,k-1,bi,bj)
108 & *_recip_dyC(i,j,bi,bj)*
109 & (Tracer(i,j,k-1,bi,bj)-Tracer(i,j-1,k-1,bi,bj))
110 & +_maskS(i,j+1,k-1,bi,bj)
111 & *_recip_dyC(i,j+1,bi,bj)*
112 & (Tracer(i,j+1,k-1,bi,bj)-Tracer(i,j,k-1,bi,bj)))
113 & )
114 ENDDO
115 ENDDO
116
117 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
118 CADJ STORE dTdx(:,:) =
119 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
120 CADJ STORE dTdy(:,:) =
121 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
122 #endif
123
124 C- Off-diagonal components of vertical flux
125 DO j=jMin,jMax
126 DO i=iMin,iMax
127 df(i,j) = df(i,j)
128 & - _rA(i,j,bi,bj)
129 & *( Kwx(i,j,k,bi,bj)*dTdx(i,j)+Kwy(i,j,k,bi,bj)*dTdy(i,j) )
130
131 ENDDO
132 ENDDO
133
134 #ifdef GM_BOLUS_ADVEC
135 IF (GM_AdvForm .AND. GM_AdvSeparate) THEN
136 DO j=jMin,jMax
137 DO i=iMin,iMax
138 rTrans(i,j) =
139 & dyG(i+1,j,bi,bj)*GM_PsiX(i+1,j,k,bi,bj)
140 & -dyG( i ,j,bi,bj)*GM_PsiX( i ,j,k,bi,bj)
141 & +dxG(i,j+1,bi,bj)*GM_PsiY(i,j+1,k,bi,bj)
142 & -dxG(i, j ,bi,bj)*GM_PsiY(i, j ,k,bi,bj)
143 ENDDO
144 ENDDO
145 #ifdef GM_AUTODIFF_EXCESSIVE_STORE
146 CADJ STORE rtrans(:,:) =
147 CADJ & comlev1_gmredi_k_gad, key=kkey, byte=isbyte
148 #endif
149 DO j=jMin,jMax
150 DO i=iMin,iMax
151 df(i,j) = df(i,j)
152 & +rTrans(i,j)*op5
153 & *(Tracer(i,j,k,bi,bj)+Tracer(i,j,k-1,bi,bj))
154 ENDDO
155 ENDDO
156 ENDIF
157 #endif /* GM_BOLUS_ADVEC */
158
159 c IF (.NOT.implicitDiffusion) THEN
160 c
161 c This vertical diffusion term is currently implemented
162 c by adding the VisbeckK*Kwz diffusivity to KappaRT/S
163 c See calc_diffusivity.F and calc_gt.F (calc_gs.F)
164 c
165 c DO j=jMin,jMax
166 c DO i=iMin,iMax
167 c df(i,j) = df(i,j) - _rA(i,j,bi,bj)
168 c & *maskUp(i,j)*VisbeckK(i,j,bi,bj)*Kwz(i,j,k,bi,bj)
169 c & *recip_drC(k)*rkfac
170 c & *(Tracer(i,j,k-1,bi,bj)-Tracer(i,j,k,bi,bj))
171 c ENDDO
172 c ENDDO
173 c ENDIF
174
175 ENDIF
176 #endif /* ALLOW_GMREDI */
177
178 RETURN
179 END

  ViewVC Help
Powered by ViewVC 1.1.22