source: trunk/LMDZ.MARS/doc/compilation.tex @ 3468

Last change on this file since 3468 was 2569, checked in by emillour, 3 years ago

Mars GCM: update documentation (mostly better handling of http links)
EM

File size: 6.5 KB
Line 
1\chapter{Program organization and compilation script}
2\label{sc:info}
3\index{Programming organization and compilation}
4
5\label{loc:contenu} 
6
7Currently the model is split between two directories: {\bf LMDZ.COMMON}
8and {\bf LMDZ.MARS}. The reason for this separation is that all that
9concerns the dynamics (and which is common to all planets) is in
10{\bf LMDZ.COMMON} whereas all that concerns the Martian physics is
11in {\bf LMDZ.MARS}. For historical reasons, {\bf LMDZ.MARS} still
12includes a dynamical core, but it is strongly recommended to use
13the {\bf LMDZ.COMMON} (mandatory if you want to run in parallel).
14
15\noindent Here is a brief description of the contents of directory
16{\bf LMDZ.COMMON}:
17\begin{verbatim}
18 libf/  model FORTRAN Source code (.F or .F90)
19         and  include files (.h) organised in sub-directories
20        (dynamics (dyn3d), filters (filtrez), interface with
21         physical packages (dynphy_lonlat), ...)
22
23 arch/  set of architecture files used by the makelmdz_fcm script
24
25 makelmdz_fcm  script to use to compile the GCM and related
26                utilities
27 bin/ directory where executables generated by the makelmdz_fcm
28       script will be generated
29
30 ioipsl/ directory with scripts usefull to download and build the
31          IOIPSL library (not needed by the Martian GCM).
32\end{verbatim}
33
34\noindent And a brief description of the
35{\bf LMDZ.MARS} directory contents:
36\begin{verbatim}
37 libf/ Model FORTRAN Source code (.F or .F90)
38        and  include files (.h) organised in sub-directories
39        (physics (phymars), dynamics (dyn3d), filters (filtrez)...)
40
41 deftank/ A collection of examples of parameter files required
42                to run the GCM (run.def, callphys.def, ...)
43 
44 util/ A set of programs useful for post-processing GCM outputs.
45
46 makegcm (Obsolete) script that should be used to compile the GCM as well
47            as related utilities (newstart, start2archive, testphys1d)
48\end{verbatim}
49
50obtain
51\section{Organization of the model source files}
52\index{Organization of the model source files}
53
54The model source files are stored in various sub directories
55in directories {\tt LMDZ.COMMON/libf} and {\tt LMDZ.MARS/libf}.
56These sub-directories correspond to the different parts of the model: \\
57In {\tt LMDZ.COMMON} one will find directories relevant for the dynamical core:
58\begin{description}
59\item{\bf grid:} mainly made up of "dimensions.h" file,
60which contains the parameters that define the model grid,
61i.e. the number of points in longitude (iim), latitude (jjm) and altitude
62(llm).
63
64\item{\bf dyn3d:} contains the dynamical core's serial code.
65
66\item{\bf dyn3dpar:} contains the dynamical core's parallel code.
67
68\item{\bf dy3d\_common:} contains routine common to serial and parallel dynamical cores.
69
70\item{\bf dynphy\_lonlat:} contains the physics/dynamics interfaces, including in subdirectory
71{\tt dynphy\_lonlat/phymars} the interface to the Martian physics.
72
73\item{\bf filtrez:} contains the longitudinal filter sources applied in the
74polar latitudes where the Courant-Friedrich-Levy stability criterion would otherwise be violated.
75
76\item{\bf misc:} contains miscelaneous routines, neither specific to dynamics or physics.
77
78\item{\bf phy\_common:} contains routines common to all physics packages (Mars, Venus, ...)
79
80\item{\bf aeronomars, phymars:} these are links to the directories of the Mars physics package in
81{\tt LMDZ.MARS/libf}
82
83\item{\bf aeronostd, chimtitan, muphytitan, phystd, phytitan, phyvenus:} links, which may be broken, to
84other physics packages (Titan, Venus, Generic GCM).
85\end{description}
86
87\noindent In {\tt LMDZ.MARS/libf} are subdirectories relevent to the Mars physics package:
88\begin{description}
89\item{\bf dyn3d, grid, filtrez:} Obsolete versions of the serial dynamical core (the
90dynamics package included in LMDZ.COMMON should be used instead).
91
92\item{\bf phymars:} contains the Martian physics routines.
93
94\item{\bf aeronomars:} contains the Martian chemistry and thermosphere routines.
95\end{description}
96
97\section{Programming}
98
99The model is written in {\bf Fortran}.
100\begin{itemize}
101\item The program sources are written in {\bf ``file.F"} 
102or {\bf ``file.F90''} files.
103The extension .F is the standard extension for fixed-form Fortran and
104the extension .F90 is for free-form Fortran.
105These files must be preprocessed (by a{\bf C preprocessor}
106such as (cpp)) before compilation (this behaviour is, for most
107compilers, implicitly obtained but using a capital F in the extention
108of the file names).
109
110\item Constants are placed in COMMON declarations,
111located in the common ``include'' files {\bf "file.h"} or in relevant modules.
112
113\item In general, variables should be passed from subroutine to subroutine
114as arguments (and never as COMMON blocks).
115
116\item In some parts of the code, for ``historical'' reasons,
117the following rule is sometimes used: in the subroutine,
118the variables (ex: \verb+name+) passed as an argument by the calling program
119are given the prefix \verb+p+ (ex: \verb+pname+)
120 while the local variables are given the prefix \verb+z+ (ex: \verb+zname+).
121As a result, several variables change their prefix (and thus their name)
122when passing from a calling subroutine to a called subroutine.
123\end{itemize}
124
125\section{Model organization}
126Figure~\ref{fg:organi_phys} describes the main subroutines called by physiq.F.
127\index{Model organization}
128\begin{figure}
129\begin{flushleft}
130\includegraphics[scale=0.70,angle=-90]{Fig/physique.pdf}
131\caption{Organigram of subroutine function physiq.F}
132\label{fg:organi_phys}
133\end{flushleft}
134\end{figure}
135
136
137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138%  Compilation du modele
139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140
141\section{Compiling the model}
142\index{Compiling the model}
143
144\label{sc:compil1}
145Technically, the model is compiled using the Unix utility {\tt make}.
146The {\tt makelmdz\_fcm} utility script recreates the {\tt makefile} file
147when necessary, for example, when a source file has been added or removed
148since the last compilation.
149
150\noindent {\bf None of this is visible to the user.
151To (re-)compile the model just run the command}
152\begin{verbatim}
153makelmdz_fcm
154\end{verbatim}
155with adequate options (e.g.
156{\tt makelmdz\_fcm -arch local -d 62x48x32 -p mars gcm}), as
157described in section~\ref{sc:compile}.
158
159
160\paragraph{Help manual for the makelmdz\_fcm script}
161Use the "-h" option to learn about possible options:
162\begin{verbatim}
163makelmdz_fcm -h
164\end{verbatim}
165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166% makegcm.help:  lu dans makegcm
167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168%\input{input/makegcm_help.tex}
169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.