1 |
|
2 |
#if 0 |
3 |
|
4 |
The somewhat weird looking format of this file is so that it can be |
5 |
included in both C and FORTRAN routines. The general problem is that |
6 |
FORTRAN requires that the definitions in this header file be included |
7 |
in each *subroutine*, and thus possibly multiple times in a single |
8 |
source file if that source file defines multiple subroutines, while C |
9 |
demands that the actual definitions only appear once per *file*, even |
10 |
if this header file is (accidently) #include'd multiple times. |
11 |
|
12 |
N.B.: Do NOT remove the parentheses in the "enum" or "PARAMETER" |
13 |
declarations. We want the user to be able to use an expression |
14 |
in the "#define" (e.g. "#define __sNx 64 + 8 "), and not have |
15 |
to worry about precedence in the substituted expressions (e.g. |
16 |
if "__sNx" is defined as 64 + 8, then "__sNx * __sNy" would not |
17 |
behave the way you might expect, unlike "(__sNx) * (__sNy)"). |
18 |
|
19 |
#endif |
20 |
|
21 |
|
22 |
|
23 |
#if 0 |
24 |
Define the magic constants. If you want to add (or delete) entries, |
25 |
note that the change needs to also be made to the C "enum" and the |
26 |
Fortran "parameter" statements. |
27 |
|
28 |
__sFacet : The fundamental unit size of a facet in llc. Facets |
29 |
one and two are 1unit x 3units, facet three (the arctic |
30 |
polar facet) is 1unit x 1unit, and facets four and five |
31 |
are 3units x 1unit. |
32 |
|
33 |
__sNx, __sNy : The (sub)tile dimensions. Each must divide __sFacet. |
34 |
Note that if sub-tiles are being used (i.e. __nSx |
35 |
and/or __nSy are greater than one), these dimensions |
36 |
are the extent of each sub-tile. |
37 |
|
38 |
__OLx, __OLy : The overlap, i.e. the number of ghost cells. |
39 |
|
40 |
__nSx, __nSy : If the code uses parallel threads in (addition to MPI), |
41 |
the sub-division of an individual tile into sub-tiles. |
42 |
An MPI process is assigned a whole tile, and each thread |
43 |
within that process is assigned a sub-tile. Thus, each |
44 |
MPI process will use (__nSx * __nSy) threads. These |
45 |
values are usually both "1" (i.e. no threading). |
46 |
|
47 |
__nPx, __nPy : The full llc decomposition of the earth contains |
48 |
(__sFacet/__sNx) * (__sFacet/__sNy) * 13 |
49 |
total tiles. However, some of these tiles represent |
50 |
areas that have no water, and so MITgcm doesn't care |
51 |
about them. (These are called "dry" tiles, or "blank" |
52 |
tiles.) We take that sub-set of the tiles we care |
53 |
about (i.e. the "wet" tiles; the ones we are actually |
54 |
going to do computations on), and imagine those tiles |
55 |
being in a 2D array, with extent (__nPx, __nPy). |
56 |
As a practical matter, for the llc decomposition, |
57 |
__nPy is almost always 1 (and __nPx is equal to the |
58 |
number of "wet" tiles). |
59 |
|
60 |
__Nr : The number of vertical levels in the 3D fields. |
61 |
#endif |
62 |
|
63 |
#if !defined(_MITGCM_MAGIC_CONSTANTS) |
64 |
#define _MITGCM_MAGIC_CONSTANTS |
65 |
|
66 |
#define __sFacet 90 |
67 |
#define __sNx 30 |
68 |
#define __sNy 30 |
69 |
#define __OLx 8 |
70 |
#define __OLy 8 |
71 |
#define __nSx 1 |
72 |
#define __nSy 1 |
73 |
#define __nPx 96 |
74 |
#define __nPy 1 |
75 |
#define __Nr 50 |
76 |
|
77 |
#endif |
78 |
|
79 |
|
80 |
|
81 |
|
82 |
#if defined(__STDC__) || defined(__cplusplus) |
83 |
|
84 |
/* For C, only include this part once */ |
85 |
#if !defined(SIZE_h) |
86 |
#define SIZE_h |
87 |
|
88 |
/* |
89 |
** We use the "enum" hack in order to force the names into the symbol |
90 |
** table, which "#define" by itself typically does not do. |
91 |
*/ |
92 |
enum { |
93 |
sFacet = (__sFacet), |
94 |
sNx = (__sNx), |
95 |
sNy = (__sNy), |
96 |
OLx = (__OLx), |
97 |
OLy = (__OLy), |
98 |
nSx = (__nSx), |
99 |
nSy = (__nSy), |
100 |
nPx = (__nPx), |
101 |
nPy = (__nPy), |
102 |
Nr = (__Nr), |
103 |
|
104 |
Nx = ((__sNx)*(__nSx)*(__nPx)), |
105 |
Ny = ((__sNy)*(__nSy)*(__nPy)), |
106 |
MAX_OLX = (OLx), |
107 |
MAX_OLY = (OLy), |
108 |
}; |
109 |
|
110 |
/* end of "if !defined(SIZE_h)" */ |
111 |
#endif |
112 |
|
113 |
|
114 |
#else |
115 |
|
116 |
|
117 |
! There are no pre-processor symbols that are guaranteed to be defined |
118 |
! for a Fortran compile, so we just assume that since this wasn't C/C++, |
119 |
! it must be Fortran. |
120 |
|
121 |
CBOP |
122 |
C !ROUTINE: SIZE.h |
123 |
C !INTERFACE: |
124 |
C include SIZE.h |
125 |
C !DESCRIPTION: \bv |
126 |
C *==========================================================* |
127 |
C | SIZE.h Declare size of underlying computational grid. |
128 |
C *==========================================================* |
129 |
C | The design here support a three-dimensional model grid |
130 |
C | with indices I,J and K. The three-dimensional domain |
131 |
C | is comprised of nPx*nSx blocks of size sNx along one axis |
132 |
C | nPy*nSy blocks of size sNy along another axis and one |
133 |
C | block of size Nz along the final axis. |
134 |
C | Blocks have overlap regions of size OLx and OLy along the |
135 |
C | dimensions that are subdivided. |
136 |
C *==========================================================* |
137 |
C \ev |
138 |
CEOP |
139 |
C Voodoo numbers controlling data layout. |
140 |
C sNx :: No. X points in sub-grid. |
141 |
C sNy :: No. Y points in sub-grid. |
142 |
C OLx :: Overlap extent in X. |
143 |
C OLy :: Overlat extent in Y. |
144 |
C nSx :: No. sub-grids in X. |
145 |
C nSy :: No. sub-grids in Y. |
146 |
C nPx :: No. of processes to use in X. |
147 |
C nPy :: No. of processes to use in Y. |
148 |
C Nx :: No. points in X for the total domain. |
149 |
C Ny :: No. points in Y for the total domain. |
150 |
C Nr :: No. points in Z for full process domain. |
151 |
|
152 |
INTEGER sFacet |
153 |
INTEGER sNx |
154 |
INTEGER sNy |
155 |
INTEGER OLx |
156 |
INTEGER OLy |
157 |
INTEGER nSx |
158 |
INTEGER nSy |
159 |
INTEGER nPx |
160 |
INTEGER nPy |
161 |
INTEGER Nx |
162 |
INTEGER Ny |
163 |
INTEGER Nr |
164 |
|
165 |
PARAMETER ( |
166 |
& sFacet = (__sFacet), |
167 |
& sNx = (__sNx), |
168 |
& sNy = (__sNy), |
169 |
& OLx = (__OLx), |
170 |
& OLy = (__OLy), |
171 |
& nSx = (__nSx), |
172 |
& nSy = (__nSy), |
173 |
& nPx = (__nPx), |
174 |
& nPy = (__nPy), |
175 |
& Nr = (__Nr) ) |
176 |
|
177 |
PARAMETER ( Nx = (__sNx)*(__nSx)*(__nPx) ) |
178 |
PARAMETER ( Ny = (__sNy)*(__nSy)*(__nPy) ) |
179 |
|
180 |
C MAX_OLX :: Set to the maximum overlap region size of any array |
181 |
C MAX_OLY that will be exchanged. Controls the sizing of exch |
182 |
C routine buffers. |
183 |
INTEGER MAX_OLX |
184 |
INTEGER MAX_OLY |
185 |
PARAMETER ( MAX_OLX = (OLx), |
186 |
& MAX_OLY = (OLy) ) |
187 |
|
188 |
|
189 |
#endif |
190 |
|