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

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

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

revision 1.95 by heimbach, Fri Feb 28 02:20:52 2003 UTC revision 1.102 by edhill, Tue Oct 28 22:57:59 2003 UTC
# Line 1  Line 1 
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
# Line 204  C         (1 + dt * K * d_zz) salt[n] = Line 205  C         (1 + dt * K * d_zz) salt[n] =
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:
# Line 253  CHPF$&                  ) Line 242  CHPF$&                  )
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
# Line 272  C--     Set up work arrays that need val Line 276  C--     Set up work arrays that need val
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    
# Line 315  C--      Calculate the total vertical di Line 321  C--      Calculate the total vertical di
321         ENDDO         ENDDO
322  #endif  #endif
323    
324    #ifdef ALLOW_AUTODIFF_TAMC
325    CADJ STORE KappaRU(:,:,:)
326    CADJ &                 = comlev1_bibj, key=idynkey, byte=isbyte
327    CADJ STORE KappaRV(:,:,:)
328    CADJ &                 = comlev1_bibj, key=idynkey, byte=isbyte
329    #endif /* ALLOW_AUTODIFF_TAMC */
330    
331  C--     Start of dynamics loop  C--     Start of dynamics loop
332          DO k=1,Nr          DO k=1,Nr
333    
# Line 329  C--       kDown  Cycles through 2,1 to p Line 342  C--       kDown  Cycles through 2,1 to p
342    
343  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
344           kkey = (idynkey-1)*Nr + k           kkey = (idynkey-1)*Nr + k
345    c
346  CADJ STORE totphihyd (:,:,k,bi,bj)  CADJ STORE totphihyd (:,:,k,bi,bj)
347  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
348    CADJ STORE gt (:,:,k,bi,bj)
349    CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
350    CADJ STORE gs (:,:,k,bi,bj)
351    CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
352    CADJ STORE theta (:,:,k,bi,bj)
353    CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
354    CADJ STORE salt  (:,:,k,bi,bj)
355    CADJ &     = comlev1_bibj_k, key=kkey, byte=isbyte
356  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
357    
358  C--      Integrate hydrostatic balance for phiHyd with BC of  C--      Integrate hydrostatic balance for phiHyd with BC of
# Line 353  C        distinguishe between Stagger an Line 375  C        distinguishe between Stagger an
375           ENDIF           ENDIF
376    
377  C--      Calculate accelerations in the momentum equations (gU, gV, ...)  C--      Calculate accelerations in the momentum equations (gU, gV, ...)
378  C        and step forward storing the result in gUnm1, gVnm1, etc...  C        and step forward storing the result in gU, gV, etc...
379           IF ( momStepping ) THEN           IF ( momStepping ) THEN
380  #ifndef DISABLE_MOM_FLUXFORM  #ifndef DISABLE_MOM_FLUXFORM
381             IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM(             IF (.NOT. vectorInvariantMomentum) CALL MOM_FLUXFORM(
# Line 372  C        and step forward storing the re Line 394  C        and step forward storing the re
394             CALL TIMESTEP(             CALL TIMESTEP(
395       I         bi,bj,iMin,iMax,jMin,jMax,k,       I         bi,bj,iMin,iMax,jMin,jMax,k,
396       I         dPhiHydX,dPhiHydY, phiSurfX, phiSurfY,       I         dPhiHydX,dPhiHydY, phiSurfX, phiSurfY,
397       I         myIter, myThid)       I         myTime, myIter, myThid)
398    
399  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
400  C--      Apply open boundary conditions  C--      Apply open boundary conditions
401           IF (useOBCS) THEN             IF (useOBCS) THEN
402             CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )               CALL OBCS_APPLY_UV( bi, bj, k, gU, gV, myThid )
403           END IF             ENDIF
404  #endif   /* ALLOW_OBCS */  #endif   /* ALLOW_OBCS */
405    
 #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 */  
406           ENDIF           ENDIF
407    
408    
# Line 401  C--     end of dynamics k loop (1:Nr) Line 412  C--     end of dynamics k loop (1:Nr)
412  C--     Implicit viscosity  C--     Implicit viscosity
413          IF (implicitViscosity.AND.momStepping) THEN          IF (implicitViscosity.AND.momStepping) THEN
414  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
415  CADJ STORE gUNm1(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte  CADJ STORE KappaRU(:,:,:) = comlev1_bibj , key=idynkey, byte=isbyte
416    CADJ STORE gU(:,:,:,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, KappaRU,recip_HFacW,       I         deltaTmom, KappaRU,recip_HFacW,
421       U         gUNm1,       U         gU,
422       I         myThid )       I         myThid )
423  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
424  CADJ STORE gVNm1(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte  CADJ STORE KappaRV(:,:,:) = comlev1_bibj , key=idynkey, byte=isbyte
425    CADJ STORE gV(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte
426  #endif    /* ALLOW_AUTODIFF_TAMC */  #endif    /* ALLOW_AUTODIFF_TAMC */
427            CALL IMPLDIFF(            CALL IMPLDIFF(
428       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
429       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
430       U         gVNm1,       U         gV,
431       I         myThid )       I         myThid )
432    
433  #ifdef   ALLOW_OBCS  #ifdef   ALLOW_OBCS
434  C--      Apply open boundary conditions  C--      Apply open boundary conditions
435           IF (useOBCS) THEN           IF (useOBCS) THEN
436             DO K=1,Nr             DO K=1,Nr
437               CALL OBCS_APPLY_UV( bi, bj, k, gUnm1, gVnm1, myThid )               CALL OBCS_APPLY_UV( bi, bj, k, gU, gV, myThid )
438             ENDDO             ENDDO
439           END IF           END IF
440  #endif   /* ALLOW_OBCS */  #endif   /* ALLOW_OBCS */
441    
442  #ifdef    INCLUDE_CD_CODE  #ifdef    ALLOW_CD_CODE
443  #ifdef    ALLOW_AUTODIFF_TAMC  #ifdef    ALLOW_AUTODIFF_TAMC
444  CADJ STORE vVelD(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte  CADJ STORE vVelD(:,:,:,bi,bj) = comlev1_bibj , key=idynkey, byte=isbyte
445  #endif    /* ALLOW_AUTODIFF_TAMC */  #endif    /* ALLOW_AUTODIFF_TAMC */
# Line 443  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_ Line 456  CADJ STORE uVelD(:,:,:,bi,bj) = comlev1_
456       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
457       U         uVelD,       U         uVelD,
458       I         myThid )       I         myThid )
459  #endif    /* INCLUDE_CD_CODE */  #endif    /* ALLOW_CD_CODE */
460  C--     End If implicitViscosity.AND.momStepping  C--     End If implicitViscosity.AND.momStepping
461          ENDIF          ENDIF
462    
# Line 459  C     &                'phiHydLow', myTh Line 472  C     &                'phiHydLow', myTh
472  Cml)  Cml)
473    
474  #ifndef DISABLE_DEBUGMODE  #ifndef DISABLE_DEBUGMODE
475        If (debugMode) THEN        If ( debugLevel .GE. debLevB ) THEN
476         CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(1,EtaN,'EtaN (DYNAMICS)',myThid)
477         CALL DEBUG_STATS_RL(Nr,uVel,'Uvel (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,uVel,'Uvel (DYNAMICS)',myThid)
478         CALL DEBUG_STATS_RL(Nr,vVel,'Vvel (DYNAMICS)',myThid)         CALL DEBUG_STATS_RL(Nr,vVel,'Vvel (DYNAMICS)',myThid)

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.102

  ViewVC Help
Powered by ViewVC 1.1.22