\documentclass[NEMO_book]{subfiles}
\begin{document}
% ================================================================
% Chapter Assimilation increments (ASM)
% ================================================================
\chapter{Apply assimilation increments (ASM)}
\label{ASM}

Authors: D. Lea,  M. Martin, K. Mogensen, A. Weaver, ...   % do we keep

\minitoc


\newpage
$\ $\newline    % force a new line

The ASM code adds the functionality to apply increments to the model variables: 
temperature, salinity, sea surface height, velocity and sea ice concentration. 
These are read into the model from a NetCDF file which may be produced by separate data
assimilation code.  The code can also output model background fields which are used
as an input to data assimilation code. This is all controlled by the namelist
\textit{\ngn{nam\_asminc} }.  There is a brief description of all the namelist options
provided.  To build the ASM code \key{asminc} must be set.

%===============================================================

\section{Direct initialization}
\label{ASM_DI}

Direct initialization (DI) refers to the instantaneous correction
of the model background state using the analysis increment.
DI is used when \np{ln\_asmdin} is set to true.

\section{Incremental Analysis Updates}
\label{ASM_IAU}

Rather than updating the model state directly with the analysis increment,
it may be preferable to introduce the increment gradually into the ocean
model in order to minimize spurious adjustment processes. This technique
is referred to as Incremental Analysis Updates (IAU) \citep{Bloom_al_MWR96}.
IAU is a common technique used with 3D assimilation methods such as 3D-Var or OI.
IAU is used when \np{ln\_asmiau} is set to true.

With IAU, the model state trajectory ${\bf x}$ in the assimilation window 
($t_{0} \leq t_{i} \leq t_{N}$)
is corrected by adding the analysis increments for temperature, salinity, horizontal velocity and SSH
as additional tendency terms to the prognostic equations:
\begin{eqnarray}     \label{eq:wa_traj_iau}
{\bf x}^{a}(t_{i}) = M(t_{i}, t_{0})[{\bf x}^{b}(t_{0})] 
\; + \; F_{i} \delta \tilde{\bf x}^{a} 
\end{eqnarray}
where $F_{i}$ is a weighting function for applying the increments $\delta
\tilde{\bf x}^{a}$ defined such that $\sum_{i=1}^{N} F_{i}=1$.
${\bf x}^b$ denotes the model initial state and ${\bf x}^a$ is the model state
after the increments are applied. 
To control the adjustment time of the model to the increment,
the increment can be applied over an arbitrary sub-window,
$t_{m} \leq t_{i} \leq t_{n}$, of the main assimilation window,
where $t_{0} \leq t_{m} \leq t_{i}$ and $t_{i} \leq t_{n} \leq t_{N}$,
Typically the increments are spread evenly over the full window.
In addition, two different weighting functions have been implemented.
The first function employs constant weights, 
\begin{eqnarray}    \label{eq:F1_i}
F^{(1)}_{i}
=\left\{ \begin{array}{ll}
   0     &    {\rm if} \; \; \; t_{i} < t_{m}                \\
   1/M &    {\rm if} \; \; \; t_{m} < t_{i} \leq t_{n} \\
   0     &    {\rm if} \; \; \; t_{i} > t_{n}
  \end{array} \right. 
\end{eqnarray}
where $M = m-n$.
The second function employs peaked hat-like weights in order to give maximum 
weight in the centre of the sub-window, with the weighting reduced 
linearly to a small value at the window end-points:
\begin{eqnarray}     \label{eq:F2_i}
F^{(2)}_{i}
=\left\{ \begin{array}{ll}
   0                           &    {\rm if} \; \; \; t_{i}       <     t_{m}                        \\
   \alpha \, i               &    {\rm if} \; \; \; t_{m}    \leq t_{i}    \leq   t_{M/2}   \\
   \alpha \, (M - i +1) &    {\rm if} \; \; \; t_{M/2}  <    t_{i}    \leq   t_{n}       \\
   0                            &   {\rm if} \; \; \; t_{i}        >    t_{n}
  \end{array} \right.
\end{eqnarray}
where $\alpha^{-1} = \sum_{i=1}^{M/2} 2i$ and $M$ is assumed to be even. 
The weights described by \eqref{eq:F2_i} provide a 
smoother transition of the analysis trajectory from one assimilation cycle 
to the next than that described by \eqref{eq:F1_i}.

%==========================================================================
% Divergence damping description %%%
\section{Divergence damping initialisation}
\label{ASM_details}

The velocity increments may be initialized by the iterative application of 
a divergence damping operator. In iteration step $n$ new estimates of 
velocity increments $u^{n}_I$ and $v^{n}_I$ are updated by:
\begin{equation} \label{eq:asm_dmp}
\left\{ \begin{aligned}
 u^{n}_I = u^{n-1}_I + \frac{1}{e_{1u} } \delta _{i+1/2} \left( {A_D
\;\chi^{n-1}_I } \right) \\
\\
 v^{n}_I = v^{n-1}_I + \frac{1}{e_{2v} } \delta _{j+1/2} \left( {A_D
\;\chi^{n-1}_I } \right) \\
\end{aligned} \right.,
\end{equation}
where
\begin{equation} \label{eq:asm_div}
\chi^{n-1}_I = \frac{1}{e_{1t}\,e_{2t}\,e_{3t} }
                \left( {\delta _i \left[ {e_{2u}\,e_{3u}\,u^{n-1}_I} \right]
                       +\delta _j \left[ {e_{1v}\,e_{3v}\,v^{n-1}_I} \right]} \right).
\end{equation}
By the application of \eqref{eq:asm_dmp} and \eqref{eq:asm_dmp} the divergence is filtered
in each iteration, and the vorticity is left unchanged. In the presence of coastal boundaries
with zero velocity increments perpendicular to the coast the divergence is strongly damped.
This type of the initialisation reduces the vertical velocity magnitude  and alleviates the
problem of the excessive unphysical vertical mixing in the first steps of the model 
integration \citep{Talagrand_JAS72, Dobricic_al_OS07}. Diffusion coefficients are defined as 
$A_D = \alpha e_{1t} e_{2t}$, where $\alpha = 0.2$. The divergence damping is activated by
assigning to \np{nn\_divdmp} in the \textit{nam\_asminc} namelist a value greater than zero. 
By choosing this value to be of the order of 100 the increments in the vertical velocity will 
be significantly reduced.


%==========================================================================

\section{Implementation details}
\label{ASM_details}

Here we show an example \ngn{namasm} namelist and the header of an example assimilation 
increments file on the ORCA2 grid.

%------------------------------------------namasm-----------------------------------------------------
%\fortranfile{namelists/namasm}
%-------------------------------------------------------------------------------------------------------------

The header of an assimilation increments file produced using the NetCDF tool
\mbox{\textit{ncdump~-h}} is shown below

\begin{ccode}
netcdf assim_background_increments {
dimensions:
        x = 182 ;
        y = 149 ;
        z = 31 ;
        t = UNLIMITED ; // (1 currently)
variables:
        float nav_lon(y, x) ;
        float nav_lat(y, x) ;
        float nav_lev(z) ;
        double time_counter(t) ;
        double time ;
        double z_inc_dateb ;
        double z_inc_datef ;
        double bckint(t, z, y, x) ;
        double bckins(t, z, y, x) ;
        double bckinu(t, z, y, x) ;
        double bckinv(t, z, y, x) ;
        double bckineta(t, y, x) ;

// global attributes:
                :DOMAIN_number_total = 1 ;
                :DOMAIN_number = 0 ;
                :DOMAIN_dimensions_ids = 1, 2 ;
                :DOMAIN_size_global = 182, 149 ;
                :DOMAIN_size_local = 182, 149 ;
                :DOMAIN_position_first = 1, 1 ;
                :DOMAIN_position_last = 182, 149 ;
                :DOMAIN_halo_size_start = 0, 0 ;
                :DOMAIN_halo_size_end = 0, 0 ;
                :DOMAIN_type = "BOX" ;
}
\end{ccode}

\end{document}
