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

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

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


Revision 1.54 - (hide annotations) (download)
Fri Feb 13 21:56:48 2009 UTC (15 years, 4 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint61n, checkpoint61q, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61r, checkpoint61p
Changes since 1.53: +5 -3 lines
Add TAF option "kind" (or adjust "byte") to enable real*4 common blocks

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

  ViewVC Help
Powered by ViewVC 1.1.22