** Warning **

Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=MITgcm at /usr/local/share/lxr/lib/LXR/Common.pm line 1224.

Last-Modified: Tue, 22 Jul 2024 05:11:40 GMT Content-Type: text/html; charset=utf-8 MITgcm/MITgcm/pkg/monitor/monitor_g.F
Back to home page

MITgcm

 
 

    


File indexing completed on 2021-09-30 05:16:07 UTC

view on githubraw file Latest commit 872ff0f0 on 2021-09-09 19:00:21 UTC
6548dcf207 Patr*0001 #include "MONITOR_OPTIONS.h"
eded583e53 Jean*0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
                0005 #ifdef ALLOW_CTRL
                0006 # include "CTRL_OPTIONS.h"
                0007 #endif
967746e1a9 Patr*0008 #include "AD_CONFIG.h"
6548dcf207 Patr*0009 
                0010 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0011 CBOP
                0012 C     !ROUTINE: MONITOR
                0013 
                0014 C     !INTERFACE:
                0015       SUBROUTINE G_MONITOR(
4f6d3a8d05 Jean*0016      I                      myTime, myIter, myThid )
6548dcf207 Patr*0017 
                0018 C     !DESCRIPTION:
                0019 C     Monitor key dynamical variables: calculate over the full domain
                0020 C      some simple statistics (e.g., min,max,average) and write them.
                0021 
                0022 C     !USES:
                0023       IMPLICIT NONE
                0024 #include "SIZE.h"
                0025 #include "EEPARAMS.h"
                0026 #include "PARAMS.h"
                0027 #include "GRID.h"
                0028 #include "DYNVARS.h"
                0029 #include "FFIELDS.h"
                0030 #include "MONITOR.h"
                0031 #ifdef ALLOW_MNC
                0032 # include "MNC_PARAMS.h"
                0033 #endif
eded583e53 Jean*0034 #ifdef ALLOW_AUTODIFF_MONITOR
                0035 # include "g_common.h"
6548dcf207 Patr*0036 #endif
                0037 
                0038 C     !INPUT PARAMETERS:
                0039       _RL myTime
4f6d3a8d05 Jean*0040       INTEGER myIter
6548dcf207 Patr*0041       INTEGER myThid
                0042 CEOP
                0043 
                0044 #if (defined (ALLOW_TANGENTLINEAR_RUN) || defined (ALLOW_ADMTLM))
eded583e53 Jean*0045 #ifdef ALLOW_AUTODIFF_MONITOR
6548dcf207 Patr*0046 
                0047 C     === Functions ====
                0048       LOGICAL  DIFFERENT_MULTIPLE
                0049       EXTERNAL DIFFERENT_MULTIPLE
                0050       LOGICAL  MASTER_CPU_IO
                0051       EXTERNAL MASTER_CPU_IO
                0052 
                0053 C     !LOCAL VARIABLES:
                0054       CHARACTER*(MAX_LEN_MBUF) msgBuf
872ff0f059 Jean*0055 c     _RL dT
b082722712 Jean*0056       _RL dummyRL(6)
                0057       INTEGER k
6548dcf207 Patr*0058 
872ff0f059 Jean*0059       IF ( DIFFERENT_MULTIPLE(adjMonitorFreq,myTime,deltaTClock) ) THEN
6548dcf207 Patr*0060 
                0061         IF ( MASTER_CPU_IO(myThid) ) THEN
                0062 C--   only the master thread is allowed to switch On/Off mon_write_stdout
3daafce20b Jean*0063 C     & mon_write_mnc (since it is the only thread that uses those flags):
6548dcf207 Patr*0064 
                0065           IF (monitor_stdio) THEN
                0066             mon_write_stdout = .TRUE.
                0067           ELSE
                0068             mon_write_stdout = .FALSE.
                0069           ENDIF
                0070           mon_write_mnc = .FALSE.
                0071 #ifdef ALLOW_MNC
                0072           IF (useMNC .AND. monitor_mnc) THEN
b082722712 Jean*0073             DO k = 1,MAX_LEN_MBUF
                0074               mon_fname(k:k) = ' '
6548dcf207 Patr*0075             ENDDO
b082722712 Jean*0076             mon_fname(1:9) = 'g_monitor'
6548dcf207 Patr*0077             CALL MNC_CW_APPEND_VNAME(
                0078      &           'T', '-_-_--__-__t', 0,0, myThid)
                0079             CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid)
                0080             CALL MNC_CW_RL_W_S(
                0081      &          'D',mon_fname,1,1,'T', myTime, myThid)
                0082             CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid)
                0083             mon_write_mnc = .TRUE.
                0084           ENDIF
                0085 #endif /* ALLOW_MNC */
                0086 
                0087 C       Dynamics field monitor start
                0088           IF ( mon_write_stdout ) THEN
                0089             WRITE(msgBuf,'(2A)') '// ==========================',
                0090      &             '============================='
                0091             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0092             WRITE(msgBuf,'(A)')
872ff0f059 Jean*0093      &             '// Begin TL_MONITOR dynamic field statistics'
6548dcf207 Patr*0094             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0095             WRITE(msgBuf,'(2A)') '// ==========================',
                0096      &             '============================='
                0097             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0098           ENDIF
                0099 
                0100 C--   endif master cpu io
                0101         ENDIF
                0102 
                0103 C       Print the time to make grepping the stdout easier
                0104         CALL MON_SET_PREF('g__time',myThid)
                0105         CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid)
                0106         CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid)
                0107 
                0108 C       Print the basic statistics of model state variables
                0109         CALL MON_SET_PREF('g__dynstat',myThid)
b082722712 Jean*0110 
                0111         CALL MON_WRITESTATS_RL(  1, g_etaN, '_g_eta',
                0112      &           maskInC, maskInC, rA , drF, dummyRL, myThid )
                0113         CALL MON_WRITESTATS_RL( Nr, g_uVel, '_g_uvel',
                0114      &           hFacW, maskInW, rAw, drF, dummyRL, myThid )
                0115         CALL MON_WRITESTATS_RL( Nr, g_vVel, '_g_vvel',
                0116      &           hFacS, maskInS, rAs, drF, dummyRL, myThid )
                0117         CALL MON_WRITESTATS_RL( Nr, g_wVel, '_g_wvel',
                0118      &           maskC, maskInC, rA , drC, dummyRL, myThid )
                0119         CALL MON_WRITESTATS_RL( Nr, g_theta,'_g_theta',
                0120      &           hFacC, maskInC, rA , drF, dummyRL, myThid )
                0121         CALL MON_WRITESTATS_RL( Nr, g_salt, '_g_salt',
                0122      &           hFacC, maskInC, rA , drF, dummyRL, myThid )
                0123         IF ( nSx.EQ.1 .AND. nSy.EQ.1 ) THEN
                0124 C-      print stats only if nSx=nSy=1 since otherwise stats are wrong
                0125          k = 1
                0126          IF ( usingPCoords ) k = Nr
                0127          CALL MON_WRITESTATS_RL( 1,g_theta(1-OLx,1-OLy,k,1,1),'_g_sst',
                0128      &            maskInC, maskInC, rA , drF, dummyRL, myThid )
                0129          CALL MON_WRITESTATS_RL( 1, g_salt(1-OLx,1-OLy,k,1,1),'_g_sss',
                0130      &            maskInC, maskInC, rA , drF, dummyRL, myThid )
                0131         ENDIF
6548dcf207 Patr*0132 
                0133 C       Print the basic statistics of external forcing
872ff0f059 Jean*0134         IF ( monitorSelect.GE.4 ) THEN
b082722712 Jean*0135          CALL MON_SET_PREF('g__forcing',myThid)
                0136          CALL MON_WRITESTATS_RS( 1, g_Qnet, '_g_qnet',
                0137      &            maskInC, maskInC, rA , drF, dummyRL, myThid )
6548dcf207 Patr*0138 #ifdef SHORTWAVE_HEATING
b082722712 Jean*0139          CALL MON_WRITESTATS_RS( 1, g_Qsw , '_g_qsw',
                0140      &            maskInC, maskInC, rA , drF, dummyRL, myThid )
6548dcf207 Patr*0141 #endif
b082722712 Jean*0142          CALL MON_WRITESTATS_RS( 1, g_EmPmR,'_g_empmr',
                0143      &            maskInC, maskInC, rA , drF, dummyRL, myThid )
                0144          CALL MON_WRITESTATS_RS( 1, g_fu ,  '_g_fu',
                0145      &            maskInW, maskInW, rAw, drF, dummyRL, myThid )
                0146          CALL MON_WRITESTATS_RS( 1, g_fv ,  '_g_fv',
                0147      &            maskInS, maskInS, rAs, drF, dummyRL, myThid )
872ff0f059 Jean*0148         ENDIF
6548dcf207 Patr*0149 
                0150 C       Print the numerical stablility parameters for current state
872ff0f059 Jean*0151 c       CALL MON_SET_PREF('g__g_vcfl',myThid)
                0152 c       dT = MAX(dTtracerLev(1),deltaTMom)
                0153 c       CALL MON_ADVCFL( '_g_uvel', g_uVel,recip_dxC,dT,myThid )
                0154 c       CALL MON_ADVCFL( '_g_vvel', g_vVel,recip_dyC,dT,myThid )
                0155 c       CALL MON_ADVCFLW( '_g_wvel',g_wVel,recip_drC,dT,myThid )
                0156 c       CALL MON_ADVCFLW2('_g_W_hf',g_wVel,recip_hFacC,
                0157 c    &                                     recip_drF,dT,myThid )
6548dcf207 Patr*0158 
                0159 C       Dynamics field monitor finish
                0160         IF ( MASTER_CPU_IO(myThid) ) THEN
                0161 C--   only the master thread is allowed to switch On/Off mon_write_stdout
3daafce20b Jean*0162 C     & mon_write_mnc (since it is the only thread that uses those flags):
6548dcf207 Patr*0163 
                0164           IF ( mon_write_stdout ) THEN
                0165             WRITE(msgBuf,'(2A)') '// ==========================',
                0166      &             '============================='
                0167             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0168             WRITE(msgBuf,'(A)')
872ff0f059 Jean*0169      &             '// End TL_MONITOR dynamic field statistics'
6548dcf207 Patr*0170             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0171             WRITE(msgBuf,'(2A)') '// ==========================',
                0172      &             '============================='
                0173             CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
                0174           ENDIF
                0175 
                0176           mon_write_stdout = .FALSE.
                0177           mon_write_mnc    = .FALSE.
                0178 
                0179 C--   endif master cpu io
                0180         ENDIF
                0181 
                0182 C     endif different multiple
                0183       ENDIF
                0184 
                0185 #endif /* ALLOW_AUTODIFF_MONITOR */
                0186 #endif /* ALLOW_TANGENTLINEAR_RUN */
                0187 
                0188       RETURN
                0189       END