/[MITgcm]/manual/s_algorithm/text/spatial-discrete.tex
ViewVC logotype

Annotation of /manual/s_algorithm/text/spatial-discrete.tex

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


Revision 1.3 - (hide annotations) (download) (as text)
Thu Aug 9 16:26:43 2001 UTC (23 years, 10 months ago) by adcroft
Branch: MAIN
Changes since 1.2: +149 -51 lines
File MIME type: application/x-tex
Added more on vertical grid.

1 adcroft 1.3 % $Header: /u/gcmpack/mitgcmdoc/part2/spatial-discrete.tex,v 1.2 2001/08/08 22:19:02 adcroft Exp $
2 adcroft 1.2 % $Name: $
3 adcroft 1.1
4     \section{Spatial discretization of the dynamical equations}
5    
6 adcroft 1.2 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 veritical directions as seperable and thus slightly
12     differently.
13    
14     Initialization of grid data is controlled by subroutine {\em
15     INI\_GRID} which in calls {\em INI\_VERTICAL\_GRID} to initialize the
16     vertical grid, and then either of {\em INI\_CARTESIAN\_GRID}, {\em
17     INI\_SPHERICAL\_POLAR\_GRID} or {\em INI\_CURV\-ILINEAR\_GRID} to
18     initialize the horizontal grid for cartesian, spherical-polar or
19     curvilinear coordinates respectively.
20    
21     The reciprocals of all grid quantities are pre-calculated and this is
22     done in subroutine {\em INI\_MASKS\_ETC} which is called later by
23     subroutine {\em INITIALIZE\_FIXED}.
24    
25     All grid descriptors are global arrays and stored in common blocks in
26     {\em GRID.h} and a generally declared as {\em \_RS}.
27    
28     \fbox{ \begin{minipage}{4.75in}
29     {\em S/R INI\_GRID} ({\em model/src/ini\_grid.F})
30    
31     {\em S/R INI\_MASKS\_ETC} ({\em model/src/ini\_masks\_etc.F})
32    
33     grid data: ({\em model/inc/GRID.h})
34     \end{minipage} }
35    
36    
37     \subsection{The finite volume method: finite volumes versus finite difference}
38    
39     The finite volume method is used to discretize the equations in
40     space. The expression ``finite volume'' actually has two meanings; one
41 adcroft 1.3 is the method of cut or instecting boundaries (shaved or lopped cells
42     in our terminology) and the other is non-linear interpolation methods
43     that can deal with non-smooth solutions such as shocks (i.e. flux
44     limiters for advection). Both make use of the integral form of the
45     conservation laws to which the {\it weak solution} is a solution on
46     each finite volume of (sub-domain). The weak solution can be
47     constructed outof piece-wise constant elements or be
48     differentiable. The differentiable equations can not be satisfied by
49     piece-wise constant functions.
50    
51     As an example, the 1-D constant coefficient advection-diffusion
52     equation:
53 adcroft 1.2 \begin{displaymath}
54     \partial_t \theta + \partial_x ( u \theta - \kappa \partial_x \theta ) = 0
55     \end{displaymath}
56 adcroft 1.3 can be discretized by integrating over finite sub-domains, i.e.
57     the lengths $\Delta x_i$:
58 adcroft 1.2 \begin{displaymath}
59     \Delta x \partial_t \theta + \delta_i ( F ) = 0
60     \end{displaymath}
61 adcroft 1.3 is exact if $\theta(x)$ is peice-wise constant over the interval
62     $\Delta x_i$ or more generally if $\theta_i$ is defined as the average
63     over the interval $\Delta x_i$.
64    
65     The flux, $F_{i-1/2}$, must be approximated:
66 adcroft 1.2 \begin{displaymath}
67     F = u \overline{\theta} - \frac{\kappa}{\Delta x_c} \partial_i \theta
68     \end{displaymath}
69 adcroft 1.3 and this is where truncation errors can enter the solution. The
70     method for obtaining $\overline{\theta}$ is unspecified and a wide
71     range of possibilities exist including centered and upwind
72     interpolation, polynomial fits based on the the volume average
73     definitions of quantities and non-linear interpolation such as
74     flux-limiters.
75    
76     Choosing simple centered second-order interpolation and differencing
77     recovers the same ODE's resulting from finite differencing for the
78     interior of a fluid. Differences arise at boundaries where a boundary
79     is not positioned on a regular or smoothly varying grid. This method
80     is used to represent the topography using lopped cell, see
81     \cite{Adcroft98}. Subtle difference also appear in more than one
82     dimension away from boundaries. This happens because the each
83     direction is discretized independantly in the finite difference method
84     while the integrating over finite volume implicitly treats all
85     directions simultaneously. Illustration of this is given in
86     \cite{Adcroft02}.
87 adcroft 1.2
88 adcroft 1.1 \subsection{C grid staggering of variables}
89    
90     \begin{figure}
91     \centerline{ \resizebox{!}{2in}{ \includegraphics{part2/cgrid3d.eps}} }
92     \caption{Three dimensional staggering of velocity components. This
93     facilitates the natural discretization of the continuity and tracer
94     equations. }
95 adcroft 1.2 \label{fig:cgrid3d}
96 adcroft 1.1 \end{figure}
97    
98 adcroft 1.2 The basic algorithm employed for stepping forward the momentum
99     equations is based on retaining non-divergence of the flow at all
100     times. This is most naturally done if the components of flow are
101     staggered in space in the form of an Arakawa C grid \cite{Arakawa70}.
102    
103     Fig. \ref{fig:cgrid3d} shows the components of flow ($u$,$v$,$w$)
104     staggered in space such that the zonal component falls on the
105     interface between continiuty cells in the zonal direction. Similarly
106     for the meridional and vertical directions. The continiuty cell is
107     synonymous with tracer cells (they are one and the same).
108    
109    
110    
111    
112 adcroft 1.1 \subsection{Horizontal grid}
113    
114     \begin{figure}
115     \centerline{ \begin{tabular}{cc}
116 adcroft 1.2 \raisebox{1.5in}{a)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Ac.eps}}
117     & \raisebox{1.5in}{b)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Az.eps}}
118 adcroft 1.1 \\
119 adcroft 1.2 \raisebox{1.5in}{c)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Au.eps}}
120     & \raisebox{1.5in}{d)}\resizebox{!}{2in}{ \includegraphics{part2/hgrid-Av.eps}}
121 adcroft 1.1 \end{tabular} }
122 adcroft 1.2 \caption{
123     Staggering of horizontal grid descriptors (lengths and areas). The
124     grid lines indicate the tracer cell boundaries and are the reference
125     grid for all panels. a) The area of a tracer cell, $A_c$, is bordered
126     by the lengths $\Delta x_g$ and $\Delta y_g$. b) The area of a
127     vorticity cell, $A_\zeta$, is bordered by the lengths $\Delta x_c$ and
128     $\Delta y_c$. c) The area of a u cell, $A_c$, is bordered by the
129     lengths $\Delta x_v$ and $\Delta y_f$. d) The area of a v cell, $A_c$,
130     is bordered by the lengths $\Delta x_f$ and $\Delta y_u$.}
131     \label{fig:hgrid}
132 adcroft 1.1 \end{figure}
133    
134 adcroft 1.2 The model domain is decomposed into tiles and within each tile a
135     quasi-regular grid is used. A tile is the basic unit of domain
136     decomposition for parallelization but may be used whether parallized
137     or not; see section \ref{sect:tiles} for more details. Although the
138     tiles may be patched together in an unstructured manner
139     (i.e. irregular or non-tessilating pattern), the interior of tiles is
140     a structered grid of quadrilateral cells. The horizontal coordinate
141     system is orthogonal curvilinear meaning we can not necessarily treat
142     the two horizontal directions as seperable. Instead, each cell in the
143     horizontal grid is described by the length of it's sides and it's
144     area.
145    
146     The grid information is quite general and describes any of the
147     available coordinates systems, cartesian, spherical-polar or
148     curvilinear. All that is necessary to distinguish between the
149     coordinate systems is to initialize the grid data (discriptors)
150     appropriately.
151    
152     In the following, we refer to the orientation of quantities on the
153     computational grid using geographic terminology such as points of the
154 adcroft 1.3 compass.
155     \marginpar{Caution!}
156     This is purely for convenience but should note be confused
157 adcroft 1.2 with the actual geographic orientation of model quantities.
158    
159 adcroft 1.3 Fig.~\ref{fig:hgrid}a shows the tracer cell (synonymous with the
160     continuity cell). The length of the southern edge, $\Delta x_g$,
161     western edge, $\Delta y_g$ and surface area, $A_c$, presented in the
162     vertical are stored in arrays {\bf DXg}, {\bf DYg} and {\bf rAc}.
163 adcroft 1.2 \marginpar{$A_c$: {\bf rAc}}
164     \marginpar{$\Delta x_g$: {\bf DXg}}
165     \marginpar{$\Delta y_g$: {\bf DYg}}
166 adcroft 1.3 The ``g'' suffix indicates that the lengths are along the defining
167     grid boundaries. The ``c'' suffix associates the quantity with the
168     cell centers. The quantities are staggered in space and the indexing
169     is such that {\bf DXg(i,j)} is positioned to the south of {\bf
170     rAc(i,j)} and {\bf DYg(i,j)} positioned to the west.
171 adcroft 1.2
172 adcroft 1.3 Fig.~\ref{fig:hgrid}b shows the vorticity cell. The length of the
173     southern edge, $\Delta x_c$, western edge, $\Delta y_c$ and surface
174     area, $A_\zeta$, presented in the vertical are stored in arrays {\bf
175     DXg}, {\bf DYg} and {\bf rAz}.
176 adcroft 1.2 \marginpar{$A_\zeta$: {\bf rAz}}
177     \marginpar{$\Delta x_c$: {\bf DXc}}
178     \marginpar{$\Delta y_c$: {\bf DYc}}
179 adcroft 1.3 The ``z'' suffix indicates that the lengths are measured between the
180     cell centers and the ``$\zeta$'' suffix associates points with the
181     vorticity points. The quantities are staggered in space and the
182     indexing is such that {\bf DXc(i,j)} is positioned to the north of
183     {\bf rAc(i,j)} and {\bf DYc(i,j)} positioned to the east.
184 adcroft 1.2
185 adcroft 1.3 Fig.~\ref{fig:hgrid}c shows the ``u'' or western (w) cell. The length of
186     the southern edge, $\Delta x_v$, eastern edge, $\Delta y_f$ and
187     surface area, $A_w$, presented in the vertical are stored in arrays
188     {\bf DXv}, {\bf DYf} and {\bf rAw}.
189 adcroft 1.2 \marginpar{$A_w$: {\bf rAw}}
190     \marginpar{$\Delta x_v$: {\bf DXv}}
191     \marginpar{$\Delta y_f$: {\bf DYf}}
192 adcroft 1.3 The ``v'' suffix indicates that the length is measured between the
193     v-points, the ``f'' suffix indicates that the length is measured
194     between the (tracer) cell faces and the ``w'' suffix associates points
195     with the u-points (w stands for west). The quantities are staggered in
196     space and the indexing is such that {\bf DXv(i,j)} is positioned to
197     the south of {\bf rAw(i,j)} and {\bf DYf(i,j)} positioned to the east.
198 adcroft 1.2
199 adcroft 1.3 Fig.~\ref{fig:hgrid}d shows the ``v'' or southern (s) cell. The length of
200     the northern edge, $\Delta x_f$, western edge, $\Delta y_u$ and
201     surface area, $A_s$, presented in the vertical are stored in arrays
202     {\bf DXf}, {\bf DYu} and {\bf rAs}.
203 adcroft 1.2 \marginpar{$A_s$: {\bf rAs}}
204     \marginpar{$\Delta x_f$: {\bf DXf}}
205     \marginpar{$\Delta y_u$: {\bf DYu}}
206 adcroft 1.3 The ``u'' suffix indicates that the length is measured between the
207     u-points, the ``f'' suffix indicates that the length is measured
208     between the (tracer) cell faces and the ``s'' suffix associates points
209     with the v-points (s stands for south). The quantities are staggered
210     in space and the indexing is such that {\bf DXf(i,j)} is positioned to
211     the north of {\bf rAs(i,j)} and {\bf DYu(i,j)} positioned to the west.
212 adcroft 1.2
213     \fbox{ \begin{minipage}{4.75in}
214     {\em S/R INI\_CARTESIAN\_GRID} ({\em
215     model/src/ini\_cartesian\_grid.F})
216    
217     {\em S/R INI\_SPHERICAL\_POLAR\_GRID} ({\em
218     model/src/ini\_spherical\_polar\_grid.F})
219    
220     {\em S/R INI\_CURVILINEAR\_GRID} ({\em
221     model/src/ini\_curvilinear\_grid.F})
222    
223     $A_c$, $A_\zeta$, $A_w$, $A_s$: {\bf rAc}, {\bf rAz}, {\bf rAw}, {\bf rAs}
224     ({\em GRID.h})
225    
226     $\Delta x_g$, $\Delta y_g$: {\bf DXg}, {\bf DYg} ({\em GRID.h})
227    
228     $\Delta x_c$, $\Delta y_c$: {\bf DXc}, {\bf DYc} ({\em GRID.h})
229    
230     $\Delta x_f$, $\Delta y_f$: {\bf DXf}, {\bf DYf} ({\em GRID.h})
231    
232     $\Delta x_v$, $\Delta y_u$: {\bf DXv}, {\bf DYu} ({\em GRID.h})
233    
234     \end{minipage} }
235    
236     \subsubsection{Reciprocals of horizontal grid descriptors}
237    
238     %\marginpar{$A_c^{-1}$: {\bf RECIP\_rAc}}
239     %\marginpar{$A_\zeta^{-1}$: {\bf RECIP\_rAz}}
240     %\marginpar{$A_w^{-1}$: {\bf RECIP\_rAw}}
241     %\marginpar{$A_s^{-1}$: {\bf RECIP\_rAs}}
242     Lengths and areas appear in the denominator of expressions as much as
243     in the numerator. For efficiency and portability, we pre-calculate the
244     reciprocal of the horizontal grid quantities so that in-line divisions
245     can be avoided.
246    
247     %\marginpar{$\Delta x_g^{-1}$: {\bf RECIP\_DXg}}
248     %\marginpar{$\Delta y_g^{-1}$: {\bf RECIP\_DYg}}
249     %\marginpar{$\Delta x_c^{-1}$: {\bf RECIP\_DXc}}
250     %\marginpar{$\Delta y_c^{-1}$: {\bf RECIP\_DYc}}
251     %\marginpar{$\Delta x_f^{-1}$: {\bf RECIP\_DXf}}
252     %\marginpar{$\Delta y_f^{-1}$: {\bf RECIP\_DYf}}
253     %\marginpar{$\Delta x_v^{-1}$: {\bf RECIP\_DXv}}
254     %\marginpar{$\Delta y_u^{-1}$: {\bf RECIP\_DYu}}
255     For each grid descriptor (array) there is a reciprocal named using the
256     prefix {\bf RECIP\_}. This doubles the amount of storage in {\em
257     GRID.h} but they are all only 2-D descriptors.
258    
259     \fbox{ \begin{minipage}{4.75in}
260     {\em S/R INI\_MASKS\_ETC} ({\em
261     model/src/ini\_masks\_etc.F})
262    
263     $A_c^{-1}$: {\bf RECIP\_Ac} ({\em GRID.h})
264    
265     $A_\zeta^{-1}$: {\bf RECIP\_Az} ({\em GRID.h})
266    
267     $A_w^{-1}$: {\bf RECIP\_Aw} ({\em GRID.h})
268    
269     $A_s^{-1}$: {\bf RECIP\_As} ({\em GRID.h})
270    
271     $\Delta x_g^{-1}$, $\Delta y_g^{-1}$: {\bf RECIP\_DXg}, {\bf RECIP\_DYg} ({\em GRID.h})
272    
273     $\Delta x_c^{-1}$, $\Delta y_c^{-1}$: {\bf RECIP\_DXc}, {\bf RECIP\_DYc} ({\em GRID.h})
274    
275     $\Delta x_f^{-1}$, $\Delta y_f^{-1}$: {\bf RECIP\_DXf}, {\bf RECIP\_DYf} ({\em GRID.h})
276    
277     $\Delta x_v^{-1}$, $\Delta y_u^{-1}$: {\bf RECIP\_DXv}, {\bf RECIP\_DYu} ({\em GRID.h})
278    
279     \end{minipage} }
280    
281     \subsubsection{Cartesian coordinates}
282    
283     Cartesian coordinates are selected when the logical flag {\bf
284     using\-Cartes\-ianGrid} in namelist {\em PARM04} is set to true. The grid
285     spacing can be set to uniform via scalars {\bf dXspacing} and {\bf
286     dYspacing} in namelist {\em PARM04} or to variable resolution by the
287     vectors {\bf DELX} and {\bf DELY}. Units are normally
288     meters. Non-dimensional coordinates can be used by interpretting the
289     gravitational constant as the Rayleigh number.
290    
291     \subsubsection{Spherical-polar coordinates}
292    
293     Spherical coordinates are selected when the logical flag {\bf
294     using\-Spherical\-PolarGrid} in namelist {\em PARM04} is set to true. The
295     grid spacing can be set to uniform via scalars {\bf dXspacing} and
296     {\bf dYspacing} in namelist {\em PARM04} or to variable resolution by
297     the vectors {\bf DELX} and {\bf DELY}. Units of these namelist
298     variables are alway degrees. The horizontal grid descriptors are
299     calculated from these namelist variables have units of meters.
300    
301     \subsubsection{Curvilinear coordinates}
302    
303     Curvilinear coordinates are selected when the logical flag {\bf
304     using\-Curvil\-inear\-Grid} in namelist {\em PARM04} is set to true. The
305     grid spacing can not be set via the namelist. Instead, the grid
306     descriptors are read from data files, one for each descriptor. As for
307     other grids, the horizontal grid descriptors have units of meters.
308    
309    
310 adcroft 1.1 \subsection{Vertical grid}
311    
312     \begin{figure}
313     \centerline{ \begin{tabular}{cc}
314 adcroft 1.2 \raisebox{4in}{a)} \resizebox{!}{4in}{
315     \includegraphics{part2/vgrid-cellcentered.eps}} & \raisebox{4in}{b)}
316     \resizebox{!}{4in}{ \includegraphics{part2/vgrid-accurate.eps}}
317 adcroft 1.1 \end{tabular} }
318     \caption{Two versions of the vertical grid. a) The cell centered
319     approach where the interface depths are specified and the tracer
320     points centered in between the interfaces. b) The interface centered
321     approach where tracer levels are specified and the w-interfaces are
322     centered in between.}
323 adcroft 1.2 \label{fig:vgrid}
324 adcroft 1.1 \end{figure}
325    
326 adcroft 1.2 As for the horizontal grid, we use the suffixes ``c'' and ``f'' to
327     indicates faces and centers. Fig.~\ref{fig:vgrid}a shows the default
328     vertical grid used by the model.
329     \marginpar{$\Delta r_f$: {\bf DRf}}
330     \marginpar{$\Delta r_c$: {\bf DRc}}
331     $\Delta r_f$ is the difference in $r$
332     (vertical coordinate) between the faces (i.e. $\Delta r_f \equiv -
333     \delta_k r$ where the minus sign appears due to the convention that the
334     surface layer has index $k=1$.).
335    
336     The vertical grid is calculated in subroutine {\em
337     INI\_VERTICAL\_GRID} and specified via the vector {\bf DELR} in
338     namelist {\em PARM04}. The units of ``r'' are either meters or Pascals
339     depending on the isomorphism being used which in turn is dependent
340     only on the choise of equation of state.
341    
342     There are alternative namelist vectors {\bf DELZ} and {\bf DELP} which
343     dictate whether z- or
344     \marginpar{Caution!}
345     p- coordinates are to be used but we intend to
346     phase this out since they are redundant.
347    
348     The reciprocals $\Delta r_f^{-1}$ and $\Delta r_c^{-1}$ are
349     pre-calculated (also in subroutine {\em INI\_VERTICAL\_GRID}). All
350     vertical grid descriptors are stored in common blocks in {\em GRID.h}.
351    
352     The above grid (Fig.~\ref{fig:vgrid}a) is known as the cell centered
353     approach because the tracer points are at cell centers; the cell
354     centers are mid-way between the cell interfaces. An alternative, the
355     vertex or interface centered approach, is shown in
356     Fig.~\ref{fig:vgrid}b. Here, the interior interfaces are positioned
357     mid-way between the tracer nodes (no longer cell centers). This
358     approach is formally more accurate for evaluation of hydrostatic
359     pressure and vertical advection but historically the cell centered
360     approach has been used. An alternative form of subroutine {\em
361     INI\_VERTICAL\_GRID} is used to select the interface centered approach
362     but no run time option is currently available.
363    
364     \fbox{ \begin{minipage}{4.75in}
365     {\em S/R INI\_VERTICAL\_GRID} ({\em
366     model/src/ini\_vertical\_grid.F})
367    
368     $\Delta r_f$: {\bf DRf} ({\em GRID.h})
369    
370     $\Delta r_c$: {\bf DRc} ({\em GRID.h})
371    
372     $\Delta r_f^{-1}$: {\bf RECIP\_DRf} ({\em GRID.h})
373    
374     $\Delta r_c^{-1}$: {\bf RECIP\_DRc} ({\em GRID.h})
375 adcroft 1.3
376     \end{minipage} }
377    
378    
379     \subsection{Topography: partially filled cells}
380    
381     \begin{figure}
382     \centerline{
383     \resizebox{4.5in}{!}{\includegraphics{part2/vgrid-xz.eps}}
384     }
385     \caption{
386     A schematic of the x-r plane showing the location of the
387     non-dimensional fractions $h_c$ and $h_w$. The physical thickness of a
388     tracer cell is given by $h_c(i,j,k) \Delta r_f(k)$ and the physical
389     thickness of the open side is given by $h_w(i,j,k) \Delta r_f(k)$.}
390     \label{fig:hfacs}
391     \end{figure}
392    
393     \cite{Adcroft97} presented two alternatives to the step-wise finite
394     difference representation of topography. The method is known to the
395     engineering community as {\em intersecting boundary method}. It
396     involves allowing the boundary to intersect a grid of cells thereby
397     modifying the shape of those cells intersected. We suggested allowing
398     the topgoraphy to take on a peice-wise linear representation (shaved
399     cells) or a simpler piecewise constant representaion (partial step).
400     Both show dramatic improvements in solution compared to the
401     traditional full step representation, the piece-wise linear being the
402     best. However, the storage requirements are excessive so the simpler
403     piece-wise constant or partial-step method is all that is currently
404     supported.
405    
406     Fig.~\ref{fig:hfacs} shows a schematic of the x-r plane indicating how
407     the thickness of a level is determined at tracer and u points.
408     \marginpar{$h_c$: {\bf hFacC}}
409     \marginpar{$h_w$: {\bf hFacW}}
410     \marginpar{$h_s$: {\bf hFacS}}
411     The physical thickness of a tracer cell is given by $h_c(i,j,k) \Delta
412     r_f(k)$ and the physical thickness of the open side is given by
413     $h_w(i,j,k) \Delta r_f(k)$. Three 3-D discriptors $h_c$, $h_w$ and
414     $h_s$ are used to describe the geometry: {\bf hFacC}, {\bf hFacW} and
415     {\bf hFacS} respectively. These are calculated in subroutine {\em
416     INI\_MASKS\_ETC} along with there reciprocals {\bf RECIP\_hFacC}, {\bf
417     RECIP\_hFacW} and {\bf RECIP\_hFacS}.
418    
419     The non-dimensional fractions (or h-facs as we call them) are
420     calculated from the model depth array and then processed to avoid tiny
421     volumes. The rule is that if a fraction is less than {\bf hFacMin}
422     then it is rounded to the nearer of $0$ or {\bf hFacMin} or if the
423     physical thickness is less than {\bf hFacMinDr} then it is similarly
424     rounded. The larger of the two methods is used when there is a
425     conflict. By setting {\bf hFacMinDr} equal to or larger than the
426     thinnest nominal layers, $\min{(\Delta z_f)}$, but setting {\bf
427     hFacMin} to some small fraction then the model will only lop thick
428     layers but retain stability based on the thinnest unlopped thickness;
429     $\min{(\Delta z_f,\mbox{\bf hFacMinDr})}$.
430    
431     \fbox{ \begin{minipage}{4.75in}
432     {\em S/R INI\_MASKS\_ETC} ({\em model/src/ini\_masks\_etc.F})
433    
434     $h_c$: {\bf hFacC} ({\em GRID.h})
435    
436     $h_w$: {\bf hFacW} ({\em GRID.h})
437    
438     $h_s$: {\bf hFacS} ({\em GRID.h})
439    
440     $h_c^{-1}$: {\bf RECIP\_hFacC} ({\em GRID.h})
441    
442     $h_w^{-1}$: {\bf RECIP\_hFacW} ({\em GRID.h})
443    
444     $h_s^{-1}$: {\bf RECIP\_hFacS} ({\em GRID.h})
445 adcroft 1.2
446     \end{minipage} }
447    
448 adcroft 1.1
449     \subsection{Continuity and horizontal pressure gradient terms}
450    
451     The core algorithm is based on the ``C grid'' discretization of the
452     continuity equation which can be summarized as:
453     \begin{eqnarray}
454     \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' \\
455     \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' \\
456     \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}' \\
457     \delta_i \Delta y_g \Delta r_f h_w u +
458     \delta_j \Delta x_g \Delta r_f h_s v +
459     \delta_k {\cal A}_c w & = & {\cal A}_c \delta_k (P-E)_{r=0}
460 adcroft 1.2 \label{eq:discrete-continuity}
461 adcroft 1.1 \end{eqnarray}
462     where the continuity equation has been most naturally discretized by
463     staggering the three components of velocity as shown in
464     Fig.~\ref{fig-cgrid3d}. The grid lengths $\Delta x_c$ and $\Delta y_c$
465     are the lengths between tracer points (cell centers). The grid lengths
466     $\Delta x_g$, $\Delta y_g$ are the grid lengths between cell
467     corners. $\Delta r_f$ and $\Delta r_c$ are the distance (in units of
468     $r$) between level interfaces (w-level) and level centers (tracer
469     level). The surface area presented in the vertical is denoted ${\cal
470     A}_c$. The factors $h_w$ and $h_s$ are non-dimensional fractions
471     (between 0 and 1) that represent the fraction cell depth that is
472     ``open'' for fluid flow.
473     \marginpar{$h_w$: {\bf hFacW}}
474     \marginpar{$h_s$: {\bf hFacS}}
475    
476     The last equation, the discrete continuity equation, can be summed in
477     the vertical to yeild the free-surface equation:
478     \begin{equation}
479     {\cal A}_c \partial_t \eta + \delta_i \sum_k \Delta y_g \Delta r_f h_w u + \delta_j \sum_k \Delta x_g \Delta r_f h_s v =
480     {\cal A}_c(P-E)_{r=0}
481     \end{equation}
482     The source term $P-E$ on the rhs of continuity accounts for the local
483     addition of volume due to excess precipitation and run-off over
484     evaporation and only enters the top-level of the {\em ocean} model.
485    
486     \subsection{Hydrostatic balance}
487    
488     The vertical momentum equation has the hydrostatic or
489     quasi-hydrostatic balance on the right hand side. This discretization
490     guarantees that the conversion of potential to kinetic energy as
491     derived from the buoyancy equation exactly matches the form derived
492     from the pressure gradient terms when forming the kinetic energy
493     equation.
494    
495     In the ocean, using z-ccordinates, the hydrostatic balance terms are
496     discretized:
497     \begin{equation}
498     \epsilon_{nh} \partial_t w
499     + g \overline{\rho'}^k + \frac{1}{\Delta z} \delta_k \Phi_h' = \ldots
500     \end{equation}
501    
502     In the atmosphere, using p-coordinates, hydrostatic balance is
503     discretized:
504     \begin{equation}
505     \overline{\theta'}^k + \frac{1}{\Delta \Pi} \delta_k \Phi_h' = 0
506     \end{equation}
507     where $\Delta \Pi$ is the difference in Exner function between the
508     pressure points. The non-hydrostatic equations are not available in
509     the atmosphere.
510    
511     The difference in approach between ocean and atmosphere occurs because
512     of the direct use of the ideal gas equation in forming the potential
513     energy conversion term $\alpha \omega$. The form of these consversion
514     terms is discussed at length in \cite{Adcroft01}.
515    
516     Because of the different representation of hydrostatic balance between
517     ocean and atmosphere there is no elegant way to represent both systems
518     using an arbitrary coordinate.
519    
520     The integration for hydrostatic pressure is made in the positive $r$
521     direction (increasing k-index). For the ocean, this is from the
522     free-surface down and for the atmosphere this is from the ground up.
523    
524     The calculations are made in the subroutine {\em
525     CALC\_PHI\_HYD}. Inside this routine, one of other of the
526     atmospheric/oceanic form is selected based on the string variable {\bf
527     buoyancyRelation}.
528    
529     \subsection{Flux-form momentum equations}
530    
531     The original finite volume model was based on the Eulerian flux form
532     momentum equations. This is the default though the vector invariant
533     form is optionally available (and recommended in some cases).
534    
535     The ``G's'' (our colloquial name for all terms on rhs!) are broken
536     into the various advective, Coriolis, horizontal dissipation, vertical
537     dissipation and metric forces:
538     \marginpar{$G_u$: {\bf Gu} }
539     \marginpar{$G_v$: {\bf Gv} }
540     \marginpar{$G_w$: {\bf Gw} }
541     \begin{eqnarray}
542     G_u & = & G_u^{adv} + G_u^{cor} + G_u^{h-diss} + G_u^{v-diss} +
543     G_u^{metric} + G_u^{nh-metric} \\
544     G_v & = & G_v^{adv} + G_v^{cor} + G_v^{h-diss} + G_v^{v-diss} +
545     G_v^{metric} + G_v^{nh-metric} \\
546     G_w & = & G_w^{adv} + G_w^{cor} + G_w^{h-diss} + G_w^{v-diss} +
547     G_w^{metric} + G_w^{nh-metric}
548     \end{eqnarray}
549     In the hydrostatic limit, $G_w=0$ and $\epsilon_{nh}=0$, reducing the
550     vertical momentum to hydrostatic balance.
551    
552     These terms are calculated in routines called from subroutine {\em
553     CALC\_MOM\_RHS} a collected into the global arrays {\bf Gu}, {\bf Gv},
554     and {\bf Gw}.
555    
556 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
557 adcroft 1.1 {\em S/R CALC\_MOM\_RHS} ({\em pkg/mom\_fluxform/calc\_mom\_rhs.F})
558    
559     $G_u$: {\bf Gu} ({\em DYNVARS.h})
560    
561     $G_v$: {\bf Gv} ({\em DYNVARS.h})
562    
563     $G_w$: {\bf Gw} ({\em DYNVARS.h})
564     \end{minipage} }
565    
566    
567     \subsubsection{Advection of momentum}
568    
569     The advective operator is second order accurate in space:
570     \begin{eqnarray}
571     {\cal A}_w \Delta r_f h_w G_u^{adv} & = &
572     \delta_i \overline{ U }^i \overline{ u }^i
573     + \delta_j \overline{ V }^i \overline{ u }^j
574     + \delta_k \overline{ W }^i \overline{ u }^k \\
575     {\cal A}_s \Delta r_f h_s G_v^{adv} & = &
576     \delta_i \overline{ U }^j \overline{ v }^i
577     + \delta_j \overline{ V }^j \overline{ v }^j
578     + \delta_k \overline{ W }^j \overline{ v }^k \\
579     {\cal A}_c \Delta r_c G_w^{adv} & = &
580     \delta_i \overline{ U }^k \overline{ w }^i
581     + \delta_j \overline{ V }^k \overline{ w }^j
582     + \delta_k \overline{ W }^k \overline{ w }^k \\
583     \end{eqnarray}
584     and because of the flux form does not contribute to the global budget
585     of linear momentum. The quantities $U$, $V$ and $W$ are volume fluxes
586     defined:
587     \marginpar{$U$: {\bf uTrans} }
588     \marginpar{$V$: {\bf vTrans} }
589     \marginpar{$W$: {\bf rTrans} }
590     \begin{eqnarray}
591     U & = & \Delta y_g \Delta r_f h_w u \\
592     V & = & \Delta x_g \Delta r_f h_s v \\
593     W & = & {\cal A}_c w
594     \end{eqnarray}
595     The advection of momentum takes the same form as the advection of
596     tracers but by a translated advective flow. Consequently, the
597     conservation of second moments, derived for tracers later, applies to
598     $u^2$ and $v^2$ and $w^2$ so that advection of momentum correctly
599     conserves kinetic energy.
600    
601 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
602 adcroft 1.1 {\em S/R MOM\_U\_ADV\_UU} ({\em mom\_u\_adv\_uu.F})
603    
604     {\em S/R MOM\_U\_ADV\_VU} ({\em mom\_u\_adv\_vu.F})
605    
606     {\em S/R MOM\_U\_ADV\_WU} ({\em mom\_u\_adv\_wu.F})
607    
608     {\em S/R MOM\_U\_ADV\_UV} ({\em mom\_u\_adv\_uv.F})
609    
610     {\em S/R MOM\_U\_ADV\_VV} ({\em mom\_u\_adv\_vv.F})
611    
612     {\em S/R MOM\_U\_ADV\_WV} ({\em mom\_u\_adv\_wv.F})
613    
614     $uu$, $uv$, $vu$, $vv$: {\bf aF} (local to {\em calc\_mom\_rhs.F})
615     \end{minipage} }
616    
617    
618    
619     \subsubsection{Coriolis terms}
620    
621     The ``pure C grid'' Coriolis terms (i.e. in absence of C-D scheme) are
622     discretized:
623     \begin{eqnarray}
624     {\cal A}_w \Delta r_f h_w G_u^{Cor} & = &
625     \overline{ f {\cal A}_c \Delta r_f h_c \overline{ v }^j }^i
626     - \epsilon_{nh} \overline{ f' {\cal A}_c \Delta r_f h_c \overline{ w }^k }^i \\
627     {\cal A}_s \Delta r_f h_s G_v^{Cor} & = &
628     - \overline{ f {\cal A}_c \Delta r_f h_c \overline{ u }^i }^j \\
629     {\cal A}_c \Delta r_c G_w^{Cor} & = &
630     \epsilon_{nh} \overline{ f' {\cal A}_c \Delta r_f h_c \overline{ u }^i }^k
631     \end{eqnarray}
632     where the Coriolis parameters $f$ and $f'$ are defined:
633     \begin{eqnarray}
634     f & = & 2 \Omega \sin{\phi} \\
635     f' & = & 2 \Omega \cos{\phi}
636     \end{eqnarray}
637     when using spherical geometry, otherwise the $\beta$-plane definition is used:
638     \begin{eqnarray}
639     f & = & f_o + \beta y \\
640     f' & = & 0
641     \end{eqnarray}
642    
643     This discretization globally conserves kinetic energy. It should be
644     noted that despite the use of this discretization in former
645     publications, all calculations to date have used the following
646     different discretization:
647     \begin{eqnarray}
648     G_u^{Cor} & = &
649     f_u \overline{ v }^{ji}
650     - \epsilon_{nh} f_u' \overline{ w }^{ik} \\
651     G_v^{Cor} & = &
652     - f_v \overline{ u }^{ij} \\
653     G_w^{Cor} & = &
654     \epsilon_{nh} f_w' \overline{ u }^{ik}
655     \end{eqnarray}
656     \marginpar{Need to change the default in code to match this}
657     where the subscripts on $f$ and $f'$ indicate evaluation of the
658     Coriolis parameters at the appropriate points in space. The above
659     discretization does {\em not} conserve anything, especially energy. An
660     option to recover this discretization has been retained for backward
661     compatibility testing (set run-time logical {\bf
662     useNonconservingCoriolis} to {\em true} which otherwise defaults to
663     {\em false}).
664    
665 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
666 adcroft 1.1 {\em S/R MOM\_CDSCHEME} ({\em mom\_cdscheme.F})
667    
668     {\em S/R MOM\_U\_CORIOLIS} ({\em mom\_u\_coriolis.F})
669    
670     {\em S/R MOM\_V\_CORIOLIS} ({\em mom\_v\_coriolis.F})
671    
672     $G_u^{Cor}$, $G_v^{Cor}$: {\bf cF} (local to {\em calc\_mom\_rhs.F})
673     \end{minipage} }
674    
675    
676     \subsubsection{Curvature metric terms}
677    
678     The most commonly used coordinate system on the sphere is the
679     geographic system $(\lambda,\phi)$. The curvilinear nature of these
680     coordinates on the sphere lead to some ``metric'' terms in the
681     component momentum equations. Under the thin-atmosphere and
682     hydrostatic approximations these terms are discretized:
683     \begin{eqnarray}
684     {\cal A}_w \Delta r_f h_w G_u^{metric} & = &
685     \overline{ \frac{ \overline{u}^i }{a} \tan{\phi} {\cal A}_c \Delta r_f h_c \overline{ v }^j }^i \\
686     {\cal A}_s \Delta r_f h_s G_v^{metric} & = &
687     - \overline{ \frac{ \overline{u}^i }{a} \tan{\phi} {\cal A}_c \Delta r_f h_c \overline{ u }^i }^j \\
688     G_w^{metric} & = & 0
689     \end{eqnarray}
690     where $a$ is the radius of the planet (sphericity is assumed) or the
691     radial distance of the particle (i.e. a function of height). It is
692     easy to see that this discretization satisfies all the properties of
693     the discrete Coriolis terms since the metric factor $\frac{u}{a}
694     \tan{\phi}$ can be viewed as a modification of the vertical Coriolis
695     parameter: $f \rightarrow f+\frac{u}{a} \tan{\phi}$.
696    
697     However, as for the Coriolis terms, a non-energy conserving form has
698     exclusively been used to date:
699     \begin{eqnarray}
700     G_u^{metric} & = & \frac{u \overline{v}^{ij} }{a} \tan{\phi} \\
701     G_v^{metric} & = & \frac{ \overline{u}^{ij} \overline{u}^{ij}}{a} \tan{\phi}
702     \end{eqnarray}
703     where $\tan{\phi}$ is evaluated at the $u$ and $v$ points
704     respectively.
705    
706 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
707 adcroft 1.1 {\em S/R MOM\_U\_METRIC\_SPHERE} ({\em mom\_u\_metric\_sphere.F})
708    
709     {\em S/R MOM\_V\_METRIC\_SPHERE} ({\em mom\_v\_metric\_sphere.F})
710    
711     $G_u^{metric}$, $G_v^{metric}$: {\bf mT} (local to {\em calc\_mom\_rhs.F})
712     \end{minipage} }
713    
714    
715    
716     \subsubsection{Non-hydrostatic metric terms}
717    
718     For the non-hydrostatic equations, dropping the thin-atmosphere
719     approximation re-introduces metric terms involving $w$ and are
720     required to conserve anglular momentum:
721     \begin{eqnarray}
722     {\cal A}_w \Delta r_f h_w G_u^{metric} & = &
723     - \overline{ \frac{ \overline{u}^i \overline{w}^k }{a} {\cal A}_c \Delta r_f h_c }^i \\
724     {\cal A}_s \Delta r_f h_s G_v^{metric} & = &
725     - \overline{ \frac{ \overline{v}^j \overline{w}^k }{a} {\cal A}_c \Delta r_f h_c}^j \\
726     {\cal A}_c \Delta r_c G_w^{metric} & = &
727     \overline{ \frac{ {\overline{u}^i}^2 + {\overline{v}^j}^2}{a} {\cal A}_c \Delta r_f h_c }^k
728     \end{eqnarray}
729    
730     Because we are always consistent, even if consistently wrong, we have,
731     in the past, used a different discretization in the model which is:
732     \begin{eqnarray}
733     G_u^{metric} & = &
734     - \frac{u}{a} \overline{w}^{ik} \\
735     G_v^{metric} & = &
736     - \frac{v}{a} \overline{w}^{jk} \\
737     G_w^{metric} & = &
738     \frac{1}{a} ( {\overline{u}^{ik}}^2 + {\overline{v}^{jk}}^2 )
739     \end{eqnarray}
740    
741 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
742 adcroft 1.1 {\em S/R MOM\_U\_METRIC\_NH} ({\em mom\_u\_metric\_nh.F})
743    
744     {\em S/R MOM\_V\_METRIC\_NH} ({\em mom\_v\_metric\_nh.F})
745    
746     $G_u^{metric}$, $G_v^{metric}$: {\bf mT} (local to {\em calc\_mom\_rhs.F})
747     \end{minipage} }
748    
749    
750     \subsubsection{Lateral dissipation}
751    
752     Historically, we have represented the SGS Reynolds stresses as simply
753     down gradient momentum fluxes, ignoring constraints on the stress
754     tensor such as symmetry.
755     \begin{eqnarray}
756     {\cal A}_w \Delta r_f h_w G_u^{h-diss} & = &
757     \delta_i \Delta y_f \Delta r_f h_c \tau_{11}
758     + \delta_j \Delta x_v \Delta r_f h_\zeta \tau_{12} \\
759     {\cal A}_s \Delta r_f h_s G_v^{h-diss} & = &
760     \delta_i \Delta y_u \Delta r_f h_\zeta \tau_{21}
761     + \delta_j \Delta x_f \Delta r_f h_c \tau_{22}
762     \end{eqnarray}
763     \marginpar{Check signs of stress definitions}
764    
765     The lateral viscous stresses are discretized:
766     \begin{eqnarray}
767     \tau_{11} & = & A_h c_{11\Delta}(\phi) \frac{1}{\Delta x_f} \delta_i u
768     -A_4 c_{11\Delta^2}(\phi) \frac{1}{\Delta x_f} \delta_i \nabla^2 u \\
769     \tau_{12} & = & A_h c_{12\Delta}(\phi) \frac{1}{\Delta y_u} \delta_j u
770     -A_4 c_{12\Delta^2}(\phi)\frac{1}{\Delta y_u} \delta_j \nabla^2 u \\
771     \tau_{21} & = & A_h c_{21\Delta}(\phi) \frac{1}{\Delta x_v} \delta_i v
772     -A_4 c_{21\Delta^2}(\phi) \frac{1}{\Delta x_v} \delta_i \nabla^2 v \\
773     \tau_{22} & = & A_h c_{22\Delta}(\phi) \frac{1}{\Delta y_f} \delta_j v
774     -A_4 c_{22\Delta^2}(\phi) \frac{1}{\Delta y_f} \delta_j \nabla^2 v
775     \end{eqnarray}
776     where the non-dimensional factors $c_{lm\Delta^n}(\phi), \{l,m,n\} \in
777     \{1,2\}$ define the ``cosine'' scaling with latitude which can be
778     applied in various ad-hoc ways. For instance, $c_{11\Delta} =
779     c_{21\Delta} = (\cos{\phi})^{3/2}$, $c_{12\Delta}=c_{22\Delta}=0$ would
780     represent the an-isotropic cosine scaling typically used on the
781     ``lat-lon'' grid for Laplacian viscosity.
782     \marginpar{Need to tidy up method for controlling this in code}
783    
784     It should be noted that dispite the ad-hoc nature of the scaling, some
785     scaling must be done since on a lat-lon grid the converging meridians
786     make it very unlikely that a stable viscosity parameter exists across
787     the entire model domain.
788    
789     The Laplacian viscosity coefficient, $A_h$ ({\bf viscAh}), has units
790     of $m^2 s^{-1}$. The bi-harmonic viscosity coefficient, $A_4$ ({\bf
791     viscA4}), has units of $m^4 s^{-1}$.
792    
793 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
794 adcroft 1.1 {\em S/R MOM\_U\_XVISCFLUX} ({\em mom\_u\_xviscflux.F})
795    
796     {\em S/R MOM\_U\_YVISCFLUX} ({\em mom\_u\_yviscflux.F})
797    
798     {\em S/R MOM\_V\_XVISCFLUX} ({\em mom\_v\_xviscflux.F})
799    
800     {\em S/R MOM\_V\_YVISCFLUX} ({\em mom\_v\_yviscflux.F})
801    
802     $\tau_{11}$, $\tau_{12}$, $\tau_{22}$, $\tau_{22}$: {\bf vF}, {\bf
803     v4F} (local to {\em calc\_mom\_rhs.F})
804     \end{minipage} }
805    
806     Two types of lateral boundary condition exist for the lateral viscous
807     terms, no-slip and free-slip.
808    
809     The free-slip condition is most convenient to code since it is
810     equivalent to zero-stress on boundaries. Simple masking of the stress
811     components sets them to zero. The fractional open stress is properly
812     handled using the lopped cells.
813    
814     The no-slip condition defines the normal gradient of a tangential flow
815     such that the flow is zero on the boundary. Rather than modify the
816     stresses by using complicated functions of the masks and ``ghost''
817     points (see \cite{Adcroft+Marshall98}) we add the boundary stresses as
818     an additional source term in cells next to solid boundaries. This has
819     the advantage of being able to cope with ``thin walls'' and also makes
820     the interior stress calculation (code) independent of the boundary
821     conditions. The ``body'' force takes the form:
822     \begin{eqnarray}
823     G_u^{side-drag} & = &
824     \frac{4}{\Delta z_f} \overline{ (1-h_\zeta) \frac{\Delta x_v}{\Delta y_u} }^j
825     \left( A_h c_{12\Delta}(\phi) u - A_4 c_{12\Delta^2}(\phi) \nabla^2 u \right)
826     \\
827     G_v^{side-drag} & = &
828     \frac{4}{\Delta z_f} \overline{ (1-h_\zeta) \frac{\Delta y_u}{\Delta x_v} }^i
829     \left( A_h c_{21\Delta}(\phi) v - A_4 c_{21\Delta^2}(\phi) \nabla^2 v \right)
830     \end{eqnarray}
831    
832     In fact, the above discretization is not quite complete because it
833     assumes that the bathymetry at velocity points is deeper than at
834     neighbouring vorticity points, e.g. $1-h_w < 1-h_\zeta$
835    
836 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
837 adcroft 1.1 {\em S/R MOM\_U\_SIDEDRAG} ({\em mom\_u\_sidedrag.F})
838    
839     {\em S/R MOM\_V\_SIDEDRAG} ({\em mom\_v\_sidedrag.F})
840    
841     $G_u^{side-drag}$, $G_v^{side-drag}$: {\bf vF} (local to {\em calc\_mom\_rhs.F})
842     \end{minipage} }
843    
844    
845     \subsubsection{Vertical dissipation}
846    
847     Vertical viscosity terms are discretized with only partial adherence
848     to the variable grid lengths introduced by the finite volume
849     formulation. This reduces the formal accuracy of these terms to just
850     first order but only next to boundaries; exactly where other terms
851     appear such as linar and quadratic bottom drag.
852     \begin{eqnarray}
853     G_u^{v-diss} & = &
854     \frac{1}{\Delta r_f h_w} \delta_k \tau_{13} \\
855     G_v^{v-diss} & = &
856     \frac{1}{\Delta r_f h_s} \delta_k \tau_{23} \\
857     G_w^{v-diss} & = & \epsilon_{nh}
858     \frac{1}{\Delta r_f h_d} \delta_k \tau_{33}
859     \end{eqnarray}
860     represents the general discrete form of the vertical dissipation terms.
861    
862     In the interior the vertical stresses are discretized:
863     \begin{eqnarray}
864     \tau_{13} & = & A_v \frac{1}{\Delta r_c} \delta_k u \\
865     \tau_{23} & = & A_v \frac{1}{\Delta r_c} \delta_k v \\
866     \tau_{33} & = & A_v \frac{1}{\Delta r_f} \delta_k w
867     \end{eqnarray}
868     It should be noted that in the non-hydrostatic form, the stress tensor
869     is even less consistent than for the hydrostatic (see Wazjowicz
870     \cite{Waojz}). It is well known how to do this properly (see Griffies
871     \cite{Griffies}) and is on the list of to-do's.
872    
873 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
874 adcroft 1.1 {\em S/R MOM\_U\_RVISCLFUX} ({\em mom\_u\_rviscflux.F})
875    
876     {\em S/R MOM\_V\_RVISCLFUX} ({\em mom\_v\_rviscflux.F})
877    
878     $\tau_{13}$: {\bf urf} (local to {\em calc\_mom\_rhs.F})
879    
880     $\tau_{23}$: {\bf vrf} (local to {\em calc\_mom\_rhs.F})
881     \end{minipage} }
882    
883    
884     As for the lateral viscous terms, the free-slip condition is
885     equivalent to simply setting the stress to zero on boundaries. The
886     no-slip condition is implemented as an additional term acting on top
887     of the interior and free-slip stresses. Bottom drag represents
888     additional friction, in addition to that imposed by the no-slip
889     condition at the bottom. The drag is cast as a stress expressed as a
890     linear or quadratic function of the mean flow in the layer above the
891     topography:
892     \begin{eqnarray}
893     \tau_{13}^{bottom-drag} & = &
894     \left(
895     2 A_v \frac{1}{\Delta r_c}
896     + r_b
897     + C_d \sqrt{ \overline{2 KE}^i }
898     \right) u \\
899     \tau_{23}^{bottom-drag} & = &
900     \left(
901     2 A_v \frac{1}{\Delta r_c}
902     + r_b
903     + C_d \sqrt{ \overline{2 KE}^j }
904     \right) v
905     \end{eqnarray}
906     where these terms are only evaluated immediately above topography.
907     $r_b$ ({\bf bottomDragLinear}) has units of $m s^{-1}$ and a typical value
908     of the order 0.0002 $m s^{-1}$. $C_d$ ({\bf bottomDragQuadratic}) is
909     dimensionless with typical values in the range 0.001--0.003.
910    
911 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
912 adcroft 1.1 {\em S/R MOM\_U\_BOTTOMDRAG} ({\em mom\_u\_bottomdrag.F})
913    
914     {\em S/R MOM\_V\_BOTTOMDRAG} ({\em mom\_v\_bottomdrag.F})
915    
916     $\tau_{13}^{bottom-drag}$, $\tau_{23}^{bottom-drag}$: {\bf vf} (local to {\em calc\_mom\_rhs.F})
917     \end{minipage} }
918    
919    
920    
921    
922    
923     \subsection{Tracer equations}
924    
925     The tracer equations are discretized consistantly with the continuity
926     equation to facilitate conservation properties analogous to the
927     continuum:
928     \begin{equation}
929     {\cal A}_c \Delta r_f h_c \partial_\theta
930     + \delta_i U \overline{ \theta }^i
931     + \delta_j V \overline{ \theta }^j
932     + \delta_k W \overline{ \theta }^k
933     = {\cal A}_c \Delta r_f h_c {\cal S}_\theta + \theta {\cal A}_c \delta_k (P-E)_{r=0}
934     \end{equation}
935     The quantities $U$, $V$ and $W$ are volume fluxes defined:
936     \marginpar{$U$: {\bf uTrans} }
937     \marginpar{$V$: {\bf vTrans} }
938     \marginpar{$W$: {\bf rTrans} }
939     \begin{eqnarray}
940     U & = & \Delta y_g \Delta r_f h_w u \\
941     V & = & \Delta x_g \Delta r_f h_s v \\
942     W & = & {\cal A}_c w
943     \end{eqnarray}
944     ${\cal S}$ represents the ``parameterized'' SGS processes and
945     physics associated with the tracer. For instance, potential
946     temperature equation in the ocean has is forced by surface and
947     partially penetrating heat fluxes:
948     \begin{equation}
949     {\cal A}_c \Delta r_f h_c {\cal S}_\theta = \frac{1}{c_p \rho_o} \delta_k {\cal A}_c {\cal Q}
950     \end{equation}
951     while the salt equation has no real sources, ${\cal S}=0$, which
952     leaves just the $P-E$ term.
953    
954     The continuity equation can be recovered by setting ${\cal Q}=0$ and
955     $\theta=1$. The term $\theta (P-E)_{r=0}$ is required to retain local
956     conservation of $\theta$. Global conservation is not possible using
957     the flux-form (as here) and a linearized free-surface
958     (\cite{Griffies00,Campin02}).
959    
960    
961    
962    
963     \subsection{Derivation of discrete energy conservation}
964    
965     These discrete equations conserve kinetic plus potential energy using the
966     following definitions:
967     \begin{equation}
968     KE = \frac{1}{2} \left( \overline{ u^2 }^i + \overline{ v^2 }^j +
969     \epsilon_{nh} \overline{ w^2 }^k \right)
970     \end{equation}
971    
972    
973     \subsection{Vector invariant momentum equations}
974    
975     The finite volume method lends itself to describing the continuity and
976     tracer equations in curvilinear coordinate systems but the appearance
977     of new metric terms in the flux-form momentum equations makes
978     generalizing them far from elegant. The vector invariant form of the
979     momentum equations are exactly that; invariant under coordinate
980     transformations.
981    
982     The non-hydrostatic vector invariant equations read:
983     \begin{equation}
984     \partial_t \vec{v} + ( 2\vec{\Omega} + \vec{\zeta}) \wedge \vec{v}
985     - b \hat{r}
986     + \vec{\nabla} B = \vec{\nabla} \cdot \vec{\bf \tau}
987     \end{equation}
988     which describe motions in any orthogonal curvilinear coordinate
989     system. Here, $B$ is the Bernoulli function and $\vec{\zeta}=\nabla
990     \wedge \vec{v}$ is the vorticity vector. We can take advantage of the
991     elegance of these equations when discretizing them and use the
992     discrete definitions of the grad, curl and divergence operators to
993     satisfy constraints. We can also consider the analogy to forming
994     derived equations, such as the vorticity equation, and examine how the
995     discretization can be adjusted to give suitable vorticity advection
996     among other things.
997    
998     The underlying algorithm is the same as for the flux form
999     equations. All that has changed is the contents of the ``G's''. For
1000     the time-being, only the hydrostatic terms have been coded but we will
1001     indicate the points where non-hydrostatic contributions will enter:
1002     \begin{eqnarray}
1003     G_u & = & G_u^{fv} + G_u^{\zeta_3 v} + G_u^{\zeta_2 w} + G_u^{\partial_x B}
1004     + G_u^{\partial_z \tau^x} + G_u^{h-dissip} + G_u^{v-dissip} \\
1005     G_v & = & G_v^{fu} + G_v^{\zeta_3 u} + G_v^{\zeta_1 w} + G_v^{\partial_y B}
1006     + G_v^{\partial_z \tau^y} + G_v^{h-dissip} + G_v^{v-dissip} \\
1007     G_w & = & G_w^{fu} + G_w^{\zeta_1 v} + G_w^{\zeta_2 u} + G_w^{\partial_z B}
1008     + G_w^{h-dissip} + G_w^{v-dissip}
1009     \end{eqnarray}
1010    
1011 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1012 adcroft 1.1 {\em S/R CALC\_MOM\_RHS} ({\em pkg/mom\_vecinv/calc\_mom\_rhs.F})
1013    
1014     $G_u$: {\bf Gu} ({\em DYNVARS.h})
1015    
1016     $G_v$: {\bf Gv} ({\em DYNVARS.h})
1017    
1018     $G_w$: {\bf Gw} ({\em DYNVARS.h})
1019     \end{minipage} }
1020    
1021     \subsubsection{Relative vorticity}
1022    
1023     The vertical component of relative vorticity is explicitly calculated
1024     and use in the discretization. The particular form is crucial for
1025     numerical stablility; alternative definitions break the conservation
1026     properties of the discrete equations.
1027    
1028     Relative vorticity is defined:
1029     \begin{equation}
1030     \zeta_3 = \frac{\Gamma}{A_\zeta}
1031     = \frac{1}{{\cal A}_\zeta} ( \delta_i \Delta y_c v - \delta_j \Delta x_c u )
1032     \end{equation}
1033     where ${\cal A}_\zeta$ is the area of the vorticity cell presented in
1034     the vertical and $\Gamma$ is the circulation about that cell.
1035    
1036 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1037 adcroft 1.1 {\em S/R MOM\_VI\_CALC\_RELVORT3} ({\em mom\_vi\_calc\_relvort3.F})
1038    
1039     $\zeta_3$: {\bf vort3} (local to {\em calc\_mom\_rhs.F})
1040     \end{minipage} }
1041    
1042    
1043     \subsubsection{Kinetic energy}
1044    
1045     The kinetic energy, denoted $KE$, is defined:
1046     \begin{equation}
1047     KE = \frac{1}{2} ( \overline{ u^2 }^i + \overline{ v^2 }^j
1048     + \epsilon_{nh} \overline{ w^2 }^k )
1049     \end{equation}
1050    
1051 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1052 adcroft 1.1 {\em S/R MOM\_VI\_CALC\_KE} ({\em mom\_vi\_calc\_ke.F})
1053    
1054     $KE$: {\bf KE} (local to {\em calc\_mom\_rhs.F})
1055     \end{minipage} }
1056    
1057    
1058     \subsubsection{Coriolis terms}
1059    
1060     The potential enstrophy conserving form of the linear Coriolis terms
1061     are written:
1062     \begin{eqnarray}
1063     G_u^{fv} & = &
1064     \frac{1}{\Delta x_c}
1065     \overline{ \frac{f}{h_\zeta} }^j \overline{ \overline{ \Delta x_g h_s v }^j }^i \\
1066     G_v^{fu} & = & -
1067     \frac{1}{\Delta y_c}
1068     \overline{ \frac{f}{h_\zeta} }^i \overline{ \overline{ \Delta y_g h_w u }^i }^j
1069     \end{eqnarray}
1070     Here, the Coriolis parameter $f$ is defined at vorticity (corner)
1071     points.
1072     \marginpar{$f$: {\bf fCoriG}}
1073     \marginpar{$h_\zeta$: {\bf hFacZ}}
1074    
1075     The potential enstrophy conserving form of the non-linear Coriolis
1076     terms are written:
1077     \begin{eqnarray}
1078     G_u^{\zeta_3 v} & = &
1079     \frac{1}{\Delta x_c}
1080     \overline{ \frac{\zeta_3}{h_\zeta} }^j \overline{ \overline{ \Delta x_g h_s v }^j }^i \\
1081     G_v^{\zeta_3 u} & = & -
1082     \frac{1}{\Delta y_c}
1083     \overline{ \frac{\zeta_3}{h_\zeta} }^i \overline{ \overline{ \Delta y_g h_w u }^i }^j
1084     \end{eqnarray}
1085     \marginpar{$\zeta_3$: {\bf vort3}}
1086    
1087     The Coriolis terms can also be evaluated together and expressed in
1088     terms of absolute vorticity $f+\zeta_3$. The potential enstrophy
1089     conserving form using the absolute vorticity is written:
1090     \begin{eqnarray}
1091     G_u^{fv} + G_u^{\zeta_3 v} & = &
1092     \frac{1}{\Delta x_c}
1093     \overline{ \frac{f + \zeta_3}{h_\zeta} }^j \overline{ \overline{ \Delta x_g h_s v }^j }^i \\
1094     G_v^{fu} + G_v^{\zeta_3 u} & = & -
1095     \frac{1}{\Delta y_c}
1096     \overline{ \frac{f + \zeta_3}{h_\zeta} }^i \overline{ \overline{ \Delta y_g h_w u }^i }^j
1097     \end{eqnarray}
1098    
1099     \marginpar{Run-time control needs to be added for these options} The
1100     disctinction between using absolute vorticity or relative vorticity is
1101     useful when constructing higher order advection schemes; monotone
1102     advection of relative vorticity behaves differently to monotone
1103     advection of absolute vorticity. Currently the choice of
1104     relative/absolute vorticity, centered/upwind/high order advection is
1105     available only through commented subroutine calls.
1106    
1107 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1108 adcroft 1.1 {\em S/R MOM\_VI\_CORIOLIS} ({\em mom\_vi\_coriolis.F})
1109    
1110     {\em S/R MOM\_VI\_U\_CORIOLIS} ({\em mom\_vi\_u\_coriolis.F})
1111    
1112     {\em S/R MOM\_VI\_V\_CORIOLIS} ({\em mom\_vi\_v\_coriolis.F})
1113    
1114     $G_u^{fv}$, $G_u^{\zeta_3 v}$: {\bf uCf} (local to {\em calc\_mom\_rhs.F})
1115    
1116     $G_v^{fu}$, $G_v^{\zeta_3 u}$: {\bf vCf} (local to {\em calc\_mom\_rhs.F})
1117     \end{minipage} }
1118    
1119    
1120     \subsubsection{Shear terms}
1121    
1122     The shear terms ($\zeta_2w$ and $\zeta_1w$) are are discretized to
1123     guarantee that no spurious generation of kinetic energy is possible;
1124     the horizontal gradient of Bernoulli function has to be consistent
1125     with the vertical advection of shear:
1126     \marginpar{N-H terms have not been tried!}
1127     \begin{eqnarray}
1128     G_u^{\zeta_2 w} & = &
1129     \frac{1}{ {\cal A}_w \Delta r_f h_w } \overline{
1130     \overline{ {\cal A}_c w }^i ( \delta_k u - \epsilon_{nh} \delta_j w )
1131     }^k \\
1132     G_v^{\zeta_1 w} & = &
1133     \frac{1}{ {\cal A}_s \Delta r_f h_s } \overline{
1134     \overline{ {\cal A}_c w }^i ( \delta_k u - \epsilon_{nh} \delta_j w )
1135     }^k
1136     \end{eqnarray}
1137    
1138 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1139 adcroft 1.1 {\em S/R MOM\_VI\_U\_VERTSHEAR} ({\em mom\_vi\_u\_vertshear.F})
1140    
1141     {\em S/R MOM\_VI\_V\_VERTSHEAR} ({\em mom\_vi\_v\_vertshear.F})
1142    
1143     $G_u^{\zeta_2 w}$: {\bf uCf} (local to {\em calc\_mom\_rhs.F})
1144    
1145     $G_v^{\zeta_1 w}$: {\bf vCf} (local to {\em calc\_mom\_rhs.F})
1146     \end{minipage} }
1147    
1148    
1149    
1150     \subsubsection{Gradient of Bernoulli function}
1151    
1152     \begin{eqnarray}
1153     G_u^{\partial_x B} & = &
1154     \frac{1}{\Delta x_c} \delta_i ( \phi' + KE ) \\
1155     G_v^{\partial_y B} & = &
1156     \frac{1}{\Delta x_y} \delta_j ( \phi' + KE )
1157     %G_w^{\partial_z B} & = &
1158     %\frac{1}{\Delta r_c} h_c \delta_k ( \phi' + KE )
1159     \end{eqnarray}
1160    
1161 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1162 adcroft 1.1 {\em S/R MOM\_VI\_U\_GRAD\_KE} ({\em mom\_vi\_u\_grad\_ke.F})
1163    
1164     {\em S/R MOM\_VI\_V\_GRAD\_KE} ({\em mom\_vi\_v\_grad\_ke.F})
1165    
1166     $G_u^{\partial_x KE}$: {\bf uCf} (local to {\em calc\_mom\_rhs.F})
1167    
1168     $G_v^{\partial_y KE}$: {\bf vCf} (local to {\em calc\_mom\_rhs.F})
1169     \end{minipage} }
1170    
1171    
1172    
1173     \subsubsection{Horizontal dissipation}
1174    
1175     The horizontal divergence, a complimentary quantity to relative
1176     vorticity, is used in parameterizing the Reynolds stresses and is
1177     discretized:
1178     \begin{equation}
1179     D = \frac{1}{{\cal A}_c h_c} (
1180     \delta_i \Delta y_g h_w u
1181     + \delta_j \Delta x_g h_s v )
1182     \end{equation}
1183    
1184 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1185 adcroft 1.1 {\em S/R MOM\_VI\_CALC\_HDIV} ({\em mom\_vi\_calc\_hdiv.F})
1186    
1187     $D$: {\bf hDiv} (local to {\em calc\_mom\_rhs.F})
1188     \end{minipage} }
1189    
1190    
1191     \subsubsection{Horizontal dissipation}
1192    
1193     The following discretization of horizontal dissipation conserves
1194     potential vorticity (thickness weighted relative vorticity) and
1195     divergence and dissipates energy, enstrophy and divergence squared:
1196     \begin{eqnarray}
1197     G_u^{h-dissip} & = &
1198     \frac{1}{\Delta x_c} \delta_i ( A_D D - A_{D4} D^*)
1199     - \frac{1}{\Delta y_u h_w} \delta_j h_\zeta ( A_\zeta \zeta - A_{\zeta4} \zeta^* )
1200     \\
1201     G_v^{h-dissip} & = &
1202     \frac{1}{\Delta x_v h_s} \delta_i h_\zeta ( A_\zeta \zeta - A_\zeta \zeta^* )
1203     + \frac{1}{\Delta y_c} \delta_j ( A_D D - A_{D4} D^* )
1204     \end{eqnarray}
1205     where
1206     \begin{eqnarray}
1207     D^* & = & \frac{1}{{\cal A}_c h_c} (
1208     \delta_i \Delta y_g h_w \nabla^2 u
1209     + \delta_j \Delta x_g h_s \nabla^2 v ) \\
1210     \zeta^* & = & \frac{1}{{\cal A}_\zeta} (
1211     \delta_i \Delta y_c \nabla^2 v
1212     - \delta_j \Delta x_c \nabla^2 u )
1213     \end{eqnarray}
1214    
1215 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1216 adcroft 1.1 {\em S/R MOM\_VI\_HDISSIP} ({\em mom\_vi\_hdissip.F})
1217    
1218     $G_u^{h-dissip}$: {\bf uDiss} (local to {\em calc\_mom\_rhs.F})
1219    
1220     $G_v^{h-dissip}$: {\bf vDiss} (local to {\em calc\_mom\_rhs.F})
1221     \end{minipage} }
1222    
1223    
1224     \subsubsection{Vertical dissipation}
1225    
1226     Currently, this is exactly the same code as the flux form equations.
1227     \begin{eqnarray}
1228     G_u^{v-diss} & = &
1229     \frac{1}{\Delta r_f h_w} \delta_k \tau_{13} \\
1230     G_v^{v-diss} & = &
1231     \frac{1}{\Delta r_f h_s} \delta_k \tau_{23}
1232     \end{eqnarray}
1233     represents the general discrete form of the vertical dissipation terms.
1234    
1235     In the interior the vertical stresses are discretized:
1236     \begin{eqnarray}
1237     \tau_{13} & = & A_v \frac{1}{\Delta r_c} \delta_k u \\
1238     \tau_{23} & = & A_v \frac{1}{\Delta r_c} \delta_k v
1239     \end{eqnarray}
1240    
1241 adcroft 1.2 \fbox{ \begin{minipage}{4.75in}
1242 adcroft 1.1 {\em S/R MOM\_U\_RVISCLFUX} ({\em mom\_u\_rviscflux.F})
1243    
1244     {\em S/R MOM\_V\_RVISCLFUX} ({\em mom\_v\_rviscflux.F})
1245    
1246     $\tau_{13}$: {\bf urf} (local to {\em calc\_mom\_rhs.F})
1247    
1248     $\tau_{23}$: {\bf vrf} (local to {\em calc\_mom\_rhs.F})
1249     \end{minipage} }

  ViewVC Help
Powered by ViewVC 1.1.22