1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
|
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
6 |
|
|
7 |
CBOP |
CBOP |
205 |
C--- |
C--- |
206 |
CEOP |
CEOP |
207 |
|
|
|
C-- Set up work arrays with valid (i.e. not NaN) values |
|
|
C These inital values do not alter the numerical results. They |
|
|
C just ensure that all memory references are to valid floating |
|
|
C point numbers. This prevents spurious hardware signals due to |
|
|
C uninitialised but inert locations. |
|
|
DO j=1-OLy,sNy+OLy |
|
|
DO i=1-OLx,sNx+OLx |
|
|
phiSurfX(i,j) = 0. _d 0 |
|
|
phiSurfY(i,j) = 0. _d 0 |
|
|
ENDDO |
|
|
ENDDO |
|
|
|
|
208 |
C-- Call to routine for calculation of |
C-- Call to routine for calculation of |
209 |
C Eliassen-Palm-flux-forced U-tendency, |
C Eliassen-Palm-flux-forced U-tendency, |
210 |
C if desired: |
C if desired: |
242 |
& + act4*max1*max2*max3 |
& + act4*max1*max2*max3 |
243 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
244 |
|
|
245 |
C-- Set up work arrays that need valid initial values |
C-- Set up work arrays with valid (i.e. not NaN) values |
246 |
|
C These inital values do not alter the numerical results. They |
247 |
|
C just ensure that all memory references are to valid floating |
248 |
|
C point numbers. This prevents spurious hardware signals due to |
249 |
|
C uninitialised but inert locations. |
250 |
|
|
251 |
DO k=1,Nr |
DO k=1,Nr |
252 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
253 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
254 |
KappaRU(i,j,k) = 0. _d 0 |
KappaRU(i,j,k) = 0. _d 0 |
255 |
KappaRV(i,j,k) = 0. _d 0 |
KappaRV(i,j,k) = 0. _d 0 |
256 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
257 |
|
cph( |
258 |
|
c-- need some re-initialisation here to break dependencies |
259 |
|
c-- totphihyd is assumed zero from ini_pressure, i.e. |
260 |
|
c-- avoiding iterate pressure p = integral of (g*rho(p)*dz) |
261 |
|
cph) |
262 |
|
totPhiHyd(i,j,k,bi,bj) = 0. _d 0 |
263 |
|
gu(i,j,k,bi,bj) = 0. _d 0 |
264 |
|
gv(i,j,k,bi,bj) = 0. _d 0 |
265 |
|
#endif |
266 |
ENDDO |
ENDDO |
267 |
ENDDO |
ENDDO |
268 |
ENDDO |
ENDDO |
276 |
phiHydC (i,j) = 0. _d 0 |
phiHydC (i,j) = 0. _d 0 |
277 |
dPhiHydX(i,j) = 0. _d 0 |
dPhiHydX(i,j) = 0. _d 0 |
278 |
dPhiHydY(i,j) = 0. _d 0 |
dPhiHydY(i,j) = 0. _d 0 |
279 |
|
phiSurfX(i,j) = 0. _d 0 |
280 |
|
phiSurfY(i,j) = 0. _d 0 |
281 |
ENDDO |
ENDDO |
282 |
ENDDO |
ENDDO |
283 |
|
|
335 |
|
|
336 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
337 |
kkey = (idynkey-1)*Nr + k |
kkey = (idynkey-1)*Nr + k |
338 |
CADJ STORE pressure(:,:,k,bi,bj) = comlev1_bibj_k , |
c |
339 |
CADJ & key=kkey , byte=isbyte |
CADJ STORE totphihyd (:,:,k,bi,bj) |
340 |
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
341 |
|
CADJ STORE gt (:,:,k,bi,bj) |
342 |
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
343 |
|
CADJ STORE gs (:,:,k,bi,bj) |
344 |
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
345 |
|
CADJ STORE theta (:,:,k,bi,bj) |
346 |
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
347 |
|
CADJ STORE salt (:,:,k,bi,bj) |
348 |
|
CADJ & = comlev1_bibj_k, key=kkey, byte=isbyte |
349 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
350 |
|
|
351 |
C-- Integrate hydrostatic balance for phiHyd with BC of |
C-- Integrate hydrostatic balance for phiHyd with BC of |
368 |
ENDIF |
ENDIF |
369 |
|
|
370 |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
C-- Calculate accelerations in the momentum equations (gU, gV, ...) |
371 |
C and step forward storing the result in gUnm1, gVnm1, etc... |
C and step forward storing the result in gU, gV, etc... |
372 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
373 |
#ifndef DISABLE_MOM_FLUXFORM |
#ifndef DISABLE_MOM_FLUXFORM |
374 |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM( |
387 |
CALL TIMESTEP( |
CALL TIMESTEP( |
388 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
389 |
I dPhiHydX,dPhiHydY, phiSurfX, phiSurfY, |
I dPhiHydX,dPhiHydY, phiSurfX, phiSurfY, |
390 |
I myIter, myThid) |
I myTime, myIter, myThid) |
391 |
|
|
392 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
393 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
394 |
IF (useOBCS) THEN |
IF (useOBCS) THEN |
395 |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
CALL OBCS_APPLY_UV( bi, bj, k, gU, gV, myThid ) |
396 |
END IF |
ENDIF |
397 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
398 |
|
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
|
|
#ifdef INCLUDE_CD_CODE |
|
|
ELSE |
|
|
DO j=1-OLy,sNy+OLy |
|
|
DO i=1-OLx,sNx+OLx |
|
|
guCD(i,j,k,bi,bj) = 0.0 |
|
|
gvCD(i,j,k,bi,bj) = 0.0 |
|
|
END DO |
|
|
END DO |
|
|
#endif /* INCLUDE_CD_CODE */ |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
|
399 |
ENDIF |
ENDIF |
400 |
|
|
401 |
|
|
405 |
C-- Implicit viscosity |
C-- Implicit viscosity |
406 |
IF (implicitViscosity.AND.momStepping) THEN |
IF (implicitViscosity.AND.momStepping) THEN |
407 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
408 |
CADJ STORE gUNm1(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte |
CADJ STORE gU(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte |
409 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
410 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
411 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
412 |
I deltaTmom, KappaRU,recip_HFacW, |
I deltaTmom, KappaRU,recip_HFacW, |
413 |
U gUNm1, |
U gU, |
414 |
I myThid ) |
I myThid ) |
415 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
416 |
CADJ STORE gVNm1(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte |
CADJ STORE gV(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte |
417 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
418 |
CALL IMPLDIFF( |
CALL IMPLDIFF( |
419 |
I bi, bj, iMin, iMax, jMin, jMax, |
I bi, bj, iMin, iMax, jMin, jMax, |
420 |
I deltaTmom, KappaRV,recip_HFacS, |
I deltaTmom, KappaRV,recip_HFacS, |
421 |
U gVNm1, |
U gV, |
422 |
I myThid ) |
I myThid ) |
423 |
|
|
424 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
425 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
426 |
IF (useOBCS) THEN |
IF (useOBCS) THEN |
427 |
DO K=1,Nr |
DO K=1,Nr |
428 |
CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid ) |
CALL OBCS_APPLY_UV( bi, bj, k, gU, gV, myThid ) |
429 |
ENDDO |
ENDDO |
430 |
END IF |
END IF |
431 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
463 |
Cml) |
Cml) |
464 |
|
|
465 |
#ifndef DISABLE_DEBUGMODE |
#ifndef DISABLE_DEBUGMODE |
466 |
If (debugMode) THEN |
If ( debugLevel .GE. debLevB ) THEN |
467 |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid) |
468 |
CALL DEBUG_STATS_RL(Nr,uVel,'Uvel (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,uVel,'Uvel (DYNAMICS)',myThid) |
469 |
CALL DEBUG_STATS_RL(Nr,vVel,'Vvel (DYNAMICS)',myThid) |
CALL DEBUG_STATS_RL(Nr,vVel,'Vvel (DYNAMICS)',myThid) |