1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.17 2009/12/21 00:17:00 jmc Exp $ |
2 |
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 |
I myIter, myTime, myThid ) |
12 |
|
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 |
#include "PTRACERS_PARAMS.h" |
24 |
#include "PTRACERS_FIELDS.h" |
25 |
#ifdef ALLOW_MONITOR |
26 |
#include "MONITOR.h" |
27 |
#endif |
28 |
|
29 |
C !INPUT PARAMETERS: =================================================== |
30 |
C myTime :: current time |
31 |
C myIter :: current timestep |
32 |
C myThid :: thread number |
33 |
_RL myTime |
34 |
INTEGER myIter |
35 |
INTEGER myThid |
36 |
|
37 |
C === Functions ==== |
38 |
LOGICAL DIFFERENT_MULTIPLE |
39 |
EXTERNAL DIFFERENT_MULTIPLE |
40 |
LOGICAL MASTER_CPU_IO |
41 |
EXTERNAL MASTER_CPU_IO |
42 |
|
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 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
50 |
CHARACTER*(MAX_LEN_MBUF) suff |
51 |
INTEGER ip |
52 |
_RL dummyRL(6) |
53 |
CEOP |
54 |
|
55 |
IF ( DIFFERENT_MULTIPLE( PTRACERS_monitorFreq,myTime,deltaTClock ) |
56 |
& ) THEN |
57 |
|
58 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
59 |
|
60 |
C-- Ptracers field monitor start |
61 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
62 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
63 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
64 |
|
65 |
IF (monitor_stdio) THEN |
66 |
mon_write_stdout = .TRUE. |
67 |
ELSE |
68 |
mon_write_stdout = .FALSE. |
69 |
ENDIF |
70 |
mon_write_mnc = .FALSE. |
71 |
#ifdef ALLOW_MNC |
72 |
IF (useMNC .AND. PTRACERS_monitor_mnc) THEN |
73 |
WRITE(mon_fname,'(A)') 'monitor_ptracer' |
74 |
CALL MNC_CW_APPEND_VNAME( |
75 |
& 'T', '-_-_--__-__t', 0,0, myThid) |
76 |
CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid) |
77 |
CALL MNC_CW_RL_W_S( |
78 |
& 'D',mon_fname,1,1,'T', myTime, myThid) |
79 |
CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid) |
80 |
mon_write_mnc = .TRUE. |
81 |
ENDIF |
82 |
#endif /* ALLOW_MNC */ |
83 |
|
84 |
IF ( mon_write_stdout ) THEN |
85 |
WRITE(msgBuf,'(2A)') '// ==========================', |
86 |
& '=============================' |
87 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
88 |
WRITE(msgBuf,'(A)') |
89 |
& '// Begin MONITOR ptracer field statistics' |
90 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
91 |
WRITE(msgBuf,'(2A)') '// ==========================', |
92 |
& '=============================' |
93 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
94 |
ENDIF |
95 |
|
96 |
C-- endif master cpu io |
97 |
ENDIF |
98 |
|
99 |
C-- Ptracers field monitor : compute stats & write |
100 |
IF ( PTRACERS_monitorFreq .NE. monitorFreq |
101 |
& .OR. (useMNC.AND.PTRACERS_monitor_mnc) ) THEN |
102 |
C repeat printing of time to make grepping easier, default is not |
103 |
C to do this, because the default is to use the same monitorFreq |
104 |
C for ptracers as for the dynamics variables. |
105 |
CALL MON_SET_PREF('trctime',myThid) |
106 |
CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid) |
107 |
CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid) |
108 |
ENDIF |
109 |
C Print the basic statistics of ptracer variables |
110 |
CALL MON_SET_PREF('trcstat_',myThid) |
111 |
DO ip = 1, PTRACERS_numInUse |
112 |
WRITE(suff,'(A7,A2)') 'ptracer',PTRACERS_ioLabel(ip) |
113 |
c WRITE(suff,'(A6,I4.4)') 'ptrac', ip |
114 |
CALL MON_WRITESTATS_RL( |
115 |
& Nr, pTracer(1-OLx,1-OLy,1,1,1,ip), suff, |
116 |
& hFacC, maskInC, rA ,drF, dummyRL, myThid ) |
117 |
ENDDO |
118 |
|
119 |
C-- Ptracers field monitor finish |
120 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
121 |
C- only the master thread is allowed to switch On/Off mon_write_stdout |
122 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
123 |
|
124 |
IF ( mon_write_stdout ) THEN |
125 |
WRITE(msgBuf,'(2A)') '// ==========================', |
126 |
& '=============================' |
127 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
128 |
WRITE(msgBuf,'(A)') |
129 |
& '// End MONITOR ptracers field statistics' |
130 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
131 |
WRITE(msgBuf,'(2A)') '// ==========================', |
132 |
& '=============================' |
133 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
134 |
ENDIF |
135 |
|
136 |
mon_write_stdout = .FALSE. |
137 |
mon_write_mnc = .FALSE. |
138 |
|
139 |
C- endif master cpu io |
140 |
ENDIF |
141 |
|
142 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
143 |
|
144 |
C--- endif different multiple |
145 |
ENDIF |
146 |
|
147 |
#endif /* ALLOW_MONITOR */ |
148 |
#endif /* ALLOW_PTRACERS */ |
149 |
|
150 |
RETURN |
151 |
END |