1 |
jmc |
1.14 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.13 2006/10/17 18:22:33 jmc Exp $ |
2 |
mlosch |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PTRACERS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: PTRACERS_MONITOR |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
|
|
SUBROUTINE PTRACERS_MONITOR( |
11 |
jmc |
1.12 |
I myIter, myTime, myThid ) |
12 |
mlosch |
1.1 |
|
13 |
|
|
C !DESCRIPTION: |
14 |
|
|
C writes out ptracer statistics |
15 |
|
|
|
16 |
|
|
C !USES: =============================================================== |
17 |
|
|
IMPLICIT NONE |
18 |
|
|
#include "SIZE.h" |
19 |
|
|
#include "EEPARAMS.h" |
20 |
|
|
#include "PARAMS.h" |
21 |
|
|
#include "GRID.h" |
22 |
|
|
#include "PTRACERS_SIZE.h" |
23 |
jmc |
1.14 |
#include "PTRACERS_PARAMS.h" |
24 |
|
|
#include "PTRACERS_FIELDS.h" |
25 |
mlosch |
1.1 |
#ifdef ALLOW_MONITOR |
26 |
|
|
#include "MONITOR.h" |
27 |
|
|
#endif |
28 |
|
|
|
29 |
|
|
C !INPUT PARAMETERS: =================================================== |
30 |
jmc |
1.12 |
C myTime :: current time |
31 |
|
|
C myIter :: current timestep |
32 |
mlosch |
1.1 |
C myThid :: thread number |
33 |
jmc |
1.12 |
_RL myTime |
34 |
mlosch |
1.1 |
INTEGER myIter |
35 |
|
|
INTEGER myThid |
36 |
|
|
|
37 |
|
|
C === Functions ==== |
38 |
jmc |
1.8 |
LOGICAL DIFFERENT_MULTIPLE |
39 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
40 |
jmc |
1.13 |
LOGICAL MASTER_CPU_IO |
41 |
|
|
EXTERNAL MASTER_CPU_IO |
42 |
mlosch |
1.1 |
|
43 |
|
|
#ifdef ALLOW_PTRACERS |
44 |
|
|
#ifdef ALLOW_MONITOR |
45 |
|
|
|
46 |
|
|
C !LOCAL VARIABLES: ==================================================== |
47 |
|
|
C i,j :: loop indices |
48 |
|
|
C ip :: ptracer number |
49 |
jmc |
1.12 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
50 |
mlosch |
1.1 |
CHARACTER*(MAX_LEN_MBUF) suff |
51 |
jmc |
1.12 |
INTEGER ip |
52 |
mlosch |
1.1 |
CEOP |
53 |
|
|
|
54 |
jmc |
1.12 |
IF ( DIFFERENT_MULTIPLE( PTRACERS_monitorFreq,myTime,deltaTClock ) |
55 |
|
|
& ) THEN |
56 |
mlosch |
1.1 |
|
57 |
jmc |
1.8 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
58 |
mlosch |
1.1 |
|
59 |
jmc |
1.12 |
C-- Ptracers field monitor start |
60 |
jmc |
1.13 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
61 |
|
|
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
62 |
jmc |
1.12 |
C & mon_write_mnc (since it's the only thread that uses those flags): |
63 |
|
|
|
64 |
|
|
IF (monitor_stdio) THEN |
65 |
|
|
mon_write_stdout = .TRUE. |
66 |
|
|
ELSE |
67 |
|
|
mon_write_stdout = .FALSE. |
68 |
|
|
ENDIF |
69 |
|
|
mon_write_mnc = .FALSE. |
70 |
|
|
#ifdef ALLOW_MNC |
71 |
|
|
IF (useMNC .AND. PTRACERS_monitor_mnc) THEN |
72 |
|
|
WRITE(mon_fname,'(A)') 'monitor_ptracer' |
73 |
|
|
CALL MNC_CW_APPEND_VNAME( |
74 |
|
|
& 'T', '-_-_--__-__t', 0,0, myThid) |
75 |
|
|
CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid) |
76 |
|
|
CALL MNC_CW_I_W_S( |
77 |
|
|
& 'I',mon_fname,1,1,'T', myIter, myThid) |
78 |
|
|
CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid) |
79 |
|
|
mon_write_mnc = .TRUE. |
80 |
|
|
ENDIF |
81 |
|
|
#endif /* ALLOW_MNC */ |
82 |
|
|
|
83 |
|
|
IF ( mon_write_stdout ) THEN |
84 |
|
|
WRITE(msgBuf,'(2A)') '// ==========================', |
85 |
|
|
& '=============================' |
86 |
|
|
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
87 |
|
|
WRITE(msgBuf,'(A)') |
88 |
|
|
& '// Begin MONITOR ptracer field statistics' |
89 |
|
|
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
90 |
|
|
WRITE(msgBuf,'(2A)') '// ==========================', |
91 |
|
|
& '=============================' |
92 |
|
|
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
93 |
|
|
ENDIF |
94 |
|
|
|
95 |
jmc |
1.13 |
C-- endif master cpu io |
96 |
mlosch |
1.1 |
ENDIF |
97 |
|
|
|
98 |
jmc |
1.12 |
C-- Ptracers field monitor : compute stats & write |
99 |
|
|
IF ( PTRACERS_monitorFreq .NE. monitorFreq |
100 |
|
|
& .OR. (useMNC.AND.PTRACERS_monitor_mnc) ) THEN |
101 |
|
|
C repeat printing of time to make grepping easier, default is not |
102 |
|
|
C to do this, because the default is to use the same monitorFreq |
103 |
|
|
C for ptracers as for the dynamics variables. |
104 |
mlosch |
1.1 |
CALL MON_SET_PREF('trctime',myThid) |
105 |
|
|
CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid) |
106 |
|
|
CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid) |
107 |
jmc |
1.12 |
ENDIF |
108 |
|
|
C Print the basic statistics of ptracer variables |
109 |
mlosch |
1.1 |
CALL MON_SET_PREF('trcstat_',myThid) |
110 |
|
|
DO ip = 1, PTRACERS_numInUse |
111 |
|
|
WRITE(suff,'(A7,I2.2)') 'ptracer',ip |
112 |
jmc |
1.12 |
c WRITE(suff,'(A7,I3.3)') 'ptrac_', ip |
113 |
mlosch |
1.1 |
CALL MON_PRINTSTATS_RL( |
114 |
jmc |
1.14 |
& Nr, pTracer(1-Olx,1-Oly,1,1,1,ip), |
115 |
mlosch |
1.1 |
& suff, maskC,hFacC,rA ,drF,myThid) |
116 |
|
|
ENDDO |
117 |
|
|
|
118 |
jmc |
1.12 |
C-- Ptracers field monitor finish |
119 |
jmc |
1.13 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
120 |
jmc |
1.12 |
C- only the master thread is allowed to switch On/Off mon_write_stdout |
121 |
|
|
C & mon_write_mnc (since it's the only thread that uses those flags): |
122 |
|
|
|
123 |
|
|
IF ( mon_write_stdout ) THEN |
124 |
mlosch |
1.1 |
WRITE(msgBuf,'(2A)') '// ==========================', |
125 |
|
|
& '=============================' |
126 |
|
|
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
127 |
jmc |
1.12 |
WRITE(msgBuf,'(A)') |
128 |
mlosch |
1.1 |
& '// End MONITOR ptracers field statistics' |
129 |
jmc |
1.12 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
130 |
mlosch |
1.1 |
WRITE(msgBuf,'(2A)') '// ==========================', |
131 |
|
|
& '=============================' |
132 |
|
|
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
133 |
|
|
ENDIF |
134 |
|
|
|
135 |
|
|
mon_write_stdout = .FALSE. |
136 |
jmc |
1.12 |
mon_write_mnc = .FALSE. |
137 |
|
|
|
138 |
jmc |
1.13 |
C- endif master cpu io |
139 |
mlosch |
1.1 |
ENDIF |
140 |
mlosch |
1.9 |
|
141 |
jmc |
1.12 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
142 |
mlosch |
1.9 |
|
143 |
jmc |
1.13 |
C--- endif different multiple |
144 |
mlosch |
1.1 |
ENDIF |
145 |
|
|
|
146 |
|
|
#endif /* ALLOW_MONITOR */ |
147 |
|
|
#endif /* ALLOW_PTRACERS */ |
148 |
|
|
|
149 |
|
|
RETURN |
150 |
|
|
END |