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

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.22