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