1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_monitor.F,v 1.26 2013/04/23 19:04:33 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
|
6 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
CBOP |
8 |
C !ROUTINE: EXF_MONITOR |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE EXF_MONITOR( |
12 |
I myTime, myIter, myThid ) |
13 |
|
14 |
C !DESCRIPTION: |
15 |
C Print some statistics about input forcing fields. |
16 |
|
17 |
C !USES: |
18 |
IMPLICIT NONE |
19 |
#include "SIZE.h" |
20 |
#include "EEPARAMS.h" |
21 |
#include "PARAMS.h" |
22 |
#include "GRID.h" |
23 |
#include "EXF_PARAM.h" |
24 |
#include "EXF_FIELDS.h" |
25 |
#ifdef ALLOW_MONITOR |
26 |
# include "MONITOR.h" |
27 |
#endif |
28 |
#ifdef ALLOW_MNC |
29 |
# include "MNC_PARAMS.h" |
30 |
#endif |
31 |
|
32 |
C !INPUT PARAMETERS: |
33 |
_RL myTime |
34 |
INTEGER myIter |
35 |
INTEGER myThid |
36 |
CEOP |
37 |
|
38 |
#ifdef ALLOW_MONITOR |
39 |
|
40 |
C === Functions ==== |
41 |
LOGICAL DIFFERENT_MULTIPLE |
42 |
EXTERNAL DIFFERENT_MULTIPLE |
43 |
LOGICAL MASTER_CPU_IO |
44 |
EXTERNAL MASTER_CPU_IO |
45 |
|
46 |
C == Local variables == |
47 |
_RL dummyRL(6) |
48 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
49 |
#ifdef ALLOW_MNC |
50 |
INTEGER k |
51 |
#endif |
52 |
LOGICAL computed |
53 |
|
54 |
#ifdef ALLOW_BULKFORMULAE |
55 |
computed = .TRUE. |
56 |
#else |
57 |
computed = .FALSE. |
58 |
#endif |
59 |
|
60 |
IF ( DIFFERENT_MULTIPLE(exf_monFreq,myTime,deltaTClock) |
61 |
& ) THEN |
62 |
|
63 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
64 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
65 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
66 |
|
67 |
IF (monitor_stdio) THEN |
68 |
mon_write_stdout = .TRUE. |
69 |
ELSE |
70 |
mon_write_stdout = .FALSE. |
71 |
ENDIF |
72 |
mon_write_mnc = .FALSE. |
73 |
#ifdef ALLOW_MNC |
74 |
IF (useMNC .AND. monitor_mnc) THEN |
75 |
DO k = 1,MAX_LEN_MBUF |
76 |
mon_fname(k:k) = ' ' |
77 |
ENDDO |
78 |
mon_fname(1:11) = 'monitor_exf' |
79 |
CALL MNC_CW_APPEND_VNAME( |
80 |
& 'T', '-_-_--__-__t', 0,0, myThid) |
81 |
CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid) |
82 |
CALL MNC_CW_RL_W_S( |
83 |
& 'D',mon_fname,1,1,'T', myTime, myThid) |
84 |
CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid) |
85 |
mon_write_mnc = .TRUE. |
86 |
ENDIF |
87 |
#endif /* ALLOW_MNC */ |
88 |
|
89 |
IF ( mon_write_stdout ) THEN |
90 |
WRITE(msgBuf,'(2A)') '// ===========================', |
91 |
& '============================' |
92 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
93 |
WRITE(msgBuf,'(A)') '// Begin MONITOR EXF statistics' |
94 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
95 |
WRITE(msgBuf,'(2A)') '// ===========================', |
96 |
& '============================' |
97 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
98 |
ENDIF |
99 |
|
100 |
C-- endif master cpu io |
101 |
ENDIF |
102 |
|
103 |
CALL MON_SET_PREF('exf',myThid) |
104 |
CALL MON_OUT_I ('_tsnumber', myIter,mon_string_none,myThid) |
105 |
CALL MON_OUT_RL('_time_sec', myTime,mon_string_none,myThid) |
106 |
|
107 |
C Print some statistics about input forcing fields |
108 |
IF ( stressIsOnCgrid ) THEN |
109 |
CALL MON_WRITESTATS_RL( 1, ustress, '_ustress', |
110 |
& maskInW, maskInW, rAw, drF, dummyRL, myThid ) |
111 |
CALL MON_WRITESTATS_RL( 1, vstress, '_vstress', |
112 |
& maskInS, maskInS, rAs, drF, dummyRL, myThid ) |
113 |
ELSE |
114 |
CALL MON_WRITESTATS_RL( 1, ustress, '_ustress', |
115 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
116 |
CALL MON_WRITESTATS_RL( 1, vstress, '_vstress', |
117 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
118 |
ENDIF |
119 |
IF ( computed .OR. hfluxfile .NE. ' ' ) THEN |
120 |
CALL MON_WRITESTATS_RL( 1, hflux, '_hflux', |
121 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
122 |
ENDIF |
123 |
IF ( computed .OR. sfluxfile .NE. ' ' ) THEN |
124 |
CALL MON_WRITESTATS_RL( 1, sflux, '_sflux', |
125 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
126 |
ENDIF |
127 |
IF ( useAtmWind ) THEN |
128 |
CALL MON_WRITESTATS_RL( 1, uwind, '_uwind', |
129 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
130 |
CALL MON_WRITESTATS_RL( 1, vwind, '_vwind', |
131 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
132 |
ENDIF |
133 |
IF ( computed .OR. wspeedfile .NE. ' ' ) THEN |
134 |
CALL MON_WRITESTATS_RL( 1, wspeed, '_wspeed', |
135 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
136 |
ENDIF |
137 |
#ifdef ALLOW_ATM_TEMP |
138 |
IF ( atempfile .NE. ' ' ) THEN |
139 |
CALL MON_WRITESTATS_RL( 1, atemp, '_atemp', |
140 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
141 |
ENDIF |
142 |
IF ( aqhfile .NE. ' ' ) THEN |
143 |
CALL MON_WRITESTATS_RL( 1, aqh, '_aqh', |
144 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
145 |
ENDIF |
146 |
IF ( lwdownfile .NE. ' ' .OR. lwfluxfile .NE. ' ' ) THEN |
147 |
CALL MON_WRITESTATS_RL( 1, lwflux, '_lwflux', |
148 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
149 |
ENDIF |
150 |
IF ( precipfile .NE. ' ' ) THEN |
151 |
CALL MON_WRITESTATS_RL( 1, precip, '_precip', |
152 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
153 |
ENDIF |
154 |
IF ( snowprecipfile .NE. ' ' ) THEN |
155 |
CALL MON_WRITESTATS_RL(1,snowprecip,'_snowprecip', |
156 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
157 |
ENDIF |
158 |
#endif /* ALLOW_ATM_TEMP */ |
159 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
160 |
IF ( swdownfile .NE. ' ' .OR. swfluxfile .NE. ' ' ) THEN |
161 |
CALL MON_WRITESTATS_RL( 1, swflux, '_swflux', |
162 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
163 |
ENDIF |
164 |
#endif |
165 |
#if defined(ALLOW_ATM_TEMP) || defined(EXF_READ_EVAP) |
166 |
IF ( computed .OR. evapfile .NE. ' ' ) THEN |
167 |
CALL MON_WRITESTATS_RL( 1, evap, '_evap', |
168 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
169 |
ENDIF |
170 |
#endif |
171 |
#ifdef ALLOW_DOWNWARD_RADIATION |
172 |
IF ( swdownfile .NE. ' ' ) THEN |
173 |
CALL MON_WRITESTATS_RL( 1, swdown, '_swdown', |
174 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
175 |
ENDIF |
176 |
IF ( lwdownfile .NE. ' ' ) THEN |
177 |
CALL MON_WRITESTATS_RL( 1, lwdown, '_lwdown', |
178 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
179 |
ENDIF |
180 |
#endif |
181 |
#ifdef ATMOSPHERIC_LOADING |
182 |
IF ( apressurefile .NE. ' ' ) THEN |
183 |
CALL MON_WRITESTATS_RL( 1,apressure,'_apressure', |
184 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
185 |
ENDIF |
186 |
#endif |
187 |
#ifdef ALLOW_RUNOFF |
188 |
IF ( runofffile .NE. ' ' ) THEN |
189 |
CALL MON_WRITESTATS_RL( 1, runoff, '_runoff', |
190 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
191 |
ENDIF |
192 |
# ifdef ALLOW_RUNOFTEMP |
193 |
IF ( runoftempfile .NE. ' ' ) THEN |
194 |
CALL MON_WRITESTATS_RL( 1, runoftemp, '_runoftemp', |
195 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
196 |
ENDIF |
197 |
# endif |
198 |
#endif |
199 |
#ifdef EXF_SEAICE_FRACTION |
200 |
IF ( areamaskfile .NE. ' ' ) THEN |
201 |
CALL MON_WRITESTATS_RL( 1, areamask,'_areamask', |
202 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
203 |
ENDIF |
204 |
#endif |
205 |
#ifdef ALLOW_CLIMSST_RELAXATION |
206 |
IF ( climsstfile .NE. ' ' ) THEN |
207 |
CALL MON_WRITESTATS_RL( 1, climsst, '_climsst', |
208 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
209 |
ENDIF |
210 |
#endif |
211 |
#ifdef ALLOW_CLIMSSS_RELAXATION |
212 |
IF ( climsssfile .NE. ' ' ) THEN |
213 |
CALL MON_WRITESTATS_RL( 1, climsss, '_climsss', |
214 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
215 |
ENDIF |
216 |
#endif |
217 |
#ifdef ALLOW_CLIMSTRESS_RELAXATION |
218 |
IF ( climustrfile .NE. ' ' ) THEN |
219 |
CALL MON_WRITESTATS_RL( 1, climustr, '_climustr', |
220 |
& maskInW, maskInW, rAw, drF, dummyRL, myThid ) |
221 |
ENDIF |
222 |
IF ( climvstrfile .NE. ' ' ) THEN |
223 |
CALL MON_WRITESTATS_RL( 1, climvstr, '_climvstr', |
224 |
& maskInS, maskInS, rAs, drF, dummyRL, myThid ) |
225 |
ENDIF |
226 |
#endif |
227 |
|
228 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
229 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
230 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
231 |
|
232 |
IF ( mon_write_stdout ) THEN |
233 |
WRITE(msgBuf,'(2A)') '// ===========================', |
234 |
& '============================' |
235 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
236 |
WRITE(msgBuf,'(A)') '// End MONITOR EXF statistics' |
237 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
238 |
WRITE(msgBuf,'(2A)') '// ===========================', |
239 |
& '============================' |
240 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
241 |
ENDIF |
242 |
|
243 |
mon_write_stdout = .FALSE. |
244 |
mon_write_mnc = .FALSE. |
245 |
|
246 |
C-- endif master cpu io |
247 |
ENDIF |
248 |
|
249 |
C endif different multiple |
250 |
ENDIF |
251 |
|
252 |
#endif /* ALLOW_MONITOR */ |
253 |
|
254 |
RETURN |
255 |
END |