Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:43:06 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
1eeb28fe07 Alis*0001 #include "RUNCLOCK_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C     !ROUTINE: RUNCLOCK_CONTINUE
                0005 C     !INTERFACE:
                0006       FUNCTION RUNCLOCK_CONTINUE( myThid )
                0007 
                0008 C     !DESCRIPTION: \bv
                0009 C     *==========================================================*
                0010 C     | FUNCTION RUNCLOCK_CONTINUE
                0011 C     | o Function to signal time to termiante run
                0012 C     *==========================================================*
                0013 C     \ev
                0014 C     !USES:
                0015       IMPLICIT NONE
                0016 
                0017 C     === Global variables ===
                0018 #include "EEPARAMS.h"
                0019 #include "RUNCLOCK.h"
                0020 
                0021 C     !INPUT/OUTPUT PARAMETERS:
                0022 C     === Routine arguments ===
                0023 C     myThid ::  my Thread Id number
                0024       LOGICAL RUNCLOCK_CONTINUE
                0025       INTEGER myThid
                0026 CEOP
                0027 
                0028 #ifdef ALLOW_RUNCLOCK
                0029 
                0030 C     !LOCAL VARIABLES:
                0031 C     === Local variables ===
                0032       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0033       INTEGER RC_now_yr,RC_now_mo,RC_now_dy
                0034       INTEGER RC_now_hr,RC_now_mi,RC_now_sc
                0035       INTEGER dd,dh,dm,ds
                0036       INTEGER elapsed_secs,maxtime_secs
                0037       Real*8 tins,ETmax
                0038 
                0039       _BEGIN_MASTER(myThid)
                0040       IF (.NOT.RUNCLOCKIsOn) THEN
                0041        WRITE(msgBuf,'(A)') ' RUNCLOCK_CONTINUE: RUNCLOCK not turned on'
                0042        CALL PRINT_ERROR( msgBuf, myThid ) 
                0043       ENDIF
                0044       _END_MASTER(myThid)
                0045 
                0046 C     Get the current wall-clock time
                0047       CALL runclock_gettime(
                0048      &   RC_now_yr,RC_now_mo,RC_now_dy,
                0049      &   RC_now_hr,RC_now_mi,RC_now_sc,
                0050      &   tins)
                0051 
                0052       CALL GLOBAL_MAX_R8(tins,myThid)
                0053 
                0054 c     write(0,*) 'RUNCLOCK_CONTINUE: yr mo dy hr mi sc tins',
                0055 c    &   RC_now_yr,RC_now_mo,RC_now_dy,
                0056 c    &   RC_now_hr,RC_now_mi,RC_now_sc,
                0057 c    &   tins
                0058 
                0059       ds=RC_now_sc-RC_start_sc
                0060       dm=RC_now_mi-RC_start_mi
                0061       dh=RC_now_hr-RC_start_hr
                0062       dd=RC_now_dy-RC_start_dy
                0063 c     write(0,'(A,4I3)') 'RUNCLOCK_CONTINUE: dy hr mi sc',dd,dh,dm,ds
                0064 
                0065       ETmax=((dd*24.+dh)*60.+dm)*60.+ds
                0066       CALL GLOBAL_MAX_R8(ETmax,myThid)
                0067       elapsed_secs=ETmax
                0068 c     elapsed_secs=((dd*24.+dh)*60.+dm)*60.+ds
                0069       maxtime_secs=(RC_MaxTime_hr*60+RC_MaxTime_mi)*60+RC_MaxTime_sc
                0070 
                0071       _BEGIN_MASTER(myThid)
                0072 c     write(0,*) ' RUNCLOCK_CONTINUE: elapsed=',elapsed_secs,maxtime_secs
                0073 
                0074 c     IF (myProcID.EQ.0)
                0075 c    & write(0,'(A,4I3,2I6,F)') 'RUNCLOCK_CONTINUE: dy hr mi sc el mx',
                0076 c    &  dd,dh,dm,ds,elapsed_secs,maxtime_secs,tins-RC_start_tins
                0077 
                0078       WRITE(msgBuf,'(A,G16.6,G24.10)') ' RUNCLOCK: dT,T-To =',
                0079      &  tins-RC_prev_tins,tins-RC_start_tins
                0080       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0081      &                    SQUEEZE_RIGHT , 1)
                0082       RC_prev_tins=tins
                0083 
                0084       IF (maxtime_secs.ne.0 .AND. elapsed_secs.GT.maxtime_secs) THEN
                0085        RUNCLOCK_CONTINUE=.FALSE.
fc2e08fa67 Cons*0086        WRITE(msgBuf,'(A)') 
                0087      & ' RUNCLOCK_CONTINUE: Wall Clock limit reached!'
1eeb28fe07 Alis*0088        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0089      &                    SQUEEZE_RIGHT , 1)
                0090        CALL PRINT_ERROR( msgBuf, myThid )
                0091        WRITE(msgBuf,'(A)') ' RUNCLOCK_CONTINUE: Ending run now ...'
                0092        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0093      &                    SQUEEZE_RIGHT , 1)
                0094        CALL PRINT_ERROR( msgBuf, myThid )
                0095        RETURN
                0096       ENDIF
                0097 
                0098       _END_MASTER(myThid)
                0099 
                0100 #endif /* ALLOW_RUNCLOCK */
                0101 
                0102       RUNCLOCK_CONTINUE=.TRUE.
                0103 
                0104       RETURN
                0105       END