85 |
# include "KPP.h" |
# include "KPP.h" |
86 |
# endif |
# endif |
87 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
|
#ifdef ALLOW_TIMEAVE |
|
|
#include "TIMEAVE_STATV.h" |
|
|
#endif |
|
88 |
|
|
89 |
C !CALLING SEQUENCE: |
C !CALLING SEQUENCE: |
90 |
C DYNAMICS() |
C DYNAMICS() |
95 |
C | |
C | |
96 |
C |-- CALC_PHI_HYD |
C |-- CALC_PHI_HYD |
97 |
C | |
C | |
|
C |-- STORE_PRESSURE |
|
|
C | |
|
98 |
C |-- MOM_FLUXFORM |
C |-- MOM_FLUXFORM |
99 |
C | |
C | |
100 |
C |-- MOM_VECINV |
C |-- MOM_VECINV |
125 |
C is "pipelined" in the vertical |
C is "pipelined" in the vertical |
126 |
C so we need an fVer for each |
C so we need an fVer for each |
127 |
C variable. |
C variable. |
128 |
C rhoK, rhoKM1 - Density at current level, and level above |
C phiHydC :: hydrostatic potential anomaly at cell center |
129 |
C phiHyd - Hydrostatic part of the potential phiHydi. |
C In z coords phiHyd is the hydrostatic potential |
130 |
C In z coords phiHydiHyd is the hydrostatic |
C (=pressure/rho0) anomaly |
131 |
C Potential (=pressure/rho0) anomaly |
C In p coords phiHyd is the geopotential height anomaly. |
132 |
C In p coords phiHydiHyd is the geopotential |
C phiHydF :: hydrostatic potential anomaly at middle between 2 centers |
133 |
C surface height anomaly. |
C dPhiHydX,Y :: Gradient (X & Y directions) of hydrostatic potential anom. |
134 |
C phiSurfX, - gradient of Surface potentiel (Pressure/rho, ocean) |
C phiSurfX, :: gradient of Surface potential (Pressure/rho, ocean) |
135 |
C phiSurfY or geopotentiel (atmos) in X and Y direction |
C phiSurfY or geopotential (atmos) in X and Y direction |
136 |
C iMin, iMax - Ranges and sub-block indices on which calculations |
C iMin, iMax - Ranges and sub-block indices on which calculations |
137 |
C jMin, jMax are applied. |
C jMin, jMax are applied. |
138 |
C bi, bj |
C bi, bj |
141 |
C index into fVerTerm. |
C index into fVerTerm. |
142 |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
143 |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
144 |
_RL phiHyd (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL phiHydF (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
145 |
_RL rhokm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL phiHydC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
146 |
_RL rhok (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dPhiHydX(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
147 |
|
_RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
148 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
149 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
150 |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
_RL KappaRU (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
156 |
INTEGER i, j |
INTEGER i, j |
157 |
INTEGER k, km1, kp1, kup, kDown |
INTEGER k, km1, kp1, kup, kDown |
158 |
|
|
159 |
Cjmc : add for phiHyd output <- but not working if multi tile per CPU |
LOGICAL DIFFERENT_MULTIPLE |
160 |
c CHARACTER*(MAX_LEN_MBUF) suff |
EXTERNAL DIFFERENT_MULTIPLE |
|
c LOGICAL DIFFERENT_MULTIPLE |
|
|
c EXTERNAL DIFFERENT_MULTIPLE |
|
|
Cjmc(end) |
|
161 |
|
|
162 |
C--- The algorithm... |
C--- The algorithm... |
163 |
C |
C |
211 |
C uninitialised but inert locations. |
C uninitialised but inert locations. |
212 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
213 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
|
rhoKM1 (i,j) = 0. _d 0 |
|
|
rhok (i,j) = 0. _d 0 |
|
214 |
phiSurfX(i,j) = 0. _d 0 |
phiSurfX(i,j) = 0. _d 0 |
215 |
phiSurfY(i,j) = 0. _d 0 |
phiSurfY(i,j) = 0. _d 0 |
216 |
ENDDO |
ENDDO |
233 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
234 |
C-- HPF directive to help TAMC |
C-- HPF directive to help TAMC |
235 |
CHPF$ INDEPENDENT, NEW (fVerU,fVerV |
CHPF$ INDEPENDENT, NEW (fVerU,fVerV |
236 |
CHPF$& ,phiHyd |
CHPF$& ,phiHydF |
237 |
CHPF$& ,KappaRU,KappaRV |
CHPF$& ,KappaRU,KappaRV |
238 |
CHPF$& ) |
CHPF$& ) |
239 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
254 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
255 |
|
|
256 |
C-- Set up work arrays that need valid initial values |
C-- Set up work arrays that need valid initial values |
257 |
DO j=1-OLy,sNy+OLy |
DO k=1,Nr |
258 |
DO i=1-OLx,sNx+OLx |
DO j=1-OLy,sNy+OLy |
259 |
DO k=1,Nr |
DO i=1-OLx,sNx+OLx |
|
phiHyd(i,j,k) = 0. _d 0 |
|
260 |
KappaRU(i,j,k) = 0. _d 0 |
KappaRU(i,j,k) = 0. _d 0 |
261 |
KappaRV(i,j,k) = 0. _d 0 |
KappaRV(i,j,k) = 0. _d 0 |
262 |
ENDDO |
ENDDO |
263 |
|
ENDDO |
264 |
|
ENDDO |
265 |
|
DO j=1-OLy,sNy+OLy |
266 |
|
DO i=1-OLx,sNx+OLx |
267 |
fVerU (i,j,1) = 0. _d 0 |
fVerU (i,j,1) = 0. _d 0 |
268 |
fVerU (i,j,2) = 0. _d 0 |
fVerU (i,j,2) = 0. _d 0 |
269 |
fVerV (i,j,1) = 0. _d 0 |
fVerV (i,j,1) = 0. _d 0 |
270 |
fVerV (i,j,2) = 0. _d 0 |
fVerV (i,j,2) = 0. _d 0 |
271 |
|
phiHydF (i,j) = 0. _d 0 |
272 |
|
phiHydC (i,j) = 0. _d 0 |
273 |
|
dPhiHydX(i,j) = 0. _d 0 |
274 |
|
dPhiHydY(i,j) = 0. _d 0 |
275 |
ENDDO |
ENDDO |
276 |
ENDDO |
ENDDO |
277 |
|
|
278 |
C-- Start computation of dynamics |
C-- Start computation of dynamics |
279 |
iMin = 1-OLx+2 |
iMin = 0 |
280 |
iMax = sNx+OLx-1 |
iMax = sNx+1 |
281 |
jMin = 1-OLy+2 |
jMin = 0 |
282 |
jMax = sNy+OLy-1 |
jMax = sNy+1 |
283 |
|
|
284 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
285 |
CADJ STORE wvel (:,:,:,bi,bj) = |
CADJ STORE wvel (:,:,:,bi,bj) = |
340 |
CALL CALC_PHI_HYD( |
CALL CALC_PHI_HYD( |
341 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
342 |
I gT, gS, |
I gT, gS, |
343 |
U phiHyd, |
U phiHydF, |
344 |
I myThid ) |
O phiHydC, dPhiHydX, dPhiHydY, |
345 |
|
I myTime, myIter, myThid ) |
346 |
ELSE |
ELSE |
347 |
CALL CALC_PHI_HYD( |
CALL CALC_PHI_HYD( |
348 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
349 |
I theta, salt, |
I theta, salt, |
350 |
U phiHyd, |
U phiHydF, |
351 |
I myThid ) |
O phiHydC, dPhiHydX, dPhiHydY, |
352 |
|
I myTime, myIter, myThid ) |
353 |
ENDIF |
ENDIF |
354 |
|
|
|
C calculate pressure from phiHyd and store it on common block |
|
|
C variable pressure |
|
|
CALL STORE_PRESSURE( bi, bj, k, phiHyd, myThid ) |
|
|
|
|
355 |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
356 |
C and step forward storing the result in gUnm1, gVnm1, etc... |
C and step forward storing the result in gUnm1, gVnm1, etc... |
357 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
358 |
#ifndef DISABLE_MOM_FLUXFORM |
#ifndef DISABLE_MOM_FLUXFORM |
359 |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
360 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
361 |
I phiHyd,KappaRU,KappaRV, |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
362 |
U fVerU, fVerV, |
U fVerU, fVerV, |
363 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
364 |
#endif |
#endif |
365 |
#ifndef DISABLE_MOM_VECINV |
#ifndef DISABLE_MOM_VECINV |
366 |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
IF (vectorInvariantMomentum) CALL MOM_VECINV( |
367 |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kup,kDown, |
368 |
I phiHyd,KappaRU,KappaRV, |
I dPhiHydX,dPhiHydY,KappaRU,KappaRV, |
369 |
U fVerU, fVerV, |
U fVerU, fVerV, |
370 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
371 |
#endif |
#endif |
372 |
CALL TIMESTEP( |
CALL TIMESTEP( |
373 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
374 |
I phiHyd, phiSurfX, phiSurfY, |
I dPhiHydX,dPhiHydY, phiSurfX, phiSurfY, |
375 |
I myIter, myThid) |
I myIter, myThid) |
376 |
|
|
377 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
447 |
C-- End If implicitViscosity.AND.momStepping |
C-- End If implicitViscosity.AND.momStepping |
448 |
ENDIF |
ENDIF |
449 |
|
|
|
Cjmc : add for phiHyd output <- but not working if multi tile per CPU |
|
|
c IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime+deltaTClock,myTime) |
|
|
c & .AND. buoyancyRelation .ne. 'OCEANIC' ) THEN |
|
|
c WRITE(suff,'(I10.10)') myIter+1 |
|
|
c CALL WRITE_FLD_XYZ_RL('PH.',suff,phiHyd,myIter+1,myThid) |
|
|
c ENDIF |
|
|
Cjmc(end) |
|
|
|
|
|
#ifdef ALLOW_TIMEAVE |
|
|
IF (taveFreq.GT.0.) THEN |
|
|
CALL TIMEAVE_CUMUL_1T(phiHydtave, phiHyd, Nr, |
|
|
I deltaTclock, bi, bj, myThid) |
|
|
ENDIF |
|
|
#endif /* ALLOW_TIMEAVE */ |
|
|
|
|
450 |
ENDDO |
ENDDO |
451 |
ENDDO |
ENDDO |
452 |
|
|