/[MITgcm]/MITgcm/model/src/calc_gt.F
ViewVC logotype

Contents of /MITgcm/model/src/calc_gt.F

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


Revision 1.48 - (show annotations) (download)
Wed Mar 1 03:08:50 2006 UTC (18 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.47: +3 -15 lines
simplify the calls to GAD_CALC_RHS by adding 1 argument.

1 C $Header: /u/gcmpack/MITgcm/model/src/calc_gt.F,v 1.47 2006/02/26 01:57:24 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: CALC_GT
9 C !INTERFACE:
10 SUBROUTINE CALC_GT(
11 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
12 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
13 I KappaRT,
14 U fVerT,
15 I myTime,myIter,myThid )
16 C !DESCRIPTION: \bv
17 C *==========================================================*
18 C | SUBROUTINE CALC_GT
19 C | o Calculate the temperature tendency terms.
20 C *==========================================================*
21 C | A procedure called EXTERNAL_FORCING_T is called from
22 C | here. These procedures can be used to add per problem
23 C | heat flux source terms.
24 C | Note: Although it is slightly counter-intuitive the
25 C | EXTERNAL_FORCING routine is not the place to put
26 C | file I/O. Instead files that are required to
27 C | calculate the external source terms are generally
28 C | read during the model main loop. This makes the
29 C | logisitics of multi-processing simpler and also
30 C | makes the adjoint generation simpler. It also
31 C | allows for I/O to overlap computation where that
32 C | is supported by hardware.
33 C | Aside from the problem specific term the code here
34 C | forms the tendency terms due to advection and mixing
35 C | The baseline implementation here uses a centered
36 C | difference form for the advection term and a tensorial
37 C | divergence of a flux form for the diffusive term. The
38 C | diffusive term is formulated so that isopycnal mixing and
39 C | GM-style subgrid-scale terms can be incorporated b simply
40 C | setting the diffusion tensor terms appropriately.
41 C *==========================================================*
42 C \ev
43
44 C !USES:
45 IMPLICIT NONE
46 C == GLobal variables ==
47 #include "SIZE.h"
48 #include "DYNVARS.h"
49 #include "EEPARAMS.h"
50 #include "PARAMS.h"
51 #ifdef ALLOW_GENERIC_ADVDIFF
52 #include "GAD.h"
53 #endif
54 #ifdef ALLOW_AUTODIFF_TAMC
55 # include "tamc.h"
56 # include "tamc_keys.h"
57 #endif
58
59 C !INPUT/OUTPUT PARAMETERS:
60 C == Routine arguments ==
61 C fVerT :: Flux of temperature (T) in the vertical
62 C direction at the upper(U) and lower(D) faces of a cell.
63 C maskUp :: Land mask used to denote base of the domain.
64 C xA :: Tracer cell face area normal to X
65 C yA :: Tracer cell face area normal to X
66 C uTrans :: Zonal volume transport through cell face
67 C vTrans :: Meridional volume transport through cell face
68 C rTrans :: Vertical volume transport at interface k
69 C rTransKp1 :: Vertical volume transport at inteface k+1
70 C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation
71 C results will be set.
72 C myThid :: Instance number for this innvocation of CALC_GT
73 _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
74 _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
76 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
77 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
78 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
79 _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
80 _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
81 _RL KappaRT(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
82 INTEGER k,kUp,kDown,kM1
83 INTEGER bi,bj,iMin,iMax,jMin,jMax
84 _RL myTime
85 INTEGER myIter
86 INTEGER myThid
87 CEOP
88
89 #ifdef ALLOW_GENERIC_ADVDIFF
90 C === Local variables ===
91 LOGICAL calcAdvection
92 INTEGER iterNb
93 #ifdef ALLOW_ADAMSBASHFORTH_3
94 INTEGER m1, m2
95 #endif
96
97 #ifdef ALLOW_AUTODIFF_TAMC
98 act1 = bi - myBxLo(myThid)
99 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
100 act2 = bj - myByLo(myThid)
101 max2 = myByHi(myThid) - myByLo(myThid) + 1
102 act3 = myThid - 1
103 max3 = nTx*nTy
104 act4 = ikey_dynamics - 1
105 itdkey = (act1 + 1) + act2*max1
106 & + act3*max1*max2
107 & + act4*max1*max2*max3
108 kkey = (itdkey-1)*Nr + k
109 #endif /* ALLOW_AUTODIFF_TAMC */
110
111 #ifdef ALLOW_AUTODIFF_TAMC
112 C-- only the kUp part of fverT is set in this subroutine
113 C-- the kDown is still required
114 fVerT(1,1,kDown) = fVerT(1,1,kDown)
115 # ifdef NONLIN_FRSURF
116 CADJ STORE fVerT(:,:,:) = comlev1_bibj_k, key=kkey, byte=isbyte
117 # endif
118 #endif
119
120 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
121
122 calcAdvection = tempAdvection .AND. .NOT.tempMultiDimAdvec
123 iterNb = myIter
124 IF (staggerTimeStep) iterNb = myIter -1
125
126 #ifdef ALLOW_ADAMSBASHFORTH_3
127 m1 = 1 + MOD(iterNb+1,2)
128 m2 = 1 + MOD( iterNb ,2)
129 CALL GAD_CALC_RHS(
130 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
131 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
132 I uVel, vVel, wVel,
133 I diffKhT, diffK4T, KappaRT,
134 I gtNm(1-Olx,1-Oly,1,1,1,m2), theta,
135 I GAD_TEMPERATURE, tempAdvScheme, tempVertAdvScheme,
136 I calcAdvection, tempImplVertAdv, AdamsBashforth_T,
137 U fVerT, gT,
138 I myTime, myIter, myThid )
139 #else /* ALLOW_ADAMSBASHFORTH_3 */
140 CALL GAD_CALC_RHS(
141 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
142 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
143 I uVel, vVel, wVel,
144 I diffKhT, diffK4T, KappaRT, gtNm1, theta,
145 I GAD_TEMPERATURE, tempAdvScheme, tempVertAdvScheme,
146 I calcAdvection, tempImplVertAdv, AdamsBashforth_T,
147 U fVerT, gT,
148 I myTime, myIter, myThid )
149 #endif
150
151 C-- External thermal forcing term(s) inside Adams-Bashforth:
152 IF ( tempForcing .AND. forcing_In_AB )
153 & CALL EXTERNAL_FORCING_T(
154 I iMin,iMax,jMin,jMax,bi,bj,k,
155 I myTime,myThid)
156
157 IF ( AdamsBashforthGt ) THEN
158 #ifdef ALLOW_ADAMSBASHFORTH_3
159 CALL ADAMS_BASHFORTH3(
160 I bi, bj, k,
161 U gT, gtNm,
162 I tempStartAB, iterNb, myThid )
163 #else
164 CALL ADAMS_BASHFORTH2(
165 I bi, bj, k,
166 U gT, gtNm1,
167 I iterNb, myThid )
168 #endif
169 ENDIF
170
171 C-- External thermal forcing term(s) outside Adams-Bashforth:
172 IF ( tempForcing .AND. .NOT.forcing_In_AB )
173 & CALL EXTERNAL_FORCING_T(
174 I iMin,iMax,jMin,jMax,bi,bj,k,
175 I myTime,myThid)
176
177 #ifdef NONLIN_FRSURF
178 IF (nonlinFreeSurf.GT.0) THEN
179 CALL FREESURF_RESCALE_G(
180 I bi, bj, k,
181 U gT,
182 I myThid )
183 IF ( AdamsBashforthGt ) THEN
184 #ifdef ALLOW_ADAMSBASHFORTH_3
185 CALL FREESURF_RESCALE_G(
186 I bi, bj, k,
187 U gtNm(1-Olx,1-Oly,1,1,1,1),
188 I myThid )
189 CALL FREESURF_RESCALE_G(
190 I bi, bj, k,
191 U gtNm(1-Olx,1-Oly,1,1,1,2),
192 I myThid )
193 #else
194 CALL FREESURF_RESCALE_G(
195 I bi, bj, k,
196 U gtNm1,
197 I myThid )
198 #endif
199 ENDIF
200 ENDIF
201 #endif /* NONLIN_FRSURF */
202
203 #endif /* ALLOW_GENERIC_ADVDIFF */
204
205 RETURN
206 END

  ViewVC Help
Powered by ViewVC 1.1.22