/[MITgcm]/mitgcm.org/sealion/technical_notes/package_guidelines/package.txt
ViewVC logotype

Annotation of /mitgcm.org/sealion/technical_notes/package_guidelines/package.txt

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


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Fri Oct 5 19:02:41 2001 UTC (23 years, 9 months ago) by adcroft
Branch: From_cnh
CVS Tags: Start
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Importing Sealion web-site into CVS ...

1 adcroft 1.1 Version: 29-Aug-2000
2     Updated: 15-Nov-2000
3    
4     MITgcmUV Packages
5     =================
6    
7     Optional parts of code are separated from
8     the MITgcmUV core driver code and organised into
9     packages. The packaging structure provides a mechanism for
10     maintaining suites of code, specific to particular
11     classes of problem, in a way that is cleanly
12     separated from the generic fluid dynamical engine.
13    
14     The MITgcmUV packaging structure is describe
15     below using generic package names ${pkg}.
16     A concrete examples of a package is the code
17     for implementing GM/Redi mixing. This code uses
18     the package name
19     * ${PKG} = GMREDI
20     * ${pkg} = gmredi
21     * ${Pkg} = gmRedi
22    
23     Package states
24     ==============
25    
26     Packages can be any one of four states, included,
27     excluded, enabled, disabled as follows:
28    
29     included(excluded) compile time state which
30     includes(excludes) package
31     code and routine calls from
32     compilation/linking etc...
33    
34     enabled(disabled) run-time state which
35     enables(disables) package code
36     execution.
37    
38     Every call to a ${pkg}_... routine from outside the package
39     should be placed within both a
40     #ifdef ALLOW_${PKG} ... block and a
41     if ( use${Pkg} ) ... then block.
42     Package states are generally not expected to change during
43     a model run.
44    
45     Package structure
46     =================
47    
48     o Each package gets its runtime configuration
49     parameters from a file named "data.${pkg}"
50     Package runtime config. options are imported
51     into a common block held in a header file
52     called "${PKG}.h".
53    
54     o The core driver part of the model can check
55     for runtime enabling or disabling of individual packages
56     through logical flags use${Pkg}.
57     The information is loaded from a
58     global package setup file called "data.pkg".
59     The use${Pkg} flags are not used within
60     individual packages.
61    
62     o Included in "${PKG}.h" is a logical flag
63     called ${Pkg}IsOn. The "${PKG}.h" header file can be imported
64     by other packages to check dependencies and requirements
65     from other packages ( see "Package Boot Sequence" section).
66     NOTE: This procedure is not presently implemented,
67     ----- neither for kpp nor for gmRedi.
68    
69     CPP Flags
70     =========
71    
72     1. Within the core driver code flags of the form
73     ALLOW_${PKG} are used to include or exclude
74     whole packages. The ALLOW_${PKG} flags are included
75     from a PKG_CPP_OPTIONS block which is currently
76     held in-line in the CPP_OPTIONS.h header file.
77     e.g.
78    
79     Core model code .....
80    
81     #include "CPP_OPTIONS.h"
82     :
83     :
84     :
85    
86     #ifdef ALLOW_${PKG}
87     if ( use${Pkg} ) CALL ${PKG}_DO_SOMETHING(...)
88     #endif
89    
90     2. Within an individual package a header file,
91     "${PKG}_OPTIONS.h", is used to set CPP flags
92     specific to that package. It is not recommended
93     to include this file in "CPP_OPTIONS.h".
94    
95    
96     Package Boot Sequence
97     =====================
98    
99     Calls to package routines within the core code timestepping
100     loop can vary. However, all packages follow a required
101     "boot" sequence outlined here:
102    
103     1. S/R PACKAGES_BOOT()
104     :
105     CALL OPEN_COPY_DATA_FILE( 'data.pkg', 'PACKAGES_BOOT', ... )
106    
107    
108     2. S/R PACKAGES_READPARMS()
109     :
110     #ifdef ALLOW_${PKG}
111     if ( use${Pkg} )
112     & CALL ${PKG}_READPARMS( retCode )
113     #endif
114    
115     2. S/R PACKAGES_CHECK()
116     :
117     #ifdef ALLOW_${PKG}
118     if ( use${Pkg} )
119     & CALL ${PKG}_CHECK( retCode )
120     #else
121     if ( use${Pkg} )
122     & CALL PACKAGES_CHECK_ERROR('${PKG}')
123     #endif
124    
125     3. S/R PACKAGES_INIT()
126     :
127     #ifdef ALLOW_${PKG}
128     if ( use${Pkg} )
129     & CALL ${PKG}_INIT( retCode )
130     #endif
131    
132    
133     Description
134     ===========
135    
136     - ${PKG}_READPARMS()
137     is responsible for reading
138     in the package parameters file data.${pkg}, and storing
139     the package parameters in "${PKG}.h".
140     -> called in INITIALISE_FIXED
141    
142     - ${PKG}_CHECK()
143     is responsible for validating
144     basic package setup and inter-package dependencies.
145     ${PKG}_CHECK can import other package parameters it may
146     need to check. This is done through header files "${PKG}.h".
147     It is assumed that parameters owned by other packages
148     will not be reset during ${PKG}_CHECK().
149     -> called in INITIALISE_FIXED
150    
151     - ${PKG}_INIT()
152     is responsible for completing the
153     internal setup of a package. This routine is called after
154     the core model state has been completely initialised
155     but before the core model timestepping starts.
156     -> called in INITIALISE_VARIA
157    
158     Summary
159     =======
160    
161     - CPP options:
162     -----------------------
163     * ALLOW_${PKG} include/exclude package for compilation
164    
165     - FORTRAN logical:
166     -----------------------
167     * use${Pkg} enable package for execution at runtime
168     -> declared in PARAMS.h
169     * ${Pkg}IsOn for package cross-dependency check
170     -> declared in ${PKG}.h
171     N.B.: Not presently used!
172    
173     - header files
174     -----------------------
175     * ${PKG}_OPTIONS.h has further package-specific CPP options
176     * ${PKG}.h package-specific common block variables, fields
177    
178     - FORTRAN source files
179     -----------------------
180     * ${pkg}_readparms.F reads parameters from file data.${pkg}
181     * ${pkg}_check.F checks package dependencies and consistencies
182     * ${pkg}_init.F initialises package-related fields
183     * ${pkg}_... .F package source code
184    
185     - parameter file
186     -----------------------
187     * data.${pkg} parameter file
188    

  ViewVC Help
Powered by ViewVC 1.1.22