1 |
C $Id$ |
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 | | w,om(i=1, | w,om(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 | | w,om(i=1, | w,om(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 | | w,om(i=1, | w,om(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,z 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 | i: East-west index | |
152 |
C | j: North-south index | |
153 |
C | k: up-down index | |
154 |
C | U: x-velocity (m/s) | |
155 |
C | w,om: z-velocity (Pa/s - therefore +ve is down) | |
156 |
C | The vertical velocity variable is sometimes named | |
157 |
C | "w" in the model code. The vertical coordinate and | |
158 |
C | also gridding are both under review - watch this | |
159 |
C | space! | |
160 |
C | T: potential temperature (oC) | |
161 |
C | "UB": Upper boundary. | |
162 |
C | "LB": Lower boundary (always solid - therefore om|w == 0)| |
163 |
C | "WB": Western boundary | |
164 |
C |"PWX": Periodic wrap around in X. | |
165 |
C |----------------------------------------------------------| |
166 |
C | (3) Views showing nomenclature and indexing | |
167 |
C | for grid descriptor variables. | |
168 |
C | | |
169 |
C | Fig 3a. shows the orientation, indexing and | |
170 |
C | notation for the grid spacing terms used internally | |
171 |
C | for the evaluation of gradient and averaging terms. | |
172 |
C | These varaibles are set based on the model input | |
173 |
C | parameters which define the model grid in terms of | |
174 |
C | spacing in X, Y and Z. | |
175 |
C | | |
176 |
C | Fig 3b. shows the orientation, indexing and | |
177 |
C | notation for the variables that are used to define | |
178 |
C | the model grid. These varaibles are set directly | |
179 |
C | from the model input. | |
180 |
C | | |
181 |
C | Figure 3a | |
182 |
C | ========= | |
183 |
C | |------------------------------------ | |
184 |
C | | | | |
185 |
C |"PWY"********************************* etc... | |
186 |
C | | | | |
187 |
C | | | | |
188 |
C | | | | |
189 |
C | | | | |
190 |
C | | | | |
191 |
C | | | | |
192 |
C | | | | |
193 |
C | | |
194 |
C | . . | |
195 |
C | . . | |
196 |
C | . . | |
197 |
C | e e | |
198 |
C | t t | |
199 |
C | c c | |
200 |
C | |-----------v-----------|-----------v----------|- | |
201 |
C | | | | | |
202 |
C | | | | | |
203 |
C | | | | | |
204 |
C | | | | | |
205 |
C | | | | | |
206 |
C | u<--dxF(i=1,j=2,k=1)--->u t | | |
207 |
C | |/|\ /|\ | | | |
208 |
C | | | | | | | |
209 |
C | | | | | | | |
210 |
C | | | | | | | |
211 |
C | |dyU(i=1, dyC(i=1, | | | |
212 |
C | --- ---|--j=2,---|--j=2,-----------------v----------|- | |
213 |
C | /|\ | | k=1) | k=1) | /|\ | | |
214 |
C | | | | | | dyF(i=2, | | |
215 |
C | | | | | | | j=1, | | |
216 |
C |dyG( |\|/ \|/ | | k=1) | | |
217 |
C | i=1,u--- t<---dxC(i=2,j=1,k=1)-->t | | |
218 |
C | j=1,| | | | | |
219 |
C | k=1)| | | | | |
220 |
C | | | | | | | |
221 |
C | | | | | | | |
222 |
C | \|/ | |<---dxV(i=2,j=1,k=1)--\|/ | | |
223 |
C |"SB"++>|___________v___________|___________v__________|_ | |
224 |
C | <--dxG(i=1,j=1,k=1)-----> | |
225 |
C | /+\ | |
226 |
C | + | |
227 |
C | + | |
228 |
C | "WB" | |
229 |
C | | |
230 |
C | N, y increasing northwards | |
231 |
C | /|\ j increasing northwards | |
232 |
C | | | |
233 |
C | | | |
234 |
C | ======>E, x increasing eastwards | |
235 |
C | i increasing eastwards | |
236 |
C | | |
237 |
C | i: East-west index | |
238 |
C | j: North-south index | |
239 |
C | k: up-down index | |
240 |
C | u: x-velocity point | |
241 |
C | V: y-velocity point | |
242 |
C | t: tracer point | |
243 |
C | "SB": Southern boundary | |
244 |
C | "WB": Western boundary | |
245 |
C |"PWX": Periodic wrap around in X. | |
246 |
C |"PWY": Periodic wrap around in Y. | |
247 |
C | | |
248 |
C | Figure 3b | |
249 |
C | ========= | |
250 |
C | | |
251 |
C | . . | |
252 |
C | . . | |
253 |
C | . . | |
254 |
C | e e | |
255 |
C | t t | |
256 |
C | c c | |
257 |
C | |-----------v-----------|-----------v--etc... | |
258 |
C | | | | |
259 |
C | | | | |
260 |
C | | | | |
261 |
C | | | | |
262 |
C | | | | |
263 |
C | u<--delX(i=1)---------->u t | |
264 |
C | | | | |
265 |
C | | | | |
266 |
C | | | | |
267 |
C | | | | |
268 |
C | | | | |
269 |
C | |-----------v-----------------------v--etc... | |
270 |
C | | /|\ | | |
271 |
C | | | | | |
272 |
C | | | | | |
273 |
C | | | | | |
274 |
C | u delY(j=1) | t | |
275 |
C | | | | | |
276 |
C | | | | | |
277 |
C | | | | | |
278 |
C | | | | | |
279 |
C | | \|/ | | |
280 |
C |"SB"++>|___________v___________|___________v__etc... | |
281 |
C | /+\ | |
282 |
C | + | |
283 |
C | + | |
284 |
C | "WB" | |
285 |
C | | |
286 |
C \==========================================================/ |
287 |
C |
288 |
C-- COMMON /GRID_R/ REAL valued grid defining variables. |
289 |
C dxC - Cell center separation in X across western cell wall (m) |
290 |
C dxG - Cell face separation in X along southern cell wall (m) |
291 |
C dxF - Cell face separation in X thru cell center (m) |
292 |
C dxV - V-point separation in X across south-west corner of cell (m) |
293 |
C dyC - Cell center separation in Y across southern cell wall (m) |
294 |
C dyG - Cell face separation in Y along western cell wall (m) |
295 |
C dyF - Cell face separation in Y thru cell center (m) |
296 |
C dyU - U-point separation in Y across south-west corner of cell (m) |
297 |
C dzC - Cell center separation in Z (Pa). |
298 |
C dzF - Cell face separation in Z (Pa). |
299 |
C H - Depth of base of fluid from upper surface f[X,Y] (m). |
300 |
C hFac - Fraction of cell in vertical which is open i.e how |
301 |
C "lopped" a cell is (dimensionless scale factor). |
302 |
C Note: The code needs terms like MIN(hFac,hFac(I+1)) |
303 |
C On some platforms it may be better to precompute |
304 |
C hFacW, hFacE, ... here than do MIN on the fly. |
305 |
C maskW - West face land mask |
306 |
C maskS - South face land mask |
307 |
C rdxC - Recipricol of dxC |
308 |
C rdxG - Recipricol of dxG |
309 |
C rdxF - Recipricol of dxF |
310 |
C rdxV - Recipricol of dxV |
311 |
C rdyC - Recipricol of dxC |
312 |
C rdyG - Recipricol of dyG |
313 |
C rdyF - Recipricol of dyF |
314 |
C rdyU - Recipricol of dyU |
315 |
C rdzC - Recipricol of dzC |
316 |
C rdzF - Recipricol of dzF |
317 |
C rh - Inverse of cell center open-depth |
318 |
C rhFacC - Inverse of cell open-depth f[X,Y,Z] ( dimensionless ). |
319 |
C rhFacW rhFacC center, rhFacW west, rhFacS south. |
320 |
C rhFacS Note: This is precomputed here because it involves division. |
321 |
C saFac - Shallow atmosphere factor (dimensionless scale factor). |
322 |
C xC - X-coordinate of center of cell f[X,Y]. The units of xc, yc |
323 |
C depend on the grid. They are not used in differencing or |
324 |
C averaging but are just a convient quantity for I/O, |
325 |
C diagnostics etc.. As such xc is in m for cartesian |
326 |
C coordinates but degrees for spherical polar. |
327 |
C yC - Y-coordinate of center of cell f[X,Y]. |
328 |
C zA - Z-face are f[X,Y] (m^2). |
329 |
C Note: In a cartesian framework zA is simply dx*dy, |
330 |
C however we use zA to allow for non-globally |
331 |
C orthogonal coordinate frames (with appropriate |
332 |
C metric terms). |
333 |
C zC - Z-coordinate of center of cell f[Z] |
334 |
C zFace - Z-coordinate of face of cell f[Z] (Pa). |
335 |
COMMON /GRID_R/ |
336 |
& dxC,dxF,dxG,dxV,dyC,dyF,dyG,dyU,dzC,dzF, |
337 |
& H,HFacC,HFacW,HFacS, |
338 |
& rdxC,rdxF,rdxG,rdxV,rdyC,rdyF,rdyG,rdyU,rdzC,rdzF, |
339 |
& rH, rhFacC,rhFacW,rhFacS, |
340 |
& saFac,xC,yC,zA,zC,zFace, |
341 |
& maskW,maskS |
342 |
real dxC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
343 |
real dxF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
344 |
real dxG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
345 |
real dxV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
346 |
real dyC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
347 |
real dyF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
348 |
real dyG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
349 |
real dyU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
350 |
real dzC (1:Nz) |
351 |
real dzF (1:Nz) |
352 |
real H (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
353 |
real HFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
354 |
real HFacW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
355 |
real HFacS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
356 |
real rdxC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
357 |
real rdxF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
358 |
real rdxG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
359 |
real rdxV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
360 |
real rdyC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
361 |
real rdyF (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
362 |
real rdyG (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
363 |
real rdyU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
364 |
real rdzC (1:Nz) |
365 |
real rdzF (1:Nz) |
366 |
real rh (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
367 |
real rhFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
368 |
real rhFacW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
369 |
real rhFacS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
370 |
real saFac (1:Nz) |
371 |
real xC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
372 |
real yC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
373 |
real zA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
374 |
real zC (1:Nz) |
375 |
real zFace (1:Nz+1) |
376 |
real maskW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
377 |
real maskS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nz,nSx,nSy) |
378 |
|
379 |
|
380 |
C-- COMMON /GRID_I/ Integer valued grid defining variables |
381 |
C iDep - Index of last "non-land" cell for each column f[X,Y]. |
382 |
COMMON /GRID_I/ |
383 |
& iDep |
384 |
INTEGER iDep(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |