/[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.48 by adcroft, Tue Mar 14 17:47:25 2000 UTC revision 1.49 by heimbach, Fri Jun 9 02:45:04 2000 UTC
# Line 20  C     | ===== Line 20  C     | =====
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    c
24    c     changed: Patrick Heimbach heimbach@mit.edu 6-Jun-2000
25    c              - computation of ikey wrong for nTx,nTy > 1
26    c                and/or nsx,nsy > 1: act1 and act2 were
27    c                mixed up.
28    
29        IMPLICIT NONE        IMPLICIT NONE
30    
31  C     == Global variables ===  C     == Global variables ===
# Line 29  C     == Global variables === Line 35  C     == Global variables ===
35  #include "PARAMS.h"  #include "PARAMS.h"
36  #include "DYNVARS.h"  #include "DYNVARS.h"
37  #include "GRID.h"  #include "GRID.h"
38    
39  #ifdef ALLOW_KPP  #ifdef ALLOW_KPP
40  #include "KPPMIX.h"  #include "KPPMIX.h"
41  #endif  #endif
42    
43    #ifdef ALLOW_AUTODIFF_TAMC
44    #include "tamc.h"
45    #include "tamc_keys.h"
46    #endif
47    
48  C     == Routine arguments ==  C     == Routine arguments ==
49  C     myTime - Current time in simulation  C     myTime - Current time in simulation
50  C     myIter - Current iteration number in simulation  C     myIter - Current iteration number in simulation
# Line 136  C                      index into fVerTe Line 148  C                      index into fVerTe
148        INTEGER k, kM1, kUp, kDown        INTEGER k, kM1, kUp, kDown
149        LOGICAL BOTTOM_LAYER        LOGICAL BOTTOM_LAYER
150    
151    #ifdef ALLOW_AUTODIFF_TAMC
152          INTEGER    isbyte
153          PARAMETER( isbyte = 4 )
154    
155          INTEGER act1, act2, act3, act4
156          INTEGER max1, max2, max3
157          INTEGER ikact, iikey,kkey
158          INTEGER maximpl
159    #endif
160    
161  C---    The algorithm...  C---    The algorithm...
162  C  C
163  C       "Correction Step"  C       "Correction Step"
# Line 181  C         (1 + dt * K * d_zz) theta[n] = Line 203  C         (1 + dt * K * d_zz) theta[n] =
203  C         (1 + dt * K * d_zz) salt[n] = salt*  C         (1 + dt * K * d_zz) salt[n] = salt*
204  C---  C---
205    
206    #ifdef ALLOW_AUTODIFF_TAMC
207    C--   dummy statement to end declaration part
208          ikey = 1
209    #endif
210    
211  C--   Set up work arrays with valid (i.e. not NaN) values  C--   Set up work arrays with valid (i.e. not NaN) values
212  C     These inital values do not alter the numerical results. They  C     These inital values do not alter the numerical results. They
213  C     just ensure that all memory references are to valid floating  C     just ensure that all memory references are to valid floating
# Line 218  C     uninitialised but inert locations. Line 245  C     uninitialised but inert locations.
245        ENDDO        ENDDO
246    
247    
248    #ifdef ALLOW_AUTODIFF_TAMC
249    C--   HPF directive to help TAMC
250    !HPF$ INDEPENDENT
251    #endif
252    
253        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
254    
255    #ifdef ALLOW_AUTODIFF_TAMC
256    C--    HPF directive to help TAMC
257    !HPF$  INDEPENDENT, NEW (rTrans,rVel,fVerT,fVerS,fVerU,fVerV
258    !HPF$&                  ,phiHyd,K13,K23,K33,KapGM
259    !HPF$&                  ,utrans,vtrans,maskc,xA,yA
260    !HPF$&                  ,KappaRT,KappaRS,KappaRU,KappaRV
261    !HPF$&                  )
262    #endif
263    
264         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
265    
266    #ifdef ALLOW_AUTODIFF_TAMC
267              act1 = bi - myBxLo(myThid)
268              max1 = myBxHi(myThid) - myBxLo(myThid) + 1
269    
270              act2 = bj - myByLo(myThid)
271              max2 = myByHi(myThid) - myByLo(myThid) + 1
272    
273              act3 = myThid - 1
274              max3 = nTx*nTy
275    
276              act4 = ikey_dynamics - 1
277    
278              ikey = (act1 + 1) + act2*max1
279         &                      + act3*max1*max2
280         &                      + act4*max1*max2*max3
281    #endif
282    
283  C--     Set up work arrays that need valid initial values  C--     Set up work arrays that need valid initial values
284          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
285           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
# Line 274  C--     Update fields in top level accor Line 333  C--     Update fields in top level accor
333          CALL CORRECTION_STEP(          CALL CORRECTION_STEP(
334       I       bi,bj,iMin,iMax,jMin,jMax,K,       I       bi,bj,iMin,iMax,jMin,jMax,K,
335       I       etaSurfX,etaSurfY,myTime,myThid)       I       etaSurfX,etaSurfY,myTime,myThid)
336    
337  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
338          IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K, myThid )          IF (openBoundaries) THEN
339    #ifdef ALLOW_AUTODIFF_TAMC
340    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
341    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
342    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
343    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
344    #endif
345               CALL APPLY_OBCS1( bi, bj, K, myThid )
346            END IF
347  #endif  #endif
348    
349          IF ( .NOT. BOTTOM_LAYER ) THEN          IF ( .NOT. BOTTOM_LAYER ) THEN
350  C--      Update fields in layer below according to tendency terms  C--      Update fields in layer below according to tendency terms
351           CALL CORRECTION_STEP(           CALL CORRECTION_STEP(
352       I        bi,bj,iMin,iMax,jMin,jMax,K+1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,
353       I        etaSurfX,etaSurfY,myTime,myThid)       I        etaSurfX,etaSurfY,myTime,myThid)
354  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
355           IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )           IF (openBoundaries) THEN
356    #ifdef ALLOW_AUTODIFF_TAMC
357    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
358    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
359    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
360    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
361    #endif
362                CALL APPLY_OBCS1( bi, bj, K+1, myThid )
363             END IF
364  #endif  #endif
365          ENDIF          ENDIF
366  #endif  #endif
367  C--     Density of 1st level (below W(1)) reference to level 1  C--     Density of 1st level (below W(1)) reference to level 1
368  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
369    #ifdef ALLOW_AUTODIFF_TAMC
370    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
371    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
372    #endif
373          CALL FIND_RHO(          CALL FIND_RHO(
374       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,       I     bi, bj, iMin, iMax, jMin, jMax, K, K, eosType,
375       O     rhoKm1,       O     rhoKm1,
# Line 303  C--     Density of 1st level (below W(1) Line 384  C--     Density of 1st level (below W(1)
384  C--      Check static stability with layer below  C--      Check static stability with layer below
385  C--      and mix as needed.  C--      and mix as needed.
386  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
387    #ifdef ALLOW_AUTODIFF_TAMC
388    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
389    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
390    #endif
391           CALL FIND_RHO(           CALL FIND_RHO(
392       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax, K+1, K, eosType,
393       O      rhoKp1,       O      rhoKp1,
394       I      myThid )       I      myThid )
395  #endif  #endif
396    
397  #ifdef  INCLUDE_CONVECT_CALL  #ifdef  INCLUDE_CONVECT_CALL
398    
399    #ifdef ALLOW_AUTODIFF_TAMC
400    CADJ STORE rhoKm1(:,:)  = comlev1_2d, key = ikey, byte = isbyte
401    CADJ STORE rhoKp1(:,:)  = comlev1_2d, key = ikey, byte = isbyte
402    #endif
403           CALL CONVECT(           CALL CONVECT(
404       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
405       U       ConvectCount,       U       ConvectCount,
406       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
407    #ifdef ALLOW_AUTODIFF_TAMC
408    CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)
409    CADJ &     = comlev1_2d, key = ikey, byte = isbyte
410    CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)
411    CADJ &     = comlev1_2d, key = ikey, byte = isbyte
412  #endif  #endif
413    
414    #endif
415    
416  C--      Implicit Vertical Diffusion for Convection  C--      Implicit Vertical Diffusion for Convection
417           IF (ivdc_kappa.NE.0.) CALL CALC_IVDC(           IF (ivdc_kappa.NE.0.) CALL CALC_IVDC(
418       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
419       U       ConvectCount, KappaRT, KappaRS,       U       ConvectCount, KappaRT, KappaRS,
420       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
421    CRG: do we need do store STORE KappaRT, KappaRS ?
422    
423  C--      Recompute density after mixing  C--      Recompute density after mixing
424  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
425           CALL FIND_RHO(           CALL FIND_RHO(
# Line 339  C--     phiHyd(z=0)=0 Line 440  C--     phiHyd(z=0)=0
440       U      phiHyd,       U      phiHyd,
441       I      myThid )       I      myThid )
442    
443    C----------------------------------------------
444    C--     start of downward loop
445    C----------------------------------------------
446          DO K=2,Nr          DO K=2,Nr
447    
448    #ifdef ALLOW_AUTODIFF_TAMC
449             kkey = ikact*(Nr-2+1) + (k-2) + 1
450    #endif
451    
452           BOTTOM_LAYER = K .EQ. Nr           BOTTOM_LAYER = K .EQ. Nr
453    
454  #ifdef DO_PIPELINED_CORRECTION_STEP  #ifdef DO_PIPELINED_CORRECTION_STEP
455           IF ( .NOT. BOTTOM_LAYER ) THEN           IF ( .NOT. BOTTOM_LAYER ) THEN
456  C--       Update fields in layer below according to tendency terms  C--       Update fields in layer below according to tendency terms
# Line 348  C--       Update fields in layer below a Line 458  C--       Update fields in layer below a
458       I         bi,bj,iMin,iMax,jMin,jMax,K+1,       I         bi,bj,iMin,iMax,jMin,jMax,K+1,
459       I         etaSurfX,etaSurfY,myTime,myThid)       I         etaSurfX,etaSurfY,myTime,myThid)
460  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
461            IF (openBoundaries) CALL APPLY_OBCS1( bi, bj, K+1, myThid )            IF (openBoundaries) THEN
462    #ifdef ALLOW_AUTODIFF_TAMC
463    CADJ STORE uvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
464    CADJ STORE vvel (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
465    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
466    CADJ STORE salt(:,:,k,bi,bj)   = comlev1_2d, key = ikey, byte = isbyte
467    #endif
468                 CALL APPLY_OBCS1( bi, bj, K+1, myThid )
469              END IF
470  #endif  #endif
471           ENDIF           ENDIF
472  #endif  #endif
473    
474  C--      Density of K level (below W(K)) reference to K level  C--      Density of K level (below W(K)) reference to K level
475  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
476    #ifdef ALLOW_AUTODIFF_TAMC
477    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
478    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
479    #endif
480           CALL FIND_RHO(           CALL FIND_RHO(
481       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,       I      bi, bj, iMin, iMax, jMin, jMax,  K, K, eosType,
482       O      rhoK,       O      rhoK,
# Line 367  C--      Density of K level (below W(K)) Line 490  C--      Density of K level (below W(K))
490  C--       Check static stability with layer below and mix as needed.  C--       Check static stability with layer below and mix as needed.
491  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.
492  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
493    #ifdef ALLOW_AUTODIFF_TAMC
494    CADJ STORE theta(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
495    CADJ STORE salt (:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
496    #endif
497            CALL FIND_RHO(            CALL FIND_RHO(
498       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,       I       bi, bj, iMin, iMax, jMin, jMax,  K+1, K, eosType,
499       O       rhoKp1,       O       rhoKp1,
500       I       myThid )       I       myThid )
501  #endif  #endif
502    
503    #ifdef ALLOW_AUTODIFF_TAMC
504    CADJ STORE rhok  (:,:)   = comlev1_3d, key = kkey, byte = isbyte
505    CADJ STORE rhoKm1(:,:)   = comlev1_3d, key = kkey, byte = isbyte
506    CADJ STORE rhoKp1(:,:)   = comlev1_3d, key = kkey, byte = isbyte
507    #endif
508    
509  #ifdef  INCLUDE_CONVECT_CALL  #ifdef  INCLUDE_CONVECT_CALL
510            CALL CONVECT(            CALL CONVECT(
511       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,       I        bi,bj,iMin,iMax,jMin,jMax,K+1,rhoK,rhoKp1,
512       U        ConvectCount,       U        ConvectCount,
513       I        myTime,myIter,myThid)       I        myTime,myIter,myThid)
514    #ifdef ALLOW_AUTODIFF_TAMC
515    CADJ STORE theta(:,:,k+1,bi,bj),theta(:,:,k,bi,bj)
516    CADJ &     = comlev1_3d, key = kkey, byte = isbyte
517    CADJ STORE salt (:,:,k+1,bi,bj),salt (:,:,k,bi,bj)
518    CADJ &     = comlev1_3d, key = kkey, byte = isbyte
519    #endif
520  #endif  #endif
521    
522  C--      Implicit Vertical Diffusion for Convection  C--      Implicit Vertical Diffusion for Convection
523           IF (ivdc_kappa.NE.0.) CALL CALC_IVDC(           IF (ivdc_kappa.NE.0.) THEN
524                CALL CALC_IVDC(
525       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,       I       bi,bj,iMin,iMax,jMin,jMax,K+1,rhoKm1,rhoKp1,
526       U       ConvectCount, KappaRT, KappaRS,       U       ConvectCount, KappaRT, KappaRS,
527       I       myTime,myIter,myThid)       I       myTime,myIter,myThid)
528    CRG: do we need do store STORE KappaRT, KappaRS ?
529             END IF
530    
531  C--       Recompute density after mixing  C--       Recompute density after mixing
532  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
533            CALL FIND_RHO(            CALL FIND_RHO(
# Line 409  C--      Calculate iso-neutral slopes fo Line 554  C--      Calculate iso-neutral slopes fo
554       O        rhoTmp,       O        rhoTmp,
555       I        myThid )       I        myThid )
556  #endif  #endif
557    
558  #ifdef  INCLUDE_CALC_ISOSLOPES_CALL  #ifdef  INCLUDE_CALC_ISOSLOPES_CALL
559    #ifdef ALLOW_AUTODIFF_TAMC
560    CADJ STORE rhoTmp(:,:)  = comlev1_3d, key = kkey, byte = isbyte
561    CADJ STORE rhok  (:,:)  = comlev1_3d, key = kkey, byte = isbyte
562    CADJ STORE rhoKm1(:,:)  = comlev1_3d, key = kkey, byte = isbyte
563    CADJ STORE kapgm (:,:)  = comlev1_3d, key = kkey, byte = isbyte
564    #endif
565           CALL CALC_ISOSLOPES(           CALL CALC_ISOSLOPES(
566       I        bi, bj, iMin, iMax, jMin, jMax, K,       I        bi, bj, iMin, iMax, jMin, jMax, K,
567       I        rhoKm1, rhoK, rhotmp,       I        rhoKm1, rhoK, rhotmp,
568       O        K13, K23, K33, KapGM,       O        K13, K23, K33, KapGM,
569       I        myThid )       I        myThid )
570  #endif  #endif
571    
572           DO J=jMin,jMax           DO J=jMin,jMax
573            DO I=iMin,iMax            DO I=iMin,iMax
574  #ifdef  INCLUDE_FIND_RHO_CALL  #ifdef  INCLUDE_FIND_RHO_CALL
# Line 424  C--      Calculate iso-neutral slopes fo Line 577  C--      Calculate iso-neutral slopes fo
577             buoyKm1(I,J) = buoyK(I,J)             buoyKm1(I,J) = buoyK(I,J)
578            ENDDO            ENDDO
579           ENDDO           ENDDO
580          ENDDO ! K          ENDDO
581    C--     end of k loop
582    
583    #ifdef ALLOW_AUTODIFF_TAMC
584    CADJ STORE theta(:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
585    CADJ STORE salt (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
586    CADJ STORE uvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
587    CADJ STORE vvel (:,:,:,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
588    #endif
589    
590  #ifdef ALLOW_KPP  #ifdef ALLOW_KPP
591    C----------------------------------------------
592  C--     Compute KPP mixing coefficients  C--     Compute KPP mixing coefficients
593    C----------------------------------------------
594          IF (usingKPPmixing) THEN          IF (usingKPPmixing) THEN
595    #ifdef ALLOW_AUTODIFF_TAMC
596    CADJ STORE fu  (:,:  ,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
597    CADJ STORE fv  (:,:  ,bi,bj)  = comlev1_2d, key = ikey, byte = isbyte
598    #endif
599           CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'           CALL TIMER_START('KVMIX (FIND KPP COEFFICIENTS) [DYNAMICS]'
600       I          , myThid)       I          , myThid)
601           CALL KVMIX(           CALL KVMIX(
# Line 438  C--     Compute KPP mixing coefficients Line 605  C--     Compute KPP mixing coefficients
605          ENDIF          ENDIF
606  #endif  #endif
607    
608    C----------------------------------------------
609    C--     start of upward loop
610    C----------------------------------------------
611          DO K = Nr, 1, -1          DO K = Nr, 1, -1
612    
613           kM1  =max(1,k-1)   ! Points to level above k (=k-1)           kM1  =max(1,k-1)   ! Points to level above k (=k-1)
614           kUp  =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above           kUp  =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
615           kDown=1+MOD(k,2)   ! Cycles through 2,1 to point to current layer           kDown=1+MOD(k,2)   ! Cycles through 2,1 to point to current layer
616    
617           iMin = 1-OLx+2           iMin = 1-OLx+2
618           iMax = sNx+OLx-1           iMax = sNx+OLx-1
619           jMin = 1-OLy+2           jMin = 1-OLy+2
620           jMax = sNy+OLy-1           jMax = sNy+OLy-1
621    
622    #ifdef ALLOW_AUTODIFF_TAMC
623             kkey = ikact*(Nr-1+1) + (k-1) + 1
624    #endif
625    
626    #ifdef ALLOW_AUTODIFF_TAMC
627    CADJ STORE rvel  (:,:,kDown)  = comlev1_3d, key = kkey, byte = isbyte
628    CADJ STORE rTrans(:,:)        = comlev1_3d, key = kkey, byte = isbyte
629    CADJ STORE KappaRT(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte
630    CADJ STORE KappaRS(:,:,:)     = comlev1_3d, key = kkey, byte = isbyte
631    #endif
632    
633  C--      Get temporary terms used by tendency routines  C--      Get temporary terms used by tendency routines
634           CALL CALC_COMMON_FACTORS (           CALL CALC_COMMON_FACTORS (
635       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I        bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
636       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,       O        xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
637       I        myThid)       I        myThid)
638    
639  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
640          IF (openBoundaries) THEN          IF (openBoundaries) THEN
641           CALL APPLY_OBCS3( bi, bj, K, Kup, rTrans, rVel, myThid )           CALL APPLY_OBCS3( bi, bj, K, Kup, rTrans, rVel, myThid )
642          ENDIF          ENDIF
643  #endif  #endif
644    
645  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL  #ifdef  INCLUDE_CALC_DIFFUSIVITY_CALL
646  C--      Calculate the total vertical diffusivity  C--      Calculate the total vertical diffusivity
647           CALL CALC_DIFFUSIVITY(           CALL CALC_DIFFUSIVITY(
# Line 475  C--      Calculate accelerations in the Line 659  C--      Calculate accelerations in the
659       U         aTerm,xTerm,cTerm,mTerm,pTerm,       U         aTerm,xTerm,cTerm,mTerm,pTerm,
660       U         fZon, fMer, fVerU, fVerV,       U         fZon, fMer, fVerU, fVerV,
661       I         myTime, myThid)       I         myTime, myThid)
662    #ifdef ALLOW_AUTODIFF_TAMC
663    #ifdef INCLUDE_CD_CODE
664             ELSE
665                DO j=1-OLy,sNy+OLy
666                   DO i=1-OLx,sNx+OLx
667                      guCD(i,j,k,bi,bj) = 0.0
668                      gvCD(i,j,k,bi,bj) = 0.0
669                   END DO
670                END DO
671    #endif
672    #endif
673           ENDIF           ENDIF
674  C--      Calculate active tracer tendencies  C--      Calculate active tracer tendencies
675           IF ( tempStepping ) THEN           IF ( tempStepping ) THEN
# Line 506  C--      Prediction step (step forward a Line 701  C--      Prediction step (step forward a
701       I       myIter, myThid)       I       myIter, myThid)
702  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
703  C--      Apply open boundary conditions  C--      Apply open boundary conditions
704           IF (openBoundaries) CALL APPLY_OBCS2( bi, bj, K, myThid )           IF (openBoundaries) THEN
705    #ifdef ALLOW_AUTODIFF_TAMC
706    CADJ STORE gunm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
707    CADJ STORE gvnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
708    CADJ STORE gwnm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
709    #endif
710                CALL APPLY_OBCS2( bi, bj, K, myThid )
711             END IF
712  #endif  #endif
713  C--      Freeze water  C--      Freeze water
714           IF (allowFreezing)           IF (allowFreezing) THEN
715       &   CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )  #ifdef ALLOW_AUTODIFF_TAMC
716    CADJ STORE gTNm1(:,:,k,bi,bj)  = comlev1_3d, key = kkey, byte = isbyte
717    #endif
718                CALL FREEZE( bi, bj, iMin, iMax, jMin, jMax, K, myThid )
719             END IF
720    
721  #ifdef DIVG_IN_DYNAMICS  #ifdef DIVG_IN_DYNAMICS
722  C--      Diagnose barotropic divergence of predicted fields  C--      Diagnose barotropic divergence of predicted fields
# Line 535  C--      Cumulative diagnostic calculati Line 741  C--      Cumulative diagnostic calculati
741    
742  C--     Implicit diffusion  C--     Implicit diffusion
743          IF (implicitDiffusion) THEN          IF (implicitDiffusion) THEN
744           IF (tempStepping) CALL IMPLDIFF(  
745    #ifdef ALLOW_AUTODIFF_TAMC
746               maximpl = 6
747               iikey = ikact*maximpl
748    #endif
749    
750             IF (tempStepping) THEN
751    #ifdef ALLOW_AUTODIFF_TAMC
752                idkey = iikey + 1
753    #endif
754                CALL IMPLDIFF(
755       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
756       I         deltaTtracer, KappaRT,recip_HFacC,       I         deltaTtracer, KappaRT,recip_HFacC,
757       U         gTNm1,       U         gTNm1,
758       I         myThid )       I         myThid )
759           IF (saltStepping) CALL IMPLDIFF(           END IF
760    
761             IF (saltStepping) THEN
762    #ifdef ALLOW_AUTODIFF_TAMC
763             idkey = iikey + 2
764    #endif
765                CALL IMPLDIFF(
766       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
767       I         deltaTtracer, KappaRS,recip_HFacC,       I         deltaTtracer, KappaRS,recip_HFacC,
768       U         gSNm1,       U         gSNm1,
769       I         myThid )       I         myThid )
770             END IF
771    
772          ENDIF ! implicitDiffusion          ENDIF ! implicitDiffusion
773    
774  C--     Implicit viscosity  C--     Implicit viscosity
775          IF (implicitViscosity) THEN          IF (implicitViscosity) THEN
776    
777           IF (momStepping) THEN           IF (momStepping) THEN
778    #ifdef ALLOW_AUTODIFF_TAMC
779             idkey = iikey + 3
780    #endif
781            CALL IMPLDIFF(            CALL IMPLDIFF(
782       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
783       I         deltaTmom, KappaRU,recip_HFacW,       I         deltaTmom, KappaRU,recip_HFacW,
784       U         gUNm1,       U         gUNm1,
785       I         myThid )       I         myThid )
786    #ifdef ALLOW_AUTODIFF_TAMC
787             idkey = iikey + 4
788    #endif
789            CALL IMPLDIFF(            CALL IMPLDIFF(
790       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
791       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
792       U         gVNm1,       U         gVNm1,
793       I         myThid )       I         myThid )
794    
795  #ifdef INCLUDE_CD_CODE  #ifdef INCLUDE_CD_CODE
796    
797    #ifdef ALLOW_AUTODIFF_TAMC
798             idkey = iikey + 5
799    #endif
800            CALL IMPLDIFF(            CALL IMPLDIFF(
801       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
802       I         deltaTmom, KappaRU,recip_HFacW,       I         deltaTmom, KappaRU,recip_HFacW,
803       U         vVelD,       U         vVelD,
804       I         myThid )       I         myThid )
805    #ifdef ALLOW_AUTODIFF_TAMC
806            idkey = iikey + 6
807    #endif
808            CALL IMPLDIFF(            CALL IMPLDIFF(
809       I         bi, bj, iMin, iMax, jMin, jMax,       I         bi, bj, iMin, iMax, jMin, jMax,
810       I         deltaTmom, KappaRV,recip_HFacS,       I         deltaTmom, KappaRV,recip_HFacS,
811       U         uVelD,       U         uVelD,
812       I         myThid )       I         myThid )
813    
814  #endif  #endif
815    
816           ENDIF ! momStepping           ENDIF ! momStepping
817          ENDIF ! implicitViscosity          ENDIF ! implicitViscosity
818    

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

  ViewVC Help
Powered by ViewVC 1.1.22