20 |
C | C*P* comments indicating place holders for which code is | |
C | C*P* comments indicating place holders for which code is | |
21 |
C | presently being developed. | |
C | presently being developed. | |
22 |
C \==========================================================/ |
C \==========================================================/ |
23 |
|
IMPLICIT NONE |
24 |
|
|
25 |
C == Global variables === |
C == Global variables === |
26 |
#include "SIZE.h" |
#include "SIZE.h" |
28 |
#include "CG2D.h" |
#include "CG2D.h" |
29 |
#include "PARAMS.h" |
#include "PARAMS.h" |
30 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
31 |
|
#include "GRID.h" |
32 |
|
#ifdef ALLOW_KPP |
33 |
|
#include "KPPMIX.h" |
34 |
|
#endif |
35 |
|
|
36 |
C == Routine arguments == |
C == Routine arguments == |
37 |
C myTime - Current time in simulation |
C myTime - Current time in simulation |
43 |
|
|
44 |
C == Local variables |
C == Local variables |
45 |
C xA, yA - Per block temporaries holding face areas |
C xA, yA - Per block temporaries holding face areas |
46 |
C uTrans, vTrans, rTrans - Per block temporaries holding flow transport |
C uTrans, vTrans, rTrans - Per block temporaries holding flow |
47 |
|
C transport |
48 |
C rVel o uTrans: Zonal transport |
C rVel o uTrans: Zonal transport |
49 |
C o vTrans: Meridional transport |
C o vTrans: Meridional transport |
50 |
C o rTrans: Vertical transport |
C o rTrans: Vertical transport |
51 |
C o rVel: Vertical velocity at upper and lower |
C o rVel: Vertical velocity at upper and |
52 |
C cell faces. |
C lower cell faces. |
53 |
C maskC,maskUp o maskC: land/water mask for tracer cells |
C maskC,maskUp o maskC: land/water mask for tracer cells |
54 |
C o maskUp: land/water mask for W points |
C o maskUp: land/water mask for W points |
55 |
C aTerm, xTerm, cTerm - Work arrays for holding separate terms in |
C aTerm, xTerm, cTerm - Work arrays for holding separate terms in |
65 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
66 |
C so we need an fVer for each |
C so we need an fVer for each |
67 |
C variable. |
C variable. |
68 |
C rhoK, rhoKM1 - Density at current level, level above and level below. |
C rhoK, rhoKM1 - Density at current level, level above and level |
69 |
|
C below. |
70 |
C rhoKP1 |
C rhoKP1 |
71 |
C buoyK, buoyKM1 - Buoyancy at current level and level above. |
C buoyK, buoyKM1 - Buoyancy at current level and level above. |
72 |
C phiHyd - Hydrostatic part of the potential phiHydi. |
C phiHyd - Hydrostatic part of the potential phiHydi. |
73 |
C In z coords phiHydiHyd is the hydrostatic pressure anomaly |
C In z coords phiHydiHyd is the hydrostatic |
74 |
C In p coords phiHydiHyd is the geopotential surface height |
C pressure anomaly |
75 |
|
C In p coords phiHydiHyd is the geopotential |
76 |
|
C surface height |
77 |
C anomaly. |
C anomaly. |
78 |
C etaSurfX, - Holds surface elevation gradient in X and Y. |
C etaSurfX, - Holds surface elevation gradient in X and Y. |
79 |
C etaSurfY |
C etaSurfY |
81 |
C diffusion tensor. |
C diffusion tensor. |
82 |
C KapGM - Spatially varying Visbeck et. al mixing coeff. |
C KapGM - Spatially varying Visbeck et. al mixing coeff. |
83 |
C KappaRT, - Total diffusion in vertical for T and S. |
C KappaRT, - Total diffusion in vertical for T and S. |
84 |
C KappaRS ( background + spatially varying, isopycnal term). |
C KappaRS (background + spatially varying, isopycnal term). |
85 |
C iMin, iMax - Ranges and sub-block indices on which calculations |
C iMin, iMax - Ranges and sub-block indices on which calculations |
86 |
C jMin, jMax are applied. |
C jMin, jMax are applied. |
87 |
C bi, bj |
C bi, bj |
88 |
C k, kUp, - Index for layer above and below. kUp and kDown |
C k, kUp, - Index for layer above and below. kUp and kDown |
89 |
C kDown, kM1 are switched with layer to be the appropriate index |
C kDown, kM1 are switched with layer to be the appropriate |
90 |
C into fVerTerm |
C index into fVerTerm. |
91 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
92 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
122 |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
123 |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRT (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
124 |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRS (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
125 |
|
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
126 |
|
_RL KappaRV (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
127 |
|
|
128 |
|
#ifdef INCLUDE_CONVECT_CALL |
129 |
|
_RL ConvectCount (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
130 |
|
#endif |
131 |
|
|
132 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
133 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
204 |
K13(i,j,k) = 0. _d 0 |
K13(i,j,k) = 0. _d 0 |
205 |
K23(i,j,k) = 0. _d 0 |
K23(i,j,k) = 0. _d 0 |
206 |
K33(i,j,k) = 0. _d 0 |
K33(i,j,k) = 0. _d 0 |
207 |
KappaRT(i,j,k) = 0. _d 0 |
KappaRU(i,j,k) = 0. _d 0 |
208 |
KappaRS(i,j,k) = 0. _d 0 |
KappaRV(i,j,k) = 0. _d 0 |
209 |
ENDDO |
ENDDO |
210 |
rhoKM1 (i,j) = 0. _d 0 |
rhoKM1 (i,j) = 0. _d 0 |
211 |
rhok (i,j) = 0. _d 0 |
rhok (i,j) = 0. _d 0 |
217 |
ENDDO |
ENDDO |
218 |
ENDDO |
ENDDO |
219 |
|
|
220 |
|
|
221 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
222 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
223 |
|
|
243 |
ENDDO |
ENDDO |
244 |
ENDDO |
ENDDO |
245 |
|
|
246 |
|
DO k=1,Nr |
247 |
|
DO j=1-OLy,sNy+OLy |
248 |
|
DO i=1-OLx,sNx+OLx |
249 |
|
#ifdef INCLUDE_CONVECT_CALL |
250 |
|
ConvectCount(i,j,k) = 0. |
251 |
|
#endif |
252 |
|
KappaRT(i,j,k) = 0. _d 0 |
253 |
|
KappaRS(i,j,k) = 0. _d 0 |
254 |
|
ENDDO |
255 |
|
ENDDO |
256 |
|
ENDDO |
257 |
|
|
258 |
iMin = 1-OLx+1 |
iMin = 1-OLx+1 |
259 |
iMax = sNx+OLx |
iMax = sNx+OLx |
260 |
jMin = 1-OLy+1 |
jMin = 1-OLy+1 |
261 |
jMax = sNy+OLy |
jMax = sNy+OLy |
262 |
|
|
263 |
|
|
264 |
K = 1 |
K = 1 |
265 |
BOTTOM_LAYER = K .EQ. Nr |
BOTTOM_LAYER = K .EQ. Nr |
266 |
|
|
267 |
|
#ifdef DO_PIPELINED_CORRECTION_STEP |
268 |
C-- Calculate gradient of surface pressure |
C-- Calculate gradient of surface pressure |
269 |
CALL CALC_GRAD_ETA_SURF( |
CALL CALC_GRAD_ETA_SURF( |
270 |
I bi,bj,iMin,iMax,jMin,jMax, |
I bi,bj,iMin,iMax,jMin,jMax, |
274 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
275 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
276 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
277 |
|
#ifdef ALLOW_OBCS |
278 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid ) |
279 |
|
#endif |
280 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( .NOT. BOTTOM_LAYER ) THEN |
281 |
C-- Update fields in layer below according to tendency terms |
C-- Update fields in layer below according to tendency terms |
282 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
283 |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
284 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
285 |
|
#ifdef ALLOW_OBCS |
286 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid ) |
287 |
|
#endif |
288 |
ENDIF |
ENDIF |
289 |
|
#endif |
290 |
C-- Density of 1st level (below W(1)) reference to level 1 |
C-- Density of 1st level (below W(1)) reference to level 1 |
291 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
292 |
CALL FIND_RHO( |
CALL FIND_RHO( |
293 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
294 |
O rhoKm1, |
O rhoKm1, |
295 |
I myThid ) |
I myThid ) |
296 |
|
#endif |
297 |
|
|
298 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( (.NOT. BOTTOM_LAYER) |
299 |
|
#ifdef ALLOW_KPP |
300 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
301 |
|
#endif |
302 |
|
& ) THEN |
303 |
C-- Check static stability with layer below |
C-- Check static stability with layer below |
304 |
C-- and mix as needed. |
C-- and mix as needed. |
305 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
306 |
CALL FIND_RHO( |
CALL FIND_RHO( |
307 |
I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType, |
308 |
O rhoKp1, |
O rhoKp1, |
309 |
I myThid ) |
I myThid ) |
310 |
|
#endif |
311 |
|
#ifdef INCLUDE_CONVECT_CALL |
312 |
CALL CONVECT( |
CALL CONVECT( |
313 |
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1, |
314 |
|
U ConvectCount, |
315 |
|
I myTime,myIter,myThid) |
316 |
|
#endif |
317 |
|
C-- Implicit Vertical Diffusion for Convection |
318 |
|
IF (ivdc_kappa.NE.0.) CALL CALC_IVDC( |
319 |
|
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1, |
320 |
|
U ConvectCount, KappaRT, KappaRS, |
321 |
I myTime,myIter,myThid) |
I myTime,myIter,myThid) |
322 |
C-- Recompute density after mixing |
C-- Recompute density after mixing |
323 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
324 |
CALL FIND_RHO( |
CALL FIND_RHO( |
325 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
326 |
O rhoKm1, |
O rhoKm1, |
327 |
I myThid ) |
I myThid ) |
328 |
|
#endif |
329 |
ENDIF |
ENDIF |
330 |
C-- Calculate buoyancy |
C-- Calculate buoyancy |
331 |
CALL CALC_BUOYANCY( |
CALL CALC_BUOYANCY( |
332 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1, |
333 |
O buoyKm1, |
O buoyKm1, |
334 |
I myThid ) |
I myThid ) |
335 |
C-- Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0 |
C-- Integrate hydrostatic balance for phiHyd with BC of |
336 |
|
C-- phiHyd(z=0)=0 |
337 |
CALL CALC_PHI_HYD( |
CALL CALC_PHI_HYD( |
338 |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1, |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1, |
339 |
U phiHyd, |
U phiHyd, |
341 |
|
|
342 |
DO K=2,Nr |
DO K=2,Nr |
343 |
BOTTOM_LAYER = K .EQ. Nr |
BOTTOM_LAYER = K .EQ. Nr |
344 |
|
#ifdef DO_PIPELINED_CORRECTION_STEP |
345 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( .NOT. BOTTOM_LAYER ) THEN |
346 |
C-- Update fields in layer below according to tendency terms |
C-- Update fields in layer below according to tendency terms |
347 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
348 |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1, |
349 |
I etaSurfX,etaSurfY,myTime,myThid) |
I etaSurfX,etaSurfY,myTime,myThid) |
350 |
|
#ifdef ALLOW_OBCS |
351 |
|
IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid ) |
352 |
|
#endif |
353 |
ENDIF |
ENDIF |
354 |
|
#endif |
355 |
C-- Density of K level (below W(K)) reference to K level |
C-- Density of K level (below W(K)) reference to K level |
356 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
357 |
CALL FIND_RHO( |
CALL FIND_RHO( |
358 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
359 |
O rhoK, |
O rhoK, |
360 |
I myThid ) |
I myThid ) |
361 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
#endif |
362 |
|
IF ( (.NOT. BOTTOM_LAYER) |
363 |
|
#ifdef ALLOW_KPP |
364 |
|
& .AND. (.NOT.usingKPPmixing) ! CONVECT not needed with KPP mixing |
365 |
|
#endif |
366 |
|
& ) THEN |
367 |
C-- Check static stability with layer below and mix as needed. |
C-- Check static stability with layer below and mix as needed. |
368 |
C-- Density of K+1 level (below W(K+1)) reference to K level. |
C-- Density of K+1 level (below W(K+1)) reference to K level. |
369 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
370 |
CALL FIND_RHO( |
CALL FIND_RHO( |
371 |
I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType, |
372 |
O rhoKp1, |
O rhoKp1, |
373 |
I myThid ) |
I myThid ) |
374 |
|
#endif |
375 |
|
#ifdef INCLUDE_CONVECT_CALL |
376 |
CALL CONVECT( |
CALL CONVECT( |
377 |
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1, |
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1, |
378 |
|
U ConvectCount, |
379 |
I myTime,myIter,myThid) |
I myTime,myIter,myThid) |
380 |
|
#endif |
381 |
|
C-- Implicit Vertical Diffusion for Convection |
382 |
|
IF (ivdc_kappa.NE.0.) CALL CALC_IVDC( |
383 |
|
I bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1, |
384 |
|
U ConvectCount, KappaRT, KappaRS, |
385 |
|
I myTime,myIter,myThid) |
386 |
C-- Recompute density after mixing |
C-- Recompute density after mixing |
387 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
388 |
CALL FIND_RHO( |
CALL FIND_RHO( |
389 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
390 |
O rhoK, |
O rhoK, |
391 |
I myThid ) |
I myThid ) |
392 |
|
#endif |
393 |
ENDIF |
ENDIF |
394 |
C-- Calculate buoyancy |
C-- Calculate buoyancy |
395 |
CALL CALC_BUOYANCY( |
CALL CALC_BUOYANCY( |
396 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoK, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoK, |
397 |
O buoyK, |
O buoyK, |
398 |
I myThid ) |
I myThid ) |
399 |
C-- Integrate hydrostatic balance for phiHyd with BC of phiHyd(z=0)=0 |
C-- Integrate hydrostatic balance for phiHyd with BC of |
400 |
|
C-- phiHyd(z=0)=0 |
401 |
CALL CALC_PHI_HYD( |
CALL CALC_PHI_HYD( |
402 |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK, |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK, |
403 |
U phiHyd, |
U phiHyd, |
404 |
I myThid ) |
I myThid ) |
405 |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
406 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
407 |
CALL FIND_RHO( |
CALL FIND_RHO( |
408 |
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K-1, K, eosType, |
409 |
O rhoTmp, |
O rhoTmp, |
410 |
I myThid ) |
I myThid ) |
411 |
|
#endif |
412 |
|
#ifdef INCLUDE_CALC_ISOSLOPES_CALL |
413 |
CALL CALC_ISOSLOPES( |
CALL CALC_ISOSLOPES( |
414 |
I bi, bj, iMin, iMax, jMin, jMax, K, |
I bi, bj, iMin, iMax, jMin, jMax, K, |
415 |
I rhoKm1, rhoK, rhotmp, |
I rhoKm1, rhoK, rhotmp, |
416 |
O K13, K23, K33, KapGM, |
O K13, K23, K33, KapGM, |
417 |
I myThid ) |
I myThid ) |
418 |
|
#endif |
419 |
DO J=jMin,jMax |
DO J=jMin,jMax |
420 |
DO I=iMin,iMax |
DO I=iMin,iMax |
421 |
|
#ifdef INCLUDE_FIND_RHO_CALL |
422 |
rhoKm1 (I,J) = rhoK(I,J) |
rhoKm1 (I,J) = rhoK(I,J) |
423 |
|
#endif |
424 |
buoyKm1(I,J) = buoyK(I,J) |
buoyKm1(I,J) = buoyK(I,J) |
425 |
ENDDO |
ENDDO |
426 |
ENDDO |
ENDDO |
427 |
ENDDO ! K |
ENDDO ! K |
428 |
|
|
429 |
|
#ifdef ALLOW_KPP |
430 |
|
C-- Compute KPP mixing coefficients |
431 |
|
IF (usingKPPmixing) THEN |
432 |
|
CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
433 |
|
I , myThid) |
434 |
|
CALL KVMIX( |
435 |
|
I bi, bj, myTime, myThid ) |
436 |
|
CALL TIMER_STOP ('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]' |
437 |
|
I , myThid) |
438 |
|
ENDIF |
439 |
|
#endif |
440 |
|
|
441 |
DO K = Nr, 1, -1 |
DO K = Nr, 1, -1 |
442 |
|
|
443 |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
kM1 =max(1,k-1) ! Points to level above k (=k-1) |
453 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
454 |
O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp, |
O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp, |
455 |
I myThid) |
I myThid) |
456 |
|
#ifdef INCLUDE_CALC_DIFFUSIVITY_CALL |
457 |
C-- Calculate the total vertical diffusivity |
C-- Calculate the total vertical diffusivity |
458 |
CALL CALC_DIFFUSIVITY( |
CALL CALC_DIFFUSIVITY( |
459 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
460 |
I maskC,maskUp,KapGM,K33, |
I maskC,maskUp,KapGM,K33, |
461 |
O KappaRT,KappaRS, |
O KappaRT,KappaRS,KappaRU,KappaRV, |
462 |
I myThid) |
I myThid) |
463 |
|
#endif |
464 |
C-- Calculate accelerations in the momentum equations |
C-- Calculate accelerations in the momentum equations |
465 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
466 |
CALL CALC_MOM_RHS( |
CALL CALC_MOM_RHS( |
467 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
468 |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
I xA,yA,uTrans,vTrans,rTrans,rVel,maskC, |
469 |
I phiHyd, |
I phiHyd,KappaRU,KappaRV, |
470 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
471 |
U fZon, fMer, fVerU, fVerV, |
U fZon, fMer, fVerU, fVerV, |
472 |
I myThid) |
I myTime, myThid) |
473 |
ENDIF |
ENDIF |
474 |
C-- Calculate active tracer tendencies |
C-- Calculate active tracer tendencies |
475 |
IF ( tempStepping ) THEN |
IF ( tempStepping ) THEN |
478 |
I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC, |
I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC, |
479 |
I K13,K23,KappaRT,KapGM, |
I K13,K23,KappaRT,KapGM, |
480 |
U aTerm,xTerm,fZon,fMer,fVerT, |
U aTerm,xTerm,fZon,fMer,fVerT, |
481 |
I myThid) |
I myTime, myThid) |
482 |
ENDIF |
ENDIF |
483 |
IF ( saltStepping ) THEN |
IF ( saltStepping ) THEN |
484 |
CALL CALC_GS( |
CALL CALC_GS( |
486 |
I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC, |
I xA,yA,uTrans,vTrans,rTrans,maskUp,maskC, |
487 |
I K13,K23,KappaRS,KapGM, |
I K13,K23,KappaRS,KapGM, |
488 |
U aTerm,xTerm,fZon,fMer,fVerS, |
U aTerm,xTerm,fZon,fMer,fVerS, |
489 |
I myThid) |
I myTime, myThid) |
490 |
ENDIF |
ENDIF |
491 |
C-- Prediction step (step forward all model variables) |
C-- Prediction step (step forward all model variables) |
492 |
CALL TIMESTEP( |
CALL TIMESTEP( |
493 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
494 |
I myThid) |
I myIter, myThid) |
495 |
|
#ifdef ALLOW_OBCS |
496 |
|
C-- Apply open boundary conditions |
497 |
|
IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid ) |
498 |
|
#endif |
499 |
|
C-- Freeze water |
500 |
|
IF (allowFreezing) |
501 |
|
& CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid ) |
502 |
C-- Diagnose barotropic divergence of predicted fields |
C-- Diagnose barotropic divergence of predicted fields |
503 |
CALL CALC_DIV_GHAT( |
CALL CALC_DIV_GHAT( |
504 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
I bi,bj,iMin,iMax,jMin,jMax,K, |
506 |
I myThid) |
I myThid) |
507 |
|
|
508 |
C-- Cumulative diagnostic calculations (ie. time-averaging) |
C-- Cumulative diagnostic calculations (ie. time-averaging) |
509 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
510 |
IF (taveFreq.GT.0.) THEN |
IF (taveFreq.GT.0.) THEN |
511 |
CALL DO_TIME_AVERAGES( |
CALL DO_TIME_AVERAGES( |
512 |
I myTime, myIter, bi, bj, K, kUp, kDown, |
I myTime, myIter, bi, bj, K, kUp, kDown, |
513 |
I K13, K23, rVel, KapGM, |
I K13, K23, rVel, KapGM, ConvectCount, |
514 |
I myThid ) |
I myThid ) |
515 |
ENDIF |
ENDIF |
516 |
#endif |
#endif |
517 |
|
|
518 |
|
|
519 |
ENDDO ! K |
ENDDO ! K |
520 |
|
|
521 |
C-- Implicit diffusion |
C-- Implicit diffusion |
522 |
IF (implicitDiffusion) THEN |
IF (implicitDiffusion) THEN |
523 |
CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax, |
IF (tempStepping) CALL IMPLDIFF( |
524 |
I KappaRT,KappaRS, |
I bi, bj, iMin, iMax, jMin, jMax, |
525 |
I myThid ) |
I deltaTtracer, KappaRT,recip_HFacC, |
526 |
ENDIF |
U gTNm1, |
527 |
|
I myThid ) |
528 |
|
IF (saltStepping) CALL IMPLDIFF( |
529 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
530 |
|
I deltaTtracer, KappaRS,recip_HFacC, |
531 |
|
U gSNm1, |
532 |
|
I myThid ) |
533 |
|
ENDIF ! implicitDiffusion |
534 |
|
C-- Implicit viscosity |
535 |
|
IF (implicitViscosity) THEN |
536 |
|
IF (momStepping) THEN |
537 |
|
CALL IMPLDIFF( |
538 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
539 |
|
I deltaTmom, KappaRU,recip_HFacW, |
540 |
|
U gUNm1, |
541 |
|
I myThid ) |
542 |
|
CALL IMPLDIFF( |
543 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
544 |
|
I deltaTmom, KappaRV,recip_HFacS, |
545 |
|
U gVNm1, |
546 |
|
I myThid ) |
547 |
|
#ifdef INCLUDE_CD_CODE |
548 |
|
CALL IMPLDIFF( |
549 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
550 |
|
I deltaTmom, KappaRU,recip_HFacW, |
551 |
|
U vVelD, |
552 |
|
I myThid ) |
553 |
|
CALL IMPLDIFF( |
554 |
|
I bi, bj, iMin, iMax, jMin, jMax, |
555 |
|
I deltaTmom, KappaRV,recip_HFacS, |
556 |
|
U uVelD, |
557 |
|
I myThid ) |
558 |
|
#endif |
559 |
|
ENDIF ! momStepping |
560 |
|
ENDIF ! implicitViscosity |
561 |
|
|
562 |
ENDDO |
ENDDO |
563 |
ENDDO |
ENDDO |
590 |
C & maxval(salt(1:sNx,1:sNy,:,:,:)) |
C & maxval(salt(1:sNx,1:sNy,:,:,:)) |
591 |
C write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.), |
C write(0,*) 'dynamics: phiHyd ',minval(phiHyd/(Gravity*Rhonil),mask=phiHyd.NE.0.), |
592 |
C & maxval(phiHyd/(Gravity*Rhonil)) |
C & maxval(phiHyd/(Gravity*Rhonil)) |
593 |
|
C CALL PLOT_FIELD_XYZRL( gU, ' GU exiting dyanmics ' , |
594 |
|
C &Nr, 1, myThid ) |
595 |
|
C CALL PLOT_FIELD_XYZRL( gV, ' GV exiting dyanmics ' , |
596 |
|
C &Nr, 1, myThid ) |
597 |
|
C CALL PLOT_FIELD_XYZRL( gS, ' GS exiting dyanmics ' , |
598 |
|
C &Nr, 1, myThid ) |
599 |
|
C CALL PLOT_FIELD_XYZRL( gT, ' GT exiting dyanmics ' , |
600 |
|
C &Nr, 1, myThid ) |
601 |
|
C CALL PLOT_FIELD_XYZRL( phiHyd, ' phiHyd exiting dyanmics ' , |
602 |
|
C &Nr, 1, myThid ) |
603 |
|
|
604 |
|
|
605 |
RETURN |
RETURN |
606 |
END |
END |