subroutine ss_nn()

Here, the shear frequency squared, , and the buoyancy frequency squared, , with buoyancy from (4) are calculated. For both calculations, two alternative methods are coded. The two straight-forward methods which are explained first, do both have the disadvantage of generating numerical instabilities. The straight-forward way for calculating is as follows:

Burchard (2002a) developed a new scheme, which guarantees that the mean kinetic energy which is dissipated from the mean flow equals the shear production of turbulent kinetic energy. Therefore, this scheme should be numerically more stable than (128):

The straight-forward discretisation of is given by

In some cases, together with the straight-forward discretisation of the shear squared, (128), this did not produce stable numerical results. The reason for this might be that the velocities involved in the calculation for the shear squared do depend on the buoyancies in the two neighbouring T-points such that the straight-forward method (130) leads to an inconsistency. However, other experiments with the energy-conserving discretisation of the shear stress squared, (129) and the straight-forward discretisation of , (130), produced numerically stable results.

Most stable results have been obtained with a weighted average for the calculation:

These stability issues need to be further investigated in the future.
**USES:**

use domain, only: imin,imax,jmin,jmax,kmax,au,av,az use variables_3d, only: kmin,kumin,hn,uu,hun,kvmin,vv,hvn,SS,num use parameters, only: g,rho_0 #ifndef NO_BAROCLINIC use variables_3d, only: NN,buoy,T,S #ifndef _OLD_BVF_ use variables_3d, only: alpha,beta #endif #endif use getm_timers, only: tic, toc, TIM_SSNN $ use omp_lib IMPLICIT NONE

Original author(s): Hans Burchard & Karsten Bolding

integer :: i,j,k,nb REALTYPE :: dz,NNc,ttt REALTYPE :: NNe,NNw,NNn,NNs REALTYPE, parameter :: small_bvf = 1.d-10 #ifdef _SMOOTH_BVF_VERT_ REALTYPE :: below,center,above #endif