### Numerics

For the spatial discretisation, the water column is divided into layers of not necessarily equal thickness ,

 (3)

with nondimensional interfaces with , and , see Burchard and Petersen (1997).

The discrete values for the mean flow quantities , , , and represent interval means and are therefore located at the centres of the intervals, and the turbulent quantities like , , , , , , , , , and are positioned at the interfaces of the intervals (see section 4.7). The indexing is such, that the interface above an interval has the same index as the interval itself. This means that mean flow quantities range from while turbulent quantities range from (see figure 1).

The staggering of the grid allows for a straight-forward discretisation of the vertical fluxes of momentum and tracers without averaging. However, for the vertical fluxes of e.g. and , averaging of the eddy diffusivities is necessary. This is only problematic for the fluxes near the surface and the bottom, where viscosities at the boundaries have to be considered for the averaging. These can however be derived from the law of the wall.

The time stepping is equidistant, based on two time levels and not limited by Courant numbers, because of the absence of advection and an implicit treatment of vertical diffusion, see figure 2. In the following, the discretisation of a simple diffusion equation,

 (4)

will be illustrated for Neumann-type boundary conditions

 for (5)

and

 for (6)

The semi-implicit discretisation of (4) can then be written as

 (7)

 (8)

 (9)

for . Here, the semi-implicit time level is defined by

 (10)

Thus, for , a fully explicit, for a fully implicit, and for the Crank and Nicolson (1947) second-order scheme are obtained. Figure 2 shows an example for . It should be noted that often a time stepping is preferable which is slightly more implicit than the Crank and Nicolson (1947) scheme in order to obtain asymptotic stability. The resulting linear system of equations (7) - (9) with tri-diagonal matrix structure is solved by means of the simplified Gaussian elimination.

With the same strategy, a very similar system of equations can be derived for variables located at the interfaces of the grid cells, i.e. variables describing turbulence.

Karsten Bolding 2012-12-28