<commit_before>\chapter{Parameterisations}\label{chap:parameterisations}

Although \fluidity\ is capable of resolving a range of scales dynamically using
an adaptive mesh, it is not always feasible to resolve all processes and spatial scales that are
required for a simulation, and therefore some form of parameterisation is required.
This chapter introduces the paramateristations that are available in \fluidity.

\section{Turbulent flow modelling and simulation}
\label{sec:turbulence_parametrisations}

\subsection{Reynolds Averaged Navier Stokes Modelling}
\label{sec:RANS}

\subsubsection{Generic length scale turbulence parameterisation}\label{sec:GLS}
\index{viscosity!eddy}
\index{diffusivity!eddy}
\index{Reynolds stress}
\index{turbulence model}
\index{GLS|see{generic length scale model}}
\index{generic length scale model}

The generic length scale (GLS) turbulence parameterisation is capable of simulating vertical
turbulence at a scale lower than that of the mesh. There is no dependency on the mesh resolution,
so is ideal for adaptive ocean-scale problems. GLS has the additional advantage that it
can be set-up to behave as a number of classical turbulence models:
$k-\epsilon$, $k-kl$, $k-\omega$,
and an additional model based on \citet{umlauf2003}, the $gen$ model.

Briefly, all implementations rely on a local, temporally varying, kinematic eddy
viscosity $K_M$ that parametrises turbulence (local Reynolds stresses) in terms of mean-flow
quantities (vertical shear) as, along
with a buoyancy term that parameterises the kinematic eddy diffusivity, $K_H$:

\begin{equation}
\overline{u'w'} = -\nu_M\frac{\partial u}{\partial z},\quad
\overline{v'w'} = -\nu_M\frac{\partial v}{\partial z},\quad
\overline{w'\rho'} = -\nu_H\frac{\partial\rho}{\partial z},
\end{equation}
with
\begin{equation}
\nu_M = \sqrt{k}lS_{M}+\nu_M^0, \quad
\nu_H = \sqrt{k}lS_{H}+\nu_H^0,
\label{eq:diff}
\end{equation}
Here, we follow the notation of \citet{umlauf2003}, where $u$ and $v$ are the 
horizontal components of the Reynolds-averaged velocity along the $x$- and $y$-axes, 
$w$ is the vertical velocity along the vertical $z$-axis, positive upwards, and 
$u'$, $v'$ and $w'$ are the components of the turbulent fluctuations about the 
mean velocity. $\nu_H^0$ is the background diffusivity, $\nu_M^0$ is the background viscosity, 
$S_{M}$ and $S_{H}$ are often referred to as stability functions, $k$ is the turbulent kinetic energy,
and $l$ is a length-scale. When using GLS the values of $\nu_M$ and $\nu_H$ become the 
vertical components of the tensors $\tautens$ and $\kaptens_T$ 
in equation \ref{boussinesq} respectively. Other tracer fields, such as 
salinity use the same diffusivity as temperature, i.e. $\kaptens_T = \kaptens_S$.

The generic length scale turbulence closure model \citep{umlauf2003} is based
on two equations, for the transport of turbulent kinetic energy (TKE) and a
generic second quantity, $\Psi$. The TKE equation is:
\begin{equation}
\frac{\partial k}{\partial t} + \bmu_i\frac{\partial k}{\partial x_i} =
\frac{\partial}{\partial z}\left(\frac{\nu_M}{\sigma_k}\frac{\partial k}{\partial z}\right) + P + B - \epsilon,
\label{eq:tke_one}
\end{equation}

\noindent 
where $\sigma_k$ is the turbulence Schmidt number for $k$, $u_i$ are the
velocity components ($u$, $v$ and $w$ in the $x$, $y$ and $z$ directions 
respectively), and $P$ and $B$ represent production by shear and buoyancy
which are defined as:
\begin{equation}
P=-\overline{u'w'}\frac{\partial u}{\partial z}-\overline{v'w'}
\frac{\partial v}{\partial z}=\nu_MM^2, \quad M^2=
\left(\frac{\partial u}{\partial z}\right)^2 + \left(\frac{\partial v}{\partial z}\right)^2,
\end{equation}
\begin{equation}
B=-\frac{g}{\rho_0}\overline{\rho'w'}=-\nu_HN^2, \quad N^2= -\frac{g}{\rho_0}\frac{\partial\rho}{\partial z}
\end{equation}

Here $N$ is the buoyancy frequency; $u$ and $v$ are the horizontal velocity 
components. The dissipation is modelled using a rate of dissipation term:
\begin{equation}
\epsilon=\left(c_\mu^0\right)^{3+\frac{p}{n}}k^{\frac{3}{2}+\frac{m}{n}}\Psi^{-\frac{1}{n}}
\end{equation}
where $c_\mu^0$ is a model constant used to make $\Psi$ identifiable with any of the transitional
models, e.g. $kl$, $\epsilon$, and $\omega$, by adopting the values shown in Table \ref{tab:glsparams} \citep{umlauf2003}.
The second equation is:
\begin{equation}<commit_msg>Adding the ocean parameterisation to the manual<commit_after>\chapter{Parameterisations}\label{chap:parameterisations}

Although \fluidity\ is capable of resolving a range of scales dynamically using
an adaptive mesh, it is not always feasible to resolve all processes and spatial scales that are
required for a simulation, and therefore some form of parameterisation is required.
This chapter introduces the paramateristations that are available in \fluidity.

\section{Turbulent flow modelling and simulation}
\label{sec:turbulence_parametrisations}

\subsection{Reynolds Averaged Navier Stokes Modelling}
\label{sec:RANS}

\subsubsection{Generic length scale turbulence parameterisation}\label{sec:GLS}
\index{viscosity!eddy}
\index{diffusivity!eddy}
\index{Reynolds stress}
\index{turbulence model}
\index{GLS|see{generic length scale model}}
\index{generic length scale model}

The generic length scale (GLS) turbulence parameterisation is capable of simulating vertical
turbulence at a scale lower than that of the mesh. There is no dependency on the mesh resolution,
so is ideal for adaptive ocean-scale problems. GLS has the additional advantage that it
can be set-up to behave as a number of classical turbulence models:
$k-\epsilon$, $k-kl$, $k-\omega$,
and an additional model based on \citet{umlauf2003}, the $gen$ model.

Briefly, all implementations rely on a local, temporally varying, kinematic eddy
viscosity $K_M$ that parametrises turbulence (local Reynolds stresses) in terms of mean-flow
quantities (vertical shear) as, along
with a buoyancy term that parameterises the kinematic eddy diffusivity, $K_H$:

\begin{equation}
\overline{u'w'} = -\nu_M\frac{\partial u}{\partial z},\quad
\overline{v'w'} = -\nu_M\frac{\partial v}{\partial z},\quad
\overline{w'\rho'} = -\nu_H\frac{\partial\rho}{\partial z},
\end{equation}
with
\begin{equation}
\nu_M = \sqrt{k}lS_{M}+\nu_M^0, \quad
\nu_H = \sqrt{k}lS_{H}+\nu_H^0,
\label{eq:diff}
\end{equation}
Here, we follow the notation of \citet{umlauf2003}, where $u$ and $v$ are the 
horizontal components of the Reynolds-averaged velocity along the $x$- and $y$-axes, 
$w$ is the vertical velocity along the vertical $z$-axis, positive upwards, and 
$u'$, $v'$ and $w'$ are the components of the turbulent fluctuations about the 
mean velocity. $\nu_H^0$ is the background diffusivity, $\nu_M^0$ is the background viscosity, 
$S_{M}$ and $S_{H}$ are often referred to as stability functions, $k$ is the turbulent kinetic energy,
and $l$ is a length-scale. When using GLS the values of $\nu_M$ and $\nu_H$ become the 
vertical components of the tensors $\tautens$ and $\kaptens_T$ 
in equation \ref{boussinesq} respectively. Other tracer fields, such as 
salinity use the same diffusivity as temperature, i.e. $\kaptens_T = \kaptens_S$.

The generic length scale turbulence closure model \citep{umlauf2003} is based
on two equations, for the transport of turbulent kinetic energy (TKE) and a
generic second quantity, $\Psi$. The TKE equation is:
\begin{equation}
\frac{\partial k}{\partial t} + \bmu_i\frac{\partial k}{\partial x_i} =
\frac{\partial}{\partial z}\left(\frac{\nu_M}{\sigma_k}\frac{\partial k}{\partial z}\right) + P + B - \epsilon,
\label{eq:tke_one}
\end{equation}

\noindent 
where $\sigma_k$ is the turbulence Schmidt number for $k$, $u_i$ are the
velocity components ($u$, $v$ and $w$ in the $x$, $y$ and $z$ directions 
respectively), and $P$ and $B$ represent production by shear and buoyancy
which are defined as:
\begin{equation}
P=-\overline{u'w'}\frac{\partial u}{\partial z}-\overline{v'w'}
\frac{\partial v}{\partial z}=\nu_MM^2, \quad M^2=
\left(\frac{\partial u}{\partial z}\right)^2 + \left(\frac{\partial v}{\partial z}\right)^2,
\end{equation}
\begin{equation}
B=-\frac{g}{\rho_0}\overline{\rho'w'}=-\nu_HN^2, \quad N^2= -\frac{g}{\rho_0}\frac{\partial\rho}{\partial z}
\end{equation}

Here $N$ is the buoyancy frequency; $u$ and $v$ are the horizontal velocity 
components. The dissipation is modelled using a rate of dissipation term:
\begin{equation}
\epsilon=\left(c_\mu^0\right)^{3+\frac{p}{n}}k^{\frac{3}{2}+\frac{m}{n}}\Psi^{-\frac{1}{n}}
\end{equation}
where $c_\mu^0$ is a model constant used to make $\Psi$ identifiable with any of the transitional
models, e.g. $kl$, $\epsilon$, and $\omega$, by adopting the values shown in Table \ref{tab:glsparams} \citep{umlauf2003}.

There is also the option to add an extra term to account for various
oceanic parameters, such an internal waves breaking. This is based on the NEMO
ocean model and takes a user-defined percentage of the surface $k$ and adds it down-depth
using an exponential profile:
\begin{equation}
    k_z = {k_z}_o + p*k_{\mathrm{sur}} * \exp{\left( -z / l_k \right)}
\end{equation}
where $k_z$ is the new turbulent kinetic energy value at depth, $z$, ${k_z}_o$ is the original TKE, $k_{\mathrm{sur}}$
is the surface TKE, $p$ is a constant, and $l_k$ is a lengthscale. The options for this can be found in
\option{\ldots/subgridscale\_parameterisations/gls/ocean\_parameterisation}.

The second equation is:
\begin{equation}
{'fraction_non_alphanumeric': 0.13000739879505338, 'fraction_numerical': 0.00718740090899482, 'mean_word_length': 5.0382897255903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4484650', 'n_tokens_mistral': 3108, 'n_tokens_neox': 2945, 'n_words': 1114}