# 2016WP SIMPLIF-5_ACC Re-implementation of Smagorinsky

This is the color code for the fulfilment of this form:

PI(S) | Previewer(s) | Reviewer(s) |

The PI is responsible to closely follow the progress of the action, and especially to contact NEMO project manager if the delay on preview (or review) are longer than the 2 weeks expected.

## Abstract

This section should be completed before starting to develop the code, in order to find agreement on the method beforehand.

**To enabling the !ticket and the source links in the Trac environment, those have to be hardcoded in the form**

# Jointly agreed plan (after preview)

## Description

This task reimplements a spatially varying eddy viscosity coefficient proportional to the local deformation rate and grid scale (Smagorinsky 1993). This reimplementation takes advantage of the recently reorganised and simplified LDF modules which means the scheme can be implemented as a simple alternative to the existing scheme for a space and time varying coefficient (nn_aht_ijk_t=31). This will provide a much cleaner implementation than the version which was removed from v3.6_STABLE and requires very few additional arrays and no preprocessor keys

## Implementation

The changes will occur primarily in ldfdyn.F90.

Firstly, in MODULE ldfdyn which will acquire the following name list additions:

!! If nn_ahm_ijk_t = 32 a time and space varying Smagorinsky viscosity !! will be computed. REAL(wp), PUBLIC :: rn_csmc !: Smagorinsky constant of proportionality REAL(wp), PUBLIC :: rn_cfacmin !: Multiplicative factor of theorectical minimum Smagorinsky viscosity REAL(wp), PUBLIC :: rn_cfacmax !: Multiplicative factor of theorectical maximum Smagorinsky viscosity

The majority of code changes then occur in ldf_dyn where the CASE statement is extended to respond to CASE 32 by setting coefficients according to the Smagorinsky scheme as revisited in Griffies and Hallberg (2000). For efficiency it is useful to define module-private 2D arrays to store some calculated terms:

REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dtensq !: horizontal tension squared (Smagorinsky only) REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dshesq !: horizontal shearing strain squared (Smagorinsky only) REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: esqt, esqf !: Square of the local gridscale (e1e2/(e1+e2))**2

The length-squared terms (L^{2}) are geometric invariants that can be calculated once
at start (ldf_dyn_init). The horizontal tension (D_{T}= du/dx - dv/y) is calculated at
T-points using the before velocities. The horizontal shearing strain (D_{S} = du/dy +
dv/dx) is calculated at F-points using the same velocities. Storing the squares of
these terms means that computing viscosity coefficients at T & F points is merely a
case of combining different averages of these arrays.

Using the relationship given by Griffies and Hallberg (2000); namely:

B_smag = A_smag * L^2 / 8

means that the biharmonic coefficients (if required) can be computed from a simple scaling of the harmonic values. Note that the new implementation of the biharmonic operator as a re-rentrant laplacian means that the square root of the biharmonic coefficient should be returned by this routine.

## Reference manual

The description of the Smagorinsky scheme in the current reference will be altered to reflect the new method of activation. At this stage there are no plans to implement the additional experimental options in the previous implementation (i.e. the ability to control the contribution of the sheer term with an additional name list parameter and the option to apply a Smagorinsky type criterion to a space a time varying diffusion coefficient.

Details of the new implementation will be added and will include both the continuous and discrete forms of the operators used.

**Griffies, S., M., and W. Hallberg, R** , Biharmonic friction with a Smagorinsky-like
viscosity for use in large-scale eddy-permitting ocean models, Mon. Wea. Rev., 128(8),
2935-2946, 2000.

## Preview

Since the preview step must be completed before the PI starts the coding, the previewer(s) answers are expected to be completed within the two weeks after the PI has sent his request.

For each question, an iterative process should take place between PI and previewer(s) in order to reach a "YES" answer for each of the following questions.

Once all "YES" have been reached, the PI can start the development into his development branch.

## Tests

Once the development is done, the PI should complete this section below and ask the reviewers to start their review in the lower section.

## Review

A successful review is needed to schedule the merge of this development into the future NEMO release during next Merge Party (usually in November).

Once review is successful, the development must be scheduled for merge during next Merge Party Meeting.