1 |
C $Header: /u/gcmpack/MITgcm/pkg/monitor/monitor_g.F,v 1.8 2012/07/06 23:06:31 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MONITOR_OPTIONS.h" |
5 |
#ifdef ALLOW_AUTODIFF |
6 |
# include "AUTODIFF_OPTIONS.h" |
7 |
#endif |
8 |
#ifdef ALLOW_CTRL |
9 |
# include "CTRL_OPTIONS.h" |
10 |
#endif |
11 |
#include "AD_CONFIG.h" |
12 |
|
13 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
14 |
CBOP |
15 |
C !ROUTINE: MONITOR |
16 |
|
17 |
C !INTERFACE: |
18 |
SUBROUTINE G_MONITOR( |
19 |
I myTime, myIter, myThid ) |
20 |
|
21 |
C !DESCRIPTION: |
22 |
C Monitor key dynamical variables: calculate over the full domain |
23 |
C some simple statistics (e.g., min,max,average) and write them. |
24 |
|
25 |
C !USES: |
26 |
IMPLICIT NONE |
27 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "PARAMS.h" |
30 |
#include "GRID.h" |
31 |
#include "DYNVARS.h" |
32 |
#include "FFIELDS.h" |
33 |
#include "MONITOR.h" |
34 |
#ifdef ALLOW_MNC |
35 |
# include "MNC_PARAMS.h" |
36 |
#endif |
37 |
#ifdef ALLOW_AUTODIFF_MONITOR |
38 |
# include "g_common.h" |
39 |
#endif |
40 |
|
41 |
C !INPUT PARAMETERS: |
42 |
_RL myTime |
43 |
INTEGER myIter |
44 |
INTEGER myThid |
45 |
CEOP |
46 |
|
47 |
#if (defined (ALLOW_TANGENTLINEAR_RUN) || defined (ALLOW_ADMTLM)) |
48 |
#ifdef ALLOW_AUTODIFF_MONITOR |
49 |
|
50 |
C === Functions ==== |
51 |
LOGICAL DIFFERENT_MULTIPLE |
52 |
EXTERNAL DIFFERENT_MULTIPLE |
53 |
LOGICAL MASTER_CPU_IO |
54 |
EXTERNAL MASTER_CPU_IO |
55 |
|
56 |
C !LOCAL VARIABLES: |
57 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
58 |
_RL dT |
59 |
_RL dummyRL(6) |
60 |
INTEGER k |
61 |
|
62 |
IF ( DIFFERENT_MULTIPLE(adjmonitorFreq,myTime,deltaTClock) ) THEN |
63 |
|
64 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
65 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
66 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
67 |
|
68 |
IF (monitor_stdio) THEN |
69 |
mon_write_stdout = .TRUE. |
70 |
ELSE |
71 |
mon_write_stdout = .FALSE. |
72 |
ENDIF |
73 |
mon_write_mnc = .FALSE. |
74 |
#ifdef ALLOW_MNC |
75 |
IF (useMNC .AND. monitor_mnc) THEN |
76 |
DO k = 1,MAX_LEN_MBUF |
77 |
mon_fname(k:k) = ' ' |
78 |
ENDDO |
79 |
mon_fname(1:9) = 'g_monitor' |
80 |
CALL MNC_CW_APPEND_VNAME( |
81 |
& 'T', '-_-_--__-__t', 0,0, myThid) |
82 |
CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid) |
83 |
CALL MNC_CW_RL_W_S( |
84 |
& 'D',mon_fname,1,1,'T', myTime, myThid) |
85 |
CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid) |
86 |
mon_write_mnc = .TRUE. |
87 |
ENDIF |
88 |
#endif /* ALLOW_MNC */ |
89 |
|
90 |
C Dynamics field monitor start |
91 |
IF ( mon_write_stdout ) THEN |
92 |
WRITE(msgBuf,'(2A)') '// ==========================', |
93 |
& '=============================' |
94 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
95 |
WRITE(msgBuf,'(A)') |
96 |
& '// Begin MONITOR dynamic field statistics' |
97 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
98 |
WRITE(msgBuf,'(2A)') '// ==========================', |
99 |
& '=============================' |
100 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
101 |
ENDIF |
102 |
|
103 |
C-- endif master cpu io |
104 |
ENDIF |
105 |
|
106 |
C Print the time to make grepping the stdout easier |
107 |
CALL MON_SET_PREF('g__time',myThid) |
108 |
CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid) |
109 |
CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid) |
110 |
|
111 |
C Print the basic statistics of model state variables |
112 |
CALL MON_SET_PREF('g__dynstat',myThid) |
113 |
|
114 |
CALL MON_WRITESTATS_RL( 1, g_etaN, '_g_eta', |
115 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
116 |
CALL MON_WRITESTATS_RL( Nr, g_uVel, '_g_uvel', |
117 |
& hFacW, maskInW, rAw, drF, dummyRL, myThid ) |
118 |
CALL MON_WRITESTATS_RL( Nr, g_vVel, '_g_vvel', |
119 |
& hFacS, maskInS, rAs, drF, dummyRL, myThid ) |
120 |
CALL MON_WRITESTATS_RL( Nr, g_wVel, '_g_wvel', |
121 |
& maskC, maskInC, rA , drC, dummyRL, myThid ) |
122 |
CALL MON_WRITESTATS_RL( Nr, g_theta,'_g_theta', |
123 |
& hFacC, maskInC, rA , drF, dummyRL, myThid ) |
124 |
CALL MON_WRITESTATS_RL( Nr, g_salt, '_g_salt', |
125 |
& hFacC, maskInC, rA , drF, dummyRL, myThid ) |
126 |
IF ( nSx.EQ.1 .AND. nSy.EQ.1 ) THEN |
127 |
C- print stats only if nSx=nSy=1 since otherwise stats are wrong |
128 |
k = 1 |
129 |
IF ( usingPCoords ) k = Nr |
130 |
CALL MON_WRITESTATS_RL( 1,g_theta(1-OLx,1-OLy,k,1,1),'_g_sst', |
131 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
132 |
CALL MON_WRITESTATS_RL( 1, g_salt(1-OLx,1-OLy,k,1,1),'_g_sss', |
133 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
134 |
ENDIF |
135 |
|
136 |
C Print the basic statistics of external forcing |
137 |
c IF ( monitorSelect.GE.3 ) THEN |
138 |
CALL MON_SET_PREF('g__forcing',myThid) |
139 |
CALL MON_WRITESTATS_RS( 1, g_Qnet, '_g_qnet', |
140 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
141 |
#ifdef SHORTWAVE_HEATING |
142 |
CALL MON_WRITESTATS_RS( 1, g_Qsw , '_g_qsw', |
143 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
144 |
#endif |
145 |
CALL MON_WRITESTATS_RS( 1, g_EmPmR,'_g_empmr', |
146 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
147 |
CALL MON_WRITESTATS_RS( 1, g_fu , '_g_fu', |
148 |
& maskInW, maskInW, rAw, drF, dummyRL, myThid ) |
149 |
CALL MON_WRITESTATS_RS( 1, g_fv , '_g_fv', |
150 |
& maskInS, maskInS, rAs, drF, dummyRL, myThid ) |
151 |
c ENDIF |
152 |
|
153 |
C Print the numerical stablility parameters for current state |
154 |
CALL MON_SET_PREF('g__g_vcfl',myThid) |
155 |
dT = MAX(dTtracerLev(1),deltaTMom) |
156 |
CALL MON_ADVCFL( '_g_uvel', g_uVel,recip_dxC,dT,myThid ) |
157 |
CALL MON_ADVCFL( '_g_vvel', g_vVel,recip_dyC,dT,myThid ) |
158 |
CALL MON_ADVCFLW( '_g_wvel',g_wVel,recip_drC,dT,myThid ) |
159 |
CALL MON_ADVCFLW2('_g_W_hf',g_wVel,recip_hFacC, |
160 |
& recip_drF,dT,myThid ) |
161 |
|
162 |
C Dynamics field monitor finish |
163 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
164 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
165 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
166 |
|
167 |
IF ( mon_write_stdout ) THEN |
168 |
WRITE(msgBuf,'(2A)') '// ==========================', |
169 |
& '=============================' |
170 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
171 |
WRITE(msgBuf,'(A)') |
172 |
& '// End MONITOR dynamic field statistics' |
173 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
174 |
WRITE(msgBuf,'(2A)') '// ==========================', |
175 |
& '=============================' |
176 |
CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) |
177 |
ENDIF |
178 |
|
179 |
mon_write_stdout = .FALSE. |
180 |
mon_write_mnc = .FALSE. |
181 |
|
182 |
C-- endif master cpu io |
183 |
ENDIF |
184 |
|
185 |
C endif different multiple |
186 |
ENDIF |
187 |
|
188 |
#endif /* ALLOW_AUTODIFF_MONITOR */ |
189 |
#endif /* ALLOW_TANGENTLINEAR_RUN */ |
190 |
|
191 |
RETURN |
192 |
END |