/[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.45 - (hide annotations) (download)
Sun Nov 6 22:19:08 2005 UTC (18 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57x_post, checkpoint57y_pre
Changes since 1.44: +33 -8 lines
Allow to apply AB on T,S rather than on AB(gT,gS):
 - implemented within #ifdef ALLOW_ADAMSBASHFORTH_3
 - use the same arrays (gtNm,gsNm) to hold tracer field at previous
   time-steps (if AB(T,S)) and tendencies (if AB(gT,gS)).

1 jmc 1.45 C $Header: /u/gcmpack/MITgcm/model/src/calc_gt.F,v 1.44 2005/04/15 14:18:51 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 cnh 1.1 SUBROUTINE CALC_GT(
11     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
12 jmc 1.39 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
13 adcroft 1.25 I KappaRT,
14 adcroft 1.28 U fVerT,
15 adcroft 1.35 I myTime,myIter,myThid )
16 cnh 1.36 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 cnh 1.1 IMPLICIT NONE
46     C == GLobal variables ==
47     #include "SIZE.h"
48     #include "DYNVARS.h"
49     #include "EEPARAMS.h"
50     #include "PARAMS.h"
51 jmc 1.43 #ifdef ALLOW_GENERIC_ADVDIFF
52 adcroft 1.34 #include "GAD.h"
53 jmc 1.43 #endif
54 cnh 1.1
55 cnh 1.36 C !INPUT/OUTPUT PARAMETERS:
56 cnh 1.1 C == Routine arguments ==
57 cnh 1.36 C fVerT :: Flux of temperature (T) in the vertical
58     C direction at the upper(U) and lower(D) faces of a cell.
59     C maskUp :: Land mask used to denote base of the domain.
60     C xA :: Tracer cell face area normal to X
61     C yA :: Tracer cell face area normal to X
62     C uTrans :: Zonal volume transport through cell face
63     C vTrans :: Meridional volume transport through cell face
64 jmc 1.39 C rTrans :: Vertical volume transport at interface k
65     C rTransKp1 :: Vertical volume transport at inteface k+1
66 cnh 1.36 C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation
67     C results will be set.
68     C myThid :: Instance number for this innvocation of CALC_GT
69 cnh 1.1 _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
70     _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71     _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72     _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73     _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74 cnh 1.14 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 jmc 1.39 _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
76 cnh 1.1 _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
77 jmc 1.42 _RL KappaRT(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
78 adcroft 1.3 INTEGER k,kUp,kDown,kM1
79 cnh 1.1 INTEGER bi,bj,iMin,iMax,jMin,jMax
80 adcroft 1.35 _RL myTime
81     INTEGER myIter
82 cnh 1.1 INTEGER myThid
83 cnh 1.36 CEOP
84 heimbach 1.24
85 jmc 1.43 #ifdef ALLOW_GENERIC_ADVDIFF
86 jmc 1.37 C === Local variables ===
87     LOGICAL calcAdvection
88 jmc 1.44 INTEGER iterNb
89 jmc 1.45 #ifdef ALLOW_ADAMSBASHFORTH_3
90     INTEGER m1, m2
91     #endif
92 jmc 1.37
93 heimbach 1.24 #ifdef ALLOW_AUTODIFF_TAMC
94     C-- only the kUp part of fverT is set in this subroutine
95     C-- the kDown is still required
96     fVerT(1,1,kDown) = fVerT(1,1,kDown)
97 adcroft 1.20 #endif
98 cnh 1.1
99 jmc 1.45 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
100    
101 jmc 1.37 calcAdvection = tempAdvection .AND. .NOT.tempMultiDimAdvec
102 jmc 1.45 iterNb = myIter
103     IF (staggerTimeStep) iterNb = myIter -1
104    
105     #ifdef ALLOW_ADAMSBASHFORTH_3
106     IF ( AdamsBashforth_T ) THEN
107     m1 = 1 + MOD(iterNb+1,2)
108     m2 = 1 + MOD( iterNb ,2)
109     CALL GAD_CALC_RHS(
110     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
111     I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
112     I uVel, vVel, wVel,
113     I diffKhT, diffK4T, KappaRT,
114     I gtNm(1-Olx,1-Oly,1,1,1,m2), theta,
115     I GAD_TEMPERATURE, tempAdvScheme, tempVertAdvScheme,
116     I calcAdvection, tempImplVertAdv,
117     U fVerT, gT,
118     I myTime, myIter, myThid )
119     ELSE
120     #endif /* ALLOW_ADAMSBASHFORTH_3 */
121     CALL GAD_CALC_RHS(
122 adcroft 1.34 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
123 jmc 1.39 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
124     I uVel, vVel, wVel,
125 jmc 1.45 I diffKhT, diffK4T, KappaRT, theta, theta,
126 jmc 1.40 I GAD_TEMPERATURE, tempAdvScheme, tempVertAdvScheme,
127 jmc 1.39 I calcAdvection, tempImplVertAdv,
128 adcroft 1.34 U fVerT, gT,
129 jmc 1.41 I myTime, myIter, myThid )
130 jmc 1.45 #ifdef ALLOW_ADAMSBASHFORTH_3
131     ENDIF
132     #endif
133 cnh 1.1
134 jmc 1.37 C-- External thermal forcing term(s) inside Adams-Bashforth:
135     IF ( tempForcing .AND. forcing_In_AB )
136     & CALL EXTERNAL_FORCING_T(
137 cnh 1.19 I iMin,iMax,jMin,jMax,bi,bj,k,
138 adcroft 1.35 I myTime,myThid)
139    
140 jmc 1.45 IF ( AdamsBashforthGt ) THEN
141 jmc 1.44 #ifdef ALLOW_ADAMSBASHFORTH_3
142     CALL ADAMS_BASHFORTH3(
143     I bi, bj, k,
144     U gT, gtNm,
145 jmc 1.45 I tempStartAB, iterNb, myThid )
146 jmc 1.44 #else
147 adcroft 1.35 CALL ADAMS_BASHFORTH2(
148 jmc 1.44 I bi, bj, k,
149     U gT, gtNm1,
150     I iterNb, myThid )
151     #endif
152 adcroft 1.35 ENDIF
153 jmc 1.37
154     C-- External thermal forcing term(s) outside Adams-Bashforth:
155     IF ( tempForcing .AND. .NOT.forcing_In_AB )
156     & CALL EXTERNAL_FORCING_T(
157     I iMin,iMax,jMin,jMax,bi,bj,k,
158     I myTime,myThid)
159 adcroft 1.35
160     #ifdef NONLIN_FRSURF
161     IF (nonlinFreeSurf.GT.0) THEN
162     CALL FREESURF_RESCALE_G(
163 jmc 1.44 I bi, bj, k,
164 adcroft 1.35 U gT,
165 jmc 1.38 I myThid )
166 jmc 1.45 IF ( AdamsBashforthGt ) THEN
167 jmc 1.44 #ifdef ALLOW_ADAMSBASHFORTH_3
168     CALL FREESURF_RESCALE_G(
169     I bi, bj, k,
170     U gtNm(1-Olx,1-Oly,1,1,1,1),
171     I myThid )
172     CALL FREESURF_RESCALE_G(
173     I bi, bj, k,
174     U gtNm(1-Olx,1-Oly,1,1,1,2),
175 adcroft 1.35 I myThid )
176 jmc 1.44 #else
177     CALL FREESURF_RESCALE_G(
178     I bi, bj, k,
179     U gtNm1,
180     I myThid )
181     #endif
182     ENDIF
183 adcroft 1.35 ENDIF
184     #endif /* NONLIN_FRSURF */
185 cnh 1.1
186 jmc 1.43 #endif /* ALLOW_GENERIC_ADVDIFF */
187    
188 cnh 1.1 RETURN
189     END

  ViewVC Help
Powered by ViewVC 1.1.22