###

do_spm - suspended matter equation

**INTERFACE:**

subroutine do_spm()

**DESCRIPTION:
**

Here, one time step for the suspended matter equation is performed.
First, preparations for the call to the advection schemes are
made, i.e. calculating the necessary metric coefficients
and the relevant vertical velocity, which is here composed of the
grid-related vertical flow velocity and the settling velocity.
Some lines of code allow here for consideration of
flocculation processes.
After the call to the advection schemes, which actually perform
the advection (and horizontal diffusion) step as an operational
split step, the fluxes between bottom SPM pool and the suspended matter
in the water column are calculated.
Afterwards, the tri-diagonal matrix for calculating the
new suspended matter by means of a semi-implicit central scheme for the
vertical diffusion is set up.
There are no source terms on the right hand sides.
The subroutine is completed by solving the tri-diagonal linear
equation by means of a tri-diagonal solver.

Optionally, the density of the sediment-laden water may be
corrected by the sediment density, see eq. (125).

Finally, some special settings for single test cases are made via
compiler options.
**USES:**

use advection_3d, only: do_advection_3d
use variables_3d, only: dt,cnpar,hun,hvn,ho,nuh,uu,vv,ww
#ifndef NO_BAROCLINIC
use variables_3d, only: rho
#endif
use domain, only: dry_z
IMPLICIT NONE

**LOCAL VARIABLES:**
integer :: i,j,k,rc
REALTYPE,dimension(I3DFIELD) :: wwadv
REALTYPE :: spmtot
REALTYPE :: Res(0:kmax)
REALTYPE :: auxn(1:kmax-1),auxo(1:kmax-1)
REALTYPE :: a1(0:kmax),a2(0:kmax)
REALTYPE :: a3(0:kmax),a4(0:kmax)
REALTYPE :: bed_flux
REALTYPE :: c
REALTYPE :: volCmud,volCpart
integer :: k2
logical :: patankar=.true.
#ifdef TRACER_POSITIVE
logical :: kk
#endif

kklingbe
2017-10-02