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.
apdx_triads.tex in NEMO/trunk/doc/latex/NEMO/subfiles – NEMO

source: NEMO/trunk/doc/latex/NEMO/subfiles/apdx_triads.tex

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

Fix headings with fortran code

File size: 62.1 KB
Line 
1\documentclass[../main/NEMO_manual]{subfiles}
2
3\begin{document}
4
5\chapter{Iso-Neutral Diffusion and Eddy Advection using Triads}
6\label{apdx:TRIADS}
7
8\chaptertoc
9
10\paragraph{Changes record} ~\\
11
12{\footnotesize
13  \begin{tabularx}{\textwidth}{l||X|X}
14    Release & Author(s) & Modifications \\
15    \hline
16    {\em   4.0} & {\em ...} & {\em ...} \\
17    {\em   3.6} & {\em ...} & {\em ...} \\
18    {\em   3.4} & {\em ...} & {\em ...} \\
19    {\em <=3.4} & {\em ...} & {\em ...}
20  \end{tabularx}
21}
22
23\clearpage
24
25%% =================================================================================================
26\section[Choice of \forcode{namtra_ldf} namelist parameters]{Choice of \protect\nam{tra_ldf}{tra\_ldf} namelist parameters}
27
28Two scheme are available to perform the iso-neutral diffusion.
29If the namelist logical \np{ln_traldf_triad}{ln\_traldf\_triad} is set true,
30\NEMO\ updates both active and passive tracers using the Griffies triad representation of iso-neutral diffusion and
31the eddy-induced advective skew (GM) fluxes.
32If the namelist logical \np{ln_traldf_iso}{ln\_traldf\_iso} is set true,
33the filtered version of Cox's original scheme (the Standard scheme) is employed (\autoref{sec:LDF_slp}).
34In the present implementation of the Griffies scheme,
35the advective skew fluxes are implemented even if \np{ln_traldf_eiv}{ln\_traldf\_eiv} is false.
36
37Values of iso-neutral diffusivity and GM coefficient are set as described in \autoref{sec:LDF_coef}.
38Note that when GM fluxes are used, the eddy-advective (GM) velocities are output for diagnostic purposes using XIOS,
39even though the eddy advection is accomplished by means of the skew fluxes.
40
41The options specific to the Griffies scheme include:
42\begin{description}
43\item [{\np{ln_triad_iso}{ln\_triad\_iso}}] See \autoref{sec:TRIADS_taper}.
44  If this is set false (the default),
45  then `iso-neutral' mixing is accomplished within the surface mixed-layer along slopes linearly decreasing with
46  depth from the value immediately below the mixed-layer to zero (flat) at the surface (\autoref{sec:TRIADS_lintaper}).
47  This is the same treatment as used in the default implementation
48  \autoref{subsec:LDF_slp_iso}; \autoref{fig:LDF_eiv_slp}.
49  Where \np{ln_triad_iso}{ln\_triad\_iso} is set true,
50  the vertical skew flux is further reduced to ensure no vertical buoyancy flux,
51  giving an almost pure horizontal diffusive tracer flux within the mixed layer.
52  This is similar to the tapering suggested by \citet{gerdes.koberle.ea_CD91}. See \autoref{subsec:TRIADS_Gerdes-taper}
53\item [{\np{ln_botmix_triad}{ln\_botmix\_triad}}] See \autoref{sec:TRIADS_iso_bdry}.
54  If this is set false (the default) then the lateral diffusive fluxes
55  associated with triads partly masked by topography are neglected.
56  If it is set true, however, then these lateral diffusive fluxes are applied,
57  giving smoother bottom tracer fields at the cost of introducing diapycnal mixing.
58\item [{\np{rn_sw_triad}{rn\_sw\_triad}}] blah blah to be added....
59\end{description}
60The options shared with the Standard scheme include:
61\begin{description}
62\item [{\np{ln_traldf_msc}{ln\_traldf\_msc}}] blah blah to be added
63\item [{\np{rn_slpmax}{rn\_slpmax}}]          blah blah to be added
64\end{description}
65
66%% =================================================================================================
67\section{Triad formulation of iso-neutral diffusion}
68\label{sec:TRIADS_iso}
69
70We have implemented into \NEMO\ a scheme inspired by \citet{griffies.gnanadesikan.ea_JPO98},
71but formulated within the \NEMO\ framework, using scale factors rather than grid-sizes.
72
73%% =================================================================================================
74\subsection{Iso-neutral diffusion operator}
75
76The iso-neutral second order tracer diffusive operator for small angles between
77iso-neutral surfaces and geopotentials is given by \autoref{eq:TRIADS_iso_tensor_1}:
78\begin{subequations}
79  \label{eq:TRIADS_iso_tensor_1}
80  \begin{equation}
81    D^{lT}=-\nabla \cdot\vect{f}^{lT}\equiv
82    -\frac{1}{e_1e_2e_3}\left[\pd{i}\left (f_1^{lT}e_2e_3\right) +
83      \pd{j}\left (f_2^{lT}e_2e_3\right) + \pd{k}\left (f_3^{lT}e_1e_2\right)\right],
84  \end{equation}
85  where the diffusive flux per unit area of physical space
86  \begin{equation}
87    \vect{f}^{lT}=-{A^{lT}}\Re\cdot\nabla T,
88  \end{equation}
89  \begin{equation}
90    \label{eq:TRIADS_iso_tensor_2}
91    \mbox{with}\quad \;\;\Re =
92    \begin{pmatrix}
93      1   &  0   & -r_1           \rule[-.9 em]{0pt}{1.79 em} \\
94      0   &  1   & -r_2           \rule[-.9 em]{0pt}{1.79 em} \\
95      -r_1 & -r_2 &  r_1 ^2+r_2 ^2 \rule[-.9 em]{0pt}{1.79 em}
96    \end{pmatrix}
97    \quad \text{and} \quad\nabla T=
98    \begin{pmatrix}
99      \frac{1}{e_1} \pd[T]{i} \rule[-.9 em]{0pt}{1.79 em} \\
100      \frac{1}{e_2} \pd[T]{j} \rule[-.9 em]{0pt}{1.79 em} \\
101      \frac{1}{e_3} \pd[T]{k} \rule[-.9 em]{0pt}{1.79 em}
102    \end{pmatrix}
103    .
104  \end{equation}
105\end{subequations}
106% \left( {{\begin{array}{*{20}c}
107%  1 \hfill & 0 \hfill & {-r_1 } \hfill \\
108%  0 \hfill & 1 \hfill & {-r_2 } \hfill \\
109%  {-r_1 } \hfill & {-r_2 } \hfill & {r_1 ^2+r_2 ^2} \hfill \\
110% \end{array} }} \right)
111Here \autoref{eq:MB_iso_slopes}
112\begin{align*}
113  r_1 &=-\frac{e_3 }{e_1 } \left( \frac{\partial \rho }{\partial i}
114        \right)
115        \left( {\frac{\partial \rho }{\partial k}} \right)^{-1} \\
116      &=-\frac{e_3 }{e_1 } \left( -\alpha\frac{\partial T }{\partial i} +
117        \beta\frac{\partial S }{\partial i} \right) \left(
118        -\alpha\frac{\partial T }{\partial k} + \beta\frac{\partial S
119        }{\partial k} \right)^{-1}
120\end{align*}
121is the $i$-component of the slope of the iso-neutral surface relative to the computational surface,
122and $r_2$ is the $j$-component.
123
124We will find it useful to consider the fluxes per unit area in $i,j,k$ space; we write
125\[
126  % \label{eq:TRIADS_Fijk}
127  \vect{F}_{\mathrm{iso}}=\left(f_1^{lT}e_2e_3, f_2^{lT}e_1e_3, f_3^{lT}e_1e_2\right).
128\]
129Additionally, we will sometimes write the contributions towards the fluxes $\vect{f}$ and
130$\vect{F}_{\mathrm{iso}}$ from the component $R_{ij}$ of $\Re$ as $f_{ij}$, $F_{\mathrm{iso}\: ij}$,
131with $f_{ij}=R_{ij}e_i^{-1}\partial T/\partial x_i$ (no summation) etc.
132
133The off-diagonal terms of the small angle diffusion tensor
134\autoref{eq:TRIADS_iso_tensor_1}, \autoref{eq:TRIADS_iso_tensor_2} produce skew-fluxes along
135the $i$- and $j$-directions resulting from the vertical tracer gradient:
136\begin{align}
137  \label{eq:TRIADS_i13c}
138  f_{13}=&+{A^{lT}} r_1\frac{1}{e_3}\frac{\partial T}{\partial k},\qquad f_{23}=+{A^{lT}} r_2\frac{1}{e_3}\frac{\partial T}{\partial k}\\
139  \intertext{and in the k-direction resulting from the lateral tracer gradients}
140  \label{eq:TRIADS_i31c}
141  f_{31}+f_{32}=& {A^{lT}} r_1\frac{1}{e_1}\frac{\partial T}{\partial i}+{A^{lT}} r_2\frac{1}{e_1}\frac{\partial T}{\partial i}
142\end{align}
143
144The vertical diffusive flux associated with the $_{33}$ component of the small angle diffusion tensor is
145\begin{equation}
146  \label{eq:TRIADS_i33c}
147  f_{33}=-{A^{lT}}(r_1^2 +r_2^2) \frac{1}{e_3}\frac{\partial T}{\partial k}.
148\end{equation}
149
150Since there are no cross terms involving $r_1$ and $r_2$ in the above,
151we can consider the iso-neutral diffusive fluxes separately in the $i$-$k$ and $j$-$k$ planes,
152just adding together the vertical components from each plane.
153The following description will describe the fluxes on the $i$-$k$ plane.
154
155There is no natural discretization for the $i$-component of the skew-flux, \autoref{eq:TRIADS_i13c},
156as although it must be evaluated at $u$-points,
157it involves vertical gradients (both for the tracer and the slope $r_1$), defined at $w$-points.
158Similarly, the vertical skew flux, \autoref{eq:TRIADS_i31c},
159is evaluated at $w$-points but involves horizontal gradients defined at $u$-points.
160
161%% =================================================================================================
162\subsection{Standard discretization}
163
164The straightforward approach to discretize the lateral skew flux
165\autoref{eq:TRIADS_i13c} from tracer cell $i,k$ to $i+1,k$, introduced in 1995 into OPA,
166\autoref{eq:TRA_ldf_iso}, is to calculate a mean vertical gradient at the $u$-point from
167the average of the four surrounding vertical tracer gradients, and multiply this by a mean slope at the $u$-point,
168calculated from the averaged surrounding vertical density gradients.
169The total area-integrated skew-flux (flux per unit area in $ijk$ space) from tracer cell $i,k$ to $i+1,k$,
170noting that the $e_{{3}_{i+1/2}^k}$ in the area $e{_{3}}_{i+1/2}^k{e_{2}}_{i+1/2}i^k$ at the $u$-point cancels out with
171the $1/{e_{3}}_{i+1/2}^k$ associated with the vertical tracer gradient, is then \autoref{eq:TRA_ldf_iso}
172\[
173  \left(F_u^{13} \right)_{i+\frac{1}{2}}^k = {A}_{i+\frac{1}{2}}^k
174  {e_{2}}_{i+1/2}^k \overline{\overline
175    r_1} ^{\,i,k}\,\overline{\overline{\delta_k T}}^{\,i,k},
176\]
177where
178\[
179  \overline{\overline
180    r_1} ^{\,i,k} = -\frac{{e_{3u}}_{i+1/2}^k}{{e_{1u}}_{i+1/2}^k}
181  \frac{\delta_{i+1/2} [\rho]}{\overline{\overline{\delta_k \rho}}^{\,i,k}},
182\]
183and here and in the following we drop the $^{lT}$ superscript from ${A^{lT}}$ for simplicity.
184Unfortunately the resulting combination $\overline{\overline{\delta_k\bullet}}^{\,i,k}$ of a $k$ average and
185a $k$ difference of the tracer reduces to $\bullet_{k+1}-\bullet_{k-1}$,
186so two-grid-point oscillations are invisible to this discretization of the iso-neutral operator.
187These \emph{computational modes} will not be damped by this operator, and may even possibly be amplified by it.
188Consequently, applying this operator to a tracer does not guarantee the decrease of its global-average variance.
189To correct this, we introduced a smoothing of the slopes of the iso-neutral surfaces (see \autoref{chap:LDF}).
190This technique works for $T$ and $S$ in so far as they are active tracers
191(\ie\ they enter the computation of density), but it does not work for a passive tracer.
192
193%% =================================================================================================
194\subsection{Expression of the skew-flux in terms of triad slopes}
195
196\citep{griffies.gnanadesikan.ea_JPO98} introduce a different discretization of the off-diagonal terms that
197nicely solves the problem.
198% Instead of multiplying the mean slope calculated at the $u$-point by
199% the mean vertical gradient at the $u$-point,
200\begin{figure}[tb]
201  \centering
202  \includegraphics[width=0.66\textwidth]{TRIADS_GRIFF_triad_fluxes}
203  \caption[Triads arrangement and tracer gradients to give lateral and vertical tracer fluxes]{
204    (a) Arrangement of triads $S_i$ and tracer gradients to
205    give lateral tracer flux from box $i,k$ to $i+1,k$
206    (b) Triads $S'_i$ and tracer gradients to give vertical tracer flux from
207    box $i,k$ to $i,k+1$.}
208  \label{fig:TRIADS_ISO_triad}
209\end{figure}
210They get the skew flux from the products of the vertical gradients at each $w$-point surrounding the $u$-point with
211the corresponding `triad' slope calculated from the lateral density gradient across the $u$-point divided by
212the vertical density gradient at the same $w$-point as the tracer gradient.
213See \autoref{fig:TRIADS_ISO_triad}a, where the thick lines denote the tracer gradients,
214and the thin lines the corresponding triads, with slopes $s_1, \dotsc s_4$.
215The total area-integrated skew-flux from tracer cell $i,k$ to $i+1,k$
216\begin{multline}
217  \label{eq:TRIADS_i13}
218  \left( F_u^{13}  \right)_{i+\frac{1}{2}}^k = {A}_{i+1}^k a_1 s_1
219  \delta_{k+\frac{1}{2}} \left[ T^{i+1}
220  \right]/e_{{3w}_{i+1}}^{k+\frac{1}{2}}  + {A} _i^k a_2 s_2 \delta
221  _{k+\frac{1}{2}} \left[ T^i
222  \right]/e_{{3w}_{i+1}}^{k+\frac{1}{2}} \\
223  +{A} _{i+1}^k a_3 s_3 \delta_{k-\frac{1}{2}} \left[ T^{i+1}
224  \right]/e_{{3w}_{i+1}}^{k+\frac{1}{2}}  +{A} _i^k a_4 s_4 \delta
225  _{k-\frac{1}{2}} \left[ T^i \right]/e_{{3w}_{i+1}}^{k+\frac{1}{2}},
226\end{multline}
227where the contributions of the triad fluxes are weighted by areas $a_1, \dotsc a_4$,
228and ${A}$ is now defined at the tracer points rather than the $u$-points.
229This discretization gives a much closer stencil, and disallows the two-point computational modes.
230
231The vertical skew flux \autoref{eq:TRIADS_i31c} from tracer cell $i,k$ to $i,k+1$ at
232the $w$-point $i,k+\frac{1}{2}$ is constructed similarly (\autoref{fig:TRIADS_ISO_triad}b) by
233multiplying lateral tracer gradients from each of the four surrounding $u$-points by the appropriate triad slope:
234\begin{multline}
235  \label{eq:TRIADS_i31}
236  \left( F_w^{31} \right) _i ^{k+\frac{1}{2}} =  {A}_i^{k+1} a_{1}'
237  s_{1}' \delta_{i-\frac{1}{2}} \left[ T^{k+1} \right]/{e_{3u}}_{i-\frac{1}{2}}^{k+1}
238  +{A}_i^{k+1} a_{2}' s_{2}' \delta_{i+\frac{1}{2}} \left[ T^{k+1} \right]/{e_{3u}}_{i+\frac{1}{2}}^{k+1} \\
239  + {A}_i^k a_{3}' s_{3}' \delta_{i-\frac{1}{2}} \left[ T^k\right]/{e_{3u}}_{i-\frac{1}{2}}^k
240  +{A}_i^k a_{4}' s_{4}' \delta_{i+\frac{1}{2}} \left[ T^k \right]/{e_{3u}}_{i+\frac{1}{2}}^k.
241\end{multline}
242
243We notate the triad slopes $s_i$ and $s'_i$ in terms of the `anchor point' $i,k$
244(appearing in both the vertical and lateral gradient),
245and the $u$- and $w$-points $(i+i_p,k)$, $(i,k+k_p)$ at the centres of the `arms' of the triad as follows
246(see also \autoref{fig:TRIADS_ISO_triad}):
247\begin{equation}
248  \label{eq:TRIADS_R}
249  _i^k \mathbb{R}_{i_p}^{k_p}
250  =-\frac{ {e_{3w}}_{\,i}^{\,k+k_p}} { {e_{1u}}_{\,i+i_p}^{\,k}}
251  \
252  \frac
253  { \alpha_i^\ \delta_{i+i_p}[T^k] - \beta_i^k \ \delta_{i+i_p}[S^k] }
254  { \alpha_i^\ \delta_{k+k_p}[T^i] - \beta_i^k \ \delta_{k+k_p}[S^i] }.
255\end{equation}
256In calculating the slopes of the local neutral surfaces,
257the expansion coefficients $\alpha$ and $\beta$ are evaluated at the anchor points of the triad,
258while the metrics are calculated at the $u$- and $w$-points on the arms.
259
260\begin{figure}[tb]
261  \centering
262  \includegraphics[width=0.66\textwidth]{TRIADS_GRIFF_qcells}
263  \caption[Triad notation for quarter cells]{
264    Triad notation for quarter cells.
265    $T$-cells are inside boxes,
266    while the $i+\fractext{1}{2},k$ $u$-cell is shaded in green and
267    the $i,k+\fractext{1}{2}$ $w$-cell is shaded in pink.}
268  \label{fig:TRIADS_qcells}
269\end{figure}
270
271Each triad $\{_i^{k}\:_{i_p}^{k_p}\}$ is associated (\autoref{fig:TRIADS_qcells}) with the quarter cell that is
272the intersection of the $i,k$ $T$-cell, the $i+i_p,k$ $u$-cell and the $i,k+k_p$ $w$-cell.
273Expressing the slopes $s_i$ and $s'_i$ in \autoref{eq:TRIADS_i13} and \autoref{eq:TRIADS_i31} in this notation,
274we have \eg\ \ $s_1=s'_1={\:}_i^k \mathbb{R}_{1/2}^{1/2}$.
275Each triad slope $_i^k\mathbb{R}_{i_p}^{k_p}$ is used once (as an $s$) to
276calculate the lateral flux along its $u$-arm, at $(i+i_p,k)$,
277and then again as an $s'$ to calculate the vertical flux along its $w$-arm at $(i,k+k_p)$.
278Each vertical area $a_i$ used to calculate the lateral flux and horizontal area $a'_i$ used to
279calculate the vertical flux can also be identified as the area across the $u$- and $w$-arms of a unique triad,
280and we notate these areas, similarly to the triad slopes,
281as $_i^k{\mathbb{A}_u}_{i_p}^{k_p}$, $_i^k{\mathbb{A}_w}_{i_p}^{k_p}$,
282where \eg\ in \autoref{eq:TRIADS_i13} $a_{1}={\:}_i^k{\mathbb{A}_u}_{1/2}^{1/2}$,
283and in \autoref{eq:TRIADS_i31} $a'_{1}={\:}_i^k{\mathbb{A}_w}_{1/2}^{1/2}$.
284
285%% =================================================================================================
286\subsection{Full triad fluxes}
287
288A key property of iso-neutral diffusion is that it should not affect the (locally referenced) density.
289In particular there should be no lateral or vertical density flux.
290The lateral density flux disappears so long as the area-integrated lateral diffusive flux from
291tracer cell $i,k$ to $i+1,k$ coming from the $_{11}$ term of the diffusion tensor takes the form
292\begin{equation}
293  \label{eq:TRIADS_i11}
294  \left( F_u^{11} \right) _{i+\frac{1}{2}} ^{k} =
295  - \left( {A}_i^{k+1} a_{1} + {A}_i^{k+1} a_{2} + {A}_i^k
296    a_{3} + {A}_i^k a_{4} \right)
297  \frac{\delta_{i+1/2} \left[ T^k\right]}{{e_{1u}}_{\,i+1/2}^{\,k}},
298\end{equation}
299where the areas $a_i$ are as in \autoref{eq:TRIADS_i13}.
300In this case, separating the total lateral flux, the sum of \autoref{eq:TRIADS_i13} and \autoref{eq:TRIADS_i11},
301into triad components, a lateral tracer flux
302\begin{equation}
303  \label{eq:TRIADS_latflux-triad}
304  _i^k {\mathbb{F}_u}_{i_p}^{k_p} (T) = - {A}_i^k{ \:}_i^k{\mathbb{A}_u}_{i_p}^{k_p}
305  \left(
306    \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
307    -\ {_i^k\mathbb{R}_{i_p}^{k_p}} \
308    \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
309  \right)
310\end{equation}
311can be identified with each triad.
312Then, because the same metric factors ${e_{3w}}_{\,i}^{\,k+k_p}$ and ${e_{1u}}_{\,i+i_p}^{\,k}$ are employed for both
313the density gradients in $ _i^k \mathbb{R}_{i_p}^{k_p}$ and the tracer gradients,
314the lateral density flux associated with each triad separately disappears.
315\begin{equation}
316  \label{eq:TRIADS_latflux-rho}
317  {\mathbb{F}_u}_{i_p}^{k_p} (\rho)=-\alpha _i^k {\:}_i^k {\mathbb{F}_u}_{i_p}^{k_p} (T) + \beta_i^k {\:}_i^k {\mathbb{F}_u}_{i_p}^{k_p} (S)=0
318\end{equation}
319Thus the total flux $\left( F_u^{31} \right) ^i _{i,k+\frac{1}{2}} + \left( F_u^{11} \right) ^i _{i,k+\frac{1}{2}}$ from
320tracer cell $i,k$ to $i+1,k$ must also vanish since it is a sum of four such triad fluxes.
321
322The squared slope $r_1^2$ in the expression \autoref{eq:TRIADS_i33c} for the $_{33}$ component is also expressed in
323terms of area-weighted squared triad slopes,
324so the area-integrated vertical flux from tracer cell $i,k$ to $i,k+1$ resulting from the $r_1^2$ term is
325\begin{equation}
326  \label{eq:TRIADS_i33}
327  \left( F_w^{33} \right) _i^{k+\frac{1}{2}} =
328  - \left( {A}_i^{k+1} a_{1}' s_{1}'^2
329    + {A}_i^{k+1} a_{2}' s_{2}'^2
330    + {A}_i^k a_{3}' s_{3}'^2
331    + {A}_i^k a_{4}' s_{4}'^2 \right)\delta_{k+\frac{1}{2}} \left[ T^{i+1} \right],
332\end{equation}
333where the areas $a'$ and slopes $s'$ are the same as in \autoref{eq:TRIADS_i31}.
334Then, separating the total vertical flux, the sum of \autoref{eq:TRIADS_i31} and \autoref{eq:TRIADS_i33},
335into triad components, a vertical flux
336\begin{align}
337  \label{eq:TRIADS_vertflux-triad}
338  _i^k {\mathbb{F}_w}_{i_p}^{k_p} (T)
339  &= {A}_i^k{\: }_i^k{\mathbb{A}_w}_{i_p}^{k_p}
340    \left(
341    {_i^k\mathbb{R}_{i_p}^{k_p}}\frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
342    -\ \left({_i^k\mathbb{R}_{i_p}^{k_p}}\right)^2 \
343    \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
344    \right) \\
345  &= - \left(\left.{ }_i^k{\mathbb{A}_w}_{i_p}^{k_p}\right/{ }_i^k{\mathbb{A}_u}_{i_p}^{k_p}\right)
346    {_i^k\mathbb{R}_{i_p}^{k_p}}{\: }_i^k{\mathbb{F}_u}_{i_p}^{k_p} (T) \label{eq:TRIADS_vertflux-triad2}
347\end{align}
348may be associated with each triad.
349Each vertical density flux $_i^k {\mathbb{F}_w}_{i_p}^{k_p} (\rho)$ associated with a triad then
350separately disappears (because the lateral flux $_i^k{\mathbb{F}_u}_{i_p}^{k_p} (\rho)$ disappears).
351Consequently the total vertical density flux
352$\left( F_w^{31} \right)_i ^{k+\frac{1}{2}} + \left( F_w^{33} \right)_i^{k+\frac{1}{2}}$ from
353tracer cell $i,k$ to $i,k+1$ must also vanish since it is a sum of four such triad fluxes.
354
355We can explicitly identify (\autoref{fig:TRIADS_qcells}) the triads associated with the $s_i$, $a_i$,
356and $s'_i$, $a'_i$ used in the definition of the $u$-fluxes and $w$-fluxes in \autoref{eq:TRIADS_i31},
357\autoref{eq:TRIADS_i13}, \autoref{eq:TRIADS_i11} \autoref{eq:TRIADS_i33} and \autoref{fig:TRIADS_ISO_triad} to write out
358the iso-neutral fluxes at $u$- and $w$-points as sums of the triad fluxes that cross the $u$- and $w$-faces:
359%(\autoref{fig:TRIADS_ISO_triad}):
360\begin{flalign}
361  \label{eq:TRIADS_iso_flux} \vect{F}_{\mathrm{iso}}(T) &\equiv
362  \sum_{\substack{i_p,\,k_p}}
363  \begin{pmatrix}
364    {_{i+1/2-i_p}^k {\mathbb{F}_u}_{i_p}^{k_p} } (T) \\ \\
365    {_i^{k+1/2-k_p} {\mathbb{F}_w}_{i_p}^{k_p} } (T) \\
366  \end{pmatrix}.
367\end{flalign}
368
369%% =================================================================================================
370\subsection{Ensuring the scheme does not increase tracer variance}
371\label{subsec:TRIADS_variance}
372
373We now require that this operator should not increase the globally-integrated tracer variance.
374%This changes according to
375% \begin{align*}
376% &\int_D  D_l^T \; T \;dv \equiv  \sum_{i,k} \left\{ T \ D_l^T \ b_T \right\}    \\
377% &\equiv + \sum_{i,k} \sum_{\substack{i_p,\,k_p}} \left\{
378%     \delta_{i} \left[{_{i+1/2-i_p}^k {\mathbb{F}_u }_{i_p}^{k_p}} \right]
379%       + \delta_{k} \left[ {_i^{k+1/2-k_p} {\mathbb{F}_w}_{i_p}^{k_p}} \right]  \ T \right\}    \\
380% &\equiv  - \sum_{i,k} \sum_{\substack{i_p,\,k_p}} \left\{
381%                 {_{i+1/2-i_p}^k {\mathbb{F}_u }_{i_p}^{k_p}} \ \delta_{i+1/2} [T]
382%              + {_i^{k+1/2-k_p} {\mathbb{F}_w}_{i_p}^{k_p}}  \ \delta_{k+1/2} [T]   \right\}      \\
383% \end{align*}
384Each triad slope $_i^k\mathbb{R}_{i_p}^{k_p}$ drives a lateral flux $_i^k{\mathbb{F}_u}_{i_p}^{k_p} (T)$ across
385the $u$-point $i+i_p,k$ and a vertical flux $_i^k{\mathbb{F}_w}_{i_p}^{k_p} (T)$ across the $w$-point $i,k+k_p$.
386The lateral flux drives a net rate of change of variance,
387summed over the two $T$-points $i+i_p-\fractext{1}{2},k$ and $i+i_p+\fractext{1}{2},k$, of
388\begin{multline}
389  {b_T}_{i+i_p-1/2}^k\left(\frac{\partial T}{\partial t}T\right)_{i+i_p-1/2}^k+
390  \quad {b_T}_{i+i_p+1/2}^k\left(\frac{\partial T}{\partial
391      t}T\right)_{i+i_p+1/2}^k \\
392  \begin{aligned}
393    &= -T_{i+i_p-1/2}^k{\;} _i^k{\mathbb{F}_u}_{i_p}^{k_p} (T) \quad + \quad  T_{i+i_p+1/2}^k
394    {\;}_i^k{\mathbb{F}_u}_{i_p}^{k_p} (T) \\
395    &={\;} _i^k{\mathbb{F}_u}_{i_p}^{k_p} (T)\,\delta_{i+ i_p}[T^k], \label{eq:TRIADS_dvar_iso_i}
396  \end{aligned}
397\end{multline}
398while the vertical flux similarly drives a net rate of change of variance summed over
399the $T$-points $i,k+k_p-\fractext{1}{2}$ (above) and $i,k+k_p+\fractext{1}{2}$ (below) of
400\begin{equation}
401  \label{eq:TRIADS_dvar_iso_k}
402  _i^k{\mathbb{F}_w}_{i_p}^{k_p} (T) \,\delta_{k+ k_p}[T^i].
403\end{equation}
404The total variance tendency driven by the triad is the sum of these two.
405Expanding $_i^k{\mathbb{F}_u}_{i_p}^{k_p} (T)$ and $_i^k{\mathbb{F}_w}_{i_p}^{k_p} (T)$ with
406\autoref{eq:TRIADS_latflux-triad} and \autoref{eq:TRIADS_vertflux-triad}, it is
407\begin{multline*}
408  -{A}_i^k\left \{
409    { } _i^k{\mathbb{A}_u}_{i_p}^{k_p}
410    \left(
411      \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
412      - {_i^k\mathbb{R}_{i_p}^{k_p}} \
413      \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }\right)\,\delta_{i+ i_p}[T^k] \right.\\
414  - \left. { } _i^k{\mathbb{A}_w}_{i_p}^{k_p}
415    \left(
416      \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
417      -{\:}_i^k\mathbb{R}_{i_p}^{k_p}
418      \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
419    \right) {\,}_i^k\mathbb{R}_{i_p}^{k_p}\delta_{k+ k_p}[T^i]
420  \right \}.
421\end{multline*}
422The key point is then that if we require $_i^k{\mathbb{A}_u}_{i_p}^{k_p}$ and $_i^k{\mathbb{A}_w}_{i_p}^{k_p}$ to
423be related to a triad volume $_i^k\mathbb{V}_{i_p}^{k_p}$ by
424\begin{equation}
425  \label{eq:TRIADS_V-A}
426  _i^k\mathbb{V}_{i_p}^{k_p}
427  ={\;}_i^k{\mathbb{A}_u}_{i_p}^{k_p}\,{e_{1u}}_{\,i + i_p}^{\,k}
428  ={\;}_i^k{\mathbb{A}_w}_{i_p}^{k_p}\,{e_{3w}}_{\,i}^{\,k + k_p},
429\end{equation}
430the variance tendency reduces to the perfect square
431\begin{equation}
432  \label{eq:TRIADS_perfect-square}
433  -{A}_i^k{\:} _i^k\mathbb{V}_{i_p}^{k_p}
434  \left(
435    \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
436    -{\:}_i^k\mathbb{R}_{i_p}^{k_p}
437    \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
438  \right)^2\leq 0.
439\end{equation}
440Thus, the constraint \autoref{eq:TRIADS_V-A} ensures that the fluxes
441(\autoref{eq:TRIADS_latflux-triad}, \autoref{eq:TRIADS_vertflux-triad}) associated with
442a given slope triad $_i^k\mathbb{R}_{i_p}^{k_p}$ do not increase the net variance.
443Since the total fluxes are sums of such fluxes from the various triads, this constraint, applied to all triads,
444is sufficient to ensure that the globally integrated variance does not increase.
445
446The expression \autoref{eq:TRIADS_V-A} can be interpreted as a discretization of the global integral
447\begin{equation}
448  \label{eq:TRIADS_cts-var}
449  \frac{\partial}{\partial t}\int\!\fractext{1}{2} T^2\, dV =
450  \int\!\mathbf{F}\cdot\nabla T\, dV,
451\end{equation}
452where, within each triad volume $_i^k\mathbb{V}_{i_p}^{k_p}$, the lateral and vertical fluxes/unit area
453\[
454  \mathbf{F}=\left(
455    \left.{}_i^k{\mathbb{F}_u}_{i_p}^{k_p} (T)\right/{}_i^k{\mathbb{A}_u}_{i_p}^{k_p},
456    \left.{\:}_i^k{\mathbb{F}_w}_{i_p}^{k_p} (T)\right/{}_i^k{\mathbb{A}_w}_{i_p}^{k_p}
457  \right)
458\]
459and the gradient
460\[
461  \nabla T = \left(
462    \left.\delta_{i+ i_p}[T^k] \right/ {e_{1u}}_{\,i + i_p}^{\,k},
463    \left.\delta_{k+ k_p}[T^i] \right/ {e_{3w}}_{\,i}^{\,k + k_p}
464  \right)
465\]
466
467%% =================================================================================================
468\subsection{Triad volumes in Griffes's scheme and in \NEMO}
469
470To complete the discretization we now need only specify the triad volumes $_i^k\mathbb{V}_{i_p}^{k_p}$.
471\citet{griffies.gnanadesikan.ea_JPO98} identifies these $_i^k\mathbb{V}_{i_p}^{k_p}$ as the volumes of the quarter cells,
472defined in terms of the distances between $T$, $u$,$f$ and $w$-points.
473This is the natural discretization of \autoref{eq:TRIADS_cts-var}.
474The \NEMO\ model, however, operates with scale factors instead of grid sizes,
475and scale factors for the quarter cells are not defined.
476Instead, therefore we simply choose
477\begin{equation}
478  \label{eq:TRIADS_V-NEMO}
479  _i^k\mathbb{V}_{i_p}^{k_p}=\fractext{1}{4} {b_u}_{i+i_p}^k,
480\end{equation}
481as a quarter of the volume of the $u$-cell inside which the triad quarter-cell lies.
482This has the nice property that when the slopes $\mathbb{R}$ vanish,
483the lateral flux from tracer cell $i,k$ to $i+1,k$ reduces to the classical form
484\begin{equation}
485  \label{eq:TRIADS_lat-normal}
486  -\overline{A}_{\,i+1/2}^k\;
487  \frac{{b_u}_{i+1/2}^k}{{e_{1u}}_{\,i + i_p}^{\,k}}
488  \;\frac{\delta_{i+ 1/2}[T^k] }{{e_{1u}}_{\,i + i_p}^{\,k}}
489  = -\overline{A}_{\,i+1/2}^k\;\frac{{e_{1w}}_{\,i + 1/2}^{\,k}\:{e_{1v}}_{\,i + 1/2}^{\,k}\;\delta_{i+ 1/2}[T^k]}{{e_{1u}}_{\,i + 1/2}^{\,k}}.
490\end{equation}
491In fact if the diffusive coefficient is defined at $u$-points,
492so that we employ ${A}_{i+i_p}^k$ instead of  ${A}_i^k$ in the definitions of the triad fluxes
493\autoref{eq:TRIADS_latflux-triad} and \autoref{eq:TRIADS_vertflux-triad},
494we can replace $\overline{A}_{\,i+1/2}^k$ by $A_{i+1/2}^k$ in the above.
495
496%% =================================================================================================
497\subsection{Summary of the scheme}
498
499The iso-neutral fluxes at $u$- and $w$-points are the sums of the triad fluxes that
500cross the $u$- and $w$-faces \autoref{eq:TRIADS_iso_flux}:
501\begin{subequations}
502  % \label{eq:TRIADS_alltriadflux}
503  \begin{flalign*}
504    % \label{eq:TRIADS_vect_isoflux}
505    \vect{F}_{\mathrm{iso}}(T) &\equiv
506    \sum_{\substack{i_p,\,k_p}}
507    \begin{pmatrix}
508      {_{i+1/2-i_p}^k {\mathbb{F}_u}_{i_p}^{k_p} } (T) \\ \\
509      {_i^{k+1/2-k_p} {\mathbb{F}_w}_{i_p}^{k_p} } (T)
510    \end{pmatrix},
511  \end{flalign*}
512  where \autoref{eq:TRIADS_latflux-triad}:
513  \begin{align}
514    \label{eq:TRIADS_triadfluxu}
515    _i^k {\mathbb{F}_u}_{i_p}^{k_p} (T) &= - {A}_i^k{
516                                          \:}\frac{{{}_i^k\mathbb{V}}_{i_p}^{k_p}}{{e_{1u}}_{\,i + i_p}^{\,k}}
517                                          \left(
518                                          \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
519                                          -\ {_i^k\mathbb{R}_{i_p}^{k_p}} \
520                                          \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
521                                          \right),\\
522    \intertext{and}
523    _i^k {\mathbb{F}_w}_{i_p}^{k_p} (T)
524                                        &= {A}_i^k{\: }\frac{{{}_i^k\mathbb{V}}_{i_p}^{k_p}}{{e_{3w}}_{\,i}^{\,k+k_p}}
525                                          \left(
526                                          {_i^k\mathbb{R}_{i_p}^{k_p}}\frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
527                                          -\ \left({_i^k\mathbb{R}_{i_p}^{k_p}}\right)^2 \
528                                          \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
529                                          \right),\label{eq:TRIADS_triadfluxw}
530  \end{align}
531  with \autoref{eq:TRIADS_V-NEMO}
532  \[
533    % \label{eq:TRIADS_V-NEMO2}
534    _i^k{\mathbb{V}}_{i_p}^{k_p}=\fractext{1}{4} {b_u}_{i+i_p}^k.
535  \]
536\end{subequations}
537
538The divergence of the expression \autoref{eq:TRIADS_iso_flux} for the fluxes gives the iso-neutral diffusion tendency at
539each tracer point:
540\[
541  % \label{eq:TRIADS_iso_operator}
542  D_l^T = \frac{1}{b_T}
543  \sum_{\substack{i_p,\,k_p}} \left\{ \delta_{i} \left[{_{i+1/2-i_p}^k
544        {\mathbb{F}_u }_{i_p}^{k_p}} \right] + \delta_{k} \left[
545      {_i^{k+1/2-k_p} {\mathbb{F}_w}_{i_p}^{k_p}} \right] \right\}
546\]
547where $b_T= e_{1T}\,e_{2T}\,e_{3T}$ is the volume of $T$-cells.
548The diffusion scheme satisfies the following six properties:
549
550\begin{description}
551\item [Horizontal diffusion] The discretization of the diffusion operator recovers the traditional five-point Laplacian
552  \autoref{eq:TRIADS_lat-normal} in the limit of flat iso-neutral direction:
553  \[
554    % \label{eq:TRIADS_iso_property0}
555    D_l^T = \frac{1}{b_T} \
556    \delta_{i} \left[ \frac{e_{2u}\,e_{3u}}{e_{1u}} \;
557      \overline{A}^{\,i} \; \delta_{i+1/2}[T] \right] \qquad
558    \text{when} \quad { _i^k \mathbb{R}_{i_p}^{k_p} }=0
559  \]
560\item [Implicit treatment in the vertical] Only tracer values associated with a single water column appear in the expression \autoref{eq:TRIADS_i33} for
561  the $_{33}$ fluxes, vertical fluxes driven by vertical gradients.
562  This is of paramount importance since it means that a time-implicit algorithm can be used to
563  solve the vertical diffusion equation.
564  This is necessary since the vertical eddy diffusivity associated with this term,
565  \[
566    \frac{1}{b_w}\sum_{\substack{i_p, \,k_p}} \left\{
567      {\:}_i^k\mathbb{V}_{i_p}^{k_p} \: {A}_i^k \: \left(_i^k \mathbb{R}_{i_p}^{k_p}\right)^2
568    \right\}  =
569    \frac{1}{4b_w}\sum_{\substack{i_p, \,k_p}} \left\{
570      {b_u}_{i+i_p}^k\: {A}_i^k \: \left(_i^k \mathbb{R}_{i_p}^{k_p}\right)^2
571    \right\},
572  \]
573  (where $b_w= e_{1w}\,e_{2w}\,e_{3w}$ is the volume of $w$-cells) can be quite large.
574\item [Pure iso-neutral operator] The iso-neutral flux of locally referenced potential density is zero.
575  See \autoref{eq:TRIADS_latflux-rho} and \autoref{eq:TRIADS_vertflux-triad2}.
576\item [Conservation of tracer] The iso-neutral diffusion conserves tracer content, \ie
577  \[
578    % \label{eq:TRIADS_iso_property1}
579    \sum_{i,j,k} \left\{ D_l^T \      b_T \right\} = 0
580  \]
581  This property is trivially satisfied since the iso-neutral diffusive operator is written in flux form.
582\item [No increase of tracer variance] The iso-neutral diffusion does not increase the tracer variance, \ie
583  \[
584    % \label{eq:TRIADS_iso_property2}
585    \sum_{i,j,k} \left\{ T \ D_l^T      \ b_T \right\} \leq 0
586  \]
587  The property is demonstrated in \autoref{subsec:TRIADS_variance} above.
588  It is a key property for a diffusion term.
589  It means that it is also a dissipation term,
590  \ie\ it dissipates the square of the quantity on which it is applied.
591  It therefore ensures that, when the diffusivity coefficient is large enough,
592  the field on which it is applied becomes free of grid-point noise.
593\item [Self-adjoint operator] The iso-neutral diffusion operator is self-adjoint, \ie
594  \begin{equation}
595    \label{eq:TRIADS_iso_property3}
596    \sum_{i,j,k} \left\{ S \ D_l^T \ b_T \right\} = \sum_{i,j,k} \left\{ D_l^S \ T \ b_T \right\}
597  \end{equation}
598  In other word, there is no need to develop a specific routine from the adjoint of this operator.
599  We just have to apply the same routine.
600  This property can be demonstrated similarly to the proof of the `no increase of tracer variance' property.
601  The contribution by a single triad towards the left hand side of \autoref{eq:TRIADS_iso_property3},
602  can be found by replacing $\delta[T]$ by $\delta[S]$ in \autoref{eq:TRIADS_dvar_iso_i} and \autoref{eq:TRIADS_dvar_iso_k}.
603  This results in a term similar to \autoref{eq:TRIADS_perfect-square},
604  \[
605    % \label{eq:TRIADS_TScovar}
606    - {A}_i^k{\:} _i^k\mathbb{V}_{i_p}^{k_p}
607    \left(
608      \frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
609      -{\:}_i^k\mathbb{R}_{i_p}^{k_p}
610      \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
611    \right)
612    \left(
613      \frac{ \delta_{i+ i_p}[S^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }
614      -{\:}_i^k\mathbb{R}_{i_p}^{k_p}
615      \frac{ \delta_{k+k_p} [S^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }
616    \right).
617  \]
618This is symmetrical in $T $ and $S$, so exactly the same term arises from
619the discretization of this triad's contribution towards the RHS of \autoref{eq:TRIADS_iso_property3}.
620\end{description}
621
622%% =================================================================================================
623\subsection{Treatment of the triads at the boundaries}
624\label{sec:TRIADS_iso_bdry}
625
626The triad slope can only be defined where both the grid boxes centred at the end of the arms exist.
627Triads that would poke up through the upper ocean surface into the atmosphere,
628or down into the ocean floor, must be masked out.
629See \autoref{fig:TRIADS_bdry_triads}.
630Surface layer triads \triad{i}{1}{R}{1/2}{-1/2} (magenta) and \triad{i+1}{1}{R}{-1/2}{-1/2} (blue) that
631require density to be specified above the ocean surface are masked (\autoref{fig:TRIADS_bdry_triads}a):
632this ensures that lateral tracer gradients produce no flux through the ocean surface.
633However, to prevent surface noise, it is customary to retain the $_{11}$ contributions towards
634the lateral triad fluxes \triad[u]{i}{1}{F}{1/2}{-1/2} and \triad[u]{i+1}{1}{F}{-1/2}{-1/2};
635this drives diapycnal tracer fluxes.
636Similar comments apply to triads that would intersect the ocean floor (\autoref{fig:TRIADS_bdry_triads}b).
637Note that both near bottom triad slopes \triad{i}{k}{R}{1/2}{1/2} and \triad{i+1}{k}{R}{-1/2}{1/2} are masked when
638either of the $i,k+1$ or $i+1,k+1$ tracer points is masked, \ie\ the $i,k+1$ $u$-point is masked.
639The associated lateral fluxes (grey-black dashed line) are masked if \np[=.false.]{ln_botmix_triad}{ln\_botmix\_triad},
640but left unmasked, giving bottom mixing, if \np[=.true.]{ln_botmix_triad}{ln\_botmix\_triad}.
641
642The default option \np[=.false.]{ln_botmix_triad}{ln\_botmix\_triad} is suitable when the bbl mixing option is enabled
643(\np[=.true.]{ln_trabbl}{ln\_trabbl}, with \np[=1]{nn_bbl_ldf}{nn\_bbl\_ldf}), or for simple idealized problems.
644For setups with topography without bbl mixing, \np[=.true.]{ln_botmix_triad}{ln\_botmix\_triad} may be necessary.
645\begin{figure}[h]
646  \centering
647  \includegraphics[width=0.66\textwidth]{TRIADS_GRIFF_bdry_triads}
648  \caption[Boundary triads]{
649    (a) Uppermost model layer $k=1$ with $i,1$ and $i+1,1$ tracer points (black dots),
650    and $i+1/2,1$ $u$-point (blue square).
651    Triad slopes \triad{i}{1}{R}{1/2}{-1/2} (magenta) and
652    \triad{i+1}{1}{R}{-1/2}{-1/2} (blue) poking through the ocean surface are masked
653    (faded in figure).
654    However,
655    the lateral $_{11}$ contributions towards \triad[u]{i}{1}{F}{1/2}{-1/2} and
656    \triad[u]{i+1}{1}{F}{-1/2}{-1/2} (yellow line) are still applied,
657    giving diapycnal diffusive fluxes.
658    \newline
659    (b) Both near bottom triad slopes \triad{i}{k}{R}{1/2}{1/2} and
660    \triad{i+1}{k}{R}{-1/2}{1/2} are masked when
661    either of the $i,k+1$ or $i+1,k+1$ tracer points is masked,
662    \ie\ the $i,k+1$ $u$-point is masked.
663    The associated lateral fluxes (grey-black dashed line) are masked if
664    \protect\np[=.false.]{ln_botmix_triad}{ln\_botmix\_triad}, but left unmasked,
665    giving bottom mixing, if \protect\np[=.true.]{ln_botmix_triad}{ln\_botmix\_triad}}
666  \label{fig:TRIADS_bdry_triads}
667\end{figure}
668
669%% =================================================================================================
670\subsection{ Limiting of the slopes within the interior}
671\label{sec:TRIADS_limit}
672
673As discussed in \autoref{subsec:LDF_slp_iso},
674iso-neutral slopes relative to geopotentials must be bounded everywhere,
675both for consistency with the small-slope approximation and for numerical stability \citep{cox_OM87, griffies_bk04}.
676The bound chosen in \NEMO\ is applied to each component of the slope separately and
677has a value of $1/100$ in the ocean interior.
678%, ramping linearly down above 70~m depth to zero at the surface
679It is of course relevant to the iso-neutral slopes $\tilde{r}_i=r_i+\sigma_i$ relative to geopotentials
680(here the $\sigma_i$ are the slopes of the coordinate surfaces relative to geopotentials)
681\autoref{eq:MB_slopes_eiv} rather than the slope $r_i$ relative to coordinate surfaces, so we require
682\[
683  |\tilde{r}_i|\leq \tilde{r}_\mathrm{max}=0.01.
684\]
685and then recalculate the slopes $r_i$ relative to coordinates.
686Each individual triad slope
687\begin{equation}
688  \label{eq:TRIADS_Rtilde}
689  _i^k\tilde{\mathbb{R}}_{i_p}^{k_p} = {}_i^k\mathbb{R}_{i_p}^{k_p}  + \frac{\delta_{i+i_p}[z_T^k]}{{e_{1u}}_{\,i + i_p}^{\,k}}
690\end{equation}
691is limited like this and then the corresponding $_i^k\mathbb{R}_{i_p}^{k_p} $ are recalculated and
692combined to form the fluxes.
693Note that where the slopes have been limited, there is now a non-zero iso-neutral density flux that
694drives dianeutral mixing.
695In particular this iso-neutral density flux is always downwards,
696and so acts to reduce gravitational potential energy.
697
698%% =================================================================================================
699\subsection{Tapering within the surface mixed layer}
700\label{sec:TRIADS_taper}
701
702Additional tapering of the iso-neutral fluxes is necessary within the surface mixed layer.
703When the Griffies triads are used, we offer two options for this.
704
705%% =================================================================================================
706\subsubsection{Linear slope tapering within the surface mixed layer}
707\label{sec:TRIADS_lintaper}
708
709This is the option activated by the default choice \np[=.false.]{ln_triad_iso}{ln\_triad\_iso}.
710Slopes $\tilde{r}_i$ relative to geopotentials are tapered linearly from their value immediately below
711the mixed layer to zero at the surface, as described in option (c) of \autoref{fig:LDF_eiv_slp}, to values
712\begin{equation}
713  \label{eq:TRIADS_rmtilde}
714  \rMLt = -\frac{z}{h}\left.\tilde{r}_i\right|_{z=-h}\quad \text{ for  } z>-h,
715\end{equation}
716and then the $r_i$ relative to vertical coordinate surfaces are appropriately adjusted to
717\[
718  % \label{eq:TRIADS_rm}
719  \rML =\rMLt -\sigma_i \quad \text{ for  } z>-h.
720\]
721Thus the diffusion operator within the mixed layer is given by:
722\[
723  % \label{eq:TRIADS_iso_tensor_ML}
724  D^{lT}=\nabla {\mathrm {\mathbf .}}\left( {A^{lT}\;\Re \;\nabla T} \right) \qquad
725  \mbox{with}\quad \;\;\Re =\left( {{
726        \begin{array}{*{20}c}
727          1 \hfill & 0 \hfill & {-\rML[1]}\hfill \\
728          0 \hfill & 1 \hfill & {-\rML[2]} \hfill \\
729          {-\rML[1]}\hfill &   {-\rML[2]} \hfill & {\rML[1]^2+\rML[2]^2} \hfill
730        \end{array}
731      }} \right)
732\]
733
734This slope tapering gives a natural connection between tracer in the mixed-layer and
735in isopycnal layers immediately below, in the thermocline.
736It is consistent with the way the $\tilde{r}_i$ are tapered within the mixed layer
737(see \autoref{sec:TRIADS_taperskew} below) so as to ensure a uniform GM eddy-induced velocity throughout the mixed layer.
738However, it gives a downwards density flux and so acts so as to reduce potential energy in the same way as
739does the slope limiting discussed above in \autoref{sec:TRIADS_limit}.
740
741As in \autoref{sec:TRIADS_limit} above, the tapering \autoref{eq:TRIADS_rmtilde} is applied separately to
742each triad $_i^k\tilde{\mathbb{R}}_{i_p}^{k_p}$, and the $_i^k\mathbb{R}_{i_p}^{k_p}$ adjusted.
743For clarity, we assume $z$-coordinates in the following;
744the conversion from $\mathbb{R}$ to $\tilde{\mathbb{R}}$ and back to $\mathbb{R}$ follows exactly as
745described above by \autoref{eq:TRIADS_Rtilde}.
746\begin{enumerate}
747\item Mixed-layer depth is defined so as to avoid including regions of weak vertical stratification in
748  the slope definition.
749  At each $i,j$ (simplified to $i$ in \autoref{fig:TRIADS_MLB_triad}),
750  we define the mixed-layer by setting the vertical index of the tracer point immediately below the mixed layer,
751  $k_{\mathrm{ML}}$, as the maximum $k$ (shallowest tracer point) such that
752  the potential density ${\rho_0}_{i,k}>{\rho_0}_{i,k_{10}}+\Delta\rho_c$,
753  where $i,k_{10}$ is the tracer gridbox within which the depth reaches 10~m.
754  See the left side of \autoref{fig:TRIADS_MLB_triad}.
755  We use the $k_{10}$-gridbox instead of the surface gridbox to avoid problems \eg\ with thin daytime mixed-layers.
756  Currently we use the same $\Delta\rho_c=0.01\;\mathrm{kg\:m^{-3}}$ for ML triad tapering as is used to
757  output the diagnosed mixed-layer depth $h_{\mathrm{ML}}=|z_{W}|_{k_{\mathrm{ML}}+1/2}$,
758  the depth of the $w$-point above the $i,k_{\mathrm{ML}}$ tracer point.
759\item We define `basal' triad slopes ${\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p}$ as
760  the slopes of those triads whose vertical `arms' go down from the $i,k_{\mathrm{ML}}$ tracer point to
761  the $i,k_{\mathrm{ML}}-1$ tracer point below.
762  This is to ensure that the vertical density gradients associated with
763  these basal triad slopes ${\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p}$ are representative of the thermocline.
764  The four basal triads defined in the bottom part of \autoref{fig:TRIADS_MLB_triad} are then
765  \begin{align*}
766    {\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p} &=
767                                                       {\:}^{k_{\mathrm{ML}}-k_p-1/2}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p},
768                                                       % \label{eq:TRIADS_Rbase}
769    \\
770    \intertext{with \eg\ the green triad}
771    {\:}_i{\mathbb{R}_{\mathrm{base}}}_{1/2}^{-1/2}&=
772                                                     {\:}^{k_{\mathrm{ML}}}_i{\mathbb{R}_{\mathrm{base}}}_{\,1/2}^{-1/2}.
773  \end{align*}
774The vertical flux associated with each of these triads passes through
775the $w$-point $i,k_{\mathrm{ML}}-1/2$ lying \emph{below} the $i,k_{\mathrm{ML}}$ tracer point, so it is this depth
776\[
777  % \label{eq:TRIADS_zbase}
778  {z_\mathrm{base}}_{\,i}={z_{w}}_{k_\mathrm{ML}-1/2}
779\]
780one gridbox deeper than the diagnosed ML depth $z_{\mathrm{ML}})$ that sets the $h$ used to taper the slopes in
781\autoref{eq:TRIADS_rmtilde}.
782\item Finally, we calculate the adjusted triads ${\:}_i^k{\mathbb{R}_{\mathrm{ML}}}_{\,i_p}^{k_p}$ within
783  the mixed layer, by multiplying the appropriate ${\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p}$ by
784  the ratio of the depth of the $w$-point ${z_w}_{k+k_p}$ to ${z_{\mathrm{base}}}_{\,i}$.
785  For instance the green triad centred on $i,k$
786  \begin{align*}
787    {\:}_i^k{\mathbb{R}_{\mathrm{ML}}}_{\,1/2}^{-1/2} &=
788                                                        \frac{{z_w}_{k-1/2}}{{z_{\mathrm{base}}}_{\,i}}{\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,1/2}^{-1/2} \\
789    \intertext{and more generally}
790    {\:}_i^k{\mathbb{R}_{\mathrm{ML}}}_{\,i_p}^{k_p} &=
791                                                       \frac{{z_w}_{k+k_p}}{{z_{\mathrm{base}}}_{\,i}}{\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p}.
792                                                       % \label{eq:TRIADS_RML}
793  \end{align*}
794\end{enumerate}
795
796\begin{figure}[h]
797  \centering
798  \includegraphics[width=0.66\textwidth]{TRIADS_GRIFF_MLB_triads}
799  \caption[Definition of mixed-layer depth and calculation of linearly tapered triads]{
800    Definition of mixed-layer depth and calculation of linearly tapered triads.
801    The figure shows a water column at a given $i,j$ (simplified to $i$),
802    with the ocean surface at the top.
803    Tracer points are denoted by bullets, and black lines the edges of the tracer cells;
804    $k$ increases upwards.
805    \newline
806    We define the mixed-layer by setting the vertical index of the tracer point immediately below
807    the mixed layer, $k_{\mathrm{ML}}$, as the maximum $k$ (shallowest tracer point) such that
808    ${\rho_0}_{i,k}>{\rho_0}_{i,k_{10}}+\Delta\rho_c$,
809    where $i,k_{10}$ is the tracer gridbox within which the depth reaches 10~m.
810    We calculate the triad slopes within the mixed layer by linearly tapering them from zero
811    (at the surface) to the `basal' slopes,
812    the slopes of the four triads passing through the $w$-point $i,k_{\mathrm{ML}}-1/2$ (blue square),
813    ${\:}_i{\mathbb{R}_{\mathrm{base}}}_{\,i_p}^{k_p}$.
814    Triads with different $i_p,k_p$, denoted by different colours,
815    (\eg\ the green triad $i_p=1/2,k_p=-1/2$) are tapered to the appropriate basal triad.}
816  \label{fig:TRIADS_MLB_triad}
817\end{figure}
818
819%% =================================================================================================
820\subsubsection{Additional truncation of skew iso-neutral flux components}
821\label{subsec:TRIADS_Gerdes-taper}
822
823The alternative option is activated by setting \np{ln_triad_iso}{ln\_triad\_iso} = true.
824This retains the same tapered slope $\rML$  described above for the calculation of the $_{33}$ term of
825the iso-neutral diffusion tensor (the vertical tracer flux driven by vertical tracer gradients),
826but replaces the $\rML$ in the skew term by
827\begin{equation}
828  \label{eq:TRIADS_rm*}
829  \rML^*=\left.\rMLt^2\right/\tilde{r}_i-\sigma_i,
830\end{equation}
831giving a ML diffusive operator
832\[
833  % \label{eq:TRIADS_iso_tensor_ML2}
834  D^{lT}=\nabla {\mathrm {\mathbf .}}\left( {A^{lT}\;\Re \;\nabla T} \right) \qquad
835  \mbox{with}\quad \;\;\Re =\left( {{
836        \begin{array}{*{20}c}
837          1 \hfill & 0 \hfill & {-\rML[1]^*}\hfill \\
838          0 \hfill & 1 \hfill & {-\rML[2]^*} \hfill \\
839          {-\rML[1]^*}\hfill &   {-\rML[2]^*} \hfill & {\rML[1]^2+\rML[2]^2} \hfill \\
840        \end{array}
841      }} \right).
842\]
843This operator
844\footnote{
845  To ensure good behaviour where horizontal density gradients are weak,
846  we in fact follow \citet{gerdes.koberle.ea_CD91} and
847  set $\rML^*=\mathrm{sgn}(\tilde{r}_i)\min(|\rMLt^2/\tilde{r}_i|,|\tilde{r}_i|)-\sigma_i$.
848}
849then has the property it gives no vertical density flux, and so does not change the potential energy.
850This approach is similar to multiplying the iso-neutral diffusion coefficient by
851$\tilde{r}_{\mathrm{max}}^{-2}\tilde{r}_i^{-2}$ for steep slopes,
852as suggested by \citet{gerdes.koberle.ea_CD91} (see also \citet{griffies_bk04}).
853Again it is applied separately to each triad $_i^k\mathbb{R}_{i_p}^{k_p}$
854
855In practice, this approach gives weak vertical tracer fluxes through the mixed-layer,
856as well as vanishing density fluxes.
857While it is theoretically advantageous that it does not change the potential energy,
858it may give a discontinuity between the fluxes within the mixed-layer (purely horizontal) and
859just below (along iso-neutral surfaces).
860% This may give strange looking results,
861% particularly where the mixed-layer depth varies strongly laterally.
862%% =================================================================================================
863\section{Eddy induced advection formulated as a skew flux}
864\label{sec:TRIADS_skew-flux}
865
866%% =================================================================================================
867\subsection{Continuous skew flux formulation}
868\label{sec:TRIADS_continuous-skew-flux}
869
870When Gent and McWilliams's [1990] diffusion is used, an additional advection term is added.
871The associated velocity is the so called eddy induced velocity,
872the formulation of which depends on the slopes of iso-neutral surfaces.
873Contrary to the case of iso-neutral mixing, the slopes used here are referenced to the geopotential surfaces,
874\ie\ \autoref{eq:LDF_slp_geo} is used in $z$-coordinate,
875and the sum \autoref{eq:LDF_slp_geo} + \autoref{eq:LDF_slp_iso} in $z^*$ or $s$-coordinates.
876
877The eddy induced velocity is given by:
878\begin{subequations}
879  % \label{eq:TRIADS_eiv}
880  \begin{equation}
881    \label{eq:TRIADS_eiv_v}
882    \begin{split}
883      u^* & = - \frac{1}{e_{3}}\;          \partial_i\psi_1,  \\
884      v^* & = - \frac{1}{e_{3}}\;          \partial_j\psi_2,    \\
885      w^* & =    \frac{1}{e_{1}e_{2}}\; \left\{ \partial_\left( e_{2} \, \psi_1\right)
886        + \partial_\left( e_{1} \, \psi_2\right) \right\},
887    \end{split}
888  \end{equation}
889  where the streamfunctions $\psi_i$ are given by
890  \begin{equation}
891    \label{eq:TRIADS_eiv_psi}
892    \begin{split}
893      \psi_1 & = A_{e} \; \tilde{r}_1,   \\
894      \psi_2 & = A_{e} \; \tilde{r}_2,
895    \end{split}
896  \end{equation}
897\end{subequations}
898with $A_{e}$ the eddy induced velocity coefficient,
899and $\tilde{r}_1$ and $\tilde{r}_2$ the slopes between the iso-neutral and the geopotential surfaces.
900
901The traditional way to implement this additional advection is to add it to the Eulerian velocity prior to
902computing the tracer advection.
903This is implemented if \texttt{traldf\_eiv?} is set in the default implementation,
904where \np{ln_traldf_triad}{ln\_traldf\_triad} is set false.
905This allows us to take advantage of all the advection schemes offered for the tracers
906(see \autoref{sec:TRA_adv}) and not just a $2^{nd}$ order advection scheme.
907This is particularly useful for passive tracers where
908\emph{positivity} of the advection scheme is of paramount importance.
909
910However, when \np{ln_traldf_triad}{ln\_traldf\_triad} is set true,
911\NEMO\ instead implements eddy induced advection according to the so-called skew form \citep{griffies_JPO98}.
912It is based on a transformation of the advective fluxes using the non-divergent nature of the eddy induced velocity.
913For example in the (\textbf{i},\textbf{k}) plane,
914the tracer advective fluxes per unit area in $ijk$ space can be transformed as follows:
915\begin{flalign*}
916  \begin{split}
917    \textbf{F}_{\mathrm{eiv}}^T =
918    \begin{pmatrix}
919      {e_{2}\,e_{3}\;  u^*} \\
920      {e_{1}\,e_{2}\; w^*}
921    \end{pmatrix}   \;   T
922    &=
923    \begin{pmatrix}
924      { - \partial_k \left( e_{2} \,\psi_1 \right) \; T \;} \\
925      {+ \partial_\left( e_{2} \, \psi_1 \right) \; T \;}
926    \end{pmatrix}          \\
927    &=
928    \begin{pmatrix}
929      { - \partial_k \left( e_{2} \, \psi_\; T \right) \;} \\
930      {+ \partial_\left( e_{2} \,\psi_1 \; T \right) \;}
931    \end{pmatrix}
932    +
933    \begin{pmatrix}
934      {+ e_{2} \, \psi_\; \partial_k T} \\
935      { - e_{2} \, \psi_\; \partial_i  T}
936    \end{pmatrix}
937  \end{split}
938\end{flalign*}
939and since the eddy induced velocity field is non-divergent,
940we end up with the skew form of the eddy induced advective fluxes per unit area in $ijk$ space:
941\begin{equation}
942  \label{eq:TRIADS_eiv_skew_ijk}
943  \textbf{F}_\mathrm{eiv}^T =
944  \begin{pmatrix}
945    {+ e_{2} \, \psi_\; \partial_k T}   \\
946    { - e_{2} \, \psi_\; \partial_i  T}
947  \end{pmatrix}
948\end{equation}
949The total fluxes per unit physical area are then
950\begin{equation}
951  \label{eq:TRIADS_eiv_skew_physical}
952  \begin{split}
953    f^*_1 & = \frac{1}{e_{3}}\; \psi_1 \partial_k T   \\
954    f^*_2 & = \frac{1}{e_{3}}\; \psi_2 \partial_k T   \\
955    f^*_3 & =  -\frac{1}{e_{1}e_{2}}\; \left\{ e_{2} \psi_1 \partial_i T + e_{1} \psi_2 \partial_j T \right\}.
956\end{split}
957\end{equation}
958Note that \autoref{eq:TRIADS_eiv_skew_physical} takes the same form whatever the vertical coordinate,
959though of course the slopes $\tilde{r}_i$ which define the $\psi_i$ in \autoref{eq:TRIADS_eiv_psi} are relative to
960geopotentials.
961The tendency associated with eddy induced velocity is then simply the convergence of the fluxes
962(\autoref{eq:TRIADS_eiv_skew_ijk}, \autoref{eq:TRIADS_eiv_skew_physical}), so
963\[
964  % \label{eq:TRIADS_skew_eiv_conv}
965  \frac{\partial T}{\partial t}= -\frac{1}{e_1 \, e_2 \, e_3 }      \left[
966    \frac{\partial}{\partial i} \left( e_2 \psi_1 \partial_k T\right)
967    + \frac{\partial}{\partial j} \left( e_1  \;
968      \psi_2 \partial_k T\right)
969    -  \frac{\partial}{\partial k} \left( e_{2} \psi_1 \partial_i T
970      + e_{1} \psi_2 \partial_j T \right)  \right]
971\]
972It naturally conserves the tracer content, as it is expressed in flux form.
973Since it has the same divergence as the advective form it also preserves the tracer variance.
974
975%% =================================================================================================
976\subsection{Discrete skew flux formulation}
977
978The skew fluxes in (\autoref{eq:TRIADS_eiv_skew_physical}, \autoref{eq:TRIADS_eiv_skew_ijk}),
979like the off-diagonal terms (\autoref{eq:TRIADS_i13c}, \autoref{eq:TRIADS_i31c}) of the small angle diffusion tensor,
980are best expressed in terms of the triad slopes, as in \autoref{fig:TRIADS_ISO_triad} and
981(\autoref{eq:TRIADS_i13}, \autoref{eq:TRIADS_i31});
982but now in terms of the triad slopes $\tilde{\mathbb{R}}$ relative to geopotentials instead of
983the $\mathbb{R}$ relative to coordinate surfaces.
984The discrete form of \autoref{eq:TRIADS_eiv_skew_ijk} using the slopes \autoref{eq:TRIADS_R} and
985defining $A_e$ at $T$-points is then given by:
986
987\begin{subequations}
988  % \label{eq:TRIADS_allskewflux}
989  \begin{flalign*}
990    % \label{eq:TRIADS_vect_skew_flux}
991    \vect{F}_{\mathrm{eiv}}(T) &\equiv    \sum_{\substack{i_p,\,k_p}}
992    \begin{pmatrix}
993      {_{i+1/2-i_p}^k {\mathbb{S}_u}_{i_p}^{k_p} } (T)      \\      \\
994      {_i^{k+1/2-k_p} {\mathbb{S}_w}_{i_p}^{k_p} } (T)      \\
995    \end{pmatrix},
996  \end{flalign*}
997  where the skew flux in the $i$-direction associated with a given triad is (\autoref{eq:TRIADS_latflux-triad},
998  \autoref{eq:TRIADS_triadfluxu}):
999  \begin{align}
1000    \label{eq:TRIADS_skewfluxu}
1001    _i^k {\mathbb{S}_u}_{i_p}^{k_p} (T) &= + \fractext{1}{4} {A_e}_i^k{
1002                                          \:}\frac{{b_u}_{i+i_p}^k}{{e_{1u}}_{\,i + i_p}^{\,k}}
1003                                          \ {_i^k\tilde{\mathbb{R}}_{i_p}^{k_p}} \
1004                                          \frac{ \delta_{k+k_p} [T^i] }{{e_{3w}}_{\,i}^{\,k+k_p} }, \\
1005    \intertext{
1006    and \autoref{eq:TRIADS_triadfluxw} in the $k$-direction, changing the sign
1007    to be consistent with \autoref{eq:TRIADS_eiv_skew_ijk}:
1008    }
1009    _i^k {\mathbb{S}_w}_{i_p}^{k_p} (T)
1010                                        &= -\fractext{1}{4} {A_e}_i^k{\: }\frac{{b_u}_{i+i_p}^k}{{e_{3w}}_{\,i}^{\,k+k_p}}
1011                                          {_i^k\tilde{\mathbb{R}}_{i_p}^{k_p}}\frac{ \delta_{i+ i_p}[T^k] }{ {e_{1u}}_{\,i + i_p}^{\,k} }.\label{eq:TRIADS_skewfluxw}
1012  \end{align}
1013\end{subequations}
1014
1015Such a discretisation is consistent with the iso-neutral operator as it uses the same definition for the slopes.
1016It also ensures the following two key properties.
1017
1018%% =================================================================================================
1019\subsubsection{No change in tracer variance}
1020
1021The discretization conserves tracer variance, \ie\ it does not include a diffusive component but is a `pure' advection term.
1022This can be seen %either from Appendix \autoref{apdx:eiv_skew} or
1023by considering the fluxes associated with a given triad slope $_i^k{\mathbb{R}}_{i_p}^{k_p} (T)$.
1024For, following \autoref{subsec:TRIADS_variance} and \autoref{eq:TRIADS_dvar_iso_i},
1025the associated horizontal skew-flux $_i^k{\mathbb{S}_u}_{i_p}^{k_p} (T)$ drives a net rate of change of variance,
1026summed over the two $T$-points $i+i_p-\fractext{1}{2},k$ and $i+i_p+\fractext{1}{2},k$, of
1027\begin{equation}
1028  \label{eq:TRIADS_dvar_eiv_i}
1029  _i^k{\mathbb{S}_u}_{i_p}^{k_p} (T)\,\delta_{i+ i_p}[T^k],
1030\end{equation}
1031while the associated vertical skew-flux gives a variance change summed over
1032the $T$-points $i,k+k_p-\fractext{1}{2}$ (above) and $i,k+k_p+\fractext{1}{2}$ (below) of
1033\begin{equation}
1034  \label{eq:TRIADS_dvar_eiv_k}
1035  _i^k{\mathbb{S}_w}_{i_p}^{k_p} (T) \,\delta_{k+ k_p}[T^i].
1036\end{equation}
1037Inspection of the definitions (\autoref{eq:TRIADS_skewfluxu}, \autoref{eq:TRIADS_skewfluxw}) shows that
1038these two variance changes (\autoref{eq:TRIADS_dvar_eiv_i}, \autoref{eq:TRIADS_dvar_eiv_k}) sum to zero.
1039Hence the two fluxes associated with each triad make no net contribution to the variance budget.
1040
1041%% =================================================================================================
1042\subsubsection{Reduction in gravitational PE}
1043
1044The vertical density flux associated with the vertical skew-flux always has the same sign as
1045the vertical density gradient;
1046thus, so long as the fluid is stable (the vertical density gradient is negative)
1047the vertical density flux is negative (downward) and hence reduces the gravitational PE.
1048
1049For the change in gravitational PE driven by the $k$-flux is
1050\begin{align}
1051  \label{eq:TRIADS_vert_densityPE}
1052  g {e_{3w}}_{\,i}^{\,k+k_p}{\mathbb{S}_w}_{i_p}^{k_p} (\rho)
1053  &=g {e_{3w}}_{\,i}^{\,k+k_p}\left[-\alpha _i^k {\:}_i^k
1054    {\mathbb{S}_w}_{i_p}^{k_p} (T) + \beta_i^k {\:}_i^k
1055    {\mathbb{S}_w}_{i_p}^{k_p} (S) \right]. \notag \\
1056  \intertext{Substituting  ${\:}_i^k {\mathbb{S}_w}_{i_p}^{k_p}$ from \autoref{eq:TRIADS_skewfluxw}, gives}
1057  % and separating out
1058  % $\rtriadt{R}=\rtriad{R} + \delta_{i+i_p}[z_T^k]$,
1059  % gives two terms. The
1060  % first $\rtriad{R}$ term (the only term for $z$-coordinates) is:
1061  &=-\fractext{1}{4} g{A_e}_i^k{\: }{b_u}_{i+i_p}^k {_i^k\tilde{\mathbb{R}}_{i_p}^{k_p}}
1062    \frac{ -\alpha _i^k\delta_{i+ i_p}[T^k]+ \beta_i^k\delta_{i+ i_p}[S^k]} { {e_{1u}}_{\,i + i_p}^{\,k} } \notag \\
1063  &=+\fractext{1}{4} g{A_e}_i^k{\: }{b_u}_{i+i_p}^k
1064    \left({_i^k\mathbb{R}_{i_p}^{k_p}}+\frac{\delta_{i+i_p}[z_T^k]}{{e_{1u}}_{\,i + i_p}^{\,k}}\right) {_i^k\mathbb{R}_{i_p}^{k_p}}
1065    \frac{-\alpha_i^k \delta_{k+ k_p}[T^i]+ \beta_i^k\delta_{k+ k_p}[S^i]} {{e_{3w}}_{\,i}^{\,k+k_p}},
1066\end{align}
1067using the definition of the triad slope $\rtriad{R}$, \autoref{eq:TRIADS_R} to
1068express $-\alpha _i^k\delta_{i+ i_p}[T^k]+\beta_i^k\delta_{i+ i_p}[S^k]$ in terms of
1069$-\alpha_i^k \delta_{k+ k_p}[T^i]+ \beta_i^k\delta_{k+ k_p}[S^i]$.
1070
1071Where the coordinates slope, the $i$-flux gives a PE change
1072\begin{multline}
1073  \label{eq:TRIADS_lat_densityPE}
1074  g \delta_{i+i_p}[z_T^k]
1075  \left[
1076    -\alpha _i^k {\:}_i^k {\mathbb{S}_u}_{i_p}^{k_p} (T) + \beta_i^k {\:}_i^k {\mathbb{S}_u}_{i_p}^{k_p} (S)
1077  \right] \\
1078  = +\fractext{1}{4} g{A_e}_i^k{\: }{b_u}_{i+i_p}^k
1079  \frac{\delta_{i+i_p}[z_T^k]}{{e_{1u}}_{\,i + i_p}^{\,k}}
1080  \left({_i^k\mathbb{R}_{i_p}^{k_p}}+\frac{\delta_{i+i_p}[z_T^k]}{{e_{1u}}_{\,i + i_p}^{\,k}}\right)
1081  \frac{-\alpha_i^k \delta_{k+ k_p}[T^i]+ \beta_i^k\delta_{k+ k_p}[S^i]} {{e_{3w}}_{\,i}^{\,k+k_p}},
1082\end{multline}
1083(using \autoref{eq:TRIADS_skewfluxu}) and so the total PE change \autoref{eq:TRIADS_vert_densityPE} +
1084\autoref{eq:TRIADS_lat_densityPE} associated with the triad fluxes is
1085\begin{multline*}
1086  % \label{eq:TRIADS_tot_densityPE}
1087  g{e_{3w}}_{\,i}^{\,k+k_p}{\mathbb{S}_w}_{i_p}^{k_p} (\rho) +
1088  g\delta_{i+i_p}[z_T^k] {\:}_i^k {\mathbb{S}_u}_{i_p}^{k_p} (\rho) \\
1089  = +\fractext{1}{4} g{A_e}_i^k{\: }{b_u}_{i+i_p}^k
1090  \left({_i^k\mathbb{R}_{i_p}^{k_p}}+\frac{\delta_{i+i_p}[z_T^k]}{{e_{1u}}_{\,i + i_p}^{\,k}}\right)^2
1091  \frac{-\alpha_i^k \delta_{k+ k_p}[T^i]+ \beta_i^k\delta_{k+ k_p}[S^i]} {{e_{3w}}_{\,i}^{\,k+k_p}}.
1092\end{multline*}
1093Where the fluid is stable, with $-\alpha_i^k \delta_{k+ k_p}[T^i]+
1094\beta_i^k\delta_{k+ k_p}[S^i]<0$, this PE change is negative.
1095
1096%% =================================================================================================
1097\subsection{Treatment of the triads at the boundaries}
1098\label{sec:TRIADS_skew_bdry}
1099
1100Triad slopes \rtriadt{R} used for the calculation of the eddy-induced skew-fluxes are masked at the boundaries
1101in exactly the same way as are the triad slopes \rtriad{R} used for the iso-neutral diffusive fluxes,
1102as described in \autoref{sec:TRIADS_iso_bdry} and \autoref{fig:TRIADS_bdry_triads}.
1103Thus surface layer triads $\triadt{i}{1}{R}{1/2}{-1/2}$ and $\triadt{i+1}{1}{R}{-1/2}{-1/2}$ are masked,
1104and both near bottom triad slopes $\triadt{i}{k}{R}{1/2}{1/2}$ and $\triadt{i+1}{k}{R}{-1/2}{1/2}$ are masked when
1105either of the $i,k+1$ or $i+1,k+1$ tracer points is masked, \ie\ the $i,k+1$ $u$-point is masked.
1106The namelist parameter \np{ln_botmix_triad}{ln\_botmix\_triad} has no effect on the eddy-induced skew-fluxes.
1107
1108%% =================================================================================================
1109\subsection{Limiting of the slopes within the interior}
1110\label{sec:TRIADS_limitskew}
1111
1112Presently, the iso-neutral slopes $\tilde{r}_i$ relative to geopotentials are limited to be less than $1/100$,
1113exactly as in calculating the iso-neutral diffusion, \S \autoref{sec:TRIADS_limit}.
1114Each individual triad \rtriadt{R} is so limited.
1115
1116%% =================================================================================================
1117\subsection{Tapering within the surface mixed layer}
1118\label{sec:TRIADS_taperskew}
1119
1120The slopes $\tilde{r}_i$ relative to geopotentials (and thus the individual triads \rtriadt{R})
1121are always tapered linearly from their value immediately below the mixed layer to zero at the surface
1122\autoref{eq:TRIADS_rmtilde}, as described in \autoref{sec:TRIADS_lintaper}.
1123This is option (c) of \autoref{fig:LDF_eiv_slp}.
1124This linear tapering for the slopes used to calculate the eddy-induced fluxes is unaffected by
1125the value of \np{ln_triad_iso}{ln\_triad\_iso}.
1126
1127The justification for this linear slope tapering is that, for $A_e$ that is constant or varies only in
1128the horizontal (the most commonly used options in \NEMO: see \autoref{sec:LDF_coef}),
1129it is equivalent to a horizontal eiv (eddy-induced velocity) that is uniform within the mixed layer
1130\autoref{eq:TRIADS_eiv_v}.
1131This ensures that the eiv velocities do not restratify the mixed layer \citep{treguier.held.ea_JPO97,danabasoglu.ferrari.ea_JC08}.
1132Equivantly, in terms of the skew-flux formulation we use here,
1133the linear slope tapering within the mixed-layer gives a linearly varying vertical flux,
1134and so a tracer convergence uniform in depth
1135(the horizontal flux convergence is relatively insignificant within the mixed-layer).
1136
1137%% =================================================================================================
1138\subsection{Streamfunction diagnostics}
1139\label{sec:TRIADS_sfdiag}
1140
1141Where the namelist parameter \np[=.true.]{ln_traldf_gdia}{ln\_traldf\_gdia},
1142diagnosed mean eddy-induced velocities are output.
1143Each time step, streamfunctions are calculated in the $i$-$k$ and $j$-$k$ planes at
1144$uw$ (integer +1/2 $i$, integer $j$, integer +1/2 $k$) and $vw$ (integer $i$, integer +1/2 $j$, integer +1/2 $k$)
1145points (see Table \autoref{tab:DOM_cell}) respectively.
1146We follow \citep{griffies_bk04} and calculate the streamfunction at a given $uw$-point from
1147the surrounding four triads according to:
1148\[
1149  % \label{eq:TRIADS_sfdiagi}
1150  {\psi_1}_{i+1/2}^{k+1/2}={\fractext{1}{4}}\sum_{\substack{i_p,\,k_p}}
1151  {A_e}_{i+1/2-i_p}^{k+1/2-k_p}\:\triadd{i+1/2-i_p}{k+1/2-k_p}{R}{i_p}{k_p}.
1152\]
1153The streamfunction $\psi_1$ is calculated similarly at $vw$ points.
1154The eddy-induced velocities are then calculated from the straightforward discretisation of \autoref{eq:TRIADS_eiv_v}:
1155\[
1156  % \label{eq:TRIADS_eiv_v_discrete}
1157  \begin{split}
1158    {u^*}_{i+1/2}^{k} & = - \frac{1}{{e_{3u}}_{i}^{k}}\left({\psi_1}_{i+1/2}^{k+1/2}-{\psi_1}_{i+1/2}^{k+1/2}\right),   \\
1159    {v^*}_{j+1/2}^{k} & = - \frac{1}{{e_{3v}}_{j}^{k}}\left({\psi_2}_{j+1/2}^{k+1/2}-{\psi_2}_{j+1/2}^{k+1/2}\right),   \\
1160    {w^*}_{i,j}^{k+1/2} & =    \frac{1}{e_{1t}e_{2t}}\; \left\{
1161      {e_{2u}}_{i+1/2}^{k+1/2} \,{\psi_1}_{i+1/2}^{k+1/2} -
1162      {e_{2u}}_{i-1/2}^{k+1/2} \,{\psi_1}_{i-1/2}^{k+1/2} \right. + \\
1163    \phantom{=} & \qquad\qquad\left. {e_{2v}}_{j+1/2}^{k+1/2} \,{\psi_2}_{j+1/2}^{k+1/2} - {e_{2v}}_{j-1/2}^{k+1/2} \,{\psi_2}_{j-1/2}^{k+1/2} \right\},
1164  \end{split}
1165\]
1166
1167\subinc{\input{../../global/epilogue}}
1168
1169\end{document}
Note: See TracBrowser for help on using the repository browser.