/[MITgcm]/MITgcm/pkg/ptracers/ptracers_monitor.F
ViewVC logotype

Contents of /MITgcm/pkg/ptracers/ptracers_monitor.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.12 - (show annotations) (download)
Tue Aug 8 21:24:31 2006 UTC (17 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58n_post, checkpoint58o_post, checkpoint58p_post
Changes since 1.11: +69 -56 lines
fix multi-threading by using same method as in all other monitor S/R ;
write a specific "ptracer_monitor.*.nc" file (this fix the Pb when freq
 was different from main-monitor)

1 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.10 2005/11/08 15:53:41 cnh 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 "EESUPPORT.h"
21 #include "PARAMS.h"
22 #include "GRID.h"
23 #include "PTRACERS_SIZE.h"
24 #include "PTRACERS.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
41 #ifdef ALLOW_PTRACERS
42 #ifdef ALLOW_MONITOR
43
44 C !LOCAL VARIABLES: ====================================================
45 C i,j :: loop indices
46 C ip :: ptracer number
47 CHARACTER*(MAX_LEN_MBUF) msgBuf
48 CHARACTER*(MAX_LEN_MBUF) suff
49 INTEGER ip
50 CEOP
51
52 IF ( DIFFERENT_MULTIPLE( PTRACERS_monitorFreq,myTime,deltaTClock )
53 & ) THEN
54
55 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
56
57 C-- Ptracers field monitor start
58 #ifdef ALLOW_USE_MPI
59 IF ( .NOT.useSingleCPUIO .OR. mpiMyId.EQ.0 ) THEN
60 #endif /* ALLOW_USE_MPI */
61 _BEGIN_MASTER(myThid)
62 C- only the master thread is allowed to switch On/Off mon_write_stdout
63 C & mon_write_mnc (since it's 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_I_W_S(
78 & 'I',mon_fname,1,1,'T', myIter, 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 _END_MASTER(myThid)
97 #ifdef ALLOW_USE_MPI
98 ENDIF
99 #endif /* ALLOW_USE_MPI */
100
101 C-- Ptracers field monitor : compute stats & write
102 IF ( PTRACERS_monitorFreq .NE. monitorFreq
103 & .OR. (useMNC.AND.PTRACERS_monitor_mnc) ) THEN
104 C repeat printing of time to make grepping easier, default is not
105 C to do this, because the default is to use the same monitorFreq
106 C for ptracers as for the dynamics variables.
107 CALL MON_SET_PREF('trctime',myThid)
108 CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid)
109 CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid)
110 ENDIF
111 C Print the basic statistics of ptracer variables
112 CALL MON_SET_PREF('trcstat_',myThid)
113 DO ip = 1, PTRACERS_numInUse
114 WRITE(suff,'(A7,I2.2)') 'ptracer',ip
115 c WRITE(suff,'(A7,I3.3)') 'ptrac_', ip
116 CALL MON_PRINTSTATS_RL(
117 & Nr, ptracer(1-Olx,1-Oly,1,1,1,ip),
118 & suff, maskC,hFacC,rA ,drF,myThid)
119 ENDDO
120
121 C-- Ptracers field monitor finish
122 #ifdef ALLOW_USE_MPI
123 IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN
124 #endif /* ALLOW_USE_MPI */
125 _BEGIN_MASTER(myThid)
126 C- only the master thread is allowed to switch On/Off mon_write_stdout
127 C & mon_write_mnc (since it's the only thread that uses those flags):
128
129 IF ( mon_write_stdout ) THEN
130 WRITE(msgBuf,'(2A)') '// ==========================',
131 & '============================='
132 CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
133 WRITE(msgBuf,'(A)')
134 & '// End MONITOR ptracers field statistics'
135 CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
136 WRITE(msgBuf,'(2A)') '// ==========================',
137 & '============================='
138 CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
139 ENDIF
140
141 mon_write_stdout = .FALSE.
142 mon_write_mnc = .FALSE.
143
144 _END_MASTER(myThid)
145 #ifdef ALLOW_USE_MPI
146 ENDIF
147 #endif /* ALLOW_USE_MPI */
148
149 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
150
151 C endif different multiple
152 ENDIF
153
154 #endif /* ALLOW_MONITOR */
155 #endif /* ALLOW_PTRACERS */
156
157 RETURN
158 END

  ViewVC Help
Powered by ViewVC 1.1.22