.. _horizontal-mixing-parameterizations:

====================================
Horizontal mixing parameterizations
====================================

The namelist `hmix\_nml <http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/modelnl/nl_pop2.html#hmix>`_ controls horizontal mixing.

Several horizontal mixing options are available for mixing tracers and
momentum. With a few exceptions (discussed later), the choice of tracer
mixing can be made independently of the choice of momentum mixing. 

As with vertical mixing, the main namelist input only selects the choice of
mixing options; the actual mixing parameters associated with each option
are read from a namelist specific to that option. 

The ``del2`` (Laplacian) and ``del4`` (bi-harmonic) mixing options are
*ad hoc* level-oriented parameterizations that mix water-mass
properties across sloping isopycnic surfaces. The Gent-McWilliams [11]
parameterization remedies this shortcoming by forcing the mixing (of
tracers only) to take place along isopycnic surfaces. The principal
drawback of the ``gent`` option is cost; it nearly doubles the running
time. For momentum mixing, an anisotropic viscosity parameterization
(``aniso``) is also available which assigns different values of
viscosity parallel and perpendicular to a given direction, where the
direction can be specified as described in a later section. Under the
``aniso`` option, a Smagorinsky form of viscosity can be specified.


Laplacian horizontal mixing.
-----------------------------

The namelist `hmix\_del2t\_nml <http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/modelnl/nl_pop2.html#hmix>`_ controls Laplacian tracer mixing.

The Laplacian mixing coefficients for tracers ``ah`` and momentum ``am``
are specified in separate namelists. The defaults shown in the namelists
are only valid for a particular grid size; the user must determine the
appropriate values for their particular grid size. 

The ``variable_hmix`` option modifies the coefficients ``ah`` and
``am`` based on functions of the grid cell areas and will reduce the
values for smaller grid cells (``am`` and ``ah`` thus represent the
values at the largest grid cells).  

Currently, the functional form of this scaling can only be changed by
editing the modules. The ``auto_hmix`` option attempts to compute
coefficients based on known values for other resolutions. The result
may or may not be suitable and the ``auto_hmix`` option is provided
mainly for flexible benchmarking of the code at various resolutions.


Biharmonic horizontal mixing. 
------------------------------

The biharmonic mixing coefficients for tracers ``ah`` and momentum
``am`` are specified in separate namelists. The defaults shown in the
namelists are only valid for a particular grid size; the user must
determine the appropriate values for their particular grid size. The
``variable_hmix`` option modifies the coefficients ``ah`` and ``am``
based on functions of the grid cell areas and will reduce the values for
smaller grid cells (``am`` and ``ah`` thus represent the values at the
largest grid cells). Currently, the functional form of this scaling can
only be changed by editing the modules. The ``auto_hmix`` option
attempts to compute coefficients based on known values for other
resolutions. The result may or may not be suitable and the ``auto_hmix``
option is provided mainly for flexible benchmarking of the code at
various resolutions.

.. todo:: put in link for **&hmix\_del4u\_nml** Biharmonic momentum mixing namelist

.. todo:: put in link for **&hmix\_del4t\_nml** Biharmonic tracer mixing namelist

Gent-McWilliams isopycnic tracer diffusion
-------------------------------------------

Gent-McWilliams (``gent``) mixing operates only on tracer species
(potential temperature, salinity and other tracers), so it should be
used in conjunction with a different option for
``hmix_momentum_choice``, typically either ``del2`` or ``aniso``. No
bi-harmonic form of ``gent`` has been developed and accepted yet, so
it is appropriate to use the ``del2`` values of ``ah``. For vertical
dependence of the mixing, a profile with the form :math:`\kappa _1 - \kappa _2*\exp^{-z/D}` can be chosen, where 
:math:`D` is a depth scale, :math:`z` is model depth and :math:`\kappa _1` and
:math:`\kappa _2` parameters specifiy factors multiplying the
diffusivity. Note that this function is multiplied by the diffusivity
``ah``; for a constant :math:`\kappa` the first parameter should be
set to 1 and the second to 0. Two diffusivities can be specified for
the Redi and bolus parts of the GM parameterization; ``ah`` is used
for the Redi part, ``ah_bolus`` is used for the bolus part. Two
different maximum slopes can also be specified to allow different
taperings of the Redi and bolus terms. A backgroud horizontal
diffusivity ``ah_bkg`` can be used for bottom cells. If the
``gm_bolus`` flag is set, the bolus velocity is explicitly calculated
and used as part of the velocity field, as opposed to the
incorporating this process as part of the horizontal mixing. This last
option does not currently work with partial bottom cells.

.. todo:: put in a link to  **&hmix\_gm\_nml** Gent-McWilliams horizontal mixing namelist

The user is referred to the `The Parallel Ocean Program (POP) Reference
Manual <http://www.cesm.ucar.edu/models/cesm1.0/pop/doc/sci/POPRefManual.pdf>`__
for details on the various options listed in the POP2 hmix\_gm\_nml and mix\_submeso\_nml namelists.

Anisotropic viscosity options
------------------------------

The anisotropic viscosity routine computes the viscous terms in the
momentum equation as the divergence of a stress tensor, which is
linearly related to the rate-of-strain tensor with viscous coefficents
``visc_para`` and ``visc_perp`` . These coefficients represent energy
dissipation in directions parallel and perpendicular to a specified
alignment direction which breaks the isotropy of the dissipation. There
are three options for choosing the alignment direction: 1) along the
local instantaneous flow direction, 2) along the east direction, and 3)
along the coordinate directions (note: the viscous operator is invariant
under a rotation of the alignment direction by 90 degrees, so for
example, choosing the alignment direction as north, south, east or west
are all equivalent.). A functional approach is used to derived the
discrete operator, which ensures positive-definite energy dissipation,
provided ``visc_para`` > ``visc_perp``.

Parallel and perpendicular viscosities can vary in space by setting the
flag ``lvariable_hmix_aniso`` to .true. The spatially-varying
viscosities in the parallel and perpendicular directions are read from a
file (``var_viscosity_infile``). A specific form of the viscosities
can be internally computed if the input filename is 'ccsm-internal'. In such a case, the six viscosity
parameters for the form must also be supplied.

The viscosities may optionally (``lsmag_aniso`` = .true.) be evaluated
with Smagorinsky-like non-linear dependence on the deformation rate,
which is proportional to the norm of the strain tensor. With the
Smagorinsky option, the viscosities are evalutated as

.. math::

   \nu_\parallel \rightarrow \max(c_\parallel|D|ds^2)  

   \nu_\perp \rightarrow \max(c_\perp|D|ds^2), u_\perp ds)

where 

:math:`ds = min(dx,dy)`,  :math:`|D| = \sqrt{2}|E|` is the deformation rate, :math:`|E|` is the norm of the strain tensor,
:math:`c_\parallel` and :math:`c_\perp` are dimensionless coefficients of order 1, and :math:`u_\parallel` and :math:`u_\perp` are velocities
associated with the grid Reynolds number which determine minimum background viscosities in regions where the nonlinear viscosities are
too small to control grid-point noise. 
Typically :math:`u_\parallel\` and :math:`u_\perp` are order 1 cm/s. Perpendicular Smagorinsky coefficients
can be reduced using a latitudinally-dependent Gaussian function. The
form of this function is governed by the three ``smag_lat`` parameters.

.. todo:: add link to **&hmix\_aniso\_nml** for Anisotropic viscosity namelist