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

Last change on this file since 14257 was 14257, checked in by nicolasmartin, 3 years ago

Overall review of LaTeX sources (not tested completely as of now):

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