# Turbulent diffusivity closures and large eddy simulation models

A turbulent diffusivity closure representing the effects of viscous dissipation and diffusion can be passed via the closure keyword.

See turbulence closures and large eddy simulation for more details on turbulent diffusivity closures.

## Constant isotropic diffusivity

To use constant isotropic values for the viscosity $\nu$ and diffusivity $\kappa$ you can use ScalarDiffusivity:

julia> using Oceananigans.TurbulenceClosures

julia> closure = ScalarDiffusivity(ν=1e-2, κ=1e-2)
ScalarDiffusivity{ExplicitTimeDiscretization}(ν=0.01, κ=0.01)

## Constant anisotropic diffusivity

To specify constant values for the horizontal and vertical viscosities, $\nu_h$ and $\nu_z$, and horizontal and vertical diffusivities, $\kappa_h$ and $\kappa_z$, you can use HorizontalScalarDiffusivity() and VerticalScalarDiffusivity(), e.g.,

julia> using Oceananigans.TurbulenceClosures

julia> horizontal_closure = HorizontalScalarDiffusivity(ν=1e-3, κ=2e-3)
HorizontalScalarDiffusivity{ExplicitTimeDiscretization}(ν=0.001, κ=0.002)

julia> vertical_closure = VerticalScalarDiffusivity(ν=1e-3, κ=2e-3)
VerticalScalarDiffusivity{ExplicitTimeDiscretization}(ν=0.001, κ=0.002)

After that you can set, e.g., closure = (horizontal_closure, vertical_closure) when constructing the model so that all components will be taken into account when calculating the diffusivity term. Note that VerticalScalarDiffusivity and HorizontalScalarDiffusivity are implemented using different schemes with different conservation properties.

## Tracer-specific diffusivities

You can also set different diffusivities for each tracer in your simulation by passing a NamedTuple as the argument $\kappa$:

julia> using Oceananigans.TurbulenceClosures

julia> ScalarDiffusivity(ν=1e-6, κ=(S=1e-7, T=1e-10))
ScalarDiffusivity{ExplicitTimeDiscretization}(ν=1.0e-6, κ=(S=1.0e-7, T=1.0e-10))

The example above sets a viscosity of 1e-6, a diffusivity for a tracer called T of 1e-7, and a diffusivity for a tracer called S of 1e-10. Specifying diffusivities this way is also valid for HorizontalScalarDiffusivity and VerticalScalarDiffusivity. If this method is used, diffusivities for all tracers need to be specified.

## Smagorinsky-Lilly

To use the default Smagorinsky-Lilly LES closure, we write

julia> using Oceananigans.TurbulenceClosures

julia> closure = SmagorinskyLilly()
SmagorinskyLilly: C=0.16, Cb=1.0, Pr=1.0

The parameters C, Cb, and Pr may alternatively be specified explicitly. For more details see SmagorinskyLilly.

## Anisotropic minimum dissipation

To use the constant anisotropic minimum dissipation (AMD) LES closure,

julia> using Oceananigans.TurbulenceClosures

julia> closure = AnisotropicMinimumDissipation()
AnisotropicMinimumDissipation{ExplicitTimeDiscretization} turbulence closure with:
Poincaré constant for momentum eddy viscosity Cν: 0.08333333333333333
Poincaré constant for tracer(s) eddy diffusivit(ies) Cκ: 0.08333333333333333
Buoyancy modification multiplier Cb: nothing

no parameters are required although they may be specified. By default, the background viscosity and diffusivity are assumed to be the molecular values for seawater. For more details see AnisotropicMinimumDissipation.

## Convective Adjustment Vertical Diffusivity–Viscosity

To use the a convective adjustment scheme that applies enhanced values for vertical diffusivity $\kappa_z$ and/or viscosity $\nu_z$, anytime and anywhere the background stratification becomes unstable.

julia> using Oceananigans

julia> closure = ConvectiveAdjustmentVerticalDiffusivity(convective_κz = 1.0, background_κz = 1e-3)
ConvectiveAdjustmentVerticalDiffusivity{VerticallyImplicitTimeDiscretization}(background_κz=0.001 convective_κz=1.0 background_νz=0.0 convective_νz=0.0)