|
|
|
|
@@ -27,9 +27,9 @@ The problem which is solved in this tutorial is illustrated in figure \ref{tutor
|
|
|
|
|
\caption{Geometry of the tutorial problem with initial and boundary conditions.}\label{tutorial-decoupled:problemfigure}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
Listing \ref{tutorial-deoucpled:mainfile} shows how the main file, which has to be executed, has to be set up, if the problem described above is to be solved using a decoupled model. This main file can be found in the directory \texttt{/dune-mux/tutorial}.
|
|
|
|
|
Listing \ref{tutorial-deoucpled:mainfile} shows how the main file, which has to be executed, has to be set up, if the problem described above is to be solved using a decoupled model. This main file can be found in the directory \texttt{/tutorial}.
|
|
|
|
|
|
|
|
|
|
\begin{lst}[File dune-mux/tutorial/tutorial\_decoupled.cc]\label{tutorial-deoucpled:mainfile} \mbox{}
|
|
|
|
|
\begin{lst}[File tutorial/tutorial\_decoupled.cc]\label{tutorial-deoucpled:mainfile} \mbox{}
|
|
|
|
|
\lstinputlisting[basicstyle=\ttfamily\scriptsize,numbers=left,
|
|
|
|
|
numberstyle=\tiny, numbersep=5pt]{../../tutorial/tutorial_decoupled.cc}
|
|
|
|
|
\end{lst}
|
|
|
|
|
@@ -38,23 +38,44 @@ First, in line \ref{tutorial-decoupled:include-begin} to \ref{tutorial-decoupled
|
|
|
|
|
|
|
|
|
|
In line \ref{tutorial-decoupled:grid-begin} to \ref{tutorial-decoupled:grid-end} the geometry is defined and the grid is generated. The three variables of Type \texttt{Dune::FieldVector} define the lower left corner of the domain (\texttt{L}), the upper right corner of the domain (\texttt{H}) and the number of cells in $x$ and $y$ direction (\texttt{N}), where the dimensions are previously defined in line \ref{tutorial-decoupled:dim}. The grid of type \texttt{Dune::SGrid} is then generated in line \ref{tutorial-decoupled:grid-end}. For more information about the dune grid interface, the different grid types that are supported and the generation of different grids it is referred to the \textit{Dune Grid Interface HOWTO} \cite{DUNE-HP}.
|
|
|
|
|
|
|
|
|
|
The second point mentioned at the beginning of this section was the definition of material properties and constitutive relationships. The fluid properties of the two fluid phases considered here are defined in lines \ref{tutorial-decoupled:water} and \ref{tutorial-decoupled:oil}. The fluid classes including different kinds of fluids (here: \texttt{Dune::Water} and \texttt{Dune::LowViscosityOil}) can be found in the folder \texttt{material/fluids} in the directory \texttt{/dune-mux/dumux}-\texttt{/material/fluids}. The properties of the solid matrix are defined in a special soil class. The \texttt{soil} object is generated in line \ref{tutorial-decoupled:soil}. As can be seen, the class type is \texttt{Dune::TutorialSoil}, which is defined in the file \texttt{tutorial\_soilproperties\_decoupled.hh} in the folder \texttt{/tutorial}. A description of this file and the definition of a soil class including the soil parameters can be found in section \ref{tutorial-decoupled:description-soil-class}. Finally, in line \ref{tutorial-decoupled:twophaserelations} the information included in the fluid and soil objects is used to generate an object of type \texttt{Dune::TwoPhaseRelations}, which includes the constitutive relationships (capillary pressure-saturation relation, relative permeability-saturation relation, etc.). The file \texttt{twophaserelations.hh} can be found in the directory \texttt{/dune-mux/dumux/material}.
|
|
|
|
|
The second point mentioned at the beginning of this section was the
|
|
|
|
|
definition of material properties and constitutive relationships. The
|
|
|
|
|
fluid properties of the two fluid phases considered here are defined
|
|
|
|
|
in lines \ref{tutorial-decoupled:water} and
|
|
|
|
|
\ref{tutorial-decoupled:oil}. The fluid classes including different
|
|
|
|
|
kinds of fluids (here: \texttt{Dune::Water} and \texttt{Dune::LowViscosityOil})
|
|
|
|
|
can be found in the folder \texttt{/dumux/material/fluids}. The
|
|
|
|
|
properties of the solid matrix are defined in a special soil
|
|
|
|
|
class. The \texttt{soil} object is generated in line
|
|
|
|
|
\ref{tutorial-decoupled:soil}. As can be seen, the class type is
|
|
|
|
|
\texttt{Dune::TutorialSoil}, which is defined in the file
|
|
|
|
|
\texttt{tutorial\_soilproperties\_decoupled.hh} in the folder
|
|
|
|
|
\texttt{/tutorial}. A description of this file and the definition of a
|
|
|
|
|
soil class including the soil parameters can be found in section
|
|
|
|
|
\ref{tutorial-decoupled:description-soil-class}. Finally, in line
|
|
|
|
|
\ref{tutorial-decoupled:twophaserelations} the information included in
|
|
|
|
|
the fluid and soil objects is used to generate an object of type
|
|
|
|
|
\texttt{Dune::TwoPhaseRelations}, which includes the constitutive
|
|
|
|
|
relationships (capillary pressure-saturation relation, relative
|
|
|
|
|
permeability-saturation relation, etc.). The file
|
|
|
|
|
\texttt{twophaserelations.hh} can be found in the directory
|
|
|
|
|
\texttt{/dumux/material}.
|
|
|
|
|
|
|
|
|
|
The definition of boundary and initial conditions as well as source of sink terms is done by definition of a so-called \textit{problem} class. In case of this tutorial the problem class is defined in the file \texttt{tutorialproblem\_decoupled.hh} in the \texttt{/tutorial} folder. In the main file the problem object of type \texttt{Dune::TutorialProblemDecoupled} is then generated in line \ref{tutorial-decoupled:problem}. A further explanation of the definition of boundary and initial conditions, source and sink terms and the structure of the problem class can be found in section \ref{tutorial-decoupled:description-bc-ic}. Besides the definition of the boundary and initial conditions the problem class is also a kind of interface containing all the objects generated before (geometry, fluids, soil, constitutive relationships, etc.). Thus, as can be seen in line \ref{tutorial-decoupled:problem} all this objects are given as arguments when calling the constructor of the problem class.
|
|
|
|
|
|
|
|
|
|
Following the steps listed at the beginning of this section, finally, a model has to be chosen. In case of this tutorial a decoupled isothermal two phase model is the choice. As explained before a decoupled model consists of a pressure equation which is decoupled or only weakly coupled to a saturation equation, concentration equations, energy balance equations, etc. In case of isothermal two phase flow one pressure equation and one saturation equation have to be solved.
|
|
|
|
|
|
|
|
|
|
The discretisation of the pressure equation is included in the object which is generated in line \ref{tutorial-decoupled:diffusion} of the main file. It is called \texttt{diffusion} and it is of type \texttt{Dune::FVTotalVelocity2P}. The definition of this class can be found in \texttt{/dune-mux/dumux/diffusion/fv} in the file \texttt{fvtotalvelocity2p.hh}. The \texttt{FV} in the class name indicates that a \textit{finite volume} discretisation is used. For the pressure equation also other discretisation methods like \textit{finite elements} or \textit{mimetic finite differences} are available.
|
|
|
|
|
The discretisation of the pressure equation is included in the object which is generated in line \ref{tutorial-decoupled:diffusion} of the main file. It is called \texttt{diffusion} and it is of type \texttt{Dune::FVTotalVelocity2P}. The definition of this class can be found in \texttt{/dumux/diffusion/fv} in the file \texttt{fvtotalvelocity2p.hh}. The \texttt{FV} in the class name indicates that a \textit{finite volume} discretisation is used. For the pressure equation also other discretisation methods like \textit{finite elements} or \textit{mimetic finite differences} are available.
|
|
|
|
|
|
|
|
|
|
Similarly, an object containing the discretisation of the saturation equation is generated in line \ref{tutorial-decoupled:transport} of the main file. As can be seen, this object is called \texttt{transport}. The class \texttt{Dune::FVSaturationWetting2P} can be found in the directory \texttt{/dune-mux/dumux/transport/fv}. Again, the \texttt{FV} in the class name indicates a \textit{finite volume} discretisation.
|
|
|
|
|
Similarly, an object containing the discretisation of the saturation equation is generated in line \ref{tutorial-decoupled:transport} of the main file. As can be seen, this object is called \texttt{transport}. The class \texttt{Dune::FVSaturationWetting2P} can be found in the directory \texttt{/dumux/transport/fv}. Again, the \texttt{FV} in the class name indicates a \textit{finite volume} discretisation.
|
|
|
|
|
|
|
|
|
|
For the decoupled model the so-called \textit{IMPES} (\textit{IM}plicit \textit{P}ressure \textit{E}xplicit \textit{S}aturation) algorithm is used. This means that the pressure equation is first solved using an implicit method. The resulting velocities are then used to solve the saturation equation explicitly. It is clear that depending on the non-linearity this is an iterative process within every timestep. The object \texttt{impes} of type \texttt{Dune::IMPES} which is generated in line \ref{tutorial-decoupled:impes} of the main file combines the objects \texttt{diffusion} and \texttt{transport} and proceeds the iterations of the IMPES algorithm within a timestep. The definition of the class \texttt{Dune::IMPES} can be found in the file \texttt{impes.hh} in the directory \texttt{/dune-mux/dumux/fractionalflow/impes}.
|
|
|
|
|
For the decoupled model the so-called \textit{IMPES} (\textit{IM}plicit \textit{P}ressure \textit{E}xplicit \textit{S}aturation) algorithm is used. This means that the pressure equation is first solved using an implicit method. The resulting velocities are then used to solve the saturation equation explicitly. It is clear that depending on the non-linearity this is an iterative process within every timestep. The object \texttt{impes} of type \texttt{Dune::IMPES} which is generated in line \ref{tutorial-decoupled:impes} of the main file combines the objects \texttt{diffusion} and \texttt{transport} and proceeds the iterations of the IMPES algorithm within a timestep. The definition of the class \texttt{Dune::IMPES} can be found in the file \texttt{impes.hh} in the directory \texttt{/dumux/fractionalflow/impes}.
|
|
|
|
|
|
|
|
|
|
Finally, an object called \texttt{timeloop} of type \texttt{Dune::TimeLoop} is generated in line \ref{tutorial-decoupled:timeloop} of the tutorial main file. The class \texttt{Dune::TimeLoop} is defined in the file \texttt{timeloop.hh} in the folder \texttt{/dune-mux/dumux/timedisc}. The object \texttt{timeloop} includes the type of timestep that is used (implicit, explicit, etc.) and contains the function \texttt{execute} which is called in line \ref{tutorial-decoupled:execute} of the main file. This function finally starts the computation and runs the (time)loop over all timesteps.
|
|
|
|
|
Finally, an object called \texttt{timeloop} of type \texttt{Dune::TimeLoop} is generated in line \ref{tutorial-decoupled:timeloop} of the tutorial main file. The class \texttt{Dune::TimeLoop} is defined in the file \texttt{timeloop.hh} in the folder \texttt{/dumux/timedisc}. The object \texttt{timeloop} includes the type of timestep that is used (implicit, explicit, etc.) and contains the function \texttt{execute} which is called in line \ref{tutorial-decoupled:execute} of the main file. This function finally starts the computation and runs the (time)loop over all timesteps.
|
|
|
|
|
|
|
|
|
|
\subsection{The definition of the fluid properties}\label{tutorial-decoupled:description-fluid-class}
|
|
|
|
|
|
|
|
|
|
In \Dumux different fluids are already implemented. The definitions can be found in the directory \texttt{material/fluids}. As can be observed in these files, for each fluid a class named like the fluid is defined. These classes are derived from the fluid base class \texttt{Fluid} which is defined in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dune-mux/dumux/material} and include several functions returning different fluid properties.
|
|
|
|
|
In \Dumux different fluids are already implemented. The definitions can be found in the directory \texttt{material/fluids}. As can be observed in these files, for each fluid a class named like the fluid is defined. These classes are derived from the fluid base class \texttt{Fluid} which is defined in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dumux/material} and include several functions returning different fluid properties.
|
|
|
|
|
|
|
|
|
|
If a new fluid type is to be used or an existing type is to be used with different fluid parameters new fluid types can be defined derived from the base class \texttt{Fluid} comparable to the fluids already defined in the file \texttt{material/fluids/}.
|
|
|
|
|
|
|
|
|
|
@@ -64,13 +85,13 @@ It is important to mention, that existing fluid classes should not be changed.
|
|
|
|
|
|
|
|
|
|
Soil properties which can be defined in \Dumux are the \textit{intrinsic permeability}, the \textit{porosity} and the \textit{heat capacity} as well as the \textit{heat conductivity} of the solid matrix. Further the \textit{residual saturations} of the fluids, and the \textit{capillary pressures-saturation function} as well as the \textit{relative permeability-saturation functions} are depending on the soil.
|
|
|
|
|
|
|
|
|
|
The base class \texttt{Dune::Matrix2p} for the definition of the soil parameters can be found in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dune-mux/dumux/material}. Derived from this base class, there exist two standard soil type classes named \texttt{HomogeneousSoil} and \texttt{HeterogeneousSoil}. Both can be found in the file \texttt{matrixproperties.hh} in the \texttt{/material} folder. If one wants to use a soil that differs from this standard soil types, new soil classes can be derived either from the base class (\texttt{Dune::Matrix2p}) or from the two standard soil classes (\texttt{Dune::HomogeneousSoil} and \texttt{Dune::HeterogeneousSoil}).
|
|
|
|
|
The base class \texttt{Dune::Matrix2p} for the definition of the soil parameters can be found in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dumux/material}. Derived from this base class, there exist two standard soil type classes named \texttt{HomogeneousSoil} and \texttt{HeterogeneousSoil}. Both can be found in the file \texttt{matrixproperties.hh} in the \texttt{/material} folder. If one wants to use a soil that differs from this standard soil types, new soil classes can be derived either from the base class (\texttt{Dune::Matrix2p}) or from the two standard soil classes (\texttt{Dune::HomogeneousSoil} and \texttt{Dune::HeterogeneousSoil}).
|
|
|
|
|
|
|
|
|
|
For this tutorial problem a new soil class named \texttt{TutorialSoil} is derived from \texttt{Dune::HomogeneousSoil} (listing \ref{tutorial-deoucpled:soilpropertiesfile}, line \ref{tutorial-decoupled:tutorialsoil}), which can be found in the file \texttt{tutorial\_soilproperties\_decoupled.hh} in the directory \texttt{/tutorial}.
|
|
|
|
|
For this tutorial problem a new soil class named \texttt{TutorialSoil} is derived from \texttt{Dune::Matrix2p} (listing \ref{tutorial-deoucpled:soilpropertiesfile}, line \ref{tutorial-decoupled:tutorialsoil}), which can be found in the file \texttt{tutorial\_soilproperties\_decoupled.hh} in the directory \texttt{/tutorial}.
|
|
|
|
|
|
|
|
|
|
Listing \ref{tutorial-deoucpled:soilpropertiesfile} shows the file \texttt{tutorial\_soilproperties\_decoupled.hh}.
|
|
|
|
|
|
|
|
|
|
\begin{lst}[File dune-mux/tutorial/tutorial\_soilproperties\_decoupled.hh]\label{tutorial-deoucpled:soilpropertiesfile} \mbox{}
|
|
|
|
|
\begin{lst}[File tutorial/tutorial\_soilproperties\_decoupled.hh]\label{tutorial-deoucpled:soilpropertiesfile} \mbox{}
|
|
|
|
|
\lstinputlisting[basicstyle=\ttfamily\scriptsize,numbers=left,
|
|
|
|
|
numberstyle=\tiny, numbersep=5pt]{../../tutorial/tutorial_soilproperties_decoupled.hh}
|
|
|
|
|
\end{lst}
|
|
|
|
|
@@ -85,9 +106,9 @@ Finally, the functions defining the type of the capillary pressure function and
|
|
|
|
|
|
|
|
|
|
\subsection{The definition of boundary and initial conditions and source or sink terms}\label{tutorial-decoupled:description-bc-ic}
|
|
|
|
|
|
|
|
|
|
Boundary and initial conditions are defined in a so-called problem class. The problem class of this tutorial has the name \texttt{TutorialProblemDecoupled} and is defined in the file \texttt{tutorialproblem\_decoupled.hh} which can be found in the directory \texttt{/tutorial}. Listing \ref{tutorial-deoucpled:problemfile} shows the class \texttt{TutorialProblemDecoupled}. As can be seen it is derived from the problem base class \texttt{FractionalFlowProblem} (line \ref{tutorial-decoupled:tutorialproblem}) which is defined in the file \texttt{fractionalflowproblem.hh} in the directory \texttt{/dune-mux/dumux/fractionalflow}.
|
|
|
|
|
Boundary and initial conditions are defined in a so-called problem class. The problem class of this tutorial has the name \texttt{TutorialProblemDecoupled} and is defined in the file \texttt{tutorialproblem\_decoupled.hh} which can be found in the directory \texttt{/tutorial}. Listing \ref{tutorial-deoucpled:problemfile} shows the class \texttt{TutorialProblemDecoupled}. As can be seen it is derived from the problem base class \texttt{FractionalFlowProblem} (line \ref{tutorial-decoupled:tutorialproblem}) which is defined in the file \texttt{fractionalflowproblem.hh} in the directory \texttt{/dumux/fractionalflow}.
|
|
|
|
|
|
|
|
|
|
\begin{lst}[File dune-mux/tutorial/tutorialproblem\_decoupled.hh]\label{tutorial-deoucpled:problemfile} \mbox{}
|
|
|
|
|
\begin{lst}[File tutorial/tutorialproblem\_decoupled.hh]\label{tutorial-deoucpled:problemfile} \mbox{}
|
|
|
|
|
\lstinputlisting[basicstyle=\ttfamily\scriptsize,numbers=left,
|
|
|
|
|
numberstyle=\tiny, numbersep=5pt]{../../tutorial/tutorialproblem_decoupled.hh}
|
|
|
|
|
\end{lst}
|
|
|
|
|
@@ -114,7 +135,7 @@ Finally, the function \texttt{initSat} is defined in line \ref{tutorial-decouple
|
|
|
|
|
|
|
|
|
|
\subsection{Exercise}
|
|
|
|
|
\label{tutorial-deoucpled:exercises}
|
|
|
|
|
The following exercises will give you the opportunity to learn how you can change soil parameters, boundary conditions and fluid properties in \Dumux. (In the future you will find the output file of the last timestep of each exercise simulation in the directory \texttt{/dune-mux/dumux/tutorial/results/decoupled}.)
|
|
|
|
|
The following exercises will give you the opportunity to learn how you can change soil parameters, boundary conditions and fluid properties in \Dumux. (In the future you will find the output file of the last timestep of each exercise simulation in the directory \texttt{/dumux/tutorial/results/decoupled}.)
|
|
|
|
|
|
|
|
|
|
\subsubsection{Exercise 1}
|
|
|
|
|
\renewcommand{\labelenumi}{\alph{enumi})}
|
|
|
|
|
@@ -129,11 +150,11 @@ Compile the main file by typing \texttt{make tutorial\_decoupled} and run the mo
|
|
|
|
|
|
|
|
|
|
\item \textbf{Changing Fluids} \\
|
|
|
|
|
Now you can change the fluids. Use DNAPL instead of Oil and Brine instead of Water. To do that you have to change the file \texttt{tutorial\_decoupled.cc}. If you want to take a closer look how the fluid classes are defined and which fluids are already available please open the files \texttt{oil.hh} and \texttt{water.hh} in the directory
|
|
|
|
|
\texttt{/dune-mux/dumux/material/fluids}.
|
|
|
|
|
\texttt{/dumux/material/fluids}.
|
|
|
|
|
|
|
|
|
|
\item \textbf{Changing Constitutive Relationships} \\
|
|
|
|
|
Use a Brooks-Corey law with $\lambda$ = 2 and entry pressure $p_b = 0.0$ instead of a linear law for the relative-permeability/saturation relationship. To do that you have to change the file \texttt{tutorial\_soilproperties\_decoupled.hh}. You can find the flag that you have to set for the Brooks-Corey law in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dune-mux/dumux/material}.
|
|
|
|
|
The available relative permeability and capillary pressure functions are defined in the file \texttt{/dune-mux/dumux/material/relperm\_pc\_law}.\\
|
|
|
|
|
Use a Brooks-Corey law with $\lambda$ = 2 and entry pressure $p_b = 0.0$ instead of a linear law for the relative-permeability/saturation relationship. To do that you have to change the file \texttt{tutorial\_soilproperties\_decoupled.hh}. You can find the flag that you have to set for the Brooks-Corey law in the file \texttt{property\_baseclasses.hh} in the directory \texttt{/dumux/material}.
|
|
|
|
|
The available relative permeability and capillary pressure functions are defined in the file \texttt{/dumux/material/relperm\_pc\_law}.\\
|
|
|
|
|
(Hint: The CFL-security-factor should be set to a value smaller than 1 if nonlinear relationships are used (Suggestion: 0.95). It can be found in the application file \texttt{tutorialproblem\_decoupled.hh}.)
|
|
|
|
|
|
|
|
|
|
\item \textbf{Heterogeneities} \\
|
|
|
|
|
@@ -192,7 +213,7 @@ Now, set up a model that describes the processes given in the Figures \ref{tutor
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\subsubsection{Exercise 3}
|
|
|
|
|
Create a file called \texttt{new\_fluid.hh} and implement a new fluid class. This new fluid class should be derived from the base class Fluid which can be found in \texttt{/dune-mux/dumux/material/property\_baseclasses.hh}. \\
|
|
|
|
|
(You can look at existing fluid classes in the file \texttt{/dune-mux/dumux/material/fluids/}.)
|
|
|
|
|
Create a file called \texttt{new\_fluid.hh} and implement a new fluid class. This new fluid class should be derived from the base class Fluid which can be found in \texttt{/dumux/material/property\_baseclasses.hh}. \\
|
|
|
|
|
(You can look at existing fluid classes in the folder \texttt{/dumux/material/fluids}.)
|
|
|
|
|
Use benzene as a new fluid and run the model of Exercise 2 with water and benzene. The properties of benzene are given in the following: \\
|
|
|
|
|
density: 889.51 kg/$\text{m}^3$, viscosity: 0.00112 Pa s.
|
|
|
|
|
|