1 |
C $Header$ |
C $Header$ |
2 |
|
|
3 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_OPTIONS.h" |
4 |
|
|
5 |
SUBROUTINE DYNAMICS(myTime, myIter, myThid) |
SUBROUTINE DYNAMICS(myTime, myIter, myThid) |
6 |
C /==========================================================\ |
C /==========================================================\ |
59 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
60 |
C so we need an fVer for each |
C so we need an fVer for each |
61 |
C variable. |
C variable. |
62 |
|
C rhoK, rhoKM1 - Density at current level, level above and level below. |
63 |
|
C rhoKP1 |
64 |
|
C buoyK, buoyKM1 - Buoyancy at current level and level above. |
65 |
|
C phiHyd - Hydrostatic part of the potential phi. |
66 |
|
C In z coords phiHyd is the hydrostatic pressure anomaly |
67 |
|
C In p coords phiHyd is the geopotential surface height anomaly. |
68 |
C iMin, iMax - Ranges and sub-block indices on which calculations |
C iMin, iMax - Ranges and sub-block indices on which calculations |
69 |
C jMin, jMax are applied. |
C jMin, jMax are applied. |
70 |
C bi, bj |
C bi, bj |
90 |
_RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
91 |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
92 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
93 |
_RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL phiHyd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
94 |
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
95 |
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
96 |
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
97 |
|
_RL buoyKM1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
98 |
|
_RL buoyK (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
99 |
_RL rhotmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rhotmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
100 |
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
101 |
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
186 |
rhok (i,j) = 0. _d 0 |
rhok (i,j) = 0. _d 0 |
187 |
rhokp1(i,j) = 0. _d 0 |
rhokp1(i,j) = 0. _d 0 |
188 |
rhotmp(i,j) = 0. _d 0 |
rhotmp(i,j) = 0. _d 0 |
189 |
|
buoyKM1(i,j) = 0. _d 0 |
190 |
|
buoyK (i,j) = 0. _d 0 |
191 |
maskC (i,j) = 0. _d 0 |
maskC (i,j) = 0. _d 0 |
192 |
ENDDO |
ENDDO |
193 |
ENDDO |
ENDDO |
213 |
K13(i,j,1) = 0. _d 0 |
K13(i,j,1) = 0. _d 0 |
214 |
K23(i,j,1) = 0. _d 0 |
K23(i,j,1) = 0. _d 0 |
215 |
K33(i,j,1) = 0. _d 0 |
K33(i,j,1) = 0. _d 0 |
216 |
KapGM(i,j) = 0. _d 0 |
KapGM(i,j) = GMkbackground |
217 |
ENDDO |
ENDDO |
218 |
ENDDO |
ENDDO |
219 |
|
|
240 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
241 |
I bi,bj,iMin,iMax,jMin,jMax,K+1,pSurfX,pSurfY,myTime,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K+1,pSurfX,pSurfY,myTime,myThid) |
242 |
ENDIF |
ENDIF |
|
|
|
243 |
C-- Density of 1st level (below W(1)) reference to level 1 |
C-- Density of 1st level (below W(1)) reference to level 1 |
244 |
CALL FIND_RHO( |
CALL FIND_RHO( |
245 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
247 |
I myThid ) |
I myThid ) |
248 |
|
|
249 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( .NOT. BOTTOM_LAYER ) THEN |
250 |
|
|
251 |
C-- Check static stability with layer below |
C-- Check static stability with layer below |
252 |
C and mix as needed. |
C and mix as needed. |
253 |
CALL FIND_RHO( |
CALL FIND_RHO( |
264 |
I myThid ) |
I myThid ) |
265 |
ENDIF |
ENDIF |
266 |
|
|
267 |
|
C-- Calculate buoyancy |
268 |
|
CALL CALC_BUOY( |
269 |
|
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1, |
270 |
|
O buoyKm1, |
271 |
|
I myThid ) |
272 |
|
|
273 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
274 |
CALL CALC_PH( |
CALL CALC_PHI_HYD( |
275 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKm1, |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyKm1, |
276 |
U pH, |
U phiHyd, |
277 |
I myThid ) |
I myThid ) |
278 |
|
|
279 |
DO K=2,Nz |
DO K=2,Nz |
280 |
|
|
281 |
BOTTOM_LAYER = K .EQ. Nz |
BOTTOM_LAYER = K .EQ. Nz |
|
|
|
282 |
IF ( .NOT. BOTTOM_LAYER ) THEN |
IF ( .NOT. BOTTOM_LAYER ) THEN |
283 |
C-- Update fields in layer below according to tendency terms |
C-- Update fields in layer below according to tendency terms |
284 |
CALL CORRECTION_STEP( |
CALL CORRECTION_STEP( |
285 |
I bi,bj,iMin,iMax,jMin,jMax,K+1,pSurfX,pSurfY,myTime,myThid) |
I bi,bj,iMin,iMax,jMin,jMax,K+1,pSurfX,pSurfY,myTime,myThid) |
286 |
ENDIF |
ENDIF |
|
C-- Update fields in layer below according to tendency terms |
|
|
C CALL CORRECTION_STEP( |
|
|
C I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myTime,myThid) |
|
|
|
|
287 |
C-- Density of K level (below W(K)) reference to K level |
C-- Density of K level (below W(K)) reference to K level |
288 |
CALL FIND_RHO( |
CALL FIND_RHO( |
289 |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
I bi, bj, iMin, iMax, jMin, jMax, K, K, eosType, |
306 |
O rhoK, |
O rhoK, |
307 |
I myThid ) |
I myThid ) |
308 |
ENDIF |
ENDIF |
309 |
|
|
310 |
|
C-- Calculate buoyancy |
311 |
|
CALL CALC_BUOY( |
312 |
|
I bi,bj,iMin,iMax,jMin,jMax,K,rhoK, |
313 |
|
O buoyK, |
314 |
|
I myThid ) |
315 |
|
|
316 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0 |
317 |
CALL CALC_PH( |
CALL CALC_PHI_HYD( |
318 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoK, |
I bi,bj,iMin,iMax,jMin,jMax,K,buoyKm1,buoyK, |
319 |
U pH, |
U phiHyd, |
320 |
I myThid ) |
I myThid ) |
321 |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
C-- Calculate iso-neutral slopes for the GM/Redi parameterisation |
322 |
CALL FIND_RHO( |
CALL FIND_RHO( |
330 |
I myThid ) |
I myThid ) |
331 |
DO J=jMin,jMax |
DO J=jMin,jMax |
332 |
DO I=iMin,iMax |
DO I=iMin,iMax |
333 |
rhoKm1(I,J)=rhoK(I,J) |
rhoKm1(I,J) =rhoK(I,J) |
334 |
|
buoyKm1(I,J)=buoyK(I,J) |
335 |
ENDDO |
ENDDO |
336 |
ENDDO |
ENDDO |
337 |
|
|
364 |
CALL CALC_MOM_RHS( |
CALL CALC_MOM_RHS( |
365 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
366 |
I xA,yA,uTrans,vTrans,wTrans,wVel,maskC, |
I xA,yA,uTrans,vTrans,wTrans,wVel,maskC, |
367 |
I pH, |
I phiHyd, |
368 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
369 |
U fZon, fMer, fVerU, fVerV, |
U fZon, fMer, fVerU, fVerV, |
370 |
I myThid) |
I myThid) |
399 |
I xA,yA, |
I xA,yA, |
400 |
I myThid) |
I myThid) |
401 |
|
|
402 |
|
C-- Cumulative diagnostic calculations (ie. time-averaging) |
403 |
|
#ifdef ALLOW_DIAGNOSTICS |
404 |
|
IF (taveFreq.GT.0.) THEN |
405 |
|
CALL DO_TIME_AVERAGES( |
406 |
|
I myTime, myIter, bi, bj, K, kUp, kDown, |
407 |
|
I K13, K23, wVel, KapGM, |
408 |
|
I myThid ) |
409 |
|
ENDIF |
410 |
|
#endif |
411 |
|
|
412 |
ENDDO ! K |
ENDDO ! K |
413 |
|
|
414 |
C-- Implicit diffusion |
C-- Implicit diffusion |