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 @ 11690

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

Update chapters according to previous commit

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