Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
785a077159 Alis*0001 #include "PTRACERS_OPTIONS.h"
                0002 
                0003 CBOP
d2825c6d08 Ed H*0004 C     !ROUTINE: PTRACERS_WRITE_STATE
785a077159 Alis*0005 
d2825c6d08 Ed H*0006 C     !INTERFACE:
d197c88195 Jean*0007       SUBROUTINE PTRACERS_WRITE_STATE(
af20bc5e19 Jean*0008      I                    myTime, myIter, myThid )
785a077159 Alis*0009 
d2825c6d08 Ed H*0010 C     !DESCRIPTION:
169b87f41a Jean*0011 C     dump to files current passive tracer state
785a077159 Alis*0012 
d2825c6d08 Ed H*0013 C     !USES:
785a077159 Alis*0014       IMPLICIT NONE
                0015 #include "SIZE.h"
                0016 #include "EEPARAMS.h"
d2825c6d08 Ed H*0017 #include "PARAMS.h"
636477d15b Jean*0018 #include "PTRACERS_SIZE.h"
0a278985fd Jean*0019 #include "PTRACERS_PARAMS.h"
                0020 #include "PTRACERS_FIELDS.h"
785a077159 Alis*0021 
d2825c6d08 Ed H*0022 C     !INPUT PARAMETERS:
                0023 C     myTime    :: model time
af20bc5e19 Jean*0024 C     myIter    :: time-step number
d2825c6d08 Ed H*0025 C     myThid    :: thread number
785a077159 Alis*0026       _RL myTime
af20bc5e19 Jean*0027       INTEGER myIter
785a077159 Alis*0028       INTEGER myThid
d2825c6d08 Ed H*0029 CEOP
785a077159 Alis*0030 
                0031 #ifdef ALLOW_PTRACERS
                0032 
af20bc5e19 Jean*0033 C     !FUNCTIONS:
d197c88195 Jean*0034       LOGICAL  DIFFERENT_MULTIPLE
                0035       EXTERNAL DIFFERENT_MULTIPLE
                0036       INTEGER  IO_ERRCOUNT
                0037       EXTERNAL IO_ERRCOUNT
                0038 
d2825c6d08 Ed H*0039 C     !LOCAL VARIABLES:
                0040 C     iTracer   :: loop indices
01111eb599 Jean*0041 C     pref      :: character buffer for creating prefix in filename
d2825c6d08 Ed H*0042 C     iRec      :: record number
785a077159 Alis*0043       INTEGER iTracer
af20bc5e19 Jean*0044       CHARACTER*(10) suff
01111eb599 Jean*0045       CHARACTER*(MAX_LEN_FNAM) pref
785a077159 Alis*0046       INTEGER iRec
d197c88195 Jean*0047 #ifdef ALLOW_MNC
b22b541fe9 Ed H*0048       CHARACTER*(1) pf
d197c88195 Jean*0049 #endif
55966bc737 Mart*0050 
94a46dfe0d Jean*0051       IF ( DIFFERENT_MULTIPLE( PTRACERS_dumpFreq, myTime, deltaTClock )
b17871c70b Jean*0052      &  .OR. dumpInitAndLast.AND.( myTime.EQ.endTime .OR.
                0053      &                             myTime.EQ.startTime  )
94a46dfe0d Jean*0054      &   ) THEN
d197c88195 Jean*0055 
                0056 C--   Write to files
                0057        _BARRIER
                0058 
                0059 #ifdef ALLOW_MNC
b22b541fe9 Ed H*0060         IF ( writeBinaryPrec .EQ. precFloat64 ) THEN
                0061           pf(1:1) = 'D'
                0062         ELSE
                0063           pf(1:1) = 'R'
                0064         ENDIF
                0065 
50653b81f1 Ed H*0066        IF ( PTRACERS_snapshot_mnc ) THEN
d2825c6d08 Ed H*0067         CALL MNC_CW_SET_UDIM('ptracers', -1, myThid)
987ff12cb6 Ed H*0068         CALL MNC_CW_RL_W_S('D','ptracers',0,0,'T',myTime,myThid)
d2825c6d08 Ed H*0069         CALL MNC_CW_SET_UDIM('ptracers', 0, myThid)
987ff12cb6 Ed H*0070         CALL MNC_CW_I_W_S('I','ptracers',0,0,'iter',myIter,myThid)
55966bc737 Mart*0071         DO iTracer = 1,PTRACERS_numInUse
b22b541fe9 Ed H*0072          CALL MNC_CW_RL_W(pf,'ptracers',0,0,PTRACERS_names(iTracer),
55966bc737 Mart*0073      &        pTracer(1-OLx,1-OLy,1,1,1,iTracer),myThid)
d2825c6d08 Ed H*0074         ENDDO
55966bc737 Mart*0075        ENDIF
d2825c6d08 Ed H*0076 #endif /*  ALLOW_MNC  */
785a077159 Alis*0077 
50653b81f1 Ed H*0078        IF ( PTRACERS_snapshot_mdsio ) THEN
d2825c6d08 Ed H*0079 
                0080 C       Loop over tracers
                0081         DO iTracer=1,PTRACERS_numInUse
785a077159 Alis*0082 
                0083 #ifdef MULTIPLE_RECORD_STATE_FILES
55966bc737 Mart*0084 C     Write each snap-shot as a record in a time-history file
                0085          IF (PTRACERS_useRecords) THEN
                0086 C     Write each passive tracer as a record
01111eb599 Jean*0087           WRITE(pref,'(A)') 'PTRACERS'
d197c88195 Jean*0088           iRec = 1 + NINT( (myTime-startTime) / PTRACERS_dumpFreq )
55966bc737 Mart*0089           iRec = (iRec-1)*PTRACERS_num + iTracer + 1
                0090          ELSE
                0091 C     Write each passive tracer in its own file
01111eb599 Jean*0092           WRITE(pref,'(2A)') 'PTRACER',PTRACERS_ioLabel(iTracer)
d197c88195 Jean*0093           iRec = 1 + NINT( (myTime-startTime) / PTRACERS_dumpFreq )
55966bc737 Mart*0094          ENDIF
d197c88195 Jean*0095 #else
01111eb599 Jean*0096 C     Write each snap-shot as a new file with a 10-digit suffix to
55966bc737 Mart*0097 C     indicate time-step number
af20bc5e19 Jean*0098          IF ( rwSuffixType.EQ.0 ) THEN
                0099           WRITE(suff,'(I10.10)') myIter
                0100          ELSE
                0101           CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid )
                0102          ENDIF
55966bc737 Mart*0103          IF (PTRACERS_useRecords) THEN
                0104 C     Write each passive tracer as a record
af20bc5e19 Jean*0105           WRITE(pref,'(A,A)') 'PTRACERS.', suff
55966bc737 Mart*0106           iRec=iTracer
                0107          ELSE
                0108 C     Write each passive tracer in its own file
af20bc5e19 Jean*0109           WRITE(pref,'(3A,A)')
                0110      &         'PTRACER', PTRACERS_ioLabel(iTracer), '.', suff
55966bc737 Mart*0111           iRec=1
                0112          ENDIF
785a077159 Alis*0113 #endif /* MULTIPLE_RECORD_STATE_FILES */
d197c88195 Jean*0114 
5357e1c86c Jean*0115 #ifdef ALLOW_OPENAD
82ae1e9576 Oliv*0116          CALL WRITE_REC_XYZ_RL(pref,
                0117      &        pTracer(:,:,:,:,:,iTracer)%v,iRec,myIter,myThid)
                0118 #else
01111eb599 Jean*0119          CALL WRITE_REC_XYZ_RL(pref,
af20bc5e19 Jean*0120      &        pTracer(1-OLx,1-OLy,1,1,1,iTracer),iRec,myIter,myThid)
82ae1e9576 Oliv*0121 #endif
d197c88195 Jean*0122 
55966bc737 Mart*0123 C     End of tracer loop
d2825c6d08 Ed H*0124         ENDDO
d197c88195 Jean*0125 
55966bc737 Mart*0126        ENDIF
                0127 
                0128        _BARRIER
d197c88195 Jean*0129 C--   Writing to files: end
d2825c6d08 Ed H*0130       ENDIF
55966bc737 Mart*0131 
785a077159 Alis*0132 #endif /* ALLOW_PTRACERS */
                0133 
                0134       RETURN
                0135       END