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

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

Application of some coding rules

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