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

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

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


Revision 1.42 - (hide annotations) (download)
Tue May 18 18:01:12 1999 UTC (25 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint22
Changes since 1.41: +66 -9 lines
Modifications/additions for KPP mixing scheme. Instigated by Dimitri.

1 adcroft 1.42 C $Header: /u/gcmpack/models/MITgcmUV/model/src/dynamics.F,v 1.41 1999/05/03 21:45:57 adcroft Exp $
2 cnh 1.1
3 adcroft 1.24 #include "CPP_OPTIONS.h"
4 cnh 1.1
5 cnh 1.8 SUBROUTINE DYNAMICS(myTime, myIter, myThid)
6 cnh 1.1 C /==========================================================\
7     C | SUBROUTINE DYNAMICS |
8     C | o Controlling routine for the explicit part of the model |
9     C | dynamics. |
10     C |==========================================================|
11     C | This routine evaluates the "dynamics" terms for each |
12     C | block of ocean in turn. Because the blocks of ocean have |
13     C | overlap regions they are independent of one another. |
14     C | If terms involving lateral integrals are needed in this |
15     C | routine care will be needed. Similarly finite-difference |
16     C | operations with stencils wider than the overlap region |
17     C | require special consideration. |
18     C | Notes |
19     C | ===== |
20     C | C*P* comments indicating place holders for which code is |
21     C | presently being developed. |
22     C \==========================================================/
23 adcroft 1.40 IMPLICIT NONE
24 cnh 1.1
25     C == Global variables ===
26     #include "SIZE.h"
27     #include "EEPARAMS.h"
28     #include "CG2D.h"
29 adcroft 1.6 #include "PARAMS.h"
30 adcroft 1.3 #include "DYNVARS.h"
31 adcroft 1.42 #include "GRID.h"
32     #ifdef ALLOW_KPP
33     #include "KPPMIX.h"
34     #endif
35 cnh 1.1
36     C == Routine arguments ==
37 cnh 1.8 C myTime - Current time in simulation
38     C myIter - Current iteration number in simulation
39 cnh 1.1 C myThid - Thread number for this instance of the routine.
40     INTEGER myThid
41 cnh 1.8 _RL myTime
42     INTEGER myIter
43 cnh 1.1
44     C == Local variables
45     C xA, yA - Per block temporaries holding face areas
46 cnh 1.38 C uTrans, vTrans, rTrans - Per block temporaries holding flow
47     C transport
48 cnh 1.30 C rVel o uTrans: Zonal transport
49 cnh 1.1 C o vTrans: Meridional transport
50 cnh 1.30 C o rTrans: Vertical transport
51 cnh 1.38 C o rVel: Vertical velocity at upper and
52     C lower cell faces.
53 cnh 1.1 C maskC,maskUp o maskC: land/water mask for tracer cells
54     C o maskUp: land/water mask for W points
55     C aTerm, xTerm, cTerm - Work arrays for holding separate terms in
56     C mTerm, pTerm, tendency equations.
57     C fZon, fMer, fVer[STUV] o aTerm: Advection term
58     C o xTerm: Mixing term
59     C o cTerm: Coriolis term
60     C o mTerm: Metric term
61     C o pTerm: Pressure term
62     C o fZon: Zonal flux term
63     C o fMer: Meridional flux term
64     C o fVer: Vertical flux term - note fVer
65     C is "pipelined" in the vertical
66     C so we need an fVer for each
67     C variable.
68 cnh 1.38 C rhoK, rhoKM1 - Density at current level, level above and level
69     C below.
70 cnh 1.26 C rhoKP1
71     C buoyK, buoyKM1 - Buoyancy at current level and level above.
72 cnh 1.31 C phiHyd - Hydrostatic part of the potential phiHydi.
73 cnh 1.38 C In z coords phiHydiHyd is the hydrostatic
74     C pressure anomaly
75     C In p coords phiHydiHyd is the geopotential
76     C surface height
77 cnh 1.30 C anomaly.
78     C etaSurfX, - Holds surface elevation gradient in X and Y.
79     C etaSurfY
80     C K13, K23, K33 - Non-zero elements of small-angle approximation
81     C diffusion tensor.
82     C KapGM - Spatially varying Visbeck et. al mixing coeff.
83     C KappaRT, - Total diffusion in vertical for T and S.
84 cnh 1.38 C KappaRS (background + spatially varying, isopycnal term).
85 cnh 1.30 C iMin, iMax - Ranges and sub-block indices on which calculations
86     C jMin, jMax are applied.
87 cnh 1.1 C bi, bj
88 cnh 1.30 C k, kUp, - Index for layer above and below. kUp and kDown
89 cnh 1.38 C kDown, kM1 are switched with layer to be the appropriate
90     C index into fVerTerm.
91 cnh 1.30 _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
92     _RS yA (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     _RL rVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
97     _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98     _RS maskUp (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99     _RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
100     _RL xTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
101     _RL cTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
102     _RL mTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
103     _RL pTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
104     _RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
105     _RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
106     _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
107     _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
108     _RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
109     _RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
110 cnh 1.31 _RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
111 cnh 1.30 _RL rhokm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
112     _RL rhokp1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
113     _RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
114     _RL buoyKM1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
115     _RL buoyK (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
116     _RL rhotmp (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
117 cnh 1.29 _RL etaSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
118     _RL etaSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
119 cnh 1.31 _RL K13 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
120     _RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
121     _RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
122 cnh 1.30 _RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
123 cnh 1.31 _RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
124     _RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
125 adcroft 1.42 _RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
126     _RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr)
127 adcroft 1.12
128 cnh 1.1 INTEGER iMin, iMax
129     INTEGER jMin, jMax
130     INTEGER bi, bj
131     INTEGER i, j
132     INTEGER k, kM1, kUp, kDown
133 cnh 1.19 LOGICAL BOTTOM_LAYER
134 cnh 1.1
135 adcroft 1.11 C--- The algorithm...
136     C
137     C "Correction Step"
138     C =================
139     C Here we update the horizontal velocities with the surface
140     C pressure such that the resulting flow is either consistent
141     C with the free-surface evolution or the rigid-lid:
142     C U[n] = U* + dt x d/dx P
143     C V[n] = V* + dt x d/dy P
144     C
145     C "Calculation of Gs"
146     C ===================
147     C This is where all the accelerations and tendencies (ie.
148 cnh 1.31 C phiHydysics, parameterizations etc...) are calculated
149 cnh 1.27 C rVel = sum_r ( div. u[n] )
150 adcroft 1.11 C rho = rho ( theta[n], salt[n] )
151 cnh 1.27 C b = b(rho, theta)
152 adcroft 1.11 C K31 = K31 ( rho )
153 cnh 1.27 C Gu[n] = Gu( u[n], v[n], rVel, b, ... )
154     C Gv[n] = Gv( u[n], v[n], rVel, b, ... )
155     C Gt[n] = Gt( theta[n], u[n], v[n], rVel, K31, ... )
156     C Gs[n] = Gs( salt[n], u[n], v[n], rVel, K31, ... )
157 adcroft 1.11 C
158 adcroft 1.12 C "Time-stepping" or "Prediction"
159 adcroft 1.11 C ================================
160     C The models variables are stepped forward with the appropriate
161     C time-stepping scheme (currently we use Adams-Bashforth II)
162     C - For momentum, the result is always *only* a "prediction"
163     C in that the flow may be divergent and will be "corrected"
164     C later with a surface pressure gradient.
165     C - Normally for tracers the result is the new field at time
166     C level [n+1} *BUT* in the case of implicit diffusion the result
167     C is also *only* a prediction.
168     C - We denote "predictors" with an asterisk (*).
169     C U* = U[n] + dt x ( 3/2 Gu[n] - 1/2 Gu[n-1] )
170     C V* = V[n] + dt x ( 3/2 Gv[n] - 1/2 Gv[n-1] )
171     C theta[n+1] = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )
172     C salt[n+1] = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )
173 adcroft 1.12 C With implicit diffusion:
174 adcroft 1.11 C theta* = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )
175     C salt* = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] )
176 adcroft 1.12 C (1 + dt * K * d_zz) theta[n] = theta*
177     C (1 + dt * K * d_zz) salt[n] = salt*
178 adcroft 1.11 C---
179    
180 cnh 1.1 C-- Set up work arrays with valid (i.e. not NaN) values
181     C These inital values do not alter the numerical results. They
182     C just ensure that all memory references are to valid floating
183     C point numbers. This prevents spurious hardware signals due to
184     C uninitialised but inert locations.
185     DO j=1-OLy,sNy+OLy
186     DO i=1-OLx,sNx+OLx
187 adcroft 1.5 xA(i,j) = 0. _d 0
188     yA(i,j) = 0. _d 0
189     uTrans(i,j) = 0. _d 0
190     vTrans(i,j) = 0. _d 0
191     aTerm(i,j) = 0. _d 0
192     xTerm(i,j) = 0. _d 0
193     cTerm(i,j) = 0. _d 0
194     mTerm(i,j) = 0. _d 0
195     pTerm(i,j) = 0. _d 0
196     fZon(i,j) = 0. _d 0
197     fMer(i,j) = 0. _d 0
198 cnh 1.31 DO K=1,Nr
199     phiHyd (i,j,k) = 0. _d 0
200 cnh 1.30 K13(i,j,k) = 0. _d 0
201     K23(i,j,k) = 0. _d 0
202     K33(i,j,k) = 0. _d 0
203 cnh 1.31 KappaRT(i,j,k) = 0. _d 0
204     KappaRS(i,j,k) = 0. _d 0
205 cnh 1.1 ENDDO
206 cnh 1.30 rhoKM1 (i,j) = 0. _d 0
207     rhok (i,j) = 0. _d 0
208     rhoKP1 (i,j) = 0. _d 0
209     rhoTMP (i,j) = 0. _d 0
210 cnh 1.26 buoyKM1(i,j) = 0. _d 0
211     buoyK (i,j) = 0. _d 0
212 cnh 1.30 maskC (i,j) = 0. _d 0
213 cnh 1.1 ENDDO
214     ENDDO
215    
216 cnh 1.35
217 cnh 1.1 DO bj=myByLo(myThid),myByHi(myThid)
218     DO bi=myBxLo(myThid),myBxHi(myThid)
219    
220 cnh 1.7 C-- Set up work arrays that need valid initial values
221     DO j=1-OLy,sNy+OLy
222     DO i=1-OLx,sNx+OLx
223 cnh 1.27 rTrans(i,j) = 0. _d 0
224     rVel (i,j,1) = 0. _d 0
225     rVel (i,j,2) = 0. _d 0
226 cnh 1.30 fVerT (i,j,1) = 0. _d 0
227     fVerT (i,j,2) = 0. _d 0
228     fVerS (i,j,1) = 0. _d 0
229     fVerS (i,j,2) = 0. _d 0
230     fVerU (i,j,1) = 0. _d 0
231     fVerU (i,j,2) = 0. _d 0
232     fVerV (i,j,1) = 0. _d 0
233     fVerV (i,j,2) = 0. _d 0
234 cnh 1.27 phiHyd(i,j,1) = 0. _d 0
235 cnh 1.30 K13 (i,j,1) = 0. _d 0
236     K23 (i,j,1) = 0. _d 0
237     K33 (i,j,1) = 0. _d 0
238     KapGM (i,j) = GMkbackground
239 cnh 1.7 ENDDO
240     ENDDO
241    
242 cnh 1.1 iMin = 1-OLx+1
243     iMax = sNx+OLx
244     jMin = 1-OLy+1
245     jMax = sNy+OLy
246 cnh 1.35
247 cnh 1.1
248 cnh 1.19 K = 1
249 cnh 1.31 BOTTOM_LAYER = K .EQ. Nr
250 cnh 1.19
251 cnh 1.38 #ifdef DO_PIPELINED_CORRECTION_STEP
252 adcroft 1.4 C-- Calculate gradient of surface pressure
253 cnh 1.28 CALL CALC_GRAD_ETA_SURF(
254 adcroft 1.4 I bi,bj,iMin,iMax,jMin,jMax,
255 cnh 1.29 O etaSurfX,etaSurfY,
256 adcroft 1.4 I myThid)
257     C-- Update fields in top level according to tendency terms
258 adcroft 1.11 CALL CORRECTION_STEP(
259 cnh 1.30 I bi,bj,iMin,iMax,jMin,jMax,K,
260     I etaSurfX,etaSurfY,myTime,myThid)
261 adcroft 1.39 IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid )
262 adcroft 1.21 IF ( .NOT. BOTTOM_LAYER ) THEN
263     C-- Update fields in layer below according to tendency terms
264     CALL CORRECTION_STEP(
265 cnh 1.30 I bi,bj,iMin,iMax,jMin,jMax,K+1,
266     I etaSurfX,etaSurfY,myTime,myThid)
267 adcroft 1.39 IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
268 adcroft 1.21 ENDIF
269 cnh 1.38 #endif
270 cnh 1.7 C-- Density of 1st level (below W(1)) reference to level 1
271 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
272 cnh 1.7 CALL FIND_RHO(
273 cnh 1.19 I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
274 cnh 1.7 O rhoKm1,
275     I myThid )
276 cnh 1.38 #endif
277 cnh 1.19
278 adcroft 1.42 IF ( (.NOT. BOTTOM_LAYER)
279     #ifdef ALLOW_KPP
280     & .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing
281     #endif
282     & ) THEN
283 cnh 1.19 C-- Check static stability with layer below
284 cnh 1.30 C-- and mix as needed.
285 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
286 cnh 1.19 CALL FIND_RHO(
287     I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
288     O rhoKp1,
289     I myThid )
290 cnh 1.38 #endif
291     #ifdef INCLUDE_CONVECT_CALL
292 cnh 1.19 CALL CONVECT(
293     I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
294     I myTime,myIter,myThid)
295 cnh 1.38 #endif
296 cnh 1.19 C-- Recompute density after mixing
297 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
298 cnh 1.19 CALL FIND_RHO(
299     I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
300     O rhoKm1,
301     I myThid )
302 cnh 1.38 #endif
303 cnh 1.19 ENDIF
304 cnh 1.26 C-- Calculate buoyancy
305 cnh 1.32 CALL CALC_BUOYANCY(
306 cnh 1.26 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,
307     O buoyKm1,
308     I myThid )
309 cnh 1.38 C-- Integrate hydrostatic balance for phiHyd with BC of
310     C-- phiHyd(z=0)=0
311 cnh 1.26 CALL CALC_PHI_HYD(
312     I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1,
313     U phiHyd,
314 adcroft 1.5 I myThid )
315    
316 cnh 1.31 DO K=2,Nr
317     BOTTOM_LAYER = K .EQ. Nr
318 cnh 1.38 #ifdef DO_PIPELINED_CORRECTION_STEP
319 adcroft 1.21 IF ( .NOT. BOTTOM_LAYER ) THEN
320     C-- Update fields in layer below according to tendency terms
321     CALL CORRECTION_STEP(
322 cnh 1.30 I bi,bj,iMin,iMax,jMin,jMax,K+1,
323     I etaSurfX,etaSurfY,myTime,myThid)
324 adcroft 1.39 IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )
325 adcroft 1.21 ENDIF
326 cnh 1.38 #endif
327 cnh 1.19 C-- Density of K level (below W(K)) reference to K level
328 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
329 cnh 1.19 CALL FIND_RHO(
330     I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
331     O rhoK,
332     I myThid )
333 cnh 1.38 #endif
334 adcroft 1.42 IF ( (.NOT. BOTTOM_LAYER)
335     #ifdef ALLOW_KPP
336     & .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing
337     #endif
338     & ) THEN
339 cnh 1.27 C-- Check static stability with layer below and mix as needed.
340     C-- Density of K+1 level (below W(K+1)) reference to K level.
341 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
342 cnh 1.19 CALL FIND_RHO(
343     I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
344     O rhoKp1,
345     I myThid )
346 cnh 1.38 #endif
347     #ifdef INCLUDE_CONVECT_CALL
348 cnh 1.19 CALL CONVECT(
349     I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,
350     I myTime,myIter,myThid)
351 cnh 1.38 #endif
352 cnh 1.19 C-- Recompute density after mixing
353 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
354 cnh 1.19 CALL FIND_RHO(
355     I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
356     O rhoK,
357     I myThid )
358 cnh 1.38 #endif
359 cnh 1.19 ENDIF
360 cnh 1.26 C-- Calculate buoyancy
361 cnh 1.32 CALL CALC_BUOYANCY(
362 cnh 1.26 I bi,bj,iMin,iMax,jMin,jMax,K,rhoK,
363     O buoyK,
364     I myThid )
365 cnh 1.38 C-- Integrate hydrostatic balance for phiHyd with BC of
366     C-- phiHyd(z=0)=0
367 cnh 1.26 CALL CALC_PHI_HYD(
368 cnh 1.30 I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK,
369     U phiHyd,
370     I myThid )
371 cnh 1.19 C-- Calculate iso-neutral slopes for the GM/Redi parameterisation
372 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
373 cnh 1.19 CALL FIND_RHO(
374 cnh 1.30 I bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType,
375     O rhoTmp,
376     I myThid )
377 cnh 1.38 #endif
378     #ifdef INCLUDE_CALC_ISOSLOPES_CALL
379 cnh 1.19 CALL CALC_ISOSLOPES(
380 cnh 1.30 I bi, bj, iMin, iMax, jMin, jMax, K,
381     I rhoKm1, rhoK, rhotmp,
382     O K13, K23, K33, KapGM,
383     I myThid )
384 cnh 1.38 #endif
385 cnh 1.19 DO J=jMin,jMax
386     DO I=iMin,iMax
387 cnh 1.38 #ifdef INCLUDE_FIND_RHO_CALL
388 cnh 1.27 rhoKm1 (I,J) = rhoK(I,J)
389 cnh 1.38 #endif
390 cnh 1.27 buoyKm1(I,J) = buoyK(I,J)
391 cnh 1.19 ENDDO
392 adcroft 1.10 ENDDO
393 adcroft 1.11 ENDDO ! K
394    
395 adcroft 1.42 #ifdef ALLOW_KPP
396     C-- Compute KPP mixing coefficients
397     IF (usingKPPmixing) THEN
398     CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'
399     I , myThid)
400     CALL KVMIX(
401     I bi, bj, myTime, myThid )
402     CALL TIMER_STOP ('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'
403     I , myThid)
404     ENDIF
405     #endif
406    
407 cnh 1.31 DO K = Nr, 1, -1
408 cnh 1.30
409 cnh 1.1 kM1 =max(1,k-1) ! Points to level above k (=k-1)
410     kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
411     kDown=1+MOD(k,2) ! Cycles through 2,1 to point to current layer
412     iMin = 1-OLx+2
413     iMax = sNx+OLx-1
414     jMin = 1-OLy+2
415     jMax = sNy+OLy-1
416    
417     C-- Get temporary terms used by tendency routines
418     CALL CALC_COMMON_FACTORS (
419     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
420 cnh 1.30 O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
421 cnh 1.1 I myThid)
422 cnh 1.38 #ifdef INCLUDE_CALC_DIFFUSIVITY_CALL
423 adcroft 1.12 C-- Calculate the total vertical diffusivity
424     CALL CALC_DIFFUSIVITY(
425     I bi,bj,iMin,iMax,jMin,jMax,K,
426     I maskC,maskUp,KapGM,K33,
427 adcroft 1.42 O KappaRT,KappaRS,KappaRU,KappaRV,
428 adcroft 1.12 I myThid)
429 cnh 1.38 #endif
430 cnh 1.1 C-- Calculate accelerations in the momentum equations
431 cnh 1.9 IF ( momStepping ) THEN
432     CALL CALC_MOM_RHS(
433     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
434 cnh 1.30 I xA,yA,uTrans,vTrans,rTrans,rVel,maskC,
435 adcroft 1.42 I phiHyd,KappaRU,KappaRV,
436 cnh 1.9 U aTerm,xTerm,cTerm,mTerm,pTerm,
437     U fZon, fMer, fVerU, fVerV,
438 cnh 1.38 I myTime, myThid)
439 cnh 1.9 ENDIF
440 cnh 1.1 C-- Calculate active tracer tendencies
441 cnh 1.9 IF ( tempStepping ) THEN
442     CALL CALC_GT(
443     I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
444 cnh 1.30 I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
445     I K13,K23,KappaRT,KapGM,
446 cnh 1.9 U aTerm,xTerm,fZon,fMer,fVerT,
447 cnh 1.37 I myTime, myThid)
448 cnh 1.9 ENDIF
449 adcroft 1.18 IF ( saltStepping ) THEN
450     CALL CALC_GS(
451     I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
452 cnh 1.30 I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC,
453     I K13,K23,KappaRS,KapGM,
454 adcroft 1.18 U aTerm,xTerm,fZon,fMer,fVerS,
455 cnh 1.37 I myTime, myThid)
456 adcroft 1.18 ENDIF
457 adcroft 1.11 C-- Prediction step (step forward all model variables)
458     CALL TIMESTEP(
459     I bi,bj,iMin,iMax,jMin,jMax,K,
460     I myThid)
461 adcroft 1.41 C-- Apply open boundary conditions
462 adcroft 1.39 IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid )
463 adcroft 1.41 C-- Freeze water
464     IF (allowFreezing)
465     & CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )
466 adcroft 1.11 C-- Diagnose barotropic divergence of predicted fields
467 cnh 1.31 CALL CALC_DIV_GHAT(
468 adcroft 1.11 I bi,bj,iMin,iMax,jMin,jMax,K,
469     I xA,yA,
470     I myThid)
471 adcroft 1.23
472     C-- Cumulative diagnostic calculations (ie. time-averaging)
473 cnh 1.38 #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE
474 adcroft 1.23 IF (taveFreq.GT.0.) THEN
475     CALL DO_TIME_AVERAGES(
476     I myTime, myIter, bi, bj, K, kUp, kDown,
477 cnh 1.30 I K13, K23, rVel, KapGM,
478 adcroft 1.23 I myThid )
479     ENDIF
480     #endif
481 adcroft 1.11
482     ENDDO ! K
483 adcroft 1.12
484     C-- Implicit diffusion
485     IF (implicitDiffusion) THEN
486 adcroft 1.42 IF (tempStepping) CALL IMPLDIFF(
487     I bi, bj, iMin, iMax, jMin, jMax,
488     I deltaTtracer, KappaRT,recip_HFacC,
489     U gTNm1,
490     I myThid )
491     IF (saltStepping) CALL IMPLDIFF(
492     I bi, bj, iMin, iMax, jMin, jMax,
493     I deltaTtracer, KappaRS,recip_HFacC,
494     U gSNm1,
495     I myThid )
496     IF (momStepping) THEN
497     CALL IMPLDIFF(
498     I bi, bj, iMin, iMax, jMin, jMax,
499     I deltaTmom, KappaRU,recip_HFacW,
500     U gUNm1,
501     I myThid )
502     CALL IMPLDIFF(
503     I bi, bj, iMin, iMax, jMin, jMax,
504     I deltaTmom, KappaRV,recip_HFacS,
505     U gVNm1,
506     I myThid )
507     #ifdef INCLUDE_CD_CODE
508     CALL IMPLDIFF(
509     I bi, bj, iMin, iMax, jMin, jMax,
510     I deltaTmom, KappaRU,recip_HFacW,
511     U vVelD,
512     I myThid )
513     CALL IMPLDIFF(
514     I bi, bj, iMin, iMax, jMin, jMax,
515     I deltaTmom, KappaRV,recip_HFacS,
516     U uVelD,
517     I myThid )
518     #endif
519     ENDIF ! momStepping
520     ENDIF ! implicitDiffusion
521 cnh 1.1
522     ENDDO
523     ENDDO
524 adcroft 1.6
525 cnh 1.19 C write(0,*) 'dynamics: pS ',minval(cg2d_x(1:sNx,1:sNy,:,:)),
526     C & maxval(cg2d_x(1:sNx,1:sNy,:,:))
527 cnh 1.20 C write(0,*) 'dynamics: U ',minval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.),
528 adcroft 1.21 C & maxval(uVel(1:sNx,1:sNy,1,:,:),mask=uVel(1:sNx,1:sNy,1,:,:).NE.0.)
529 cnh 1.20 C write(0,*) 'dynamics: V ',minval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(1:sNx,1:sNy,1,:,:).NE.0.),
530 adcroft 1.21 C & maxval(vVel(1:sNx,1:sNy,1,:,:),mask=vVel(1:sNx,1:sNy,1,:,:).NE.0.)
531 cnh 1.30 C write(0,*) 'dynamics: rVel(1) ',
532     C & minval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.),
533     C & maxval(rVel(1:sNx,1:sNy,1),mask=rVel(1:sNx,1:sNy,1).NE.0.)
534     C write(0,*) 'dynamics: rVel(2) ',
535     C & minval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.),
536     C & maxval(rVel(1:sNx,1:sNy,2),mask=rVel(1:sNx,1:sNy,2).NE.0.)
537 adcroft 1.15 cblk write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)),
538     cblk & maxval(K13(1:sNx,1:sNy,:))
539     cblk write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)),
540     cblk & maxval(K23(1:sNx,1:sNy,:))
541     cblk write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)),
542     cblk & maxval(K33(1:sNx,1:sNy,:))
543 cnh 1.19 C write(0,*) 'dynamics: gT ',minval(gT(1:sNx,1:sNy,:,:,:)),
544     C & maxval(gT(1:sNx,1:sNy,:,:,:))
545     C write(0,*) 'dynamics: T ',minval(Theta(1:sNx,1:sNy,:,:,:)),
546     C & maxval(Theta(1:sNx,1:sNy,:,:,:))
547     C write(0,*) 'dynamics: gS ',minval(gS(1:sNx,1:sNy,:,:,:)),
548     C & maxval(gS(1:sNx,1:sNy,:,:,:))
549     C write(0,*) 'dynamics: S ',minval(salt(1:sNx,1:sNy,:,:,:)),
550     C & maxval(salt(1:sNx,1:sNy,:,:,:))
551 cnh 1.31 C write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.),
552     C & maxval(phiHyd/(Gravity*Rhonil))
553 cnh 1.36 C CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' ,
554     C &Nr, 1, myThid )
555     C CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' ,
556     C &Nr, 1, myThid )
557     C CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' ,
558     C &Nr, 1, myThid )
559     C CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' ,
560 cnh 1.38 C &Nr, 1, myThid )
561     C CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' ,
562 cnh 1.36 C &Nr, 1, myThid )
563    
564 cnh 1.1
565     RETURN
566     END

  ViewVC Help
Powered by ViewVC 1.1.22