Skip to content
Snippets Groups Projects
Commit 3e321ce9 authored by Alexander Kissinger's avatar Alexander Kissinger
Browse files

Worked over tutorial coupled section

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9017 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 2f916603
No related branches found
No related tags found
No related merge requests found
...@@ -175,6 +175,7 @@ Universit\"at Stuttgart, Paffenwaldring 61, D-70569 Stuttgart, Germany}\\ ...@@ -175,6 +175,7 @@ Universit\"at Stuttgart, Paffenwaldring 61, D-70569 Stuttgart, Germany}\\
\input{TipsNTricks} \input{TipsNTricks}
\input{install} \input{install}
\bibliographystyle{plain} \bibliographystyle{plain}
\bibliography{dumux-handbook} \bibliography{dumux-handbook}
\printindex \printindex
......
...@@ -57,7 +57,7 @@ model. This file has to be compiled and executed in order to solve the problem d ...@@ -57,7 +57,7 @@ model. This file has to be compiled and executed in order to solve the problem d
above. above.
\begin{lst}[File tutorial/tutorial\_coupled.cc]\label{tutorial-coupled:mainfile} \mbox{} \begin{lst}[File tutorial/tutorial\_coupled.cc]\label{tutorial-coupled:mainfile} \mbox{}
\lstinputlisting[style=DumuxCode, numbersep=5pt, firstline=29]{../../tutorial/tutorial_coupled.cc} \lstinputlisting[style=DumuxCode, numbersep=5pt, firstline=24]{../../tutorial/tutorial_coupled.cc}
\end{lst} \end{lst}
From line \ref{tutorial-coupled:include-begin} to line From line \ref{tutorial-coupled:include-begin} to line
...@@ -78,7 +78,7 @@ Required parameters for the start of the simulation, ...@@ -78,7 +78,7 @@ Required parameters for the start of the simulation,
such as the initial time-step size, the simulation time or details of the grid, such as the initial time-step size, the simulation time or details of the grid,
can be either specified by command line arguments of the form can be either specified by command line arguments of the form
(\texttt{-ParameterName ParameterValue}), in the file specified by the (\texttt{-ParameterName ParameterValue}), in the file specified by the
\texttt{-parameterFile} argument, or if the latter is not specified, \texttt{-ParameterFile} argument, or if the latter is not specified,
in the file \mbox{\texttt{tutorial\_coupled.input}}. in the file \mbox{\texttt{tutorial\_coupled.input}}.
If a parameter is If a parameter is
specified on the command line as well as in the parameter file, the specified on the command line as well as in the parameter file, the
...@@ -106,7 +106,7 @@ so-called \textit{problem file} as shown in ...@@ -106,7 +106,7 @@ so-called \textit{problem file} as shown in
listing~\ref{tutorial-coupled:problemfile}. listing~\ref{tutorial-coupled:problemfile}.
\begin{lst}[File tutorial/tutorialproblem\_coupled.hh]\label{tutorial-coupled:problemfile} \mbox{} \begin{lst}[File tutorial/tutorialproblem\_coupled.hh]\label{tutorial-coupled:problemfile} \mbox{}
\lstinputlisting[style=DumuxCode, numbersep=5pt, firstline=28]{../../tutorial/tutorialproblem_coupled.hh} \lstinputlisting[style=DumuxCode, numbersep=5pt, firstline=19]{../../tutorial/tutorialproblem_coupled.hh}
\end{lst} \end{lst}
First, a new type tag is created for the problem in line First, a new type tag is created for the problem in line
...@@ -198,7 +198,7 @@ Methods which make statements about boundary segments of the grid ...@@ -198,7 +198,7 @@ Methods which make statements about boundary segments of the grid
over the boundary segment are specified. over the boundary segment are specified.
\item[element:] The element of the grid where the boundary segment \item[element:] The element of the grid where the boundary segment
is located. is located.
\item[fvElemGeometry:] The finite-volume geometry induced on the \item[fvElementGeometry:] The finite-volume geometry induced on the
finite element by the box scheme. finite element by the box scheme.
\item[isIt:] The \texttt{Intersection} of the boundary segment as given by the grid. \item[isIt:] The \texttt{Intersection} of the boundary segment as given by the grid.
\item[scvIdx:] The index of the sub-control volume in \item[scvIdx:] The index of the sub-control volume in
...@@ -209,7 +209,7 @@ Methods which make statements about boundary segments of the grid ...@@ -209,7 +209,7 @@ Methods which make statements about boundary segments of the grid
Similarly, the \texttt{initial()} and \texttt{source()} methods Similarly, the \texttt{initial()} and \texttt{source()} methods
specify properties of control volumes and thus only get specify properties of control volumes and thus only get
\texttt{values}, \texttt{element}, \texttt{fvElemGeom} and \texttt{values}, \texttt{element}, \texttt{fvGeomtry} and
\texttt{scvIdx} as arguments. \texttt{scvIdx} as arguments.
In addition to these five methods, there might be some model-specific In addition to these five methods, there might be some model-specific
...@@ -299,7 +299,7 @@ to be called with three arguments: ...@@ -299,7 +299,7 @@ to be called with three arguments:
parameter describes the considered element by means of a \Dune parameter describes the considered element by means of a \Dune
entity. Elements provide information about their geometry and entity. Elements provide information about their geometry and
position and can be mapped to a global index. position and can be mapped to a global index.
\item[\texttt{fvElemGeom}:] It holds information about the finite-volume \item[\texttt{fvElementGeomtry}:] It holds information about the finite-volume
geometry of the element induced by the box method. geometry of the element induced by the box method.
\item[\texttt{scvIdx}:] This is the index of the sub-control volume of the \item[\texttt{scvIdx}:] This is the index of the sub-control volume of the
element which is considered. It is equivalent to the local index element which is considered. It is equivalent to the local index
...@@ -337,7 +337,9 @@ the material description can be found in ...@@ -337,7 +337,9 @@ the material description can be found in
\label{tutorial-coupled:exercises} \label{tutorial-coupled:exercises}
The following exercises will give you the opportunity to learn how you The following exercises will give you the opportunity to learn how you
can change soil parameters, boundary conditions, run-time parameters can change soil parameters, boundary conditions, run-time parameters
and fluid properties in \Dumux. and fluid properties in \Dumux. Possible solutions to these exercises are given in the tutorial folder in the
sub-folder \texttt{solutions\_coupled} as \texttt{.diff} files. In these files only the lines that are different from the original file are listed.
They can be opened with any editor.
\subsubsection{Exercise 1} \subsubsection{Exercise 1}
\renewcommand{\labelenumi}{\alph{enumi})} For Exercise 1 you have \renewcommand{\labelenumi}{\alph{enumi})} For Exercise 1 you have
...@@ -346,49 +348,79 @@ to make only some small changes in the tutorial files. ...@@ -346,49 +348,79 @@ to make only some small changes in the tutorial files.
\begin{enumerate} \begin{enumerate}
\item \textbf{Running the Program} \\ \item \textbf{Running the Program} \\
To get an impression what the results should look like you can first run the original version of the coupled tutorial model by typing \texttt{./tutorial\_coupled}. Note, that the time-step size is automatically adapted during the simulation. For the visualization of the results using paraview please refer to section \ref{quick-start-guide}. To get an impression what the results should look like you can first run the original version of
the coupled tutorial model by typing \texttt{./tutorial\_coupled}.
Note, that the time-step size is automatically adapted during the simulation.
For the visualization of the results using paraview please refer to section \ref{quick-start-guide}.
\item \textbf{Changing the Model Domain and the Boundary Conditions} \\ \item \textbf{Changing the Model Domain and the Boundary Conditions} \\
Change the size of the model domain so that you get a rectangle with Change the size of the model domain so that you get a rectangle with
edge lengths of $\text{x} = \unit[400]{m}$ and $\text{y} = \unit[500]{m}$ and with edge lengths of $\text{x} = \unit[400]{m}$ and $\text{y} = \unit[500]{m}$ and with
discretization lengths of $\Delta \text{x} = \unit[20]{m}$ and $\Delta discretization lengths of $\Delta \text{x} = \unit[20]{m}$ and $\Delta
\text{y} = \unit[20]{m}$. \text{y} = \unit[20]{m}$. For this you have to edit the parameter file (\texttt{tutorialproblem\_coupled.input})
and run the programme again.\\
Note, that you do not have to recompile the programme if you make changes to the parameter file.
Change the boundary conditions in the file Change the boundary conditions in the file
\texttt{tutorialproblem\_coupled.hh} so that water enters from the \texttt{tutorialproblem\_coupled.hh} so that water enters from the
bottom and oil is extracted from the top boundary. The right and the bottom and oil is extracted from the top boundary. The right and the
left boundary should be closed for water and oil fluxes. left boundary should be closed for water and oil fluxes. \\
Note, that the value has to be positive for inflow and negative for outflow.
Compile the main file by typing \texttt{make tutorial\_coupled} and Compile the main file by typing \texttt{make tutorial\_coupled} and
run the model as explained above. run the model as explained above.
\item \textbf{Changing the Shape of the Discrete Elements} \\ \item \textbf{Changing the Shape of the Discrete Elements} \\
Change the types of elements used for discretizing the domain. In line \ref{tutorial-coupled:set-gridcreator} of the problem file the type of gridcreator is chosen. By choosing a different grid creator you can discretize the domain with different elements. Hint: You can find gridcreators in \texttt{dumux/common/}. The shape of the employed elements can be visualized in paraview by choosing \texttt{Surface with Edges}. Change the types of elements used for discretizing the domain. In line \ref{tutorial-coupled:set-gridcreator} of the problem
file the type of gridcreator is chosen. By choosing a different grid creator you can discretize the domain with different elements.
Hint: You can find gridcreators in \texttt{dumux/common/}, change for example from \texttt{cubegridcreator.hh} to \texttt{simplexgridcreator.hh}.
Besides having to change the grid creator it is also necessary to change the DUNE-grid module in line \ref{tutorial-coupled:set-grid} from \texttt{ALUCubeGrid}
to \texttt{ALUSimplexGrid}.
The shape of the employed elements can be visualized in paraview by choosing \texttt{Surface with Edges}.
\item \textbf{Changing Fluids} \\ \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 select different components via the property system in the problem file: Now you can change the fluids. Use DNAPL instead of Oil and Brine instead of Water. To do that, you have to select different components via the property system in the problem file:
\begin{enumerate} \begin{enumerate}
\item Brine: Brine is thermodynamically very similar to pure water but also considers a fixed amount of salt in the liquid phase. Hence, the class \texttt{Dumux::Brine} uses a pure water class, such as \texttt{Dumux::H2O}, as a second template argument after the data type \texttt{<Scalar>}. \item Brine: Brine is thermodynamically very similar to pure water but also considers a fixed amount of salt in the liquid phase.
\item DNAPL: A standard set of chemical substances, such as Oil and Brine, is already included in the problem (via a list of \texttt{\#include ..} statements) and hence easily accessible by default. However, this is not the case for the class \texttt{Dumux::SimpleDNAPL}, which describes a simple \textbf{d}ense \textbf{n}on-\textbf{a}queous \textbf{p}hase \textbf{l}iquid and is located in the folder \texttt{dumux/material/components/}. Try to include the file and select the component as the non-wetting phase via the property system. Hence, the class \texttt{Dumux::Brine} uses a pure water class, such as \texttt{Dumux::H2O},
as a second template argument after the data type \texttt{<Scalar>}, i.e. \texttt{Dumux::Brine<Scalar, Dumux::H2O>}. The file is located in the folder \texttt{dumux/material/components/}.
Try to include the file and select the component as the wetting phase via the property system.
\item DNAPL:
Now let's include a DNAPL (\textbf{d}ense \textbf{n}on-\textbf{a}queous \textbf{p}hase \textbf{l}iquid)
which is located in the folder \texttt{dumux/material/components/}. Try to include the file and select the component as the non-wetting phase via the property system.
\end{enumerate} \end{enumerate}
If you want to take a closer look on how the fluid classes are defined and which substances are already available please browse through the files in the directory If you want to take a closer look on how the fluid classes are defined and which substances are already available please browse through the files in the directory
\texttt{/dumux/material/components} and read chapter~\ref{sec:fluidframework}. \texttt{/dumux/material/components} and read chapter~\ref{sec:fluidframework}.
\item \textbf{Use a Full-Fledged Fluid System} \\ \item \textbf{Use a Full-Fledged Fluid System} \\
\Dumux usually describes fluid mixtures via \textit{fluid systems}, see also chapter \ref{sec:fluidframework}. In order to include a fluid system, you first have to comment out lines \ref{tutorial-coupled:2p-system-start} to \ref{tutorial-coupled:2p-system-end} in the problem file. If you use eclipse, this can easily be done by pressing \textit{Ctrl + Shift + 7} -- the same as to cancel the comment later on.\\ \Dumux usually describes fluid mixtures via \textit{fluid systems}, see also chapter \ref{sec:fluidframework}.
Now include the file \texttt{fluidsystems/h2oairfluidsystem.hh} in the material folder, and set a property \texttt{FluidSystem} with the appropriate type, i.e. \texttt{Dumux::H2OAirFluidSystem<TypeTag>}. However, this is a rather complicated fluid system which considers mixtures of components and also uses tabulated components that need to be initialized -- i.e. the tables need to be filled with values. The initialization of the fluid system is normally done in the constructor of the problem by calling \texttt{GET\_PROP\_TYPE(TypeTag, FluidSystem)::init();}. As water flow replacing a gas is much faster, test your simulation only until $2000$ seconds and start with a time step of $1$ second.\\ In order to include a fluid system, you first have to comment out lines \ref{tutorial-coupled:2p-system-start}
to \ref{tutorial-coupled:2p-system-end} in the problem file. If you use eclipse, this can easily be done by pressing \textit{Ctrl + Shift + 7} --
the same as to cancel the comment later on.\\
Now include the file \texttt{fluidsystems/h2oairfluidsystem.hh} in the material folder, and set a type property \texttt{FluidSystem} (see line \ref{tutorial-coupled:set-fluidsystem})
with the appropriate type, which is:\\
\texttt{Dumux::FluidSystems::H2OAir<typename GET\_PROP\_TYPE(TypeTag, Scalar)>}.\\
However, this is a rather complicated fluid system which
considers mixtures of components and also uses tabulated components that need to be initialized -- i.e. the tables need to be filled with values.
The initialization of the fluid system is normally done in the constructor of the problem by calling \texttt{GET\_PROP\_TYPE(TypeTag, FluidSystem)::init();}.
Remember that the constructor function always has the same name as the respective class, i.e. \texttt{TutorialProblemCoupled(..)}.\\
As water flow replacing a gas is much faster, test your simulation only until $2000$ seconds and start with a time step of $1$ second.\\
Please reverse the changes made in this part of the exercise, as we will continue to use immiscible phases from here on and hence do not need a complex fluid system. Please reverse the changes made in this part of the exercise, as we will continue to use immiscible phases from here on and hence do not need a complex fluid system.
\item \textbf{Changing Constitutive Relations} \\ \item \textbf{Changing Constitutive Relations} \\
Use an unregularized linear law with an entry pressure of $p_e = 0.0\;\text{Pa}$ and maximal capillary pressure of e.g. $p_{c_{max}} = 2000.0\;\text{Pa}$ instead of using a Use an unregularized linear law with an entry pressure of $p_e = 0.0\;\text{Pa}$ and maximal capillary pressure of e.g. $p_{c_{max}} = 2000.0\;\text{Pa}$ instead of using a
regularized Brooks-Corey law for the regularized Brooks-Corey law for the
relative permeability and for the capillary pressure saturation relationship. To do that you have relative permeability and for the capillary pressure saturation relationship. To do that you have
to change the file \texttt{tutorialspatialparams\_coupled.hh}. to change the material law property (line \ref{tutorial-coupled:eff2abs}) in \texttt{tutorialspatialparams\_coupled.hh}. Leave the type definition of \texttt{Scalar} and remove
the type definition of \texttt{BrooksAndCorey} in the private section of the property definition. Exchange the \texttt{EffToAbsLaw} with the \texttt{LinearMaterial} law type in the
public section.
You can find the material laws in the folder You can find the material laws in the folder
\verb+dumux/material/fluidmatrixinteractions+. The necessary parameters \verb+dumux/material/fluidmatrixinteractions+. The necessary parameters
of the linear law and the respective \texttt{set}-functions can be found of the linear law and the respective \texttt{set}-functions can be found
in the file \\ in the file \\
\verb+dumux/material/fluidmatrixinteractions/2p/linearmaterialparams.hh+. \verb+dumux/material/fluidmatrixinteractions/2p/linearmaterialparams.hh+.\\
Call the \texttt{set}-functions from the constructor of the \texttt{tutorialspatialparams\_coupled.hh}.
\item \textbf{Heterogeneities} \\ \item \textbf{Heterogeneities} \\
Set up a model domain with the soil properties given in Figure Set up a model domain with the soil properties given in Figure
...@@ -406,7 +438,8 @@ of the linear law and the respective \texttt{set}-functions can be found ...@@ -406,7 +438,8 @@ of the linear law and the respective \texttt{set}-functions can be found
\caption{Exercise 1f: Set-up of a model domain with a heterogeneity. $\Delta x = 20 \;\text{m}$ $\Delta y = 20\;\text{m}$.}\label{tutorial-coupled:exercise1_d} \caption{Exercise 1f: Set-up of a model domain with a heterogeneity. $\Delta x = 20 \;\text{m}$ $\Delta y = 20\;\text{m}$.}\label{tutorial-coupled:exercise1_d}
\end{figure} \end{figure}
domain. You can use the fluids of exercise 1c).\\ domain. You can use the fluids of exercise 1c).\\
\textbf{Hint:} The current position of the control volume can be obtained using \texttt{element\allowbreak.geometry()\allowbreak.corner(scvIdx)}.\\ \textbf{Hint:} The current position of the control volume can be obtained using \texttt{element\allowbreak.geometry()\allowbreak.corner(scvIdx)}, which
returns a vector of the global coordinates of the current position.\\
When does the front cross the material border? In paraview, the When does the front cross the material border? In paraview, the
animation view (\textit{View} $\rightarrow$ \textit{Animation animation view (\textit{View} $\rightarrow$ \textit{Animation
View}) is a convenient way to get a rough feeling of the time-step View}) is a convenient way to get a rough feeling of the time-step
...@@ -419,7 +452,7 @@ the file \texttt{tutorialproblem\_coupled.hh} (e.g. with the name ...@@ -419,7 +452,7 @@ the file \texttt{tutorialproblem\_coupled.hh} (e.g. with the name
\texttt{ex2\_tutorialproblem\_coupled.hh} and new spatial parameters \texttt{ex2\_tutorialproblem\_coupled.hh} and new spatial parameters
just like \texttt{tutorialspatialparams\_coupled.hh}. The new just like \texttt{tutorialspatialparams\_coupled.hh}. The new
problem file needs to problem file needs to
be included in the file \texttt{tutorial\_coupled.cc}. be included in the file \texttt{tutorial\_coupled.cc}).
The new files should contain the definition of new classes with names The new files should contain the definition of new classes with names
that relate to the file name, such as that relate to the file name, such as
...@@ -431,7 +464,10 @@ in the header files (e.g. change ...@@ -431,7 +464,10 @@ in the header files (e.g. change
\mbox{\texttt{DUMUX\_EX2\_TUTORIALPROBLEM\_COUPLED\_HH}}). \mbox{\texttt{DUMUX\_EX2\_TUTORIALPROBLEM\_COUPLED\_HH}}).
Besides adjusting the guardian macros, the new problem file should define and Besides adjusting the guardian macros, the new problem file should define and
use a new type tag for the problem as well as a new problem class use a new type tag for the problem as well as a new problem class
e.g. \mbox{\texttt{Ex2TutorialProblemCoupled}}. Make sure to assign your e.g. \mbox{\texttt{Ex2TutorialProblemCoupled}}. Similarly adjust your new spatial parameters file. If you are using Eclipse there is
a very helpful function called \texttt{Refactor} which you can use to change
all similar variables or types in your current file in one go. Just place the cursor at the variable or type you want to change
and use the \texttt{Refactor} $\rightarrow$ \texttt{Rename} functionality. Make sure to assign your
newly defined spatial parameter class to the newly defined spatial parameter class to the
\texttt{SpatialParams} property for the new \texttt{SpatialParams} property for the new
type tag. type tag.
...@@ -495,10 +531,14 @@ via \textit{parameter input files}. ...@@ -495,10 +531,14 @@ via \textit{parameter input files}.
In the code, parameters can be read via the macro In the code, parameters can be read via the macro
\texttt{GET\_RUNTIME\_PARAM(TypeTag, Scalar, \texttt{GET\_RUNTIME\_PARAM(TypeTag, Scalar,
MyWonderfulGroup.MyWonderfulParameter);}. At the end of the MyWonderfulGroup.MyWonderfulParameter);}. In this exercise we will explore the possibilities of the
simulation a list of parameters is printed if the command line option parameter file. For this we take a look at the file \texttt{ex3\_tutorial\_coupled.input} in the \texttt{solutions\_coupled} folder.
\texttt{-printParams 1} is passed to the simulation. Add some (for Besides the parameters which you already used in the parameter file above, there are parameters which can be used to control the
example \texttt{Newton.MaxSteps} and \texttt{EnableGravity}) to the Newton and the Linear solver (groups: \texttt{Newton} and \texttt{LinearSolver}). Run-time parameters used in the problem or spatial parameters classes
can also be set with the respective group names (\texttt{Problem} and \texttt{SpatialParams}) in the parameter file. For the latter parameters to be included in the program
they have to be assigned in the problem or spatial parameters constructor. This can be done as shown in the files \texttt{ex3\_tutorialproblem\_coupled.diff}
and \texttt{ex3\_tutorialspatialparams\_coupled.diff} in the \texttt{solutions\_coupled} folder. Add some (for
example \texttt{Newton.MaxSteps} and \texttt{Problem.EnableGravity}) to the
parameter file \texttt{tutorial\_coupled.input} and observe what parameter file \texttt{tutorial\_coupled.input} and observe what
happens if they are modified. For more information about the input file please refer to section \ref{sec:inputFiles}. happens if they are modified. For more information about the input file please refer to section \ref{sec:inputFiles}.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment