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/releases/r4.0/r4.0-HEAD/doc/latex/NEMO/subfiles – NEMO

source: NEMO/releases/r4.0/r4.0-HEAD/doc/latex/NEMO/subfiles/apdx_triads.tex @ 14467

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

Fix documentation generation (manual and guide)

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