Back to home page

MITgcm

 
 

    


File indexing completed on 2021-10-14 05:16:38 UTC

view on githubraw file Latest commit 796b5e35 on 2021-09-19 19:31:52 UTC
0c49347dc7 Alis*0001 #include "GMREDI_OPTIONS.h"
                0002 
15d11726a0 Jean*0003 CBOP
                0004 C     !ROUTINE: GMREDI_OUTPUT
                0005 
                0006 C     !INTERFACE:
                0007       SUBROUTINE GMREDI_OUTPUT( myTime, myIter, myThid )
                0008 
                0009 C     !DESCRIPTION: \bv
                0010 C     *==========================================================*
                0011 C     | SUBROUTINE GMREDI_OUTPUT
                0012 C     | o general routine for GM/Redi output
                0013 C     *==========================================================*
                0014 C     |   write time-average & snap-shot output
                0015 C     *==========================================================*
                0016 C     \ev
                0017 
                0018 C     !USES:
0c49347dc7 Alis*0019       IMPLICIT NONE
                0020 
                0021 C     === Global variables ===
                0022 #include "SIZE.h"
                0023 #include "EEPARAMS.h"
                0024 #include "PARAMS.h"
                0025 #include "GMREDI.h"
15d11726a0 Jean*0026 #include "GMREDI_TAVE.h"
0c49347dc7 Alis*0027 
15d11726a0 Jean*0028 C     !INPUT PARAMETERS:
                0029 C     myTime :: Current time of simulation ( s )
                0030 C     myIter :: Iteration number
                0031 C     myThid :: my Thread Id number
0c49347dc7 Alis*0032       _RL     myTime
                0033       INTEGER myIter
                0034       INTEGER myThid
15d11726a0 Jean*0035 CEOP
0c49347dc7 Alis*0036 
                0037 #ifdef ALLOW_GMREDI
8d8488bf10 Jean*0038 C     !FUNCTIONS:
94a46dfe0d Jean*0039       LOGICAL  DIFFERENT_MULTIPLE
                0040       EXTERNAL DIFFERENT_MULTIPLE
8d8488bf10 Jean*0041 
                0042 C     !LOCAL VARIABLES:
df5a9764ba Jean*0043       CHARACTER*(10) suff
8d8488bf10 Jean*0044 #ifdef ALLOW_TIMEAVE
                0045       INTEGER bi, bj
                0046 #endif
                0047 #ifdef ALLOW_MNC
b22b541fe9 Ed H*0048       CHARACTER*(1) pf
8d8488bf10 Jean*0049 #endif
0c49347dc7 Alis*0050 
94a46dfe0d Jean*0051       IF ( DIFFERENT_MULTIPLE(diagFreq,myTime,deltaTClock)
8d8488bf10 Jean*0052      &   ) THEN
e2d47178e0 Ed H*0053 
                0054         IF ( GM_MDSIO ) THEN
df5a9764ba Jean*0055           IF ( rwSuffixType.EQ.0 ) THEN
                0056             WRITE(suff,'(I10.10)') myIter
                0057           ELSE
                0058             CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid )
                0059           ENDIF
e2d47178e0 Ed H*0060           CALL WRITE_FLD_XYZ_RL( 'GM_Kux.',suff,Kux,myIter,myThid)
                0061           CALL WRITE_FLD_XYZ_RL( 'GM_Kvy.',suff,Kvy,myIter,myThid)
                0062 #ifdef GM_EXTRA_DIAGONAL
                0063           IF (GM_ExtraDiag) THEN
                0064             CALL WRITE_FLD_XYZ_RL( 'GM_Kuz.',suff,Kuz,myIter,myThid)
                0065             CALL WRITE_FLD_XYZ_RL( 'GM_Kvz.',suff,Kvz,myIter,myThid)
                0066           ENDIF
                0067 #endif
                0068         ENDIF
                0069 
                0070 #ifdef ALLOW_MNC
                0071         IF ( GM_MNC ) THEN
8d8488bf10 Jean*0072           IF ( writeBinaryPrec .EQ. precFloat64 ) THEN
                0073            pf(1:1) = 'D'
                0074           ELSE
                0075            pf(1:1) = 'R'
                0076           ENDIF
e2d47178e0 Ed H*0077           CALL MNC_CW_SET_UDIM('gm_inst', -1, myThid)
                0078           CALL MNC_CW_RL_W_S('D','gm_inst',0,0,'T',myTime,myThid)
                0079           CALL MNC_CW_SET_UDIM('gm_inst', 0, myThid)
                0080           CALL MNC_CW_I_W_S('I','gm_inst',0,0,'iter',myIter,myThid)
b22b541fe9 Ed H*0081           CALL MNC_CW_RL_W(pf,'gm_inst',0,0,'Kux',Kux,myThid)
                0082           CALL MNC_CW_RL_W(pf,'gm_inst',0,0,'Kvy',Kvy,myThid)
f42e64b3e7 Jean*0083 #ifdef GM_EXTRA_DIAGONAL
e2d47178e0 Ed H*0084           IF (GM_ExtraDiag) THEN
b22b541fe9 Ed H*0085             CALL MNC_CW_RL_W(pf,'gm_inst',0,0,'Kuz',Kuz,myThid)
                0086             CALL MNC_CW_RL_W(pf,'gm_inst',0,0,'Kvz',Kvz,myThid)
8d8488bf10 Jean*0087           ENDIF
e2d47178e0 Ed H*0088 #endif
                0089         ENDIF
796b5e35f7 Jean*0090 #endif /* ALLOW_MNC */
e2d47178e0 Ed H*0091 
8d8488bf10 Jean*0092       ENDIF
f42e64b3e7 Jean*0093 
                0094 #ifdef ALLOW_TIMEAVE
0c49347dc7 Alis*0095 C     Dump files and restart average computation if needed
8d8488bf10 Jean*0096       IF ( DIFFERENT_MULTIPLE( taveFreq, myTime, deltaTClock )
0c49347dc7 Alis*0097      &     ) THEN
8d8488bf10 Jean*0098 
0c49347dc7 Alis*0099 C      Normalize by integrated time
                0100        DO bj = myByLo(myThid), myByHi(myThid)
                0101         DO bi = myBxLo(myThid), myBxHi(myThid)
8d8488bf10 Jean*0102          CALL TIMEAVE_NORMALIZE( GM_Kwx_T, GM_timeAve,
                0103      &                           Nr, bi, bj, myThid )
                0104          CALL TIMEAVE_NORMALIZE( GM_Kwy_T, GM_timeAve,
                0105      &                           Nr, bi, bj, myThid )
                0106          CALL TIMEAVE_NORMALIZE( GM_Kwz_T, GM_timeAve,
                0107      &                           Nr, bi, bj, myThid )
0c49347dc7 Alis*0108 #ifdef GM_VISBECK_VARIABLE_K
f42e64b3e7 Jean*0109         IF (GM_Visbeck_alpha.NE.0.)
8d8488bf10 Jean*0110      &   CALL TIMEAVE_NORMALIZE( Visbeck_K_T, GM_timeAve,
                0111      &                           1 , bi, bj, myThid )
f42e64b3e7 Jean*0112 #endif
                0113 #ifdef GM_BOLUS_ADVEC
                0114         IF (GM_AdvForm) THEN
8d8488bf10 Jean*0115          CALL TIMEAVE_NORMALIZE( GM_PsiXtave, GM_timeAve,
                0116      &                           Nr, bi, bj, myThid )
                0117          CALL TIMEAVE_NORMALIZE( GM_PsiYtave, GM_timeAve,
                0118      &                           Nr, bi, bj, myThid )
f42e64b3e7 Jean*0119         ENDIF
0c49347dc7 Alis*0120 #endif
                0121         ENDDO
                0122        ENDDO
8d8488bf10 Jean*0123 
e2d47178e0 Ed H*0124        IF ( GM_MDSIO ) THEN
df5a9764ba Jean*0125          IF ( rwSuffixType.EQ.0 ) THEN
                0126            WRITE(suff,'(I10.10)') myIter
                0127          ELSE
                0128            CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid )
                0129          ENDIF
e2d47178e0 Ed H*0130          CALL WRITE_FLD_XYZ_RL('GM_Kwx-T.',suff,GM_Kwx_T,myIter,myThid)
                0131          CALL WRITE_FLD_XYZ_RL('GM_Kwy-T.',suff,GM_Kwy_T,myIter,myThid)
                0132          CALL WRITE_FLD_XYZ_RL('GM_Kwz-T.',suff,GM_Kwz_T,myIter,myThid)
0c49347dc7 Alis*0133 #ifdef GM_VISBECK_VARIABLE_K
e2d47178e0 Ed H*0134          IF (GM_Visbeck_alpha.NE.0.)
                0135      &        CALL WRITE_FLD_XY_RL('Visbeck_K-T.',suff,Visbeck_K_T,
                0136      &                             myIter,myThid)
0c49347dc7 Alis*0137 #endif
f42e64b3e7 Jean*0138 #ifdef GM_BOLUS_ADVEC
e2d47178e0 Ed H*0139          IF (GM_AdvForm) THEN
                0140            CALL WRITE_FLD_XYZ_RL('GM_PsiXtave.',suff,GM_PsiXtave,
                0141      &                           myIter,myThid)
                0142            CALL WRITE_FLD_XYZ_RL('GM_PsiYtave.',suff,GM_PsiYtave,
                0143      &                           myIter,myThid)
                0144          ENDIF
                0145 #endif
                0146        ENDIF
8d8488bf10 Jean*0147 
e2d47178e0 Ed H*0148 #ifdef ALLOW_MNC
                0149        IF ( GM_MNC ) THEN
8d8488bf10 Jean*0150          IF ( writeBinaryPrec .EQ. precFloat64 ) THEN
                0151            pf(1:1) = 'D'
                0152          ELSE
                0153            pf(1:1) = 'R'
                0154          ENDIF
e2d47178e0 Ed H*0155          CALL MNC_CW_SET_UDIM('gm_tave', -1, myThid)
                0156          CALL MNC_CW_RL_W_S('D','gm_tave',0,0,'T',myTime,myThid)
                0157          CALL MNC_CW_SET_UDIM('gm_tave', 0, myThid)
                0158          CALL MNC_CW_I_W_S('I','gm_tave',0,0,'iter',myIter,myThid)
b22b541fe9 Ed H*0159          CALL MNC_CW_RL_W(pf,'gm_tave',0,0,'Kwx',GM_Kwx_T,myThid)
                0160          CALL MNC_CW_RL_W(pf,'gm_tave',0,0,'Kwy',GM_Kwy_T,myThid)
                0161          CALL MNC_CW_RL_W(pf,'gm_tave',0,0,'Kwz',GM_Kwz_T,myThid)
e2d47178e0 Ed H*0162 #ifdef GM_VISBECK_VARIABLE_K
                0163          IF (GM_Visbeck_alpha.NE.0.) THEN
8d8488bf10 Jean*0164            CALL MNC_CW_RL_W(pf,'gm_tave',0,0,'VisbK',
e2d47178e0 Ed H*0165      &          Visbeck_K_T, myThid)
                0166          ENDIF
                0167 #endif
                0168 #ifdef GM_BOLUS_ADVEC
                0169          IF (GM_AdvForm) THEN
                0170            CALL MNC_CW_RL_W(
b22b541fe9 Ed H*0171      &          pf,'gm_tave',0,0,'PsiX', GM_PsiXtave, myThid)
e2d47178e0 Ed H*0172            CALL MNC_CW_RL_W(
b22b541fe9 Ed H*0173      &          pf,'gm_tave',0,0,'PsiY', GM_PsiYtave, myThid)
e2d47178e0 Ed H*0174          ENDIF
                0175 #endif
f42e64b3e7 Jean*0176        ENDIF
                0177 #endif
8d8488bf10 Jean*0178 
0c49347dc7 Alis*0179 C      Reset averages to zero
                0180        DO bj = myByLo(myThid), myByHi(myThid)
                0181         DO bi = myBxLo(myThid), myBxHi(myThid)
8d8488bf10 Jean*0182          CALL TIMEAVE_RESET( GM_Kwx_T, Nr, bi, bj, myThid )
                0183          CALL TIMEAVE_RESET( GM_Kwy_T, Nr, bi, bj, myThid )
                0184          CALL TIMEAVE_RESET( GM_Kwz_T, Nr, bi, bj, myThid )
f42e64b3e7 Jean*0185 #ifdef GM_VISBECK_VARIABLE_K
                0186          IF (GM_Visbeck_alpha.NE.0.)
8d8488bf10 Jean*0187      &    CALL TIMEAVE_RESET( Visbeck_K_T, 1, bi, bj, myThid )
f42e64b3e7 Jean*0188 #endif
                0189 #ifdef GM_BOLUS_ADVEC
                0190          IF (GM_AdvForm) THEN
8d8488bf10 Jean*0191           CALL TIMEAVE_RESET( GM_PsiXtave, Nr, bi, bj, myThid )
                0192           CALL TIMEAVE_RESET( GM_PsiYtave, Nr, bi, bj, myThid )
f42e64b3e7 Jean*0193          ENDIF
                0194 #endif
8d8488bf10 Jean*0195          GM_timeAve(bi,bj) = 0.
0c49347dc7 Alis*0196         ENDDO
                0197        ENDDO
                0198 
8d8488bf10 Jean*0199       ENDIF
0ac82346d7 Jean*0200 #endif /* ALLOW_TIMEAVE */
8d8488bf10 Jean*0201 
0c49347dc7 Alis*0202 #endif /* ALLOW_GMREDI */
8d8488bf10 Jean*0203 
0c49347dc7 Alis*0204       RETURN
                0205       END