1 |
edhill |
1.2 |
\section{Diagnostics--A Flexible Infrastructure} |
2 |
molod |
1.1 |
\label{sec:pkg:diagnostics} |
3 |
|
|
\begin{rawhtml} |
4 |
|
|
<!-- CMIREDIR:package_diagnostics: --> |
5 |
|
|
\end{rawhtml} |
6 |
|
|
|
7 |
edhill |
1.2 |
\subsection{Introduction} |
8 |
molod |
1.1 |
|
9 |
|
|
\noindent |
10 |
edhill |
1.2 |
This section of the documentation describes the Diagnostics package |
11 |
|
|
available within the GCM. A large selection of model diagnostics is |
12 |
|
|
available for output. In addition to the diagnostic quantities |
13 |
|
|
pre-defined in the GCM, there exists the option, in any experiment, to |
14 |
|
|
define a new diagnostic quantity and include it as part of the |
15 |
|
|
diagnostic output with the addition of a single subroutine call in the |
16 |
|
|
routine where the field is computed. As a matter of philosophy, no |
17 |
|
|
diagnostic is enabled as default, thus each user must specify the |
18 |
|
|
exact diagnostic information required for an experiment. This is |
19 |
|
|
accomplished by enabling the specific diagnostic of interest cataloged |
20 |
|
|
in the Diagnostic Menu (see Section \ref{sec:diagnostics:menu}). |
21 |
|
|
Instructions for enabling diagnostic output and defining new |
22 |
|
|
diagnostic quantities are found in Section |
23 |
molod |
1.1 |
\ref{sec:diagnostics:usersguide} of this document. |
24 |
|
|
|
25 |
|
|
\noindent |
26 |
edhill |
1.2 |
The Diagnostic Menu in this section of the manual is a listing of |
27 |
|
|
diagnostic quantities available within the main (dynamics) part of the |
28 |
|
|
GCM. Additional diagnostic quantities, defined within the different |
29 |
|
|
GCM packages, are available and are listed in the diagnostic menu |
30 |
|
|
subsection of the manual section associated with each relevant |
31 |
|
|
package. Once a diagnostic is enabled, the GCM will continually |
32 |
|
|
increment an array specifically allocated for that diagnostic whenever |
33 |
|
|
the appropriate quantity is computed. A counter is defined which |
34 |
|
|
records how many times each diagnostic quantity has been incremented. |
35 |
|
|
Several special diagnostics are included in the menu. Quantities |
36 |
jmc |
1.9 |
referred to as ``Counter Diagnostics'', are defined for selected |
37 |
edhill |
1.2 |
diagnostics which record the frequency at which a diagnostic is |
38 |
jmc |
1.9 |
incremented separately for each model grid location. Quantities |
39 |
|
|
referred to as ``User Diagnostics'' are included in the menu to |
40 |
edhill |
1.2 |
facilitate defining new diagnostics for a particular experiment. |
41 |
molod |
1.1 |
|
42 |
edhill |
1.2 |
\subsection{Equations} |
43 |
molod |
1.1 |
Not relevant. |
44 |
|
|
|
45 |
edhill |
1.2 |
\subsection{Key Subroutines and Parameters} |
46 |
molod |
1.1 |
\label{sec:diagnostics:diagover} |
47 |
|
|
|
48 |
|
|
\noindent |
49 |
edhill |
1.2 |
There are several utilities within the GCM available to users to |
50 |
|
|
enable, disable, clear, write and retrieve model diagnostics, and may |
51 |
|
|
be called from any routine. The available utilities and the CALL |
52 |
|
|
sequences are listed below. |
53 |
|
|
|
54 |
jmc |
1.9 |
\noindent |
55 |
|
|
{\bf DIAGNOSTICS\_ADDTOLIST} |
56 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_addtolist.F}{pkg-diagnostics-diagnostics\_addtolist.F}): |
57 |
|
|
%This subroutine enables a diagnostic from the Diagnostic Menu, |
58 |
|
|
%meaning that space is allocated for the |
59 |
|
|
%diagnostic and the model routines will increment the diagnostic value |
60 |
|
|
%during execution. |
61 |
|
|
This routine is the underlying interface routine for defining a new permanent |
62 |
|
|
diagnostic in the main model or in a package. The calling sequence is: |
63 |
|
|
|
64 |
|
|
\begin{verbatim} |
65 |
|
|
CALL DIAGNOSTICS_ADDTOLIST ( |
66 |
|
|
O diagNum, |
67 |
|
|
I diagName, diagCode, diagUnits, diagTitle, diagMate, |
68 |
|
|
I myThid ) |
69 |
|
|
|
70 |
|
|
where: |
71 |
|
|
diagNum = diagnostic Id number - Output from routine |
72 |
|
|
diagName = name of diagnostic to declare |
73 |
|
|
diagCode = parser code for this diagnostic |
74 |
|
|
diagUnits = field units for this diagnostic |
75 |
|
|
diagTitle = field description for this diagnostic |
76 |
|
|
diagMate = diagnostic mate number |
77 |
|
|
myThid = my Thread Id number |
78 |
|
|
|
79 |
|
|
\end{verbatim} |
80 |
|
|
|
81 |
|
|
|
82 |
edhill |
1.2 |
\noindent |
83 |
jmc |
1.9 |
{\bf DIAGNOSTICS\_FILL} |
84 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_fill.F}{pkg-diagnostics-diagnostics\_fill.F}): |
85 |
|
|
This is the main user interface routine to the diagnostics package. |
86 |
|
|
This routine will increment the specified |
87 |
edhill |
1.2 |
diagnostic quantity with a field sent through the argument list. |
88 |
|
|
|
89 |
|
|
\begin{verbatim} |
90 |
jmc |
1.9 |
CALL DIAGNOSTICS_FILL( |
91 |
|
|
I inpFld, chardiag, |
92 |
|
|
I kLev, nLevs, bibjFlg, bi, bj, myThid ) |
93 |
edhill |
1.2 |
|
94 |
|
|
where: |
95 |
jmc |
1.9 |
inpFld = Field to increment diagnostics array |
96 |
|
|
diagName = diagnostic identificator name (8 characters long) |
97 |
|
|
kLev = Integer flag for vertical levels: |
98 |
|
|
> 0 (any integer): WHICH single level to increment in qdiag. |
99 |
|
|
0,-1 to increment "nLevs" levels in qdiag, |
100 |
|
|
0 : fill-in in the same order as the input array |
101 |
|
|
-1: fill-in in reverse order. |
102 |
|
|
nLevs = indicates Number of levels of the input field array |
103 |
|
|
(whether to fill-in all the levels (kLev<1) or just one (kLev>0)) |
104 |
|
|
bibjFlg = Integer flag to indicate instructions for bi bj loop |
105 |
edhill |
1.2 |
= 0 indicates that the bi-bj loop must be done here |
106 |
|
|
= 1 indicates that the bi-bj loop is done OUTSIDE |
107 |
|
|
= 2 indicates that the bi-bj loop is done OUTSIDE |
108 |
jmc |
1.9 |
AND that we have been sent a local array (with overlap regions) |
109 |
|
|
(local array here means that it has no bi-bj dimensions) |
110 |
edhill |
1.2 |
= 3 indicates that the bi-bj loop is done OUTSIDE |
111 |
jmc |
1.9 |
AND that we have been sent a local array |
112 |
|
|
AND that the array has no overlap region (interior only) |
113 |
|
|
NOTE - bibjFlg can be NEGATIVE to indicate not to increment counter |
114 |
|
|
bi = X-direction tile number - used for bibjFlg=1-3 |
115 |
|
|
bj = Y-direction tile number - used for bibjFlg=1-3 |
116 |
|
|
myThid = my thread Id number |
117 |
edhill |
1.2 |
\end{verbatim} |
118 |
molod |
1.1 |
|
119 |
|
|
\noindent |
120 |
jmc |
1.9 |
{\bf DIAGNOSTICS\_SCALE\_FILL} |
121 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_scale\_fill.F}{pkg-diagnostics-diagnostics\_scale\_fill.F}): |
122 |
|
|
This is a possible alternative routine to |
123 |
|
|
DIAGNOSTICS\_FILL which performs the same functions and has an additional option |
124 |
molod |
1.1 |
to scale the field before filling or raise the field to a power before filling. |
125 |
|
|
|
126 |
edhill |
1.2 |
\begin{verbatim} |
127 |
jmc |
1.9 |
CALL DIAGNOSTICS_SCALE_FILL( |
128 |
|
|
I inpFld, scaleFact, power, chardiag, |
129 |
|
|
I kLev, nLevs, bibjFlg, bi, bj, myThid ) |
130 |
edhill |
1.2 |
|
131 |
jmc |
1.9 |
|
132 |
|
|
where all the arguments are the same as for DIAGNOSTICS_FILL with |
133 |
edhill |
1.2 |
the addition of: |
134 |
jmc |
1.9 |
scaleFact = Scaling factor to apply to the input field product |
135 |
|
|
power = Integer power to which to raise the input field (before scaling) |
136 |
edhill |
1.2 |
\end{verbatim} |
137 |
|
|
|
138 |
|
|
\noindent |
139 |
jmc |
1.9 |
{\bf DIAGNOSTICS\_IS\_ON}: Function call to inquire whether a |
140 |
edhill |
1.2 |
diagnostic is active and can be incremented. Useful when there is a |
141 |
|
|
computation that must be done locally before a call to |
142 |
jmc |
1.9 |
DIAGNOSTICS\_FILL. The call sequence: |
143 |
edhill |
1.2 |
|
144 |
|
|
\begin{verbatim} |
145 |
jmc |
1.9 |
flag = DIAGNOSTICS_IS_ON( diagName, myThid ) |
146 |
edhill |
1.2 |
|
147 |
|
|
where: |
148 |
jmc |
1.9 |
diagName = diagnostic identificator name (8 characters long) |
149 |
|
|
myThid = my thread Id number |
150 |
edhill |
1.2 |
\end{verbatim} |
151 |
|
|
|
152 |
|
|
\noindent |
153 |
jmc |
1.9 |
{\bf DIAGNOSTICS\_GET\_POINTERS} |
154 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_utils.F}{pkg-diagnostics-diagnostics\_utils.F}): |
155 |
|
|
This subroutine retrieves the value of a the diagnostics pointers |
156 |
|
|
that other routines require as input - can be useful if the diagnostics common |
157 |
|
|
blocks are not local to a routine. |
158 |
edhill |
1.2 |
|
159 |
|
|
\begin{verbatim} |
160 |
jmc |
1.9 |
CALL DIAGNOSTICS_GET_POINTERS( |
161 |
|
|
I diagName, listId, |
162 |
|
|
O ndId, ip, |
163 |
|
|
I myThid ) |
164 |
edhill |
1.2 |
|
165 |
|
|
where: |
166 |
jmc |
1.9 |
diagName = diagnostic identificator name (8 characters long) |
167 |
|
|
listId = list number that specifies the output frequency |
168 |
|
|
ndId = diagnostics Id number (in available diagnostics list) |
169 |
|
|
ip = diagnostics pointer to storage array |
170 |
|
|
myThid = my Thread Id number |
171 |
edhill |
1.2 |
\end{verbatim} |
172 |
|
|
|
173 |
|
|
\noindent |
174 |
jmc |
1.9 |
{\bf GETDIAG} |
175 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_utils.F}{pkg-diagnostics-diagnostics\_utils.F}): |
176 |
|
|
This subroutine retrieves the value of a model diagnostic. |
177 |
|
|
This routine is particularly useful when called from a |
178 |
edhill |
1.2 |
user output routine, although it can be called from any routine. This |
179 |
|
|
routine returns the time-averaged value of the diagnostic by dividing |
180 |
|
|
the current accumulated diagnostic value by its corresponding counter. |
181 |
|
|
This routine does not change the value of the diagnostic itself, that |
182 |
|
|
is, it does not replace the diagnostic with its time-average. The |
183 |
|
|
calling sequence for this routine is givin by: |
184 |
|
|
|
185 |
|
|
\begin{verbatim} |
186 |
jmc |
1.9 |
CALL GETDIAG( |
187 |
|
|
I levreal, undef, |
188 |
|
|
O qtmp, |
189 |
|
|
I ndId, mate, ip, im, bi, bj, myThid ) |
190 |
edhill |
1.2 |
|
191 |
|
|
where: |
192 |
|
|
lev = Model Level at which the diagnostic is desired |
193 |
|
|
undef = Fill value to be used when diagnostic is undefined |
194 |
|
|
qtmp = Time-Averaged Diagnostic Output |
195 |
jmc |
1.9 |
ndId = diagnostics Id number (in available diagnostics list) |
196 |
|
|
mate = counter diagnostic number if any ; 0 otherwise |
197 |
|
|
ip = pointer to storage array location for diag. |
198 |
|
|
im = pointer to storage array location for mate |
199 |
|
|
bi = X-direction tile number |
200 |
|
|
bj = Y-direction tile number |
201 |
|
|
myThid = my thread Id number |
202 |
edhill |
1.2 |
\end{verbatim} |
203 |
|
|
|
204 |
|
|
\noindent |
205 |
jmc |
1.9 |
{\bf DIAGNOSTICS\_CLRDIAG} |
206 |
|
|
(\filelink{pkg/diagnostics/diagnostics\_clear.F}{pkg-diagnostics-diagnostics\_clear.F}): |
207 |
|
|
This subroutine initializes the values of model |
208 |
edhill |
1.2 |
diagnostics to zero, and is particularly useful when called from user |
209 |
jmc |
1.9 |
output routines to re-initialize diagnostics during the run. |
210 |
|
|
The calling sequence is: |
211 |
edhill |
1.2 |
|
212 |
|
|
\begin{verbatim} |
213 |
jmc |
1.9 |
CALL DIAGNOSTICS_CLRDIAG ( ipt, nLev, myThid ) |
214 |
edhill |
1.2 |
|
215 |
|
|
where: |
216 |
jmc |
1.9 |
ipt :: diagnostic pointer to storage array |
217 |
|
|
nLev :: number of levels (in storage array) to reset |
218 |
|
|
myThid :: my Thread Id number |
219 |
edhill |
1.2 |
\end{verbatim} |
220 |
|
|
|
221 |
|
|
\noindent |
222 |
|
|
The diagnostics are computed at various times and places within the |
223 |
|
|
GCM. Because MITgcm may employ a staggered grid, diagnostics may be |
224 |
|
|
computed at grid box centers, corners, or edges, and at the middle or |
225 |
|
|
edge in the vertical. Some diagnostics are scalars, while others are |
226 |
|
|
components of vectors. An internal array is defined which contains |
227 |
|
|
information concerning various grid attributes of each diagnostic. The |
228 |
|
|
GDIAG array (in common block {\tt diagnostics} in file {\tt |
229 |
jmc |
1.9 |
DIAGNOSTICS.h}) is internally defined as a character*10 variable, and |
230 |
edhill |
1.2 |
is equivalenced to a character*1 "parse" array in output in order to |
231 |
|
|
extract the grid-attribute information. The GDIAG array is described |
232 |
|
|
in Table \ref{tab:diagnostics:gdiag.tabl}. |
233 |
molod |
1.1 |
|
234 |
|
|
\begin{table} |
235 |
|
|
\caption{Diagnostic Parsing Array} |
236 |
|
|
\label{tab:diagnostics:gdiag.tabl} |
237 |
|
|
\begin{center} |
238 |
|
|
\begin{tabular}{ |c|c|l| } |
239 |
|
|
\hline |
240 |
|
|
\multicolumn{3}{|c|}{\bf Diagnostic Parsing Array} \\ |
241 |
|
|
\hline |
242 |
|
|
\hline |
243 |
|
|
Array & Value & Description \\ |
244 |
|
|
\hline |
245 |
jmc |
1.9 |
parse(1) & $\rightarrow$ S & Scalar Diagnostic \\ |
246 |
|
|
& $\rightarrow$ U & U-vector component Diagnostic \\ |
247 |
|
|
& $\rightarrow$ V & V-vector component Diagnostic \\ \hline |
248 |
|
|
parse(2) & $\rightarrow$ U & C-Grid U-Point \\ |
249 |
|
|
& $\rightarrow$ V & C-Grid V-Point \\ |
250 |
|
|
& $\rightarrow$ M & C-Grid Mass Point \\ |
251 |
|
|
& $\rightarrow$ Z & C-Grid Vorticity (Corner) Point \\ \hline |
252 |
|
|
parse(3) & $\rightarrow$ & Used for Level Integrated output: cumulate levels \\ |
253 |
|
|
& $\rightarrow$ r & same but cumulate product by model level thickness \\ |
254 |
|
|
& $\rightarrow$ R & same but cumulate product by hFac \& level thickness \\ \hline |
255 |
|
|
parse(4) & $\rightarrow$ P & Positive Definite Diagnostic \\ \hline |
256 |
|
|
parse(5) & $\rightarrow$ C & with Counter array \\ |
257 |
|
|
& $\rightarrow$ D & Disabled Diagnostic for output \\ \hline |
258 |
|
|
parse(6-8)& & retired, formerly: 3-digit mate number \\ \hline |
259 |
|
|
parse(9) & $\rightarrow$ U & model-level plus 1/2 \\ |
260 |
|
|
& $\rightarrow$ M & model-level middle \\ |
261 |
|
|
& $\rightarrow$ L & model-level minus 1/2 \\ \hline |
262 |
|
|
parse(10) & $\rightarrow$ 0 & levels = 0 \\ |
263 |
|
|
& $\rightarrow$ 1 & levels = 1 \\ |
264 |
|
|
& $\rightarrow$ R & levels = Nr \\ |
265 |
|
|
& $\rightarrow$ L & levels = MAX(Nr,NrPhys) \\ |
266 |
|
|
& $\rightarrow$ M & levels = MAX(Nr,NrPhys) - 1 \\ |
267 |
|
|
& $\rightarrow$ G & levels = Ground\_level Number \\ |
268 |
|
|
& $\rightarrow$ I & levels = sea-Ice\_level Number \\ |
269 |
|
|
& $\rightarrow$ X & free levels option (need to be set explicitly)\\ \hline |
270 |
molod |
1.1 |
\end{tabular} |
271 |
|
|
\addcontentsline{lot}{section}{Table 3: Diagnostic Parsing Array} |
272 |
|
|
\end{center} |
273 |
|
|
\end{table} |
274 |
|
|
|
275 |
|
|
|
276 |
|
|
\noindent |
277 |
|
|
As an example, consider a diagnostic whose associated GDIAG parameter is equal |
278 |
jmc |
1.9 |
to ``UUR\hspace{5mm}MR''. From GDIAG we can determine that this diagnostic is a |
279 |
|
|
U-vector component located at the C-grid U-point, model mid-level (M) |
280 |
|
|
with Nr levels (last R). |
281 |
molod |
1.1 |
|
282 |
|
|
\noindent |
283 |
|
|
In this way, each Diagnostic in the model has its attributes (ie. vector or scalar, |
284 |
|
|
C-grid location, etc.) defined internally. The Output routines use this information |
285 |
|
|
in order to determine what type of transformations need to be performed. Any |
286 |
|
|
interpolations are done at the time of output rather than during each model step. |
287 |
|
|
In this way the User has flexibility in determining the type of gridded data which |
288 |
|
|
is output. |
289 |
|
|
|
290 |
edhill |
1.2 |
\subsection{Usage Notes} |
291 |
molod |
1.1 |
\label{sec:diagnostics:usersguide} |
292 |
|
|
|
293 |
|
|
\noindent |
294 |
jmc |
1.9 |
To use the diagnostics package, other than enabling it in {\tt packages.conf} |
295 |
|
|
and turning the {\tt useDiagnostics} flag in {\tt data.pkg} to .TRUE., there are two |
296 |
molod |
1.1 |
further steps the user must take to enable the diagnostics package for |
297 |
|
|
output of quantities that are already defined in the GCM under an experiment's |
298 |
jmc |
1.9 |
configuration of packages. |
299 |
|
|
A parameter file {\tt data.diagnostics} must be supplied in the run directory, |
300 |
|
|
and the file DIAGNOSTICS\_SIZE.h must be included in the |
301 |
molod |
1.1 |
code directory. The steps for defining a new (permanent or experiment-specific |
302 |
|
|
temporary) diagnostic quantity will be outlined later. |
303 |
|
|
|
304 |
jmc |
1.9 |
\noindent The namelist in parameter file {\tt data.diagnostics} will activate |
305 |
|
|
a user-defined list of diagnostics quantities to be computed, |
306 |
|
|
specify the frequency and type of output, the number of levels, and |
307 |
|
|
the name of all the separate output files. |
308 |
|
|
A sample {\tt data.diagnostics} namelist file: |
309 |
molod |
1.1 |
|
310 |
edhill |
1.2 |
\begin{verbatim} |
311 |
|
|
# Diagnostic Package Choices |
312 |
jmc |
1.9 |
#-------------------- |
313 |
|
|
# dumpAtLast (logical): always write output at the end of simulation (default=F) |
314 |
|
|
# diag_mnc (logical): write to NetCDF files (default=useMNC) |
315 |
|
|
#--for each output-stream: |
316 |
|
|
# fileName(n) : prefix of the output file name (max 80c long) for outp.stream n |
317 |
|
|
# frequency(n):< 0 : write snap-shot output every |frequency| seconds |
318 |
|
|
# > 0 : write time-average output every frequency seconds |
319 |
|
|
# timePhase(n) : write at time = timePhase + multiple of |frequency| |
320 |
|
|
# averagingFreq : frequency (in s) for periodic averaging interval |
321 |
|
|
# averagingPhase : phase (in s) for periodic averaging interval |
322 |
|
|
# repeatCycle : number of averaging intervals in 1 cycle |
323 |
|
|
# levels(:,n) : list of levels to write to file (Notes: declared as REAL) |
324 |
|
|
# when this entry is missing, select all common levels of this list |
325 |
|
|
# fields(:,n) : list of selected diagnostics fields (8.c) in outp.stream n |
326 |
|
|
# (see "available_diagnostics.log" file for the full list of diags) |
327 |
|
|
# missing_value(n) : missing value for real-type fields in output file "n" |
328 |
|
|
# fileFlags(n) : specific code (8c string) for output file "n" |
329 |
|
|
#-------------------- |
330 |
|
|
&DIAGNOSTICS_LIST |
331 |
|
|
fields(1:2,1) = 'UVEL ','VVEL ', |
332 |
|
|
levels(1:5,1) = 1.,2.,3.,4.,5., |
333 |
|
|
filename(1) = 'diagout1', |
334 |
edhill |
1.2 |
frequency(1) = 86400., |
335 |
jmc |
1.9 |
fields(1:3,2) = 'THETA ','SALT ', |
336 |
|
|
filename(2) = 'diagout2', |
337 |
|
|
fileflags(2) = ' P1 ', |
338 |
|
|
frequency(2) = 3600., |
339 |
|
|
& |
340 |
|
|
|
341 |
|
|
#-------------------- |
342 |
|
|
# Parameter for Diagnostics of per level statistics: |
343 |
|
|
#-------------------- |
344 |
|
|
# diagSt_mnc (logical): write stat-diags to NetCDF files (default=diag_mnc) |
345 |
|
|
# diagSt_regMaskFile : file containing the region-mask to read-in |
346 |
|
|
# nSetRegMskFile : number of region-mask sets within the region-mask file |
347 |
|
|
# set_regMask(i) : region-mask set-index that identifies the region "i" |
348 |
|
|
# val_regMask(i) : region "i" identifier value in the region mask |
349 |
|
|
#--for each output-stream: |
350 |
|
|
# stat_fName(n) : prefix of the output file name (max 80c long) for outp.stream n |
351 |
|
|
# stat_freq(n):< 0 : write snap-shot output every |stat_freq| seconds |
352 |
|
|
# > 0 : write time-average output every stat_freq seconds |
353 |
|
|
# stat_phase(n) : write at time = stat_phase + multiple of |stat_freq| |
354 |
|
|
# stat_region(:,n) : list of "regions" (default: 1 region only=global) |
355 |
|
|
# stat_fields(:,n) : list of selected diagnostics fields (8.c) in outp.stream n |
356 |
|
|
# (see "available_diagnostics.log" file for the full list of diags) |
357 |
|
|
#-------------------- |
358 |
|
|
&DIAG_STATIS_PARMS |
359 |
|
|
& |
360 |
edhill |
1.2 |
\end{verbatim} |
361 |
|
|
|
362 |
|
|
\noindent |
363 |
|
|
In this example, there are two output files that will be generated for |
364 |
|
|
each tile and for each output time. The first set of output files has |
365 |
|
|
the prefix diagout1, does time averaging every 86400. seconds, |
366 |
|
|
(frequency is 86400.), and will write fields which are multiple-level |
367 |
|
|
fields at output levels 1-5. The names of diagnostics quantities are |
368 |
|
|
UVEL and VVEL. The second set of output files has the prefix |
369 |
|
|
diagout2, does time averaging every 3600. seconds, includes fields |
370 |
jmc |
1.9 |
with all levels, and the names of diagnostics quantities are THETA and SALT. |
371 |
edhill |
1.2 |
|
372 |
|
|
\noindent |
373 |
|
|
The user must assure that enough computer memory is allocated for the |
374 |
|
|
diagnostics and the output streams selected for a particular |
375 |
jmc |
1.9 |
experiment. This is accomplished by modifying the file |
376 |
edhill |
1.2 |
DIAGNOSTICS\_SIZE.h and including it in the experiment code directory. |
377 |
jmc |
1.9 |
The parameters that should be checked are called numDiags, numLists, |
378 |
|
|
numperList, and diagSt\_size. |
379 |
molod |
1.1 |
|
380 |
jmc |
1.9 |
\noindent numDiags (and diagSt\_size): \\ |
381 |
molod |
1.1 |
\noindent All GCM diagnostic quantities are stored in the single diagnostic array QDIAG |
382 |
jmc |
1.9 |
which is located in the file |
383 |
|
|
\filelink{pkg/diagnostics/DIAGNOSTICS.h}{pkg-diagnostics-DIAGNOSTICS.h} |
384 |
molod |
1.1 |
and has the form:\\ |
385 |
edhill |
1.2 |
\begin{verbatim} |
386 |
jmc |
1.9 |
_RL qdiag(1-Olx,sNx+Olx,1-Olx,sNx+Olx,numDiags,nSx,nSy) |
387 |
|
|
_RL qSdiag(0:nStats,0:nRegions,diagSt_size,nSx,nSy) |
388 |
|
|
COMMON / DIAG_STORE_R / qdiag, qSdiag |
389 |
edhill |
1.2 |
\end{verbatim} |
390 |
|
|
\noindent |
391 |
|
|
The first two-dimensions of qdiag correspond to the horizontal |
392 |
|
|
dimension of a given diagnostic, and the third dimension of qdiag is |
393 |
|
|
used to identify diagnostic fields and levels combined. In order to |
394 |
|
|
minimize the memory requirement of the model for diagnostics, the |
395 |
|
|
default GCM executable is compiled with room for only one horizontal |
396 |
jmc |
1.9 |
diagnostic array, or with numDiags set to Nr. In order for the User to |
397 |
edhill |
1.2 |
enable more than 1 three-dimensional diagnostic, the size of the |
398 |
jmc |
1.9 |
diagnostics common must be expanded to accommodate the desired |
399 |
edhill |
1.2 |
diagnostics. This can be accomplished by manually changing the |
400 |
jmc |
1.9 |
parameter numDiags in the file |
401 |
edhill |
1.2 |
\filelink{pkg/diagnostics/DIAGNOSTICS\_SIZE.h}{pkg-diagnostics-DIAGNOSTICS\_SIZE.h}. |
402 |
jmc |
1.9 |
numDiags should be set greater than or equal to the sum of all the |
403 |
edhill |
1.2 |
diagnostics activated for output each multiplied by the number of |
404 |
|
|
levels defined for that diagnostic quantity. For the above example, |
405 |
|
|
there are 4 multiple level fields, which the diagnostics menu (see |
406 |
|
|
below) indicates are defined at the GCM vertical resolution, Nr. The |
407 |
jmc |
1.9 |
value of numDiags in DIAGNOSTICS\_SIZE.h would therefore be equal to |
408 |
edhill |
1.2 |
4*Nr, or, say 40 if $Nr=10$. |
409 |
molod |
1.1 |
|
410 |
jmc |
1.9 |
\noindent numLists and numperList: \\ |
411 |
|
|
\noindent The parameter numLists must be set greater than or equal to |
412 |
edhill |
1.2 |
the number of separate output streams that the user specifies in the |
413 |
jmc |
1.9 |
namelist file data.diagnostics. The parameter numperList corresponds |
414 |
|
|
to the maximum number of diagnostics requested per output streams. |
415 |
edhill |
1.2 |
|
416 |
|
|
\noindent |
417 |
|
|
In order to define and include as part of the diagnostic output any |
418 |
|
|
field that is desired for a particular experiment, two steps must be |
419 |
|
|
taken. The first is to enable the ``User Diagnostic'' in |
420 |
jmc |
1.9 |
{\tt data.diagnostics}. This is accomplished by adding one of the ``User |
421 |
edhill |
1.2 |
Diagnostic'' field names (UDIAG1 through UDIAG10, for multi-level |
422 |
|
|
fields, or SDIAG1 through SDIAG10 for single level fields) to the |
423 |
|
|
data.diagnostics namelist in one of the output streams. These fields |
424 |
|
|
are listed in the diagnostics menu. The second step is to add a call |
425 |
jmc |
1.9 |
to DIAGNOSTICS\_FILL from the subroutine in which the quantity desired |
426 |
edhill |
1.2 |
for diagnostic output is computed. |
427 |
|
|
|
428 |
|
|
\noindent |
429 |
|
|
In order to add a new diagnostic to the permanent set of diagnostics |
430 |
|
|
that the main model or any package contains as part of its diagnostics |
431 |
jmc |
1.9 |
menu, the subroutine DIAGNOSTICS\_ADDTOLIST should be called during the |
432 |
edhill |
1.2 |
initialization phase of the main model or package. For the main model, |
433 |
jmc |
1.9 |
the call should be made from subroutine DIAGNOSTICS\_MAIN\_INIT, and |
434 |
|
|
for a package, the call should probably be made from |
435 |
|
|
%somewhere in the PACKAGES\_INIT\_FIXED sequence (probably |
436 |
|
|
from inside the particular package's init\_fixed routine. |
437 |
|
|
A typical code sequence to set the |
438 |
|
|
input arguments to DIAGNOSTICS\_ADDTOLIST would look like: |
439 |
molod |
1.1 |
|
440 |
edhill |
1.2 |
\begin{verbatim} |
441 |
jmc |
1.9 |
diagName = 'RHOAnoma' |
442 |
|
|
diagTitle = 'Density Anomaly (=Rho-rhoConst)' |
443 |
|
|
diagUnits = 'kg/m^3 ' |
444 |
|
|
diagCode = 'SMR MR ' |
445 |
|
|
CALL DIAGNOSTICS\_ADDTOLIST( diagNum, |
446 |
|
|
I diagName, diagCode, diagUnits, diagTitle, 0, myThid ) |
447 |
edhill |
1.2 |
\end{verbatim} |
448 |
|
|
|
449 |
|
|
\noindent If the new diagnostic quantity is associated with either a |
450 |
jmc |
1.9 |
vector pair or a diagnostic counter, the diagMate argument must be |
451 |
|
|
provided with the proper index corresponding to the ``mate''. |
452 |
|
|
The output argument from DIAGNOSTICS\_ADDTOLIST that is called diagNum here |
453 |
|
|
contains a running total of the number of diagnostics defined in the code up to |
454 |
edhill |
1.2 |
any point during the run. The sequence number for the next two |
455 |
|
|
diagnostics defined (the two components of the vector pair, for |
456 |
|
|
instance) will be diagNum+1 and diagNum+2. The definition of the first |
457 |
|
|
component of the vector pair must fill the ``mate'' segment of the |
458 |
|
|
diagCode as diagnostic number diagNum+2. Since the subroutine |
459 |
|
|
increments diagNum, the definition of the second component of the |
460 |
|
|
vector fills the ``mate'' part of diagCode with diagNum. A code |
461 |
|
|
sequence for this case would look like: |
462 |
|
|
|
463 |
|
|
\begin{verbatim} |
464 |
jmc |
1.9 |
diagName = 'UVEL ' |
465 |
|
|
diagTitle = 'Zonal Component of Velocity (m/s)' |
466 |
|
|
diagUnits = 'm/s ' |
467 |
|
|
diagCode = 'UUR MR ' |
468 |
|
|
diagMate = diagNum + 2 |
469 |
|
|
CALL DIAGNOSTICS_ADDTOLIST( diagNum, |
470 |
|
|
I diagName, diagCode, diagUnits, diagTitle, diagMate, myThid ) |
471 |
|
|
|
472 |
|
|
diagName = 'VVEL ' |
473 |
|
|
diagTitle = 'Meridional Component of Velocity (m/s)' |
474 |
|
|
diagUnits = 'm/s ' |
475 |
|
|
diagCode = 'VVR MR ' |
476 |
|
|
diagMate = diagNum |
477 |
|
|
CALL DIAGNOSTICS_ADDTOLIST( diagNum, |
478 |
|
|
I diagName, diagCode, diagUnits, diagTitle, diagMate, myThid ) |
479 |
edhill |
1.2 |
\end{verbatim} |
480 |
molod |
1.1 |
|
481 |
jmc |
1.8 |
\input{s_outp_pkgs/text/diagnostics-menu.tex} |
482 |
molod |
1.1 |
|
483 |
|
|
\newpage |
484 |
|
|
\noindent For a list of the diagnostic fields available in the |
485 |
|
|
different MITgcm packages, follow the link to the diagnostics menu |
486 |
|
|
in the manual section describing the package: |
487 |
|
|
|
488 |
edhill |
1.5 |
\begin{itemize} |
489 |
|
|
\item aim: \ref{sec:pkg:aim:diagnostics} |
490 |
|
|
\item exf: \ref{sec:pkg:exf:diagnostics} |
491 |
|
|
\item gchem: \ref{sec:pkg:gchem:diagnostics} |
492 |
molod |
1.6 |
\item generic\_advdiff: \ref{sec:pkg:gad:diagnostics} |
493 |
edhill |
1.5 |
\item gridalt: \ref{sec:pkg:gridalt:diagnostics} |
494 |
|
|
\item gmredi: \ref{sec:pkg:gmredi:diagnostics} |
495 |
|
|
\item fizhi: \ref{sec:pkg:fizhi:diagnostics} |
496 |
|
|
\item kpp: \ref{sec:pkg:kpp:diagnostics} |
497 |
|
|
\item land: \ref{sec:pkg:land:diagnostics} |
498 |
|
|
\item mom\_common: \ref{sec:pkg:mom_common:diagnostics} |
499 |
|
|
\item obcs: \ref{sec:pkg:obcs:diagnostics} |
500 |
|
|
\item thsice: \ref{sec:pkg:thsice:diagnostics} |
501 |
|
|
\item shap\_filt: \ref{sec:pkg:shap_filt:diagnostics} |
502 |
molod |
1.7 |
\item ptracers: \ref{sec:pkg:ptracers:diagnostics} |
503 |
edhill |
1.5 |
\end{itemize} |
504 |
molod |
1.1 |
|
505 |
edhill |
1.2 |
\subsection{Dos and Donts} |
506 |
molod |
1.1 |
|
507 |
edhill |
1.2 |
\subsection{Diagnostics Reference} |
508 |
molod |
1.1 |
|