New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
chap_time_domain.tex in NEMO/trunk/doc/latex/NEMO/subfiles – NEMO

source: NEMO/trunk/doc/latex/NEMO/subfiles/chap_time_domain.tex @ 11599

Last change on this file since 11599 was 11599, checked in by nicolasmartin, 5 years ago

Cosmetic cleaning

File size: 19.3 KB
Line 
1\documentclass[../main/NEMO_manual]{subfiles}
2
3\begin{document}
4
5\chapter{Time Domain}
6\label{chap:TD}
7
8\thispagestyle{plain}
9
10\chaptertoc
11
12\paragraph{Changes record} ~\\
13
14{\footnotesize
15  \begin{tabularx}{\textwidth}{l||X|X}
16    Release & Author(s) & Modifications \\
17    \hline
18    {\em   4.0} & {\em ...} & {\em ...} \\
19    {\em   3.6} & {\em ...} & {\em ...} \\
20    {\em   3.4} & {\em ...} & {\em ...} \\
21    {\em <=3.4} & {\em ...} & {\em ...}
22  \end{tabularx}
23}
24
25\clearpage
26
27% Missing things:
28%  - daymod: definition of the time domain (nit000, nitend and the calendar)
29
30\gmcomment{STEVEN :maybe a picture of the directory structure in the introduction which could be referred to here,
31  would help  ==> to be added}
32
33Having defined the continuous equations in \autoref{chap:MB}, we need now to choose a time discretization,
34a key feature of an ocean model as it exerts a strong influence on the structure of the computer code
35(\ie\ on its flowchart).
36In the present chapter, we provide a general description of the \NEMO\  time stepping strategy and
37the consequences for the order in which the equations are solved.
38
39%% =================================================================================================
40\section{Time stepping environment}
41\label{sec:TD_environment}
42
43The time stepping used in \NEMO\ is a three level scheme that can be represented as follows:
44\begin{equation}
45  \label{eq:TD}
46  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t - \rdt, \, t, \, t + \rdt}
47\end{equation}
48where $x$ stands for $u$, $v$, $T$ or $S$;
49RHS is the Right-Hand-Side of the corresponding time evolution equation;
50$\rdt$ is the time step;
51and the superscripts indicate the time at which a quantity is evaluated.
52Each term of the RHS is evaluated at a specific time stepping depending on the physics with which it is associated.
53
54The choice of the time stepping used for this evaluation is discussed below as well as
55the implications for starting or restarting a model simulation.
56Note that the time stepping calculation is generally performed in a single operation.
57With such a complex and nonlinear system of equations it would be dangerous to let a prognostic variable evolve in
58time for each term separately.
59
60The three level scheme requires three arrays for each prognostic variable.
61For each variable $x$ there is $x_b$ (before), $x_n$ (now) and $x_a$.
62The third array, although referred to as $x_a$ (after) in the code,
63is usually not the variable at the after time step;
64but rather it is used to store the time derivative (RHS in \autoref{eq:TD}) prior to time-stepping the equation.
65The time stepping itself is performed once at each time step where implicit vertical diffusion is computed, \ie\ in the \mdl{trazdf} and \mdl{dynzdf} modules.
66
67%% =================================================================================================
68\section{Non-diffusive part --- Leapfrog scheme}
69\label{sec:TD_leap_frog}
70
71The time stepping used for processes other than diffusion is the well-known leapfrog scheme
72\citep{mesinger.arakawa_bk76}.
73This scheme is widely used for advection processes in low-viscosity fluids.
74It is a time centred scheme, \ie\ the RHS in \autoref{eq:TD} is evaluated at time step $t$, the now time step.
75It may be used for momentum and tracer advection, pressure gradient, and Coriolis terms,
76but not for diffusion terms.
77It is an efficient method that achieves second-order accuracy with
78just one right hand side evaluation per time step.
79Moreover, it does not artificially damp linear oscillatory motion nor does it produce instability by
80amplifying the oscillations.
81These advantages are somewhat diminished by the large phase-speed error of the leapfrog scheme,
82and the unsuitability of leapfrog differencing for the representation of diffusion and Rayleigh damping processes.
83However, the scheme allows the coexistence of a numerical and a physical mode due to
84its leading third order dispersive error.
85In other words a divergence of odd and even time steps may occur.
86To prevent it, the leapfrog scheme is often used in association with a Robert-Asselin time filter
87(hereafter the LF-RA scheme).
88This filter, first designed by \citet{robert_JMSJ66} and more comprehensively studied by \citet{asselin_MWR72},
89is a kind of laplacian diffusion in time that mixes odd and even time steps:
90\begin{equation}
91  \label{eq:TD_asselin}
92  x_F^t = x^t + \gamma \, \lt[ x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt]
93\end{equation}
94where the subscript $F$ denotes filtered values and $\gamma$ is the Asselin coefficient.
95$\gamma$ is initialized as \np{rn_atfp}{rn\_atfp} (namelist parameter).
96Its default value is \np[=10.e-3]{rn_atfp}{rn\_atfp} (see \autoref{sec:TD_mLF}),
97causing only a weak dissipation of high frequency motions (\citep{farge-coulombier_phd87}).
98The addition of a time filter degrades the accuracy of the calculation from second to first order.
99However, the second order truncation error is proportional to $\gamma$, which is small compared to 1.
100Therefore, the LF-RA is a quasi second order accurate scheme.
101The LF-RA scheme is preferred to other time differencing schemes such as predictor corrector or trapezoidal schemes,
102because the user has an explicit and simple control of the magnitude of the time diffusion of the scheme.
103When used with the 2nd order space centred discretisation of the advection terms in
104the momentum and tracer equations, LF-RA avoids implicit numerical diffusion:
105diffusion is set explicitly by the user through the Robert-Asselin
106filter parameter and the viscosity and diffusion coefficients.
107
108%% =================================================================================================
109\section{Diffusive part --- Forward or backward scheme}
110\label{sec:TD_forward_imp}
111
112The leapfrog differencing scheme is unsuitable for the representation of diffusion and damping processes.
113For a tendency $D_x$, representing a diffusion term or a restoring term to a tracer climatology
114(when present, see \autoref{sec:TRA_dmp}), a forward time differencing scheme is used :
115\[
116  %\label{eq:TD_euler}
117  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ D_x^{t - \rdt}
118\]
119
120This is diffusive in time and conditionally stable.
121The conditions for stability of second and fourth order horizontal diffusion schemes are \citep{griffies_bk04}:
122\begin{equation}
123  \label{eq:TD_euler_stability}
124  A^h <
125  \begin{cases}
126    \frac{e^2}{ 8 \, \rdt} & \text{laplacian diffusion} \\
127    \frac{e^4}{64 \, \rdt} & \text{bilaplacian diffusion}
128  \end{cases}
129\end{equation}
130where $e$ is the smallest grid size in the two horizontal directions and $A^h$ is the mixing coefficient.
131The linear constraint \autoref{eq:TD_euler_stability} is a necessary condition, but not sufficient.
132If it is not satisfied, even mildly, then the model soon becomes wildly unstable.
133The instability can be removed by either reducing the length of the time steps or reducing the mixing coefficient.
134
135For the vertical diffusion terms, a forward time differencing scheme can be used,
136but usually the numerical stability condition imposes a strong constraint on the time step. To overcome the stability constraint, a
137backward (or implicit) time differencing scheme is used. This scheme is unconditionally stable but diffusive and can be written as follows:
138\begin{equation}
139  \label{eq:TD_imp}
140  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t + \rdt}
141\end{equation}
142
143%%gm
144%%gm   UPDATE the next paragraphs with time varying thickness ...
145%%gm
146
147This scheme is rather time consuming since it requires a matrix inversion. For example, the finite difference approximation of the temperature equation is:
148\[
149  % \label{eq:TD_imp_zdf}
150  \frac{T(k)^{t + 1} - T(k)^{t - 1}}{2 \; \rdt}
151  \equiv
152  \text{RHS} + \frac{1}{e_{3t}} \delta_k \lt[ \frac{A_w^{vT}}{e_{3w} } \delta_{k + 1/2} \lt[ T^{t + 1} \rt] \rt]
153\]
154where RHS is the right hand side of the equation except for the vertical diffusion term.
155We rewrite \autoref{eq:TD_imp} as:
156\begin{equation}
157  \label{eq:TD_imp_mat}
158  -c(k + 1) \; T^{t + 1}(k + 1) + d(k) \; T^{t + 1}(k) - \; c(k) \; T^{t + 1}(k - 1) \equiv b(k)
159\end{equation}
160where
161\begin{align*}
162  c(k) &= A_w^{vT} (k) \, / \, e_{3w} (k)     \\
163  d(k) &= e_{3t}   (k)       \, / \, (2 \rdt) + c_k + c_{k + 1}    \\
164  b(k) &= e_{3t}   (k) \; \lt( T^{t - 1}(k) \, / \, (2 \rdt) + \text{RHS} \rt)
165\end{align*}
166
167\autoref{eq:TD_imp_mat} is a linear system of equations with an associated matrix which is tridiagonal.
168Moreover,
169$c(k)$ and $d(k)$ are positive and the diagonal term is greater than the sum of the two extra-diagonal terms,
170therefore a special adaptation of the Gauss elimination procedure is used to find the solution
171(see for example \citet{richtmyer.morton_bk67}).
172
173%% =================================================================================================
174\section{Surface pressure gradient}
175\label{sec:TD_spg_ts}
176
177The leapfrog environment supports a centred in time computation of the surface pressure, \ie\ evaluated
178at \textit{now} time step. This refers to as the explicit free surface case in the code (\np[=.true.]{ln_dynspg_exp}{ln\_dynspg\_exp}).
179This choice however imposes a strong constraint on the time step which should be small enough to resolve the propagation
180of external gravity waves. As a matter of fact, one rather use in a realistic setup, a split-explicit free surface
181(\np[=.true.]{ln_dynspg_ts}{ln\_dynspg\_ts}) in which barotropic and baroclinic dynamical equations are solved separately with ad-hoc
182time steps. The use of the time-splitting (in combination with non-linear free surface) imposes some constraints on the design of
183the overall flowchart, in particular to ensure exact tracer conservation (see \autoref{fig:TD_TimeStep_flowchart}).
184
185Compared to the former use of the filtered free surface in \NEMO\ v3.6 (\citet{roullet.madec_JGR00}), the use of a split-explicit free surface is advantageous
186on massively parallel computers. Indeed, no global computations are anymore required by the elliptic solver which saves a substantial amount of communication
187time. Fast barotropic motions (such as tides) are also simulated with a better accuracy.
188
189%\gmcomment{
190\begin{figure}[!t]
191  \centering
192  \includegraphics[width=0.66\textwidth]{Fig_TimeStepping_flowchart_v4}
193  \caption[Leapfrog time stepping sequence with split-explicit free surface]{
194    Sketch of the leapfrog time stepping sequence in \NEMO\ with split-explicit free surface.
195    The latter combined with non-linear free surface requires the dynamical tendency being
196    updated prior tracers tendency to ensure conservation.
197    Note the use of time integrated fluxes issued from the barotropic loop in
198    subsequent calculations of tracer advection and in the continuity equation.
199    Details about the time-splitting scheme can be found in \autoref{subsec:DYN_spg_ts}.}
200  \label{fig:TD_TimeStep_flowchart}
201\end{figure}
202%}
203
204%% =================================================================================================
205\section{Modified Leapfrog -- Asselin filter scheme}
206\label{sec:TD_mLF}
207
208Significant changes have been introduced by \cite{leclair.madec_OM09} in the LF-RA scheme in order to
209ensure tracer conservation and to allow the use of a much smaller value of the Asselin filter parameter.
210The modifications affect both the forcing and filtering treatments in the LF-RA scheme.
211
212In a classical LF-RA environment, the forcing term is centred in time,
213\ie\ it is time-stepped over a $2 \rdt$ period:
214$x^t = x^t + 2 \rdt Q^t$ where $Q$ is the forcing applied to $x$,
215and the time filter is given by \autoref{eq:TD_asselin} so that $Q$ is redistributed over several time step.
216In the modified LF-RA environment, these two formulations have been replaced by:
217\begin{gather}
218  \label{eq:TD_forcing}
219  x^{t + \rdt} = x^{t - \rdt} + \rdt \lt( Q^{t - \rdt / 2} + Q^{t + \rdt / 2} \rt\\
220  \label{eq:TD_RA}
221  x_F^t       = x^t + \gamma \, \lt( x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt)
222                    - \gamma \, \rdt \, \lt( Q^{t + \rdt / 2} - Q^{t - \rdt / 2} \rt)
223\end{gather}
224The change in the forcing formulation given by \autoref{eq:TD_forcing} (see \autoref{fig:TD_MLF_forcing})
225has a significant effect:
226the forcing term no longer excites the divergence of odd and even time steps \citep{leclair.madec_OM09}.
227% forcing seen by the model....
228This property improves the LF-RA scheme in two aspects.
229First, the LF-RA can now ensure the local and global conservation of tracers.
230Indeed, time filtering is no longer required on the forcing part.
231The influence of the Asselin filter on the forcing is explicitly removed by adding a new term in the filter
232(last term in \autoref{eq:TD_RA} compared to \autoref{eq:TD_asselin}).
233Since the filtering of the forcing was the source of non-conservation in the classical LF-RA scheme,
234the modified formulation becomes conservative \citep{leclair.madec_OM09}.
235Second, the LF-RA becomes a truly quasi -second order scheme.
236Indeed, \autoref{eq:TD_forcing} used in combination with a careful treatment of static instability
237(\autoref{subsec:ZDF_evd}) and of the TKE physics (\autoref{subsec:ZDF_tke_ene})
238(the two other main sources of time step divergence),
239allows a reduction by two orders of magnitude of the Asselin filter parameter.
240
241Note that the forcing is now provided at the middle of a time step:
242$Q^{t + \rdt / 2}$ is the forcing applied over the $[t,t + \rdt]$ time interval.
243This and the change in the time filter, \autoref{eq:TD_RA},
244allows for an exact evaluation of the contribution due to the forcing term between any two time steps,
245even if separated by only $\rdt$ since the time filter is no longer applied to the forcing term.
246
247\begin{figure}[!t]
248  \centering
249  \includegraphics[width=0.66\textwidth]{Fig_MLF_forcing}
250  \caption[Forcing integration methods for modified leapfrog (top and bottom)]{
251    Illustration of forcing integration methods.
252    (top) ''Traditional'' formulation:
253    the forcing is defined at the same time as the variable to which it is applied
254    (integer value of the time step index) and it is applied over a $2 \rdt$ period.
255    (bottom)  modified formulation:
256    the forcing is defined in the middle of the time
257    (integer and a half value of the time step index) and
258    the mean of two successive forcing values ($n - 1 / 2$, $n + 1 / 2$) is applied over
259    a $2 \rdt$ period.}
260  \label{fig:TD_MLF_forcing}
261\end{figure}
262
263%% =================================================================================================
264\section{Start/Restart strategy}
265\label{sec:TD_rst}
266
267\begin{listing}
268  \nlst{namrun}
269  \caption{\forcode{&namrun}}
270  \label{lst:namrun}
271\end{listing}
272
273The first time step of this three level scheme when starting from initial conditions is a forward step
274(Euler time integration):
275\[
276  % \label{eq:TD_DOM_euler}
277  x^1 = x^0 + \rdt \ \text{RHS}^0
278\]
279This is done simply by keeping the leapfrog environment (\ie\ the \autoref{eq:TD} three level time stepping) but
280setting all $x^0$ (\textit{before}) and $x^1$ (\textit{now}) fields equal at the first time step and
281using half the value of a leapfrog time step ($2 \rdt$).
282
283It is also possible to restart from a previous computation, by using a restart file.
284The restart strategy is designed to ensure perfect restartability of the code:
285the user should obtain the same results to machine precision either by
286running the model for $2N$ time steps in one go,
287or by performing two consecutive experiments of $N$ steps with a restart.
288This requires saving two time levels and many auxiliary data in the restart files in machine precision.
289
290Note that the time step $\rdt$, is also saved in the restart file.
291When restarting, if the time step has been changed, or one of the prognostic variables at \textit{before} time step
292is missing, an Euler time stepping scheme is imposed. A forward initial step can still be enforced by the user by setting
293the namelist variable \np[=0]{nn_euler}{nn\_euler}. Other options to control the time integration of the model
294are defined through the  \nam{run}{run} namelist variables.
295\gmcomment{
296add here how to force the restart to contain only one time step for operational purposes
297
298add also the idea of writing several restart for seasonal forecast : how is it done ?
299
300verify that all namelist pararmeters are truly described
301
302a word on the check of restart  .....
303}
304
305\gmcomment{       % add a subsection here
306
307%% =================================================================================================
308\subsection{Time domain}
309\label{subsec:TD_time}
310
311Options are defined through the  \nam{dom}{dom} namelist variables.
312 \colorbox{yellow}{add here a few word on nit000 and nitend}
313
314 \colorbox{yellow}{Write documentation on the calendar and the key variable adatrj}
315
316add a description of daymod, and the model calandar (leap-year and co)
317
318}        %% end add
319
320\gmcomment{       % add implicit in vvl case  and Crant-Nicholson scheme
321
322Implicit time stepping in case of variable volume thickness.
323
324Tracer case (NB for momentum in vector invariant form take care!)
325
326\begin{flalign*}
327  &\frac{\lt( e_{3t}\,T \rt)_k^{t+1}-\lt( e_{3t}\,T \rt)_k^{t-1}}{2\rdt}
328  \equiv \text{RHS}+ \delta_k \lt[ {\frac{A_w^{vt} }{e_{3w}^{t+1} }\delta_{k + 1/2} \lt[ {T^{t+1}} \rt]}
329  \rt]      \\
330  &\lt( e_{3t}\,T \rt)_k^{t+1}-\lt( e_{3t}\,T \rt)_k^{t-1}
331  \equiv {2\rdt} \ \text{RHS}+ {2\rdt} \ \delta_k \lt[ {\frac{A_w^{vt} }{e_{3w}^{t+1} }\delta_{k + 1/2} \lt[ {T^{t+1}} \rt]}
332  \rt]      \\
333  &\lt( e_{3t}\,T \rt)_k^{t+1}-\lt( e_{3t}\,T \rt)_k^{t-1}
334  \equiv 2\rdt \ \text{RHS}
335  + 2\rdt \ \lt\{ \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k + 1/2} [ T_{k +1}^{t+1} - T_k      ^{t+1} ]
336    - \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k - 1/2} [ T_k       ^{t+1} - T_{k -1}^{t+1} ]  \rt\}     \\
337  &\\
338  &\lt( e_{3t}\,T \rt)_k^{t+1}
339  -  {2\rdt} \           \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k + 1/2}                  T_{k +1}^{t+1}
340  + {2\rdt} \ \lt\{  \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k + 1/2}
341    +  \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k - 1/2}     \rt\}   T_{k    }^{t+1}
342  -  {2\rdt} \           \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k - 1/2}                  T_{k -1}^{t+1}      \\
343  &\equiv \lt( e_{3t}\,T \rt)_k^{t-1} + {2\rdt} \ \text{RHS}    \\
344  %
345\end{flalign*}
346\begin{flalign*}
347  \allowdisplaybreaks
348  \intertext{ Tracer case }
349  %
350  &  \qquad \qquad  \quad   -  {2\rdt}                  \ \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k + 1/2}
351  \qquad \qquad \qquad  \qquad  T_{k +1}^{t+1}   \\
352  &+ {2\rdt} \ \biggl\{  (e_{3t})_{k   }^{t+1}  \bigg. +    \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k + 1/2}
353  +   \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k - 1/2} \bigg. \biggr\}  \ \ \ T_{k   }^{t+1}  &&\\
354  & \qquad \qquad  \qquad \qquad \qquad \quad \ \ {2\rdt} \                          \lt[ \frac{A_w^{vt}}{e_{3w}^{t+1}} \rt]_{k - 1/2}                          \quad \ \ T_{k -1}^{t+1}
355  \ \equiv \ \lt( e_{3t}\,T \rt)_k^{t-1} + {2\rdt} \ \text{RHS}  \\
356  %
357\end{flalign*}
358\begin{flalign*}
359  \allowdisplaybreaks
360  \intertext{ Tracer content case }
361  %
362  & -  {2\rdt} \              & \frac{(A_w^{vt})_{k + 1/2}} {(e_{3w})_{k + 1/2}^{t+1}\;(e_{3t})_{k +1}^{t+1}}  && \  \lt( e_{3t}\,T \rt)_{k +1}^{t+1}   &\\
363  & + {2\rdt} \ \lt[ 1  \rt.+ & \frac{(A_w^{vt})_{k + 1/2}} {(e_{3w})_{k + 1/2}^{t+1}\;(e_{3t})_k^{t+1}}
364  + & \frac{(A_w^{vt})_{k - 1/2}} {(e_{3w})_{k - 1/2}^{t+1}\;(e_{3t})_k^{t+1}}  \lt\rt& \lt( e_{3t}\,T \rt)_{k   }^{t+1}  &\\
365  & -  {2\rdt} \               & \frac{(A_w^{vt})_{k - 1/2}} {(e_{3w})_{k - 1/2}^{t+1}\;(e_{3t})_{k -1}^{t+1}}     &\  \lt( e_{3t}\,T \rt)_{k -1}^{t+1}
366  \equiv \lt( e_{3t}\,T \rt)_k^{t-1} + {2\rdt} \ \text{RHS}  &
367\end{flalign*}
368
369}
370
371\onlyinsubfile{\input{../../global/epilogue}}
372
373\end{document}
Note: See TracBrowser for help on using the repository browser.