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

Contents of /MITgcm/pkg/diagnostics/diagnostics_switch_onoff.F

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


Revision 1.7 - (show annotations) (download)
Mon May 16 23:41:32 2005 UTC (18 years, 11 months ago) by molod
Branch: MAIN
Changes since 1.6: +9 -10 lines
Use alarm system for diagnostics when fizhi is in use

1 C $Header: /u/gcmpack/MITgcm/pkg/diagnostics/diagnostics_switch_onoff.F,v 1.6 2005/05/15 03:36:19 jmc Exp $
2 C $Name: $
3
4 #include "DIAG_OPTIONS.h"
5
6 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7 CBOP 0
8 C !ROUTINE: DIAGNOSTICS_SWITCH_ONOFF
9
10 C !INTERFACE:
11 SUBROUTINE DIAGNOSTICS_SWITCH_ONOFF( myTime, myIter, myThid )
12
13 C !DESCRIPTION:
14 C-----
15 C Called at the beginning of the time-step,
16 C to switch on/off diagnostics for snap-shot output
17 C-----
18 C during iterations that are multiple of |freq|,
19 C switch ON diagnostics (ndiag>=0) that will become active
20 C and then can be written at the end of the time-step ;
21 C otherwise, put diagnostics in non-active mode (ndiag=-1)
22 C-----
23
24 C !USES:
25 IMPLICIT NONE
26 #include "SIZE.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "DIAGNOSTICS_SIZE.h"
30 #include "DIAGNOSTICS.h"
31 #ifdef ALLOW_FIZHI
32 #include "chronos.h"
33 #endif
34
35 C !INPUT PARAMETERS:
36 C myTime :: current Time of simulation ( s )
37 C myIter :: current Iteration number
38 C myThid :: my Thread Id number
39 _RL myTime
40 INTEGER myIter
41 INTEGER myThid
42 CEOP
43
44 C !LOCAL VARIABLES:
45 C newIter :: future iteration number
46 C j,m,n :: loop index
47 c CHARACTER*(MAX_LEN_MBUF) msgBuf
48 c INTEGER newIter
49 INTEGER j, m, n
50 LOGICAL time4SnapShot
51 _RL phiSec, freqSec
52 #ifdef ALLOW_FIZHI
53 integer mmdd,hhmmss,nsecf2,alarm2
54 character *9 tagname
55 #endif
56
57 LOGICAL DIFF_PHASE_MULTIPLE
58 EXTERNAL DIFF_PHASE_MULTIPLE
59
60 _BEGIN_MASTER(myThid)
61
62 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
63
64 c newIter = 1 + myIter
65 DO n = 1,nlists
66
67 IF ( freq(n).LT.0. ) THEN
68 C-- Select diagnostics list that uses instantaneous output
69
70 freqSec = freq(n)
71 phiSec = phase(n)
72 time4SnapShot = DIFF_PHASE_MULTIPLE( phiSec, freqSec,
73 & myTime, deltaTclock )
74 #ifdef ALLOW_FIZHI
75 if( useFIZHI) then
76 mmdd = int(freq(n))
77 hhmmss = int((freq(n) - int(freq(n)))*1.e6)
78 freqSec = nsecf2(hhmmss,mmdd,nymd)
79 write(tagname,'(A,I2.2)')'diagtag',n
80 time4SnapShot = alarm2(tagname)
81 endif
82 #endif
83
84 IF ( time4SnapShot ) THEN
85 C-- switch ON diagnostics of output-stream # n
86 DO m=1,nActive(n)
87 j = jdiag(m,n)
88 c IF (ndiag(j).NE.0) WRITE(0,*) myIter,j,ndiag(j),' ->',0
89 ndiag(j) = 0
90 ENDDO
91 ELSE
92 C-- switch OFF diagnostics of output-stream # n
93 DO m=1,nActive(n)
94 j = jdiag(m,n)
95 c IF (ndiag(j).NE.-1) WRITE(0,*) myIter,j,ndiag(j),' ->',-1
96 ndiag(j) = -1
97 ENDDO
98 ENDIF
99
100 ENDIF
101 ENDDO
102
103 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
104
105 _END_MASTER(myThid)
106
107 C-jmc: do we need a "BARRIER" at this point ?
108 c _BARRIER
109
110 RETURN
111 END

  ViewVC Help
Powered by ViewVC 1.1.22