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.
Changeset 11573 for NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/doc/latex/NEMO/subfiles/chap_time_domain.tex – NEMO

Ignore:
Timestamp:
2019-09-19T11:18:03+02:00 (5 years ago)
Author:
jchanut
Message:

#2222, merged with trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/doc/latex/NEMO/subfiles/chap_time_domain.tex

    r11184 r11573  
    66% Chapter 2 ——— Time Domain (step.F90) 
    77% ================================================================ 
    8 \chapter{Time Domain (STP)} 
    9 \label{chap:STP} 
    10 \minitoc 
     8\chapter{Time Domain} 
     9\label{chap:TD} 
     10\chaptertoc 
    1111 
    1212% Missing things: 
     
    1919\newpage 
    2020 
    21 Having defined the continuous equations in \autoref{chap:PE}, we need now to choose a time discretization, 
     21Having defined the continuous equations in \autoref{chap:MB}, we need now to choose a time discretization, 
    2222a key feature of an ocean model as it exerts a strong influence on the structure of the computer code 
    23 (\ie on its flowchart). 
    24 In the present chapter, we provide a general description of the \NEMO  time stepping strategy and 
     23(\ie\ on its flowchart). 
     24In the present chapter, we provide a general description of the \NEMO\  time stepping strategy and 
    2525the consequences for the order in which the equations are solved. 
    2626 
     
    2929% ================================================================ 
    3030\section{Time stepping environment} 
    31 \label{sec:STP_environment} 
    32  
    33 The time stepping used in \NEMO is a three level scheme that can be represented as follows: 
    34 \begin{equation} 
    35   \label{eq:STP} 
     31\label{sec:TD_environment} 
     32 
     33The time stepping used in \NEMO\ is a three level scheme that can be represented as follows: 
     34\begin{equation} 
     35  \label{eq:TD} 
    3636  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t - \rdt, \, t, \, t + \rdt} 
    37 \end{equation}  
     37\end{equation} 
    3838where $x$ stands for $u$, $v$, $T$ or $S$; 
    3939RHS is the Right-Hand-Side of the corresponding time evolution equation; 
     
    5252The third array, although referred to as $x_a$ (after) in the code, 
    5353is usually not the variable at the after time step; 
    54 but rather it is used to store the time derivative (RHS in \autoref{eq:STP}) prior to time-stepping the equation. 
    55 The 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. 
     54but rather it is used to store the time derivative (RHS in \autoref{eq:TD}) prior to time-stepping the equation. 
     55The 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. 
    5656 
    5757% ------------------------------------------------------------------------------------------------------------- 
     
    5959% ------------------------------------------------------------------------------------------------------------- 
    6060\section{Non-diffusive part --- Leapfrog scheme} 
    61 \label{sec:STP_leap_frog} 
     61\label{sec:TD_leap_frog} 
    6262 
    6363The time stepping used for processes other than diffusion is the well-known leapfrog scheme 
    6464\citep{mesinger.arakawa_bk76}. 
    6565This scheme is widely used for advection processes in low-viscosity fluids. 
    66 It is a time centred scheme, \ie the RHS in \autoref{eq:STP} is evaluated at time step $t$, the now time step. 
     66It is a time centred scheme, \ie\ the RHS in \autoref{eq:TD} is evaluated at time step $t$, the now time step. 
    6767It may be used for momentum and tracer advection, pressure gradient, and Coriolis terms, 
    6868but not for diffusion terms. 
     
    8181is a kind of laplacian diffusion in time that mixes odd and even time steps: 
    8282\begin{equation} 
    83   \label{eq:STP_asselin} 
     83  \label{eq:TD_asselin} 
    8484  x_F^t = x^t + \gamma \, \lt[ x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt] 
    8585\end{equation} 
    8686where the subscript $F$ denotes filtered values and $\gamma$ is the Asselin coefficient. 
    8787$\gamma$ is initialized as \np{rn\_atfp} (namelist parameter). 
    88 Its default value is \np{rn\_atfp}\forcode{ = 10.e-3} (see \autoref{sec:STP_mLF}), 
     88Its default value is \np{rn\_atfp}\forcode{ = 10.e-3} (see \autoref{sec:TD_mLF}), 
    8989causing only a weak dissipation of high frequency motions (\citep{farge-coulombier_phd87}). 
    9090The addition of a time filter degrades the accuracy of the calculation from second to first order. 
     
    9292Therefore, the LF-RA is a quasi second order accurate scheme. 
    9393The LF-RA scheme is preferred to other time differencing schemes such as predictor corrector or trapezoidal schemes, 
    94 because the user has an explicit and simple control of the magnitude of the time diffusion of the scheme.  
     94because the user has an explicit and simple control of the magnitude of the time diffusion of the scheme. 
    9595When used with the 2nd order space centred discretisation of the advection terms in 
    9696the momentum and tracer equations, LF-RA avoids implicit numerical diffusion: 
    97 diffusion is set explicitly by the user through the Robert-Asselin  
     97diffusion is set explicitly by the user through the Robert-Asselin 
    9898filter parameter and the viscosity and diffusion coefficients. 
    9999 
     
    102102% ------------------------------------------------------------------------------------------------------------- 
    103103\section{Diffusive part --- Forward or backward scheme} 
    104 \label{sec:STP_forward_imp} 
     104\label{sec:TD_forward_imp} 
    105105 
    106106The leapfrog differencing scheme is unsuitable for the representation of diffusion and damping processes. 
     
    108108(when present, see \autoref{sec:TRA_dmp}), a forward time differencing scheme is used : 
    109109\[ 
    110   %\label{eq:STP_euler} 
     110  %\label{eq:TD_euler} 
    111111  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ D_x^{t - \rdt} 
    112112\] 
     
    115115The conditions for stability of second and fourth order horizontal diffusion schemes are \citep{griffies_bk04}: 
    116116\begin{equation} 
    117   \label{eq:STP_euler_stability} 
     117  \label{eq:TD_euler_stability} 
    118118  A^h < 
    119119  \begin{cases} 
     
    123123\end{equation} 
    124124where $e$ is the smallest grid size in the two horizontal directions and $A^h$ is the mixing coefficient. 
    125 The linear constraint \autoref{eq:STP_euler_stability} is a necessary condition, but not sufficient. 
     125The linear constraint \autoref{eq:TD_euler_stability} is a necessary condition, but not sufficient. 
    126126If it is not satisfied, even mildly, then the model soon becomes wildly unstable. 
    127127The instability can be removed by either reducing the length of the time steps or reducing the mixing coefficient. 
    128128 
    129129For the vertical diffusion terms, a forward time differencing scheme can be used, 
    130 but usually the numerical stability condition imposes a strong constraint on the time step. To overcome the stability constraint, a  
     130but usually the numerical stability condition imposes a strong constraint on the time step. To overcome the stability constraint, a 
    131131backward (or implicit) time differencing scheme is used. This scheme is unconditionally stable but diffusive and can be written as follows: 
    132132\begin{equation} 
    133   \label{eq:STP_imp} 
     133  \label{eq:TD_imp} 
    134134  x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t + \rdt} 
    135135\end{equation} 
     
    141141This scheme is rather time consuming since it requires a matrix inversion. For example, the finite difference approximation of the temperature equation is: 
    142142\[ 
    143   % \label{eq:STP_imp_zdf} 
     143  % \label{eq:TD_imp_zdf} 
    144144  \frac{T(k)^{t + 1} - T(k)^{t - 1}}{2 \; \rdt} 
    145145  \equiv 
     
    147147\] 
    148148where RHS is the right hand side of the equation except for the vertical diffusion term. 
    149 We rewrite \autoref{eq:STP_imp} as: 
    150 \begin{equation} 
    151   \label{eq:STP_imp_mat} 
     149We rewrite \autoref{eq:TD_imp} as: 
     150\begin{equation} 
     151  \label{eq:TD_imp_mat} 
    152152  -c(k + 1) \; T^{t + 1}(k + 1) + d(k) \; T^{t + 1}(k) - \; c(k) \; T^{t + 1}(k - 1) \equiv b(k) 
    153153\end{equation} 
    154 where  
    155 \begin{align*}  
     154where 
     155\begin{align*} 
    156156  c(k) &= A_w^{vT} (k) \, / \, e_{3w} (k)     \\ 
    157157  d(k) &= e_{3t}   (k)       \, / \, (2 \rdt) + c_k + c_{k + 1}    \\ 
     
    159159\end{align*} 
    160160 
    161 \autoref{eq:STP_imp_mat} is a linear system of equations with an associated matrix which is tridiagonal. 
     161\autoref{eq:TD_imp_mat} is a linear system of equations with an associated matrix which is tridiagonal. 
    162162Moreover, 
    163163$c(k)$ and $d(k)$ are positive and the diagonal term is greater than the sum of the two extra-diagonal terms, 
     
    169169% ------------------------------------------------------------------------------------------------------------- 
    170170\section{Surface pressure gradient} 
    171 \label{sec:STP_spg_ts} 
    172  
    173 The leapfrog environment supports a centred in time computation of the surface pressure, \ie evaluated  
    174 at \textit{now} time step. This refers to as the explicit free surface case in the code (\np{ln\_dynspg\_exp}\forcode{ = .true.}).  
    175 This choice however imposes a strong constraint on the time step which should be small enough to resolve the propagation  
    176 of external gravity waves. As a matter of fact, one rather use in a realistic setup, a split-explicit free surface  
    177 (\np{ln\_dynspg\_ts}\forcode{ = .true.}) in which barotropic and baroclinic dynamical equations are solved separately with ad-hoc  
    178 time steps. The use of the time-splitting (in combination with non-linear free surface) imposes some constraints on the design of  
    179 the overall flowchart, in particular to ensure exact tracer conservation (see \autoref{fig:TimeStep_flowchart}). 
    180  
    181 Compared 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  
    182 on massively parallel computers. Indeed, no global computations are anymore required by the elliptic solver which saves a substantial amount of communication  
    183 time. Fast barotropic motions (such as tides) are also simulated with a better accuracy.  
    184  
    185 %\gmcomment{  
     171\label{sec:TD_spg_ts} 
     172 
     173The leapfrog environment supports a centred in time computation of the surface pressure, \ie\ evaluated 
     174at \textit{now} time step. This refers to as the explicit free surface case in the code (\np{ln\_dynspg\_exp}\forcode{=.true.}). 
     175This choice however imposes a strong constraint on the time step which should be small enough to resolve the propagation 
     176of external gravity waves. As a matter of fact, one rather use in a realistic setup, a split-explicit free surface 
     177(\np{ln\_dynspg\_ts}\forcode{=.true.}) in which barotropic and baroclinic dynamical equations are solved separately with ad-hoc 
     178time steps. The use of the time-splitting (in combination with non-linear free surface) imposes some constraints on the design of 
     179the overall flowchart, in particular to ensure exact tracer conservation (see \autoref{fig:TD_TimeStep_flowchart}). 
     180 
     181Compared 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 
     182on massively parallel computers. Indeed, no global computations are anymore required by the elliptic solver which saves a substantial amount of communication 
     183time. Fast barotropic motions (such as tides) are also simulated with a better accuracy. 
     184 
     185%\gmcomment{ 
    186186%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    187187\begin{figure}[!t] 
    188   \begin{center} 
    189     \includegraphics[width=\textwidth]{Fig_TimeStepping_flowchart_v4} 
    190     \caption{ 
    191       \protect\label{fig:TimeStep_flowchart} 
    192       Sketch of the leapfrog time stepping sequence in \NEMO with split-explicit free surface. The latter combined 
    193        with non-linear free surface requires the dynamical tendency being updated prior tracers tendency to ensure  
    194        conservation. Note the use of time integrated fluxes issued from the barotropic loop  in subsequent calculations  
    195        of tracer advection and in the continuity equation. Details about the time-splitting scheme can be found  
    196        in \autoref{subsec:DYN_spg_ts}. 
    197     } 
    198   \end{center} 
     188  \centering 
     189  \includegraphics[width=0.66\textwidth]{Fig_TimeStepping_flowchart_v4} 
     190  \caption[Leapfrog time stepping sequence with split-explicit free surface]{ 
     191    Sketch of the leapfrog time stepping sequence in \NEMO\ with split-explicit free surface. 
     192    The latter combined with non-linear free surface requires the dynamical tendency being 
     193    updated prior tracers tendency to ensure conservation. 
     194    Note the use of time integrated fluxes issued from the barotropic loop in 
     195    subsequent calculations of tracer advection and in the continuity equation. 
     196    Details about the time-splitting scheme can be found in \autoref{subsec:DYN_spg_ts}.} 
     197  \label{fig:TD_TimeStep_flowchart} 
    199198\end{figure} 
    200199%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    205204% ------------------------------------------------------------------------------------------------------------- 
    206205\section{Modified Leapfrog -- Asselin filter scheme} 
    207 \label{sec:STP_mLF} 
     206\label{sec:TD_mLF} 
    208207 
    209208Significant changes have been introduced by \cite{leclair.madec_OM09} in the LF-RA scheme in order to 
     
    212211 
    213212In a classical LF-RA environment, the forcing term is centred in time, 
    214 \ie it is time-stepped over a $2 \rdt$ period: 
     213\ie\ it is time-stepped over a $2 \rdt$ period: 
    215214$x^t = x^t + 2 \rdt Q^t$ where $Q$ is the forcing applied to $x$, 
    216 and the time filter is given by \autoref{eq:STP_asselin} so that $Q$ is redistributed over several time step. 
     215and the time filter is given by \autoref{eq:TD_asselin} so that $Q$ is redistributed over several time step. 
    217216In the modified LF-RA environment, these two formulations have been replaced by: 
    218217\begin{gather} 
    219   \label{eq:STP_forcing} 
     218  \label{eq:TD_forcing} 
    220219  x^{t + \rdt} = x^{t - \rdt} + \rdt \lt( Q^{t - \rdt / 2} + Q^{t + \rdt / 2} \rt)  \\ 
    221   \label{eq:STP_RA} 
     220  \label{eq:TD_RA} 
    222221  x_F^t       = x^t + \gamma \, \lt( x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt) 
    223222                    - \gamma \, \rdt \, \lt( Q^{t + \rdt / 2} - Q^{t - \rdt / 2} \rt) 
    224223\end{gather} 
    225 The change in the forcing formulation given by \autoref{eq:STP_forcing} (see \autoref{fig:MLF_forcing}) 
     224The change in the forcing formulation given by \autoref{eq:TD_forcing} (see \autoref{fig:TD_MLF_forcing}) 
    226225has a significant effect: 
    227226the forcing term no longer excites the divergence of odd and even time steps \citep{leclair.madec_OM09}. 
     
    231230Indeed, time filtering is no longer required on the forcing part. 
    232231The influence of the Asselin filter on the forcing is explicitly removed by adding a new term in the filter 
    233 (last term in \autoref{eq:STP_RA} compared to \autoref{eq:STP_asselin}). 
     232(last term in \autoref{eq:TD_RA} compared to \autoref{eq:TD_asselin}). 
    234233Since the filtering of the forcing was the source of non-conservation in the classical LF-RA scheme, 
    235234the modified formulation becomes conservative \citep{leclair.madec_OM09}. 
    236235Second, the LF-RA becomes a truly quasi -second order scheme. 
    237 Indeed, \autoref{eq:STP_forcing} used in combination with a careful treatment of static instability 
    238 (\autoref{subsec:ZDF_evd}) and of the TKE physics (\autoref{subsec:ZDF_tke_ene})  
     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}) 
    239238(the two other main sources of time step divergence), 
    240239allows a reduction by two orders of magnitude of the Asselin filter parameter. 
     
    242241Note that the forcing is now provided at the middle of a time step: 
    243242$Q^{t + \rdt / 2}$ is the forcing applied over the $[t,t + \rdt]$ time interval. 
    244 This and the change in the time filter, \autoref{eq:STP_RA}, 
     243This and the change in the time filter, \autoref{eq:TD_RA}, 
    245244allows for an exact evaluation of the contribution due to the forcing term between any two time steps, 
    246245even if separated by only $\rdt$ since the time filter is no longer applied to the forcing term. 
     
    248247%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    249248\begin{figure}[!t] 
    250   \begin{center} 
    251     \includegraphics[width=\textwidth]{Fig_MLF_forcing} 
    252     \caption{ 
    253       \protect\label{fig:MLF_forcing} 
    254       Illustration of forcing integration methods. 
    255       (top) ''Traditional'' formulation: 
    256       the forcing is defined at the same time as the variable to which it is applied 
    257       (integer value of the time step index) and it is applied over a $2 \rdt$ period. 
    258       (bottom)  modified formulation: 
    259       the forcing is defined in the middle of the time (integer and a half value of the time step index) and 
    260       the mean of two successive forcing values ($n - 1 / 2$, $n + 1 / 2$) is applied over a $2 \rdt$ period. 
    261     } 
    262   \end{center} 
     249  \centering 
     250  \includegraphics[width=0.66\textwidth]{Fig_MLF_forcing} 
     251  \caption[Forcing integration methods for modified leapfrog (top and bottom)]{ 
     252    Illustration of forcing integration methods. 
     253    (top) ''Traditional'' formulation: 
     254    the forcing is defined at the same time as the variable to which it is applied 
     255    (integer value of the time step index) and it is applied over a $2 \rdt$ period. 
     256    (bottom)  modified formulation: 
     257    the forcing is defined in the middle of the time 
     258    (integer and a half value of the time step index) and 
     259    the mean of two successive forcing values ($n - 1 / 2$, $n + 1 / 2$) is applied over 
     260    a $2 \rdt$ period.} 
     261  \label{fig:TD_MLF_forcing} 
    263262\end{figure} 
    264263%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    268267% ------------------------------------------------------------------------------------------------------------- 
    269268\section{Start/Restart strategy} 
    270 \label{sec:STP_rst} 
     269\label{sec:TD_rst} 
    271270 
    272271%--------------------------------------------namrun------------------------------------------- 
    273 \nlst{namrun} 
     272\begin{listing} 
     273  \nlst{namrun} 
     274  \caption{\forcode{&namrun}} 
     275  \label{lst:namrun} 
     276\end{listing} 
    274277%-------------------------------------------------------------------------------------------------------------- 
    275278 
     
    277280(Euler time integration): 
    278281\[ 
    279   % \label{eq:DOM_euler} 
     282  % \label{eq:TD_DOM_euler} 
    280283  x^1 = x^0 + \rdt \ \text{RHS}^0 
    281284\] 
    282 This is done simply by keeping the leapfrog environment (\ie the \autoref{eq:STP} three level time stepping) but 
     285This is done simply by keeping the leapfrog environment (\ie\ the \autoref{eq:TD} three level time stepping) but 
    283286setting all $x^0$ (\textit{before}) and $x^1$ (\textit{now}) fields equal at the first time step and 
    284 using half the value of a leapfrog time step ($2 \rdt$).  
     287using half the value of a leapfrog time step ($2 \rdt$). 
    285288 
    286289It is also possible to restart from a previous computation, by using a restart file. 
     
    292295 
    293296Note that the time step $\rdt$, is also saved in the restart file. 
    294 When restarting, if the time step has been changed, or one of the prognostic variables at \textit{before} time step  
    295 is missing, an Euler time stepping scheme is imposed. A forward initial step can still be enforced by the user by setting  
    296 the namelist variable \np{nn\_euler}\forcode{=0}. Other options to control the time integration of the model  
    297 are defined through the  \ngn{namrun} namelist variables. 
     297When restarting, if the time step has been changed, or one of the prognostic variables at \textit{before} time step 
     298is missing, an Euler time stepping scheme is imposed. A forward initial step can still be enforced by the user by setting 
     299the namelist variable \np{nn\_euler}\forcode{=0}. Other options to control the time integration of the model 
     300are defined through the  \nam{run} namelist variables. 
    298301%%% 
    299302\gmcomment{ 
     
    302305add also the idea of writing several restart for seasonal forecast : how is it done ? 
    303306 
    304 verify that all namelist pararmeters are truly described  
     307verify that all namelist pararmeters are truly described 
    305308 
    306309a word on the check of restart  ..... 
     
    308311%%% 
    309312 
    310 \gmcomment{       % add a subsection here   
     313\gmcomment{       % add a subsection here 
    311314 
    312315%------------------------------------------------------------------------------------------------------------- 
     
    314317% ------------------------------------------------------------------------------------------------------------- 
    315318\subsection{Time domain} 
    316 \label{subsec:STP_time} 
     319\label{subsec:TD_time} 
    317320%--------------------------------------------namrun------------------------------------------- 
    318321 
    319 \nlst{namdom}          
    320322%-------------------------------------------------------------------------------------------------------------- 
    321323 
    322 Options are defined through the  \ngn{namdom} namelist variables. 
     324Options are defined through the  \nam{dom} namelist variables. 
    323325 \colorbox{yellow}{add here a few word on nit000 and nitend} 
    324326 
     
    332334 
    333335%% 
    334 \gmcomment{       % add implicit in vvl case  and Crant-Nicholson scheme    
     336\gmcomment{       % add implicit in vvl case  and Crant-Nicholson scheme 
    335337 
    336338Implicit time stepping in case of variable volume thickness. 
Note: See TracChangeset for help on using the changeset viewer.