source: trunk/LMDZ.TITAN/DOC/io.tex @ 3467

Last change on this file since 3467 was 987, checked in by jleconte, 11 years ago

11/06/2013 == JL+EM

  • User manual (+ sources) added in DOC.
File size: 17.7 KB
Line 
1\chapter{Input/Output}
2\label{sc:io}
3
4\section{NetCDF format}
5
6%%%%%%%%%%%%%%%%%%%%%%%%%%
7GCM input/output data are written in {\bf NetCDF} format
8(Network Common Data Form). NetCDF is an interface used to store and access
9geophysical data, and a library that provides an implementation of this
10interface. The NetCDF library also defines a machine-independent format for
11representing scientific data.
12Together, the interface, library and format support the creation, access and
13sharing of scientific data. NetCDF was developed at the Unidata Program Center
14in Boulder, Colorado. The freely available source can be obtained from
15{the Unidata website}{http://www.unidata.ucar.edu/software/netcdf}.
16
17A data set in NetCDF format is a single file, as it is self-descriptive.
18
19\subsection{NetCDF file editor: ncdump}
20
21The editor is included in the NetCDF library.
22By default it generates an ASCII representation as standard output
23from the NetCDF file specified at the input.
24
25\paragraph{Main commands for  ncdump}
26
27\begin{center}
28{\it ncdump diagfi.nc}
29\end{center}
30
31\noindent
32dump contents of NetCDF file {\tt diagfi.nc} to standard output
33(i.e. the screen).
34
35\begin{center}
36{\it ncdump -c diagfi.nc}
37\end{center}
38
39\noindent
40Displays the {\bf coordinate} variable values (variables which are also
41dimensions), as well as the declarations, variables and attribute values.
42The values of the non-coordinate variable data are not displayed at
43the output.
44
45\begin{center}
46{\it ncdump -h diagfi.nc}
47\end{center}
48
49\noindent
50Shows only the informative header of the file, which is the declaration
51of the dimensions, variables and attributes, but not the values of these
52variables. The output is identical to that in option {\bf -c} except for
53the fact that the coordinated variable values are not included.
54
55\begin{center}
56{\it ncdump -v var1,...,varn diagfi.nc}
57\end{center}
58
59\noindent
60The output includes the specific variable values,
61as well as all the dimensions, variables and attributes.
62More that one variable can be specified in the list following this option.
63The list must be a simple argument for the command, and must not contain any
64spaces. If no variable is specified, the command displays all the values of
65the variables in the file by default.
66
67
68\subsection{Graphic visualization of the NetCDF files using GrAds}
69
70GrAdS (The Grid Analysis and Display System) is a graphic software developed
71by Brian Doty at the "Center for Ocean-Land-Atmosphere (COLA)".
72
73One of its functions is to enable data stored in NetCDF format to be
74visualized directly. In figure~\ref{fg:grads} for example, we can see the
75GrADS visualization of the temperature data at a given moment.
76%
77\begin{figure}
78\centering
79\includegraphics[width=0.5\textwidth,angle=270]{Fig/grads.eps}
80\caption{Example of temperature data (in this case for present-day Mars) at a given time using
81GrADS visualization\label{fg:grads}}
82\end{figure}
83%
84However, unlike NetCDF, GrADS only recognizes files where all the variables are stored on the same horizontal grid.
85These variables can be in 1, 2, 3 or 4 dimensions (X,Y,Z and t).\\
86
87GrADS can also be obtained on the {WWW}{http://grads.iges.org/grads/}.
88
89\section{Input and parameter files}
90
91%{\bf \it Examples of initialization files can be found in directory
92%\begin{verbatim}$PATH1/LMDZ.MARS/deftank \end{verbatim}}
93\label{loc:entrees}
94
95The (3D version of the) GCM requires
96the input of two initialization files (in NetCDF format):\\
97-{\bf start.nc}
98contains the initial states of the dynamical variables.\\
99-{\bf startfi.nc}
100contains the initial states of the physical variables.\\
101Note that collections of initial states can be retreived at:\\
102\verb+http://www.lmd.jussieu.fr/~forget/datagcm/Starts+ \\
103Extracting {\tt start.nc} and {\tt startfi.nc} from these archived
104requires using program {\tt newstart}, as described in
105section~\ref{sc:newstart}.\\
106
107\noindent
108To run, the GCM also requires the  four following
109parameter files (ascii text files):\\
110-{\bf run.def} the parameters of the dynamical part of the program,
111and the temporal integration of the model.\\
112-{\bf callphys.def} the parameters for calling the physical part.\\
113-{\bf traceur.def} the names of the tracer to use.\\
114-{\bf z2sig.def}
115 the vertical distribution of the atmospheric layers.\\
116Examples of these parameter files can be found in the
117\verb+LMDZ.MARS/deftank+ directory.
118
119\subsection{run.def}
120\label{vb:run.def}
121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122% run.def: les param sont lus dans dyn3d/defrun.F
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124
125A typical {\tt run.def} file is given as an example below.
126The choice of variables to be set is simple (e.g.
127 {\tt nday} number of modeled days to run),
128while the others do not need to be changed for normal use.\\
129The format of the {\tt run.def} file is quite straightforward
130(and flexible): values given to parameters must be given as:
131\begin{verbatim}
132  parameter = value
133\end{verbatim}
134Any blank line or line beginning with symbol {\bf \#} is
135a comment, and instruction lines may be written in any order.
136Moreover, not specifying a parameter/value set (e.g. deleting it
137or commenting it out) means you want the GCM to use a default built-in value.
138Additionally, one may use a specific keyword {\bf INCLUDEDEF} to specify
139another (text) file in which to also read values of parameters; e.g.:
140\begin{verbatim}
141INCLUDEDEF=callphys.def
142\end{verbatim}
143
144
145\noindent Here are some details about some of the parameters which may be
146set in {\tt run.def}:
147\begin{itemize}
148\item {\bf day\_step}, the number of dynamical steps per day to use for
149the time integration. This needs to be large enough for the model
150to remain stable (this is related to the CFL stability criterion
151which essentially depends on the horizontal resolution of the model).
152On Mars, in theory, the GCM can run with
153{\tt day\_step}=480 using the 64$\times$48 grid, but model stability
154improves when this number is higher: {\tt day\_step}=960 is recommended
155 when using the 64$\times$48 grid. According to the CFL criterion,
156{\tt day\_step} should vary in proportion with the resolution: for example
157{\tt day\_step}=480 using the 32$\times$24 horizontal resolution.
158Note that {\tt day\_step} must also be divisible by {\tt iperiod}. For other planets... [FINISH]
159
160\item {\bf tetagdiv, tetagrot, tetatemp} control the dissipation intensity.
161It is better to limit the dissipation intensity
162(tetagdiv, tetagrot, tetatemp should not be too low).
163However the model diverges if tetagdiv, tetagrot, tetatemp are too high,
164especially if there is a lot of dust in the atmosphere. \\
165Example used with nitergdiv=1 and  nitergrot=niterh=2 : \\
166- using the 32$\times$24 grid tetagdiv=6000~s ; tetagrot=tetatemp=30000~s \\
167- using the 64$\times$48 grid: tetagdiv=3000~s ; tetagrot=tetatemp=9000~s
168
169\item {\bf idissip} is the time step used for the dissipation:
170dissipation is computed and added every {\tt idissip} dynamical
171time step. If {\tt idissip} is
172too short, the model waste time in these calculations. But if idissip is too
173long, the  dissipation will not be parametrized correctly and the  model will
174be more likely to diverge.
175A check must be made, so that:
176{\tt idissip}~$<$~{\tt tetagdiv}$\times${\tt daystep}/86400
177(same rule for {\tt tetagrot} and {\tt tetatemp}).
178This is tested automatically during the run.
179
180\item {\bf iphysiq} is the time step used for the physics:
181physical tendencies are computed every {\tt iphysiq} dynamical time step.
182In practice, we
183usually set the physical time step to be of the order of half an hour.
184We thus generally set {\tt iphysiq}= {\tt day\_step}/48
185
186\end{itemize}
187
188\noindent
189{\it Example of run.def file: }
190\input{input/run.tex}
191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
192
193
194\subsection{callphys.def}
195\label{sc:callphys.def}
196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197% callphys.def: les param sont lus dans phymars/inifis.F
198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
199The {\tt callphys.def} file (along the same format
200as the {\tt run.def} file) contains parameter/value sets
201for the physics.\\
202
203
204\noindent
205{\it Example of callphys.def file: }
206\input{input/callphys.tex}
207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
208
209\subsection{traceur.def}
210\label{sc:traceur.def}
211Tracers in input ({\tt start.nc} and {\tt startfi.nc}) and output
212files ({\tt restart.nc} and {\tt restartfi.nc}) are stored using
213individual tracer names (e.g. {\tt co2} for CO2 gas, {\tt h2o\_vap}
214for water vapour, {\tt h2o\_ice} for water ice, ...).\\
215The first line of the {\tt traceur.def} file (an ASCII file) must
216contain the number of tracers to load and use (this number should
217be the same as given to the {\tt -t} option of the {\tt makegcm}
218script when the GCM was compiled), followed by the tracer names
219(one per line). Note that if the corresponding tracers are not
220found in input files {\tt start.nc} and {\tt startfi.nc}, then the
221tracer is initialized to zero.\\
222
223
224\noindent {\it Example of a traceur.def file:
225(with water vapour and ice tracers)}
226{\footnotesize
227\begin{verbatim}
2282
229h2o_ice
230h2o_vap
231\end{verbatim}
232}
233
234\subsection{z2sig.def}
235The {\tt z2sig.def} file contains the pseudo-altitudes
236(in km) at which the user wants to set the vertical levels.\\
237Note that levels should be unevenly spread, with a higher resolution
238near the surface in order to capture the rapid variations of variables
239there. It is recommended to use the altitude levels as set in the
240{\tt z2sig.def} file provided in the {\tt deftank} directory.\\
241
242\noindent
243{\it Example of  z2sig.def file}
244\input{input/z2sig.tex}
245
246\subsection{Initialization files: start and startfi}
247
248%
249\begin{figure}[h]
250\centering
251\framebox[0.8\textwidth][c]{\includegraphics[width=0.7\textwidth]{Fig/netcdf.eps}}
252\caption{Organization of NetCDF files \label{fg:netcdf}}
253\end{figure}
254%
255Files {\tt start.nc} and {\tt startfi.nc}, like all the NetCDF files of
256the GCM,
257are constructed on the same model (see NetCDF file composition,
258figure~\ref{fg:netcdf}). They contain:\\
259- a header with a ``control'' variable followed by a series of variables
260defining the (physical and dynamical) grids \\
261- a series of non temporal variables that give information about surface
262conditions on the planet.\\
263- a ``time'' variable giving the values of the different instants at which
264the temporal variables are stored
265(a single time value (t=0) for start,
266as it describes the dynamical initial states,
267and no time values for startfi, as it describes only a physical state).\\
268
269To visualize the contents of a {\tt start.nc} file using the
270{\tt ncdump} command:\\
271
272\noindent
273{\it ncdump -h start.nc}\\
274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275% List START
276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277\input{input/dyn_list.tex}
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279
280\noindent
281List of contents of a {\tt startfi.nc} file:\\
282
283\noindent
284{\it ncdump -h startfi.nc}\\
285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
286% List startfi
287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288\input{input/fi_list.tex}
289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290
291
292
293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294%    Description des start et startfi
295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296
297\paragraph{Physical and dynamical headers}
298
299There are two types of headers: one for the physical headers,
300and one for the dynamical headers.
301The headers always begin with a ``control' variable
302(described below), that is allocated differently in the physical and
303dynamical parts.
304The other variables in the header concern the (physical and dynamical) grids.
305They are the following:\\
306
307\noindent
308the horizontal coordinates\\
309- {\bf rlonu}, {\bf rlatu}, {\bf rlonv}, {\bf rlatv} for the dynamical part,\\
310- {\bf lati}, {\bf long} for the physical part,\\
311
312\noindent
313the coefficients for passing from the physical grid to the dynamical grid\\
314- {\bf cu},{\bf cv} only in the dynamical header\\
315
316\noindent
317and finally, the grid box areas\\
318- {\bf aire} for the dynamical part,\\
319- {\bf area} for the physical part.\\
320
321\paragraph{Surface conditions}
322
323The surface conditions are mostly given in the physical NetCDF files by
324variables:\\
325- {\bf phisfi} for the initial state of surface geopotential,\\
326- {\bf albedodat} for the bare ground albedo,\\
327- {\bf inertiedat} for the surface thermal inertia,\\
328- {\bf zmea}, {\bf zstd}, {\bf zsig}, {\bf zgam} and {\bf zthe} for
329  the subgrid scale topography.\\
330
331\noindent
332For the dynamics:\\
333- {\bf physinit} for the initial state of surface geopotential\\
334
335\noindent
336Remark: variables {\bf phisfi} and {\bf physinit} contain the same information
337(surface geopotential), but {\bf phisfi} gives the geopotential values on the
338physical grid, while {\bf physinit} give the values on the dynamical grid.\\
339
340\paragraph{Physical and dynamical state variables}
341To save disk space, the initialization files store the variables used by
342the model, rather than the ``natural'' variables.\\
343
344\noindent
345For the dynamics:
346\begin{description}
347\item - {\bf ucov} and {\bf vcov} the covariant winds\\
348These variables are linked to the ``natural'' winds by\\
349\verb+ucov = cu * u+ and \verb+vcov = cv * v+
350\item - {\bf teta} the potential temperature,\\
351  or more precisely, the potential enthalpy linked to temperature {\bf T} by
352  $\theta = T\dep{\frac{P}{Pref}}^{-K}$
353\item - the tracers,
354\item - {\bf ps} surface pressure.
355\item - {\bf masse} the atmosphere mass in each grid box.
356\end{description}
357
358\noindent
359``Vectorial'' variables {\bf ucov} and {\bf vcov} are stored on
360``staggered'' grids u and v respectively (in the dynamics)
361(see section \ref{fg:grid}).\\
362Scalar variables {\bf h}, {\bf q} (tracers), {\bf ps}, {\bf masse} are stored
363on the ``scalar'' grid of the dynamical part.\\
364
365\noindent
366For the physics:
367\begin{description}
368\item - {\bf co2ice} surface dry ice,
369\item - {\bf tsurf} surface temperature,
370\item - {\bf tsoil} temperatures at different layers under the surface,
371\item - {\bf emis} surface emissivity,
372\item - {\bf q2} wind variance,\\
373or more precisely, the square root of the turbulent kinetic energy.
374\item - the surface ``tracer'' budget
375 (kg.m$^{-2}$),\\
376\end{description}
377
378\noindent
379All these variables are stored on the ``physical'' grid
380(see section \ref{fg:grid}).\\
381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
382
383\paragraph{The ``control'' array}
384
385\indent
386Both physical and dynamical headers of the GCM NetCDF files start with
387a {\bf controle} variable. This variable is an array of 100 reals (the vector
388called {\tt tab\_cntrl} in the program), which contains the program control
389parameters.
390Parameters differ between the physical and dynamical sections, and examples
391of both are listed below. The contents of table {\tt tab\_cntrl} can also
392be checked with the command {\tt ncdump -ff -v controle}.\\
393
394\noindent
395{\bf The "control" array in the header of a dynamical NetCDF file:
396start}
397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
398% tab_cntrl (dynamique) dans dyn3d/inimomo.F
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400\input{input/dyn_cntl.tex}
401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402
403\noindent
404{\bf The "controle" array in the header of a physical NetCDF file:
405startfi.nc}
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407% tab_cntrl (physique) dans phymars/iniwritefi.F
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409\input{input/fi_cntl.tex}
410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
411
412\newpage
413\section{Output files}
414
415\subsection{NetCDF restart files - restart.nc and restartfi.nc}
416These files are of the exact same format as {\tt start.nc} and
417{\tt startfi.nc}
418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419% Description des fichiers de Sortie
420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421
422\subsection{ NetCDF file - diagfi.nc}
423NetCDF file {\tt diagfi.nc} stores the instantaneous physical variables
424throughout the simulation at regular intervals
425(set by the value of parameter {\tt ecritphy} in
426parameter file {\tt run.def}; note that {\tt ecritphy} should be a
427multiple of {\tt iphysiq} as well as a divisor of {\tt day\_step}).
428
429\noindent
430{\bf Any variable from any sub-routine of the physics can be stored
431by calling subroutine}
432\verb+ writediagfi+
433
434
435\noindent
436Illustrative example of the contents of a {\tt diagfi.nc}
437file (using ncdump):\\
438\noindent
439{\it ncdump -h diagfi.nc}\\
440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441% List DIAGFI
442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443% temporaire!!!
444\input{input/diag_list.tex}
445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
446
447\noindent
448The structure of the file is thus as follows:
449\begin{description}
450\item- the dimensions
451\item- variable ``time'' containing the time of the timestep stored in the
452 file (in Martian days since the beginning of the run)
453\item- variable ``control'' containing many parameters, as described above.
454\item- from `` rhonu'' to 'phisinit'': a list of data describing the
455 geometrical coordinates of the data file, plus the surface topography
456\item- finally, all the 2D or 3D data stored in the run.
457\end{description}
458
459
460\subsection{Stats files}
461
462As an option ({\tt stats} must be set to {\tt .true.} in {\tt callphys.def}),
463the model can accumulate any
464variable from any subroutine of the physics by calling
465subroutine \verb+ wstat+
466\\ \\
467\noindent
468This save is performed at regular intervals 12 times a day.
469An average of the daily evolutions over the whole run is calculated
470(for example, for a 10 day run, the averages of the variable values at
4710hTU, 2hTU, 4hTU,...24hTU are calculated), along with RMS standard
472deviations of the variables. This ouput is given in
473file {\tt stats.nc}.\\
474
475
476\noindent
477Illustrative example of the contents of a {\tt stats.nc} file (using ncdump):\\
478\noindent
479{\it ncdump -h stats.nc}\\
480\input{input/stats_list.tex}
481
482\noindent
483The structure of the file is simillar to the {\tt diagfi.nc} file,
484except that, as stated before, the average of variables are given for
48512 times of the day and that RMS standard deviation are also provided.
486
Note: See TracBrowser for help on using the repository browser.