Back to home page

MITgcm

 
 

    


File indexing completed on 2021-06-27 05:11:08 UTC

view on githubraw file Latest commit 4e4ad91a on 2021-06-26 16:30:07 UTC
d8206d87ee Patr*0001 #include "EBM_OPTIONS.h"
4e4ad91a39 Jean*0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
d8206d87ee Patr*0005 
fa24296df4 Jean*0006 CBOP 0
                0007 C !ROUTINE: EBM_ZONALMEAN
                0008 
                0009 C !INTERFACE:
d8206d87ee Patr*0010       SUBROUTINE EBM_ZONALMEAN( myTime, myIter, myThid )
                0011 
fa24296df4 Jean*0012 C     !DESCRIPTION:
                0013 C     *==========================================================*
                0014 C     | S/R CALCULATE ZONAL MEAN TEMPERATURE
                0015 C     *==========================================================*
d8206d87ee Patr*0016 
fa24296df4 Jean*0017 C     !USES:
                0018       IMPLICIT NONE
d8206d87ee Patr*0019 C     === Global variables ===
                0020 #include "SIZE.h"
                0021 #include "EEPARAMS.h"
                0022 #include "PARAMS.h"
                0023 #include "GRID.h"
fa24296df4 Jean*0024 #include "DYNVARS.h"
                0025 #include "FFIELDS.h"
d8206d87ee Patr*0026 #ifdef ALLOW_EBM
                0027 # include "EBM.h"
                0028 #endif
b08554040b Patr*0029 #ifdef ALLOW_AUTODIFF_TAMC
                0030 # include "tamc.h"
                0031 #endif
d8206d87ee Patr*0032 
fa24296df4 Jean*0033 C     !INPUT PARAMETERS:
d8206d87ee Patr*0034 C     === Routine arguments ===
fa24296df4 Jean*0035 C     myThid   :: my Thread Id number
d8206d87ee Patr*0036       _RL myTime
fa24296df4 Jean*0037       INTEGER myIter
                0038       INTEGER myThid
                0039 CEOP
d8206d87ee Patr*0040 
                0041 #ifdef ALLOW_EBM
fa24296df4 Jean*0042 C     !LOCAL VARIABLES:
                0043 C     i, j, k :: Loop counters
d8206d87ee Patr*0044       INTEGER i, j, k, bi, bj
e01977ab65 Jean*0045       INTEGER jg
                0046       _RL tileSumMask(nSx,nSy)
                0047       _RL tileSumSST (nSx,nSy)
                0048       _RL locSumMask(Ny)
                0049       _RL locSumSST (Ny)
d8206d87ee Patr*0050 
                0051 C--   Top layer only
                0052       k = 1
                0053 
                0054 C--   Calculate the zonal mean
e01977ab65 Jean*0055       DO jg = 1,Ny
                0056         DO bj=myByLo(myThid),myByHi(myThid)
                0057          DO bi=myBxLo(myThid),myBxHi(myThid)
                0058           tileSumMask(bi,bj) = 0.
                0059           tileSumSST (bi,bj) = 0.
                0060           j = jg + 1 - myYGlobalLo - (bj-1)*sNy
                0061           IF ( j.GE.1 .AND. j.LE.sNy ) THEN
                0062            DO i = 1,sNx
                0063             tileSumMask(bi,bj) = tileSumMask(bi,bj)
                0064      &                         + maskC(i,j,k,bi,bj)
                0065             tileSumSST (bi,bj) = tileSumSST (bi,bj)
                0066      &                         + maskC(i,j,k,bi,bj)*theta(i,j,k,bi,bj)
                0067            ENDDO
                0068           ENDIF
d8206d87ee Patr*0069          ENDDO
                0070         ENDDO
e01977ab65 Jean*0071         CALL GLOBAL_SUM_TILE_RL( tileSumMask, locSumMask(jg), myThid )
                0072         CALL GLOBAL_SUM_TILE_RL( tileSumSST,  locSumSST(jg),  myThid )
b08554040b Patr*0073       ENDDO
                0074 
                0075 #ifdef ALLOW_AUTODIFF_TAMC
                0076 CADJ STORE CountX = comlev1, key = ikey_dynamics
                0077 #endif
fa24296df4 Jean*0078       _BEGIN_MASTER(myThid)
                0079       DO bj=1,nSy
b08554040b Patr*0080        DO j=1-OLy,sNy+OLy
e01977ab65 Jean*0081         jg = myYGlobalLo + j-1 + (bj-1)*sNy
                0082 C       cyclic domain in Y:
                0083 c       jg = 1 + MOD( jg-1+Ny, Ny)
                0084 C       closed domain in Y:
                0085         jg = MAX(MIN(jg,Ny),1)
                0086         CountX(j,bj) = locSumMask(jg)
                0087         ZonalMeanSST(j,bj) = locSumSST(jg)
fa24296df4 Jean*0088         IF ( CountX(j,bj).GT.0. _d 0 ) THEN
4e8c9bded2 Patr*0089           ZonalMeanSST(j,bj) = ZonalMeanSST(j,bj)/CountX(j,bj)
                0090         ENDIF
                0091        ENDDO
d8206d87ee Patr*0092       ENDDO
fa24296df4 Jean*0093       _END_MASTER(myThid)
                0094       _BARRIER
                0095 
                0096       IF ( tauThetaZonRelax .NE. 0. _d 0 ) THEN
                0097 C-    replace SST with ZonalMeanSST for relaxation towards Zonal-Mean value
                0098        DO bj=myByLo(myThid),myByHi(myThid)
                0099         DO bi=myBxLo(myThid),myBxHi(myThid)
                0100          DO j = 1-OLy, sNy+OLy
                0101           DO i = 1-OLx, sNx+OLx
                0102             SST(i,j,bi,bj) = ZonalMeanSST(j,bj)
                0103           ENDDO
                0104          ENDDO
                0105         ENDDO
                0106        ENDDO
e01977ab65 Jean*0107 c      _EXCH_XY_RS( SST, myThid )
fa24296df4 Jean*0108       ENDIF
d8206d87ee Patr*0109 
                0110 #endif /* ALLOW_EBM */
                0111 
                0112       RETURN
                0113       END