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

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

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

revision 1.46 by heimbach, Fri Jun 1 22:20:02 2007 UTC revision 1.47 by jmc, Sun Jun 3 22:53:50 2007 UTC
# Line 85  C     myThid :: Thread number for this i Line 85  C     myThid :: Thread number for this i
85    
86  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
87  C     == Local variables  C     == Local variables
88  C     rhoK, rhoKM1  :: Density at current level, and level above  C     rhoK, rhoKm1  :: Density at current level, and level above
89  C     iMin, iMax    :: Ranges and sub-block indices on which calculations  C     iMin, iMax    :: Ranges and sub-block indices on which calculations
90  C     jMin, jMax       are applied.  C     jMin, jMax       are applied.
91  C     bi, bj        :: tile indices  C     bi, bj        :: tile indices
92  C     i,j,k         :: loop indices  C     i,j,k         :: loop indices
93        _RL rhokp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhoKp1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94        _RL rhokm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhoKm1  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
95        _RL rhok    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rhoK    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96        _RL sigmaX  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaX  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
97        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaY  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
98        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL sigmaR  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
# Line 121  C--   dummy statement to end declaration Line 121  C--   dummy statement to end declaration
121        doDiagsRho = 0        doDiagsRho = 0
122  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
123        IF ( useDiagnostics .AND. fluidIsWater ) THEN        IF ( useDiagnostics .AND. fluidIsWater ) THEN
         IF ( DIAGNOSTICS_IS_ON('DRHODR  ',myThid) ) doDiagsRho = 1  
124          IF ( DIAGNOSTICS_IS_ON('RHOANOSQ',myThid) .OR.          IF ( DIAGNOSTICS_IS_ON('RHOANOSQ',myThid) .OR.
125       &       DIAGNOSTICS_IS_ON('URHOMASS',myThid) .OR.       &       DIAGNOSTICS_IS_ON('URHOMASS',myThid) .OR.
126       &       DIAGNOSTICS_IS_ON('VRHOMASS',myThid) .OR.       &       DIAGNOSTICS_IS_ON('VRHOMASS',myThid) .OR.
127       &       DIAGNOSTICS_IS_ON('WRHOMASS',myThid) .OR.       &       DIAGNOSTICS_IS_ON('WRHOMASS',myThid) .OR.
128       &       DIAGNOSTICS_IS_ON('WRHOMASS',myThid) ) doDiagsRho = 2       &       DIAGNOSTICS_IS_ON('WRHOMASS',myThid) ) doDiagsRho = 2
129            IF ( doDiagsRho.EQ.0 .AND.
130         &       DIAGNOSTICS_IS_ON('MXLDEPTH',myThid) ) doDiagsRho = 1
131            IF ( doDiagsRho.EQ.0 .AND.
132         &       DIAGNOSTICS_IS_ON('DRHODR  ',myThid) ) doDiagsRho = 1
133        ENDIF        ENDIF
134  #endif /* ALLOW_DIAGNOSTICS */  #endif /* ALLOW_DIAGNOSTICS */
135    
# Line 202  C       and modify forcing terms includi Line 205  C       and modify forcing terms includi
205          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
206       &    CALL DEBUG_CALL('SHELFICE_THERMODYNAMICS',myThid)       &    CALL DEBUG_CALL('SHELFICE_THERMODYNAMICS',myThid)
207  #endif  #endif
208  C     compute temperature and (virtual) salt flux at the  C     compute temperature and (virtual) salt flux at the
209  C     shelf-ice ocean interface  C     shelf-ice ocean interface
210         CALL TIMER_START('SHELFICE_THERMODYNAMICS [DO_OCEANIC_PHYS]',         CALL TIMER_START('SHELFICE_THERMODYNAMICS [DO_OCEANIC_PHYS]',
211       &       myThid)       &       myThid)
# Line 263  CHPF$ INDEPENDENT Line 266  CHPF$ INDEPENDENT
266       &                      + act3*max1*max2       &                      + act3*max1*max2
267       &                      + act4*max1*max2*max3       &                      + act4*max1*max2*max3
268  #else  /* ALLOW_AUTODIFF_TAMC */  #else  /* ALLOW_AUTODIFF_TAMC */
269  C     if fluid is not water, by-pass find_rho, gmredi, surfaceForcing  C     if fluid is not water, by-pass find_rho, gmredi, surfaceForcing
270  C     and all vertical mixing schemes, but keep OBCS_CALC  C     and all vertical mixing schemes, but keep OBCS_CALC
271          IF ( fluidIsWater ) THEN          IF ( fluidIsWater ) THEN
272  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 276  C     uninitialised but inert locations. Line 279  C     uninitialised but inert locations.
279    
280          DO j=1-OLy,sNy+OLy          DO j=1-OLy,sNy+OLy
281           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
282            rhok   (i,j)   = 0. _d 0            rhoK   (i,j)   = 0. _d 0
283            rhoKM1 (i,j)   = 0. _d 0            rhoKm1 (i,j)   = 0. _d 0
284            rhoKP1 (i,j)   = 0. _d 0            rhoKp1 (i,j)   = 0. _d 0
285           ENDDO           ENDDO
286          ENDDO          ENDDO
287    
# Line 350  C--     Start of diagnostic loop Line 353  C--     Start of diagnostic loop
353  C? Patrick, is this formula correct now that we change the loop range?  C? Patrick, is this formula correct now that we change the loop range?
354  C? Do we still need this?  C? Do we still need this?
355  cph kkey formula corrected.  cph kkey formula corrected.
356  cph Needed for rhok, rhokm1, in the case useGMREDI.  cph Needed for rhoK, rhoKm1, in the case useGMREDI.
357           kkey = (itdkey-1)*Nr + k           kkey = (itdkey-1)*Nr + k
358  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
359    
# Line 390  CADJ STORE salt (:,:,k-1,bi,bj) = comlev Line 393  CADJ STORE salt (:,:,k-1,bi,bj) = comlev
393  cph Avoid variable aliasing for adjoint !!!  cph Avoid variable aliasing for adjoint !!!
394              DO j=jMin,jMax              DO j=jMin,jMax
395               DO i=iMin,iMax               DO i=iMin,iMax
396                rhoKP1(i,j) = rhoK(i,j)                rhoKp1(i,j) = rhoK(i,j)
397               ENDDO               ENDDO
398              ENDDO              ENDDO
399              CALL GRAD_SIGMA(              CALL GRAD_SIGMA(
# Line 402  cph Avoid variable aliasing for adjoint Line 405  cph Avoid variable aliasing for adjoint
405    
406  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
407  ctest# ifndef GM_EXCLUDE_CLIPPING  ctest# ifndef GM_EXCLUDE_CLIPPING
408  CADJ STORE rhok   (:,:) = comlev1_bibj_k ,       key=kkey, byte=isbyte  CADJ STORE rhoK   (:,:) = comlev1_bibj_k ,       key=kkey, byte=isbyte
409  ctest# endif  ctest# endif
410  CADJ STORE rhokm1 (:,:) = comlev1_bibj_k ,       key=kkey, byte=isbyte  CADJ STORE rhoKm1 (:,:) = comlev1_bibj_k ,       key=kkey, byte=isbyte
411  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
412  C--       Implicit Vertical Diffusion for Convection  C--       Implicit Vertical Diffusion for Convection
413  c ==> should use sigmaR !!!  c ==> should use sigmaR !!!
# Line 430  c ==> should use sigmaR !!! Line 433  c ==> should use sigmaR !!!
433  C--     end of diagnostic k loop (Nr:1)  C--     end of diagnostic k loop (Nr:1)
434          ENDDO          ENDDO
435    
436    C--     Diagnose Mixed Layer Depth:
437            IF ( useGMRedi .OR. doDiagsRho.GE.1 ) THEN
438              CALL CALC_OCE_MXLAYER( rhoK, sigmaR,
439         &              bi, bj, myTime, myIter, myThid )
440            ENDIF
441  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
442          IF ( doDiagsRho.GE.1 ) THEN          IF ( doDiagsRho.GE.1 ) THEN
443            CALL DIAGNOSTICS_FILL (sigmaR, 'DRHODR  ', 0, Nr,            CALL DIAGNOSTICS_FILL (sigmaR, 'DRHODR  ', 0, Nr,
# Line 482  CADJ STORE surfaceForcingTice(:,:,bi,bj) Line 490  CADJ STORE surfaceForcingTice(:,:,bi,bj)
490  CADJ &     = comlev1_bibj, key=itdkey, byte=isbyte  CADJ &     = comlev1_bibj, key=itdkey, byte=isbyte
491  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
492    
 #ifdef  ALLOW_GMREDI  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 # ifndef GM_EXCLUDE_CLIPPING  
 cph storing here is needed only for one GMREDI_OPTIONS:  
 cph define GM_BOLUS_ADVEC  
 cph keep it although TAF says you dont need to.  
 cph but I've avoided the #ifdef for now, in case more things change  
 CADJ STORE sigmaX(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte  
 CADJ STORE sigmaY(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte  
 CADJ STORE sigmaR(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte  
 # endif  
 #endif /* ALLOW_AUTODIFF_TAMC */  
   
 C--     Calculate iso-neutral slopes for the GM/Redi parameterisation  
         IF (useGMRedi) THEN  
 #ifdef ALLOW_DEBUG  
           IF ( debugLevel .GE. debLevB )  
      &     CALL DEBUG_CALL('GMREDI_CALC_TENSOR',myThid)  
 #endif  
           CALL GMREDI_CALC_TENSOR(  
      I             bi, bj, iMin, iMax, jMin, jMax,  
      I             sigmaX, sigmaY, sigmaR,  
      I             myThid )  
 #ifdef ALLOW_AUTODIFF_TAMC  
         ELSE  
           CALL GMREDI_CALC_TENSOR_DUMMY(  
      I             bi, bj, iMin, iMax, jMin, jMax,  
      I             sigmaX, sigmaY, sigmaR,  
      I             myThid )  
 #endif /* ALLOW_AUTODIFF_TAMC */  
         ENDIF  
   
 #endif  /* ALLOW_GMREDI */  
   
493  #ifdef  ALLOW_KPP  #ifdef  ALLOW_KPP
494  C--     Compute KPP mixing coefficients  C--     Compute KPP mixing coefficients
495          IF (useKPP) THEN          IF (useKPP) THEN
# Line 581  C--     Compute GGL90 mixing coefficient Line 554  C--     Compute GGL90 mixing coefficient
554          ENDIF          ENDIF
555  #endif /* ALLOW_TIMEAVE */  #endif /* ALLOW_TIMEAVE */
556    
557    #ifdef  ALLOW_GMREDI
558    #ifdef ALLOW_AUTODIFF_TAMC
559    # ifndef GM_EXCLUDE_CLIPPING
560    cph storing here is needed only for one GMREDI_OPTIONS:
561    cph define GM_BOLUS_ADVEC
562    cph keep it although TAF says you dont need to.
563    cph but I've avoided the #ifdef for now, in case more things change
564    CADJ STORE sigmaX(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte
565    CADJ STORE sigmaY(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte
566    CADJ STORE sigmaR(:,:,:)        = comlev1_bibj, key=itdkey, byte=isbyte
567    # endif
568    #endif /* ALLOW_AUTODIFF_TAMC */
569    
570    C--     Calculate iso-neutral slopes for the GM/Redi parameterisation
571            IF (useGMRedi) THEN
572    #ifdef ALLOW_DEBUG
573              IF ( debugLevel .GE. debLevB )
574         &     CALL DEBUG_CALL('GMREDI_CALC_TENSOR',myThid)
575    #endif
576              CALL GMREDI_CALC_TENSOR(
577         I             bi, bj, iMin, iMax, jMin, jMax,
578         I             sigmaX, sigmaY, sigmaR,
579         I             myThid )
580    #ifdef ALLOW_AUTODIFF_TAMC
581            ELSE
582              CALL GMREDI_CALC_TENSOR_DUMMY(
583         I             bi, bj, iMin, iMax, jMin, jMax,
584         I             sigmaX, sigmaY, sigmaR,
585         I             myThid )
586    #endif /* ALLOW_AUTODIFF_TAMC */
587            ENDIF
588    #endif  /* ALLOW_GMREDI */
589    
590  #ifndef ALLOW_AUTODIFF_TAMC  #ifndef ALLOW_AUTODIFF_TAMC
591  C---  if fluid Is Water: end  C---  if fluid Is Water: end
592          ENDIF          ENDIF

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.22