\documentclass[12pt]{book}
\usepackage{html,a4wide,epsfig}
\usepackage[british]{babel}
\newcommand{\hl}[1]{\htmladdnormallink{{\it #1}}{#1}}
\newcommand{\ix}[1]{#1\index{#1}}
\newcommand{\linecmd}{
   \setlength{\unitlength}{1cm}
   \noindent
   \begin{picture}(18,0.12)
     \thicklines
     \put(0,0){\line(1,0){17}}
     \put(0,0.1){\line(1,0){17}}
   \end{picture}
}
\newcommand{\idxcmd}[1]{
   \addcontentsline{toc}{subsubsection}{#1}
   \index{#1}
}
\begin{document}

\section*{SWANmud documentation
\footnote[1]{
$Revision$\\
$HeadURL$ 
 \\
Access via https://public.deltares.nl/display/OET/SWANmud 
} }

\noindent SWANmud contains extra features to simulate the effect of fluid mud layers
on the wave number. Details on the implementation can be found in:
\begin{itemize}
\item Kranenburg, W.M., J.C. Winterwerp, G.J. de Boer, J.M. Cornelisse and M. Zijlema, 2011. SWAN-mud, an engineering model for mud-induced wave-damping, ASCE, Journal of Hydraulic Engineering (doi: 10.1061/(ASCE)HY.1943-7900.0000370).
\item Kranenburg, W.M. (2008). Msc. thesis Delft University of technology. \url{http://repository.tudelft.nl/view/ir/uuid%3A7644eb5b-0ec9-4190-9f72-ccd7b50cfc47/}
Supervisors:  J.C. Winterwerp, G.J. de Boer.

\end{itemize}

The latest version of SWANmud is based on SWAN release 40.51A.

\idxcmd{MUD}
\linecmd
\begin{verbatim}
MUD  [alpha]   [rhom]    [rho0]   [nu] [layer] &
     [disperr] [disperi] [source] [cg] [power]
\end{verbatim}
\linecmd

\noindent
With this extra command in SWANmud the user can anable the mud frunctionality.
\begin{tabbing}
xxxxxxxxxxxx\= \kill
{\tt [alpha]} \>   calibration coefficient in damping term for accounting \+\\
                   possible nonlinear effects (parameter 1)\\
                   Default: {\tt [alpha]}=0.\-\\
{\tt [rhom]} \>    is the density $\rho$ of the fluid mud layer (in kg/m$^3$). (parameter 2)\+\\
                   Default: {\tt [rhom]}=1300.\-\\
{\tt [rho0]}    \> is the water density $\rho$ (in kg/m$^3$). (parameter 3)\+\\
                   Default: {\tt [rho0]}={\tt [rho]} from {\tt SET} command.\-\\
{\tt [nu]} \>      viscosity of fluid mud layer (note that the \+\\
                   viscosity of water is always 1e-6 m$^2$/s) (parameter 4)\\
                   Default: {\tt [nu]} = 0.00276 m$^2$/s.\-\\
{\tt [layer]} \>   thickness of mud layer in m in case {\tt READINP} command is not\+\\
                   used to read a spatially varying thickness of mud.(parameter 5)\\
                   Default: {\tt [layer]} = 0.\-\\
{\tt [disperr]} \> type of dispersion relation to be used for either ...\\
{\tt [disperi]} \> .. the real ({\tt [disperr]}) and imaginary {\tt [disperi]}  \+\\
                   wave number respectively (parameters 6 and 7)\\
                   \pushtabs
                   xxxxxxxxxxxxx\=xxx \kill
                   {\tt [disperr]} = 0 \>: Guo (2002)\\
                   {\tt [disperr]} = 1 \>: Gade (1958)\\
                   {\tt [disperr]} = 2 \>: DeWit (1995)\\
                   {\tt [disperr]} = 3 \>: Delft (2010)\\
                   {\tt [disperr]} = 4 \>: Dalrymple (1978)\\
                   {\tt [disperr]} = 5 \>: Ng (2000)\\
                   {\tt [disperr]} =-1 \>: 2D spectral file {\tt MUDFile} will be read \\
                   This file is walsy written if any of the above disperion relations is used.\\
                   Please check {\tt MUDFile} to check for possible errors in convergence.\\
                   Any artificial dispersion relation cen be fed into SWANmud by supplying a \\
                   {\tt MUDFile} with the correct matrix size. {\tt MUDFile} is a regular 2D spectral \\
                   file that specifies ({\tt KREAL}, {\tt KIMAG}) for every location and every spectral bin.\\
                   \poptabs
                   Default: {\tt [disperr]} = 3 and {\tt [disperi]} = 3. \-\\
{\tt [source]} \>  type of dispersion relation to be used for \+\\
                   source term. Note that not for all dispersion relations \\
                   the corresponding source term is available. (parameter 8) \\
                   \pushtabs
                   xxxxxxxxxxxxx\=xxx \kill
                   {\tt [disperr]} = 0 \>: no fluid mud dissipation\\
                   {\tt [disperr]} = 1 \>: Gade (1958)\\
                   {\tt [disperr]} = 1 \>: Gade (1958)\\
                   {\tt [disperr]} = 2 \>: DeWit (1995)\\
                   \poptabs 
                   Note that the same codes have been used as for {\tt [disperr]} and {\tt [disperi]}. \\
                   A warning is issued if the codes for {\tt [source]} and {\tt [disperr]} and {\tt [disperi]} \\
                   do not match.
                   Default: {\tt [source]} = 3.\-\\
{\tt [cg]}  \>     whether to use the effect of fluid mud on the \+\\
                   wave propagation (parameter 9)\\
                   \pushtabs
                   xxxxxxxxxxxxx\=xxx \kill
                   {\tt [cg]} = 0 \>: no not use effect of mud on propagation\\
                   {\tt [cg]} = 1 \>: include effect of mud on propagation\\
                   \poptabs
                   Default: {\tt [cg]} = 0.\-\\
{\tt [power]}  \>  power for determining spectrum averaged wave length {\tt WLENMR}\+\\
                   (parameter 10)\\
                   \pushtabs
                   xxxxxxxxxxxxx\=xxx \kill
                   {\tt [disperr]} =  0 \>: uses same exponent for {\tt WLENMR} as for {\tt WLEN}\\
                   {\tt [disperr]} $>$  1 \>: exponent to be used for {\tt WLENMR}\\
                   {\tt [disperr]} ranging from {\tt -MSC} to $<$ -1 \>: \\ 
                   selects one particular frequency with index $abs({\tt [disperr]})$\\
                   \poptabs
                   Default: {\tt [power]} = 0.\-\\
\end{tabbing}
\begin{picture}(16,0.1)
  \put(0,0){\line(1,0){15}}
  \put(0,0.04){\line(1,0){15}}
\end{picture}
\\
\\
\noindent SWANmud always generates a 2D spectral file called {\tt MUDFile} that contains
the real and imaginary wave numbers for all locations and all frequencies ({\tt KREAL}, {\tt KIMAG}).
Note that there is no directional dependence of these wave numbers, so the 2D spectral file
contains only one (dummy) directional bin.

Sometimes the calculatation of the real and imaginary wave numbers results in erronous roots. 
This happens in the margin of the parameter space, e.g. a very thin mud layer (order mm) or 
extreme values for the viscosity. Always check the {\tt MUDFile} for improper roots. When a roots
is very wrong, SWANmud will crash, but sometimes erronous roots do not make SWAN crash. A manualy modified 
{\tt MUDFile} in which any erronous roots has been corrected, can be fed back into SWAN using 
{\tt [disperr]} =1 and {\tt [disperi]} =-1. 

The calculation of the mud-affected wave numbers can be slow in some cases. In those cases {\tt MUDFile} can
simply be reused unaltered for wave scenarios in which the mud parameters do not change (i.e only wave conditions and directional grids vary, but mud thickness, water depth, water level, mud and water density, mud viscosity and the spatial and frequency grids remain identical).

You can load and analyse the {\tt MUDFile} easily as any 2D spectral file with for instance the SWAN Matlab toolbox 
from the OpenEarthTools collection available via \url{http://www.Openearth.eu}.
\\
\begin{picture}(16,0.1)
  \put(0,0){\line(1,0){15}}
  \put(0,0.04){\line(1,0){15}}
\end{picture}
\\
\\
\noindent For SWANmud additional definitions for output quantities are available ({\tt BLOck},{\tt TABle}):
\begin{tabbing}
 xxxxxxxxxxxx\= \kill
{\tt DISMud} \> total energy dissipation due to fluid mud\+\\
                (in W/m$^2$ or m$^2$/s, depending on command {\tt SET}).\-\\
{\tt WLENMR}\>  spectrally averaged {\tt KREAL} in (m), defined as\+\\
                        \\
${\rm WLENMR} = 2\pi \left( \frac{\int \int k^{p} E(\sigma,\theta)d\sigma d\theta}{\int \int k^{p-1} E(\sigma,\theta)d\sigma d\theta} \right)^{-1}$ \\
                        \\
                 As default, $p=1$ ($p$ is defined by the command {\tt power} in {\tt MUD}).\-\\
{\tt MUDL} \>    thickness of mud layer (in m).\\
{\tt KI}     \> spectrally averaged {\tt KIMAG} (in rad/m), see definition for {\tt WLENMR}.\\
\end{tabbing}
\begin{picture}(16,0.1)
  \put(0,0){\line(1,0){15}}
  \put(0,0.04){\line(1,0){15}}
\end{picture}
\\
\\
\noindent For SWANmud an additional definition for an input quantity is available too ({\tt INPgrid}):
\begin{tabbing}
 xxxxxxxxxxxx\= \kill
{\tt MUDL} \>    thickness of mud layer (in m).\\
\end{tabbing}

\noindent to be used as the other input fields:

\begin{verbatim}
          |  ...         |
          |              |          
READinp  <   MUDl         >  ...
          |              |          
          |  ...         |
\end{verbatim}

\begin{verbatim}
              | ..          |
              |             |
INPgrid     (<               >)  ...
              | MUDl        |
              |             |
              | ..          |
\end{verbatim}
\begin{picture}(16,0.1)
  \put(0,0){\line(1,0){15}}
  \put(0,0.04){\line(1,0){15}}
\end{picture}
\\
\\
Example of relevant lines from example using Gade (1958) {\tt swan.edt}

\begin{verbatim}
...
INPGRID MUDL     -1.    0.     0.     2     0  501.     0.
READINP MUDL   1. 'mudfield.bot' 4 0 FREE
...
FRICTION ...
MUD alpha=1. rhom=1750. nu=0.5 disperr=1 disperi=1 source=1 cg=0
WIND ...
...
CURVE  'GAUGE' 0. 0.  100  1000. 0.
TABLE  'GAUGE' HEAD 'out.crv' XP YP DEP HS DISSIP DISMud WLEN WLENMR KI MUDL
...
\end{verbatim}
\end{document}
