\chapter{OlaFlow}

\section{2D Model}
A 2Dv model was built on a small domain around the breakwater (\SI{250}{\m}
from the crest).

A tool that allows mapping the output fields from swash to the initial fields
in olaFlow was built. Alpha.water and U fields are mapped from swash to
olaFlow.

Boundary conditions are set using the output from the swash model.

A regular mesh is generated and snapped to the bathymetry (mesh resolution: \SI{.5}{\m}).

Simulation is run for 400 seconds using the largest wave from the swash model with the buoy spectrum as an input
(\autoref{fig:wave}).

\begin{figure}
	\centering
	\includegraphics{wave.pdf}
	\caption{Boundary condition for olaflow model.}\label{fig:wave}
\end{figure}

Results are plotted using python \autoref{fig:resola}.
\begin{figure}
	\centering
	\includegraphics{resola.pdf}
	\caption{Results from olaFlow model.}\label{fig:resola}
\end{figure}

\subsection{Porosity parameters}
Several parameters should be calibrated in order to accurately model the porous media: $a$, $b$ and $c$ are friction
parameters in Forcheimer's equation; D50 is the median diameter of the elements constituting the porous media; $p$ is
the porosity of the media.

7 cases were run with the values in \autoref{tab:porotest}.

\begin{table}
	\centering
	\begin{tabular}{cccccc}
		\toprule
		\textbf{Case} & $a$ & $b$ & $c$ & D50 (\si{\m}) & $\phi$ \\
		\midrule
		\textbf{0} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{1} & \intersemibold\num{0} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{2} & \intersemibold\num{5000} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{3} & \num{50} & \intersemibold\num{0} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{4} & \num{50} & \intersemibold\num{3.0} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{5} & \num{50} & \num{1.2} & \num{0.34} & \intersemibold\num{2} & \num{0.4} \\
		\textbf{6} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \intersemibold\num{0.25} \\
		\bottomrule
	\end{tabular}
	\caption{Test cases for porosity parameters.}\label{tab:porotest}
\end{table}

Some results are displayed in \autoref{fig:diff} and \autoref{fig:diff2}. No major differences are noticable
between cases (excepted for case 3, where $b=0$).

\begin{figure}
	\centering
	\includegraphics{diff.pdf}
	\caption{Tests for porosity parameters; water - air border at \SI{-50}{\m}.}\label{fig:diff}
\end{figure}
\begin{figure}
	\centering
	\includegraphics{diff2.pdf}
	\caption{Tests for porosity parameters; water - air border at \SI{-20}{\m}.}\label{fig:diff2}
\end{figure}

Another run with a different value for $b$ was made (\autoref{tab:porotestb}). Results are in \autoref{fig:diff3b}.
The value of $b$ seems to have a major effect how wave energy is dissipated / how waves break, as seen in
\autoref{fig:diff3b175}.

\begin{table}
	\centering
	\begin{tabular}{cccccc}
		\toprule
		\textbf{Case} & $a$ & $b$ & $c$ & D50 (\si{\m}) & $\phi$ \\
		\midrule
		\textbf{0} & \num{50} & \num{1.2} & \num{0.34} & \num{4} & \num{0.4} \\
		\textbf{1} & \num{50} & \intersemibold\num{0} & \num{0.34} & \num{4} & \num{0.4} \\ % 3
		\textbf{2} & \num{50} & \intersemibold\num{0.2} & \num{0.34} & \num{4} & \num{0.4} \\ % 3b
		\bottomrule
	\end{tabular}
	\caption{Test cases for porosity parameters.}\label{tab:porotestb}
\end{table}

\begin{figure}
	\centering
	\includegraphics{diff3b.pdf}
	\caption{Tests for porosity parameters; water - air border at \SI{-20}{\m}.}\label{fig:diff3b}
\end{figure}
\begin{figure}
	\centering
	\includegraphics{diff3b175.pdf}
	\caption{Tests for porosity parameters; water - air border at \SI{175}{\s}.}\label{fig:diff3b175}
\end{figure}

\subsection{Turbulence model}
A case with the $k-\omega$ SST turbulence model was run to compare with the $k-\varepsilon$ model.
Results displayed in \autoref{fig:sst}. Significant differences are found between both models.

Wave breaking as expected using SST model (\autoref{fig:sst175}). See
\url{https://public.edgarpierre.fr/anim_olaflow_kom.mp4}

\begin{figure}
	\centering
	\includegraphics{diffsst.pdf}
	\caption{$x=\SI{-50}{\m}$. Case 1: $k-\varepsilon$ model; case 2: $k-\omega$ SST model.}\label{fig:sst}
\end{figure}
\begin{figure}
	\centering
	\includegraphics{diffsst175.pdf}
	\caption{$t=\SI{175}{\s}$. Case 1: $k-\varepsilon$ model; case 2: $k-\omega$ SST model.}\label{fig:sst175}
\end{figure}

\subsection{Results}
Maximum flow velocity is displayed in \autoref{fig:maxu}.

\begin{figure}
	\centering
	\includegraphics{maxu.pdf}
	\caption{Maximum velocity.}\label{fig:maxu}
\end{figure}

The flow reaches \SIrange{15}{20}{\m\per\s} velocity, which is in accordance with results from \textcite{amir}.
