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

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

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


Revision 1.12 - (hide annotations) (download)
Tue Aug 8 21:24:31 2006 UTC (17 years, 11 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 jmc 1.11 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.10 2005/11/08 15:53:41 cnh 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 jmc 1.11 #include "EESUPPORT.h"
21 mlosch 1.1 #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 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 mlosch 1.1
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 jmc 1.12 CHARACTER*(MAX_LEN_MBUF) msgBuf
48 mlosch 1.1 CHARACTER*(MAX_LEN_MBUF) suff
49 jmc 1.12 INTEGER ip
50 mlosch 1.1 CEOP
51    
52 jmc 1.12 IF ( DIFFERENT_MULTIPLE( PTRACERS_monitorFreq,myTime,deltaTClock )
53     & ) THEN
54 mlosch 1.1
55 jmc 1.8 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
56 mlosch 1.1
57 jmc 1.12 C-- Ptracers field monitor start
58 mlosch 1.1 #ifdef ALLOW_USE_MPI
59 jmc 1.12 IF ( .NOT.useSingleCPUIO .OR. mpiMyId.EQ.0 ) THEN
60 mlosch 1.1 #endif /* ALLOW_USE_MPI */
61 jmc 1.12 _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 mlosch 1.1 #ifdef ALLOW_USE_MPI
98     ENDIF
99     #endif /* ALLOW_USE_MPI */
100    
101 jmc 1.12 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 mlosch 1.1 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 jmc 1.12 ENDIF
111     C Print the basic statistics of ptracer variables
112 mlosch 1.1 CALL MON_SET_PREF('trcstat_',myThid)
113     DO ip = 1, PTRACERS_numInUse
114     WRITE(suff,'(A7,I2.2)') 'ptracer',ip
115 jmc 1.12 c WRITE(suff,'(A7,I3.3)') 'ptrac_', ip
116 mlosch 1.1 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 jmc 1.12 C-- Ptracers field monitor finish
122 mlosch 1.1 #ifdef ALLOW_USE_MPI
123 jmc 1.12 IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN
124 mlosch 1.1 #endif /* ALLOW_USE_MPI */
125 jmc 1.12 _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 mlosch 1.1 WRITE(msgBuf,'(2A)') '// ==========================',
131     & '============================='
132     CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
133 jmc 1.12 WRITE(msgBuf,'(A)')
134 mlosch 1.1 & '// End MONITOR ptracers field statistics'
135 jmc 1.12 CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
136 mlosch 1.1 WRITE(msgBuf,'(2A)') '// ==========================',
137     & '============================='
138     CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1)
139     ENDIF
140    
141     mon_write_stdout = .FALSE.
142 jmc 1.12 mon_write_mnc = .FALSE.
143    
144 mlosch 1.1 _END_MASTER(myThid)
145 jmc 1.12 #ifdef ALLOW_USE_MPI
146 mlosch 1.1 ENDIF
147 jmc 1.12 #endif /* ALLOW_USE_MPI */
148 mlosch 1.9
149 jmc 1.12 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
150 mlosch 1.9
151 mlosch 1.1 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