/[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.3 by molod, Thu Feb 26 22:08:49 2004 UTC revision 1.14 by jmc, Sat May 14 20:45:27 2005 UTC
# Line 1  Line 1 
1        subroutine diagnostics_write (myThid, myIter)  C $Header$
2    C $Name$
3    
4    #include "DIAG_OPTIONS.h"
5    
6          SUBROUTINE DIAGNOSTICS_WRITE ( myTime, myIter, myThid )
7  C***********************************************************************  C***********************************************************************
8  C  Purpose  C  Purpose
9  C  -------  C  -------
# Line 6  C    Output sequence for the (multiple) Line 11  C    Output sequence for the (multiple)
11  C  C
12  C  Arguments  Description  C  Arguments  Description
13  C  ----------------------  C  ----------------------
14  C     myIter ..... Current Iteration Number  C     myTime :: Current time of simulation ( s )
15  C     myThid ..... Current Process(or)  C     myIter :: Current Iteration Number
16    C     myThid :: my thread Id number
17  C***********************************************************************  C***********************************************************************
18         implicit none         IMPLICIT NONE
 #include "CPP_OPTIONS.h"  
19  #include "SIZE.h"  #include "SIZE.h"
20  #include "diagnostics_SIZE.h"  #include "DIAGNOSTICS_SIZE.h"
21  #include "diagnostics.h"  #include "DIAGNOSTICS.h"
22    #include "EEPARAMS.h"
23    #include "PARAMS.h"
24    #ifdef ALLOW_FIZHI
25    #include "chronos.h"
26    #endif
27    
28        integer myThid, myIter  C     !INPUT PARAMETERS:
29          _RL     myTime
30          INTEGER myIter, myThid
31    
32  c Local variables  c Local variables
33  c ===============  c ===============
34        integer   n        INTEGER   n
35          INTEGER   myItM1, wrIter
36          LOGICAL   dump2fileNow
37          _RL       phiSec, freqSec, wrTime
38    #ifdef ALLOW_CAL
39          INTEGER thisdate(4), prevdate(4)
40    #endif
41    #ifdef ALLOW_FIZHI
42          integer nsecf2,yymmdd,hhmmss
43    #endif
44    
45          LOGICAL  DIFF_PHASE_MULTIPLE
46          EXTERNAL DIFF_PHASE_MULTIPLE
47    
48          IF ( myIter.NE.nIter0 ) THEN
49            myItM1 = myIter - 1
50    
51  C***********************************************************************  C***********************************************************************
52  C***   Check to see if its time for Diagnostic Output                ***  C***   Check to see IF its time for Diagnostic Output                ***
53  C***********************************************************************  C***********************************************************************
       do n=1,nlists  
       if ( mod(freq(n),myIter).eq.0 ) then  
        call diagout(myThid,myIter,n)  
        call clrindx(myThid,n)  
       endif  
       enddo  
54    
55        return  #ifdef ALLOW_CAL
56        end          IF ( calendarDumps ) THEN
57    C-    Determine calendar dates for this and previous time step.
58               call cal_GetDate(myiter  ,mytime            ,thisdate,mythid)
59               call cal_GetDate(myiter-1,mytime-deltaTClock,prevdate,mythid)
60            ENDIF
61    #endif
62    
63            DO n = 1,nlists
64              freqSec = freq(n)
65              phiSec = phase(n)
66    #ifdef ALLOW_FIZHI
67             if( useFIZHI) then
68              yymmdd = int(freq(n))
69              hhmmss = int((freq(n) - int(freq(n)))*1.e6)
70              freqSec = nsecf2(hhmmss,yymmdd,nymd)
71              yymmdd = int(phase(n))
72              hhmmss = int((phase(n) - int(phase(n)))*1.e6)
73              phiSec = nsecf2(hhmmss,yymmdd,nymd)
74             endif
75    #endif
76    
77              IF ( freqSec.LT.0. ) THEN
78    C--     write snap-shot with suffix = myIter to be consistent with
79    C       time-average diagnostics (e.g., freq=-1 & freq=1):
80    c           wrIter = myIter
81    c           wrTime = myTime
82    C--     write snap-shot with suffix = myIter-1 to be consistent with
83    C       state-variable time-step:
84                wrIter = myItM1
85                wrTime = myTime - deltaTclock
86              ELSE
87                wrIter = myIter
88                wrTime = myTime
89              ENDIF
90              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
91         &                                        wrTime, deltaTclock )
92    
93    #ifdef ALLOW_CAL
94              IF ( calendarDumps .AND. (
95         &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.
96         &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 ))) THEN
97    C--   Convert approximate months (30-31 days) and years (360-372 days)
98    C     to exact calendar months and years.
99               dump2fileNow = .FALSE.
100    C-    Monthly freqSec:
101               IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.
102         &        (thisdate(1)-prevdate(1)).GT.50   ) dump2fileNow = .TRUE.
103    C-    Yearly  freqSec:
104               IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.
105         &        (thisdate(1)-prevdate(1)).GT.5000 ) dump2fileNow = .TRUE.
106              ENDIF
107    #endif
108    
109              IF ( dump2fileNow ) THEN
110                CALL DIAGNOSTICS_OUT(n,wrIter,myThid)
111              ENDIF
112            ENDDO
113    
114    C-      wait for everyone before setting arrays to zero:
115            _BARRIER
116            DO n = 1,nlists
117              freqSec = freq(n)
118              phiSec = phase(n)
119    #ifdef ALLOW_FIZHI
120             if( useFIZHI) then
121              yymmdd = int(freq(n))
122              hhmmss = int((freq(n) - int(freq(n)))*1.e6)
123              freqSec = nsecf2(hhmmss,yymmdd,nymd)
124              yymmdd = int(phase(n))
125              hhmmss = int((phase(n) - int(phase(n)))*1.e6)
126              phiSec = nsecf2(hhmmss,yymmdd,nymd)
127             endif
128    #endif
129              wrTime = myTime
130              IF ( freqSec.LT.0. ) wrTime = myTime - deltaTclock
131              dump2fileNow = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
132         &                                        wrTime, deltaTclock )
133    
134              IF ( dump2fileNow ) CALL CLRINDX(n,myThid)
135            ENDDO
136    
137    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
138          ENDIF
139    
140          RETURN
141          END

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22