/[MITgcm]/manual/s_getstarted/text/getting_started.tex
ViewVC logotype

Diff of /manual/s_getstarted/text/getting_started.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.1.1 by adcroft, Wed Aug 8 16:15:31 2001 UTC revision 1.4 by adcroft, Mon Oct 15 19:35:11 2001 UTC
# Line 1  Line 1 
1  % $Header$  % $Header$
2  % $Name$  % $Name$
3    
4    %\section{Getting started}
5    
6  \begin{center}  In this section, we describe how to use the model. In the first
7  {\Large \textbf{Using the model}}  section, we provide enough information to help you get started with
8    the model. We believe the best way to familiarize yourself with the
9    model is to run the case study examples provided with the base
10    version. Information on how to obtain, compile, and run the code is
11    found there as well as a brief description of the model structure
12    directory and the case study examples.  The latter and the code
13    structure are described more fully in chapters
14    \ref{chap:discretization} and \ref{chap:sarch}, respectively. Here, in
15    this section, we provide information on how to customize the code when
16    you are ready to try implementing the configuration you have in mind.
17    
18    \section{Where to find information}
19    \label{sect:whereToFindInfo}
20    
21    A web site is maintained for release 1 (Sealion) of MITgcm:
22    \begin{verbatim}
23    http://mitgcm.org/sealion
24    \end{verbatim}
25    Here you will find an on-line version of this document, a
26    ``browsable'' copy of the code and a searchable database of the model
27    and site, as well as links for downloading the model and
28    documentation, to data-sources and other related sites.
29    
30  \vspace*{4mm}  There is also a support news group for the model that you can email at
31    \texttt{support@mitgcm.org} or browse at:
 \vspace*{3mm} {\large July 2001}  
 \end{center}  
   
 In this part, we describe how to use the model. In the first section, we  
 provide enough information to help you get started with the model. We  
 believe the best way to familiarize yourself with the model is to run the  
 case study examples provided with the base version. Information on how to  
 obtain, compile, and run the code is found there as well as a brief  
 description of the model structure directory and the case study examples.  
 The latter and the code structure are described more fully in sections 2 and  
 3, respectively. In section 4, we provide information on how to customize  
 the code when you are ready to try implementing the configuration you have  
 in mind.  
   
 \section{Getting started}  
   
 \subsection{Obtaining the code}  
   
 The reference web site for the model is:  
 \begin{verbatim}  
 http://mitgcm.org  
 \end{verbatim}  
   
 On this site, you can download the model as well as find useful information,  
 some of which might overlap with what is written here. There is also a  
 support news group for the model located at (send your message to \texttt{%  
 support@mitgcm.org}):  
32  \begin{verbatim}  \begin{verbatim}
33  news://mitgcm.org/mitgcm.support  news://mitgcm.org/mitgcm.support
34  \end{verbatim}  \end{verbatim}
35    A mail to the email list will reach all the developers and be archived
36    on the newsgroup. A users email list will be established at some time
37    in the future.
38    
39    
40    \section{Obtaining the code}
41    \label{sect:obtainingCode}
42    
43  If CVS is available on your system, we strongly encourage you to use it. CVS  If CVS is available on your system, we strongly encourage you to use it. CVS
44  provides an efficient and elegant way of organizing your code and keeping  provides an efficient and elegant way of organizing your code and keeping
45  track of your changes. If CVS is not available on your machine, you can also  track of your changes. If CVS is not available on your machine, you can also
46  download a tar file.  download a tar file.
47    
 \subsubsection{using CVS}  
   
48  Before you can use CVS, the following environment variable has to be set in  Before you can use CVS, the following environment variable has to be set in
49  your .cshrc or .tcshrc:  your .cshrc or .tcshrc:
50  \begin{verbatim}  \begin{verbatim}
# Line 52  your .cshrc or .tcshrc: Line 52  your .cshrc or .tcshrc:
52  % cvs login ( CVS password: cvsanon )  % cvs login ( CVS password: cvsanon )
53  \end{verbatim}  \end{verbatim}
54    
55  You only need to do ``cvs login'' once. To obtain the latest source:  You only need to do ``cvs login'' once. To obtain the source for the release:
56  \begin{verbatim}  \begin{verbatim}
57  % cvs co -d directory models/MITgcmUV  % cvs co -d directory -P -r release1 MITgcmUV
58  \end{verbatim}  \end{verbatim}
59    
60  This creates a directory called \textit{directory}. If \textit{directory}  This creates a directory called \textit{directory}. If \textit{directory}
# Line 62  exists this command updates your code ba Line 62  exists this command updates your code ba
62  directory in the source tree contains a directory \textit{CVS}. This  directory in the source tree contains a directory \textit{CVS}. This
63  information is required by CVS to keep track of your file versions with  information is required by CVS to keep track of your file versions with
64  respect to the repository. Don't edit the files in \textit{CVS}! To obtain a  respect to the repository. Don't edit the files in \textit{CVS}! To obtain a
65  specific \textit{version} that is not the latest source:  different \textit{version} that is not the latest source:
66    \begin{verbatim}
67    % cvs co -d directory -P -r version MITgcm
68    \end{verbatim}
69    or the latest development version:
70  \begin{verbatim}  \begin{verbatim}
71  % cvs co -d directory -r version models/MITgcmUV  % cvs co -d directory -P MITgcm
72  \end{verbatim}  \end{verbatim}
73    
74  \subsubsection{other methods}  \paragraph*{Conventional download method}
75    \label{sect:conventionalDownload}
76    
77  You can download the model as a tar file from the reference web site at:  If you do not have CVS on your system, you can download the model as a
78    tar file from the reference web site at:
79  \begin{verbatim}  \begin{verbatim}
80  http://mitgcm.org/download/  http://mitgcm.org/download/
81  \end{verbatim}  \end{verbatim}
82    The tar file still contains CVS information which we urge you not to
83    delete; even if you do not use CVS yourself the information can help
84    us if you should need to send us your copy of the code.
85    
86  \subsection{Model and directory structure}  \section{Model and directory structure}
87    
88  The ``numerical'' model is contained within a execution environment support  The ``numerical'' model is contained within a execution environment support
89  wrapper. This wrapper is designed to provide a general framework for  wrapper. This wrapper is designed to provide a general framework for
# Line 124  the makefile specific to the Tangent lin Line 133  the makefile specific to the Tangent lin
133  generates the adjoint code. The latter is described in details in part V.  generates the adjoint code. The latter is described in details in part V.
134    
135  \item \textit{utils}: this directory contains various utilities. The  \item \textit{utils}: this directory contains various utilities. The
136  subdirectory \textit{knudsen2} contains code and a makefile that compute  subdirectory \textit{knudsen2} contains code and a makefile that
137  coefficients of the polynomial approximation to the knudsen formula for an  compute coefficients of the polynomial approximation to the knudsen
138  ocean nonlinear equation of state. The \textit{matlab} subdirectory contains  formula for an ocean nonlinear equation of state. The \textit{matlab}
139  matlab scripts for reading model output directly into matlab. \textit{scripts%  subdirectory contains matlab scripts for reading model output directly
140  } contains C-shell post-processing scripts for joining processor-based and  into matlab. \textit{scripts} contains C-shell post-processing
141  tiled-based model output.  scripts for joining processor-based and tiled-based model output.
142    
143  \item \textit{verification}: this directory contains the model examples. See  \item \textit{verification}: this directory contains the model examples. See
144  below.  section \ref{sect:modelExamples}.
145  \end{itemize}  \end{itemize}
146    
147  \subsection{Model examples}  \section{Example experiments}
148    \label{sect:modelExamples}
149    
150  Now that you have successfully downloaded the model code we recommend that  Now that you have successfully downloaded the model code we recommend that
151  you first try to run the examples provided with the base version. You will  you first try to run the examples provided with the base version. You will
# Line 144  you will use eventually. The examples ar Line 154  you will use eventually. The examples ar
154  the directory \textit{verification} and are briefly described below (a full  the directory \textit{verification} and are briefly described below (a full
155  description is given in section 2):  description is given in section 2):
156    
157  \subsubsection{List of model examples}  \subsection{List of model examples}
158    
159  \begin{itemize}  \begin{itemize}
160  \item \textit{exp0} - single layer, ocean double gyre (barotropic with  \item \textit{exp0} - single layer, ocean double gyre (barotropic with
# Line 198  Molteni physics package. Global configur Line 208  Molteni physics package. Global configur
208  \item \textit{adjustment.cs-32x32x1}  \item \textit{adjustment.cs-32x32x1}
209  \end{itemize}  \end{itemize}
210    
211  \subsubsection{Directory structure of model examples}  \subsection{Directory structure of model examples}
212    
213  Each example directory has the following subdirectories:  Each example directory has the following subdirectories:
214    
# Line 250  comparison with your own output when you Line 260  comparison with your own output when you
260  Once you have chosen the example you want to run, you are ready to compile  Once you have chosen the example you want to run, you are ready to compile
261  the code.  the code.
262    
263  \subsection{Compiling the code}  \section{Building the code}
264    \label{sect:buildingCode}
265    
266    To compile the code, we use the {\em make} program. This uses a file
267    ({\em Makefile}) that allows us to pre-process source files, specify
268    compiler and optimization options and also figures out any file
269    dependancies. We supply a script ({\em genmake}), described in section
270    \ref{sect:genmake}, that automatically creates the {\em Makefile} for
271    you. You then need to build the dependancies and compile the code.
272    
273    As an example, let's assume that you want to build and run experiment
274    \textit{verification/exp2}. The are multiple ways and places to actually
275    do this but here let's build the code in
276    \textit{verification/exp2/input}:
277    \begin{verbatim}
278    % cd verification/exp2/input
279    \end{verbatim}
280    First, build the {\em Makefile}:
281    \begin{verbatim}
282    % ../../../tools/genmake -mods=../code
283    \end{verbatim}
284    The command line option tells {\em genmake} to override model source
285    code with any files in the directory {\em ./code/}.
286    
287    If there is no \textit{.genmakerc} in the \textit{input} directory, you have
288    to use the following options when invoking \textit{genmake}:
289    \begin{verbatim}
290    % ../../../tools/genmake  -mods=../code
291    \end{verbatim}
292    
293    Next, create the dependancies:
294    \begin{verbatim}
295    % make depend
296    \end{verbatim}
297    This modifies {\em Makefile} by attaching a [long] list of files on
298    which other files depend. The purpose of this is to reduce
299    re-compilation if and when you start to modify the code. {\tt make
300    depend} also created links from the model source to this directory.
301    
302    Now compile the code:
303    \begin{verbatim}
304    % make
305    \end{verbatim}
306    The {\tt make} command creates an executable called \textit{mitgcmuv}.
307    
308    Now you are ready to run the model. General instructions for doing so are
309    given in section \ref{sect:runModel}. Here, we can run the model with:
310    \begin{verbatim}
311    ./mitgcmuv > output.txt
312    \end{verbatim}
313    where we are re-directing the stream of text output to the file {\em
314    output.txt}.
315    
316    
317    \subsection{Building/compiling the code elsewhere}
318    
319    In the example above (section \ref{sect:buildingCode}) we built the
320    executable in the {\em input} directory of the experiment for
321    convenience. You can also configure and compile the code in other
322    locations, for example on a scratch disk with out having to copy the
323    entire source tree. The only requirement to do so is you have {\tt
324    genmake} in your path or you know the absolute path to {\tt genmake}.
325    
326    The following sections outline some possible methods of organizing you
327    source and data.
328    
329    \subsubsection{Building from the {\em ../code directory}}
330    
331    This is just as simple as building in the {\em input/} directory:
332    \begin{verbatim}
333    % cd verification/exp2/code
334    % ../../../tools/genmake
335    % make depend
336    % make
337    \end{verbatim}
338    However, to run the model the executable ({\em mitgcmuv}) and input
339    files must be in the same place. If you only have one calculation to make:
340    \begin{verbatim}
341    % cd ../input
342    % cp ../code/mitgcmuv ./
343    % ./mitgcmuv > output.txt
344    \end{verbatim}
345    or if you will be making muliple runs with the same executable:
346    \begin{verbatim}
347    % cd ../
348    % cp -r input run1
349    % cp code/mitgcmuv run1
350    % cd run1
351    % ./mitgcmuv > output.txt
352    \end{verbatim}
353    
354    \subsubsection{Building from a new directory}
355    
356    Since the {\em input} directory contains input files it is often more
357    useful to keep {\em input} prestine and build in a new directory
358    within {\em verification/exp2/}:
359    \begin{verbatim}
360    % cd verification/exp2
361    % mkdir build
362    % cd build
363    % ../../../tools/genmake -mods=../code
364    % make depend
365    % make
366    \end{verbatim}
367    This builds the code exactly as before but this time you need to copy
368    either the executable or the input files or both in order to run the
369    model. For example,
370    \begin{verbatim}
371    % cp ../input/* ./
372    % ./mitgcmuv > output.txt
373    \end{verbatim}
374    or if you tend to make multiple runs with the same executable then
375    running in a new directory each time might be more appropriate:
376    \begin{verbatim}
377    % cd ../
378    % mkdir run1
379    % cp build/mitgcmuv run1/
380    % cp input/* run1/
381    % cd run1
382    % ./mitgcmuv > output.txt
383    \end{verbatim}
384    
385    \subsubsection{Building from on a scratch disk}
386    
387    Model object files and output data can use up large amounts of disk
388    space so it is often the case that you will be operating on a large
389    scratch disk. Assuming the model source is in {\em ~/MITgcm} then the
390    following commands will build the model in {\em /scratch/exp2-run1}:
391    \begin{verbatim}
392    % cd /scratch/exp2-run1
393    % ~/MITgcm/tools/genmake -rootdir=~/MITgcm -mods=~/MITgcm/verification/exp2/code
394    % make depend
395    % make
396    \end{verbatim}
397    To run the model here, you'll need the input files:
398    \begin{verbatim}
399    % cp ~/MITgcm/verification/exp2/input/* ./
400    % ./mitgcmuv > output.txt
401    \end{verbatim}
402    
403    As before, you could build in one directory and make multiple runs of
404    the one experiment:
405    \begin{verbatim}
406    % cd /scratch/exp2
407    % mkdir build
408    % cd build
409    % ~/MITgcm/tools/genmake -rootdir=~/MITgcm -mods=~/MITgcm/verification/exp2/code
410    % make depend
411    % make
412    % cd ../
413    % cp -r ~/MITgcm/verification/exp2/input run2
414    % cd run2
415    % ./mitgcmuv > output.txt
416    \end{verbatim}
417    
418    
419    
420  \subsubsection{The script \textit{genmake}}  \subsection{\textit{genmake}}
421    \label{sect:genmake}
422    
423  To compile the code, use the script \textit{genmake} located in the \textit{%  To compile the code, use the script \textit{genmake} located in the \textit{%
424  tools} directory. \textit{genmake} is a script that generates the makefile.  tools} directory. \textit{genmake} is a script that generates the makefile.
# Line 353  For some of the examples, there is a fil Line 519  For some of the examples, there is a fil
519  that particular example. In this way you don't need to type the options when  that particular example. In this way you don't need to type the options when
520  invoking \textit{genmake}.  invoking \textit{genmake}.
521    
 \subsubsection{Compiling}  
522    
523  Let's assume that you want to run, say, example \textit{exp2} in the \textit{%  \section{Running the model}
524  input} directory. To compile the code, type the following commands from the  \label{sect:runModel}
 model root tree:  
 \begin{verbatim}  
 % cd verification/exp2/input  
 % ../../../tools/genmake  
 % make depend  
 % make  
 \end{verbatim}  
525    
526  If there is no \textit{.genmakerc} in the \textit{input} directory, you have  If compilation finished succesfuully (section \ref{sect:buildModel})
527  to use the following options when invoking \textit{genmake}:  then an executable called {\em mitgcmuv} will now exist in the local
528  \begin{verbatim}  directory.
 % ../../../tools/genmake  -mods=../code  
 \end{verbatim}  
529    
530  In addition, you will probably want to disable some of the packages. Taking  To run the model as a single process (ie. not in parallel) simply
531  again the case of \textit{exp2}, the full \textit{genmake} command will  type:
 probably look like this:  
532  \begin{verbatim}  \begin{verbatim}
533  % ../../../tools/genmake  -mods=../code  -disable=kpp,gmredi,aim,...  % ./mitgcmuv
534  \end{verbatim}  \end{verbatim}
535    The ``./'' is a safe-guard to make sure you use the local executable
536  The make command creates an executable called \textit{mitgcmuv}.  in case you have others that exist in your path (surely odd if you
537    do!). The above command will spew out many lines of text output to
538  Note that you can compile and run the code in another directory than \textit{%  your screen.  This output contains details such as parameter values as
539  input}. You just need to make sure that you copy the input data files into  well as diagnostics such as mean Kinetic energy, largest CFL number,
540  the directory where you want to run the model. For example to compile from  etc. It is worth keeping this text output with the binary output so we
541  \textit{code}:  normally re-direct the {\em stdout} stream as follows:
542  \begin{verbatim}  \begin{verbatim}
543  % cd verification/exp2/code  % ./mitgcmuv > output.txt
 % ../../../tools/genmake  
 % make depend  
 % make  
544  \end{verbatim}  \end{verbatim}
545    
546  \subsection{Running the model}  For the example experiments in {\em vericication}, an example of the
547    output is kept in {\em results/output.txt} for comparison. You can compare
548    your {\em output.txt} with this one to check that the set-up works.
549    
550    
 The first thing to do is to run the code by typing \textit{mitgcmuv} and see  
 what happens. You can compare what you get with what is in the \textit{%  
 results} directory. Unless noted otherwise, most examples are set up to run  
 for a few time steps only so that you can quickly figure out whether the  
 model is working or not.  
551    
552  \subsubsection{Output files}  \subsection{Output files}
553    
554  The model produces various output files. At a minimum, the instantaneous  The model produces various output files. At a minimum, the instantaneous
555  ``state'' of the model is written out, which is made of the following files:  ``state'' of the model is written out, which is made of the following files:
# Line 450  as the pickup files but are named differ Line 600  as the pickup files but are named differ
600  used to restart the model but are overwritten every other time they are  used to restart the model but are overwritten every other time they are
601  output to save disk space during long integrations.  output to save disk space during long integrations.
602    
603  \subsubsection{Looking at the output}  \subsection{Looking at the output}
604    
605  All the model data are written according to a ``meta/data'' file format.  All the model data are written according to a ``meta/data'' file format.
606  Each variable is associated with two files with suffix names \textit{.data}  Each variable is associated with two files with suffix names \textit{.data}
# Line 464  written in this format. The matlab scrip Line 614  written in this format. The matlab scrip
614  \textit{utils/matlab} under the root tree. The script \textit{rdmds.m} reads  \textit{utils/matlab} under the root tree. The script \textit{rdmds.m} reads
615  the data. Look at the comments inside the script to see how to use it.  the data. Look at the comments inside the script to see how to use it.
616    
617  \section{Code structure}  Some examples of reading and visualizing some output in {\em Matlab}:
618    \begin{verbatim}
619    % matlab
620    >> H=rdmds('Depth');
621    >> contourf(H');colorbar;
622    >> title('Depth of fluid as used by model');
623    
624    >> eta=rdmds('Eta',10);
625    >> imagesc(eta');axis ij;colorbar;
626    >> title('Surface height at iter=10');
627    
628    >> eta=rdmds('Eta',[0:10:100]);
629    >> for n=1:11; imagesc(eta(:,:,n)');axis ij;colorbar;pause(.5);end
630    \end{verbatim}
631    
632  \section{Doing it yourself: customizing the code}  \section{Doing it yourself: customizing the code}
633    
 \subsection{\protect\bigskip Configuration and setup}  
   
634  When you are ready to run the model in the configuration you want, the  When you are ready to run the model in the configuration you want, the
635  easiest thing is to use and adapt the setup of the case studies experiment  easiest thing is to use and adapt the setup of the case studies experiment
636  (described previously) that is the closest to your configuration. Then, the  (described previously) that is the closest to your configuration. Then, the
# Line 478  relative to the ''numerical model'' part Line 639  relative to the ''numerical model'' part
639  the ''execution environment'' part is covered in the parallel implementation  the ''execution environment'' part is covered in the parallel implementation
640  section) and on the variables and parameters that you are likely to change.  section) and on the variables and parameters that you are likely to change.
641    
642    \subsection{\protect\bigskip Configuration and setup}
643    
644  The CPP keys relative to the ''numerical model'' part of the code are all  The CPP keys relative to the ''numerical model'' part of the code are all
645  defined and set in the file \textit{CPP\_OPTIONS.h }in the directory \textit{%  defined and set in the file \textit{CPP\_OPTIONS.h }in the directory \textit{%
646  model/inc }or in one of the \textit{code }directories of the case study  model/inc }or in one of the \textit{code }directories of the case study
# Line 494  In what follows the parameters are group Line 657  In what follows the parameters are group
657  computational domain, the equations solved in the model, and the simulation  computational domain, the equations solved in the model, and the simulation
658  controls.  controls.
659    
660  \subsubsection{Computational domain, geometry and time-discretization}  \subsection{Computational domain, geometry and time-discretization}
661    
662  \begin{itemize}  \begin{itemize}
663  \item dimensions  \item dimensions
# Line 586  parameter is set through the variable \t Line 749  parameter is set through the variable \t
749  stagger baroclinic time stepping can be activated by setting the logical  stagger baroclinic time stepping can be activated by setting the logical
750  variable \textbf{staggerTimeStep }to '.\texttt{TRUE}.'.  variable \textbf{staggerTimeStep }to '.\texttt{TRUE}.'.
751    
752  \subsubsection{Equation of state}  \subsection{Equation of state}
753    
754  First, because the model equations are written in terms of perturbations, a  First, because the model equations are written in terms of perturbations, a
755  reference thermodynamic state needs to be specified. This is done through  reference thermodynamic state needs to be specified. This is done through
# Line 615  available in the same directory and you Line 778  available in the same directory and you
778  values of the vertical levels in \textit{knudsen2.f }so that they match  values of the vertical levels in \textit{knudsen2.f }so that they match
779  those of your configuration). \textit{\ }  those of your configuration). \textit{\ }
780    
781  \subsubsection{Momentum equations}  \subsection{Momentum equations}
782    
783  In this section, we only focus for now on the parameters that you are likely  In this section, we only focus for now on the parameters that you are likely
784  to change, i.e. the ones relative to forcing and dissipation for example.  to change, i.e. the ones relative to forcing and dissipation for example.
# Line 719  geopotential (for the atmosphere) you ne Line 882  geopotential (for the atmosphere) you ne
882  \texttt{TRUE}.' and the other to '.\texttt{FALSE}.' depending on how you  \texttt{TRUE}.' and the other to '.\texttt{FALSE}.' depending on how you
883  want to deal with the ocean upper or atmosphere lower boundary).  want to deal with the ocean upper or atmosphere lower boundary).
884    
885  \subsubsection{Tracer equations}  \subsection{Tracer equations}
886    
887  This section covers the tracer equations i.e. the potential temperature  This section covers the tracer equations i.e. the potential temperature
888  equation and the salinity (for the ocean) or specific humidity (for the  equation and the salinity (for the ocean) or specific humidity (for the
# Line 810  wish the tracer vertical diffusivities t Line 973  wish the tracer vertical diffusivities t
973  vertically due to static instabilities. Note that \textbf{cadjFreq }and  vertically due to static instabilities. Note that \textbf{cadjFreq }and
974  \textbf{ivdc\_kappa }can not both have non-zero value.  \textbf{ivdc\_kappa }can not both have non-zero value.
975    
976  \subsubsection{Simulation controls}  \subsection{Simulation controls}
977    
978  The model ''clock'' is defined by the variable \textbf{deltaTClock }(in s)  The model ''clock'' is defined by the variable \textbf{deltaTClock }(in s)
979  which determines the IO frequencies and is used in tagging output.  which determines the IO frequencies and is used in tagging output.

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22