@@ -18,10 +18,10 @@ The macro can be used with a variable amount of arguments. A simple call could l
\begin{lstlisting}[style=DumuxCode]
dune_add_test(NAME my_test
SOURCES mainfile.cc
SOURCES main.cc
CMD_ARGS my_test params.input)
\end{lstlisting}
Here, we create an executable called \texttt{my\_test} from a source file \texttt{mainfile.cc}.
Here, we create an executable called \texttt{my\_test} from a source file \texttt{main.cc}.
The name of the test will also be \texttt{my\_test} (has to be unique). The last argument specifies a command - here, we just run the executable \texttt{my\_test} with an input file \texttt{params.input}. For more advanced uses of
the \texttt{add\_dune\_test} macro, have a look at the \texttt{test} directory. A complete documentation is given under \url{https://www.dune-project.org/sphinx/core-2.5/}.
We discretize space with cell-centered finite volume methods (\ref{cc} ), the box method (\ref{box})
or a staggered grid scheme.
or a staggered grid scheme (\ref{staggered}).
Grid adaption is available for both box and cell-centered finite volume method.
In general, the spatial parameters, especially the porosity, have to be assigned on
the coarsest level of discretization.
%
\subsection{Cell Centered Finite Volume Methods -- A Short Introduction}\label{cc}
Cell-centered finite volume methods use the elements of the grid as control volumes.
For each control volume the discrete values are determined at the element/control
volume center (not required to be the barycenters).
We consider a domain $\Omega\subset\mathbb{R}^d$, $d \in\{2, 3\}$ with boundary $\Gamma=\partial\Omega$. Within this section, we consider the following elliptic problem
\begin{equation}
\begin{aligned}
\nabla\cdot\left( - \mathbf{\Lambda}\nabla u \right) &= q &&\mathrm{in}\,\Omega\\
\left( - \mathbf{\Lambda}\nabla u \right) \cdot\mathbf{n}&= v_N &&\mathrm{on}\,\Gamma_N \\
u &= u_D &&\mathrm{on}\,\Gamma_D.
\label{eq:elliptic}
\end{aligned}
\end{equation}
Here, $\mathbf{\Lambda}=\mathbf{\Lambda}(\mathbf{x}, \mathbf{u})$ is a symmetric and positive definite tensor of second rank (e.g. permeability, diffusivity, etc.), $u = u (\mathbf{x})$ is unknown and $q = q(\mathbf{x}, \mathbf{u})$ is a source/sink.
We denote by $\mathcal{M}$ the mesh that results from the division of the domain $\Omega$ into $n_e$ control volumes $K \subset\Omega$. Each $K$ is a polygonal open set such that $K \cap L =\emptyset, \forall{K \neq L}$ and $\overline{\Omega}=\cup_{K \in\mathcal{M}}\overline{K}$.
For the derivation of the finite-volume formulation we integrate the first equation of \eqref{eq:elliptic} over a control volume $K$ and apply the Gauss divergence theorem:
Splitting the control volume boundary $\partial K$ into a finite number of faces $\sigma\subset\partial K$ (such that $\sigma=\overline{K}\cap\overline{L}$ for some neighboring control volume $L$) and replacing the exact fluxes by an approximation, i.e. $F_{K, \sigma}\approx\int_{\sigma}\left(-\mathbf{\Lambda}_K \nabla u \right)\cdot\mathbf{n}\mathrm{d}\Gamma$ (here $\mathbf{\Lambda}_K$ is the value of $\mathbf{\Lambda}$ associated with control volume $K$), yield
where $F_{K, \sigma}$ is the discrete flux through face $\sigma$ flowing out of cell $K$ and $Q_K :=\int_K q \,\mathrm{d}x$ is the integrated source/sink term. Equation \eqref{eq:ccdisc} is the typical cell-centered finite-volume formulation.
Finite-volume schemes differ in the way how the term
$(\mathbf{\Lambda}_K \nabla u )\cdot\mathbf{n}$ is approximated (i.e. the choice of the fluxes $F_{K, \sigma}$). Using the symmetry of the tensor $\mathbf{\Lambda}_K$, this term can be rewritten as
$\nabla u \cdot\mathbf{\Lambda}_K\mathbf{n}$, which corresponds to the directional derivative of $u$ in co-normal direction $\mathbf{\Lambda}_K\mathbf{n}$.
In the following, the main ideas of the two-point flux approximation and the multi-point flux approximation methods are briefly described. Hereby, we restrict the discussion to the two-dimensional case.
Please also note that other types of equations, e.g. instationary parabolic problems, can be discretized by applying some time discretization scheme to the time derivatives and by using the finite-volume scheme for the flux discretization. For simplicity the discussion is restricted to the elliptic problem \eqref{eq:elliptic}.
\subsubsection{Tpfa Method}\label{cc_tpfa}
The linear two-point flux approximation is a simple but robust cell-centered finite-volume scheme, which is commonly used in commercial software.
This scheme can be derived by using the co-normal decomposition, which reads
with the tensor $\mathbf{\Lambda}_K$ associated with control volume $K$, the distance vector $\mathbf{d}_{K,\sigma} :=\mathbf{x}_\sigma-\mathbf{x}_K$ and $\mathbf{d}_{K,\sigma}^T \mathbf{d}^{\bot}_{K,\sigma}=0$, see Figure \ref{pc:cctpfa} for the used notations. The same can be done for the conormal $\mathbf{\Lambda}_L \mathbf{n}_{L, \sigma}$. The $t_{K,\sigma}$ and $t_{L,\sigma}$ are the transmissibilities associated with the face $\sigma$. These transmissibilities are calculated in \Dumux by using the function \texttt{computeTpfaTransmissibility}.
\caption{Two neighboring control volumes sharing the face $\sigma$.}
\label{pc:cctpfa}
\end{figure}
With these notations, it follows that for each cell $K$ and face $\sigma$
\begin{equation}
\nabla u \cdot\mathbf{\Lambda}_K \mathbf{n}_{K, \sigma} = t_{K,\sigma}\nabla u \cdot\mathbf{d}_{K,\sigma} + \nabla u \cdot\mathbf{d}^{\bot}_{K,\sigma}.
\end{equation}
For the Tpfa scheme, the second part in the above equation is neglected. By using the fact that $\nabla u \cdot\mathbf{d}_{K,\sigma}\approx u_\sigma- u_K$, the discrete fluxes for face $\sigma$ are given by
By neglecting the orthogonal term, the consistency of the scheme is lost for general grids, where $\nabla u \cdot\mathbf{d}^{\bot}_{K,\sigma}\not=0$. The consistency is achieved only for so-called K-orthogonal grids for which $\mathbf{d}^{\bot}_{K,\sigma}=0$. For such grids we deduce that
with $\tau_{K,\sigma} :=\mathbf{n}_{K, \sigma}\mathbf{\Lambda}_K\mathbf{n}_{K, \sigma}, \tau_{L,\sigma} :=\mathbf{n}_{L, \sigma}\mathbf{\Lambda}_L\mathbf{n}_{L, \sigma}$, $d_{K,\sigma}:=\mathbf{n}_{K, \sigma}\cdot\mathbf{d}_{K, \sigma}$, and $d_{L,\sigma}:=\mathbf{n}_{L, \sigma}\cdot\mathbf{d}_{L, \sigma}$. This reduces, for the case of scalar permeability, to a distance weighted harmonic averaging of permeabilities.
\subsubsection{Mpfa Method}\label{cc_mpfa}
Expressions for the face fluxes $F_{K, \sigma}$ are obtained by introducing intermediate face unknowns $u_\sigma$ in addition to the cell unknowns $u_K$ and enforcing the physically motivated continuity of fluxes and continuity of the solution across the faces. For a face $\sigma$ between the two polygons $K$ and $L$ these conditions read:
\begin{equation}
\begin{aligned}
&F_{K, \sigma} + F_{L, \sigma} = 0 \\
&{u}_{K,\sigma} = {u}_{L,\sigma} = {u}_{\sigma}.
\label{eq:sigmaConditions}
\end{aligned}
\end{equation}
Using these conditions, the intermediate face unknowns ${u}_\sigma$ can be eliminated and the fluxes are expressed as a function of the cell unknowns $u_N$ and associated transmissibilities $t^N_{K,\sigma}$:
\caption{Interaction region for the Mpfa-O method. The graphic on the right illustrates how the sub-control volume $L^v$ and face $\sigma^v_2$ are embedded in cell $L$. Note that the face stencils for all sub-control volume faces in the depicted interaction region are $\mathcal{S}_{\sigma^v_i}=\{ K,L,M \}$, meaning that the fluxes over the sub-control volume faces depend on the three cell unknowns $u_K, u_L, u_M$.}
\label{pc:interactionRegion_mpfa}
\end{figure}
The main difference between the various finite-volume schemes available is the assembly of the face fluxes, i.e. the computation of the $t^N_{K,\sigma}$ and the size of $\mathcal{S}_{K,\sigma}$. For the Tpfa, that has been presented in the last section, the stencil and transmissibilities are given as
with $t_{K,\sigma},t_{L,\sigma}$ as defined in equation \eqref{eq:conormalDecTpfa}.
In the following, a multi-point flux approximation method (Mpfa-O method), which was introduced in \citet{A3:aavatsmark:2002}, is presented. The main difference to the Tpfa scheme is the fact that a consistent discrete gradient is constructed, i.e. the term $\nabla u \cdot\mathbf{d}^{\bot}_{K,\sigma}$ is not neglected.
For this scheme, a dual grid is created by connecting the barycenters of the cells with the barycenters of the faces ($d=2$) or the barycenters of the faces and edges ($d=3$). This divides each cell into sub-control volumes $K^v$. Analogously, each face is sub-divided into sub-control volume faces $\sigma^v$, see Figure \ref{pc:interactionRegion_mpfa}. We allow for piecewise constant $\mathbf{\Lambda}$ (denoted as $\mathbf{\Lambda}_K$ for each cell $K$) and construct discrete gradients $\nabla_\mathcal{D}^{K^v} u$ (per sub-control volume $K^v$).
In the following, we restrict our discussion to the two-dimensional setup that is shown in Figure \ref{pc:interactionRegion_mpfa}.
Here, the discrete gradients are constructed to be consistent such that the following conditions hold:
\begin{equation}
\nabla_\mathcal{D}^{K^v} u \cdot (\mathbf{x}_{\sigma^v_1}- \mathbf{x}_{K}) = u_{\sigma^v_1} - u_K, \quad\nabla_\mathcal{D}^{K^v} u \cdot (\mathbf{x}_{\sigma^v_3}- \mathbf{x}_{K}) = u_{\sigma^v_3} - u_K.
\end{equation}
Thus, a discrete gradient (for sub-control volume $K^v$) that fulfills these conditions is given as
\begin{equation}
\nabla_\mathcal{D}^{K^v} u = \mathbb{D}^{-T}_{K^v}
\begin{bmatrix}
u_{\sigma^v_1} - u_K \\
u_{\sigma^v_3} - u_K
\end{bmatrix}, \qquad\text{ with }\;\mathbb{D}_{K^v} :=