/[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.8 by adcroft, Fri Oct 5 19:41:08 2001 UTC revision 1.25 by jmc, Wed Jun 28 16:55:53 2006 UTC
# Line 1  Line 1 
1  % $Header$  % $Header$
2  % $Name$  % $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{part2/notation}
14    
15    \section{Time-stepping}
16    \begin{rawhtml}
17    <!-- CMIREDIR:time-stepping: -->
18    \end{rawhtml}
19    
20  The equations of motion integrated by the model involve four  The equations of motion integrated by the model involve four
21  prognostic equations for flow, $u$ and $v$, temperature, $\theta$, and  prognostic equations for flow, $u$ and $v$, temperature, $\theta$, and
22  salt/moisture, $S$, and three diagnostic equations for vertical flow,  salt/moisture, $S$, and three diagnostic equations for vertical flow,
# Line 13  and diagnostic equations requires a mode Line 29  and diagnostic equations requires a mode
29  forward prognostic variables while satisfying constraints imposed by  forward prognostic variables while satisfying constraints imposed by
30  diagnostic equations.  diagnostic equations.
31    
32  Since the model comes in several flavours and formulation, it would be  Since the model comes in several flavors and formulation, it would be
33  confusing to present the model algorithm exactly as written into code  confusing to present the model algorithm exactly as written into code
34  along with all the switches and optional terms. Instead, we present  along with all the switches and optional terms. Instead, we present
35  the algorithm for each of the basic formulations which are:  the algorithm for each of the basic formulations which are:
# Line 37  method, with a rigid-lid model in sectio Line 53  method, with a rigid-lid model in sectio
53  \ref{sect:pressure-method-rigid-lid}. This algorithm is essentially  \ref{sect:pressure-method-rigid-lid}. This algorithm is essentially
54  unchanged, apart for some coefficients, when the rigid lid assumption  unchanged, apart for some coefficients, when the rigid lid assumption
55  is replaced with a linearized implicit free-surface, described in  is replaced with a linearized implicit free-surface, described in
56  section \ref{sect:pressure-method-linear-backward}. These two flavours  section \ref{sect:pressure-method-linear-backward}. These two flavors
57  of the pressure-method encompass all formulations of the model as it  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  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  in section \ref{sect:adams-bashforth} and put into the context of the
# Line 50  treated more exactly, including non-line Line 66  treated more exactly, including non-line
66  described in section \ref{sect:nonlinear-freesurface}.  described in section \ref{sect:nonlinear-freesurface}.
67    
68    
69  \section{Pressure method with rigid-lid} \label{sect:pressure-method-rigid-lid}  \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}  \begin{figure}
76  \begin{center}  \begin{center}
# Line 61  A schematic of the evolution in time of Line 81  A schematic of the evolution in time of
81  algorithm. A prediction for the flow variables at time level $n+1$ is  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  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}$,  $u^*$, $v^*$. Next, a pressure field is found such that $u^{n+1}$,
84  $v^{n+1}$ will be non-divergent. Conceptually, the $*$ quantitites  $v^{n+1}$ will be non-divergent. Conceptually, the $*$ quantities
85  exist at time level $n+1$ but they are intermediate and only  exist at time level $n+1$ but they are intermediate and only
86  temporary.}  temporary.}
87  \label{fig:pressure-method-rigid-lid}  \label{fig:pressure-method-rigid-lid}
# Line 70  temporary.} Line 90  temporary.}
90  \begin{figure}  \begin{figure}
91  \begin{center} \fbox{ \begin{minipage}{4.5in} \begin{tabbing}  \begin{center} \fbox{ \begin{minipage}{4.5in} \begin{tabbing}
92  aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill  aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
93  FORWARD\_STEP \\  \filelink{FORWARD\_STEP}{model-src-forward_step.F} \\
94  \> DYNAMICS \\  \> DYNAMICS \\
95  \>\> TIMESTEP \` $u^*$,$v^*$ (\ref{eq:ustar-rigid-lid},\ref{eq:vstar-rigid-lid}) \\  \>\> TIMESTEP \` $u^*$,$v^*$ (\ref{eq:ustar-rigid-lid},\ref{eq:vstar-rigid-lid}) \\
96  \> SOLVE\_FOR\_PRESSURE \\  \> SOLVE\_FOR\_PRESSURE \\
97  \>\> CALC\_DIV\_GHAT \` $H\widehat{u^*}$,$H\widehat{v^*}$ (\ref{eq:elliptic}) \\  \>\> CALC\_DIV\_GHAT \` $H\widehat{u^*}$,$H\widehat{v^*}$ (\ref{eq:elliptic}) \\
98  \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic}) \\  \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic}) \\
99  \> THE\_CORRECTION\_STEP  \\  \> MOMENTUM\_CORRECTION\_STEP  \\
100  \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1}$ \\  \>\> 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})  \>\> 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}  \end{tabbing} \end{minipage} } \end{center}
103  \caption{Calling tree for the pressure method alogtihm}  \caption{Calling tree for the pressure method algorithm
104      (\filelink{FORWARD\_STEP}{model-src-forward_step.F})}
105  \label{fig:call-tree-pressure-method}  \label{fig:call-tree-pressure-method}
106  \end{figure}  \end{figure}
107    
# Line 102  flow boundary conditions applied, become Line 123  flow boundary conditions applied, become
123  \label{eq:rigid-lid-continuity}  \label{eq:rigid-lid-continuity}
124  \end{equation}  \end{equation}
125  Here, $H\widehat{u} = \int_H u dz$ is the depth integral of $u$,  Here, $H\widehat{u} = \int_H u dz$ is the depth integral of $u$,
126  similarly for $H\widehat{v}$. The rigid-lid approzimation sets $w=0$  similarly for $H\widehat{v}$. The rigid-lid approximation sets $w=0$
127  at the lid so that it does not move but allows a pressure to be  at the lid so that it does not move but allows a pressure to be
128  exerted on the fluid by the lid. The horizontal momentum equations and  exerted on the fluid by the lid. The horizontal momentum equations and
129  vertically integrated continuity equation are be discretized in time  vertically integrated continuity equation are be discretized in time
# Line 130  pressure gradient is explicit and so can Line 151  pressure gradient is explicit and so can
151  $G$.  $G$.
152    
153  Substituting the two momentum equations into the depth integrated  Substituting the two momentum equations into the depth integrated
154  continuity equation eliminates $u^{n+1}$ and $v^{n+1}$ yeilding an  continuity equation eliminates $u^{n+1}$ and $v^{n+1}$ yielding an
155  elliptic equation for $\eta^{n+1}$. Equations  elliptic equation for $\eta^{n+1}$. Equations
156  \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} and  \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} and
157  \ref{eq:discrete-time-cont-rigid-lid} can then be re-arranged as follows:  \ref{eq:discrete-time-cont-rigid-lid} can then be re-arranged as follows:
# Line 157  Fig.~\ref{fig:pressure-method-rigid-lid} Line 178  Fig.~\ref{fig:pressure-method-rigid-lid}
178  with the future flow field (time level $n+1$) but it could equally  with the future flow field (time level $n+1$) but it could equally
179  have been drawn as staggered in time with the flow.  have been drawn as staggered in time with the flow.
180    
181  The correspondance to the code is as follows:  The correspondence to the code is as follows:
182  \begin{itemize}  \begin{itemize}
183  \item  \item
184  the prognostic phase, equations \ref{eq:ustar-rigid-lid} and \ref{eq:vstar-rigid-lid},  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  stepping forward $u^n$ and $v^n$ to $u^{*}$ and $v^{*}$ is coded in
186  {\em TIMESTEP.F}  \filelink{TIMESTEP()}{model-src-timestep.F}
187  \item  \item
188  the vertical integration, $H \widehat{u^*}$ and $H  the vertical integration, $H \widehat{u^*}$ and $H
189  \widehat{v^*}$, divergence and invertion of the elliptic operator in  \widehat{v^*}$, divergence and inversion of the elliptic operator in
190  equation \ref{eq:elliptic} is coded in {\em  equation \ref{eq:elliptic} is coded in
191  SOLVE\_FOR\_PRESSURE.F}  \filelink{SOLVE\_FOR\_PRESSURE()}{model-src-solve_for_pressure.F}
192  \item  \item
193  finally, the new flow field at time level $n+1$ given by equations  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 {\em CORRECTION\_STEP.F}.  \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}  \end{itemize}
197  The calling tree for these routines is given in  The calling tree for these routines is given in
198  Fig.~\ref{fig:call-tree-pressure-method}.  Fig.~\ref{fig:call-tree-pressure-method}.
# Line 190  G_u^{(n+1/2)} Line 212  G_u^{(n+1/2)}
212    
213  \section{Pressure method with implicit linear free-surface}  \section{Pressure method with implicit linear free-surface}
214  \label{sect:pressure-method-linear-backward}  \label{sect:pressure-method-linear-backward}
215    \begin{rawhtml}
216    <!-- CMIREDIR:pressure_method_linear_backward: -->
217    \end{rawhtml}
218    
219  The rigid-lid approximation filters out external gravity waves  The rigid-lid approximation filters out external gravity waves
220  subsequently modifying the dispersion relation of barotropic Rossby  subsequently modifying the dispersion relation of barotropic Rossby
# Line 201  The rigid-lid approximation can be easil Line 226  The rigid-lid approximation can be easil
226  of the free-surface equation which can be written:  of the free-surface equation which can be written:
227  \begin{equation}  \begin{equation}
228  \partial_t \eta + \partial_x H \widehat{u} + \partial_y H \widehat{v} = P-E+R  \partial_t \eta + \partial_x H \widehat{u} + \partial_y H \widehat{v} = P-E+R
229  \label{eq:linear-free-surface=P-E+R}  \label{eq:linear-free-surface=P-E}
230  \end{equation}  \end{equation}
231  which differs from the depth integrated continuity equation with  which differs from the depth integrated continuity equation with
232  rigid-lid (\ref{eq:rigid-lid-continuity}) by the time-dependent term  rigid-lid (\ref{eq:rigid-lid-continuity}) by the time-dependent term
# Line 209  and fresh-water source term. Line 234  and fresh-water source term.
234    
235  Equation \ref{eq:discrete-time-cont-rigid-lid} in the rigid-lid  Equation \ref{eq:discrete-time-cont-rigid-lid} in the rigid-lid
236  pressure method is then replaced by the time discretization of  pressure method is then replaced by the time discretization of
237  \ref{eq:linear-free-surface=P-E+R} which is:  \ref{eq:linear-free-surface=P-E} which is:
238  \begin{equation}  \begin{equation}
239  \eta^{n+1}  \eta^{n+1}
240  + \Delta t \partial_x H \widehat{u^{n+1}}  + \Delta t \partial_x H \widehat{u^{n+1}}
241  + \Delta t \partial_y H \widehat{v^{n+1}}  + \Delta t \partial_y H \widehat{v^{n+1}}
242  =  =
243  \eta^{n}  \eta^{n}
244  + \Delta t ( P - E + R )  + \Delta t ( P - E )
245  \label{eq:discrete-time-backward-free-surface}  \label{eq:discrete-time-backward-free-surface}
246  \end{equation}  \end{equation}
247  where the use of flow at time level $n+1$ makes the method implicit  where the use of flow at time level $n+1$ makes the method implicit
# Line 231  As for the rigid-lid pressure method, eq Line 256  As for the rigid-lid pressure method, eq
256  \begin{eqnarray}  \begin{eqnarray}
257  u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-backward-free-surface} \\  u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-backward-free-surface} \\
258  v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-backward-free-surface} \\  v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-backward-free-surface} \\
259  \eta^* & = & \epsilon_{fs} \left( \eta^{n} +P-E+R \right)- \Delta t  \eta^* & = & \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)- \Delta t
260    \partial_x H \widehat{u^{*}}    \partial_x H \widehat{u^{*}}
261  + \partial_y H \widehat{v^{*}}  + \partial_y H \widehat{v^{*}}
262  \\  \\
263    \partial_x g H \partial_x \eta^{n+1}    \partial_x g H \partial_x \eta^{n+1}
264  + \partial_y g H \partial_y \eta^{n+1}  & + & \partial_y g H \partial_y \eta^{n+1}
265  - \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}   - \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
266  & = &   =
267  - \frac{\eta^*}{\Delta t^2}  - \frac{\eta^*}{\Delta t^2}
268  \label{eq:elliptic-backward-free-surface}  \label{eq:elliptic-backward-free-surface}
269  \\  \\
# Line 250  to~\ref{eq:vn+1-backward-free-surface}, Line 275  to~\ref{eq:vn+1-backward-free-surface},
275  the pressure method algorithm with a backward implicit, linearized  the pressure method algorithm with a backward implicit, linearized
276  free surface. The method is still formerly a pressure method because  free surface. The method is still formerly a pressure method because
277  in the limit of large $\Delta t$ the rigid-lid method is  in the limit of large $\Delta t$ the rigid-lid method is
278  reovered. However, the implicit treatment of the free-surface allows  recovered. However, the implicit treatment of the free-surface allows
279  the flow to be divergent and for the surface pressure/elevation to  the flow to be divergent and for the surface pressure/elevation to
280  respond on a finite time-scale (as opposed to instantly). To recovere  respond on a finite time-scale (as opposed to instantly). To recover
281  the rigid-lid formulation, we introduced a switch-like parameter,  the rigid-lid formulation, we introduced a switch-like parameter,
282  $\epsilon_{fs}$, which selects between the free-surface and rigid-lid;  $\epsilon_{fs}$, which selects between the free-surface and rigid-lid;
283  $\epsilon_{fs}=1$ allows the free-surface to evolve; $\epsilon_{fs}=0$  $\epsilon_{fs}=1$ allows the free-surface to evolve; $\epsilon_{fs}=0$
# Line 266  pressure-method. Line 291  pressure-method.
291    
292  \section{Explicit time-stepping: Adams-Bashforth}  \section{Explicit time-stepping: Adams-Bashforth}
293  \label{sect:adams-bashforth}  \label{sect:adams-bashforth}
294    \begin{rawhtml}
295    <!-- CMIREDIR:adams_bashforth: -->
296    \end{rawhtml}
297    
298  In describing the the pressure method above we deferred describing the  In describing the the pressure method above we deferred describing the
299  time discretization of the explicit terms. We have historically used  time discretization of the explicit terms. We have historically used
# Line 281  FORWARD\_STEP \\ Line 309  FORWARD\_STEP \\
309  \> THERMODYNAMICS \\  \> THERMODYNAMICS \\
310  \>\> CALC\_GT \\  \>\> CALC\_GT \\
311  \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ \\  \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ \\
312  \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\  \>either\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
313  \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:adams-bashforth2}) \\  \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:adams-bashforth2}) \\
314    \>or\>\> EXTERNAL\_FORCING \` $G_\theta^{(n+1/2)} = G_\theta^{(n+1/2)} + {\cal Q}$ \\
315  \>\> TIMESTEP\_TRACER \` $\tau^*$ (\ref{eq:taustar}) \\  \>\> TIMESTEP\_TRACER \` $\tau^*$ (\ref{eq:taustar}) \\
316  \>\> IMPLDIFF \` $\tau^{(n+1)}$ (\ref{eq:tau-n+1-implicit})  \>\> IMPLDIFF \` $\tau^{(n+1)}$ (\ref{eq:tau-n+1-implicit})
317  \end{tabbing} \end{minipage} } \end{center}  \end{tabbing} \end{minipage} } \end{center}
# Line 319  simpler to include these terms and this Line 348  simpler to include these terms and this
348  and forcing evolves smoothly. Problems can, and do, arise when forcing  and forcing evolves smoothly. Problems can, and do, arise when forcing
349  or motions are high frequency and this corresponds to a reduced  or motions are high frequency and this corresponds to a reduced
350  stability compared to a simple forward time-stepping of such terms.  stability compared to a simple forward time-stepping of such terms.
351    The model offers the possibility to leave the forcing term outside the
352    Adams-Bashforth extrapolation, by turning off the logical flag
353    {\bf forcing\_In\_AB } (parameter file {\em data}, namelist {\em PARM01},
354    default value = True).
355    
356  A stability analysis for an oscillation equation should be given at this point.  A stability analysis for an oscillation equation should be given at this point.
357  \marginpar{AJA needs to find his notes on this...}  \marginpar{AJA needs to find his notes on this...}
# Line 328  A stability analysis for a relaxation eq Line 361  A stability analysis for a relaxation eq
361    
362    
363  \section{Implicit time-stepping: backward method}  \section{Implicit time-stepping: backward method}
364    \begin{rawhtml}
365    <!-- CMIREDIR:implicit_time-stepping_backward: -->
366    \end{rawhtml}
367    
368  Vertical diffusion and viscosity can be treated implicitly in time  Vertical diffusion and viscosity can be treated implicitly in time
369  using the backward method which is an intrinsic scheme. For tracers,  using the backward method which is an intrinsic scheme.
370  the time discrretized equation is:  Recently, the option to treat the vertical advection
371    implicitly has been added, but not yet tested; therefore,
372    the description hereafter is limited to diffusion and viscosity.
373    For tracers,
374    the time discretized equation is:
375  \begin{equation}  \begin{equation}
376  \tau^{n+1} - \Delta t \partial_r \kappa_v \partial_r \tau^{n+1} =  \tau^{n+1} - \Delta t \partial_r \kappa_v \partial_r \tau^{n+1} =
377  \tau^{n} + \Delta t G_\tau^{(n+1/2)}  \tau^{n} + \Delta t G_\tau^{(n+1/2)}
# Line 361  Fig.~\ref{fig:call-tree-adams-bashforth} Line 401  Fig.~\ref{fig:call-tree-adams-bashforth}
401  stepping forward a tracer variable such as temperature.  stepping forward a tracer variable such as temperature.
402    
403  In order to fit within the pressure method, the implicit viscosity  In order to fit within the pressure method, the implicit viscosity
404  must not alter the barotropic flow. In other words, it can on ly  must not alter the barotropic flow. In other words, it can only
405  redistribute momentum in the vertical. The upshot of this is that  redistribute momentum in the vertical. The upshot of this is that
406  although vertical viscosity may be backward implicit and  although vertical viscosity may be backward implicit and
407  unconditionally stable, no-slip boundary conditions may not be made  unconditionally stable, no-slip boundary conditions may not be made
# Line 369  implicit and are thus cast as a an expli Line 409  implicit and are thus cast as a an expli
409    
410  \section{Synchronous time-stepping: variables co-located in time}  \section{Synchronous time-stepping: variables co-located in time}
411  \label{sect:adams-bashforth-sync}  \label{sect:adams-bashforth-sync}
412    \begin{rawhtml}
413    <!-- CMIREDIR:adams_bashforth_sync: -->
414    \end{rawhtml}
415    
416  \begin{figure}  \begin{figure}
417  \begin{center}  \begin{center}
# Line 377  implicit and are thus cast as a an expli Line 420  implicit and are thus cast as a an expli
420  \caption{  \caption{
421  A schematic of the explicit Adams-Bashforth and implicit time-stepping  A schematic of the explicit Adams-Bashforth and implicit time-stepping
422  phases of the algorithm. All prognostic variables are co-located in  phases of the algorithm. All prognostic variables are co-located in
423  time. Explicit tendancies are evaluated at time level $n$ as a  time. Explicit tendencies are evaluated at time level $n$ as a
424  function of the state at that time level (dotted arrow). The explicit  function of the state at that time level (dotted arrow). The explicit
425  tendancy from the previous time level, $n-1$, is used to extrapolate  tendency from the previous time level, $n-1$, is used to extrapolate
426  tendancies to $n+1/2$ (dashed arrow). This extrapolated tendancy  tendencies to $n+1/2$ (dashed arrow). This extrapolated tendency
427  allows variables to be stably integrated forward-in-time to render an  allows variables to be stably integrated forward-in-time to render an
428  estimate ($*$-variables) at the $n+1$ time level (solid  estimate ($*$-variables) at the $n+1$ time level (solid
429  arc-arrow). The operator ${\cal L}$ formed from implicit-in-time terms  arc-arrow). The operator ${\cal L}$ formed from implicit-in-time terms
# Line 389  is solved to yield the state variables a Line 432  is solved to yield the state variables a
432  \end{figure}  \end{figure}
433    
434  \begin{figure}  \begin{figure}
435  \begin{center} \fbox{ \begin{minipage}{4.5in} \begin{tabbing}  \begin{center} \fbox{ \begin{minipage}{4.7in} \begin{tabbing}
436  aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill  aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
437  FORWARD\_STEP \\  FORWARD\_STEP \\
438    \>\> EXTERNAL\_FIELDS\_LOAD\\
439    \>\> DO\_ATMOSPHERIC\_PHYS \\
440    \>\> DO\_OCEANIC\_PHYS \\
441  \> THERMODYNAMICS \\  \> THERMODYNAMICS \\
442  \>\> CALC\_GT \\  \>\> CALC\_GT \\
443  \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ (\ref{eq:Gt-n-sync})\\  \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$ (\ref{eq:Gt-n-sync})\\
444  \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\  \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
445  \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:Gt-n+5-sync}) \\  \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:Gt-n+5-sync}) \\
446  \>\> TIMESTEP\_TRACER \` $\tau^*$ (\ref{eq:tstar-sync}) \\  \>\> TIMESTEP\_TRACER \` $\theta^*$ (\ref{eq:tstar-sync}) \\
447  \>\> IMPLDIFF \` $\tau^{(n+1)}$ (\ref{eq:t-n+1-sync}) \\  \>\> IMPLDIFF \` $\theta^{(n+1)}$ (\ref{eq:t-n+1-sync}) \\
448  \> DYNAMICS \\  \> DYNAMICS \\
449  \>\> CALC\_PHI\_HYD \` $\phi_{hyd}^n$ (\ref{eq:phi-hyd-sync}) \\  \>\> CALC\_PHI\_HYD \` $\phi_{hyd}^n$ (\ref{eq:phi-hyd-sync}) \\
450  \>\> MOM\_FLUXFORM or MOM\_VECINV \` $G_{\vec{\bf v}}^n$ (\ref{eq:Gv-n-sync})\\  \>\> MOM\_FLUXFORM or MOM\_VECINV \` $G_{\vec{\bf v}}^n$ (\ref{eq:Gv-n-sync})\\
451  \>\> TIMESTEP \` $\vec{\bf v}^*$ (\ref{eq:Gv-n+5-sync}, \ref{eq:vstar-sync}) \\  \>\> TIMESTEP \` $\vec{\bf v}^*$ (\ref{eq:Gv-n+5-sync}, \ref{eq:vstar-sync}) \\
452  \>\> IMPLDIFF \` $\vec{\bf v}^{**}$ (\ref{eq:vstarstar-sync}) \\  \>\> IMPLDIFF \` $\vec{\bf v}^{**}$ (\ref{eq:vstarstar-sync}) \\
453    \> UPDATE\_R\_STAR or UPDATE\_SURF\_DR \` (NonLin-FS only)\\
454  \> SOLVE\_FOR\_PRESSURE \\  \> SOLVE\_FOR\_PRESSURE \\
455  \>\> CALC\_DIV\_GHAT \` $\eta^*$ (\ref{eq:nstar-sync}) \\  \>\> CALC\_DIV\_GHAT \` $\eta^*$ (\ref{eq:nstar-sync}) \\
456  \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic-sync}) \\  \>\> CG2D \` $\eta^{n+1}$ (\ref{eq:elliptic-sync}) \\
457  \> THE\_CORRECTION\_STEP  \\  \> MOMENTUM\_CORRECTION\_STEP  \\
458  \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1}$ \\  \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1}$ \\
459  \>\> CORRECTION\_STEP \` $u^{n+1}$,$v^{n+1}$ (\ref{eq:v-n+1-sync})  \>\> CORRECTION\_STEP \` $u^{n+1}$,$v^{n+1}$ (\ref{eq:v-n+1-sync})\\
460    \> TRACERS\_CORRECTION\_STEP  \\
461    \>\> CYCLE\_TRACER \` $\theta^{n+1}$ \\
462    \>\> FILTER \` Shapiro Filter, Zonal Filter (FFT) \\
463    \>\> CONVECTIVE\_ADJUSTMENT \` \\
464  \end{tabbing} \end{minipage} } \end{center}  \end{tabbing} \end{minipage} } \end{center}
465  \caption{  \caption{
466  Calling tree for the overall synchronous algorithm using  Calling tree for the overall synchronous algorithm using
467  Adams-Bashforth time-stepping.}  Adams-Bashforth time-stepping.
468    The place where the model geometry
469    ({\bf hFac} factors) is updated is added here but is only relevant
470    for the non-linear free-surface algorithm.
471    For completeness, the external forcing,
472    ocean and atmospheric physics have been added, although they are mainly
473    optional}
474  \label{fig:call-tree-adams-bashforth-sync}  \label{fig:call-tree-adams-bashforth-sync}
475  \end{figure}  \end{figure}
476    
477  The Adams-Bashforth extrapolation of explicit tendancies fits neatly  The Adams-Bashforth extrapolation of explicit tendencies fits neatly
478  into the pressure method algorithm when all state variables are  into the pressure method algorithm when all state variables are
479  co-locacted in time. Fig.~\ref{fig:adams-bashforth-sync} illustrates  co-located in time. Fig.~\ref{fig:adams-bashforth-sync} illustrates
480  the location of variables in time and the evolution of the algorithm  the location of variables in time and the evolution of the algorithm
481  with time. The algorithm can be represented by the sequential solution  with time. The algorithm can be represented by the sequential solution
482  of the follow equations:  of the follow equations:
# Line 442  G_{\theta,S}^{(n+1/2)} & = & (3/2+\epsil Line 499  G_{\theta,S}^{(n+1/2)} & = & (3/2+\epsil
499  \label{eq:vstar-sync} \\  \label{eq:vstar-sync} \\
500  \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )  \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )
501  \label{eq:vstarstar-sync} \\  \label{eq:vstarstar-sync} \\
502  \eta^* & = & \epsilon_{fs} \left( \eta^{n} +P-E+R \right)- \Delta t  \eta^* & = & \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)- \Delta t
503    \nabla \cdot H \widehat{ \vec{\bf v}^{**} }    \nabla \cdot H \widehat{ \vec{\bf v}^{**} }
504  \label{eq:nstar-sync} \\  \label{eq:nstar-sync} \\
505  \nabla \cdot g H \nabla \eta^{n+1} - \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}  \nabla \cdot g H \nabla \eta^{n+1} & - & \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
506  & = & - \frac{\eta^*}{\Delta t^2}  ~ = ~ - \frac{\eta^*}{\Delta t^2}
507  \label{eq:elliptic-sync} \\  \label{eq:elliptic-sync} \\
508  \vec{\bf v}^{n+1} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1}  \vec{\bf v}^{n+1} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1}
509  \label{eq:v-n+1-sync}  \label{eq:v-n+1-sync}
510  \end{eqnarray}  \end{eqnarray}
511  Fig.~\ref{fig:adams-bashforth-sync} illustrates the location of  Fig.~\ref{fig:adams-bashforth-sync} illustrates the location of
512  variables in time and evolution of the algorithm with time. The  variables in time and evolution of the algorithm with time. The
513  Adams-Bashforth extrapolation of the tracer tendancies is illustrated  Adams-Bashforth extrapolation of the tracer tendencies is illustrated
514  byt the dashed arrow, the prediction at $n+1$ is indicated by the  by the dashed arrow, the prediction at $n+1$ is indicated by the
515  solid arc. Inversion of the implicit terms, ${\cal  solid arc. Inversion of the implicit terms, ${\cal
516  L}^{-1}_{\theta,S}$, then yields the new tracer fields at $n+1$. All  L}^{-1}_{\theta,S}$, then yields the new tracer fields at $n+1$. All
517  these operations are carried out in subroutine {\em THERMODYNAMICS} an  these operations are carried out in subroutine {\em THERMODYNAMICS} an
# Line 465  accelerations, stepping forward and solv Line 522  accelerations, stepping forward and solv
522  surface pressure gradient terms, corresponding to equations  surface pressure gradient terms, corresponding to equations
523  \ref{eq:Gv-n-sync} to \ref{eq:v-n+1-sync}.  \ref{eq:Gv-n-sync} to \ref{eq:v-n+1-sync}.
524  These operations are carried out in subroutines {\em DYNAMCIS}, {\em  These operations are carried out in subroutines {\em DYNAMCIS}, {\em
525  SOLVE\_FOR\_PRESSURE} and {\em THE\_CORRECTION\_STEP}. This, then,  SOLVE\_FOR\_PRESSURE} and {\em MOMENTUM\_CORRECTION\_STEP}. This, then,
526  represents an entire algorithm for stepping forward the model one  represents an entire algorithm for stepping forward the model one
527  time-step. The corresponding calling tree is given in  time-step. The corresponding calling tree is given in
528  \ref{fig:call-tree-adams-bashforth-sync}.  \ref{fig:call-tree-adams-bashforth-sync}.
529    
530  \section{Staggered baroclinic time-stepping}  \section{Staggered baroclinic time-stepping}
531  \label{sect:adams-bashforth-staggered}  \label{sect:adams-bashforth-staggered}
532    \begin{rawhtml}
533    <!-- CMIREDIR:adams_bashforth_staggered: -->
534    \end{rawhtml}
535    
536  \begin{figure}  \begin{figure}
537  \begin{center}  \begin{center}
# Line 480  time-step. The corresponding calling tre Line 540  time-step. The corresponding calling tre
540  \caption{  \caption{
541  A schematic of the explicit Adams-Bashforth and implicit time-stepping  A schematic of the explicit Adams-Bashforth and implicit time-stepping
542  phases of the algorithm but with staggering in time of thermodynamic  phases of the algorithm but with staggering in time of thermodynamic
543  variables with the flow. Explicit thermodynamics tendancies are  variables with the flow.
544  evaluated at time level $n-1/2$ as a function of the thermodynamics  Explicit momentum tendencies are evaluated at time level $n-1/2$ as a
545  state at that time level $n$ and flow at time $n$ (dotted arrow). The  function of the flow field at that time level $n-1/2$.
546  explicit tendancy from the previous time level, $n-3/2$, is used to  The explicit tendency from the previous time level, $n-3/2$, is used to
547  extrapolate tendancies to $n$ (dashed arrow). This extrapolated  extrapolate tendencies to $n$ (dashed arrow).
548  tendancy allows thermo-dynamics variables to be stably integrated  The hydrostatic pressure/geo-potential $\phi_{hyd}$ is evaluated directly
549  forward-in-time to render an estimate ($*$-variables) at the $n+1/2$  at time level $n$ (vertical arrows) and used with the extrapolated tendencies
550  time level (solid arc-arrow). The implicit-in-time operator ${\cal  to step forward the flow variables from $n-1/2$ to $n+1/2$ (solid arc-arrow).
551  L_{\theta,S}}$ is solved to yield the thermodynamic variables at time  The implicit-in-time operator ${\cal L}_{\bf u,v}$ (vertical arrows) is
552  level $n+1/2$. These are then used to calculate the hydrostatic  then applied to the previous estimation of the the flow field ($*$-variables)
553  pressure/geo-potential, $\phi_{hyd}$ (vertical arrows). The  and yields to the two velocity components $u,v$ at time level $n+1/2$.
554  hydrostatic pressure gradient is evaluated directly an time level  These are then used to calculate the advection term (dashed arc-arrow)
555  $n+1/2$ in stepping forward the flow variables from $n$ to $n+1$  of the thermo-dynamics tendencies at time step $n$.
556  (solid arc-arrow). }  The extrapolated thermodynamics tendency, from time level $n-1$ and $n$
557    to $n+1/2$, allows thermodynamic variables to be stably integrated
558    forward-in-time (solid arc-arrow) up to time level $n+1$.
559    }
560  \label{fig:adams-bashforth-staggered}  \label{fig:adams-bashforth-staggered}
561  \end{figure}  \end{figure}
562    
# Line 502  limiting process for determining a stabl Line 565  limiting process for determining a stabl
565  circumstance, it is more efficient to stagger in time the  circumstance, it is more efficient to stagger in time the
566  thermodynamic variables with the flow  thermodynamic variables with the flow
567  variables. Fig.~\ref{fig:adams-bashforth-staggered} illustrates the  variables. Fig.~\ref{fig:adams-bashforth-staggered} illustrates the
568  staggering and algorith. The key difference between this and  staggering and algorithm. The key difference between this and
569  Fig.~\ref{fig:adams-bashforth-sync} is that the new thermodynamics  Fig.~\ref{fig:adams-bashforth-sync} is that the thermodynamic variables
570  fields are used to compute the hydrostatic pressure at time level  are solved after the dynamics, using the recently updated flow field.
571  $n+1/2$. The essentially allows the gravity wave terms to leap-frog in  This essentially allows the gravity wave terms to leap-frog in
572  time giving second order accuracy and more stability.  time giving second order accuracy and more stability.
573    
574  The essential change in the staggered algorithm is the calculation of  The essential change in the staggered algorithm is that the
575  hydrostatic pressure which, in the context of the synchronous  thermodynamics solver is delayed from half a time step,
576  algorithm involves replacing equation \ref{eq:phi-hyd-sync} with  allowing the use of the most recent velocities to compute
577  \begin{displaymath}  the advection terms. Once the thermodynamics fields are
578  \phi_{hyd}^n = \int b(\theta^{n+1},S^{n+1}) dr  updated, the hydrostatic pressure is computed
579  \end{displaymath}  to step forwrad the dynamics.
580  but the pressure gradient must also be taken out of the  Note that the pressure gradient must also be taken out of the
581  Adams-Bashforth extrapoltion. Also, retaining the integer time-levels,  Adams-Bashforth extrapolation. Also, retaining the integer time-levels,
582  $n$ and $n+1$, does not give a user the sense of where variables are  $n$ and $n+1$, does not give a user the sense of where variables are
583  located in time.  Instead, we re-write the entire algorithm,  located in time.  Instead, we re-write the entire algorithm,
584  \ref{eq:Gt-n-sync} to \ref{eq:v-n+1-sync}, annotating the  \ref{eq:Gt-n-sync} to \ref{eq:v-n+1-sync}, annotating the
585  position in time of variables appropriately:  position in time of variables appropriately:
586  \begin{eqnarray}  \begin{eqnarray}
587  G_{\theta,S}^{n-1/2} & = & G_{\theta,S} ( u^n, \theta^{n-1/2}, S^{n-1/2} )  \phi^{n}_{hyd} & = & \int b(\theta^{n},S^{n}) dr
 \label{eq:Gt-n-staggered} \\  
 G_{\theta,S}^{(n)} & = & (3/2+\epsilon_{AB}) G_{\theta,S}^{n-1/2}-(1/2+\epsilon_{AB}) G_{\theta,S}^{n-3/2}  
 \label{eq:Gt-n+5-staggered} \\  
 (\theta^*,S^*) & = & (\theta^{n},S^{n}) + \Delta t G_{\theta,S}^{(n)}  
 \label{eq:tstar-staggered} \\  
 (\theta^{n+1/2},S^{n+1/2}) & = & {\cal L}^{-1}_{\theta,S} (\theta^*,S^*)  
 \label{eq:t-n+1-staggered} \\  
 \phi^{n+1/2}_{hyd} & = & \int b(\theta^{n+1/2},S^{n+1/2}) dr  
588  \label{eq:phi-hyd-staggered} \\  \label{eq:phi-hyd-staggered} \\
589  \vec{\bf G}_{\vec{\bf v}}^{n} & = & \vec{\bf G}_{\vec{\bf v}} ( \vec{\bf v}^n )  \vec{\bf G}_{\vec{\bf v}}^{n-1/2} & = & \vec{\bf G}_{\vec{\bf v}} ( \vec{\bf v}^{n-1/2} )
590  \label{eq:Gv-n-staggered} \\  \label{eq:Gv-n-staggered} \\
591  \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}  \vec{\bf G}_{\vec{\bf v}}^{(n)} & = & (3/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n-1/2} - (1/2 + \epsilon_{AB} ) \vec{\bf G}_{\vec{\bf v}}^{n-3/2}
592  \label{eq:Gv-n+5-staggered} \\  \label{eq:Gv-n+5-staggered} \\
593  \vec{\bf v}^{*} & = & \vec{\bf v}^{n} + \Delta t \left( \vec{\bf G}_{\vec{\bf v}}^{(n+1/2)} - \nabla \phi_{hyd}^{n+1/2} \right)  \vec{\bf v}^{*} & = & \vec{\bf v}^{n-1/2} + \Delta t \left( \vec{\bf G}_{\vec{\bf v}}^{(n)} - \nabla \phi_{hyd}^{n} \right)
594  \label{eq:vstar-staggered} \\  \label{eq:vstar-staggered} \\
595  \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )  \vec{\bf v}^{**} & = & {\cal L}_{\vec{\bf v}}^{-1} ( \vec{\bf v}^* )
596  \label{eq:vstarstar-staggered} \\  \label{eq:vstarstar-staggered} \\
597  \eta^* & = & \epsilon_{fs} \left( \eta^{n} +P-E+R \right)- \Delta t  \eta^* & = & \epsilon_{fs} \left( \eta^{n-1/2} + \Delta t (P-E)^n \right)- \Delta t
598    \nabla \cdot H \widehat{ \vec{\bf v}^{**} }    \nabla \cdot H \widehat{ \vec{\bf v}^{**} }
599  \label{eq:nstar-staggered} \\  \label{eq:nstar-staggered} \\
600  \nabla \cdot g H \nabla \eta^{n+1} - \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}  \nabla \cdot g H \nabla \eta^{n+1/2} & - & \frac{\epsilon_{fs} \eta^{n+1/2}}{\Delta t^2}
601  & = & - \frac{\eta^*}{\Delta t^2}  ~ = ~ - \frac{\eta^*}{\Delta t^2}
602  \label{eq:elliptic-staggered} \\  \label{eq:elliptic-staggered} \\
603  \vec{\bf v}^{n+1} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1}  \vec{\bf v}^{n+1/2} & = & \vec{\bf v}^{*} - \Delta t g \nabla \eta^{n+1/2}
604  \label{eq:v-n+1-staggered}  \label{eq:v-n+1-staggered} \\
605    G_{\theta,S}^{n} & = & G_{\theta,S} ( u^{n+1/2}, \theta^{n}, S^{n} )
606    \label{eq:Gt-n-staggered} \\
607    G_{\theta,S}^{(n+1/2)} & = & (3/2+\epsilon_{AB}) G_{\theta,S}^{n}-(1/2+\epsilon_{AB}) G_{\theta,S}^{n-1}
608    \label{eq:Gt-n+5-staggered} \\
609    (\theta^*,S^*) & = & (\theta^{n},S^{n}) + \Delta t G_{\theta,S}^{(n+1/2)}
610    \label{eq:tstar-staggered} \\
611    (\theta^{n+1},S^{n+1}) & = & {\cal L}^{-1}_{\theta,S} (\theta^*,S^*)
612    \label{eq:t-n+1-staggered}
613  \end{eqnarray}  \end{eqnarray}
614  The calling sequence is unchanged from  The corresponding calling tree is given in
615  Fig.~\ref{fig:call-tree-adams-bashforth-sync}. The staggered algorithm  \ref{fig:call-tree-adams-bashforth-staggered}.
616  is activated with the run-time flag {\bf staggerTimeStep=.TRUE.} in  The staggered algorithm is activated with the run-time flag
617  {\em PARM01} of {\em data}.  {\bf staggerTimeStep}{\em=.TRUE.} in parameter file {\em data},
618    namelist {\em PARM01}.
619    
620    \begin{figure}
621    \begin{center} \fbox{ \begin{minipage}{4.7in} \begin{tabbing}
622    aaa \= aaa \= aaa \= aaa \= aaa \= aaa \kill
623    FORWARD\_STEP \\
624    \>\> EXTERNAL\_FIELDS\_LOAD\\
625    \>\> DO\_ATMOSPHERIC\_PHYS \\
626    \>\> DO\_OCEANIC\_PHYS \\
627    \> DYNAMICS \\
628    \>\> CALC\_PHI\_HYD \` $\phi_{hyd}^n$ (\ref{eq:phi-hyd-staggered}) \\
629    \>\> MOM\_FLUXFORM or MOM\_VECINV \` $G_{\vec{\bf v}}^{n-1/2}$
630        (\ref{eq:Gv-n-staggered})\\
631    \>\> TIMESTEP \` $\vec{\bf v}^*$ (\ref{eq:Gv-n+5-staggered},
632                                      \ref{eq:vstar-staggered}) \\
633    \>\> IMPLDIFF \` $\vec{\bf v}^{**}$ (\ref{eq:vstarstar-staggered}) \\
634    \> UPDATE\_R\_STAR or UPDATE\_SURF\_DR \` (NonLin-FS only)\\
635    \> SOLVE\_FOR\_PRESSURE \\
636    \>\> CALC\_DIV\_GHAT \` $\eta^*$ (\ref{eq:nstar-staggered}) \\
637    \>\> CG2D \` $\eta^{n+1/2}$ (\ref{eq:elliptic-staggered}) \\
638    \> MOMENTUM\_CORRECTION\_STEP  \\
639    \>\> CALC\_GRAD\_PHI\_SURF \` $\nabla \eta^{n+1/2}$ \\
640    \>\> CORRECTION\_STEP \` $u^{n+1/2}$,$v^{n+1/2}$ (\ref{eq:v-n+1-staggered})\\
641    \> THERMODYNAMICS \\
642    \>\> CALC\_GT \\
643    \>\>\> GAD\_CALC\_RHS \` $G_\theta^n = G_\theta( u, \theta^n )$
644         (\ref{eq:Gt-n-staggered})\\
645    \>\>\> EXTERNAL\_FORCING \` $G_\theta^n = G_\theta^n + {\cal Q}$ \\
646    \>\>\> ADAMS\_BASHFORTH2 \` $G_\theta^{(n+1/2)}$ (\ref{eq:Gt-n+5-staggered}) \\
647    \>\> TIMESTEP\_TRACER \` $\theta^*$ (\ref{eq:tstar-staggered}) \\
648    \>\> IMPLDIFF \` $\theta^{(n+1)}$ (\ref{eq:t-n+1-staggered}) \\
649    \> TRACERS\_CORRECTION\_STEP  \\
650    \>\> CYCLE\_TRACER \` $\theta^{n+1}$ \\
651    \>\> FILTER \` Shapiro Filter, Zonal Filter (FFT) \\
652    \>\> CONVECTIVE\_ADJUSTMENT \` \\
653    \end{tabbing} \end{minipage} } \end{center}
654    \caption{
655    Calling tree for the overall staggered algorithm using
656    Adams-Bashforth time-stepping.
657    The place where the model geometry
658    ({\bf hFac} factors) is updated is added here but is only relevant
659    for the non-linear free-surface algorithm.
660    }
661    \label{fig:call-tree-adams-bashforth-staggered}
662    \end{figure}
663    
664  The only difficulty with this approach is apparent in equation  The only difficulty with this approach is apparent in equation
665  $\ref{eq:Gt-n-staggered}$ and illustrated by the dotted arrow  \ref{eq:Gt-n-staggered} and illustrated by the dotted arrow
666  connecting $u,v^n$ with $G_\theta^{n-1/2}$. The flow used to advect  connecting $u,v^{n+1/2}$ with $G_\theta^{n}$. The flow used to advect
667  tracers around is not naturally located in time. This could be avoided  tracers around is not naturally located in time. This could be avoided
668  by applying the Adams-Bashforth extrapolation to the tracer field  by applying the Adams-Bashforth extrapolation to the tracer field
669  itself and advection that around but this is not yet available. We're  itself and advecting that around but this approach is not yet
670  not aware of any detrimental effect of this feature. The difficulty  available. We're not aware of any detrimental effect of this
671  lies mainly in interpretation of what time-level variables and terms  feature. The difficulty lies mainly in interpretation of what
672  correspond to.  time-level variables and terms correspond to.
673    
674    
675  \section{Non-hydrostatic formulation}  \section{Non-hydrostatic formulation}
676  \label{sect:non-hydrostatic}  \label{sect:non-hydrostatic}
677    \begin{rawhtml}
678    <!-- CMIREDIR:non-hydrostatic_formulation: -->
679    \end{rawhtml}
680    
681    The non-hydrostatic formulation re-introduces the full vertical
682    momentum equation and requires the solution of a 3-D elliptic
683    equations for non-hydrostatic pressure perturbation. We still
684    intergrate vertically for the hydrostatic pressure and solve a 2-D
685    elliptic equation for the surface pressure/elevation for this reduces
686    the amount of work needed to solve for the non-hydrostatic pressure.
687    
688  [to be written...]  The momentum equations are discretized in time as follows:
689    \begin{eqnarray}
690    \frac{1}{\Delta t} u^{n+1} + g \partial_x \eta^{n+1} + \partial_x \phi_{nh}^{n+1}
691    & = & \frac{1}{\Delta t} u^{n} + G_u^{(n+1/2)} \label{eq:discrete-time-u-nh} \\
692    \frac{1}{\Delta t} v^{n+1} + g \partial_y \eta^{n+1} + \partial_y \phi_{nh}^{n+1}
693    & = & \frac{1}{\Delta t} v^{n} + G_v^{(n+1/2)} \label{eq:discrete-time-v-nh} \\
694    \frac{1}{\Delta t} w^{n+1} + \partial_r \phi_{nh}^{n+1}
695    & = & \frac{1}{\Delta t} w^{n} + G_w^{(n+1/2)} \label{eq:discrete-time-w-nh}
696    \end{eqnarray}
697    which must satisfy the discrete-in-time depth integrated continuity,
698    equation~\ref{eq:discrete-time-backward-free-surface} and the local continuity equation
699    \begin{equation}
700    \partial_x u^{n+1} + \partial_y v^{n+1} + \partial_r w^{n+1} = 0
701    \label{eq:non-divergence-nh}
702    \end{equation}
703    As before, the explicit predictions for momentum are consolidated as:
704    \begin{eqnarray*}
705    u^* & = & u^n + \Delta t G_u^{(n+1/2)} \\
706    v^* & = & v^n + \Delta t G_v^{(n+1/2)} \\
707    w^* & = & w^n + \Delta t G_w^{(n+1/2)}
708    \end{eqnarray*}
709    but this time we introduce an intermediate step by splitting the
710    tendancy of the flow as follows:
711    \begin{eqnarray}
712    u^{n+1} = u^{**} - \Delta t \partial_x \phi_{nh}^{n+1}
713    & &
714    u^{**} = u^{*} - \Delta t g \partial_x \eta^{n+1} \\
715    v^{n+1} = v^{**} - \Delta t \partial_y \phi_{nh}^{n+1}
716    & &
717    v^{**} = v^{*} - \Delta t g \partial_y \eta^{n+1}
718    \end{eqnarray}
719    Substituting into the depth integrated continuity
720    (equation~\ref{eq:discrete-time-backward-free-surface}) gives
721    \begin{equation}
722    \partial_x H \partial_x \left( g \eta^{n+1} + \widehat{\phi}_{nh}^{n+1} \right)
723    +
724    \partial_y H \partial_y \left( g \eta^{n+1} + \widehat{\phi}_{nh}^{n+1} \right)
725     - \frac{\epsilon_{fs}\eta^*}{\Delta t^2}
726    = - \frac{\eta^*}{\Delta t^2}
727    \end{equation}
728    which is approximated by equation
729    \ref{eq:elliptic-backward-free-surface} on the basis that i)
730    $\phi_{nh}^{n+1}$ is not yet known and ii) $\nabla \widehat{\phi}_{nh}
731    << g \nabla \eta$. If \ref{eq:elliptic-backward-free-surface} is
732    solved accurately then the implication is that $\widehat{\phi}_{nh}
733    \approx 0$ so that thet non-hydrostatic pressure field does not drive
734    barotropic motion.
735    
736    The flow must satisfy non-divergence
737    (equation~\ref{eq:non-divergence-nh}) locally, as well as depth
738    integrated, and this constraint is used to form a 3-D elliptic
739    equations for $\phi_{nh}^{n+1}$:
740    \begin{equation}
741    \partial_{xx} \phi_{nh}^{n+1} + \partial_{yy} \phi_{nh}^{n+1} +
742    \partial_{rr} \phi_{nh}^{n+1} =
743    \partial_x u^{**} + \partial_y v^{**} + \partial_r w^{*}
744    \end{equation}
745    
746    The entire algorithm can be summarized as the sequential solution of
747    the following equations:
748    \begin{eqnarray}
749    u^{*} & = & u^{n} + \Delta t G_u^{(n+1/2)} \label{eq:ustar-nh} \\
750    v^{*} & = & v^{n} + \Delta t G_v^{(n+1/2)} \label{eq:vstar-nh} \\
751    w^{*} & = & w^{n} + \Delta t G_w^{(n+1/2)} \label{eq:wstar-nh} \\
752    \eta^* ~ = ~ \epsilon_{fs} \left( \eta^{n} + \Delta t (P-E) \right)
753    & - & \Delta t
754      \partial_x H \widehat{u^{*}}
755    + \partial_y H \widehat{v^{*}}
756    \\
757      \partial_x g H \partial_x \eta^{n+1}
758    + \partial_y g H \partial_y \eta^{n+1}
759    & - & \frac{\epsilon_{fs} \eta^{n+1}}{\Delta t^2}
760    ~ = ~
761    - \frac{\eta^*}{\Delta t^2}
762    \label{eq:elliptic-nh}
763    \\
764    u^{**} & = & u^{*} - \Delta t g \partial_x \eta^{n+1} \label{eq:unx-nh}\\
765    v^{**} & = & v^{*} - \Delta t g \partial_y \eta^{n+1} \label{eq:vnx-nh}\\
766    \partial_{xx} \phi_{nh}^{n+1} + \partial_{yy} \phi_{nh}^{n+1} +
767    \partial_{rr} \phi_{nh}^{n+1} & = &
768    \partial_x u^{**} + \partial_y v^{**} + \partial_r w^{*} \\
769    u^{n+1} & = & u^{**} - \Delta t \partial_x \phi_{nh}^{n+1} \label{eq:un+1-nh}\\
770    v^{n+1} & = & v^{**} - \Delta t \partial_y \phi_{nh}^{n+1} \label{eq:vn+1-nh}\\
771    \partial_r w^{n+1} & = & - \partial_x u^{n+1} - \partial_y v^{n+1}
772    \end{eqnarray}
773    where the last equation is solved by vertically integrating for
774    $w^{n+1}$.
775    
776    
777    
778  \section{Variants on the Free Surface}  \section{Variants on the Free Surface}
779    \label{sect:free-surface}
780    
781  We now descibe the various formulations of the free-surface that  We now describe the various formulations of the free-surface that
782  include non-linear forms, implicit in time using Crank-Nicholson,  include non-linear forms, implicit in time using Crank-Nicholson,
783  explicit and [one day] split-explicit. First, we'll reiterate the  explicit and [one day] split-explicit. First, we'll reiterate the
784  underlying algorithm but this time using the notation consistent with  underlying algorithm but this time using the notation consistent with
785  the more general vertical coordinate $r$. The elliptic equation for  the more general vertical coordinate $r$. The elliptic equation for
786  free-surface coordinate (units of $r$), correpsonding to  free-surface coordinate (units of $r$), corresponding to
787  \ref{eq:discrete-time-backward-free-surface}, and  \ref{eq:discrete-time-backward-free-surface}, and
788  assuming no non-hydrostatic effects ($\epsilon_{nh} = 0$) is:  assuming no non-hydrostatic effects ($\epsilon_{nh} = 0$) is:
789  \begin{eqnarray}  \begin{eqnarray}
# Line 592  where Line 796  where
796  \begin{eqnarray}  \begin{eqnarray}
797  {\eta}^* = \epsilon_{fs} \: {\eta}^{n} -  {\eta}^* = \epsilon_{fs} \: {\eta}^{n} -
798  \Delta t {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o} \vec{\bf v}^* dr  \Delta t {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o} \vec{\bf v}^* dr
799  \: + \: \epsilon_{fw} \Delta_t (P-E)^{n}  \: + \: \epsilon_{fw} \Delta t (P-E)^{n}
800  \label{eq-solve2D_rhs}  \label{eq-solve2D_rhs}
801  \end{eqnarray}  \end{eqnarray}
802    
803  \fbox{ \begin{minipage}{4.75in}  \fbox{ \begin{minipage}{4.75in}
804  {\em S/R SOLVE\_FOR\_PRESSURE} ({\em solve\_for\_pressure.F})  {\em S/R SOLVE\_FOR\_PRESSURE} ({\em solve\_for\_pressure.F})
805    
806  $u^*$: {\bf GuNm1} ({\em DYNVARS.h})  $u^*$: {\bf gU} ({\em DYNVARS.h})
807    
808  $v^*$: {\bf GvNm1} ({\em DYNVARS.h})  $v^*$: {\bf gV} ({\em DYNVARS.h})
809    
810  $\eta^*$: {\bf cg2d\_b} (\em SOLVE\_FOR\_PRESSURE.h)  $\eta^*$: {\bf cg2d\_b} (\em SOLVE\_FOR\_PRESSURE.h)
811    
# Line 611  $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h) Line 815  $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h)
815    
816    
817  Once ${\eta}^{n+1}$ has been found, substituting into  Once ${\eta}^{n+1}$ has been found, substituting into
818  \ref{eq-tDsC-Hmom} yields $\vec{\bf v}^{n+1}$ if the model is  \ref{eq:discrete-time-u}, \ref{eq:discrete-time-v} yields $\vec{\bf v}^{n+1}$
819  hydrostatic ($\epsilon_{nh}=0$):  if the model is hydrostatic ($\epsilon_{nh}=0$):
820  $$  $$
821  \vec{\bf v}^{n+1} = \vec{\bf v}^{*}  \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
822  - \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}  - \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}
# Line 621  $$ Line 825  $$
825  This is known as the correction step. However, when the model is  This is known as the correction step. However, when the model is
826  non-hydrostatic ($\epsilon_{nh}=1$) we need an additional step and an  non-hydrostatic ($\epsilon_{nh}=1$) we need an additional step and an
827  additional equation for $\phi'_{nh}$. This is obtained by substituting  additional equation for $\phi'_{nh}$. This is obtained by substituting
828  \ref{eq-tDsC-Hmom} and \ref{eq-tDsC-Vmom} into  \ref{eq:discrete-time-u-nh}, \ref{eq:discrete-time-v-nh} and \ref{eq:discrete-time-w-nh}
829  \ref{eq-tDsC-cont}:  into continuity:
830  \begin{equation}  \begin{equation}
831  \left[ {\bf \nabla}_h^2 + \partial_{rr} \right] {\phi'_{nh}}^{n+1}  \left[ {\bf \nabla}_h^2 + \partial_{rr} \right] {\phi'_{nh}}^{n+1}
832  = \frac{1}{\Delta t} \left(  = \frac{1}{\Delta t} \left(
# Line 653  without any consequence on the solution. Line 857  without any consequence on the solution.
857    
858  $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h)  $\eta^{n+1}$: {\bf etaN} (\em DYNVARS.h)
859    
860  $\phi_{nh}^{n+1}$: {\bf phi\_nh} (\em DYNVARS.h)  $\phi_{nh}^{n+1}$: {\bf phi\_nh} (\em NH\_VARS.h)
861    
862  $u^*$: {\bf GuNm1} ({\em DYNVARS.h})  $u^*$: {\bf gU} ({\em DYNVARS.h})
863    
864  $v^*$: {\bf GvNm1} ({\em DYNVARS.h})  $v^*$: {\bf gV} ({\em DYNVARS.h})
865    
866  $u^{n+1}$: {\bf uVel} ({\em DYNVARS.h})  $u^{n+1}$: {\bf uVel} ({\em DYNVARS.h})
867    
# Line 685  at the same point in the code. Line 889  at the same point in the code.
889    
890    
891  \subsection{Crank-Nickelson barotropic time stepping}  \subsection{Crank-Nickelson barotropic time stepping}
892    \label{sect:freesurf-CrankNick}
893    
894  The full implicit time stepping described previously is  The full implicit time stepping described previously is
895  unconditionally stable but damps the fast gravity waves, resulting in  unconditionally stable but damps the fast gravity waves, resulting in
# Line 699  stable, Crank-Nickelson scheme; $(\beta, Line 904  stable, Crank-Nickelson scheme; $(\beta,
904  corresponds to the forward - backward scheme that conserves energy but is  corresponds to the forward - backward scheme that conserves energy but is
905  only stable for small time steps.\\  only stable for small time steps.\\
906  In the code, $\beta,\gamma$ are defined as parameters, respectively  In the code, $\beta,\gamma$ are defined as parameters, respectively
907  {\it implicSurfPress}, {\it implicDiv2DFlow}. They are read from  {\bf implicSurfPress}, {\bf implicDiv2DFlow}. They are read from
908  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.
909    
910  Equations \ref{eq-tDsC-Hmom} and \ref{eq-tDsC-eta} are modified as follows:  Equations \ref{eq:ustar-backward-free-surface} --
911  $$  \ref{eq:vn+1-backward-free-surface} are modified as follows:
912    \begin{eqnarray*}
913  \frac{ \vec{\bf v}^{n+1} }{ \Delta t }  \frac{ \vec{\bf v}^{n+1} }{ \Delta t }
914  + {\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} ]
915  + \epsilon_{nh} {\bf \nabla}_h {\phi'_{nh}}^{n+1}  + \epsilon_{nh} {\bf \nabla}_h {\phi'_{nh}}^{n+1}
916   = \frac{ \vec{\bf v}^* }{ \Delta t }   = \frac{ \vec{\bf v}^* }{ \Delta t }
917  $$  \end{eqnarray*}
918  $$  \begin{eqnarray}
919  \epsilon_{fs} \frac{ {\eta}^{n+1} - {\eta}^{n} }{ \Delta t}  \epsilon_{fs} \frac{ {\eta}^{n+1} - {\eta}^{n} }{ \Delta t}
920  + {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o}  + {\bf \nabla}_h \cdot \int_{R_{fixed}}^{R_o}
921  [ \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
922  = \epsilon_{fw} (P-E)  = \epsilon_{fw} (P-E)
923  $$  \label{eq:eta-n+1-CrankNick}
924    \end{eqnarray}
925  where:  where:
926  \begin{eqnarray*}  \begin{eqnarray*}
927  \vec{\bf v}^* & = &  \vec{\bf v}^* & = &
# Line 736  $$ Line 943  $$
943  {\bf \nabla}_h {\eta}^{n+1}  {\bf \nabla}_h {\eta}^{n+1}
944  = {\eta}^*  = {\eta}^*
945  $$  $$
946  and then to compute (correction step):  and then to compute ({\em CORRECTION\_STEP}):
947  $$  $$
948  \vec{\bf v}^{n+1} = \vec{\bf v}^{*}  \vec{\bf v}^{n+1} = \vec{\bf v}^{*}
949  - \beta \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}  - \beta \Delta t {\bf \nabla}_h b_s {\eta}^{n+1}
950  $$  $$
951    
952  The non-hydrostatic part is solved as described previously.  %The non-hydrostatic part is solved as described previously.
953    
954  Note that:  \noindent
955    Notes:
956  \begin{enumerate}  \begin{enumerate}
957    \item The RHS term of equation \ref{eq:eta-n+1-CrankNick}
958    corresponds the contribution of fresh water flux (P-E)
959    to the free-surface variations ($\epsilon_{fw}=1$,
960    {\bf useRealFreshWater}{\em=TRUE} in parameter file {\em data}).
961    In order to remain consistent with the tracer equation, specially in
962    the non-linear free-surface formulation, this term is also
963    affected by the Crank-Nickelson time stepping. The RHS reads:
964    $\epsilon_{fw} ( \gamma (P-E)^{n+1/2} + (1-\gamma) (P-E)^{n-1/2} )$
965  \item The non-hydrostatic part of the code has not yet been  \item The non-hydrostatic part of the code has not yet been
966  updated, so that this option cannot be used with $(\beta,\gamma) \neq (1,1)$.  updated, and therefore cannot be used with $(\beta,\gamma) \neq (1,1)$.
967  \item The stability criteria with Crank-Nickelson time stepping  \item The stability criteria with Crank-Nickelson time stepping
968  for the pure linear gravity wave problem in cartesian coordinates is:  for the pure linear gravity wave problem in cartesian coordinates is:
969  \begin{itemize}  \begin{itemize}

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.22