1 | \chapter{Program organization and compilation script} |
---|
2 | \label{sc:info} |
---|
3 | \index{Programming organization and compilation} |
---|
4 | |
---|
5 | \label{loc:contenu} |
---|
6 | |
---|
7 | Currently the model is split between two directories: {\bf LMDZ.COMMON} |
---|
8 | and {\bf LMDZ.MARS}. The reason for this separation is that all that |
---|
9 | concerns the dynamics (and which is common to all planets) is in |
---|
10 | {\bf LMDZ.COMMON} whereas all that concerns the Martian physics is |
---|
11 | in {\bf LMDZ.MARS}. For historical reasons, {\bf LMDZ.MARS} still |
---|
12 | includes a dynamical core, but it is strongly recommended to use |
---|
13 | the {\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 | |
---|
50 | obtain |
---|
51 | \section{Organization of the model source files} |
---|
52 | \index{Organization of the model source files} |
---|
53 | |
---|
54 | The model source files are stored in various sub directories |
---|
55 | in directories {\tt LMDZ.COMMON/libf} and {\tt LMDZ.MARS/libf}. |
---|
56 | These sub-directories correspond to the different parts of the model: \\ |
---|
57 | In {\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, |
---|
60 | which contains the parameters that define the model grid, |
---|
61 | i.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 |
---|
74 | polar 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 |
---|
84 | other 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 |
---|
90 | dynamics 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 | |
---|
99 | The model is written in {\bf Fortran}. |
---|
100 | \begin{itemize} |
---|
101 | \item The program sources are written in {\bf ``file.F"} |
---|
102 | or {\bf ``file.F90''} files. |
---|
103 | The extension .F is the standard extension for fixed-form Fortran and |
---|
104 | the extension .F90 is for free-form Fortran. |
---|
105 | These files must be preprocessed (by a{\bf C preprocessor} |
---|
106 | such as (cpp)) before compilation (this behaviour is, for most |
---|
107 | compilers, implicitly obtained but using a capital F in the extention |
---|
108 | of the file names). |
---|
109 | |
---|
110 | \item Constants are placed in COMMON declarations, |
---|
111 | located 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 |
---|
114 | as arguments (and never as COMMON blocks). |
---|
115 | |
---|
116 | \item In some parts of the code, for ``historical'' reasons, |
---|
117 | the following rule is sometimes used: in the subroutine, |
---|
118 | the variables (ex: \verb+name+) passed as an argument by the calling program |
---|
119 | are given the prefix \verb+p+ (ex: \verb+pname+) |
---|
120 | while the local variables are given the prefix \verb+z+ (ex: \verb+zname+). |
---|
121 | As a result, several variables change their prefix (and thus their name) |
---|
122 | when passing from a calling subroutine to a called subroutine. |
---|
123 | \end{itemize} |
---|
124 | |
---|
125 | \section{Model organization} |
---|
126 | Figure~\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} |
---|
145 | Technically, the model is compiled using the Unix utility {\tt make}. |
---|
146 | The {\tt makelmdz\_fcm} utility script recreates the {\tt makefile} file |
---|
147 | when necessary, for example, when a source file has been added or removed |
---|
148 | since the last compilation. |
---|
149 | |
---|
150 | \noindent {\bf None of this is visible to the user. |
---|
151 | To (re-)compile the model just run the command} |
---|
152 | \begin{verbatim} |
---|
153 | makelmdz_fcm |
---|
154 | \end{verbatim} |
---|
155 | with adequate options (e.g. |
---|
156 | {\tt makelmdz\_fcm -arch local -d 62x48x32 -p mars gcm}), as |
---|
157 | described in section~\ref{sc:compile}. |
---|
158 | |
---|
159 | |
---|
160 | \paragraph{Help manual for the makelmdz\_fcm script} |
---|
161 | Use the "-h" option to learn about possible options: |
---|
162 | \begin{verbatim} |
---|
163 | makelmdz_fcm -h |
---|
164 | \end{verbatim} |
---|
165 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
166 | % makegcm.help: lu dans makegcm |
---|
167 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
168 | %\input{input/makegcm_help.tex} |
---|
169 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|