1 |
% $Header: /u/u0/gcmpack/mitgcmdoc/part2/spatial-discrete.tex,v 1.9 2001/10/24 15:21:27 cnh Exp $ |
2 |
% $Name: $ |
3 |
|
4 |
\section{Spatial discretization of the dynamical equations} |
5 |
|
6 |
Spatial discretization is carried out using the finite volume |
7 |
method. This amounts to a grid-point method (namely second-order |
8 |
centered finite difference) in the fluid interior but allows |
9 |
boundaries to intersect a regular grid allowing a more accurate |
10 |
representation of the position of the boundary. We treat the |
11 |
horizontal and vertical directions as separable and differently. |
12 |
|
13 |
\input{part2/notation} |
14 |
|
15 |
|
16 |
\subsection{The finite volume method: finite volumes versus finite difference} |
17 |
|
18 |
The finite volume method is used to discretize the equations in |
19 |
space. The expression ``finite volume'' actually has two meanings; one |
20 |
is the method of embedded or intersecting boundaries (shaved or lopped |
21 |
cells in our terminology) and the other is non-linear interpolation |
22 |
methods that can deal with non-smooth solutions such as shocks |
23 |
(i.e. flux limiters for advection). Both make use of the integral form |
24 |
of the conservation laws to which the {\it weak solution} is a |
25 |
solution on each finite volume of (sub-domain). The weak solution can |
26 |
be constructed out of piece-wise constant elements or be |
27 |
differentiable. The differentiable equations can not be satisfied by |
28 |
piece-wise constant functions. |
29 |
|
30 |
As an example, the 1-D constant coefficient advection-diffusion |
31 |
equation: |
32 |
\begin{displaymath} |
33 |
\partial_t \theta + \partial_x ( u \theta - \kappa \partial_x \theta ) = 0 |
34 |
\end{displaymath} |
35 |
can be discretized by integrating over finite sub-domains, i.e. |
36 |
the lengths $\Delta x_i$: |
37 |
\begin{displaymath} |
38 |
\Delta x \partial_t \theta + \delta_i ( F ) = 0 |
39 |
\end{displaymath} |
40 |
is exact if $\theta(x)$ is piece-wise constant over the interval |
41 |
$\Delta x_i$ or more generally if $\theta_i$ is defined as the average |
42 |
over the interval $\Delta x_i$. |
43 |
|
44 |
The flux, $F_{i-1/2}$, must be approximated: |
45 |
\begin{displaymath} |
46 |
F = u \overline{\theta} - \frac{\kappa}{\Delta x_c} \partial_i \theta |
47 |
\end{displaymath} |
48 |
and this is where truncation errors can enter the solution. The |
49 |
method for obtaining $\overline{\theta}$ is unspecified and a wide |
50 |
range of possibilities exist including centered and upwind |
51 |
interpolation, polynomial fits based on the the volume average |
52 |
definitions of quantities and non-linear interpolation such as |
53 |
flux-limiters. |
54 |
|
55 |
Choosing simple centered second-order interpolation and differencing |
56 |
recovers the same ODE's resulting from finite differencing for the |
57 |
interior of a fluid. Differences arise at boundaries where a boundary |
58 |
is not positioned on a regular or smoothly varying grid. This method |
59 |
is used to represent the topography using lopped cell, see |
60 |
\cite{Adcroft98}. Subtle difference also appear in more than one |
61 |
dimension away from boundaries. This happens because the each |
62 |
direction is discretized independently in the finite difference method |
63 |
while the integrating over finite volume implicitly treats all |
64 |
directions simultaneously. Illustration of this is given in |
65 |
\cite{Adcroft02}. |
66 |
|
67 |
\subsection{C grid staggering of variables} |
68 |
|
69 |
\begin{figure} |
70 |
\begin{center} |
71 |
\resizebox{!}{2in}{ \includegraphics{part2/cgrid3d.eps}} |
72 |
\end{center} |
73 |
\caption{Three dimensional staggering of velocity components. This |
74 |
facilitates the natural discretization of the continuity and tracer |
75 |
equations. } |
76 |
\label{fig:cgrid3d} |
77 |
\end{figure} |
78 |
|
79 |
The basic algorithm employed for stepping forward the momentum |
80 |
equations is based on retaining non-divergence of the flow at all |
81 |
times. This is most naturally done if the components of flow are |
82 |
staggered in space in the form of an Arakawa C grid \cite{Arakawa70}. |
83 |
|
84 |
Fig. \ref{fig:cgrid3d} shows the components of flow ($u$,$v$,$w$) |
85 |
staggered in space such that the zonal component falls on the |
86 |
interface between continuity cells in the zonal direction. Similarly |
87 |
for the meridional and vertical directions. The continuity cell is |
88 |
synonymous with tracer cells (they are one and the same). |
89 |
|
90 |
|
91 |
|
92 |
\subsection{Grid initialization and data} |
93 |
|
94 |
Initialization of grid data is controlled by subroutine {\em |
95 |
INI\_GRID} which in calls {\em INI\_VERTICAL\_GRID} to initialize the |
96 |
vertical grid, and then either of {\em INI\_CARTESIAN\_GRID}, {\em |
97 |
INI\_SPHERICAL\_POLAR\_GRID} or {\em INI\_CURV\-ILINEAR\_GRID} to |
98 |
initialize the horizontal grid for cartesian, spherical-polar or |
99 |
curvilinear coordinates respectively. |
100 |
|
101 |
The reciprocals of all grid quantities are pre-calculated and this is |
102 |
done in subroutine {\em INI\_MASKS\_ETC} which is called later by |
103 |
subroutine {\em INITIALIZE\_FIXED}. |
104 |
|
105 |
All grid descriptors are global arrays and stored in common blocks in |
106 |
{\em GRID.h} and a generally declared as {\em \_RS}. |
107 |
|
108 |
\fbox{ \begin{minipage}{4.75in} |
109 |
{\em S/R INI\_GRID} ({\em model/src/ini\_grid.F}) |
110 |
|
111 |
{\em S/R INI\_MASKS\_ETC} ({\em model/src/ini\_masks\_etc.F}) |
112 |
|
113 |
grid data: ({\em model/inc/GRID.h}) |
114 |
\end{minipage} } |
115 |
|
116 |
|
117 |
\subsection{Horizontal grid} |
118 |
\label{sec:spatial_discrete_horizontal_grid} |
119 |
|
120 |
\begin{figure} |
121 |
\begin{center} |
122 |
\begin{tabular}{cc} |
123 |
\raisebox{1.5in}{a)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Ac.eps}} |
124 |
& \raisebox{1.5in}{b)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Az.eps}} |
125 |
\\ |
126 |
\raisebox{1.5in}{c)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Au.eps}} |
127 |
& \raisebox{1.5in}{d)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Av.eps}} |
128 |
\end{tabular} |
129 |
\end{center} |
130 |
\caption{ |
131 |
Staggering of horizontal grid descriptors (lengths and areas). The |
132 |
grid lines indicate the tracer cell boundaries and are the reference |
133 |
grid for all panels. a) The area of a tracer cell, $A_c$, is bordered |
134 |
by the lengths $\Delta x_g$ and $\Delta y_g$. b) The area of a |
135 |
vorticity cell, $A_\zeta$, is bordered by the lengths $\Delta x_c$ and |
136 |
$\Delta y_c$. c) The area of a u cell, $A_c$, is bordered by the |
137 |
lengths $\Delta x_v$ and $\Delta y_f$. d) The area of a v cell, $A_c$, |
138 |
is bordered by the lengths $\Delta x_f$ and $\Delta y_u$.} |
139 |
\label{fig:hgrid} |
140 |
\end{figure} |
141 |
|
142 |
The model domain is decomposed into tiles and within each tile a |
143 |
quasi-regular grid is used. A tile is the basic unit of domain |
144 |
decomposition for parallelization but may be used whether parallelized |
145 |
or not; see section \ref{sect:tiles} for more details. Although the |
146 |
tiles may be patched together in an unstructured manner |
147 |
(i.e. irregular or non-tessilating pattern), the interior of tiles is |
148 |
a structured grid of quadrilateral cells. The horizontal coordinate |
149 |
system is orthogonal curvilinear meaning we can not necessarily treat |
150 |
the two horizontal directions as separable. Instead, each cell in the |
151 |
horizontal grid is described by the length of it's sides and it's |
152 |
area. |
153 |
|
154 |
The grid information is quite general and describes any of the |
155 |
available coordinates systems, cartesian, spherical-polar or |
156 |
curvilinear. All that is necessary to distinguish between the |
157 |
coordinate systems is to initialize the grid data (descriptors) |
158 |
appropriately. |
159 |
|
160 |
In the following, we refer to the orientation of quantities on the |
161 |
computational grid using geographic terminology such as points of the |
162 |
compass. |
163 |
\marginpar{Caution!} |
164 |
This is purely for convenience but should note be confused |
165 |
with the actual geographic orientation of model quantities. |
166 |
|
167 |
Fig.~\ref{fig:hgrid}a shows the tracer cell (synonymous with the |
168 |
continuity cell). The length of the southern edge, $\Delta x_g$, |
169 |
western edge, $\Delta y_g$ and surface area, $A_c$, presented in the |
170 |
vertical are stored in arrays {\bf DXg}, {\bf DYg} and {\bf rAc}. |
171 |
\marginpar{$A_c$: {\bf rAc}} |
172 |
\marginpar{$\Delta x_g$: {\bf DXg}} |
173 |
\marginpar{$\Delta y_g$: {\bf DYg}} |
174 |
The ``g'' suffix indicates that the lengths are along the defining |
175 |
grid boundaries. The ``c'' suffix associates the quantity with the |
176 |
cell centers. The quantities are staggered in space and the indexing |
177 |
is such that {\bf DXg(i,j)} is positioned to the south of {\bf |
178 |
rAc(i,j)} and {\bf DYg(i,j)} positioned to the west. |
179 |
|
180 |
Fig.~\ref{fig:hgrid}b shows the vorticity cell. The length of the |
181 |
southern edge, $\Delta x_c$, western edge, $\Delta y_c$ and surface |
182 |
area, $A_\zeta$, presented in the vertical are stored in arrays {\bf |
183 |
DXg}, {\bf DYg} and {\bf rAz}. |
184 |
\marginpar{$A_\zeta$: {\bf rAz}} |
185 |
\marginpar{$\Delta x_c$: {\bf DXc}} |
186 |
\marginpar{$\Delta y_c$: {\bf DYc}} |
187 |
The ``z'' suffix indicates that the lengths are measured between the |
188 |
cell centers and the ``$\zeta$'' suffix associates points with the |
189 |
vorticity points. The quantities are staggered in space and the |
190 |
indexing is such that {\bf DXc(i,j)} is positioned to the north of |
191 |
{\bf rAc(i,j)} and {\bf DYc(i,j)} positioned to the east. |
192 |
|
193 |
Fig.~\ref{fig:hgrid}c shows the ``u'' or western (w) cell. The length of |
194 |
the southern edge, $\Delta x_v$, eastern edge, $\Delta y_f$ and |
195 |
surface area, $A_w$, presented in the vertical are stored in arrays |
196 |
{\bf DXv}, {\bf DYf} and {\bf rAw}. |
197 |
\marginpar{$A_w$: {\bf rAw}} |
198 |
\marginpar{$\Delta x_v$: {\bf DXv}} |
199 |
\marginpar{$\Delta y_f$: {\bf DYf}} |
200 |
The ``v'' suffix indicates that the length is measured between the |
201 |
v-points, the ``f'' suffix indicates that the length is measured |
202 |
between the (tracer) cell faces and the ``w'' suffix associates points |
203 |
with the u-points (w stands for west). The quantities are staggered in |
204 |
space and the indexing is such that {\bf DXv(i,j)} is positioned to |
205 |
the south of {\bf rAw(i,j)} and {\bf DYf(i,j)} positioned to the east. |
206 |
|
207 |
Fig.~\ref{fig:hgrid}d shows the ``v'' or southern (s) cell. The length of |
208 |
the northern edge, $\Delta x_f$, western edge, $\Delta y_u$ and |
209 |
surface area, $A_s$, presented in the vertical are stored in arrays |
210 |
{\bf DXf}, {\bf DYu} and {\bf rAs}. |
211 |
\marginpar{$A_s$: {\bf rAs}} |
212 |
\marginpar{$\Delta x_f$: {\bf DXf}} |
213 |
\marginpar{$\Delta y_u$: {\bf DYu}} |
214 |
The ``u'' suffix indicates that the length is measured between the |
215 |
u-points, the ``f'' suffix indicates that the length is measured |
216 |
between the (tracer) cell faces and the ``s'' suffix associates points |
217 |
with the v-points (s stands for south). The quantities are staggered |
218 |
in space and the indexing is such that {\bf DXf(i,j)} is positioned to |
219 |
the north of {\bf rAs(i,j)} and {\bf DYu(i,j)} positioned to the west. |
220 |
|
221 |
\fbox{ \begin{minipage}{4.75in} |
222 |
{\em S/R INI\_CARTESIAN\_GRID} ({\em |
223 |
model/src/ini\_cartesian\_grid.F}) |
224 |
|
225 |
{\em S/R INI\_SPHERICAL\_POLAR\_GRID} ({\em |
226 |
model/src/ini\_spherical\_polar\_grid.F}) |
227 |
|
228 |
{\em S/R INI\_CURVILINEAR\_GRID} ({\em |
229 |
model/src/ini\_curvilinear\_grid.F}) |
230 |
|
231 |
$A_c$, $A_\zeta$, $A_w$, $A_s$: {\bf rAc}, {\bf rAz}, {\bf rAw}, {\bf rAs} |
232 |
({\em GRID.h}) |
233 |
|
234 |
$\Delta x_g$, $\Delta y_g$: {\bf DXg}, {\bf DYg} ({\em GRID.h}) |
235 |
|
236 |
$\Delta x_c$, $\Delta y_c$: {\bf DXc}, {\bf DYc} ({\em GRID.h}) |
237 |
|
238 |
$\Delta x_f$, $\Delta y_f$: {\bf DXf}, {\bf DYf} ({\em GRID.h}) |
239 |
|
240 |
$\Delta x_v$, $\Delta y_u$: {\bf DXv}, {\bf DYu} ({\em GRID.h}) |
241 |
|
242 |
\end{minipage} } |
243 |
|
244 |
\subsubsection{Reciprocals of horizontal grid descriptors} |
245 |
|
246 |
%\marginpar{$A_c^{-1}$: {\bf RECIP\_rAc}} |
247 |
%\marginpar{$A_\zeta^{-1}$: {\bf RECIP\_rAz}} |
248 |
%\marginpar{$A_w^{-1}$: {\bf RECIP\_rAw}} |
249 |
%\marginpar{$A_s^{-1}$: {\bf RECIP\_rAs}} |
250 |
Lengths and areas appear in the denominator of expressions as much as |
251 |
in the numerator. For efficiency and portability, we pre-calculate the |
252 |
reciprocal of the horizontal grid quantities so that in-line divisions |
253 |
can be avoided. |
254 |
|
255 |
%\marginpar{$\Delta x_g^{-1}$: {\bf RECIP\_DXg}} |
256 |
%\marginpar{$\Delta y_g^{-1}$: {\bf RECIP\_DYg}} |
257 |
%\marginpar{$\Delta x_c^{-1}$: {\bf RECIP\_DXc}} |
258 |
%\marginpar{$\Delta y_c^{-1}$: {\bf RECIP\_DYc}} |
259 |
%\marginpar{$\Delta x_f^{-1}$: {\bf RECIP\_DXf}} |
260 |
%\marginpar{$\Delta y_f^{-1}$: {\bf RECIP\_DYf}} |
261 |
%\marginpar{$\Delta x_v^{-1}$: {\bf RECIP\_DXv}} |
262 |
%\marginpar{$\Delta y_u^{-1}$: {\bf RECIP\_DYu}} |
263 |
For each grid descriptor (array) there is a reciprocal named using the |
264 |
prefix {\bf RECIP\_}. This doubles the amount of storage in {\em |
265 |
GRID.h} but they are all only 2-D descriptors. |
266 |
|
267 |
\fbox{ \begin{minipage}{4.75in} |
268 |
{\em S/R INI\_MASKS\_ETC} ({\em |
269 |
model/src/ini\_masks\_etc.F}) |
270 |
|
271 |
$A_c^{-1}$: {\bf RECIP\_Ac} ({\em GRID.h}) |
272 |
|
273 |
$A_\zeta^{-1}$: {\bf RECIP\_Az} ({\em GRID.h}) |
274 |
|
275 |
$A_w^{-1}$: {\bf RECIP\_Aw} ({\em GRID.h}) |
276 |
|
277 |
$A_s^{-1}$: {\bf RECIP\_As} ({\em GRID.h}) |
278 |
|
279 |
$\Delta x_g^{-1}$, $\Delta y_g^{-1}$: {\bf RECIP\_DXg}, {\bf RECIP\_DYg} ({\em GRID.h}) |
280 |
|
281 |
$\Delta x_c^{-1}$, $\Delta y_c^{-1}$: {\bf RECIP\_DXc}, {\bf RECIP\_DYc} ({\em GRID.h}) |
282 |
|
283 |
$\Delta x_f^{-1}$, $\Delta y_f^{-1}$: {\bf RECIP\_DXf}, {\bf RECIP\_DYf} ({\em GRID.h}) |
284 |
|
285 |
$\Delta x_v^{-1}$, $\Delta y_u^{-1}$: {\bf RECIP\_DXv}, {\bf RECIP\_DYu} ({\em GRID.h}) |
286 |
|
287 |
\end{minipage} } |
288 |
|
289 |
\subsubsection{Cartesian coordinates} |
290 |
|
291 |
Cartesian coordinates are selected when the logical flag {\bf |
292 |
using\-Cartes\-ianGrid} in namelist {\em PARM04} is set to true. The grid |
293 |
spacing can be set to uniform via scalars {\bf dXspacing} and {\bf |
294 |
dYspacing} in namelist {\em PARM04} or to variable resolution by the |
295 |
vectors {\bf DELX} and {\bf DELY}. Units are normally |
296 |
meters. Non-dimensional coordinates can be used by interpreting the |
297 |
gravitational constant as the Rayleigh number. |
298 |
|
299 |
\subsubsection{Spherical-polar coordinates} |
300 |
|
301 |
Spherical coordinates are selected when the logical flag {\bf |
302 |
using\-Spherical\-PolarGrid} in namelist {\em PARM04} is set to true. The |
303 |
grid spacing can be set to uniform via scalars {\bf dXspacing} and |
304 |
{\bf dYspacing} in namelist {\em PARM04} or to variable resolution by |
305 |
the vectors {\bf DELX} and {\bf DELY}. Units of these namelist |
306 |
variables are alway degrees. The horizontal grid descriptors are |
307 |
calculated from these namelist variables have units of meters. |
308 |
|
309 |
\subsubsection{Curvilinear coordinates} |
310 |
|
311 |
Curvilinear coordinates are selected when the logical flag {\bf |
312 |
using\-Curvil\-inear\-Grid} in namelist {\em PARM04} is set to true. The |
313 |
grid spacing can not be set via the namelist. Instead, the grid |
314 |
descriptors are read from data files, one for each descriptor. As for |
315 |
other grids, the horizontal grid descriptors have units of meters. |
316 |
|
317 |
|
318 |
\subsection{Vertical grid} |
319 |
|
320 |
\begin{figure} |
321 |
\begin{center} |
322 |
\begin{tabular}{cc} |
323 |
\raisebox{4in}{a)} \resizebox{!}{4in}{ |
324 |
\includegraphics{part2/vgrid-cellcentered.eps}} & \raisebox{4in}{b)} |
325 |
\resizebox{!}{4in}{ \includegraphics{part2/vgrid-accurate.eps}} |
326 |
\end{tabular} |
327 |
\end{center} |
328 |
\caption{Two versions of the vertical grid. a) The cell centered |
329 |
approach where the interface depths are specified and the tracer |
330 |
points centered in between the interfaces. b) The interface centered |
331 |
approach where tracer levels are specified and the w-interfaces are |
332 |
centered in between.} |
333 |
\label{fig:vgrid} |
334 |
\end{figure} |
335 |
|
336 |
As for the horizontal grid, we use the suffixes ``c'' and ``f'' to |
337 |
indicates faces and centers. Fig.~\ref{fig:vgrid}a shows the default |
338 |
vertical grid used by the model. |
339 |
\marginpar{$\Delta r_f$: {\bf DRf}} |
340 |
\marginpar{$\Delta r_c$: {\bf DRc}} |
341 |
$\Delta r_f$ is the difference in $r$ |
342 |
(vertical coordinate) between the faces (i.e. $\Delta r_f \equiv - |
343 |
\delta_k r$ where the minus sign appears due to the convention that the |
344 |
surface layer has index $k=1$.). |
345 |
|
346 |
The vertical grid is calculated in subroutine {\em |
347 |
INI\_VERTICAL\_GRID} and specified via the vector {\bf DELR} in |
348 |
namelist {\em PARM04}. The units of ``r'' are either meters or Pascals |
349 |
depending on the isomorphism being used which in turn is dependent |
350 |
only on the choice of equation of state. |
351 |
|
352 |
There are alternative namelist vectors {\bf DELZ} and {\bf DELP} which |
353 |
dictate whether z- or |
354 |
\marginpar{Caution!} |
355 |
p- coordinates are to be used but we intend to |
356 |
phase this out since they are redundant. |
357 |
|
358 |
The reciprocals $\Delta r_f^{-1}$ and $\Delta r_c^{-1}$ are |
359 |
pre-calculated (also in subroutine {\em INI\_VERTICAL\_GRID}). All |
360 |
vertical grid descriptors are stored in common blocks in {\em GRID.h}. |
361 |
|
362 |
The above grid (Fig.~\ref{fig:vgrid}a) is known as the cell centered |
363 |
approach because the tracer points are at cell centers; the cell |
364 |
centers are mid-way between the cell interfaces. An alternative, the |
365 |
vertex or interface centered approach, is shown in |
366 |
Fig.~\ref{fig:vgrid}b. Here, the interior interfaces are positioned |
367 |
mid-way between the tracer nodes (no longer cell centers). This |
368 |
approach is formally more accurate for evaluation of hydrostatic |
369 |
pressure and vertical advection but historically the cell centered |
370 |
approach has been used. An alternative form of subroutine {\em |
371 |
INI\_VERTICAL\_GRID} is used to select the interface centered approach |
372 |
but no run time option is currently available. |
373 |
|
374 |
\fbox{ \begin{minipage}{4.75in} |
375 |
{\em S/R INI\_VERTICAL\_GRID} ({\em |
376 |
model/src/ini\_vertical\_grid.F}) |
377 |
|
378 |
$\Delta r_f$: {\bf DRf} ({\em GRID.h}) |
379 |
|
380 |
$\Delta r_c$: {\bf DRc} ({\em GRID.h}) |
381 |
|
382 |
$\Delta r_f^{-1}$: {\bf RECIP\_DRf} ({\em GRID.h}) |
383 |
|
384 |
$\Delta r_c^{-1}$: {\bf RECIP\_DRc} ({\em GRID.h}) |
385 |
|
386 |
\end{minipage} } |
387 |
|
388 |
|
389 |
\subsection{Topography: partially filled cells} |
390 |
|
391 |
\begin{figure} |
392 |
\begin{center} |
393 |
\resizebox{4.5in}{!}{\includegraphics{part2/vgrid-xz.eps}} |
394 |
\end{center} |
395 |
\caption{ |
396 |
A schematic of the x-r plane showing the location of the |
397 |
non-dimensional fractions $h_c$ and $h_w$. The physical thickness of a |
398 |
tracer cell is given by $h_c(i,j,k) \Delta r_f(k)$ and the physical |
399 |
thickness of the open side is given by $h_w(i,j,k) \Delta r_f(k)$.} |
400 |
\label{fig:hfacs} |
401 |
\end{figure} |
402 |
|
403 |
\cite{Adcroft97} presented two alternatives to the step-wise finite |
404 |
difference representation of topography. The method is known to the |
405 |
engineering community as {\em intersecting boundary method}. It |
406 |
involves allowing the boundary to intersect a grid of cells thereby |
407 |
modifying the shape of those cells intersected. We suggested allowing |
408 |
the topography to take on a piece-wise linear representation (shaved |
409 |
cells) or a simpler piecewise constant representation (partial step). |
410 |
Both show dramatic improvements in solution compared to the |
411 |
traditional full step representation, the piece-wise linear being the |
412 |
best. However, the storage requirements are excessive so the simpler |
413 |
piece-wise constant or partial-step method is all that is currently |
414 |
supported. |
415 |
|
416 |
Fig.~\ref{fig:hfacs} shows a schematic of the x-r plane indicating how |
417 |
the thickness of a level is determined at tracer and u points. |
418 |
\marginpar{$h_c$: {\bf hFacC}} |
419 |
\marginpar{$h_w$: {\bf hFacW}} |
420 |
\marginpar{$h_s$: {\bf hFacS}} |
421 |
The physical thickness of a tracer cell is given by $h_c(i,j,k) \Delta |
422 |
r_f(k)$ and the physical thickness of the open side is given by |
423 |
$h_w(i,j,k) \Delta r_f(k)$. Three 3-D descriptors $h_c$, $h_w$ and |
424 |
$h_s$ are used to describe the geometry: {\bf hFacC}, {\bf hFacW} and |
425 |
{\bf hFacS} respectively. These are calculated in subroutine {\em |
426 |
INI\_MASKS\_ETC} along with there reciprocals {\bf RECIP\_hFacC}, {\bf |
427 |
RECIP\_hFacW} and {\bf RECIP\_hFacS}. |
428 |
|
429 |
The non-dimensional fractions (or h-facs as we call them) are |
430 |
calculated from the model depth array and then processed to avoid tiny |
431 |
volumes. The rule is that if a fraction is less than {\bf hFacMin} |
432 |
then it is rounded to the nearer of $0$ or {\bf hFacMin} or if the |
433 |
physical thickness is less than {\bf hFacMinDr} then it is similarly |
434 |
rounded. The larger of the two methods is used when there is a |
435 |
conflict. By setting {\bf hFacMinDr} equal to or larger than the |
436 |
thinnest nominal layers, $\min{(\Delta z_f)}$, but setting {\bf |
437 |
hFacMin} to some small fraction then the model will only lop thick |
438 |
layers but retain stability based on the thinnest unlopped thickness; |
439 |
$\min{(\Delta z_f,\mbox{\bf hFacMinDr})}$. |
440 |
|
441 |
\fbox{ \begin{minipage}{4.75in} |
442 |
{\em S/R INI\_MASKS\_ETC} ({\em model/src/ini\_masks\_etc.F}) |
443 |
|
444 |
$h_c$: {\bf hFacC} ({\em GRID.h}) |
445 |
|
446 |
$h_w$: {\bf hFacW} ({\em GRID.h}) |
447 |
|
448 |
$h_s$: {\bf hFacS} ({\em GRID.h}) |
449 |
|
450 |
$h_c^{-1}$: {\bf RECIP\_hFacC} ({\em GRID.h}) |
451 |
|
452 |
$h_w^{-1}$: {\bf RECIP\_hFacW} ({\em GRID.h}) |
453 |
|
454 |
$h_s^{-1}$: {\bf RECIP\_hFacS} ({\em GRID.h}) |
455 |
|
456 |
\end{minipage} } |
457 |
|
458 |
|
459 |
\section{Continuity and horizontal pressure gradient terms} |
460 |
|
461 |
The core algorithm is based on the ``C grid'' discretization of the |
462 |
continuity equation which can be summarized as: |
463 |
\begin{eqnarray} |
464 |
\partial_t u + \frac{1}{\Delta x_c} \delta_i \left. \frac{ \partial \Phi}{\partial r}\right|_{s} \eta + \frac{\epsilon_{nh}}{\Delta x_c} \delta_i \Phi_{nh}' & = & G_u - \frac{1}{\Delta x_c} \delta_i \Phi_h' \label{eq:discrete-momu} \\ |
465 |
\partial_t v + \frac{1}{\Delta y_c} \delta_j \left. \frac{ \partial \Phi}{\partial r}\right|_{s} \eta + \frac{\epsilon_{nh}}{\Delta y_c} \delta_j \Phi_{nh}' & = & G_v - \frac{1}{\Delta y_c} \delta_j \Phi_h' \label{eq:discrete-momv} \\ |
466 |
\epsilon_{nh} \left( \partial_t w + \frac{1}{\Delta r_c} \delta_k \Phi_{nh}' \right) & = & \epsilon_{nh} G_w + \overline{b}^k - \frac{1}{\Delta r_c} \delta_k \Phi_{h}' \label{eq:discrete-momw} \\ |
467 |
\delta_i \Delta y_g \Delta r_f h_w u + |
468 |
\delta_j \Delta x_g \Delta r_f h_s v + |
469 |
\delta_k {\cal A}_c w & = & {\cal A}_c \delta_k (P-E)_{r=0} |
470 |
\label{eq:discrete-continuity} |
471 |
\end{eqnarray} |
472 |
where the continuity equation has been most naturally discretized by |
473 |
staggering the three components of velocity as shown in |
474 |
Fig.~\ref{fig-cgrid3d}. The grid lengths $\Delta x_c$ and $\Delta y_c$ |
475 |
are the lengths between tracer points (cell centers). The grid lengths |
476 |
$\Delta x_g$, $\Delta y_g$ are the grid lengths between cell |
477 |
corners. $\Delta r_f$ and $\Delta r_c$ are the distance (in units of |
478 |
$r$) between level interfaces (w-level) and level centers (tracer |
479 |
level). The surface area presented in the vertical is denoted ${\cal |
480 |
A}_c$. The factors $h_w$ and $h_s$ are non-dimensional fractions |
481 |
(between 0 and 1) that represent the fraction cell depth that is |
482 |
``open'' for fluid flow. |
483 |
\marginpar{$h_w$: {\bf hFacW}} |
484 |
\marginpar{$h_s$: {\bf hFacS}} |
485 |
|
486 |
The last equation, the discrete continuity equation, can be summed in |
487 |
the vertical to yield the free-surface equation: |
488 |
\begin{equation} |
489 |
{\cal A}_c \partial_t \eta + \delta_i \sum_k \Delta y_g \Delta r_f h_w |
490 |
u + \delta_j \sum_k \Delta x_g \Delta r_f h_s v = {\cal |
491 |
A}_c(P-E)_{r=0} \label{eq:discrete-freesurface} |
492 |
\end{equation} |
493 |
The source term $P-E$ on the rhs of continuity accounts for the local |
494 |
addition of volume due to excess precipitation and run-off over |
495 |
evaporation and only enters the top-level of the {\em ocean} model. |
496 |
|
497 |
\section{Hydrostatic balance} |
498 |
|
499 |
The vertical momentum equation has the hydrostatic or |
500 |
quasi-hydrostatic balance on the right hand side. This discretization |
501 |
guarantees that the conversion of potential to kinetic energy as |
502 |
derived from the buoyancy equation exactly matches the form derived |
503 |
from the pressure gradient terms when forming the kinetic energy |
504 |
equation. |
505 |
|
506 |
In the ocean, using z-coordinates, the hydrostatic balance terms are |
507 |
discretized: |
508 |
\begin{equation} |
509 |
\epsilon_{nh} \partial_t w |
510 |
+ g \overline{\rho'}^k + \frac{1}{\Delta z} \delta_k \Phi_h' = \ldots |
511 |
\label{eq:discrete_hydro_ocean} |
512 |
\end{equation} |
513 |
|
514 |
In the atmosphere, using p-coordinates, hydrostatic balance is |
515 |
discretized: |
516 |
\begin{equation} |
517 |
\overline{\theta'}^k + \frac{1}{\Delta \Pi} \delta_k \Phi_h' = 0 |
518 |
\label{eq:discrete_hydro_atmos} |
519 |
\end{equation} |
520 |
where $\Delta \Pi$ is the difference in Exner function between the |
521 |
pressure points. The non-hydrostatic equations are not available in |
522 |
the atmosphere. |
523 |
|
524 |
The difference in approach between ocean and atmosphere occurs because |
525 |
of the direct use of the ideal gas equation in forming the potential |
526 |
energy conversion term $\alpha \omega$. The form of these conversion |
527 |
terms is discussed at length in \cite{Adcroft01}. |
528 |
|
529 |
Because of the different representation of hydrostatic balance between |
530 |
ocean and atmosphere there is no elegant way to represent both systems |
531 |
using an arbitrary coordinate. |
532 |
|
533 |
The integration for hydrostatic pressure is made in the positive $r$ |
534 |
direction (increasing k-index). For the ocean, this is from the |
535 |
free-surface down and for the atmosphere this is from the ground up. |
536 |
|
537 |
The calculations are made in the subroutine {\em |
538 |
CALC\_PHI\_HYD}. Inside this routine, one of other of the |
539 |
atmospheric/oceanic form is selected based on the string variable {\bf |
540 |
buoyancyRelation}. |
541 |
|