2 |
|
|
3 |
<article id="MITgcm-Development-HOWTO"> |
<article id="MITgcm-Development-HOWTO"> |
4 |
|
|
|
<!-- |
|
|
Build commands: |
|
|
db2ps -d ldp.dsl devel_HOWTO.sgml |
|
|
db2pdf -d ldp.dsl devel_HOWTO.sgml |
|
|
db2html -d ./ldp.dsl devel_HOWTO.sgml |
|
|
db2html -u -d ./ldp.dsl devel_HOWTO.sgml |
|
|
--> |
|
|
|
|
5 |
<articleinfo> |
<articleinfo> |
6 |
<title>MITgcm Development HOWTO</title> |
<title>MITgcm Development HOWTO</title> |
7 |
|
|
55 |
<sect2> |
<sect2> |
56 |
<title>User Manual</title> |
<title>User Manual</title> |
57 |
|
|
58 |
<para>Before jumping into |
<para>Before jumping into development, please familiarize yourself with |
59 |
development, please familiarize yourself with the MITgcm user |
the <ulink url="http://mitgcm.org/docs.html"> MITgcm user manual |
60 |
manual which is available <ulink |
</ulink>. This document contains volumes of useful information and is |
61 |
url="http://mitgcm.org/">on the main web page</ulink>. This |
included here by reference.</para> |
|
document contains volumes of useful information and is included |
|
|
here by reference.</para> |
|
62 |
|
|
63 |
<para>Also, a "snapshot" or<ulink |
<!-- |
64 |
|
<para>Also, a "snapshot" or <ulink |
65 |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
66 |
the user manual may be available, though this is only put on the |
the user manual may be available, though this is only put on the |
67 |
web for testing purposes.</para> |
web for testing purposes.</para> |
68 |
|
--> |
69 |
</sect2> |
</sect2> |
70 |
|
|
71 |
<sect2> |
<sect2> |
182 |
<title>Branches</title> |
<title>Branches</title> |
183 |
|
|
184 |
<para>As shown in the online <ulink |
<para>As shown in the online <ulink |
185 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index?graph=1.174">ViewCVS-generated |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index?graph=1.174"> |
186 |
tree</ulink>, the MITgcm codebase is split into to two branches |
ViewCVS-generated tree</ulink>, the MITgcm codebase is split into to two |
187 |
or "lines" under which development proceeds. These two lines |
branches or "lines" under which development proceeds. These two lines are |
188 |
are referred to as the "MAIN" and "ecco" versions of the code. |
referred to as the "MAIN" and "ecco" versions of the code. While not |
189 |
While not identical, the bulk of the MAIN and ecco lines are |
identical, the bulk of the MAIN and ecco lines are composed of files from |
190 |
composed of files from the same codebase. |
the same codebase. |
191 |
</para> |
</para> |
192 |
|
|
193 |
<para>Periodically, a "Release" branch is formed from the "MAIN" |
<para>Periodically, a "Release" branch is formed from the "MAIN" |
194 |
development branch. This is done in order to create a |
development branch. This is done in order to create a relatively stable |
195 |
relatively stable reference point for both users and developers. |
reference point for both users and developers. The intent is that once a |
196 |
The intent is that once a relese branch has been created, only |
relese branch has been created, only bug-fixes will be added to it. |
197 |
bug-fixes will be added to it. Meanwhile, development (which |
Meanwhile, development (which might "break" or otherwise render invalid |
198 |
might "break" or otherwise render invalid the documentation, |
the documentation, tutorials, and/or examples contained within a release |
199 |
tutorials, and/or examples contained within a release branch) is |
branch) is allowed to continue along the MAIN and ecco lines.</para> |
|
allowed to continue along the MAIN and ecco lines.</para> |
|
200 |
</sect2> |
</sect2> |
201 |
|
|
202 |
<sect2> |
<sect2> |
203 |
<title>Tagging</title> |
<title>Tagging</title> |
204 |
|
|
205 |
<para>The intent of tagging is to create "known-good" |
<para>The intent of tagging is to create "known-good" checkpoints that |
206 |
checkpoints that developers can use as references. |
developers can use as references. Traditionally, MITgcm tagging has |
207 |
Traditionally, MITgcm tagging has maintained the following |
maintained the following conventions:</para> |
|
conventions:</para> |
|
208 |
|
|
209 |
<orderedlist> |
<orderedlist> |
210 |
<listitem> |
<listitem> |
211 |
<para>Developer checks out code into a local CVS-managed |
<para>Developer checks out code into a local CVS-managed directory, |
212 |
directory, makes various changes/additions, tests these |
makes various changes/additions, tests these edits, and eventually |
213 |
edits, and eventually reaches a point where (s)he is |
reaches a point where (s)he is satisfied that the changes form a new |
214 |
satisfied that the changes form a new "useful" point in the |
"useful" point in the evolution of the code.</para> |
|
evolution of the code.</para> |
|
215 |
</listitem> |
</listitem> |
216 |
|
|
217 |
<listitem> |
<listitem> |
218 |
<para>The developer then runs the <ulink |
<para>The developer then runs the <ulink |
219 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/verification/testscript">testscript</ulink> |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/verification/testscript"> |
220 |
shell script to see if any problems are introduced. While |
testscript</ulink> shell script to see if any problems are introduced. |
221 |
not intended to be exhaustive, the test cases within the |
While not intended to be exhaustive, the test cases within the |
222 |
verification directory do provide some indication whether |
verification directory do provide some indication whether gross errors |
223 |
gross errors have been introduced. |
have been introduced. |
224 |
</para> |
</para> |
225 |
</listitem> |
</listitem> |
226 |
|
|
230 |
then:</para> |
then:</para> |
231 |
<orderedlist> |
<orderedlist> |
232 |
<listitem> |
<listitem> |
233 |
<para>adds a "checkpointXY_pre" comment (where X is a |
<para>adds a "checkpointXY_pre" comment (where X is a checkpoint |
234 |
checkpoint number and Y is a letter) to the <ulink |
number and Y is a letter) to the <ulink |
235 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index">tag-index</ulink> |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index"> |
236 |
file and checks it into the CVS repository</para> |
tag-index</ulink> file and checks it into the CVS |
237 |
|
repository</para> |
238 |
</listitem> |
</listitem> |
239 |
<listitem> |
<listitem> |
240 |
<para>submits the set of changes to the CVS repository |
<para>submits the set of changes to the CVS repository and adds |
241 |
and adds comments to <filename>tag-index</filename> |
comments to <filename>tag-index</filename> describing what the |
242 |
describing what the changes are along with a matching |
changes are along with a matching "checkpointXY_post" entry</para> |
|
"checkpointXY_post" entry</para> |
|
243 |
</listitem> |
</listitem> |
244 |
</orderedlist> |
</orderedlist> |
245 |
</listitem> |
</listitem> |
246 |
</orderedlist> |
</orderedlist> |
247 |
|
|
248 |
<para>The result of this tagging procedure is a sequence of |
<para>The result of this tagging procedure is a sequence of development |
249 |
development checkpoints with comments which resembles:</para> |
checkpoints with comments which resembles:</para> |
250 |
|
|
251 |
<programlisting> |
<programlisting> |
252 |
checkpoint50e_post |
checkpoint50e_post |
268 |
checkpoint50d_pre |
checkpoint50d_pre |
269 |
</programlisting> |
</programlisting> |
270 |
|
|
271 |
<para>This information can be used to refer to various stages of |
<para>This information can be used to refer to various stages of the code |
272 |
the code development. For example, bugs can be traced to |
development. For example, bugs can be traced to individual sets of CVS |
273 |
individual sets of CVS checkins based upon their first |
checkins based upon their first appearance when comparing the results from |
274 |
appearance when comparing the results from different |
different checkpoints.</para> |
|
checkpoints.</para> |
|
275 |
|
|
276 |
</sect2> |
</sect2> |
277 |
</sect1> |
</sect1> |
283 |
<sect2 id="documentation_getting"> |
<sect2 id="documentation_getting"> |
284 |
<title>Getting the Docs and Code</title> |
<title>Getting the Docs and Code</title> |
285 |
|
|
286 |
<para>The first step towards editing the documentation is to |
<para>The first step towards editing the documentation is to checkout a |
287 |
checkout a copy of code, docs, and build scripts from the CVS |
copy of code, docs, and build scripts from the CVS server using:</para> |
|
server using:</para> |
|
288 |
|
|
289 |
<screen> |
<screen> |
290 |
$ export CVS_RSH=ssh |
$ export CVS_RSH=ssh |
291 |
$ export CVSROOT=':ext:auden.lcs.mit.edu:/u/u3/gcmpack' |
$ export CVSROOT=':ext:NAME@mitgcm.org:/u/gcmpack' |
292 |
$ mkdir scratch |
$ mkdir scratch |
293 |
$ cvs co MITgcm manual mitgcm.org |
$ cvs co MITgcm manual mitgcm.org |
294 |
</screen> |
</screen> |
295 |
|
|
296 |
<para>These commands extract the necessary information from the |
<para>These commands extract the necessary information from the CVS server |
297 |
CVS server and create a temporary (called |
and create a temporary (called <filename>scratch</filename>) directory for |
298 |
<filename>scratch</filename>) directory for the storage of the |
the storage of the HTML and other files that will be created. Please note |
299 |
HTML and other files that will be created. Please note that you |
that you must either create <filename>scratch</filename> as shown or edit |
300 |
must either create <filename>scratch</filename> as shown or edit |
the various <filename>Makefile</filename>s and scripts used to create the |
301 |
the various <filename>Makefile</filename>s and scripts used to |
documentation.</para> |
|
create the documentation.</para> |
|
302 |
</sect2> |
</sect2> |
303 |
|
|
304 |
<sect2> |
<sect2> |
305 |
<title>Editing the Documentation</title> |
<title>Editing the Documentation</title> |
306 |
|
|
307 |
<para>The documentation is contained in the |
<para>The documentation is contained in the <filename>manual</filename> |
308 |
<filename>manual</filename> directory in a raw LaTeX format. |
directory in a raw LaTeX format. The main document is |
309 |
The main document is <filename>manual.tex</filename> and it uses |
<filename>manual.tex</filename> and it uses <command>\input{}</command>s |
310 |
<command>\input{}</command>s to include the chapters and |
to include the chapters and subsections.</para> |
311 |
subsections.</para> |
|
312 |
|
<para>Since the same LaTeX source is used to produce PostScript, PDF, and |
313 |
<para>Since the same LaTeX source is used to produce PostScript, |
HTML output, care should be taken to follow certain conventions. Two of |
314 |
PDF, and HTML output, care should be taken to follow certain |
the most important are the usage of the <command>\filelink{}{}</command> |
315 |
conventions. Two of the most important are the usage of the |
and <command>\varlink{}{}</command> commands. Both of these commands have |
316 |
<command>\filelink{}{}</command> and |
been defined to simplify the connection between the automatically |
317 |
<command>\varlink{}{}</command> commands. Both of these |
generated ("code browser") HTML and the HTML version of the manual |
318 |
commands have been defined to simplify the connection between |
produced by LaTeX2HTML. They each take two arguments (corresponding to |
319 |
the automatically generated ("code browser") HTML and the HTML |
the contents of the two sets of curly braces) which are the text that the |
320 |
version of the manual produced by LaTeX2HTML. They each take |
author wishes to be "wrapped" within the link, and a specially formatted |
321 |
two arguments (corresponding to the contents of the two sets of |
link thats relative to the <filename>MITgcm</filename> directory within |
322 |
curly braces) which are the text that the author wishes to be |
the CVS tree.</para> |
|
"wrapped" within the link, and a specially formatted link thats |
|
|
relative to the <filename>MITgcm</filename> directory within the |
|
|
CVS tree.</para> |
|
323 |
|
|
324 |
<para>The result is a command that resembles either</para> |
<para>The result is a command that resembles either</para> |
325 |
|
|
354 |
site can be built using:</para> |
site can be built using:</para> |
355 |
|
|
356 |
<screen> |
<screen> |
357 |
$ cd mitgcm.org/devel/buildweb |
$ cd mitgcm.org/devel/buildweb |
358 |
$ make All |
$ make All |
359 |
</screen> |
</screen> |
360 |
|
|
361 |
<para>Which builds the PDF from the LaTeX source, creates the |
<para>Which builds the PDF from the LaTeX source, creates the HTML output |
362 |
HTML output from the LaTeX source, parses the FORTRAN code base |
from the LaTeX source, parses the FORTRAN code base to produce a |
363 |
to produce a hyperlinked HTML version of the source, and then |
hyperlinked HTML version of the source, and then determines the |
364 |
determines the cross-linking between the various HTML |
cross-linking between the various HTML components.</para> |
365 |
components.</para> |
|
366 |
|
<para>If there are no errors, the result of the build process (which can |
367 |
<para>If there are no errors, the result of the build process |
take 30+ minutes on a P4/2.5Ghz) will be contained within a single |
368 |
(which can take 30+ minutes on a P4/2.5Ghz) will be contained |
directory called <filename>scratch/dev_docs</filename>. This is a freshly |
369 |
within a single directory called |
built version of the entire on-line users manual. If you have the correct |
370 |
<filename>scratch/dev_docs</filename>. This is a freshly built |
permissions, it can be directly copied to the web server area:</para> |
|
version of the entire on-line users manual. If you have the |
|
|
correct permissions, it can be directly copied to the web server |
|
|
area:</para> |
|
371 |
|
|
372 |
<screen> |
<screen> |
373 |
$ mv scratch/dev_docs /u/u0/httpd/html |
$ mv scratch/dev_docs /u/u0/httpd/html |
374 |
</screen> |
</screen> |
375 |
|
|
376 |
<para>and the update is complete.</para> |
<para>and the update is complete.</para> |
392 |
For MITgcm, the process is similar. Typical commands are:</para> |
For MITgcm, the process is similar. Typical commands are:</para> |
393 |
|
|
394 |
<screen> |
<screen> |
395 |
$ genmake -mods=../code |
$ genmake -mods=../code |
396 |
$ make depend |
$ make depend |
397 |
$ make |
$ make |
398 |
</screen> |
</screen> |
399 |
|
|
400 |
<para>The following sections describe the individual steps in the build |
<para>The following sections describe the individual steps in the build |
428 |
simple as:</para> |
simple as:</para> |
429 |
|
|
430 |
<screen> |
<screen> |
431 |
$ genmake2 -mods=../code |
$ genmake2 -mods=../code |
432 |
</screen> |
</screen> |
433 |
|
|
434 |
<para>However, some systems (particularly commercial Unixes that lack a |
<para>However, some systems (particularly commercial Unixes that lack a |
437 |
the following: </para> |
the following: </para> |
438 |
|
|
439 |
<screen> |
<screen> |
440 |
$ /usr/bin/sh genmake2 -make=gmake -mods=../code |
$ /usr/bin/sh genmake2 -make=gmake -mods=../code |
441 |
$ /opt/gnu/bin/bash genmake2 -ieee -make=/usr/local/bin/gmake -mods=../code |
$ /opt/gnu/bin/bash genmake2 -ieee -make=/usr/local/bin/gmake -mods=../code |
442 |
</screen> |
</screen> |
443 |
|
|
444 |
<para>The genmake2 code has been written in a Bourne and BASH (v1) |
<para>The genmake2 code has been written in a Bourne and BASH (v1) |
451 |
|
|
452 |
<orderedlist> |
<orderedlist> |
453 |
<listitem> |
<listitem> |
454 |
<para>a <filename>gm_local</filename> file in the current |
<para>a <filename>gemake_local</filename> file in the current |
455 |
directory</para> |
directory</para> |
456 |
</listitem> |
</listitem> |
457 |
<listitem> |
<listitem> |
471 |
from:</para> |
from:</para> |
472 |
|
|
473 |
<screen> |
<screen> |
474 |
$ genmake2 -help |
$ genmake2 -help |
475 |
</screen> |
</screen> |
476 |
|
|
477 |
<para>The most important options for <filename>genmake2</> are:</para> |
<para>The most important options for <filename>genmake2</> are:</para> |
527 |
specified, then it is assumed that the two packages are compatible |
specified, then it is assumed that the two packages are compatible |
528 |
and will function either with or without each other.</para> |
and will function either with or without each other.</para> |
529 |
</listitem> |
</listitem> |
|
|
|
530 |
</varlistentry> |
</varlistentry> |
531 |
|
|
532 |
<varlistentry> |
<varlistentry> |
541 |
</varlistentry> |
</varlistentry> |
542 |
|
|
543 |
<varlistentry> |
<varlistentry> |
544 |
|
<term><filename>-adof=/path/to/file</></term> |
545 |
|
<term><filename>-adoptfile=/path/to/file</></term> |
546 |
|
<listitem> |
547 |
|
<para>This option specifies the "adjoint" or automatic |
548 |
|
differentiation options file to be used. The file is analogous |
549 |
|
to the "optfile" defined above but it specifies information for |
550 |
|
the AD build process. The default file is located in <filename> |
551 |
|
$ROOTDIR/tools/adjoint_options/adjoint_default </> and it |
552 |
|
defines the "TAF" and "TAMC" compilers. An alternate version is |
553 |
|
also available at <filename> |
554 |
|
$ROOTDIR/tools/adjoint_options/adjoint_staf </> that selects the |
555 |
|
newer "STAF" compiler. As with any compilers, it is helpful to |
556 |
|
have their directories listed in your $PATH environment |
557 |
|
variable.</para> |
558 |
|
</listitem> |
559 |
|
</varlistentry> |
560 |
|
|
561 |
|
<varlistentry> |
562 |
<term><filename>-mods=DIR</></term> |
<term><filename>-mods=DIR</></term> |
563 |
<term><filename>-mods='DIR1 [DIR2 ...]'</></term> |
<term><filename>-mods='DIR1 [DIR2 ...]'</></term> |
564 |
<listitem> |
<listitem> |
612 |
</sect3> |
</sect3> |
613 |
|
|
614 |
<sect3 id="makefile_use"> |
<sect3 id="makefile_use"> |
615 |
<title>Using <filename>Makefile</></title> |
<title>Using the <filename>Makefile</></title> |
616 |
|
|
617 |
<para>Once a <filename>Makefile</> has been created, one can |
<para>Once a <filename>Makefile</> has been created using |
618 |
build an executable using:</para> |
<filename>genmake2</>, one can build a "standard" (forward |
619 |
|
simulator) executable using:</para> |
620 |
|
|
621 |
<screen> |
<screen> |
622 |
$ make CLEAN |
$ make CLEAN |
623 |
$ make depend |
$ make depend |
624 |
$ make |
$ make |
625 |
</screen> |
</screen> |
626 |
|
|
627 |
<para>The "make CLEAN" step will remove any stale source files, include |
<para>The "make CLEAN" step will remove any stale source files, include |
645 |
substitutions) custom definitions such as variable types within the |
substitutions) custom definitions such as variable types within the |
646 |
source files. This additional stage is necessary in order to overcome |
source files. This additional stage is necessary in order to overcome |
647 |
some of the inconsistencies in the sizes of objects (bytes) between |
some of the inconsistencies in the sizes of objects (bytes) between |
648 |
different compilers.</para> |
different compilers. The result of the build process is an executable |
649 |
|
with the name <filename>mitgcmuv</>.</para> |
650 |
|
|
651 |
|
<para>In addition to the forward simulator described above, the |
652 |
|
<filename>Makefile</> also has a number of targets that can be used to |
653 |
|
produce various adjoint and tangent-linear builds for optimization and |
654 |
|
other parameter-sensitivity problems. The additional targets within |
655 |
|
the <filename>Makefile</> are:</para> |
656 |
|
|
657 |
|
<variablelist> |
658 |
|
|
659 |
|
<varlistentry> |
660 |
|
<term><filename>make adall</></term> |
661 |
|
<listitem> |
662 |
|
<para>This target produces an <filename>mitgcmuv_ad</> executable |
663 |
|
using the <filename>taf</> or <filename>staf</> adjoint |
664 |
|
compiler. See the <filename>genmake2</> "-adof" option for |
665 |
|
compiler selection.</para> |
666 |
|
</listitem> |
667 |
|
</varlistentry> |
668 |
|
|
669 |
<para>Please report compilation failures or other problems to |
<varlistentry> |
670 |
<email>MITgcm-support@mitgcm.org</email>.</para> |
<term><filename>make ftlall</></term> |
671 |
|
<listitem> |
672 |
|
<para>Similar to <filename>make adall</> above, this |
673 |
|
produces...</para> |
674 |
|
</listitem> |
675 |
|
</varlistentry> |
676 |
|
|
677 |
|
</variablelist> |
678 |
|
|
679 |
|
<para>Please report any compilation failures or other build problems to |
680 |
|
the <email>MITgcm-support@mitgcm.org</email> list.</para> |
681 |
|
|
682 |
</sect3> |
</sect3> |
683 |
|
|
710 |
line as simple as:</para> |
line as simple as:</para> |
711 |
|
|
712 |
<screen> |
<screen> |
713 |
$ cd verification |
$ cd verification |
714 |
$ ./testreport -ieee |
$ ./testreport -ieee |
715 |
</screen> |
</screen> |
716 |
|
|
717 |
<para>However, some systems (those lacking or wiht a broken "/bin/sh") |
<para>However, some systems (those lacking or wiht a broken "/bin/sh") |
718 |
may require an explicit shell invocation such as:</para> |
may require an explicit shell invocation such as:</para> |
719 |
|
|
720 |
<screen> |
<screen> |
721 |
$ sh ./testreport -ieee -t 'exp0 exp4' |
$ sh ./testreport -ieee -t 'exp0 exp4' |
722 |
$ /some/path/to/bash ./testreport -ieee -t 'ideal_2D_oce lab_sea natl_box' |
$ /some/path/to/bash ./testreport -ieee -t 'ideal_2D_oce lab_sea natl_box' |
723 |
</screen> |
</screen> |
724 |
|
|
725 |
<para>The <filename>testreport</> script accepts a number of |
<para>The <filename>testreport</> script accepts a number of |
886 |
Package runtime config. options are imported |
Package runtime config. options are imported |
887 |
into a common block held in a header file |
into a common block held in a header file |
888 |
called "${PKG}.h". |
called "${PKG}.h". |
889 |
|
Note: In some packages, the header file "${PKG}.h" is splitted |
890 |
|
into "${PKG}_PARAMS.h" that contains the package parameters and |
891 |
|
${PKG}_VARS.h" for the field arrays. |
892 |
|
|
893 |
o The core driver part of the model can check |
o The core driver part of the model can check |
894 |
for runtime enabling or disabling of individual packages |
for runtime enabling or disabling of individual packages |
911 |
1. Within the core driver code flags of the form |
1. Within the core driver code flags of the form |
912 |
ALLOW_${PKG} are used to include or exclude |
ALLOW_${PKG} are used to include or exclude |
913 |
whole packages. The ALLOW_${PKG} flags are included |
whole packages. The ALLOW_${PKG} flags are included |
914 |
from a PKG_CPP_OPTIONS block which is currently |
from a PACKAGES_CONFIG.h file that is automatically |
915 |
|
generated by genmake2 (see genmake2 section). |
916 |
held in-line in the CPP_OPTIONS.h header file. |
held in-line in the CPP_OPTIONS.h header file. |
917 |
e.g. |
e.g. |
918 |
|
|
919 |
Core model code ..... |
Core model code ..... |
920 |
|
|
921 |
|
#include "PACKAGES_CONFIG.h" |
922 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
923 |
: |
: |
924 |
: |
: |
930 |
|
|
931 |
2. Within an individual package a header file, |
2. Within an individual package a header file, |
932 |
"${PKG}_OPTIONS.h", is used to set CPP flags |
"${PKG}_OPTIONS.h", is used to set CPP flags |
933 |
specific to that package. It is not recommended |
specific to that package. It also includes |
934 |
to include this file in "CPP_OPTIONS.h". |
"PACKAGES_CONFIG.h" and "CPP_OPTIONS.h". |
935 |
|
|
936 |
|
|
937 |
Package Boot Sequence |
Package Boot Sequence |
953 |
& CALL ${PKG}_READPARMS( retCode ) |
& CALL ${PKG}_READPARMS( retCode ) |
954 |
#endif |
#endif |
955 |
|
|
956 |
2. S/R PACKAGES_CHECK() |
3. S/R PACKAGES_INIT_FIXED() |
957 |
|
: |
958 |
|
#ifdef ALLOW_${PKG} |
959 |
|
if ( use${Pkg} ) |
960 |
|
& CALL ${PKG}_INIT_FIXED( retCode ) |
961 |
|
#endif |
962 |
|
|
963 |
|
4. S/R PACKAGES_CHECK() |
964 |
: |
: |
965 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
966 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
970 |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
971 |
#endif |
#endif |
972 |
|
|
973 |
3. S/R PACKAGES_INIT() |
5. S/R PACKAGES_INIT_VARIABLES() |
974 |
: |
: |
975 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
976 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
977 |
& CALL ${PKG}_INIT( retCode ) |
& CALL ${PKG}_INIT_VARIA( ) |
978 |
#endif |
#endif |
979 |
|
|
980 |
|
Package Output |
981 |
|
============== |
982 |
|
6. S/R DO_THE_MODEL_IO |
983 |
|
|
984 |
|
#ifdef ALLOW_${PKG} |
985 |
|
if ( use${Pkg} ) |
986 |
|
& CALL ${PKG}_DIAGS( ) [ or CALL ${PKG}_OUTPUT( ) ] |
987 |
|
#endif |
988 |
|
|
989 |
|
7. S/R PACKAGES_WRITE_PICKUP() |
990 |
|
|
991 |
|
#ifdef ALLOW_${PKG} |
992 |
|
if ( use${Pkg} ) |
993 |
|
& CALL ${PKG}_WRITE_PICKUP( ) |
994 |
|
#endif |
995 |
|
|
996 |
Description |
Description |
997 |
=========== |
=========== |
999 |
- ${PKG}_READPARMS() |
- ${PKG}_READPARMS() |
1000 |
is responsible for reading |
is responsible for reading |
1001 |
in the package parameters file data.${pkg}, and storing |
in the package parameters file data.${pkg}, and storing |
1002 |
the package parameters in "${PKG}.h". |
the package parameters in "${PKG}.h" (or in "${PKG}_PARAMS.h"). |
1003 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_READPARMS |
1004 |
|
|
1005 |
|
- ${PKG}_INIT_FIXED() |
1006 |
|
is responsible for completing the internal setup of a package. |
1007 |
|
-> called from INITIALISE_FIXED in PACKAGES_INIT_FIXED |
1008 |
|
note: 1) some pkg use instead: |
1009 |
|
CALL ${PKG}_INITIALISE ( or the old form CALL ${PKG}_INIT ) |
1010 |
|
2) for simple pkg setup, this part is done inside ${PKG}_READPARMS |
1011 |
|
|
1012 |
- ${PKG}_CHECK() |
- ${PKG}_CHECK() |
1013 |
is responsible for validating |
is responsible for validating |
1016 |
need to check. This is done through header files "${PKG}.h". |
need to check. This is done through header files "${PKG}.h". |
1017 |
It is assumed that parameters owned by other packages |
It is assumed that parameters owned by other packages |
1018 |
will not be reset during ${PKG}_CHECK(). |
will not be reset during ${PKG}_CHECK(). |
1019 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_CHECK |
1020 |
|
|
1021 |
- ${PKG}_INIT() |
- ${PKG}_INIT_VARIA() |
1022 |
is responsible for completing the |
is responsible for fill-in all package variables with an initial value. |
1023 |
internal setup of a package. This routine is called after |
Contains eventually a call to ${PKG}_READ_PICKUP that will read |
1024 |
the core model state has been completely initialised |
from a pickup file the package variables required to restart the model. |
1025 |
but before the core model timestepping starts. |
This routine is called after the core model state has been completely |
1026 |
-> called in INITIALISE_VARIA |
initialised but before the core model timestepping starts. |
1027 |
|
-> called from INITIALISE_VARIA in PACKAGES_INIT_VARIABLES |
1028 |
|
note: the name ${PKG}_INIT_VARIA is not yet standard and some pkg |
1029 |
|
use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old |
1030 |
|
form ${PKG}_INIT |
1031 |
|
|
1032 |
|
- ${PKG}_DIAGS() [or ${PKG}_OUTPUT( ) ] |
1033 |
|
is responsible for writing time-average fields to output files |
1034 |
|
(but the cumulating step is done within the package main S/R). |
1035 |
|
Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR) |
1036 |
|
and write snap-shot fields that are hold in common blocks. Other |
1037 |
|
temporary fields are directly dump to file where they are available. |
1038 |
|
NOTE: 1) ${PKG}_OUTPUT is progressively replacing ${PKG}_DIAGS() |
1039 |
|
to avoid confusion with pkg/diagnostics functionality. |
1040 |
|
2) the output part is not yet in a standard form and might still |
1041 |
|
evolve a lot. |
1042 |
|
-> called within DO_THE_MODEL_IO |
1043 |
|
|
1044 |
|
- ${PKG}_WRITE_PICKUP() |
1045 |
|
is responsible for writing a package pickup file when necessary for |
1046 |
|
a restart. (found also the old name: ${PKG}_WRITE_CHECKPOINT ) |
1047 |
|
-> called from FORWARD_STEP and THE_MODEL_MAIN in PACKAGES_WRITE_PICKUP |
1048 |
|
|
1049 |
Summary |
Summary |
1050 |
======= |
======= |
1065 |
----------------------- |
----------------------- |
1066 |
* ${PKG}_OPTIONS.h has further package-specific CPP options |
* ${PKG}_OPTIONS.h has further package-specific CPP options |
1067 |
* ${PKG}.h package-specific common block variables, fields |
* ${PKG}.h package-specific common block variables, fields |
1068 |
|
or ${PKG}_PARAMS.h package-specific common block parameters |
1069 |
|
and ${PKG}_VARS.h package-specific common block fields |
1070 |
|
|
1071 |
- FORTRAN source files |
- FORTRAN source files |
1072 |
----------------------- |
----------------------- |
1073 |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
1074 |
* ${pkg}_check.F checks package dependencies and consistencies |
* ${pkg}_init_fixed.F complete the package setup |
1075 |
* ${pkg}_init.F initialises package-related fields |
* ${pkg}_check.F checks package dependencies and consistencies |
1076 |
* ${pkg}_... .F package source code |
* ${pkg}_init_varia.F initialises package-related fields |
1077 |
|
* ${pkg}_... .F package source code |
1078 |
|
* ${pkg}_diags.F write output to file. |
1079 |
|
or ${pkg}_output.F write output to file. |
1080 |
|
* ${pkg}_write_pickup.F write a package pickup file to restart the model |
1081 |
|
|
1082 |
|
New: Subroutine in one package (pkgA) that only contains code which |
1083 |
|
is connected to a 2nd package (pkgB) (e.g.: gmredi_diagnostics_init.F) |
1084 |
|
will be named: pkgA_pkgB_something.F |
1085 |
|
|
1086 |
- parameter file |
- parameter file |
1087 |
----------------------- |
----------------------- |