1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/inc/GRID.h,v 1.4 1998/06/08 21:43:00 cnh Exp $ |
2 |
C |
3 |
C /==========================================================\ |
4 |
C | GRID.h | |
5 |
C | o Header file defining model grid. | |
6 |
C |==========================================================| |
7 |
C | Model grid is defined for each process by reference to | |
8 |
C | the arrays set here. | |
9 |
C | Notes | |
10 |
C | ===== | |
11 |
C | The standard MITgcm convention of westmost, southern most| |
12 |
C | and upper most having the (1,1,1) index is used here. | |
13 |
C | i.e. | |
14 |
C |----------------------------------------------------------| |
15 |
C | (1) Plan view schematic of model grid (top layer i.e. ) | |
16 |
C | ================================= ( ocean surface ) | |
17 |
C | ( or top of ) | |
18 |
C | ( atmosphere ) | |
19 |
C | This diagram shows the location of the model | |
20 |
C | prognostic variables on the model grid. The "T" | |
21 |
C | location is used for all tracers. The figure also | |
22 |
C | shows the southern most, western most indexing | |
23 |
C | convention that is used for all model variables. | |
24 |
C | | |
25 |
C | | |
26 |
C | V(i=1, V(i=Nx, | |
27 |
C | j=Ny+1, j=Ny+1, | |
28 |
C | k=1) k=1) | |
29 |
C | /|\ /|\ "PWX" | |
30 |
C | |---------|------------------etc.. |---- *--- | |
31 |
C | | | * | | |
32 |
C |"PWY"*******************************etc.. **********"PWY"| |
33 |
C | | | * | | |
34 |
C | | | * | | |
35 |
C | | | * | | |
36 |
C |U(i=1, ==> x | x *==>U | |
37 |
C | j=Ny,| T(i=1, | T(i=Nx, *(i=Nx+1,| |
38 |
C | k=1) | j=Ny, | j=Ny, * |j=Ny,| |
39 |
C | | k=1) | k=1) * |k=1) | |
40 |
C | | |
41 |
C | . . . | |
42 |
C | . . . | |
43 |
C | . . . | |
44 |
C | e e * e | |
45 |
C | t t * t | |
46 |
C | c c * c | |
47 |
C | | | * | | |
48 |
C | | | * | | |
49 |
C |U(i=1, ==> x | x * | | |
50 |
C | j=2, | T(i=1, | T(i=Nx, * | | |
51 |
C | k=1) | j=2, | j=2, * | | |
52 |
C | | k=1) | k=1) * | | |
53 |
C | | | * | | |
54 |
C | | /|\ | /|\ * | | |
55 |
C | -----------|------------------etc.. |-----*--- | |
56 |
C | | V(i=1, | V(i=Nx, * | | |
57 |
C | | j=2, | j=2, * | | |
58 |
C | | k=1) | k=1) * | | |
59 |
C | | | * | | |
60 |
C |U(i=1, ==> x ==>U(i=2, x *==>U | |
61 |
C | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1,| |
62 |
C | k=1) | j=1, | k=1) j=1, * |j=1, | |
63 |
C | | k=1) | k=1) * |k=1) | |
64 |
C | | | * | | |
65 |
C | | /|\ | /|\ * | | |
66 |
C |"SB"++>|---------|------------------etc.. |-----*--- | |
67 |
C | /+\ V(i=1, V(i=Nx, * | |
68 |
C | + j=1, j=1, * | |
69 |
C | + k=1) k=1) * | |
70 |
C | "WB" "PWX" | |
71 |
C | | |
72 |
C | N, y increasing northwards | |
73 |
C | /|\ j increasing northwards | |
74 |
C | | | |
75 |
C | | | |
76 |
C | ======>E, x increasing eastwards | |
77 |
C | i increasing eastwards | |
78 |
C | | |
79 |
C | i: East-west index | |
80 |
C | j: North-south index | |
81 |
C | k: up-down index | |
82 |
C | U: x-velocity (m/s) | |
83 |
C | V: y-velocity (m/s) | |
84 |
C | T: potential temperature (oC) | |
85 |
C | "SB": Southern boundary | |
86 |
C | "WB": Western boundary | |
87 |
C |"PWX": Periodic wrap around in X. | |
88 |
C |"PWY": Periodic wrap around in Y. | |
89 |
C |----------------------------------------------------------| |
90 |
C | (2) South elevation schematic of model grid | |
91 |
C | ======================================= | |
92 |
C | This diagram shows the location of the model | |
93 |
C | prognostic variables on the model grid. The "T" | |
94 |
C | location is used for all tracers. The figure also | |
95 |
C | shows the upper most, western most indexing | |
96 |
C | convention that is used for all model variables. | |
97 |
C | | |
98 |
C | "WB" | |
99 |
C | + | |
100 |
C | + | |
101 |
C | \+/ /|\ /|\ | |
102 |
C |"UB"++>|-------- | -----------------etc.. | ----*--- | |
103 |
C | | rVel(i=1, | rVel(i=Nx, * | | |
104 |
C | | j=1, | j=1, * | | |
105 |
C | | k=1) | k=1) * | | |
106 |
C | | | * | | |
107 |
C |U(i=1, ==> x ==>U(i=2, x *==>U | |
108 |
C | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1,| |
109 |
C | k=1) | j=1, | k=1) j=1, * |j=1, | |
110 |
C | | k=1) | k=1) * |k=1) | |
111 |
C | | | * | | |
112 |
C | | /|\ | /|\ * | | |
113 |
C | |-------- | -----------------etc.. | ----*--- | |
114 |
C | | rVel(i=1, | rVel(i=Nx, * | | |
115 |
C | | j=1, | j=1, * | | |
116 |
C | | k=2) | k=2) * | | |
117 |
C | | |
118 |
C | . . . | |
119 |
C | . . . | |
120 |
C | . . . | |
121 |
C | e e * e | |
122 |
C | t t * t | |
123 |
C | c c * c | |
124 |
C | | | * | | |
125 |
C | | | * | | |
126 |
C | | | * | | |
127 |
C | | | * | | |
128 |
C | | /|\ | /|\ * | | |
129 |
C | |-------- | -----------------etc.. | ----*--- | |
130 |
C | | rVel(i=1, | rVel(i=Nx, * | | |
131 |
C | | j=1, | j=1, * | | |
132 |
C | | k=Nz) | k=Nz) * | | |
133 |
C |U(i=1, ==> x ==>U(i=2, x *==>U | |
134 |
C | j=1, | T(i=1, | j=1, T(i=Nx, *(i=Nx+1,| |
135 |
C | k=Nz)| j=1, | k=Nz) j=1, * |j=1, | |
136 |
C | | k=Nz) | k=Nz) * |k=Nz)| |
137 |
C | | | * | | |
138 |
C |"LB"++>============================================== | |
139 |
C | "PWX" | |
140 |
C | | |
141 |
C | Up increasing upwards. | |
142 |
C |/|\ | |
143 |
C | | | |
144 |
C | | | |
145 |
C | =====> E i increasing eastwards | |
146 |
C | | x increasing eastwards | |
147 |
C | | | |
148 |
C |\|/ | |
149 |
C | Down,k increasing downwards. | |
150 |
C | | |
151 |
C | Note: r => height (m) => r increases upwards | |
152 |
C | r => pressure (Pa) => r increases downwards | |
153 |
C | | |
154 |
C | | |
155 |
C | i: East-west index | |
156 |
C | j: North-south index | |
157 |
C | k: up-down index | |
158 |
C | U: x-velocity (m/s) | |
159 |
C | rVel: z-velocity ( units of r ) | |
160 |
C | The vertical velocity variable rVel is in units of | |
161 |
C | "r" the vertical coordinate. r in m will give | |
162 |
C | rVel m/s. r in Pa will give rVel Pa/s. | |
163 |
C | T: potential temperature (oC) | |
164 |
C | "UB": Upper boundary. | |
165 |
C | "LB": Lower boundary (always solid - therefore om|w == 0)| |
166 |
C | "WB": Western boundary | |
167 |
C |"PWX": Periodic wrap around in X. | |
168 |
C |----------------------------------------------------------| |
169 |
C | (3) Views showing nomenclature and indexing | |
170 |
C | for grid descriptor variables. | |
171 |
C | | |
172 |
C | Fig 3a. shows the orientation, indexing and | |
173 |
C | notation for the grid spacing terms used internally | |
174 |
C | for the evaluation of gradient and averaging terms. | |
175 |
C | These varaibles are set based on the model input | |
176 |
C | parameters which define the model grid in terms of | |
177 |
C | spacing in X, Y and Z. | |
178 |
C | | |
179 |
C | Fig 3b. shows the orientation, indexing and | |
180 |
C | notation for the variables that are used to define | |
181 |
C | the model grid. These varaibles are set directly | |
182 |
C | from the model input. | |
183 |
C | | |
184 |
C | Figure 3a | |
185 |
C | ========= | |
186 |
C | |------------------------------------ | |
187 |
C | | | | |
188 |
C |"PWY"********************************* etc... | |
189 |
C | | | | |
190 |
C | | | | |
191 |
C | | | | |
192 |
C | | | | |
193 |
C | | | | |
194 |
C | | | | |
195 |
C | | | | |
196 |
C | | |
197 |
C | . . | |
198 |
C | . . | |
199 |
C | . . | |
200 |
C | e e | |
201 |
C | t t | |
202 |
C | c c | |
203 |
C | |-----------v-----------|-----------v----------|- | |
204 |
C | | | | | |
205 |
C | | | | | |
206 |
C | | | | | |
207 |
C | | | | | |
208 |
C | | | | | |
209 |
C | u<--dxF(i=1,j=2,k=1)--->u t | | |
210 |
C | |/|\ /|\ | | | |
211 |
C | | | | | | | |
212 |
C | | | | | | | |
213 |
C | | | | | | | |
214 |
C | |dyU(i=1, dyC(i=1, | | | |
215 |
C | --- ---|--j=2,---|--j=2,-----------------v----------|- | |
216 |
C | /|\ | | k=1) | k=1) | /|\ | | |
217 |
C | | | | | | dyF(i=2, | | |
218 |
C | | | | | | | j=1, | | |
219 |
C |dyG( |\|/ \|/ | | k=1) | | |
220 |
C | i=1,u--- t<---dxC(i=2,j=1,k=1)-->t | | |
221 |
C | j=1,| | | | | |
222 |
C | k=1)| | | | | |
223 |
C | | | | | | | |
224 |
C | | | | | | | |
225 |
C | \|/ | |<---dxV(i=2,j=1,k=1)--\|/ | | |
226 |
C |"SB"++>|___________v___________|___________v__________|_ | |
227 |
C | <--dxG(i=1,j=1,k=1)-----> | |
228 |
C | /+\ | |
229 |
C | + | |
230 |
C | + | |
231 |
C | "WB" | |
232 |
C | | |
233 |
C | N, y increasing northwards | |
234 |
C | /|\ j increasing northwards | |
235 |
C | | | |
236 |
C | | | |
237 |
C | ======>E, x increasing eastwards | |
238 |
C | i increasing eastwards | |
239 |
C | | |
240 |
C | i: East-west index | |
241 |
C | j: North-south index | |
242 |
C | k: up-down index | |
243 |
C | u: x-velocity point | |
244 |
C | V: y-velocity point | |
245 |
C | t: tracer point | |
246 |
C | "SB": Southern boundary | |
247 |
C | "WB": Western boundary | |
248 |
C |"PWX": Periodic wrap around in X. | |
249 |
C |"PWY": Periodic wrap around in Y. | |
250 |
C | | |
251 |
C | Figure 3b | |
252 |
C | ========= | |
253 |
C | | |
254 |
C | . . | |
255 |
C | . . | |
256 |
C | . . | |
257 |
C | e e | |
258 |
C | t t | |
259 |
C | c c | |
260 |
C | |-----------v-----------|-----------v--etc... | |
261 |
C | | | | |
262 |
C | | | | |
263 |
C | | | | |
264 |
C | | | | |
265 |
C | | | | |
266 |
C | u<--delX(i=1)---------->u t | |
267 |
C | | | | |
268 |
C | | | | |
269 |
C | | | | |
270 |
C | | | | |
271 |
C | | | | |
272 |
C | |-----------v-----------------------v--etc... | |
273 |
C | | /|\ | | |
274 |
C | | | | | |
275 |
C | | | | | |
276 |
C | | | | | |
277 |
C | u delY(j=1) | t | |
278 |
C | | | | | |
279 |
C | | | | | |
280 |
C | | | | | |
281 |
C | | | | | |
282 |
C | | \|/ | | |
283 |
C |"SB"++>|___________v___________|___________v__etc... | |
284 |
C | /+\ | |
285 |
C | + | |
286 |
C | + | |
287 |
C | "WB" | |
288 |
C | | |
289 |
C \==========================================================/ |
290 |
|
291 |
C Macros that override/modify standard definitions |
292 |
#include "GRID_MACROS.h" |
293 |
|
294 |
C |
295 |
C-- COMMON /GRID_R/ REAL valued grid defining variables. |
296 |
C dxC - Cell center separation in X across western cell wall (m) |
297 |
C dxG - Cell face separation in X along southern cell wall (m) |
298 |
C dxF - Cell face separation in X thru cell center (m) |
299 |
C dxV - V-point separation in X across south-west corner of cell (m) |
300 |
C dyC - Cell center separation in Y across southern cell wall (m) |
301 |
C dyG - Cell face separation in Y along western cell wall (m) |
302 |
C dyF - Cell face separation in Y thru cell center (m) |
303 |
C dyU - U-point separation in Y across south-west corner of cell (m) |
304 |
C drC - Cell center separation along Z axis ( units of r ). |
305 |
C drF - Cell face separation along Z axis ( units of r ). |
306 |
C H - Depth of base of fluid from upper surface f[X,Y] (m). |
307 |
C hFac - Fraction of cell in vertical which is open i.e how |
308 |
C "lopped" a cell is (dimensionless scale factor). |
309 |
C Note: The code needs terms like MIN(hFac,hFac(I+1)) |
310 |
C On some platforms it may be better to precompute |
311 |
C hFacW, hFacE, ... here than do MIN on the fly. |
312 |
C maskW - West face land mask |
313 |
C maskS - South face land mask |
314 |
C recip_dxC - Recipricol of dxC |
315 |
C recip_dxG - Recipricol of dxG |
316 |
C recip_dxF - Recipricol of dxF |
317 |
C recip_dxV - Recipricol of dxV |
318 |
C recip_dyC - Recipricol of dxC |
319 |
C recip_dyG - Recipricol of dyG |
320 |
C recip_dyF - Recipricol of dyF |
321 |
C recip_dyU - Recipricol of dyU |
322 |
C recip_drC - Recipricol of drC |
323 |
C recip_drF - Recipricol of drF |
324 |
C recip_H - Inverse of cell center open-depth |
325 |
C recip_hFacC - Inverse of cell open-depth f[X,Y,Z] ( dimensionless ). |
326 |
C recip_hFacW rhFacC center, rhFacW west, rhFacS south. |
327 |
C recip_hFacS Note: This is precomputed here because it involves division. |
328 |
C saFac - Shallow atmosphere factor (dimensionless scale factor). |
329 |
C xC - X-coordinate of center of cell f[X,Y]. The units of xc, yc |
330 |
C depend on the grid. They are not used in differencing or |
331 |
C averaging but are just a convient quantity for I/O, |
332 |
C diagnostics etc.. As such xc is in m for cartesian |
333 |
C coordinates but degrees for spherical polar. |
334 |
C yC - Y-coordinate of center of cell f[X,Y]. |
335 |
C xC0, yC0 - West edge x coord ( metres or degrees ) |
336 |
C South edge y coord ( metres or degrees ) |
337 |
C rA - R-face are f[X,Y] ( m^2 ). |
338 |
C Note: In a cartesian framework zA is simply dx*dy, |
339 |
C however we use zA to allow for non-globally |
340 |
C orthogonal coordinate frames (with appropriate |
341 |
C metric terms). |
342 |
C rC - R-coordinate of center of cell f[Z] (units of r). |
343 |
C rF - R-coordinate of face of cell f[Z] (units of r). |
344 |
C tanPhiAtU - tan of the latitude at U point. Used for spherical polar |
345 |
C metric term in U equation. |
346 |
C tanPhiAtV - tan of the latitude at V point. Used for spherical polar |
347 |
C metric term in V equation. |
348 |
COMMON /GRID_R/ |
349 |
& dxC,dxF,dxG,dxV,dyC,dyF,dyG,dyU,dzC,drF, |
350 |
& H,HFacC,HFacW,HFacS, |
351 |
& recip_dxC,recip_dxF,recip_dxG,recip_dxV, |
352 |
& recip_dyC,recip_dyF,recip_dyG,recip_dyU, |
353 |
& recip_drC,recip_drF, |
354 |
& recip_H, |
355 |
& recip_hFacC,recip_hFacW,recip_hFacS, |
356 |
& saFac, |
357 |
& xC,yC,rA,rC,rF,yC0,xC0, |
358 |
& maskW,maskS, |
359 |
& tanPhiAtU, tanPhiAtV |
360 |
_RS dxC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
361 |
_RS dxF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
362 |
_RS dxG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
363 |
_RS dxV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
364 |
_RS dyC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
365 |
_RS dyF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
366 |
_RS dyG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
367 |
_RS dyU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
368 |
_RS drC (1:Nz) |
369 |
_RS drF (1:Nz) |
370 |
_RS H (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
371 |
_RS HFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
372 |
_RS HFacW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
373 |
_RS HFacS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
374 |
_RS recip_dxC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
375 |
_RS recip_dxF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
376 |
_RS recip_dxG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
377 |
_RS recip_dxV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
378 |
_RS recip_dyC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
379 |
_RS recip_dyF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
380 |
_RS recip_dyG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
381 |
_RS recip_dyU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
382 |
_RS recip_dzC (1:Nz) |
383 |
_RS recip_drF (1:Nz) |
384 |
_RS recip_h (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
385 |
_RS recip_hFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
386 |
_RS recip_hFacW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
387 |
_RS recip_hFacS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
388 |
_RS saFac (1:Nz) |
389 |
_RS xC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
390 |
_RS xC0 |
391 |
_RS yC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
392 |
_RS yC0 |
393 |
_RS rA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
394 |
_RS rC (1:Nz) |
395 |
_RS rF (1:Nz+1) |
396 |
_RS maskW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
397 |
_RS maskS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
398 |
_RS tanPhiAtU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
399 |
_RS tanPhiAtV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
400 |
|
401 |
|
402 |
C-- COMMON /GRID_I/ Integer valued grid defining variables |
403 |
C iDep - Index of last "non-land" cell for each column f[X,Y]. |
404 |
COMMON /GRID_I/ |
405 |
& iDep |
406 |
INTEGER iDep(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |