/[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.12 by molod, Fri May 13 18:22:53 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        _RL     myTime
29          INTEGER myIter, myThid
30    
31  c Local variables  c Local variables
32  c ===============  c ===============
33        integer   n        INTEGER   n
34          INTEGER   myItM1, wrIter
35          LOGICAL   dump2fileNow
36          INTEGER thisdate(4), prevdate(4)
37          _RL     freqSec
38          integer realfreq,nsecf2,yymmdd,hhmmss
39    
40          IF ( myIter.NE.nIter0 ) THEN
41            myItM1 = myIter - 1
42    
43  C***********************************************************************  C***********************************************************************
44  C***   Check to see if its time for Diagnostic Output                ***  C***   Check to see IF its time for Diagnostic Output                ***
45  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  
46    
47        return  #ifdef ALLOW_CAL
48        end          IF ( calendarDumps ) THEN
49    C-    Determine calendar dates for this and previous time step.
50               call cal_GetDate(myiter  ,mytime            ,thisdate,mythid)
51               call cal_GetDate(myiter-1,mytime-deltaTClock,prevdate,mythid)
52            ENDIF
53    #endif
54    
55            DO n = 1,nlists
56             realfreq = freq(n)
57    #ifdef ALLOW_FIZHI
58             if( useFIZHI) then
59              yymmdd = int(freq(n))
60              realfreq = nsecf2(0,yymmdd,nymd) / deltaTclock
61             endif
62    #endif
63    
64              IF ( realfreq.LT.0 ) THEN
65                dump2fileNow = MOD(myItM1,-realfreq) .EQ. INT(-realfreq/2)
66    C--     write snap-shot with suffix = myIter to be consistent with
67    C       time-average diagnostics (e.g., freq=-1 & freq=1):
68    c           wrIter = myIter
69    C--     write snap-shot with suffix = myIter-1 to be consistent with
70    C       state-variable time-step:
71                wrIter = myItM1
72              ELSE
73                dump2fileNow = MOD(myIter,realfreq) .EQ. 0
74                wrIter = myIter
75              ENDIF
76    
77    #ifdef ALLOW_CAL
78              freqSec = realfreq * deltaTClock
79              IF ( calendarDumps .AND. (
80         &     ( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 ) .OR.
81         &     ( freqSec.GE.31104000 .AND. freqSec.LE.31968000 ))) THEN
82    C--   Convert approximate months (30-31 days) and years (360-372 days)
83    C     to exact calendar months and years.
84               dump2fileNow = .FALSE.
85    C-    Monthly freqSec:
86               IF( freqSec.GE. 2592000 .AND. freqSec.LE. 2678400 .AND.
87         &        (thisdate(1)-prevdate(1)).GT.50   ) dump2fileNow = .TRUE.
88    C-    Yearly  freqSec:
89               IF( freqSec.GE.31104000 .AND. freqSec.LE.31968000 .AND.
90         &        (thisdate(1)-prevdate(1)).GT.5000 ) dump2fileNow = .TRUE.
91              ENDIF
92    #endif
93    
94              IF ( dump2fileNow ) THEN
95                CALL DIAGNOSTICS_OUT(n,wrIter,myThid)
96              ENDIF
97            ENDDO
98    
99    C-      wait for everyone before setting arrays to zero:
100            _BARRIER
101            DO n = 1,nlists
102             realfreq = freq(n)
103    #ifdef ALLOW_FIZHI
104             if( useFIZHI) then
105              yymmdd = int(freq(n))
106              realfreq = nsecf2(0,yymmdd,nymd) / deltaTclock
107             endif
108    #endif
109              IF ( realfreq.LT.0 ) THEN
110                dump2fileNow = MOD(myItM1,-realfreq) .EQ. INT(-realfreq/2)
111              ELSE
112                dump2fileNow = MOD(myIter,realfreq) .EQ. 0
113              ENDIF
114              IF ( dump2fileNow ) CALL CLRINDX(n,myThid)
115            ENDDO
116    
117    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
118          ENDIF
119    
120          RETURN
121          END

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

  ViewVC Help
Powered by ViewVC 1.1.22