1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.9 2005/10/11 08:35:36 mlosch 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 |
#ifdef ALLOW_MNC |
22 |
#include "MNC_PARAMS.h" |
23 |
#endif |
24 |
#include "EESUPPORT.h" |
25 |
#include "DYNVARS.h" |
26 |
#include "GRID.h" |
27 |
#include "PTRACERS_SIZE.h" |
28 |
#include "PTRACERS.h" |
29 |
#ifdef ALLOW_MONITOR |
30 |
#include "MONITOR.h" |
31 |
#endif |
32 |
|
33 |
C !INPUT PARAMETERS: =================================================== |
34 |
C myThid :: thread number |
35 |
C myIter :: current timestep |
36 |
C myTime :: current time |
37 |
INTEGER myIter |
38 |
_RL myTime |
39 |
INTEGER myThid |
40 |
|
41 |
C === Functions ==== |
42 |
LOGICAL DIFFERENT_MULTIPLE |
43 |
EXTERNAL DIFFERENT_MULTIPLE |
44 |
|
45 |
#ifdef ALLOW_PTRACERS |
46 |
#ifdef ALLOW_MONITOR |
47 |
|
48 |
C !LOCAL VARIABLES: ==================================================== |
49 |
C i,j :: loop indices |
50 |
C ip :: ptracer number |
51 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
52 |
CHARACTER*(MAX_LEN_MBUF) suff |
53 |
_RL dT |
54 |
integer ip |
55 |
CEOP |
56 |
|
57 |
dT=deltaTclock |
58 |
|
59 |
IF ( DIFFERENT_MULTIPLE( PTRACERS_monitorFreq,myTime,dT ) ) THEN |
60 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
61 |
mon_write_stdout = .FALSE. |
62 |
mon_write_mnc = .FALSE. |
63 |
_BARRIER |
64 |
|
65 |
C Ptracers field monitor start |
66 |
_BEGIN_MASTER(myThid) |
67 |
#ifdef ALLOW_USE_MPI |
68 |
IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN |
69 |
#endif /* ALLOW_USE_MPI */ |
70 |
|
71 |
IF (PTRACERS_monitor_stdio) THEN |
72 |
WRITE(msgBuf,'(2A)') '// ==========================', |
73 |
& '=============================' |
74 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
75 |
WRITE(msgBuf,'(A)') |
76 |
& '// Begin MONITOR ptracer field statistics' |
77 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, |
78 |
& SQUEEZE_RIGHT , 1) |
79 |
WRITE(msgBuf,'(2A)') '// ==========================', |
80 |
& '=============================' |
81 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
82 |
mon_write_stdout = .TRUE. |
83 |
ENDIF |
84 |
|
85 |
#ifdef ALLOW_USE_MPI |
86 |
ENDIF |
87 |
#endif /* ALLOW_USE_MPI */ |
88 |
_END_MASTER(myThid) |
89 |
|
90 |
#ifdef ALLOW_MNC |
91 |
IF (useMNC .AND. PTRACERS_monitor_mnc) mon_write_mnc = .TRUE. |
92 |
#endif /* ALLOW_MNC */ |
93 |
|
94 |
IF ( PTRACERS_monitorFreq .NE. monitorFreq ) THEN |
95 |
C repeat printing of time to make grepping easier, default is not |
96 |
C to do this, because the default is to use the same monitorFreq |
97 |
C for ptracers as for the dynamics variables. |
98 |
CALL MON_SET_PREF('trctime',myThid) |
99 |
CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid) |
100 |
CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid) |
101 |
ENDIF |
102 |
C Print the basic statistics of ptracer variables |
103 |
CALL MON_SET_PREF('trcstat_',myThid) |
104 |
DO ip = 1, PTRACERS_numInUse |
105 |
_BEGIN_MASTER(myThid) |
106 |
WRITE(suff,'(A7,I2.2)') 'ptracer',ip |
107 |
_END_MASTER(myThid) |
108 |
_BARRIER |
109 |
CALL MON_PRINTSTATS_RL( |
110 |
& Nr, ptracer(1-Olx,1-Oly,1,1,1,ip), |
111 |
& suff, maskC,hFacC,rA ,drF,myThid) |
112 |
ENDDO |
113 |
|
114 |
IF (PTRACERS_monitor_stdio) THEN |
115 |
C Ptracers field monitor finish |
116 |
_BEGIN_MASTER(myThid) |
117 |
#ifdef ALLOW_USE_MPI |
118 |
IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN |
119 |
#endif /* ALLOW_USE_MPI */ |
120 |
WRITE(msgBuf,'(2A)') '// ==========================', |
121 |
& '=============================' |
122 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
123 |
WRITE(msgBuf,'(A)') |
124 |
& '// End MONITOR ptracers field statistics' |
125 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, |
126 |
& SQUEEZE_RIGHT , 1) |
127 |
WRITE(msgBuf,'(2A)') '// ==========================', |
128 |
& '=============================' |
129 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
130 |
#ifdef ALLOW_USE_MPI |
131 |
ENDIF |
132 |
#endif /* ALLOW_USE_MPI */ |
133 |
|
134 |
mon_write_stdout = .FALSE. |
135 |
|
136 |
_END_MASTER(myThid) |
137 |
ENDIF |
138 |
|
139 |
mon_write_stdout = .FALSE. |
140 |
mon_write_mnc = .FALSE. |
141 |
|
142 |
C endif different multiple |
143 |
ENDIF |
144 |
|
145 |
#endif /* ALLOW_MONITOR */ |
146 |
#endif /* ALLOW_PTRACERS */ |
147 |
|
148 |
RETURN |
149 |
END |