/[MITgcm]/manual/s_algorithm/text/time_stepping.tex
ViewVC logotype

Annotation of /manual/s_algorithm/text/time_stepping.tex

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


Revision 1.25 - (hide annotations) (download) (as text)
Wed Jun 28 16:55:53 2006 UTC (19 years ago) by jmc
Branch: MAIN
Changes since 1.24: +7 -7 lines
File MIME type: application/x-tex
updated

1 jmc 1.25 % $Header: /u/gcmpack/manual/part2/time_stepping.tex,v 1.24 2006/06/27 22:31:23 edhill Exp $
2 jmc 1.2 % $Name: $
3 adcroft 1.1
4 cnh 1.15 This chapter lays out the numerical schemes that are
5     employed in the core MITgcm algorithm. Whenever possible
6     links are made to actual program code in the MITgcm implementation.
7     The chapter begins with a discussion of the temporal discretization
8     used in MITgcm. This discussion is followed by sections that
9     describe the spatial discretization. The schemes employed for momentum
10     terms are described first, afterwards the schemes that apply to
11     passive and dynamically active tracers are described.
12    
13 jmc 1.22 \input{part2/notation}
14 cnh 1.15
15     \section{Time-stepping}
16 edhill 1.19 \begin{rawhtml}
17     <!-- CMIREDIR:time-stepping: -->
18     \end{rawhtml}
19    
20 adcroft 1.8 The equations of motion integrated by the model involve four
21     prognostic equations for flow, $u$ and $v$, temperature, $\theta$, and
22     salt/moisture, $S$, and three diagnostic equations for vertical flow,
23     $w$, density/buoyancy, $\rho$/$b$, and pressure/geo-potential,
24     $\phi_{hyd}$. In addition, the surface pressure or height may by
25     described by either a prognostic or diagnostic equation and if
26     non-hydrostatics terms are included then a diagnostic equation for
27     non-hydrostatic pressure is also solved. The combination of prognostic
28     and diagnostic equations requires a model algorithm that can march
29     forward prognostic variables while satisfying constraints imposed by
30     diagnostic equations.
31    
32 cnh 1.9 Since the model comes in several flavors and formulation, it would be
33 adcroft 1.8 confusing to present the model algorithm exactly as written into code
34     along with all the switches and optional terms. Instead, we present
35     the algorithm for each of the basic formulations which are:
36     \begin{enumerate}
37     \item the semi-implicit pressure method for hydrostatic equations
38     with a rigid-lid, variables co-located in time and with
39     Adams-Bashforth time-stepping, \label{it:a}
40     \item as \ref{it:a}. but with an implicit linear free-surface, \label{it:b}
41     \item as \ref{it:a}. or \ref{it:b}. but with variables staggered in time,
42     \label{it:c}
43     \item as \ref{it:a}. or \ref{it:b}. but with non-hydrostatic terms included,
44     \item as \ref{it:b}. or \ref{it:c}. but with non-linear free-surface.
45     \end{enumerate}
46    
47     In all the above configurations it is also possible to substitute the
48     Adams-Bashforth with an alternative time-stepping scheme for terms
49     evaluated explicitly in time. Since the over-arching algorithm is
50     independent of the particular time-stepping scheme chosen we will
51     describe first the over-arching algorithm, known as the pressure
52     method, with a rigid-lid model in section
53     \ref{sect:pressure-method-rigid-lid}. This algorithm is essentially
54     unchanged, apart for some coefficients, when the rigid lid assumption
55     is replaced with a linearized implicit free-surface, described in
56 cnh 1.9 section \ref{sect:pressure-method-linear-backward}. These two flavors
57 adcroft 1.8 of the pressure-method encompass all formulations of the model as it
58     exists today. The integration of explicit in time terms is out-lined
59     in section \ref{sect:adams-bashforth} and put into the context of the
60     overall algorithm in sections \ref{sect:adams-bashforth-sync} and
61     \ref{sect:adams-bashforth-staggered}. Inclusion of non-hydrostatic
62     terms requires applying the pressure method in three dimensions
63     instead of two and this algorithm modification is described in section
64     \ref{sect:non-hydrostatic}. Finally, the free-surface equation may be
65     treated more exactly, including non-linear terms, and this is
66     described in section \ref{sect:nonlinear-freesurface}.
67    
68    
69 edhill 1.19 \section{Pressure method with rigid-lid}
70     \label{sect:pressure-method-rigid-lid}
71     \begin{rawhtml}
72     <!-- CMIREDIR:pressure_method_rigid_lid: -->
73     \end{rawhtml}
74 adcroft 1.8
75     \begin{figure}
76     \begin{center}
77     \resizebox{4.0in}{!}{\includegraphics{part2/pressure-method-rigid-lid.eps}}
78     \end{center}
79     \caption{
80     A schematic of the evolution in time of the pressure method
81     algorithm. A prediction for the flow variables at time level $n+1$ is
82     made based only on the explicit terms, $G^{(n+^1/_2)}$, and denoted
83     $u^*$, $v^*$. Next, a pressure field is found such that $u^{n+1}$,
84 cnh 1.9 $v^{n+1}$ will be non-divergent. Conceptually, the $*$ quantities
85 adcroft 1.8 exist at time level $n+1$ but they are intermediate and only
86     temporary.}
87     \label{fig:pressure-method-rigid-lid}
88     \end{figure}
89    
90     \begin{figure}
91     \begin{center} \fbox{ \begin{minipage}{4.5in} \begin{tabbing}
92     aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
93 edhill 1.16 \filelink{FORWARD\_STEP}{model-src-forward_step.F} \\
94 adcroft 1.8 \> DYNAMICS \\
95     \>\> TIMESTEP \` $u^*$,$v^*$ (\ref{eq:ustar-rigid-lid},\ref{eq:vstar-rigid-lid}) \\
96     \> SOLVE\_FOR\_PRESSURE \\
97     \>\> CALC\_DIV\_GHAT \` $H\widehat{u^*}$,$H\widehat{v^*}$ (\ref{eq:elliptic}) \\
98     \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic}) \\
99 jmc 1.17 \> MOMENTUM\_CORRECTION\_STEP \\
100 adcroft 1.8 \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1}$ \\
101     \>\> CORRECTION\_STEP \` $u^{n+1}$,$v^{n+1}$ (\ref{eq:un+1-rigid-lid},\ref{eq:vn+1-rigid-lid})
102     \end{tabbing} \end{minipage} } \end{center}
103 edhill 1.16 \caption{Calling tree for the pressure method algorithm
104     (\filelink{FORWARD\_STEP}{model-src-forward_step.F})}
105 adcroft 1.8 \label{fig:call-tree-pressure-method}
106     \end{figure}
107    
108     The horizontal momentum and continuity equations for the ocean
109     (\ref{eq:ocean-mom} and \ref{eq:ocean-cont}), or for the atmosphere
110     (\ref{eq:atmos-mom} and \ref{eq:atmos-cont}), can be summarized by:
111     \begin{eqnarray}
112     \partial_t u + g \partial_x \eta & = & G_u \\
113     \partial_t v + g \partial_y \eta & = & G_v \\
114     \partial_x u + \partial_y v + \partial_z w & = & 0
115     \end{eqnarray}
116     where we are adopting the oceanic notation for brevity. All terms in
117     the momentum equations, except for surface pressure gradient, are
118     encapsulated in the $G$ vector. The continuity equation, when
119     integrated over the fluid depth, $H$, and with the rigid-lid/no normal
120     flow boundary conditions applied, becomes:
121     \begin{equation}
122     \partial_x H \widehat{u} + \partial_y H \widehat{v} = 0
123     \label{eq:rigid-lid-continuity}
124     \end{equation}
125     Here, $H\widehat{u} = \int_H u dz$ is the depth integral of $u$,
126 cnh 1.9 similarly for $H\widehat{v}$. The rigid-lid approximation sets $w=0$
127 adcroft 1.8 at the lid so that it does not move but allows a pressure to be
128     exerted on the fluid by the lid. The horizontal momentum equations and
129     vertically integrated continuity equation are be discretized in time
130     and space as follows:
131 adcroft 1.1 \begin{eqnarray}
132 adcroft 1.8 u^{n+1} + \Delta t g \partial_x \eta^{n+1}
133     & = & u^{n} + \Delta t G_u^{(n+1/2)}
134     \label{eq:discrete-time-u}
135     \\
136     v^{n+1} + \Delta t g \partial_y \eta^{n+1}
137     & = & v^{n} + \Delta t G_v^{(n+1/2)}
138     \label{eq:discrete-time-v}
139     \\
140     \partial_x H \widehat{u^{n+1}}
141     + \partial_y H \widehat{v^{n+1}} & = & 0
142     \label{eq:discrete-time-cont-rigid-lid}
143 adcroft 1.1 \end{eqnarray}
144 adcroft 1.8 As written here, terms on the LHS all involve time level $n+1$ and are
145     referred to as implicit; the implicit backward time stepping scheme is
146     being used. All other terms in the RHS are explicit in time. The
147     thermodynamic quantities are integrated forward in time in parallel
148     with the flow and will be discussed later. For the purposes of
149     describing the pressure method it suffices to say that the hydrostatic
150     pressure gradient is explicit and so can be included in the vector
151     $G$.
152    
153     Substituting the two momentum equations into the depth integrated
154 cnh 1.9 continuity equation eliminates $u^{n+1}$ and $v^{n+1}$ yielding an
155 adcroft 1.8 elliptic equation for $\eta^{n+1}$. Equations
156     \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} and
157     \ref{eq:discrete-time-cont-rigid-lid} can then be re-arranged as follows:
158     \begin{eqnarray}
159     u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-rigid-lid} \\
160     v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-rigid-lid} \\
161     \partial_x \Delta t g H \partial_x \eta^{n+1}
162     + \partial_y \Delta t g H \partial_y \eta^{n+1}
163 adcroft 1.1 & = &
164 adcroft 1.8 \partial_x H \widehat{u^{*}}
165     + \partial_y H \widehat{v^{*}} \label{eq:elliptic}
166 adcroft 1.1 \\
167 adcroft 1.8 u^{n+1} & = & u^{*} - \Delta t g \partial_x \eta^{n+1} \label{eq:un+1-rigid-lid}\\
168     v^{n+1} & = & v^{*} - \Delta t g \partial_y \eta^{n+1} \label{eq:vn+1-rigid-lid}
169     \end{eqnarray}
170     Equations \ref{eq:ustar-rigid-lid} to \ref{eq:vn+1-rigid-lid}, solved
171     sequentially, represent the pressure method algorithm used in the
172     model. The essence of the pressure method lies in the fact that any
173     explicit prediction for the flow would lead to a divergence flow field
174     so a pressure field must be found that keeps the flow non-divergent
175     over each step of the integration. The particular location in time of
176     the pressure field is somewhat ambiguous; in
177     Fig.~\ref{fig:pressure-method-rigid-lid} we depicted as co-located
178     with the future flow field (time level $n+1$) but it could equally
179     have been drawn as staggered in time with the flow.
180    
181 cnh 1.9 The correspondence to the code is as follows:
182 adcroft 1.8 \begin{itemize}
183     \item
184     the prognostic phase, equations \ref{eq:ustar-rigid-lid} and \ref{eq:vstar-rigid-lid},
185     stepping forward $u^n$ and $v^n$ to $u^{*}$ and $v^{*}$ is coded in
186 edhill 1.16 \filelink{TIMESTEP()}{model-src-timestep.F}
187 adcroft 1.8 \item
188     the vertical integration, $H \widehat{u^*}$ and $H
189 cnh 1.9 \widehat{v^*}$, divergence and inversion of the elliptic operator in
190 cnh 1.15 equation \ref{eq:elliptic} is coded in
191 edhill 1.16 \filelink{SOLVE\_FOR\_PRESSURE()}{model-src-solve_for_pressure.F}
192 adcroft 1.8 \item
193     finally, the new flow field at time level $n+1$ given by equations
194 cnh 1.15 \ref{eq:un+1-rigid-lid} and \ref{eq:vn+1-rigid-lid} is calculated in
195 edhill 1.16 \filelink{CORRECTION\_STEP()}{model-src-correction_step.F}.
196 adcroft 1.8 \end{itemize}
197     The calling tree for these routines is given in
198     Fig.~\ref{fig:call-tree-pressure-method}.
199    
200    
201    
202     \paragraph{Need to discuss implicit viscosity somewhere:}
203 jmc 1.2 \begin{eqnarray}
204 adcroft 1.8 \frac{1}{\Delta t} u^{n+1} - \partial_z A_v \partial_z u^{n+1}
205     + g \partial_x \eta^{n+1} & = & \frac{1}{\Delta t} u^{n} +
206     G_u^{(n+1/2)}
207     \\
208     \frac{1}{\Delta t} v^{n+1} - \partial_z A_v \partial_z v^{n+1}
209     + g \partial_y \eta^{n+1} & = & \frac{1}{\Delta t} v^{n} + G_v^{(n+1/2)}
210 jmc 1.2 \end{eqnarray}
211 adcroft 1.1
212 jmc 1.4
213 adcroft 1.8 \section{Pressure method with implicit linear free-surface}
214     \label{sect:pressure-method-linear-backward}
215 edhill 1.19 \begin{rawhtml}
216     <!-- CMIREDIR:pressure_method_linear_backward: -->
217     \end{rawhtml}
218 adcroft 1.6
219 adcroft 1.8 The rigid-lid approximation filters out external gravity waves
220     subsequently modifying the dispersion relation of barotropic Rossby
221     waves. The discrete form of the elliptic equation has some zero
222     eigen-values which makes it a potentially tricky or inefficient
223     problem to solve.
224 adcroft 1.6
225 adcroft 1.8 The rigid-lid approximation can be easily replaced by a linearization
226     of the free-surface equation which can be written:
227     \begin{equation}
228     \partial_t \eta + \partial_x H \widehat{u} + \partial_y H \widehat{v} = P-E+R
229 jmc 1.20 \label{eq:linear-free-surface=P-E}
230 adcroft 1.8 \end{equation}
231     which differs from the depth integrated continuity equation with
232     rigid-lid (\ref{eq:rigid-lid-continuity}) by the time-dependent term
233     and fresh-water source term.
234    
235     Equation \ref{eq:discrete-time-cont-rigid-lid} in the rigid-lid
236     pressure method is then replaced by the time discretization of
237 jmc 1.20 \ref{eq:linear-free-surface=P-E} which is:
238 adcroft 1.8 \begin{equation}
239     \eta^{n+1}
240     + \Delta t \partial_x H \widehat{u^{n+1}}
241     + \Delta t \partial_y H \widehat{v^{n+1}}
242     =
243     \eta^{n}
244 jmc 1.20 + \Delta t ( P - E )
245 adcroft 1.8 \label{eq:discrete-time-backward-free-surface}
246     \end{equation}
247     where the use of flow at time level $n+1$ makes the method implicit
248     and backward in time. The is the preferred scheme since it still
249     filters the fast unresolved wave motions by damping them. A centered
250     scheme, such as Crank-Nicholson, would alias the energy of the fast
251     modes onto slower modes of motion.
252    
253     As for the rigid-lid pressure method, equations
254     \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} and
255     \ref{eq:discrete-time-backward-free-surface} can be re-arranged as follows:
256 adcroft 1.1 \begin{eqnarray}
257 adcroft 1.8 u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-backward-free-surface} \\
258     v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-backward-free-surface} \\
259 jmc 1.20 \eta^* & = & \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)- \Delta t
260 adcroft 1.8 \partial_x H \widehat{u^{*}}
261     + \partial_y H \widehat{v^{*}}
262     \\
263     \partial_x g H \partial_x \eta^{n+1}
264 jmc 1.20 & + & \partial_y g H \partial_y \eta^{n+1}
265     - \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
266     =
267 adcroft 1.8 - \frac{\eta^*}{\Delta t^2}
268     \label{eq:elliptic-backward-free-surface}
269 adcroft 1.1 \\
270 adcroft 1.8 u^{n+1} & = & u^{*} - \Delta t g \partial_x \eta^{n+1} \label{eq:un+1-backward-free-surface}\\
271     v^{n+1} & = & v^{*} - \Delta t g \partial_y \eta^{n+1} \label{eq:vn+1-backward-free-surface}
272 adcroft 1.1 \end{eqnarray}
273 adcroft 1.8 Equations~\ref{eq:ustar-backward-free-surface}
274     to~\ref{eq:vn+1-backward-free-surface}, solved sequentially, represent
275     the pressure method algorithm with a backward implicit, linearized
276     free surface. The method is still formerly a pressure method because
277     in the limit of large $\Delta t$ the rigid-lid method is
278 cnh 1.9 recovered. However, the implicit treatment of the free-surface allows
279 adcroft 1.8 the flow to be divergent and for the surface pressure/elevation to
280 cnh 1.9 respond on a finite time-scale (as opposed to instantly). To recover
281 adcroft 1.8 the rigid-lid formulation, we introduced a switch-like parameter,
282     $\epsilon_{fs}$, which selects between the free-surface and rigid-lid;
283     $\epsilon_{fs}=1$ allows the free-surface to evolve; $\epsilon_{fs}=0$
284     imposes the rigid-lid. The evolution in time and location of variables
285     is exactly as it was for the rigid-lid model so that
286     Fig.~\ref{fig:pressure-method-rigid-lid} is still
287     applicable. Similarly, the calling sequence, given in
288     Fig.~\ref{fig:call-tree-pressure-method}, is as for the
289     pressure-method.
290    
291    
292     \section{Explicit time-stepping: Adams-Bashforth}
293     \label{sect:adams-bashforth}
294 edhill 1.19 \begin{rawhtml}
295     <!-- CMIREDIR:adams_bashforth: -->
296     \end{rawhtml}
297 adcroft 1.8
298     In describing the the pressure method above we deferred describing the
299     time discretization of the explicit terms. We have historically used
300     the quasi-second order Adams-Bashforth method for all explicit terms
301     in both the momentum and tracer equations. This is still the default
302     mode of operation but it is now possible to use alternate schemes for
303     tracers (see section \ref{sect:tracer-advection}).
304    
305     \begin{figure}
306     \begin{center} \fbox{ \begin{minipage}{4.5in} \begin{tabbing}
307     aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
308     FORWARD\_STEP \\
309     \> THERMODYNAMICS \\
310     \>\> CALC\_GT \\
311     \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ \\
312 jmc 1.17 \>either\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
313 adcroft 1.8 \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:adams-bashforth2}) \\
314 jmc 1.17 \>or\>\> EXTERNAL\_FORCING \` $G_\theta^{(n+1/2)} = G_\theta^{(n+1/2)} + {\cal Q}$ \\
315 adcroft 1.8 \>\> TIMESTEP\_TRACER \` $\tau^*$ (\ref{eq:taustar}) \\
316     \>\> IMPLDIFF \` $\tau^{(n+1)}$ (\ref{eq:tau-n+1-implicit})
317     \end{tabbing} \end{minipage} } \end{center}
318     \caption{
319     Calling tree for the Adams-Bashforth time-stepping of temperature with
320     implicit diffusion.}
321     \label{fig:call-tree-adams-bashforth}
322     \end{figure}
323    
324     In the previous sections, we summarized an explicit scheme as:
325     \begin{equation}
326     \tau^{*} = \tau^{n} + \Delta t G_\tau^{(n+1/2)}
327     \label{eq:taustar}
328     \end{equation}
329     where $\tau$ could be any prognostic variable ($u$, $v$, $\theta$ or
330     $S$) and $\tau^*$ is an explicit estimate of $\tau^{n+1}$ and would be
331     exact if not for implicit-in-time terms. The parenthesis about $n+1/2$
332     indicates that the term is explicit and extrapolated forward in time
333     and for this we use the quasi-second order Adams-Bashforth method:
334     \begin{equation}
335     G_\tau^{(n+1/2)} = ( 3/2 + \epsilon_{AB}) G_\tau^n
336     - ( 1/2 + \epsilon_{AB}) G_\tau^{n-1}
337     \label{eq:adams-bashforth2}
338     \end{equation}
339     This is a linear extrapolation, forward in time, to
340     $t=(n+1/2+{\epsilon_{AB}})\Delta t$. An extrapolation to the mid-point
341     in time, $t=(n+1/2)\Delta t$, corresponding to $\epsilon_{AB}=0$,
342     would be second order accurate but is weakly unstable for oscillatory
343     terms. A small but finite value for $\epsilon_{AB}$ stabilizes the
344     method. Strictly speaking, damping terms such as diffusion and
345     dissipation, and fixed terms (forcing), do not need to be inside the
346     Adams-Bashforth extrapolation. However, in the current code, it is
347     simpler to include these terms and this can be justified if the flow
348     and forcing evolves smoothly. Problems can, and do, arise when forcing
349     or motions are high frequency and this corresponds to a reduced
350     stability compared to a simple forward time-stepping of such terms.
351 jmc 1.17 The model offers the possibility to leave the forcing term outside the
352     Adams-Bashforth extrapolation, by turning off the logical flag
353     {\bf forcing\_In\_AB } (parameter file {\em data}, namelist {\em PARM01},
354     default value = True).
355 adcroft 1.8
356     A stability analysis for an oscillation equation should be given at this point.
357     \marginpar{AJA needs to find his notes on this...}
358    
359     A stability analysis for a relaxation equation should be given at this point.
360     \marginpar{...and for this too.}
361    
362    
363     \section{Implicit time-stepping: backward method}
364 edhill 1.19 \begin{rawhtml}
365     <!-- CMIREDIR:implicit_time-stepping_backward: -->
366     \end{rawhtml}
367 adcroft 1.8
368     Vertical diffusion and viscosity can be treated implicitly in time
369 jmc 1.17 using the backward method which is an intrinsic scheme.
370     Recently, the option to treat the vertical advection
371     implicitly has been added, but not yet tested; therefore,
372     the description hereafter is limited to diffusion and viscosity.
373     For tracers,
374 cnh 1.9 the time discretized equation is:
375 adcroft 1.8 \begin{equation}
376     \tau^{n+1} - \Delta t \partial_r \kappa_v \partial_r \tau^{n+1} =
377     \tau^{n} + \Delta t G_\tau^{(n+1/2)}
378     \label{eq:implicit-diffusion}
379     \end{equation}
380     where $G_\tau^{(n+1/2)}$ is the remaining explicit terms extrapolated
381     using the Adams-Bashforth method as described above. Equation
382     \ref{eq:implicit-diffusion} can be split split into:
383 adcroft 1.1 \begin{eqnarray}
384 adcroft 1.8 \tau^* & = & \tau^{n} + \Delta t G_\tau^{(n+1/2)}
385     \label{eq:taustar-implicit} \\
386     \tau^{n+1} & = & {\cal L}_\tau^{-1} ( \tau^* )
387     \label{eq:tau-n+1-implicit}
388 adcroft 1.1 \end{eqnarray}
389 adcroft 1.8 where ${\cal L}_\tau^{-1}$ is the inverse of the operator
390 adcroft 1.6 \begin{equation}
391 adcroft 1.8 {\cal L} = \left[ 1 + \Delta t \partial_r \kappa_v \partial_r \right]
392 adcroft 1.6 \end{equation}
393 adcroft 1.8 Equation \ref{eq:taustar-implicit} looks exactly as \ref{eq:taustar}
394     while \ref{eq:tau-n+1-implicit} involves an operator or matrix
395     inversion. By re-arranging \ref{eq:implicit-diffusion} in this way we
396     have cast the method as an explicit prediction step and an implicit
397     step allowing the latter to be inserted into the over all algorithm
398     with minimal interference.
399    
400     Fig.~\ref{fig:call-tree-adams-bashforth} shows the calling sequence for
401     stepping forward a tracer variable such as temperature.
402    
403     In order to fit within the pressure method, the implicit viscosity
404 jmc 1.17 must not alter the barotropic flow. In other words, it can only
405 adcroft 1.8 redistribute momentum in the vertical. The upshot of this is that
406     although vertical viscosity may be backward implicit and
407     unconditionally stable, no-slip boundary conditions may not be made
408     implicit and are thus cast as a an explicit drag term.
409    
410     \section{Synchronous time-stepping: variables co-located in time}
411     \label{sect:adams-bashforth-sync}
412 edhill 1.19 \begin{rawhtml}
413     <!-- CMIREDIR:adams_bashforth_sync: -->
414     \end{rawhtml}
415 adcroft 1.8
416     \begin{figure}
417     \begin{center}
418     \resizebox{5.0in}{!}{\includegraphics{part2/adams-bashforth-sync.eps}}
419     \end{center}
420     \caption{
421     A schematic of the explicit Adams-Bashforth and implicit time-stepping
422     phases of the algorithm. All prognostic variables are co-located in
423 cnh 1.9 time. Explicit tendencies are evaluated at time level $n$ as a
424 adcroft 1.8 function of the state at that time level (dotted arrow). The explicit
425 cnh 1.9 tendency from the previous time level, $n-1$, is used to extrapolate
426     tendencies to $n+1/2$ (dashed arrow). This extrapolated tendency
427 adcroft 1.8 allows variables to be stably integrated forward-in-time to render an
428     estimate ($*$-variables) at the $n+1$ time level (solid
429     arc-arrow). The operator ${\cal L}$ formed from implicit-in-time terms
430     is solved to yield the state variables at time level $n+1$. }
431     \label{fig:adams-bashforth-sync}
432     \end{figure}
433    
434     \begin{figure}
435 jmc 1.17 \begin{center} \fbox{ \begin{minipage}{4.7in} \begin{tabbing}
436 adcroft 1.8 aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
437     FORWARD\_STEP \\
438 jmc 1.17 \>\> EXTERNAL\_FIELDS\_LOAD\\
439     \>\> DO\_ATMOSPHERIC\_PHYS \\
440     \>\> DO\_OCEANIC\_PHYS \\
441 adcroft 1.8 \> THERMODYNAMICS \\
442     \>\> CALC\_GT \\
443     \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ (\ref{eq:Gt-n-sync})\\
444     \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
445     \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:Gt-n+5-sync}) \\
446 jmc 1.20 \>\> TIMESTEP\_TRACER \` $\theta^*$ (\ref{eq:tstar-sync}) \\
447     \>\> IMPLDIFF \` $\theta^{(n+1)}$ (\ref{eq:t-n+1-sync}) \\
448 adcroft 1.8 \> DYNAMICS \\
449     \>\> CALC\_PHI\_HYD \` $\phi_{hyd}^n$ (\ref{eq:phi-hyd-sync}) \\
450     \>\> MOM\_FLUXFORM or MOM\_VECINV \` $G_{\vec{\bf v}}^n$ (\ref{eq:Gv-n-sync})\\
451     \>\> TIMESTEP \` $\vec{\bf v}^*$ (\ref{eq:Gv-n+5-sync}, \ref{eq:vstar-sync}) \\
452     \>\> IMPLDIFF \` $\vec{\bf v}^{**}$ (\ref{eq:vstarstar-sync}) \\
453 jmc 1.17 \> UPDATE\_R\_STAR or UPDATE\_SURF\_DR \` (NonLin-FS only)\\
454 adcroft 1.8 \> SOLVE\_FOR\_PRESSURE \\
455     \>\> CALC\_DIV\_GHAT \` $\eta^*$ (\ref{eq:nstar-sync}) \\
456     \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic-sync}) \\
457 jmc 1.17 \> MOMENTUM\_CORRECTION\_STEP \\
458 adcroft 1.8 \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1}$ \\
459 jmc 1.17 \>\> CORRECTION\_STEP \` $u^{n+1}$,$v^{n+1}$ (\ref{eq:v-n+1-sync})\\
460     \> TRACERS\_CORRECTION\_STEP \\
461     \>\> CYCLE\_TRACER \` $\theta^{n+1}$ \\
462     \>\> FILTER \` Shapiro Filter, Zonal Filter (FFT) \\
463     \>\> CONVECTIVE\_ADJUSTMENT \` \\
464 adcroft 1.8 \end{tabbing} \end{minipage} } \end{center}
465     \caption{
466     Calling tree for the overall synchronous algorithm using
467 jmc 1.17 Adams-Bashforth time-stepping.
468     The place where the model geometry
469 jmc 1.20 ({\bf hFac} factors) is updated is added here but is only relevant
470 jmc 1.17 for the non-linear free-surface algorithm.
471     For completeness, the external forcing,
472     ocean and atmospheric physics have been added, although they are mainly
473     optional}
474 adcroft 1.8 \label{fig:call-tree-adams-bashforth-sync}
475     \end{figure}
476    
477 cnh 1.9 The Adams-Bashforth extrapolation of explicit tendencies fits neatly
478 adcroft 1.8 into the pressure method algorithm when all state variables are
479 cnh 1.9 co-located in time. Fig.~\ref{fig:adams-bashforth-sync} illustrates
480 adcroft 1.8 the location of variables in time and the evolution of the algorithm
481     with time. The algorithm can be represented by the sequential solution
482     of the follow equations:
483     \begin{eqnarray}
484     G_{\theta,S}^{n} & = & G_{\theta,S} ( u^n, \theta^n, S^n )
485     \label{eq:Gt-n-sync} \\
486     G_{\theta,S}^{(n+1/2)} & = & (3/2+\epsilon_{AB}) G_{\theta,S}^{n}-(1/2+\epsilon_{AB}) G_{\theta,S}^{n-1}
487     \label{eq:Gt-n+5-sync} \\
488     (\theta^*,S^*) & = & (\theta^{n},S^{n}) + \Delta t G_{\theta,S}^{(n+1/2)}
489     \label{eq:tstar-sync} \\
490     (\theta^{n+1},S^{n+1}) & = & {\cal L}^{-1}_{\theta,S} (\theta^*,S^*)
491     \label{eq:t-n+1-sync} \\
492     \phi^n_{hyd} & = & \int b(\theta^n,S^n) dr
493     \label{eq:phi-hyd-sync} \\
494     \vec{\bf G}_{\vec{\bf v}}^{n} & = & \vec{\bf G}_{\vec{\bf v}} ( \vec{\bf v}^n, \phi^n_{hyd} )
495     \label{eq:Gv-n-sync} \\
496     \vec{\bf G}_{\vec{\bf v}}^{(n+1/2)} & = & (3/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n} - (1/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n-1}
497     \label{eq:Gv-n+5-sync} \\
498     \vec{\bf v}^{*} & = & \vec{\bf v}^{n} + \Delta t \vec{\bf G}_{\vec{\bf v}}^{(n+1/2)}
499     \label{eq:vstar-sync} \\
500     \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )
501     \label{eq:vstarstar-sync} \\
502 jmc 1.17 \eta^* & = & \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)- \Delta t
503 adcroft 1.8 \nabla \cdot H \widehat{ \vec{\bf v}^{**} }
504     \label{eq:nstar-sync} \\
505 jmc 1.17 \nabla \cdot g H \nabla \eta^{n+1} & - & \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
506     ~ = ~ - \frac{\eta^*}{\Delta t^2}
507 adcroft 1.8 \label{eq:elliptic-sync} \\
508     \vec{\bf v}^{n+1} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1}
509     \label{eq:v-n+1-sync}
510     \end{eqnarray}
511     Fig.~\ref{fig:adams-bashforth-sync} illustrates the location of
512     variables in time and evolution of the algorithm with time. The
513 cnh 1.9 Adams-Bashforth extrapolation of the tracer tendencies is illustrated
514     by the dashed arrow, the prediction at $n+1$ is indicated by the
515 adcroft 1.8 solid arc. Inversion of the implicit terms, ${\cal
516     L}^{-1}_{\theta,S}$, then yields the new tracer fields at $n+1$. All
517     these operations are carried out in subroutine {\em THERMODYNAMICS} an
518     subsidiaries, which correspond to equations \ref{eq:Gt-n-sync} to
519     \ref{eq:t-n+1-sync}.
520     Similarly illustrated is the Adams-Bashforth extrapolation of
521     accelerations, stepping forward and solving of implicit viscosity and
522     surface pressure gradient terms, corresponding to equations
523     \ref{eq:Gv-n-sync} to \ref{eq:v-n+1-sync}.
524     These operations are carried out in subroutines {\em DYNAMCIS}, {\em
525 jmc 1.17 SOLVE\_FOR\_PRESSURE} and {\em MOMENTUM\_CORRECTION\_STEP}. This, then,
526 adcroft 1.8 represents an entire algorithm for stepping forward the model one
527     time-step. The corresponding calling tree is given in
528     \ref{fig:call-tree-adams-bashforth-sync}.
529    
530     \section{Staggered baroclinic time-stepping}
531     \label{sect:adams-bashforth-staggered}
532 edhill 1.19 \begin{rawhtml}
533     <!-- CMIREDIR:adams_bashforth_staggered: -->
534     \end{rawhtml}
535 adcroft 1.8
536     \begin{figure}
537     \begin{center}
538     \resizebox{5.5in}{!}{\includegraphics{part2/adams-bashforth-staggered.eps}}
539     \end{center}
540     \caption{
541     A schematic of the explicit Adams-Bashforth and implicit time-stepping
542     phases of the algorithm but with staggering in time of thermodynamic
543 jmc 1.18 variables with the flow.
544     Explicit momentum tendencies are evaluated at time level $n-1/2$ as a
545     function of the flow field at that time level $n-1/2$.
546     The explicit tendency from the previous time level, $n-3/2$, is used to
547     extrapolate tendencies to $n$ (dashed arrow).
548     The hydrostatic pressure/geo-potential $\phi_{hyd}$ is evaluated directly
549     at time level $n$ (vertical arrows) and used with the extrapolated tendencies
550     to step forward the flow variables from $n-1/2$ to $n+1/2$ (solid arc-arrow).
551 jmc 1.20 The implicit-in-time operator ${\cal L}_{\bf u,v}$ (vertical arrows) is
552 jmc 1.18 then applied to the previous estimation of the the flow field ($*$-variables)
553     and yields to the two velocity components $u,v$ at time level $n+1/2$.
554     These are then used to calculate the advection term (dashed arc-arrow)
555     of the thermo-dynamics tendencies at time step $n$.
556     The extrapolated thermodynamics tendency, from time level $n-1$ and $n$
557     to $n+1/2$, allows thermodynamic variables to be stably integrated
558     forward-in-time (solid arc-arrow) up to time level $n+1$.
559     }
560 adcroft 1.8 \label{fig:adams-bashforth-staggered}
561     \end{figure}
562    
563     For well stratified problems, internal gravity waves may be the
564     limiting process for determining a stable time-step. In the
565     circumstance, it is more efficient to stagger in time the
566     thermodynamic variables with the flow
567     variables. Fig.~\ref{fig:adams-bashforth-staggered} illustrates the
568 cnh 1.9 staggering and algorithm. The key difference between this and
569 jmc 1.17 Fig.~\ref{fig:adams-bashforth-sync} is that the thermodynamic variables
570     are solved after the dynamics, using the recently updated flow field.
571     This essentially allows the gravity wave terms to leap-frog in
572 adcroft 1.8 time giving second order accuracy and more stability.
573    
574 jmc 1.17 The essential change in the staggered algorithm is that the
575     thermodynamics solver is delayed from half a time step,
576     allowing the use of the most recent velocities to compute
577     the advection terms. Once the thermodynamics fields are
578     updated, the hydrostatic pressure is computed
579 jmc 1.20 to step forwrad the dynamics.
580 jmc 1.17 Note that the pressure gradient must also be taken out of the
581 cnh 1.9 Adams-Bashforth extrapolation. Also, retaining the integer time-levels,
582 adcroft 1.8 $n$ and $n+1$, does not give a user the sense of where variables are
583     located in time. Instead, we re-write the entire algorithm,
584     \ref{eq:Gt-n-sync} to \ref{eq:v-n+1-sync}, annotating the
585     position in time of variables appropriately:
586     \begin{eqnarray}
587 jmc 1.20 \phi^{n}_{hyd} & = & \int b(\theta^{n},S^{n}) dr
588     \label{eq:phi-hyd-staggered} \\
589 jmc 1.17 \vec{\bf G}_{\vec{\bf v}}^{n-1/2} & = & \vec{\bf G}_{\vec{\bf v}} ( \vec{\bf v}^{n-1/2} )
590 adcroft 1.8 \label{eq:Gv-n-staggered} \\
591 jmc 1.17 \vec{\bf G}_{\vec{\bf v}}^{(n)} & = & (3/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n-1/2} - (1/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n-3/2}
592 adcroft 1.8 \label{eq:Gv-n+5-staggered} \\
593 jmc 1.17 \vec{\bf v}^{*} & = & \vec{\bf v}^{n-1/2} + \Delta t \left( \vec{\bf G}_{\vec{\bf v}}^{(n)} - \nabla \phi_{hyd}^{n} \right)
594 adcroft 1.8 \label{eq:vstar-staggered} \\
595     \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )
596     \label{eq:vstarstar-staggered} \\
597 jmc 1.17 \eta^* & = & \epsilon_{fs} \left( \eta^{n-1/2} + \Delta t (P-E)^n \right)- \Delta t
598 adcroft 1.8 \nabla \cdot H \widehat{ \vec{\bf v}^{**} }
599     \label{eq:nstar-staggered} \\
600 jmc 1.17 \nabla \cdot g H \nabla \eta^{n+1/2} & - & \frac{\epsilon_{fs} \eta^{n+1/2}}{\Delta t^2}
601     ~ = ~ - \frac{\eta^*}{\Delta t^2}
602 adcroft 1.8 \label{eq:elliptic-staggered} \\
603 jmc 1.17 \vec{\bf v}^{n+1/2} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1/2}
604     \label{eq:v-n+1-staggered} \\
605     G_{\theta,S}^{n} & = & G_{\theta,S} ( u^{n+1/2}, \theta^{n}, S^{n} )
606     \label{eq:Gt-n-staggered} \\
607     G_{\theta,S}^{(n+1/2)} & = & (3/2+\epsilon_{AB}) G_{\theta,S}^{n}-(1/2+\epsilon_{AB}) G_{\theta,S}^{n-1}
608     \label{eq:Gt-n+5-staggered} \\
609     (\theta^*,S^*) & = & (\theta^{n},S^{n}) + \Delta t G_{\theta,S}^{(n+1/2)}
610     \label{eq:tstar-staggered} \\
611     (\theta^{n+1},S^{n+1}) & = & {\cal L}^{-1}_{\theta,S} (\theta^*,S^*)
612 edhill 1.23 \label{eq:t-n+1-staggered}
613 adcroft 1.8 \end{eqnarray}
614 jmc 1.17 The corresponding calling tree is given in
615     \ref{fig:call-tree-adams-bashforth-staggered}.
616     The staggered algorithm is activated with the run-time flag
617 jmc 1.20 {\bf staggerTimeStep}{\em=.TRUE.} in parameter file {\em data},
618 jmc 1.17 namelist {\em PARM01}.
619    
620     \begin{figure}
621     \begin{center} \fbox{ \begin{minipage}{4.7in} \begin{tabbing}
622     aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
623     FORWARD\_STEP \\
624     \>\> EXTERNAL\_FIELDS\_LOAD\\
625     \>\> DO\_ATMOSPHERIC\_PHYS \\
626     \>\> DO\_OCEANIC\_PHYS \\
627     \> DYNAMICS \\
628     \>\> CALC\_PHI\_HYD \` $\phi_{hyd}^n$ (\ref{eq:phi-hyd-staggered}) \\
629     \>\> MOM\_FLUXFORM or MOM\_VECINV \` $G_{\vec{\bf v}}^{n-1/2}$
630     (\ref{eq:Gv-n-staggered})\\
631     \>\> TIMESTEP \` $\vec{\bf v}^*$ (\ref{eq:Gv-n+5-staggered},
632     \ref{eq:vstar-staggered}) \\
633     \>\> IMPLDIFF \` $\vec{\bf v}^{**}$ (\ref{eq:vstarstar-staggered}) \\
634     \> UPDATE\_R\_STAR or UPDATE\_SURF\_DR \` (NonLin-FS only)\\
635     \> SOLVE\_FOR\_PRESSURE \\
636     \>\> CALC\_DIV\_GHAT \` $\eta^*$ (\ref{eq:nstar-staggered}) \\
637     \>\> CG2D \` $\eta^{n+1/2}$ (\ref{eq:elliptic-staggered}) \\
638     \> MOMENTUM\_CORRECTION\_STEP \\
639     \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1/2}$ \\
640     \>\> CORRECTION\_STEP \` $u^{n+1/2}$,$v^{n+1/2}$ (\ref{eq:v-n+1-staggered})\\
641     \> THERMODYNAMICS \\
642     \>\> CALC\_GT \\
643     \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$
644     (\ref{eq:Gt-n-staggered})\\
645     \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
646     \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:Gt-n+5-staggered}) \\
647 jmc 1.20 \>\> TIMESTEP\_TRACER \` $\theta^*$ (\ref{eq:tstar-staggered}) \\
648     \>\> IMPLDIFF \` $\theta^{(n+1)}$ (\ref{eq:t-n+1-staggered}) \\
649 jmc 1.17 \> TRACERS\_CORRECTION\_STEP \\
650     \>\> CYCLE\_TRACER \` $\theta^{n+1}$ \\
651     \>\> FILTER \` Shapiro Filter, Zonal Filter (FFT) \\
652     \>\> CONVECTIVE\_ADJUSTMENT \` \\
653     \end{tabbing} \end{minipage} } \end{center}
654     \caption{
655     Calling tree for the overall staggered algorithm using
656     Adams-Bashforth time-stepping.
657     The place where the model geometry
658 jmc 1.20 ({\bf hFac} factors) is updated is added here but is only relevant
659 jmc 1.17 for the non-linear free-surface algorithm.
660     }
661     \label{fig:call-tree-adams-bashforth-staggered}
662     \end{figure}
663 adcroft 1.7
664 adcroft 1.8 The only difficulty with this approach is apparent in equation
665 adcroft 1.11 \ref{eq:Gt-n-staggered} and illustrated by the dotted arrow
666 jmc 1.18 connecting $u,v^{n+1/2}$ with $G_\theta^{n}$. The flow used to advect
667 adcroft 1.8 tracers around is not naturally located in time. This could be avoided
668     by applying the Adams-Bashforth extrapolation to the tracer field
669 adcroft 1.14 itself and advecting that around but this approach is not yet
670     available. We're not aware of any detrimental effect of this
671     feature. The difficulty lies mainly in interpretation of what
672     time-level variables and terms correspond to.
673 adcroft 1.7
674    
675 adcroft 1.8 \section{Non-hydrostatic formulation}
676     \label{sect:non-hydrostatic}
677 edhill 1.19 \begin{rawhtml}
678     <!-- CMIREDIR:non-hydrostatic_formulation: -->
679     \end{rawhtml}
680 adcroft 1.7
681 adcroft 1.14 The non-hydrostatic formulation re-introduces the full vertical
682     momentum equation and requires the solution of a 3-D elliptic
683     equations for non-hydrostatic pressure perturbation. We still
684     intergrate vertically for the hydrostatic pressure and solve a 2-D
685     elliptic equation for the surface pressure/elevation for this reduces
686     the amount of work needed to solve for the non-hydrostatic pressure.
687 adcroft 1.7
688 adcroft 1.14 The momentum equations are discretized in time as follows:
689     \begin{eqnarray}
690     \frac{1}{\Delta t} u^{n+1} + g \partial_x \eta^{n+1} + \partial_x \phi_{nh}^{n+1}
691     & = & \frac{1}{\Delta t} u^{n} + G_u^{(n+1/2)} \label{eq:discrete-time-u-nh} \\
692     \frac{1}{\Delta t} v^{n+1} + g \partial_y \eta^{n+1} + \partial_y \phi_{nh}^{n+1}
693     & = & \frac{1}{\Delta t} v^{n} + G_v^{(n+1/2)} \label{eq:discrete-time-v-nh} \\
694     \frac{1}{\Delta t} w^{n+1} + \partial_r \phi_{nh}^{n+1}
695 edhill 1.24 & = & \frac{1}{\Delta t} w^{n} + G_w^{(n+1/2)} \label{eq:discrete-time-w-nh}
696 adcroft 1.14 \end{eqnarray}
697     which must satisfy the discrete-in-time depth integrated continuity,
698     equation~\ref{eq:discrete-time-backward-free-surface} and the local continuity equation
699     \begin{equation}
700     \partial_x u^{n+1} + \partial_y v^{n+1} + \partial_r w^{n+1} = 0
701     \label{eq:non-divergence-nh}
702     \end{equation}
703     As before, the explicit predictions for momentum are consolidated as:
704     \begin{eqnarray*}
705     u^* & = & u^n + \Delta t G_u^{(n+1/2)} \\
706     v^* & = & v^n + \Delta t G_v^{(n+1/2)} \\
707     w^* & = & w^n + \Delta t G_w^{(n+1/2)}
708     \end{eqnarray*}
709     but this time we introduce an intermediate step by splitting the
710     tendancy of the flow as follows:
711     \begin{eqnarray}
712     u^{n+1} = u^{**} - \Delta t \partial_x \phi_{nh}^{n+1}
713     & &
714     u^{**} = u^{*} - \Delta t g \partial_x \eta^{n+1} \\
715     v^{n+1} = v^{**} - \Delta t \partial_y \phi_{nh}^{n+1}
716     & &
717     v^{**} = v^{*} - \Delta t g \partial_y \eta^{n+1}
718     \end{eqnarray}
719     Substituting into the depth integrated continuity
720     (equation~\ref{eq:discrete-time-backward-free-surface}) gives
721     \begin{equation}
722     \partial_x H \partial_x \left( g \eta^{n+1} + \widehat{\phi}_{nh}^{n+1} \right)
723     +
724     \partial_y H \partial_y \left( g \eta^{n+1} + \widehat{\phi}_{nh}^{n+1} \right)
725     - \frac{\epsilon_{fs}\eta^*}{\Delta t^2}
726     = - \frac{\eta^*}{\Delta t^2}
727     \end{equation}
728     which is approximated by equation
729     \ref{eq:elliptic-backward-free-surface} on the basis that i)
730     $\phi_{nh}^{n+1}$ is not yet known and ii) $\nabla \widehat{\phi}_{nh}
731     << g \nabla \eta$. If \ref{eq:elliptic-backward-free-surface} is
732     solved accurately then the implication is that $\widehat{\phi}_{nh}
733     \approx 0$ so that thet non-hydrostatic pressure field does not drive
734     barotropic motion.
735    
736     The flow must satisfy non-divergence
737     (equation~\ref{eq:non-divergence-nh}) locally, as well as depth
738     integrated, and this constraint is used to form a 3-D elliptic
739     equations for $\phi_{nh}^{n+1}$:
740     \begin{equation}
741     \partial_{xx} \phi_{nh}^{n+1} + \partial_{yy} \phi_{nh}^{n+1} +
742     \partial_{rr} \phi_{nh}^{n+1} =
743     \partial_x u^{**} + \partial_y v^{**} + \partial_r w^{*}
744     \end{equation}
745    
746     The entire algorithm can be summarized as the sequential solution of
747     the following equations:
748     \begin{eqnarray}
749     u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-nh} \\
750     v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-nh} \\
751     w^{*} & = & w^{n} + \Delta t G_w^{(n+1/2)} \label{eq:wstar-nh} \\
752 jmc 1.17 \eta^* ~ = ~ \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)
753     & - & \Delta t
754 adcroft 1.14 \partial_x H \widehat{u^{*}}
755     + \partial_y H \widehat{v^{*}}
756     \\
757     \partial_x g H \partial_x \eta^{n+1}
758     + \partial_y g H \partial_y \eta^{n+1}
759 jmc 1.17 & - & \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
760     ~ = ~
761 adcroft 1.14 - \frac{\eta^*}{\Delta t^2}
762     \label{eq:elliptic-nh}
763     \\
764     u^{**} & = & u^{*} - \Delta t g \partial_x \eta^{n+1} \label{eq:unx-nh}\\
765     v^{**} & = & v^{*} - \Delta t g \partial_y \eta^{n+1} \label{eq:vnx-nh}\\
766     \partial_{xx} \phi_{nh}^{n+1} + \partial_{yy} \phi_{nh}^{n+1} +
767     \partial_{rr} \phi_{nh}^{n+1} & = &
768     \partial_x u^{**} + \partial_y v^{**} + \partial_r w^{*} \\
769     u^{n+1} & = & u^{**} - \Delta t \partial_x \phi_{nh}^{n+1} \label{eq:un+1-nh}\\
770     v^{n+1} & = & v^{**} - \Delta t \partial_y \phi_{nh}^{n+1} \label{eq:vn+1-nh}\\
771     \partial_r w^{n+1} & = & - \partial_x u^{n+1} - \partial_y v^{n+1}
772     \end{eqnarray}
773     where the last equation is solved by vertically integrating for
774     $w^{n+1}$.
775 adcroft 1.7
776 adcroft 1.1
777    
778 adcroft 1.8 \section{Variants on the Free Surface}
779 jmc 1.20 \label{sect:free-surface}
780 adcroft 1.1
781 cnh 1.9 We now describe the various formulations of the free-surface that
782 adcroft 1.8 include non-linear forms, implicit in time using Crank-Nicholson,
783     explicit and [one day] split-explicit. First, we'll reiterate the
784     underlying algorithm but this time using the notation consistent with
785     the more general vertical coordinate $r$. The elliptic equation for
786 cnh 1.9 free-surface coordinate (units of $r$), corresponding to
787 adcroft 1.8 \ref{eq:discrete-time-backward-free-surface}, and
788     assuming no non-hydrostatic effects ($\epsilon_{nh} = 0$) is:
789 jmc 1.2 \begin{eqnarray}
790 adcroft 1.1 \epsilon_{fs} {\eta}^{n+1} -
791 adcroft 1.8 {\bf \nabla}_h \cdot \Delta t^2 (R_o-R_{fixed}) {\bf \nabla}_h b_s
792     {\eta}^{n+1} = {\eta}^*
793 jmc 1.4 \label{eq-solve2D}
794 jmc 1.2 \end{eqnarray}
795 adcroft 1.1 where
796 jmc 1.2 \begin{eqnarray}
797 adcroft 1.1 {\eta}^* = \epsilon_{fs} \: {\eta}^{n} -
798 jmc 1.5 \Delta t {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o} \vec{\bf v}^* dr
799 jmc 1.25 \: + \: \epsilon_{fw} \Delta t (P-E)^{n}
800 jmc 1.4 \label{eq-solve2D_rhs}
801 jmc 1.2 \end{eqnarray}
802 adcroft 1.1
803 adcroft 1.7 \fbox{ \begin{minipage}{4.75in}
804     {\em S/R SOLVE\_FOR\_PRESSURE} ({\em solve\_for\_pressure.F})
805    
806 jmc 1.25 $u^*$: {\bf gU} ({\em DYNVARS.h})
807 adcroft 1.7
808 jmc 1.25 $v^*$: {\bf gV} ({\em DYNVARS.h})
809 adcroft 1.7
810     $\eta^*$: {\bf cg2d\_b} (\em SOLVE\_FOR\_PRESSURE.h)
811    
812     $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h)
813    
814     \end{minipage} }
815    
816    
817 adcroft 1.6 Once ${\eta}^{n+1}$ has been found, substituting into
818 jmc 1.21 \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} yields $\vec{\bf v}^{n+1}$
819     if the model is hydrostatic ($\epsilon_{nh}=0$):
820 adcroft 1.1 $$
821     \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
822 jmc 1.3 - \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}
823 adcroft 1.1 $$
824    
825     This is known as the correction step. However, when the model is
826     non-hydrostatic ($\epsilon_{nh}=1$) we need an additional step and an
827 adcroft 1.6 additional equation for $\phi'_{nh}$. This is obtained by substituting
828 adcroft 1.14 \ref{eq:discrete-time-u-nh}, \ref{eq:discrete-time-v-nh} and \ref{eq:discrete-time-w-nh}
829 adcroft 1.12 into continuity:
830 adcroft 1.1 \begin{equation}
831 jmc 1.3 \left[ {\bf \nabla}_h^2 + \partial_{rr} \right] {\phi'_{nh}}^{n+1}
832 adcroft 1.1 = \frac{1}{\Delta t} \left(
833 jmc 1.3 {\bf \nabla}_h \cdot \vec{\bf v}^{**} + \partial_r \dot{r}^* \right)
834 adcroft 1.1 \end{equation}
835     where
836     \begin{displaymath}
837 jmc 1.3 \vec{\bf v}^{**} = \vec{\bf v}^* - \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}
838 adcroft 1.1 \end{displaymath}
839     Note that $\eta^{n+1}$ is also used to update the second RHS term
840     $\partial_r \dot{r}^* $ since
841     the vertical velocity at the surface ($\dot{r}_{surf}$)
842     is evaluated as $(\eta^{n+1} - \eta^n) / \Delta t$.
843    
844     Finally, the horizontal velocities at the new time level are found by:
845     \begin{equation}
846     \vec{\bf v}^{n+1} = \vec{\bf v}^{**}
847 jmc 1.3 - \epsilon_{nh} \Delta t {\bf \nabla}_h {\phi'_{nh}}^{n+1}
848 adcroft 1.1 \end{equation}
849     and the vertical velocity is found by integrating the continuity
850 adcroft 1.6 equation vertically. Note that, for the convenience of the restart
851     procedure, the vertical integration of the continuity equation has
852     been moved to the beginning of the time step (instead of at the end),
853 adcroft 1.1 without any consequence on the solution.
854    
855 adcroft 1.7 \fbox{ \begin{minipage}{4.75in}
856     {\em S/R CORRECTION\_STEP} ({\em correction\_step.F})
857    
858     $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h)
859    
860 jmc 1.25 $\phi_{nh}^{n+1}$: {\bf phi\_nh} (\em NH\_VARS.h)
861 adcroft 1.7
862 jmc 1.25 $u^*$: {\bf gU} ({\em DYNVARS.h})
863 adcroft 1.7
864 jmc 1.25 $v^*$: {\bf gV} ({\em DYNVARS.h})
865 adcroft 1.7
866     $u^{n+1}$: {\bf uVel} ({\em DYNVARS.h})
867    
868     $v^{n+1}$: {\bf vVel} ({\em DYNVARS.h})
869    
870     \end{minipage} }
871    
872    
873    
874 adcroft 1.6 Regarding the implementation of the surface pressure solver, all
875     computation are done within the routine {\it SOLVE\_FOR\_PRESSURE} and
876     its dependent calls. The standard method to solve the 2D elliptic
877     problem (\ref{eq-solve2D}) uses the conjugate gradient method (routine
878     {\it CG2D}); the solver matrix and conjugate gradient operator are
879     only function of the discretized domain and are therefore evaluated
880     separately, before the time iteration loop, within {\it INI\_CG2D}.
881     The computation of the RHS $\eta^*$ is partly done in {\it
882     CALC\_DIV\_GHAT} and in {\it SOLVE\_FOR\_PRESSURE}.
883    
884     The same method is applied for the non hydrostatic part, using a
885     conjugate gradient 3D solver ({\it CG3D}) that is initialized in {\it
886     INI\_CG3D}. The RHS terms of 2D and 3D problems are computed together
887     at the same point in the code.
888 adcroft 1.7
889 adcroft 1.6
890 adcroft 1.1
891     \subsection{Crank-Nickelson barotropic time stepping}
892 jmc 1.20 \label{sect:freesurf-CrankNick}
893 adcroft 1.1
894 adcroft 1.6 The full implicit time stepping described previously is
895     unconditionally stable but damps the fast gravity waves, resulting in
896     a loss of potential energy. The modification presented now allows one
897     to combine an implicit part ($\beta,\gamma$) and an explicit part
898     ($1-\beta,1-\gamma$) for the surface pressure gradient ($\beta$) and
899     for the barotropic flow divergence ($\gamma$).
900 adcroft 1.1 \\
901     For instance, $\beta=\gamma=1$ is the previous fully implicit scheme;
902     $\beta=\gamma=1/2$ is the non damping (energy conserving), unconditionally
903     stable, Crank-Nickelson scheme; $(\beta,\gamma)=(1,0)$ or $=(0,1)$
904     corresponds to the forward - backward scheme that conserves energy but is
905     only stable for small time steps.\\
906     In the code, $\beta,\gamma$ are defined as parameters, respectively
907 jmc 1.20 {\bf implicSurfPress}, {\bf implicDiv2DFlow}. They are read from
908     the main parameter file "{\em data}" and are set by default to 1,1.
909 adcroft 1.1
910 adcroft 1.12 Equations \ref{eq:ustar-backward-free-surface} --
911     \ref{eq:vn+1-backward-free-surface} are modified as follows:
912 jmc 1.20 \begin{eqnarray*}
913 adcroft 1.1 \frac{ \vec{\bf v}^{n+1} }{ \Delta t }
914 jmc 1.3 + {\bf \nabla}_h b_s [ \beta {\eta}^{n+1} + (1-\beta) {\eta}^{n} ]
915     + \epsilon_{nh} {\bf \nabla}_h {\phi'_{nh}}^{n+1}
916 adcroft 1.1 = \frac{ \vec{\bf v}^* }{ \Delta t }
917 jmc 1.20 \end{eqnarray*}
918     \begin{eqnarray}
919 adcroft 1.1 \epsilon_{fs} \frac{ {\eta}^{n+1} - {\eta}^{n} }{ \Delta t}
920 jmc 1.5 + {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o}
921 adcroft 1.1 [ \gamma \vec{\bf v}^{n+1} + (1-\gamma) \vec{\bf v}^{n}] dr
922     = \epsilon_{fw} (P-E)
923 jmc 1.20 \label{eq:eta-n+1-CrankNick}
924     \end{eqnarray}
925 adcroft 1.1 where:
926     \begin{eqnarray*}
927     \vec{\bf v}^* & = &
928     \vec{\bf v} ^{n} + \Delta t \vec{\bf G}_{\vec{\bf v}} ^{(n+1/2)}
929 jmc 1.3 + (\beta-1) \Delta t {\bf \nabla}_h b_s {\eta}^{n}
930     + \Delta t {\bf \nabla}_h {\phi'_{hyd}}^{(n+1/2)}
931 adcroft 1.1 \\
932     {\eta}^* & = &
933     \epsilon_{fs} {\eta}^{n} + \epsilon_{fw} \Delta t (P-E)
934 jmc 1.5 - \Delta t {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o}
935 adcroft 1.1 [ \gamma \vec{\bf v}^* + (1-\gamma) \vec{\bf v}^{n}] dr
936     \end{eqnarray*}
937     \\
938 adcroft 1.6 In the hydrostatic case ($\epsilon_{nh}=0$), allowing us to find
939     ${\eta}^{n+1}$, thus:
940 adcroft 1.1 $$
941     \epsilon_{fs} {\eta}^{n+1} -
942 jmc 1.5 {\bf \nabla}_h \cdot \beta\gamma \Delta t^2 b_s (R_o - R_{fixed})
943 jmc 1.3 {\bf \nabla}_h {\eta}^{n+1}
944 adcroft 1.1 = {\eta}^*
945     $$
946 jmc 1.20 and then to compute ({\em CORRECTION\_STEP}):
947 adcroft 1.1 $$
948     \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
949 jmc 1.3 - \beta \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}
950 adcroft 1.1 $$
951    
952 jmc 1.20 %The non-hydrostatic part is solved as described previously.
953 adcroft 1.6
954 jmc 1.20 \noindent
955     Notes:
956 adcroft 1.6 \begin{enumerate}
957 jmc 1.20 \item The RHS term of equation \ref{eq:eta-n+1-CrankNick}
958     corresponds the contribution of fresh water flux (P-E)
959     to the free-surface variations ($\epsilon_{fw}=1$,
960     {\bf useRealFreshWater}{\em=TRUE} in parameter file {\em data}).
961     In order to remain consistent with the tracer equation, specially in
962     the non-linear free-surface formulation, this term is also
963     affected by the Crank-Nickelson time stepping. The RHS reads:
964     $\epsilon_{fw} ( \gamma (P-E)^{n+1/2} + (1-\gamma) (P-E)^{n-1/2} )$
965 adcroft 1.6 \item The non-hydrostatic part of the code has not yet been
966 jmc 1.20 updated, and therefore cannot be used with $(\beta,\gamma) \neq (1,1)$.
967 adcroft 1.6 \item The stability criteria with Crank-Nickelson time stepping
968     for the pure linear gravity wave problem in cartesian coordinates is:
969     \begin{itemize}
970     \item $\beta + \gamma < 1$ : unstable
971     \item $\beta \geq 1/2$ and $ \gamma \geq 1/2$ : stable
972     \item $\beta + \gamma \geq 1$ : stable if
973 adcroft 1.1 $$
974     c_{max}^2 (\beta - 1/2)(\gamma - 1/2) + 1 \geq 0
975     $$
976     $$
977     \mbox{with }~
978     %c^2 = 2 g H {\Delta t}^2
979     %(\frac{1-cos 2 \pi / k}{\Delta x^2}
980     %+\frac{1-cos 2 \pi / l}{\Delta y^2})
981     %$$
982     %Practically, the most stringent condition is obtained with $k=l=2$ :
983     %$$
984     c_{max} = 2 \Delta t \: \sqrt{g H} \:
985     \sqrt{ \frac{1}{\Delta x^2} + \frac{1}{\Delta y^2} }
986     $$
987 adcroft 1.6 \end{itemize}
988     \end{enumerate}
989    

  ViewVC Help
Powered by ViewVC 1.1.22