1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_monitor_ad.F,v 1.6 2012/08/28 19:17:46 gforget 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: ADEXF_MONITOR |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE ADEXF_MONITOR( |
12 |
I iwhen, 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 |
#ifdef ALLOW_AUTODIFF |
32 |
# ifdef ALLOW_AUTODIFF_MONITOR |
33 |
# include "adcommon.h" |
34 |
# endif |
35 |
#endif |
36 |
|
37 |
C !INPUT PARAMETERS: |
38 |
INTEGER iwhen |
39 |
_RL myTime |
40 |
INTEGER myIter |
41 |
INTEGER myThid |
42 |
CEOP |
43 |
|
44 |
#if ( defined (ALLOW_MONITOR) && defined (ALLOW_AUTODIFF_MONITOR) ) |
45 |
|
46 |
C === Functions ==== |
47 |
LOGICAL DIFFERENT_MULTIPLE |
48 |
EXTERNAL DIFFERENT_MULTIPLE |
49 |
LOGICAL MASTER_CPU_IO |
50 |
EXTERNAL MASTER_CPU_IO |
51 |
|
52 |
C == Local variables == |
53 |
_RL dummyRL(6) |
54 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
55 |
#ifdef ALLOW_MNC |
56 |
INTEGER k |
57 |
#endif |
58 |
|
59 |
IF ( DIFFERENT_MULTIPLE(adjmonitorFreq,myTime,deltaTClock) ) THEN |
60 |
|
61 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
62 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
63 |
C & mon_write_mnc (since it is 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. monitor_mnc) THEN |
73 |
DO k = 1,MAX_LEN_MBUF |
74 |
mon_fname(k:k) = ' ' |
75 |
ENDDO |
76 |
mon_fname(1:13) = 'admonitor_exf' |
77 |
CALL MNC_CW_APPEND_VNAME( |
78 |
& 'T', '-_-_--__-__t', 0,0, myThid) |
79 |
CALL MNC_CW_SET_UDIM(mon_fname, -1, myThid) |
80 |
CALL MNC_CW_RL_W_S( |
81 |
& 'D',mon_fname,1,1,'T', myTime, myThid) |
82 |
CALL MNC_CW_SET_UDIM(mon_fname, 0, myThid) |
83 |
mon_write_mnc = .TRUE. |
84 |
ENDIF |
85 |
#endif /* ALLOW_MNC */ |
86 |
|
87 |
IF ( mon_write_stdout ) THEN |
88 |
WRITE(msgBuf,'(2A)') '// ===========================', |
89 |
& '============================' |
90 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
91 |
WRITE(msgBuf,'(A,I2)') |
92 |
& '// Begin AD_MONITOR EXF statistics for iwhen = ', |
93 |
& iwhen |
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('ad_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 |
IF ( iwhen .EQ.1 ) THEN |
108 |
|
109 |
C Print some statistics about input forcing fields |
110 |
IF ( stressIsOnCgrid ) THEN |
111 |
CALL MON_WRITESTATS_RL( 1, adustress, '_adustress', |
112 |
& maskInW, maskInW, rAw, drF, dummyRL, myThid ) |
113 |
CALL MON_WRITESTATS_RL( 1, advstress, '_advstress', |
114 |
& maskInS, maskInS, rAs, drF, dummyRL, myThid ) |
115 |
ELSE |
116 |
CALL MON_WRITESTATS_RL( 1, adustress, '_adustress', |
117 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
118 |
CALL MON_WRITESTATS_RL( 1, advstress, '_advstress', |
119 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
120 |
ENDIF |
121 |
CALL MON_WRITESTATS_RL( 1, adhflux, '_adhflux', |
122 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
123 |
CALL MON_WRITESTATS_RL( 1, adsflux, '_adsflux', |
124 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
125 |
CALL MON_WRITESTATS_RL( 1, adwspeed, '_adwspeed', |
126 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
127 |
|
128 |
ELSEIF ( iwhen .EQ.2 ) THEN |
129 |
|
130 |
IF ( useAtmWind ) THEN |
131 |
CALL MON_WRITESTATS_RL( 1, aduwind, '_aduwind', |
132 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
133 |
CALL MON_WRITESTATS_RL( 1, advwind, '_advwind', |
134 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
135 |
ENDIF |
136 |
#ifdef ALLOW_ATM_TEMP |
137 |
CALL MON_WRITESTATS_RL( 1, adatemp, '_adatemp', |
138 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
139 |
CALL MON_WRITESTATS_RL( 1, adaqh, '_adaqh', |
140 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
141 |
CALL MON_WRITESTATS_RL( 1, adlwflux, '_adlwflux', |
142 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
143 |
CALL MON_WRITESTATS_RL( 1, adprecip, '_adprecip', |
144 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
145 |
#endif /* ALLOW_ATM_TEMP */ |
146 |
#if defined(ALLOW_ATM_TEMP) && defined(SHORTWAVE_HEATING) |
147 |
CALL MON_WRITESTATS_RL( 1, adswflux, '_adswflux', |
148 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
149 |
#endif |
150 |
#ifdef ALLOW_DOWNWARD_RADIATION |
151 |
CALL MON_WRITESTATS_RL( 1, adswdown, '_adswdown', |
152 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
153 |
CALL MON_WRITESTATS_RL( 1, adlwdown, '_adlwdown', |
154 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
155 |
#endif |
156 |
#ifdef ATMOSPHERIC_LOADING |
157 |
cph CALL MON_WRITESTATS_RL( 1,adapressure,'_adapressure', |
158 |
cph & maskInC, maskInC, rA , drF, dummyRL, myThid ) |
159 |
#endif |
160 |
#ifdef ALLOW_RUNOFF |
161 |
cph CALL MON_WRITESTATS_RL( 1, adrunoff, '_adrunoff', |
162 |
cph & maskInC, maskInC, rA , drF, dummyRL, myThid ) |
163 |
#endif |
164 |
#ifdef EXF_SEAICE_FRACTION |
165 |
cph CALL MON_WRITESTATS_RL( 1, areamask,'_areamask', |
166 |
cph & maskInC, maskInC, rA , drF, dummyRL, myThid ) |
167 |
#endif |
168 |
#ifdef ALLOW_CLIMSST_RELAXATION |
169 |
cph CALL MON_WRITESTATS_RL( 1, climsst, '_climsst', |
170 |
cph & maskInC, maskInC, rA , drF, dummyRL, myThid ) |
171 |
#endif |
172 |
#ifdef ALLOW_CLIMSSS_RELAXATION |
173 |
cph CALL MON_WRITESTATS_RL( 1, climsss, '_climsss', |
174 |
cph & maskInC, maskInC, rA , drF, dummyRL, myThid ) |
175 |
#endif |
176 |
#ifdef ALLOW_CLIMSTRESS_RELAXATION |
177 |
cph CALL MON_WRITESTATS_RL( 1, climustr, '_climustr', |
178 |
cph & maskInW, maskInW, rAw, drF, dummyRL, myThid ) |
179 |
cph CALL MON_WRITESTATS_RL( 1, climvstr, '_climvstr', |
180 |
cph & maskInS, maskInS, rAs, drF, dummyRL, myThid ) |
181 |
#endif |
182 |
|
183 |
ELSEIF ( iwhen .EQ.3 ) THEN |
184 |
|
185 |
CALL MON_WRITESTATS_RS( 1, adfu, '_adfu', |
186 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
187 |
CALL MON_WRITESTATS_RS( 1, adfv, '_adfv', |
188 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
189 |
CALL MON_WRITESTATS_RS( 1, adqnet, '_adqnet', |
190 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
191 |
CALL MON_WRITESTATS_RS( 1, adempmr, '_adempmr', |
192 |
& maskInC, maskInC, rA , drF, dummyRL, myThid ) |
193 |
|
194 |
ENDIF |
195 |
|
196 |
IF ( MASTER_CPU_IO(myThid) ) THEN |
197 |
C-- only the master thread is allowed to switch On/Off mon_write_stdout |
198 |
C & mon_write_mnc (since it is the only thread that uses those flags): |
199 |
|
200 |
IF ( mon_write_stdout ) THEN |
201 |
WRITE(msgBuf,'(2A)') '// ===========================', |
202 |
& '============================' |
203 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
204 |
WRITE(msgBuf,'(A,I2)') |
205 |
& '// End AD_MONITOR EXF statistics for iwhen = ', |
206 |
& iwhen |
207 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
208 |
WRITE(msgBuf,'(2A)') '// ===========================', |
209 |
& '============================' |
210 |
CALL PRINT_MESSAGE(msgBuf, mon_ioUnit, SQUEEZE_RIGHT, 1) |
211 |
ENDIF |
212 |
|
213 |
mon_write_stdout = .FALSE. |
214 |
mon_write_mnc = .FALSE. |
215 |
|
216 |
C-- endif master cpu io |
217 |
ENDIF |
218 |
|
219 |
C endif different multiple |
220 |
ENDIF |
221 |
|
222 |
#endif /* ALLOW_MONITOR */ |
223 |
|
224 |
RETURN |
225 |
END |