/[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.31 by heimbach, Sun Oct 22 01:11:44 2006 UTC revision 1.41 by heimbach, Wed Apr 18 19:54:06 2007 UTC
# Line 64  C     == Global variables === Line 64  C     == Global variables ===
64  # endif  # endif
65  # ifdef ALLOW_EXF  # ifdef ALLOW_EXF
66  #  include "ctrl.h"  #  include "ctrl.h"
67  #  include "exf_fields.h"  #  include "EXF_FIELDS.h"
 #  include "exf_clim_fields.h"  
68  #  ifdef ALLOW_BULKFORMULAE  #  ifdef ALLOW_BULKFORMULAE
69  #   include "exf_constants.h"  #   include "EXF_CONSTANTS.h"
70  #  endif  #  endif
71  # endif  # endif
72  # ifdef ALLOW_SEAICE  # ifdef ALLOW_SEAICE
# Line 118  C--   dummy statement to end declaration Line 117  C--   dummy statement to end declaration
117        IF ( debugLevel .GE. debLevB )        IF ( debugLevel .GE. debLevB )
118       &     CALL DEBUG_ENTER('DO_OCEANIC_PHYS',myThid)       &     CALL DEBUG_ENTER('DO_OCEANIC_PHYS',myThid)
119  #endif  #endif
120    
121        doDiagsRho = 0        doDiagsRho = 0
122  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
123        IF ( useDiagnostics .AND. fluidIsWater ) THEN        IF ( useDiagnostics .AND. fluidIsWater ) THEN
# Line 144  C     under sea-ice may not be "exactly" Line 143  C     under sea-ice may not be "exactly"
143  C     theta is dumped or time-averaged.  C     theta is dumped or time-averaged.
144        IF ( useSEAICE ) THEN        IF ( useSEAICE ) THEN
145  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
146  CADJ STORE qnet,qsw            = comlev1, key = ikey_dynamics  CADJ STORE atemp,aqh,precip    = comlev1, key = ikey_dynamics
147  CADJ STORE aqh,precip,swdown   = comlev1, key = ikey_dynamics  CADJ STORE swdown,lwdown       = comlev1, key = ikey_dynamics
148  CADJ STORE theta               = comlev1, key = ikey_dynamics  CADJ STORE theta               = comlev1, key = ikey_dynamics
149  # ifdef SEAICE_ALLOW_DYNAMICS  cph# ifdef EXF_READ_EVAP
150    CADJ STORE evap                = comlev1, key = ikey_dynamics
151    cph# endif
152    cph# ifdef SEAICE_ALLOW_DYNAMICS
153  CADJ STORE uvel,vvel           = comlev1, key = ikey_dynamics  CADJ STORE uvel,vvel           = comlev1, key = ikey_dynamics
154    cph# endif
155    # ifdef SEAICE_CGRID
156    CADJ STORE fu, fv              = comlev1, key = ikey_dynamics
157    CADJ STORE seaicemasku         = comlev1, key = ikey_dynamics
158    CADJ STORE seaicemaskv         = comlev1, key = ikey_dynamics
159    #  ifdef ATMOSPHERIC_LOADING
160    CADJ STORE siceload            = comlev1, key = ikey_dynamics
161    #  endif
162  # endif  # endif
163  #endif  #endif
164  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
# Line 207  CADJ STORE theta = comlev1, key = ikey_d Line 217  CADJ STORE theta = comlev1, key = ikey_d
217  #ifdef ALLOW_OCN_COMPON_INTERF  #ifdef ALLOW_OCN_COMPON_INTERF
218  C--    Apply imported data (from coupled interface) to forcing fields  C--    Apply imported data (from coupled interface) to forcing fields
219  C jmc: do not know precisely where to put this call (bf or af thSIce ?)  C jmc: do not know precisely where to put this call (bf or af thSIce ?)
220         IF ( useCoupler ) THEN        IF ( useCoupler ) THEN
221           CALL OCN_APPLY_IMPORT( .TRUE., myTime, myIter, myThid )           CALL OCN_APPLY_IMPORT( .TRUE., myTime, myIter, myThid )
222         ENDIF        ENDIF
223  #endif /* ALLOW_OCN_COMPON_INTERF */  #endif /* ALLOW_OCN_COMPON_INTERF */
224    
225  #ifdef ALLOW_BALANCE_FLUXES  #ifdef ALLOW_BALANCE_FLUXES
226  C     balance fluxes  C     balance fluxes
227         IF ( balanceEmPmR )        IF ( balanceEmPmR )
228       &        CALL REMOVE_MEAN_RS( 1, EmPmR, maskH, maskH, rA, drF,       &        CALL REMOVE_MEAN_RS( 1, EmPmR, maskH, maskH, rA, drF,
229       &        'EmPmR', myTime, myThid )       &        'EmPmR', myTime, myThid )
230         IF ( balanceQnet )        IF ( balanceQnet )
231       &        CALL REMOVE_MEAN_RS( 1, Qnet,  maskH, maskH, rA, drF,       &        CALL REMOVE_MEAN_RS( 1, Qnet,  maskH, maskH, rA, drF,
232       &        'Qnet ', myTime, myThid )       &        'Qnet ', myTime, myThid )
233  #endif /* ALLOW_BALANCE_FLUXES */  #endif /* ALLOW_BALANCE_FLUXES */
# Line 244  CHPF$ INDEPENDENT Line 254  CHPF$ INDEPENDENT
254            itdkey = (act1 + 1) + act2*max1            itdkey = (act1 + 1) + act2*max1
255       &                      + act3*max1*max2       &                      + act3*max1*max2
256       &                      + act4*max1*max2*max3       &                      + act4*max1*max2*max3
257    #else  /* ALLOW_AUTODIFF_TAMC */
258    C     if fluid is not water, by-pass find_rho, gmredi, surfaceForcing
259    C     and all vertical mixing schemes, but keep OBCS_CALC
260            IF ( fluidIsWater ) THEN
261  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
262    
263  C--   Set up work arrays with valid (i.e. not NaN) values  C--   Set up work arrays with valid (i.e. not NaN) values
# Line 313  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_ Line 327  CADJ STORE vvel (:,:,:,bi,bj) = comlev1_
327  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
328    
329  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
330          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
331       &    CALL DEBUG_MSG('ENTERING UPWARD K LOOP',myThid)       &    CALL DEBUG_MSG('ENTERING UPWARD K LOOP',myThid)
332  #endif  #endif
333    
# Line 330  cph Needed for rhok, rhokm1, in the case Line 344  cph Needed for rhok, rhokm1, in the case
344    
345  C--       Calculate gradients of potential density for isoneutral  C--       Calculate gradients of potential density for isoneutral
346  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)  C         slope terms (e.g. GM/Redi tensor or IVDC diffusivity)
 c         IF ( k.GT.1 .AND. (useGMRedi.OR.ivdc_kappa.NE.0.) ) THEN  
347            IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.)            IF ( useGMRedi .OR. (k.GT.1 .AND. ivdc_kappa.NE.0.)
348       &                   .OR. doDiagsRho.GE.1 ) THEN       &                   .OR. doDiagsRho.GE.1 ) THEN
349  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
350              IF ( debugLevel .GE. debLevB )              IF ( debugLevel .GE. debLevB )
351       &       CALL DEBUG_CALL('FIND_RHO',myThid)       &       CALL DEBUG_CALL('FIND_RHO',myThid)
352  #endif  #endif
353  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 359  CADJ STORE salt (:,:,k-1,bi,bj) = comlev Line 372  CADJ STORE salt (:,:,k-1,bi,bj) = comlev
372       I        myThid )       I        myThid )
373              ENDIF              ENDIF
374  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
375              IF ( debugLevel .GE. debLevB )              IF ( debugLevel .GE. debLevB )
376       &       CALL DEBUG_CALL('GRAD_SIGMA',myThid)       &       CALL DEBUG_CALL('GRAD_SIGMA',myThid)
377  #endif  #endif
378  cph Avoid variable aliasing for adjoint !!!  cph Avoid variable aliasing for adjoint !!!
# Line 385  C--       Implicit Vertical Diffusion fo Line 398  C--       Implicit Vertical Diffusion fo
398  c ==> should use sigmaR !!!  c ==> should use sigmaR !!!
399            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN            IF (k.GT.1 .AND. ivdc_kappa.NE.0.) THEN
400  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
401              IF ( debugLevel .GE. debLevB )              IF ( debugLevel .GE. debLevB )
402       &       CALL DEBUG_CALL('CALC_IVDC',myThid)       &       CALL DEBUG_CALL('CALC_IVDC',myThid)
403  #endif  #endif
404              CALL CALC_IVDC(              CALL CALC_IVDC(
# Line 406  C--     end of diagnostic k loop (Nr:1) Line 419  C--     end of diagnostic k loop (Nr:1)
419          ENDDO          ENDDO
420    
421  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
 c       IF ( useDiagnostics .AND.  
 c    &       (useGMRedi .OR. ivdc_kappa.NE.0.) ) THEN  
422          IF ( doDiagsRho.GE.1 ) THEN          IF ( doDiagsRho.GE.1 ) THEN
423            CALL DIAGNOSTICS_FILL (sigmaR, 'DRHODR  ', 0, Nr,            CALL DIAGNOSTICS_FILL (sigmaR, 'DRHODR  ', 0, Nr,
424       &         2, bi, bj, myThid)       &         2, bi, bj, myThid)
425          ENDIF          ENDIF
426  #endif  #endif
427    
 #ifdef  ALLOW_OBCS  
 C--     Calculate future values on open boundaries  
         IF (useOBCS) THEN  
 #ifdef ALLOW_DEBUG  
           IF ( debugLevel .GE. debLevB )  
      &     CALL DEBUG_CALL('OBCS_CALC',myThid)  
 #endif  
           CALL OBCS_CALC( bi, bj, myTime+deltaTclock, myIter+1,  
      I            uVel, vVel, wVel, theta, salt,  
      I            myThid )  
         ENDIF  
 #endif  /* ALLOW_OBCS */  
   
 #ifndef ALLOW_AUTODIFF_TAMC  
         IF ( fluidIsWater ) THEN  
 #endif  
428  C--     Determines forcing terms based on external fields  C--     Determines forcing terms based on external fields
429  C       relaxation terms, etc.  C       relaxation terms, etc.
430  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
431          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
432       &    CALL DEBUG_CALL('EXTERNAL_FORCING_SURF',myThid)       &    CALL DEBUG_CALL('EXTERNAL_FORCING_SURF',myThid)
433  #endif  #endif
434  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
# Line 450  CADJ STORE recip_hFacC(:,:,:,bi,bj) Line 445  CADJ STORE recip_hFacC(:,:,:,bi,bj)
445  CADJ &     = comlev1_bibj, key=itdkey, byte=isbyte  CADJ &     = comlev1_bibj, key=itdkey, byte=isbyte
446  # endif  # endif
447  #endif  #endif
448           CALL EXTERNAL_FORCING_SURF(          CALL EXTERNAL_FORCING_SURF(
449       I             bi, bj, iMin, iMax, jMin, jMax,       I             bi, bj, iMin, iMax, jMin, jMax,
450       I             myTime, myIter, myThid )       I             myTime, myIter, myThid )
 #ifndef ALLOW_AUTODIFF_TAMC  
         ENDIF  
 #endif  
451  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
452  # ifdef EXACT_CONSERV  # ifdef EXACT_CONSERV
453  cph-test  cph-test
# Line 495  CADJ STORE sigmaR(:,:,:)        = comlev Line 487  CADJ STORE sigmaR(:,:,:)        = comlev
487  C--     Calculate iso-neutral slopes for the GM/Redi parameterisation  C--     Calculate iso-neutral slopes for the GM/Redi parameterisation
488          IF (useGMRedi) THEN          IF (useGMRedi) THEN
489  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
490            IF ( debugLevel .GE. debLevB )            IF ( debugLevel .GE. debLevB )
491       &     CALL DEBUG_CALL('GMREDI_CALC_TENSOR',myThid)       &     CALL DEBUG_CALL('GMREDI_CALC_TENSOR',myThid)
492  #endif  #endif
493            CALL GMREDI_CALC_TENSOR(            CALL GMREDI_CALC_TENSOR(
# Line 517  C--     Calculate iso-neutral slopes for Line 509  C--     Calculate iso-neutral slopes for
509  C--     Compute KPP mixing coefficients  C--     Compute KPP mixing coefficients
510          IF (useKPP) THEN          IF (useKPP) THEN
511  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
512            IF ( debugLevel .GE. debLevB )            IF ( debugLevel .GE. debLevB )
513       &     CALL DEBUG_CALL('KPP_CALC',myThid)       &     CALL DEBUG_CALL('KPP_CALC',myThid)
514  #endif  #endif
515            CALL KPP_CALC(            CALL KPP_CALC(
# Line 535  C--     Compute KPP mixing coefficients Line 527  C--     Compute KPP mixing coefficients
527  C--     Compute PP81 mixing coefficients  C--     Compute PP81 mixing coefficients
528          IF (usePP81) THEN          IF (usePP81) THEN
529  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
530            IF ( debugLevel .GE. debLevB )            IF ( debugLevel .GE. debLevB )
531       &     CALL DEBUG_CALL('PP81_CALC',myThid)       &     CALL DEBUG_CALL('PP81_CALC',myThid)
532  #endif  #endif
533            CALL PP81_CALC(            CALL PP81_CALC(
# Line 547  C--     Compute PP81 mixing coefficients Line 539  C--     Compute PP81 mixing coefficients
539  C--     Compute MY82 mixing coefficients  C--     Compute MY82 mixing coefficients
540          IF (useMY82) THEN          IF (useMY82) THEN
541  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
542            IF ( debugLevel .GE. debLevB )            IF ( debugLevel .GE. debLevB )
543       &     CALL DEBUG_CALL('MY82_CALC',myThid)       &     CALL DEBUG_CALL('MY82_CALC',myThid)
544  #endif  #endif
545            CALL MY82_CALC(            CALL MY82_CALC(
# Line 559  C--     Compute MY82 mixing coefficients Line 551  C--     Compute MY82 mixing coefficients
551  C--     Compute GGL90 mixing coefficients  C--     Compute GGL90 mixing coefficients
552          IF (useGGL90) THEN          IF (useGGL90) THEN
553  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
554            IF ( debugLevel .GE. debLevB )            IF ( debugLevel .GE. debLevB )
555       &     CALL DEBUG_CALL('GGL90_CALC',myThid)       &     CALL DEBUG_CALL('GGL90_CALC',myThid)
556  #endif  #endif
557            CALL GGL90_CALC(            CALL GGL90_CALC(
# Line 568  C--     Compute GGL90 mixing coefficient Line 560  C--     Compute GGL90 mixing coefficient
560  #endif /* ALLOW_GGL90 */  #endif /* ALLOW_GGL90 */
561    
562  #ifdef ALLOW_TIMEAVE  #ifdef ALLOW_TIMEAVE
563          IF ( taveFreq.GT. 0. _d 0 .AND. fluidIsWater ) THEN          IF ( taveFreq.GT. 0. _d 0 ) THEN
564            CALL TIMEAVE_SURF_FLUX( bi, bj, myTime, myIter, myThid)            CALL TIMEAVE_SURF_FLUX( bi, bj, myTime, myIter, myThid)
565          ENDIF          ENDIF
566          IF (taveFreq.GT.0. .AND. ivdc_kappa.NE.0.) THEN          IF (taveFreq.GT.0. .AND. ivdc_kappa.NE.0.) THEN
# Line 577  C--     Compute GGL90 mixing coefficient Line 569  C--     Compute GGL90 mixing coefficient
569          ENDIF          ENDIF
570  #endif /* ALLOW_TIMEAVE */  #endif /* ALLOW_TIMEAVE */
571    
572    #ifndef ALLOW_AUTODIFF_TAMC
573    C---  if fluid Is Water: end
574            ENDIF
575    #endif
576    
577    #ifdef  ALLOW_OBCS
578    C--     Calculate future values on open boundaries
579            IF (useOBCS) THEN
580    #ifdef ALLOW_DEBUG
581              IF ( debugLevel .GE. debLevB )
582         &     CALL DEBUG_CALL('OBCS_CALC',myThid)
583    #endif
584              CALL OBCS_CALC( bi, bj, myTime+deltaTclock, myIter+1,
585         I            uVel, vVel, wVel, theta, salt,
586         I            myThid )
587            ENDIF
588    #endif  /* ALLOW_OBCS */
589    
590  C--   end bi,bj loops.  C--   end bi,bj loops.
591         ENDDO         ENDDO
592        ENDDO        ENDDO

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.22