50 |
INTEGER nInterval |
INTEGER nInterval |
51 |
_RL xInterval |
_RL xInterval |
52 |
LOGICAL dBugFlag |
LOGICAL dBugFlag |
53 |
|
INTEGER dBugUnit |
54 |
#ifdef ALLOW_FIZHI |
#ifdef ALLOW_FIZHI |
55 |
LOGICAL alarm2, alarm2next |
LOGICAL ALARM2NEXT |
56 |
|
EXTERNAL ALARM2NEXT |
57 |
CHARACTER *9 tagname |
CHARACTER *9 tagname |
58 |
#endif |
#endif |
59 |
|
|
62 |
|
|
63 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
64 |
|
|
65 |
dBugFlag = debugLevel.GT.debLevB .AND. myThid.EQ.1 |
dBugFlag = debugLevel.GE.debLevE .AND. myThid.EQ.1 |
66 |
|
dBugUnit = errorMessageUnit |
67 |
|
|
68 |
c newIter = 1 + myIter |
c newIter = 1 + myIter |
69 |
DO n = 1,nlists |
DO n = 1,nlists |
74 |
freqSec = freq(n) |
freqSec = freq(n) |
75 |
phiSec = phase(n) |
phiSec = phase(n) |
76 |
time4SnapShot = DIFF_PHASE_MULTIPLE( phiSec, freqSec, |
time4SnapShot = DIFF_PHASE_MULTIPLE( phiSec, freqSec, |
77 |
& myTime, deltaTclock ) |
& myTime, deltaTClock ) |
78 |
#ifdef ALLOW_FIZHI |
#ifdef ALLOW_FIZHI |
79 |
IF ( useFIZHI ) THEN |
IF ( useFIZHI ) THEN |
80 |
WRITE(tagname,'(A,I2.2)')'diagtag',n |
WRITE(tagname,'(A,I2.2)')'diagtag',n |
81 |
time4SnapShot = alarm2next(tagname,deltaT) |
time4SnapShot = ALARM2NEXT(tagname,deltaT) |
82 |
ENDIF |
ENDIF |
83 |
#endif |
#endif |
84 |
|
#ifdef ALLOW_CAL |
85 |
|
IF ( useCAL ) THEN |
86 |
|
CALL CAL_TIME2DUMP( phiSec, freqSec, deltaTClock, |
87 |
|
U time4SnapShot, |
88 |
|
I myTime, myIter, myThid ) |
89 |
|
ENDIF |
90 |
|
#endif /* ALLOW_CAL */ |
91 |
|
|
92 |
DO bj=myByLo(myThid), myByHi(myThid) |
DO bj=myByLo(myThid), myByHi(myThid) |
93 |
DO bi=myBxLo(myThid), myBxHi(myThid) |
DO bi=myBxLo(myThid), myBxHi(myThid) |
116 |
|
|
117 |
IF ( averageCycle(n).GT.1 ) THEN |
IF ( averageCycle(n).GT.1 ) THEN |
118 |
C-- Select diagnostics list that uses periodic averaging |
C-- Select diagnostics list that uses periodic averaging |
119 |
xInterval = myTime + deltaTclock*0.5 _d 0 - averagePhase(n) |
xInterval = myTime + deltaTClock*0.5 _d 0 - averagePhase(n) |
120 |
xInterval = xInterval / averageFreq(n) |
xInterval = xInterval / averageFreq(n) |
121 |
IF ( xInterval.GE.0. ) THEN |
IF ( xInterval.GE.0. ) THEN |
122 |
nInterval = INT(xInterval) |
nInterval = INT(xInterval) |
128 |
|
|
129 |
C- check future value of pdiag: |
C- check future value of pdiag: |
130 |
IF (dBugFlag.AND.pdiag(n,1,1).NE.nInterval) |
IF (dBugFlag.AND.pdiag(n,1,1).NE.nInterval) |
131 |
& WRITE(0,'(A,I8,3(A,I3),F17.6)') 'DIAG_SWITCH_ONOFF: at it=', |
& WRITE(dBugUnit,'(A,I8,3(A,I4),F17.6)') |
132 |
& myIter, ', list:', n, ' switch', |
& 'DIAG_SWITCH_ONOFF: at it=', myIter, ', list:', n, |
133 |
& pdiag(n,1,1),' ->', nInterval, xInterval |
& ' switch', pdiag(n,1,1),' ->', nInterval, xInterval |
134 |
IF ( nInterval.LT.0 .OR. nInterval.GE.averageCycle(n) ) THEN |
IF ( nInterval.LT.0 .OR. nInterval.GE.averageCycle(n) ) THEN |
135 |
WRITE(msgBuf,'(2A,I2,A,I4)') 'DIAGNOSTICS_SWITCH_ONOFF:', |
WRITE(msgBuf,'(2A,I3,A,I4)') 'DIAGNOSTICS_SWITCH_ONOFF:', |
136 |
& ' error setting pdiag(n=',n,') to:', nInterval |
& ' error setting pdiag(n=',n,') to:', nInterval |
137 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |
138 |
WRITE(msgBuf,'(2A,I3,A,F17.6)') 'DIAGNOSTICS_SWITCH_ONOFF:', |
WRITE(msgBuf,'(2A,I4,A,F17.6)') 'DIAGNOSTICS_SWITCH_ONOFF:', |
139 |
& ' cycle=', averageCycle(n), ', xInt=', xInterval |
& ' cycle=', averageCycle(n), ', xInt=', xInterval |
140 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |
141 |
STOP 'ABNORMAL END: S/R DIAGNOSTICS_SWITCH_ONOFF' |
STOP 'ABNORMAL END: S/R DIAGNOSTICS_SWITCH_ONOFF' |
158 |
IF ( diagSt_freq(n).LT.0. ) THEN |
IF ( diagSt_freq(n).LT.0. ) THEN |
159 |
C-- Select diagnostics list that uses instantaneous output |
C-- Select diagnostics list that uses instantaneous output |
160 |
|
|
161 |
dBugFlag = debugLevel.GT.debLevB |
dBugFlag = debugLevel.GE.debLevE |
162 |
|
|
163 |
freqSec = diagSt_freq(n) |
freqSec = diagSt_freq(n) |
164 |
phiSec = diagSt_phase(n) |
phiSec = diagSt_phase(n) |
165 |
time4SnapShot = DIFF_PHASE_MULTIPLE( phiSec, freqSec, |
time4SnapShot = DIFF_PHASE_MULTIPLE( phiSec, freqSec, |
166 |
& myTime, deltaTclock ) |
& myTime, deltaTClock ) |
167 |
|
|
168 |
#ifdef ALLOW_FIZHI |
#ifdef ALLOW_FIZHI |
169 |
IF ( useFIZHI ) THEN |
IF ( useFIZHI ) THEN |
170 |
WRITE(tagname,'(A,I2.2)')'diagStg',n |
WRITE(tagname,'(A,I2.2)')'diagStg',n |
171 |
time4SnapShot = alarm2next(tagname,deltaT) |
time4SnapShot = ALARM2NEXT(tagname,deltaT) |
172 |
ENDIF |
ENDIF |
173 |
#endif |
#endif |
174 |
|
#ifdef ALLOW_CAL |
175 |
|
IF ( useCAL ) THEN |
176 |
|
CALL CAL_TIME2DUMP( phiSec, freqSec, deltaTClock, |
177 |
|
U time4SnapShot, |
178 |
|
I myTime, myIter, myThid ) |
179 |
|
ENDIF |
180 |
|
#endif /* ALLOW_CAL */ |
181 |
|
|
182 |
DO bj=myByLo(myThid), myByHi(myThid) |
DO bj=myByLo(myThid), myByHi(myThid) |
183 |
DO bi=myBxLo(myThid), myBxHi(myThid) |
DO bi=myBxLo(myThid), myBxHi(myThid) |
189 |
IF (iSp.GT.0) THEN |
IF (iSp.GT.0) THEN |
190 |
nd = jSdiag(m,n) |
nd = jSdiag(m,n) |
191 |
IF (dBugFlag.AND.qSdiag(0,0,iSp,bi,bj).NE. 0.) |
IF (dBugFlag.AND.qSdiag(0,0,iSp,bi,bj).NE. 0.) |
192 |
& WRITE(0,'(I8,I4,3A,1PE10.3,A,I3)') myIter, |
& WRITE(dBugUnit,'(A,I8,A,I6,3A,1PE10.3,A,I3)') |
193 |
& nd,' ',cdiag(nd),' :',qSdiag(0,0,iSp,bi,bj),' ->', 0 |
& 'DIAG_SWITCH_ONOFF: at it=', myIter, ' diag:', nd, |
194 |
|
& ' ',cdiag(nd),' :',qSdiag(0,0,iSp,bi,bj),' ->', 0 |
195 |
qSdiag(0,0,iSp,bi,bj) = 0. |
qSdiag(0,0,iSp,bi,bj) = 0. |
196 |
ENDIF |
ENDIF |
197 |
ENDDO |
ENDDO |
202 |
IF (iSp.GT.0) THEN |
IF (iSp.GT.0) THEN |
203 |
nd = jSdiag(m,n) |
nd = jSdiag(m,n) |
204 |
IF (dBugFlag.AND.qSdiag(0,0,iSp,bi,bj).NE.-1.) |
IF (dBugFlag.AND.qSdiag(0,0,iSp,bi,bj).NE.-1.) |
205 |
& WRITE(0,'(I8,I4,3A,1PE10.3,A,I3)') myIter, |
& WRITE(dBugUnit,'(A,I8,A,I6,3A,1PE10.3,A,I3)') |
206 |
& nd,' ',cdiag(nd),' :',qSdiag(0,0,iSp,bi,bj),' ->',-1 |
& 'DIAG_SWITCH_ONOFF: at it=', myIter, ' diag:', nd, |
207 |
|
& ' ',cdiag(nd),' :',qSdiag(0,0,iSp,bi,bj),' ->', -1 |
208 |
qSdiag(0,0,iSp,bi,bj) = -1. |
qSdiag(0,0,iSp,bi,bj) = -1. |
209 |
ENDIF |
ENDIF |
210 |
ENDDO |
ENDDO |