/[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.21 by molod, Tue Jun 14 22:30:02 2005 UTC
# Line 22  C*************************************** Line 22  C***************************************
22  #include "EEPARAMS.h"  #include "EEPARAMS.h"
23  #include "PARAMS.h"  #include "PARAMS.h"
24    
25    C     !INPUT PARAMETERS:
26        _RL     myTime        _RL     myTime
27        INTEGER myIter, myThid        INTEGER myIter, myThid
28    
# Line 30  c =============== Line 31  c ===============
31        INTEGER   n        INTEGER   n
32        INTEGER   myItM1, wrIter        INTEGER   myItM1, wrIter
33        LOGICAL   dump2fileNow        LOGICAL   dump2fileNow
34          _RL       phiSec, freqSec, wrTime
35    #ifdef ALLOW_CAL
36        INTEGER thisdate(4), prevdate(4)        INTEGER thisdate(4), prevdate(4)
37        _RL     freqSec  #endif
38    #ifdef ALLOW_FIZHI
39          logical alarm2
40          character *9 tagname
41    #endif
42    
43          LOGICAL  DIFF_PHASE_MULTIPLE
44          EXTERNAL DIFF_PHASE_MULTIPLE
45    
46        IF ( myIter.NE.nIter0 ) THEN        IF ( myIter.NE.nIter0 ) THEN
47          myItM1 = myIter - 1          myItM1 = myIter - 1
# Line 49  C-    Determine calendar dates for this Line 59  C-    Determine calendar dates for this
59  #endif  #endif
60    
61          DO n = 1,nlists          DO n = 1,nlists
62            IF ( freq(n).LT.0 ) THEN            freqSec = freq(n)
63              dump2fileNow = MOD(myItM1,-freq(n)) .EQ. INT(-freq(n)/2)            phiSec = phase(n)
64    
65              IF ( freqSec.LT.0. ) THEN
66  C--     write snap-shot with suffix = myIter to be consistent with  C--     write snap-shot with suffix = myIter to be consistent with
67  C       time-average diagnostics (e.g., freq=-1 & freq=1):  C       time-average diagnostics (e.g., freq=-1 & freq=1):
68  c           wrIter = myIter  c           wrIter = myIter
69    c           wrTime = myTime
70  C--     write snap-shot with suffix = myIter-1 to be consistent with  C--     write snap-shot with suffix = myIter-1 to be consistent with
71  C       state-variable time-step:  C       state-variable time-step:
72              wrIter = myItM1              wrIter = myItM1
73                wrTime = myTime - deltaTclock
74            ELSE            ELSE
             dump2fileNow = MOD(myIter,freq(n)) .EQ. 0  
75              wrIter = myIter              wrIter = myIter
76                wrTime = myTime
77            ENDIF            ENDIF
78              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
79         &                                        wrTime, deltaTclock )
80    #ifdef ALLOW_FIZHI
81             if( useFIZHI) then
82              write(tagname,'(A,I2.2)')'diagtag',n
83              dump2fileNow = alarm2(tagname)
84             endif
85    #endif
86    
87  #ifdef ALLOW_CAL  #ifdef ALLOW_CAL
           freqSec = freq(n) * deltaTClock  
88            IF ( calendarDumps .AND. (            IF ( calendarDumps .AND. (
89       &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.       &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.
90       &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 )) THEN       &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 ))) THEN
91  C--   Convert approximate months (30-31 days) and years (360-372 days)  C--   Convert approximate months (30-31 days) and years (360-372 days)
92  C     to exact calendar months and years.  C     to exact calendar months and years.
93             dump2fileNow = .FALSE             dump2fileNow = .FALSE.
94  C-    Monthly freqSec:  C-    Monthly freqSec:
95             IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.             IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.
96       &        thisdate-prevdate.GT.50   ) dump2fileNow = .TRUE.       &        (thisdate(1)-prevdate(1)).GT.50   ) dump2fileNow = .TRUE.
97  C-    Yearly  freqSec:  C-    Yearly  freqSec:
98             IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.             IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.
99       &        thisdate-prevdate.GT.5000 ) dump2fileNow = .TRUE.       &        (thisdate(1)-prevdate(1)).GT.5000 ) dump2fileNow = .TRUE.
100              ENDIF
101    #endif
102    
103              IF ( dump2fileNow .or. (myIter.eq.nIter0+nTimeSteps) ) THEN
104                CALL DIAGNOSTICS_OUT(n,wrIter,myTime,myThid)
105              ENDIF
106            ENDDO
107    
108    C---   Check to see IF its time for Statistics Diag. Output
109    
110            DO n = 1,diagSt_nbLists
111              freqSec = diagSt_freq(n)
112              phiSec = diagSt_phase(n)
113    
114              IF ( freqSec.LT.0. ) THEN
115    C--     write snap-shot with suffix = myIter to be consistent with
116    C       time-average diagnostics (e.g., freq=-1 & freq=1):
117    c           wrIter = myIter
118    c           wrTime = myTime
119    C--     write snap-shot with suffix = myIter-1 to be consistent with
120    C       state-variable time-step:
121                wrIter = myItM1
122                wrTime = myTime - deltaTclock
123              ELSE
124                wrIter = myIter
125                wrTime = myTime
126            ENDIF            ENDIF
127              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
128         &                                        wrTime, deltaTclock )
129    #ifdef ALLOW_FIZHI
130             if( useFIZHI) then
131              write(tagname,'(A,I2.2)')'diagStg',n
132              dump2fileNow = alarm2(tagname)
133             endif
134  #endif  #endif
135    
136            IF ( dump2fileNow ) THEN            IF ( dump2fileNow .or. (myIter.eq.nIter0+nTimeSteps) ) THEN
137              CALL DIAGNOSTICS_OUT(n,wrIter,myThid)              CALL DIAGSTATS_OUTPUT(n,wrIter,myThid)
138            ENDIF            ENDIF
139          ENDDO          ENDDO
140    
141    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
142  C-      wait for everyone before setting arrays to zero:  C-      wait for everyone before setting arrays to zero:
143          _BARRIER          _BARRIER
144    
145    C--     Clear storage space:
146    
147          DO n = 1,nlists          DO n = 1,nlists
148            IF ( freq(n).LT.0 ) THEN            freqSec = freq(n)
149              dump2fileNow = MOD(myItM1,-freq(n)) .EQ. INT(-freq(n)/2)            phiSec = phase(n)
150            ELSE  
151              dump2fileNow = MOD(myIter,freq(n)) .EQ. 0            wrTime = myTime
152              IF ( freqSec.LT.0. ) wrTime = myTime - deltaTclock
153              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
154         &                                        wrTime, deltaTclock )
155    #ifdef ALLOW_FIZHI
156              if( useFIZHI) then
157               write(tagname,'(A,I2.2)')'diagtag',n
158               dump2fileNow = alarm2(tagname)
159              endif
160    #endif
161    
162    #ifdef ALLOW_CAL
163              IF ( calendarDumps .AND. (
164         &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.
165         &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 ))) THEN
166    C--   Convert approximate months (30-31 days) and years (360-372 days)
167    C     to exact calendar months and years.
168               dump2fileNow = .FALSE.
169    C-    Monthly freqSec:
170               IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.
171         &        (thisdate(1)-prevdate(1)).GT.50   ) dump2fileNow = .TRUE.
172    C-    Yearly  freqSec:
173               IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.
174         &        (thisdate(1)-prevdate(1)).GT.5000 ) dump2fileNow = .TRUE.
175            ENDIF            ENDIF
176            IF ( dump2fileNow ) CALL CLRINDX(n,myThid)  #endif
177    
178              IF ( dump2fileNow .or. (myIter.eq.nIter0+nTimeSteps) )
179         .                             CALL CLRINDX(n,myThid)
180            ENDDO
181    
182            DO n = 1,diagSt_nbLists
183              freqSec = diagSt_freq(n)
184              phiSec = diagSt_phase(n)
185              wrTime = myTime
186              IF ( freqSec.LT.0. ) wrTime = myTime - deltaTclock
187              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
188         &                                        wrTime, deltaTclock )
189    #ifdef ALLOW_FIZHI
190             if( useFIZHI) then
191              write(tagname,'(A,I2.2)')'diagStg',n
192              dump2fileNow = alarm2(tagname)
193             endif
194    #endif
195              IF ( dump2fileNow .or. (myIter.eq.nIter0+nTimeSteps) )
196         .                             CALL DIAGSTATS_CLEAR(n,myThid)
197          ENDDO          ENDDO
198    
199  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|

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

  ViewVC Help
Powered by ViewVC 1.1.22