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

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

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

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

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22