Back to home page

MITgcm

 
 

    


File indexing completed on 2018-10-18 05:09:57 UTC

view on githubraw file Latest commit 52dd931a on 2018-10-17 20:00:48 UTC
52dd931a85 Timo*0001 #include "AUTODIFF_OPTIONS.h"
                0002 #ifdef ALLOW_CTRL
                0003 # include "CTRL_OPTIONS.h"
                0004 #endif
                0005 #include "AD_CONFIG.h"
                0006 
                0007 CBOP
                0008 C     !ROUTINE: g_dummy_for_etan
                0009 C     !INTERFACE:
                0010       subroutine g_dummy_for_etan( myTime, myIter, myThid )
                0011 
                0012 C     !DESCRIPTION: \bv
                0013 C     *==========================================================*
                0014 C     | SUBROUTINE g_dummy_for_etan                              |
                0015 C     *==========================================================*
                0016 C     Extract tangent linear variable from TAMC/TAF-generated
                0017 C     tangent linear common blocks, contained in g_common.h
                0018 C     and write fields to file;
                0019 C     Make sure common blocks in g_common.h are up-to-date
                0020 C     w.r.t. current adjoint code.
                0021 C     *==========================================================*
                0022 C     | SUBROUTINE g_dummy_for_etan                              |
                0023 C     *==========================================================*
                0024 C     \ev
                0025 
                0026 C     !USES:
                0027       IMPLICIT NONE
                0028 
                0029 C     == Global variables ===
                0030 #include "SIZE.h"
                0031 #include "EEPARAMS.h"
                0032 #include "PARAMS.h"
                0033 #ifdef ALLOW_AUTODIFF_MONITOR
                0034 # include "g_common.h"
                0035 #endif
                0036 
                0037 C     !INPUT/OUTPUT PARAMETERS:
                0038 C     == Routine arguments ==
                0039 C     myIter :: iteration counter for this thread
                0040 C     myTime :: time counter for this thread
                0041 C     myThid :: Thread number for this instance of the routine.
                0042       INTEGER myThid
                0043       INTEGER myIter
                0044       _RL     myTime
                0045 
                0046 #ifdef ALLOW_TANGENTLINEAR_RUN
                0047 #ifdef ALLOW_AUTODIFF_MONITOR
                0048 
                0049 C     !FUNCTIONS:
                0050       LOGICAL  DIFFERENT_MULTIPLE
                0051       EXTERNAL DIFFERENT_MULTIPLE
                0052       INTEGER  IO_ERRCOUNT
                0053       EXTERNAL IO_ERRCOUNT
                0054 
                0055 C     !LOCAL VARIABLES:
                0056 c     == local variables ==
                0057 C     suff   :: Hold suffix part of a filename
                0058 C     msgBuf :: Error message buffer
                0059       CHARACTER*(10) suff
                0060       INTEGER beginIOErrCount
                0061       INTEGER endIOErrCount
                0062       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0063 CEOP
                0064 
                0065       IF (
                0066      &  DIFFERENT_MULTIPLE(adjDumpFreq,myTime,deltaTClock)
                0067      &   ) THEN
                0068 
                0069         CALL TIMER_START('I/O (WRITE)        [ADJOINT LOOP]', myThid )
                0070 c       write(*,*) 'myIter= ',myIter
                0071 
                0072 C--     Set suffix for this set of data files.
                0073         IF ( rwSuffixType.EQ.0 ) THEN
                0074           WRITE(suff,'(I10.10)') myIter
                0075         ELSE
                0076           CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid )
                0077         ENDIF
                0078 
                0079 C--     Read IO error counter
                0080         beginIOErrCount = IO_ERRCOUNT(myThid)
                0081 
                0082         CALL WRITE_FLD_XY_RL(
                0083      &       'G_Jetan.',suff, g_etan, myIter, myThid )
                0084 
                0085 
                0086 C--     Reread IO error counter
                0087         endIOErrCount = IO_ERRCOUNT(myThid)
                0088 
                0089 C--     Check for IO errors
                0090         IF ( endIOErrCount .NE. beginIOErrCount ) THEN
                0091          WRITE(msgBuf,'(A)')  'S/R WRITE_STATE'
                0092          CALL PRINT_ERROR( msgBuf, myThid )
                0093          WRITE(msgBuf,'(A)')  'Error writing out G_Jetan'
                0094          CALL PRINT_ERROR( msgBuf, myThid )
                0095          WRITE(msgBuf,'(A,I10)') 'Timestep ',myIter
                0096          CALL PRINT_ERROR( msgBuf, myThid )
                0097         ELSE
                0098          WRITE(msgBuf,'(A,I10)')
                0099      &    '// g_JetaN written, timestep', myIter
                0100          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0101      &                       SQUEEZE_RIGHT, myThid )
                0102          WRITE(msgBuf,'(A)')  ' '
                0103          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0104      &                       SQUEEZE_RIGHT, myThid )
                0105         ENDIF
                0106 
                0107         CALL TIMER_STOP( 'I/O (WRITE)        [ADJOINT LOOP]', myThid )
                0108 
                0109       ENDIF
                0110 
                0111 #endif /* ALLOW_AUTODIFF_MONITOR */
                0112 #endif /* ALLOW_TANGENTLINEAR_RUN */
                0113 
                0114       RETURN
                0115       END