/[MITgcm]/MITgcm/doc/devel_HOWTO.sgml
ViewVC logotype

Diff of /MITgcm/doc/devel_HOWTO.sgml

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

revision 1.4 by edhill, Thu Nov 20 00:01:42 2003 UTC revision 1.10 by jmc, Thu Jan 21 23:59:17 2010 UTC
# Line 2  Line 2 
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    
# Line 30  Build commands: Line 22  Build commands:
22            Initial version.            Initial version.
23          </revremark>          </revremark>
24        </revision>        </revision>
25          <revision>
26            <revnumber>0.02</revnumber>
27            <date>2010-01-21</date>
28            <authorinitials>jmc</authorinitials>
29            <revremark>
30              update links.
31            </revremark>
32          </revision>
33      </revhistory>      </revhistory>
34    
35      <abstract>      <abstract>
# Line 45  Build commands: Line 45  Build commands:
45      <sect2>      <sect2>
46        <title>New Versions of This Document</title> <para>You can        <title>New Versions of This Document</title> <para>You can
47        obtain the latest version of this document <ulink        obtain the latest version of this document <ulink
48        url="http://mitgcm.org/dev_docs/devel_HOWTO/">online</ulink> in        url="http://mitgcm.org/public/docs.html">online</ulink> in
49        various formats.</para>        various formats.</para>
50      </sect2>      </sect2>
51      <sect2>      <sect2>
# Line 63  Build commands: Line 63  Build commands:
63      <sect2>      <sect2>
64        <title>User Manual</title>        <title>User Manual</title>
65    
66        <para>Before jumping into        <para>Before jumping into development, please familiarize yourself with
67        development, please familiarize yourself with the MITgcm user          the <ulink url="http://mitgcm.org/public/docs.html"> MITgcm user manual
68        manual which is available <ulink          </ulink>.  This document contains volumes of useful information and is
69        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>  
70    
71        <para>Also, a "snapshot" or<ulink        <!--
72          <para>Also, a "snapshot" or <ulink
73        url="http://mitgcm.org/dev_docs/">development version</ulink> of        url="http://mitgcm.org/dev_docs/">development version</ulink> of
74        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
75        web for testing purposes.</para>        web for testing purposes.</para>
76          -->
77      </sect2>      </sect2>
78    
79      <sect2>      <sect2>
# Line 138  Build commands: Line 138  Build commands:
138     e|- tools     e|- tools
139     ?|  tutorial_examples        documented tests     ?|  tutorial_examples        documented tests
140      |                             only populated on release1 branch      |                             only populated on release1 branch
141      |                             and not validated during "testscript"      |                             and not validated during "testreport"
142      '- utils      '- utils
143         verification             std tests         verification             std tests
144    
# Line 190  Build commands: Line 190  Build commands:
190        <title>Branches</title>        <title>Branches</title>
191    
192        <para>As shown in the online <ulink        <para>As shown in the online <ulink
193        url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index?graph=1.174">ViewCVS-generated        url="http://mitgcm.org/viewvc/MITgcm/MITgcm/doc/tag-index?view=graph">
194        tree</ulink>, the MITgcm codebase is split into to two branches        ViewCVS-generated tree</ulink>, the MITgcm codebase is split into to two
195        or "lines" under which development proceeds.  These two lines        branches or "lines" under which development proceeds.  These two lines are
196        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
197        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
198        composed of files from the same codebase.        the same codebase.
199        </para>        </para>
200    
201        <para>Periodically, a "Release" branch is formed from the "MAIN"        <para>Periodically, a "Release" branch is formed from the "MAIN"
202        development branch.  This is done in order to create a        development branch.  This is done in order to create a relatively stable
203        relatively stable reference point for both users and developers.        reference point for both users and developers.  The intent is that once a
204        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.
205        bug-fixes will be added to it.  Meanwhile, development (which        Meanwhile, development (which might "break" or otherwise render invalid
206        might "break" or otherwise render invalid the documentation,        the documentation, tutorials, and/or examples contained within a release
207        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>  
208      </sect2>      </sect2>
209    
210      <sect2>      <sect2>
211        <title>Tagging</title>        <title>Tagging</title>
212    
213        <para>The intent of tagging is to create "known-good"        <para>The intent of tagging is to create "known-good" checkpoints that
214        checkpoints that developers can use as references.        developers can use as references.  Traditionally, MITgcm tagging has
215        Traditionally, MITgcm tagging has maintained the following        maintained the following conventions:</para>
       conventions:</para>  
216    
217        <orderedlist>        <orderedlist>
218          <listitem>          <listitem>
219            <para>Developer checks out code into a local CVS-managed            <para>Developer checks out code into a local CVS-managed directory,
220            directory, makes various changes/additions, tests these            makes various changes/additions, tests these edits, and eventually
221            edits, and eventually reaches a point where (s)he is            reaches a point where (s)he is satisfied that the changes form a new
222            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>  
223          </listitem>          </listitem>
224    
225          <listitem>          <listitem>
226            <para>The developer then runs the <ulink            <para>The developer then runs the <ulink
227            url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/verification/testscript">testscript</ulink>            url="http://mitgcm.org/viewvc/MITgcm/MITgcm/verification/testreport">
228            shell script to see if any problems are introduced.  While            testreport</ulink> shell script to see if any problems are introduced.
229            not intended to be exhaustive, the test cases within the            While not intended to be exhaustive, the test cases within the
230            verification directory do provide some indication whether            verification directory do provide some indication whether gross errors
231            gross errors have been introduced.            have been introduced.
232            </para>            </para>
233          </listitem>          </listitem>
234    
# Line 241  Build commands: Line 238  Build commands:
238            then:</para>            then:</para>
239            <orderedlist>            <orderedlist>
240              <listitem>              <listitem>
241                <para>adds a "checkpointXY_pre" comment (where X is a                <para>adds a "checkpointXY_pre" comment (where X is a checkpoint
242                checkpoint number and Y is a letter) to the <ulink                number and Y is a letter) to the <ulink
243                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index">tag-index</ulink>                url="http://mitgcm.org/viewvc/MITgcm/MITgcm/doc/tag-index">
244                file and checks it into the CVS repository</para>                tag-index</ulink> file and checks it into the CVS
245                  repository</para>
246              </listitem>              </listitem>
247              <listitem>              <listitem>
248                <para>submits the set of changes to the CVS repository                <para>submits the set of changes to the CVS repository and adds
249                and adds comments to <filename>tag-index</filename>                comments to <filename>tag-index</filename> describing what the
250                describing what the changes are along with a matching                changes are along with a matching "checkpointXY_post" entry</para>
               "checkpointXY_post" entry</para>  
251              </listitem>              </listitem>
252            </orderedlist>            </orderedlist>
253          </listitem>          </listitem>
254        </orderedlist>        </orderedlist>
255    
256        <para>The result of this tagging procedure is a sequence of        <para>The result of this tagging procedure is a sequence of development
257        development checkpoints with comments which resembles:</para>        checkpoints with comments which resembles:</para>
258    
259  <programlisting>  <programlisting>
260  checkpoint50e_post  checkpoint50e_post
# Line 279  o fix small problem with in ptracers_wri Line 276  o fix small problem with in ptracers_wri
276  checkpoint50d_pre  checkpoint50d_pre
277  </programlisting>  </programlisting>
278    
279        <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
280        the code development.  For example, bugs can be traced to        development.  For example, bugs can be traced to individual sets of CVS
281        individual sets of CVS checkins based upon their first        checkins based upon their first appearance when comparing the results from
282        appearance when comparing the results from different        different checkpoints.</para>
       checkpoints.</para>  
283    
284      </sect2>      </sect2>
285    </sect1>    </sect1>
# Line 295  checkpoint50d_pre Line 291  checkpoint50d_pre
291      <sect2 id="documentation_getting">      <sect2 id="documentation_getting">
292        <title>Getting the Docs and Code</title>        <title>Getting the Docs and Code</title>
293    
294        <para>The first step towards editing the documentation is to        <para>The first step towards editing the documentation is to checkout a
295        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>  
296    
297  <screen>  <screen>
298  $ export CVS_RSH=ssh    $ export CVS_RSH=ssh
299  $ export CVSROOT=':ext:auden.lcs.mit.edu:/u/u3/gcmpack'    $ export CVSROOT=':ext:NAME@mitgcm.org:/u/gcmpack'
300  $ mkdir scratch    $ mkdir scratch
301  $ cvs co MITgcm manual mitgcm.org    $ cvs co -P MITgcm manual mitgcm.org
302  </screen>  </screen>
303    
304        <para>These commands extract the necessary information from the        <para>These commands extract the necessary information from the CVS server
305        CVS server and create a temporary (called        and create a temporary (called <filename>scratch</filename>) directory for
306        <filename>scratch</filename>) directory for the storage of the        the storage of the HTML and other files that will be created.  Please note
307        HTML and other files that will be created.  Please note that you        that you must either create <filename>scratch</filename> as shown or edit
308        must either create <filename>scratch</filename> as shown or edit        the various <filename>Makefile</filename>s and scripts used to create the
309        the various <filename>Makefile</filename>s and scripts used to        documentation.</para>
       create the documentation.</para>  
310      </sect2>      </sect2>
311    
312      <sect2>      <sect2>
313        <title>Editing the Documentation</title>        <title>Editing the Documentation</title>
314    
315        <para>The documentation is contained in the        <para>The documentation is contained in the <filename>manual</filename>
316        <filename>manual</filename> directory in a raw LaTeX format.        directory in a raw LaTeX format.  The main document is
317        The main document is <filename>manual.tex</filename> and it uses        <filename>manual.tex</filename> and it uses <command>\input{}</command>s
318        <command>\input{}</command>s to include the chapters and        to include the chapters and subsections.</para>
319        subsections.</para>  
320          <para>Since the same LaTeX source is used to produce PostScript, PDF, and
321        <para>Since the same LaTeX source is used to produce PostScript,        HTML output, care should be taken to follow certain conventions.  Two of
322        PDF, and HTML output, care should be taken to follow certain        the most important are the usage of the <command>\filelink{}{}</command>
323        conventions.  Two of the most important are the usage of the        and <command>\varlink{}{}</command> commands.  Both of these commands have
324        <command>\filelink{}{}</command> and        been defined to simplify the connection between the automatically
325        <command>\varlink{}{}</command> commands.  Both of these        generated ("code browser") HTML and the HTML version of the manual
326        commands have been defined to simplify the connection between        produced by LaTeX2HTML.  They each take two arguments (corresponding to
327        the automatically generated ("code browser") HTML and the HTML        the contents of the two sets of curly braces) which are the text that the
328        version of the manual produced by LaTeX2HTML.  They each take        author wishes to be "wrapped" within the link, and a specially formatted
329        two arguments (corresponding to the contents of the two sets of        link thats relative to the <filename>MITgcm</filename> directory within
330        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>  
331    
332        <para>The result is a command that resembles either</para>        <para>The result is a command that resembles either</para>
333                
# Line 371  $ cvs co MITgcm manual mitgcm.org Line 362  $ cvs co MITgcm manual mitgcm.org
362        site can be built using:</para>        site can be built using:</para>
363    
364  <screen>  <screen>
365  $ cd mitgcm.org/devel/buildweb    $ cd mitgcm.org/devel/buildweb
366  $ make All    $ make All
367  </screen>  </screen>
368    
369        <para>Which builds the PDF from the LaTeX source, creates the        <para>Which builds the PDF from the LaTeX source, creates the HTML output
370        HTML output from the LaTeX source, parses the FORTRAN code base        from the LaTeX source, parses the FORTRAN code base to produce a
371        to produce a hyperlinked HTML version of the source, and then        hyperlinked HTML version of the source, and then determines the
372        determines the cross-linking between the various HTML        cross-linking between the various HTML components.</para>
373        components.</para>  
374          <para>If there are no errors, the result of the build process (which can
375        <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
376        (which can take 30+ minutes on a P4/2.5Ghz) will be contained        directory called <filename>scratch/dev_docs</filename>.  This is a freshly
377        within a single directory called        built version of the entire on-line users manual.  If you have the correct
378        <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>  
379    
380  <screen>  <screen>
381  $ mv scratch/dev_docs /u/u0/httpd/html    $ mv scratch/dev_docs /u/u0/httpd/html
382  </screen>  </screen>
383    
384        <para>and the update is complete.</para>        <para>and the update is complete.</para>
# Line 412  $ mv scratch/dev_docs /u/u0/httpd/html Line 400  $ mv scratch/dev_docs /u/u0/httpd/html
400          For MITgcm, the process is similar.  Typical commands are:</para>          For MITgcm, the process is similar.  Typical commands are:</para>
401    
402  <screen>  <screen>
403  $ genmake -mods=../code    $ genmake -mods=../code
404  $ make depend    $ make depend
405  $ make    $ make
406  </screen>  </screen>
407    
408        <para>The following sections describe the individual steps in the build        <para>The following sections describe the individual steps in the build
# Line 448  $ make Line 436  $ make
436          simple as:</para>          simple as:</para>
437    
438  <screen>  <screen>
439  $ genmake2 -mods=../code    $ genmake2 -mods=../code
440  </screen>  </screen>
441    
442          <para>However, some systems (particularly commercial Unixes that lack a          <para>However, some systems (particularly commercial Unixes that lack a
# Line 457  $ genmake2 -mods=../code Line 445  $ genmake2 -mods=../code
445            the following: </para>            the following: </para>
446    
447  <screen>  <screen>
448  $ /usr/bin/sh genmake2 -make=gmake  -mods=../code    $ /usr/bin/sh genmake2 -make=gmake  -mods=../code
449  $ /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
450  </screen>  </screen>
451    
452          <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)
# Line 471  $ /opt/gnu/bin/bash genmake2 -ieee -make Line 459  $ /opt/gnu/bin/bash genmake2 -ieee -make
459    
460          <orderedlist>          <orderedlist>
461            <listitem>            <listitem>
462              <para>a <filename>gm_local</filename> file in the current              <para>a <filename>gemake_local</filename> file in the current
463                directory</para>                directory</para>
464            </listitem>            </listitem>
465            <listitem>            <listitem>
# Line 491  $ /opt/gnu/bin/bash genmake2 -ieee -make Line 479  $ /opt/gnu/bin/bash genmake2 -ieee -make
479            from:</para>            from:</para>
480    
481  <screen>  <screen>
482  $ genmake2 -help    $ genmake2 -help
483  </screen>  </screen>
484    
485          <para>The most important options for <filename>genmake2</> are:</para>          <para>The most important options for <filename>genmake2</> are:</para>
# Line 547  $ genmake2 -help Line 535  $ genmake2 -help
535                specified, then it is assumed that the two packages are compatible                specified, then it is assumed that the two packages are compatible
536                and will function either with or without each other.</para>                and will function either with or without each other.</para>
537              </listitem>              </listitem>
   
538            </varlistentry>            </varlistentry>
539    
540            <varlistentry>            <varlistentry>
# Line 562  $ genmake2 -help Line 549  $ genmake2 -help
549            </varlistentry>            </varlistentry>
550    
551            <varlistentry>            <varlistentry>
552                <term><filename>-adof=/path/to/file</></term>
553                <term><filename>-adoptfile=/path/to/file</></term>
554                <listitem>
555                  <para>This option specifies the "adjoint" or automatic
556                    differentiation options file to be used.  The file is analogous
557                    to the "optfile" defined above but it specifies information for
558                    the AD build process.  The default file is located in <filename>
559                    $ROOTDIR/tools/adjoint_options/adjoint_default </> and it
560                    defines the "TAF" and "TAMC" compilers.  An alternate version is
561                    also available at <filename>
562                    $ROOTDIR/tools/adjoint_options/adjoint_staf </> that selects the
563                    newer "STAF" compiler.  As with any compilers, it is helpful to
564                    have their directories listed in your $PATH environment
565                    variable.</para>
566                </listitem>
567              </varlistentry>
568    
569              <varlistentry>
570              <term><filename>-mods=DIR</></term>              <term><filename>-mods=DIR</></term>
571              <term><filename>-mods='DIR1 [DIR2 ...]'</></term>              <term><filename>-mods='DIR1 [DIR2 ...]'</></term>
572              <listitem>              <listitem>
# Line 615  $ genmake2 -help Line 620  $ genmake2 -help
620        </sect3>        </sect3>
621    
622        <sect3 id="makefile_use">        <sect3 id="makefile_use">
623          <title>Using <filename>Makefile</></title>          <title>Using the <filename>Makefile</></title>
624    
625          <para>Once a <filename>Makefile</> has been created, one can          <para>Once a <filename>Makefile</> has been created using
626          build an executable using:</para>            <filename>genmake2</>, one can build a "standard" (forward
627              simulator) executable using:</para>
628    
629  <screen>  <screen>
630  $ make CLEAN    $ make CLEAN
631  $ make depend    $ make depend
632  $ make    $ make
633  </screen>  </screen>
634    
635          <para>The "make CLEAN" step will remove any stale source files, include          <para>The "make CLEAN" step will remove any stale source files, include
# Line 647  $ make Line 653  $ make
653            substitutions) custom definitions such as variable types within the            substitutions) custom definitions such as variable types within the
654            source files.  This additional stage is necessary in order to overcome            source files.  This additional stage is necessary in order to overcome
655            some of the inconsistencies in the sizes of objects (bytes) between            some of the inconsistencies in the sizes of objects (bytes) between
656            different compilers.</para>            different compilers. The result of the build process is an executable
657              with the name <filename>mitgcmuv</>.</para>
658    
659            <para>In addition to the forward simulator described above, the
660              <filename>Makefile</> also has a number of targets that can be used to
661              produce various adjoint and tangent-linear builds for optimization and
662              other parameter-sensitivity problems.  The additional targets within
663              the <filename>Makefile</> are:</para>
664    
665          <para>Please report compilation failures or other problems to          <variablelist>
666            <email>MITgcm-support@mitgcm.org</email>.</para>  
667              <varlistentry>
668                <term><filename>make adall</></term>
669                <listitem>
670                  <para>This target produces an <filename>mitgcmuv_ad</> executable
671                    using the <filename>taf</> or <filename>staf</> adjoint
672                    compiler.  See the <filename>genmake2</> "-adof" option for
673                    compiler selection.</para>
674                </listitem>
675              </varlistentry>
676    
677              <varlistentry>
678                <term><filename>make ftlall</></term>
679                <listitem>
680                  <para>Similar to <filename>make adall</> above, this
681                    produces...</para>
682                </listitem>
683              </varlistentry>
684    
685            </variablelist>
686    
687            <para>Please report any compilation failures or other build problems to
688              the <email>MITgcm-support@mitgcm.org</email> list.</para>
689    
690        </sect3>        </sect3>
691    
# Line 683  $ make Line 718  $ make
718          line as simple as:</para>          line as simple as:</para>
719    
720  <screen>  <screen>
721  $ cd verification    $ cd verification
722  $ ./testreport -ieee    $ ./testreport -ieee
723  </screen>  </screen>
724    
725          <para>However, some systems (those lacking or wiht a broken "/bin/sh")          <para>However, some systems (those lacking or wiht a broken "/bin/sh")
726            may require an explicit shell invocation such as:</para>            may require an explicit shell invocation such as:</para>
727    
728  <screen>  <screen>
729  $ sh ./testreport -ieee -t 'exp0 exp4'    $ sh ./testreport -ieee -t 'exp0 exp4'
730  $ /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'
731  </screen>  </screen>
732    
733          <para>The <filename>testreport</> script accepts a number of          <para>The <filename>testreport</> script accepts a number of
# Line 760  $ /some/path/to/bash ./testreport -ieee Line 795  $ /some/path/to/bash ./testreport -ieee
795                special command option (see "-command" below) to invoke the MPI                special command option (see "-command" below) to invoke the MPI
796                executable.  Examples of PBS scripts using MPI with testreport can be                executable.  Examples of PBS scripts using MPI with testreport can be
797                found in the <ulink                found in the <ulink
798                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/">                url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/">
799                MITgcm-contrib area</ulink></para>                MITgcm-contrib area</ulink></para>
800              </listitem>              </listitem>
801            </varlistentry>            </varlistentry>
# Line 772  $ /some/path/to/bash ./testreport -ieee Line 807  $ /some/path/to/bash ./testreport -ieee
807                output.txt" is not sufficient.  This option allows a more general                output.txt" is not sufficient.  This option allows a more general
808                command (or shell script) to be invoked.  Examples of PBS scripts                command (or shell script) to be invoked.  Examples of PBS scripts
809                using MPI with testreport can be found in the <ulink                using MPI with testreport can be found in the <ulink
810                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/">                url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/">
811                MITgcm-contrib area</ulink></para>                MITgcm-contrib area</ulink></para>
812              </listitem>              </listitem>
813            </varlistentry>            </varlistentry>
# Line 859  o  Each package gets its runtime configu Line 894  o  Each package gets its runtime configu
894     Package runtime config. options are imported     Package runtime config. options are imported
895     into a common block held in a header file     into a common block held in a header file
896     called "${PKG}.h".     called "${PKG}.h".
897       Note: In some packages, the header file "${PKG}.h" is splitted
898       into "${PKG}_PARAMS.h" that contains the package parameters and
899       ${PKG}_VARS.h" for the field arrays.
900    
901  o  The core driver part of the model can check  o  The core driver part of the model can check
902     for runtime enabling or disabling of individual packages     for runtime enabling or disabling of individual packages
# Line 881  CPP Flags Line 919  CPP Flags
919      1. Within the core driver code flags of the form      1. Within the core driver code flags of the form
920         ALLOW_${PKG} are used to include or exclude         ALLOW_${PKG} are used to include or exclude
921         whole packages. The ALLOW_${PKG} flags are included         whole packages. The ALLOW_${PKG} flags are included
922         from a PKG_CPP_OPTIONS block which is currently         from a PACKAGES_CONFIG.h file that is automatically
923           generated by genmake2 (see genmake2 section).
924         held in-line in the CPP_OPTIONS.h header file.         held in-line in the CPP_OPTIONS.h header file.
925         e.g.         e.g.
926    
927         Core model code .....         Core model code .....
928    
929           #include "PACKAGES_CONFIG.h"
930         #include "CPP_OPTIONS.h"         #include "CPP_OPTIONS.h"
931           :           :
932           :           :
# Line 898  CPP Flags Line 938  CPP Flags
938    
939      2. Within an individual package a header file,      2. Within an individual package a header file,
940         "${PKG}_OPTIONS.h", is used to set CPP flags         "${PKG}_OPTIONS.h", is used to set CPP flags
941         specific to that package. It is not recommended         specific to that package. It also includes
942         to include this file in "CPP_OPTIONS.h".         "PACKAGES_CONFIG.h" and "CPP_OPTIONS.h".
943    
944    
945  Package Boot Sequence  Package Boot Sequence
# Line 921  Package Boot Sequence Line 961  Package Boot Sequence
961       &       CALL ${PKG}_READPARMS( retCode )       &       CALL ${PKG}_READPARMS( retCode )
962          #endif          #endif
963    
964      2. S/R PACKAGES_CHECK()      3. S/R PACKAGES_INIT_FIXED()
965                :
966            #ifdef ALLOW_${PKG}
967              if ( use${Pkg} )
968         &       CALL ${PKG}_INIT_FIXED( retCode )
969            #endif
970    
971        4. S/R PACKAGES_CHECK()
972              :              :
973          #ifdef ALLOW_${PKG}          #ifdef ALLOW_${PKG}
974            if ( use${Pkg} )            if ( use${Pkg} )
# Line 931  Package Boot Sequence Line 978  Package Boot Sequence
978       &       CALL PACKAGES_CHECK_ERROR('${PKG}')       &       CALL PACKAGES_CHECK_ERROR('${PKG}')
979          #endif          #endif
980    
981      3. S/R PACKAGES_INIT()      5. S/R PACKAGES_INIT_VARIABLES()
982              :              :
983          #ifdef ALLOW_${PKG}          #ifdef ALLOW_${PKG}
984            if ( use${Pkg} )            if ( use${Pkg} )
985       &       CALL ${PKG}_INIT( retCode )       &       CALL ${PKG}_INIT_VARIA( )
986          #endif          #endif
987    
988    Package Output
989    ==============
990         6. S/R DO_THE_MODEL_IO
991    
992            #ifdef ALLOW_${PKG}
993              if ( use${Pkg} )
994         &       CALL ${PKG}_OUTPUT( )
995            #endif
996    
997         7. S/R PACKAGES_WRITE_PICKUP()
998    
999            #ifdef ALLOW_${PKG}
1000              if ( use${Pkg} )
1001         &       CALL ${PKG}_WRITE_PICKUP( )
1002            #endif
1003    
1004  Description  Description
1005  ===========  ===========
# Line 945  Description Line 1007  Description
1007        - ${PKG}_READPARMS()        - ${PKG}_READPARMS()
1008      is responsible for reading      is responsible for reading
1009      in the package parameters file data.${pkg}, and storing      in the package parameters file data.${pkg}, and storing
1010      the package parameters in "${PKG}.h".      the package parameters in "${PKG}.h" (or in "${PKG}_PARAMS.h").
1011      -> called in INITIALISE_FIXED      -> called from INITIALISE_FIXED in PACKAGES_READPARMS
1012    
1013         - ${PKG}_INIT_FIXED()
1014        is responsible for completing the internal setup of a package.
1015        -> called from INITIALISE_FIXED in PACKAGES_INIT_FIXED
1016        note: 1) some pkg use instead:
1017                 CALL ${PKG}_INITIALISE  ( or the old form CALL ${PKG}_INIT )
1018              2) for simple pkg setup, this part is done inside ${PKG}_READPARMS
1019    
1020       - ${PKG}_CHECK()       - ${PKG}_CHECK()
1021      is responsible for validating      is responsible for validating
# Line 955  Description Line 1024  Description
1024      need to check. This is done through header files "${PKG}.h".      need to check. This is done through header files "${PKG}.h".
1025      It is assumed that parameters owned by other packages      It is assumed that parameters owned by other packages
1026      will not be reset during ${PKG}_CHECK().      will not be reset during ${PKG}_CHECK().
1027      -> called in INITIALISE_FIXED      -> called from INITIALISE_FIXED in PACKAGES_CHECK
1028    
1029       - ${PKG}_INIT()       - ${PKG}_INIT_VARIA()
1030      is responsible for completing the      is responsible for fill-in all package variables with an initial value.
1031      internal setup of a package. This routine is called after      Contains eventually a call to ${PKG}_READ_PICKUP that will read
1032      the core model state has been completely initialised      from a pickup file the package variables required to restart the model.
1033      but before the core model timestepping starts.      This routine is called after the core model state has been completely
1034      -> called in INITIALISE_VARIA      initialised but before the core model timestepping starts.
1035        -> called from INITIALISE_VARIA in PACKAGES_INIT_VARIABLES
1036        note: the name ${PKG}_INIT_VARIA is not yet standard and some pkg
1037         use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old
1038         form ${PKG}_INIT
1039    
1040         - ${PKG}_OUTPUT( )
1041         is responsible for writing time-average fields to output files
1042         (but the cumulating step is done within the package main S/R).
1043         Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR)
1044         and write snap-shot fields that are hold in common blocks. Other
1045         temporary fields are directly dump to file where they are available.
1046         NOTE: 1) the S/R old name ${PKG}_DIAGS is used in some packages
1047                  but is beeing replaced by ${PKG}_OUTPUT
1048                  to avoid confusion with pkg/diagnostics functionality.
1049               2) the output part is not yet in a standard form and might still
1050                  evolve a lot.
1051        -> called within DO_THE_MODEL_IO
1052    
1053         - ${PKG}_WRITE_PICKUP()
1054         is responsible for writing a package pickup file when necessary for
1055         a restart. (found also the old name: ${PKG}_WRITE_CHECKPOINT )
1056        -> called from FORWARD_STEP and THE_MODEL_MAIN in PACKAGES_WRITE_PICKUP
1057    
1058  Summary  Summary
1059  =======  =======
# Line 983  Summary Line 1074  Summary
1074    -----------------------    -----------------------
1075    * ${PKG}_OPTIONS.h     has further package-specific CPP options    * ${PKG}_OPTIONS.h     has further package-specific CPP options
1076    * ${PKG}.h             package-specific common block variables, fields    * ${PKG}.h             package-specific common block variables, fields
1077       or  ${PKG}_PARAMS.h   package-specific common block parameters
1078       and ${PKG}_VARS.h     package-specific common block fields
1079    
1080  - FORTRAN source files  - FORTRAN source files
1081    -----------------------    -----------------------
1082    * ${pkg}_readparms.F   reads parameters from file data.${pkg}    * ${pkg}_readparms.F    reads parameters from file data.${pkg}
1083    * ${pkg}_check.F       checks package dependencies and consistencies    * ${pkg}_init_fixed.F   complete the package setup
1084    * ${pkg}_init.F        initialises package-related fields    * ${pkg}_check.F        checks package dependencies and consistencies
1085    * ${pkg}_... .F        package source code    * ${pkg}_init_varia.F   initialises package-related fields
1086      * ${pkg}_... .F         package source code
1087      * ${pkg}_output.F       write output to file.
1088      * ${pkg}_write_pickup.F write a package pickup file to restart the model
1089    
1090      New: Subroutine in one package (pkgA) that only contains code which
1091           is connected to a 2nd package (pkgB) (e.g.: gmredi_diagnostics_init.F)
1092           will be named: pkgA_pkgB_something.F
1093    
1094  - parameter file  - parameter file
1095    -----------------------    -----------------------

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

  ViewVC Help
Powered by ViewVC 1.1.22