1 |
C $Header: /u/gcmpack/MITgcm/pkg/diagnostics/diagnostics_switch_onoff.F,v 1.1 2004/12/20 01:53:53 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( 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 |
|
32 |
C !INPUT PARAMETERS: |
33 |
C myIter :: current Iteration number |
34 |
C myThid :: my Thread Id number |
35 |
INTEGER myIter |
36 |
INTEGER myThid |
37 |
CEOP |
38 |
|
39 |
C !LOCAL VARIABLES: |
40 |
C newIter :: future iteration number |
41 |
C j,m,n :: loop index |
42 |
c CHARACTER*(MAX_LEN_MBUF) msgBuf |
43 |
INTEGER newIter |
44 |
INTEGER j, m, n |
45 |
|
46 |
_BEGIN_MASTER(myThid) |
47 |
|
48 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
49 |
|
50 |
newIter = 1 + myIter |
51 |
DO n = 1,nlists |
52 |
IF ( freq(n).LT.0 ) THEN |
53 |
C-- Select diagnostics list that uses instantaneous output |
54 |
|
55 |
c IF ( MOD(newIter,freq(n)).EQ.0 ) THEN |
56 |
IF ( MOD(myIter,-freq(n)).EQ.INT(-freq(n)/2) ) THEN |
57 |
C-- switch ON diagnostics of output-stream # n |
58 |
DO m=1,nActive(n) |
59 |
j = jdiag(m,n) |
60 |
c IF (ndiag(j).NE.0) WRITE(0,*) myIter,j,ndiag(j),' ->',0 |
61 |
ndiag(j) = 0 |
62 |
ENDDO |
63 |
ELSE |
64 |
C-- switch OFF diagnostics of output-stream # n |
65 |
DO m=1,nActive(n) |
66 |
j = jdiag(m,n) |
67 |
c IF (ndiag(j).NE.-1) WRITE(0,*) myIter,j,ndiag(j),' ->',-1 |
68 |
ndiag(j) = -1 |
69 |
ENDDO |
70 |
ENDIF |
71 |
|
72 |
ENDIF |
73 |
ENDDO |
74 |
|
75 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
76 |
|
77 |
_END_MASTER(myThid) |
78 |
|
79 |
C-jmc: do we need a "BARRIER" at this point ? |
80 |
c _BARRIER |
81 |
|
82 |
RETURN |
83 |
END |