/[MITgcm]/MITgcm/pkg/diagnostics/diagnostics_write.F
ViewVC logotype

Diff of /MITgcm/pkg/diagnostics/diagnostics_write.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by dimitri, Sun Feb 20 11:46:25 2005 UTC revision 1.16 by molod, Tue May 17 00:22:00 2005 UTC
# Line 21  C*************************************** Line 21  C***************************************
21  #include "DIAGNOSTICS.h"  #include "DIAGNOSTICS.h"
22  #include "EEPARAMS.h"  #include "EEPARAMS.h"
23  #include "PARAMS.h"  #include "PARAMS.h"
24    #ifdef ALLOW_FIZHI
25    #include "chronos.h"
26    #endif
27    
28    C     !INPUT PARAMETERS:
29        _RL     myTime        _RL     myTime
30        INTEGER myIter, myThid        INTEGER myIter, myThid
31    
# Line 30  c =============== Line 34  c ===============
34        INTEGER   n        INTEGER   n
35        INTEGER   myItM1, wrIter        INTEGER   myItM1, wrIter
36        LOGICAL   dump2fileNow        LOGICAL   dump2fileNow
37          _RL       phiSec, freqSec, wrTime
38    #ifdef ALLOW_CAL
39        INTEGER thisdate(4), prevdate(4)        INTEGER thisdate(4), prevdate(4)
40        _RL     freqSec  #endif
41    #ifdef ALLOW_FIZHI
42          integer nsecf2,mmdd,hhmmss
43          logical alarm2
44          character *9 tagname
45    #endif
46    
47          LOGICAL  DIFF_PHASE_MULTIPLE
48          EXTERNAL DIFF_PHASE_MULTIPLE
49    
50        IF ( myIter.NE.nIter0 ) THEN        IF ( myIter.NE.nIter0 ) THEN
51          myItM1 = myIter - 1          myItM1 = myIter - 1
# Line 49  C-    Determine calendar dates for this Line 63  C-    Determine calendar dates for this
63  #endif  #endif
64    
65          DO n = 1,nlists          DO n = 1,nlists
66            IF ( freq(n).LT.0 ) THEN            freqSec = freq(n)
67              dump2fileNow = MOD(myItM1,-freq(n)) .EQ. INT(-freq(n)/2)            phiSec = phase(n)
68    #ifdef ALLOW_FIZHI
69             if( useFIZHI) then
70              mmdd = int(freq(n))
71              hhmmss = int((freq(n) - int(freq(n)))*1.e6)
72              freqSec = nsecf2(hhmmss,mmdd,nymd)
73             endif
74    #endif
75    
76              IF ( freqSec.LT.0. ) THEN
77  C--     write snap-shot with suffix = myIter to be consistent with  C--     write snap-shot with suffix = myIter to be consistent with
78  C       time-average diagnostics (e.g., freq=-1 & freq=1):  C       time-average diagnostics (e.g., freq=-1 & freq=1):
79  c           wrIter = myIter  c           wrIter = myIter
80    c           wrTime = myTime
81  C--     write snap-shot with suffix = myIter-1 to be consistent with  C--     write snap-shot with suffix = myIter-1 to be consistent with
82  C       state-variable time-step:  C       state-variable time-step:
83              wrIter = myItM1              wrIter = myItM1
84                wrTime = myTime - deltaTclock
85            ELSE            ELSE
             dump2fileNow = MOD(myIter,freq(n)) .EQ. 0  
86              wrIter = myIter              wrIter = myIter
87                wrTime = myTime
88            ENDIF            ENDIF
89              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
90         &                                        wrTime, deltaTclock )
91    #ifdef ALLOW_FIZHI
92             if( useFIZHI) then
93              write(tagname,'(A,I2.2)')'diagtag',n
94              dump2fileNow = alarm2(tagname)
95             endif
96    #endif
97    
98  #ifdef ALLOW_CAL  #ifdef ALLOW_CAL
           freqSec = freq(n) * deltaTClock  
99            IF ( calendarDumps .AND. (            IF ( calendarDumps .AND. (
100       &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.       &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.
101       &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 )) THEN       &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 ))) THEN
102  C--   Convert approximate months (30-31 days) and years (360-372 days)  C--   Convert approximate months (30-31 days) and years (360-372 days)
103  C     to exact calendar months and years.  C     to exact calendar months and years.
104             dump2fileNow = .FALSE             dump2fileNow = .FALSE.
105  C-    Monthly freqSec:  C-    Monthly freqSec:
106             IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.             IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.
107       &        thisdate-prevdate.GT.50   ) dump2fileNow = .TRUE.       &        (thisdate(1)-prevdate(1)).GT.50   ) dump2fileNow = .TRUE.
108  C-    Yearly  freqSec:  C-    Yearly  freqSec:
109             IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.             IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.
110       &        thisdate-prevdate.GT.5000 ) dump2fileNow = .TRUE.       &        (thisdate(1)-prevdate(1)).GT.5000 ) dump2fileNow = .TRUE.
111            ENDIF            ENDIF
112  #endif  #endif
113    
# Line 87  C-    Yearly  freqSec: Line 119  C-    Yearly  freqSec:
119  C-      wait for everyone before setting arrays to zero:  C-      wait for everyone before setting arrays to zero:
120          _BARRIER          _BARRIER
121          DO n = 1,nlists          DO n = 1,nlists
122            IF ( freq(n).LT.0 ) THEN            freqSec = freq(n)
123              dump2fileNow = MOD(myItM1,-freq(n)) .EQ. INT(-freq(n)/2)            phiSec = phase(n)
124            ELSE  #ifdef ALLOW_FIZHI
125              dump2fileNow = MOD(myIter,freq(n)) .EQ. 0           if( useFIZHI) then
126            ENDIF            mmdd = int(freq(n))
127              hhmmss = int((freq(n) - int(freq(n)))*1.e6)
128              freqSec = nsecf2(hhmmss,mmdd,nymd)
129             endif
130    #endif
131              wrTime = myTime
132              IF ( freqSec.LT.0. ) wrTime = myTime - deltaTclock
133              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
134         &                                        wrTime, deltaTclock )
135    #ifdef ALLOW_FIZHI
136              if( useFIZHI) then
137               write(tagname,'(A,I2.2)')'diagtag',n
138               dump2fileNow = alarm2(tagname)
139              endif
140    #endif
141            IF ( dump2fileNow ) CALL CLRINDX(n,myThid)            IF ( dump2fileNow ) CALL CLRINDX(n,myThid)
142          ENDDO          ENDDO
143    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22