2010-12-13 13:12:18 +00:00
\section [Fully-coupled model] { Solving a problem using a Fully-Coupled Model} \label { tutorial-coupled}
2008-08-01 07:07:43 +00:00
2008-09-25 08:11:11 +00:00
The process of solving a problem using \Dumux can be roughly divided into four parts:
\begin { enumerate}
\item The geometry of the problem and correspondingly a grid have to be defined.
2010-10-19 09:16:57 +00:00
\item Material properties and constitutive relationships have to be selected.
2008-09-25 08:11:11 +00:00
\item Boundary conditions as well as initial conditions have to be defined.
\item A suitable model has to be chosen.
\end { enumerate}
2011-09-01 09:47:38 +00:00
The problem being solved in this tutorial is illustrated in Figure \ref { tutorial-coupled:problemfigure} . A rectangular domain with no flow boundaries on the top and on the bottom, which is initially saturated with oil, is considered. Water infiltrates from the left side into the domain. Gravity effects are neglected.
2008-09-25 08:11:11 +00:00
\begin { figure} [h]
\psfrag { x} { x}
\psfrag { y} { y}
\psfrag { no flow} { no flow}
\psfrag { water} { \textbf { water} }
\psfrag { oil} { \textcolor { white} { \textbf { oil} } }
\psfrag { p_ w = 2 x 10^ 5 [Pa]} { $ p _ w = 2 \times 10 ^ 5 $ [Pa]}
\psfrag { p_ w_ initial = 2 x 10^ 5 [Pa]} { \textcolor { white} { \textbf { $ \mathbf { p _ { w _ { initial } } = 2 \times 10 ^ 5 } $ [Pa]} } }
\psfrag { S_ n = 0} { $ S _ n = 0 $ }
2008-10-09 17:49:28 +00:00
\psfrag { S_ n_ initial = 0} { \textcolor { white} { $ \mathbf { S _ { n _ { initial } } = 1 } $ } }
2008-09-25 08:11:11 +00:00
\psfrag { q_ w = 0 [kg/m^ 2s]} { $ q _ w = 0 $ $ \left [ \frac { \textnormal { kg } } { \textnormal { m } ^ 2 \textnormal { s } } \right ] $ }
2010-12-07 11:12:19 +00:00
\psfrag { q_ n = -3 x 10^ -4 [kg/m^ 2s]} { $ q _ n = - 3 \times 10 ^ { - 2 } $ $ \left [ \frac { \textnormal { kg } } { \textnormal { m } ^ 2 \textnormal { s } } \right ] $ }
2008-09-25 08:11:11 +00:00
\centering
\includegraphics [width=0.9\linewidth,keepaspectratio] { EPS/tutorial-problemconfiguration}
\caption { Geometry of the tutorial problem with initial and boundary conditions.} \label { tutorial-coupled:problemfigure}
\end { figure}
2011-09-01 09:47:38 +00:00
The equations solved here are the mass balances of oil and
2009-06-18 16:46:37 +00:00
water:
\begin { align}
\label { massbalancewater}
\frac { \partial (\phi \, S_ { w} \, \varrho _ { w} )} { \partial t}
2010-12-10 15:05:12 +00:00
-
2010-11-11 14:52:18 +00:00
\nabla \cdot \left ( \varrho _ { w} \, \frac { k_ { rw} } { \mu _ { w} } \, \mathbf { K} \; \nabla p_ w \right )
2009-06-18 16:46:37 +00:00
-
2010-11-11 14:52:18 +00:00
q_ w
2009-06-18 16:46:37 +00:00
& =
0 \\
\label { massbalanceoil}
\frac { \partial (\phi \, S_ { o} \, \varrho _ { o} )} { \partial t}
2010-12-10 15:05:12 +00:00
-
2010-11-11 14:52:18 +00:00
\nabla \cdot \left ( \varrho _ { o} \, \frac { k_ { ro} } { \mu _ { o} } \, \mathbf { K} \; \nabla p_ o \right )
2009-06-18 16:46:37 +00:00
-
2010-11-11 14:52:18 +00:00
q_ o
2009-06-18 16:46:37 +00:00
& =
0
\end { align}
\subsection { The main file}
Listing \ref { tutorial-coupled:mainfile} shows the main file
2010-10-19 09:16:57 +00:00
\texttt { tutorial/tutorial\_ coupled.cc} for the coupled two-phase
2011-09-01 09:47:38 +00:00
model. This file needs to be executed in order to solve the problem described
2009-06-18 16:46:37 +00:00
above.
\begin { lst} [File tutorial/tutorial\_ coupled.cc]\label { tutorial-coupled:mainfile} \mbox { }
\lstinputlisting [basicstyle=\ttfamily \scriptsize ,numbers=left,
2011-02-04 18:08:25 +00:00
numberstyle=\tiny , numbersep=5pt, firstline=28]{ ../../tutorial/tutorial_ coupled.cc}
2008-09-25 08:11:11 +00:00
\end { lst}
2009-06-18 16:46:37 +00:00
From line \ref { tutorial-coupled:include-begin} to line
2010-12-10 15:05:12 +00:00
\ref { tutorial-coupled:include-end} the \Dune and \Dumux files which
2009-06-18 16:46:37 +00:00
contain the needed functions and classes are included.
At line \ref { tutorial-coupled:set-type-tag} the type tag of the
problem which is going to be simulated is set. All other data types
can be retrieved by the \Dumux property system and only depend on this
single type tag. Retrieving them is done between line
\ref { tutorial-coupled:retrieve-types-begin} and
\ref { tutorial-coupled:retrieve-types-end} . For an introduction to the
2010-11-10 10:15:37 +00:00
property system, see section \ref { sec:propertysystem} .
2009-06-18 16:46:37 +00:00
The first thing which should be done at run time is to initialize the
2010-12-10 15:05:12 +00:00
message passing interface using \Dune 's \texttt { MPIHelper} class. Line
2010-10-19 09:16:57 +00:00
\ref { tutorial-coupled:init-mpi} is essential if the simulation is
2009-06-18 16:46:37 +00:00
intended to be run on more than one processor at the same time. Next,
the command line arguments are parsed starting at line
2011-09-01 09:47:38 +00:00
\ref { tutorial-coupled:parse-args-begin} down to line
2010-10-19 09:16:57 +00:00
\ref { tutorial-coupled:parse-args-end} . In this example, it is checked if and
from which time on a previous run of the simulation should be restarted. Furthermore, we
parse the time when the simulation ends and the initial time step size.
2009-06-18 16:46:37 +00:00
2010-10-19 09:16:57 +00:00
After this, a grid is created in line
2009-06-18 16:46:37 +00:00
\ref { tutorial-coupled:create-grid} and the problem is instantiated for
2010-10-19 09:16:57 +00:00
its leaf grid view in line \ref { tutorial-coupled:instantiate-problem} .
2011-10-11 12:54:41 +00:00
Finally, on line \ref { tutorial-coupled:initTimeManager} the time
manager is created with the parsed starting parameters. If requested by
the user, a state written to disk by a previous simulation run can be
restored if via the restart flag.
2011-09-01 09:47:38 +00:00
The simulation procedure is started in line
2009-06-18 16:46:37 +00:00
\ref { tutorial-coupled:execute} .
\subsection { The problem class}
When solving a problem using \Dumux , the most important file is the
so-called \textit { problem file} as shown in listing
\ref { tutorial-coupled:problemfile} of
\texttt { tutorialproblem\_ coupled.hh} .
\begin { lst} [File tutorial/tutorialproblem\_ coupled.hh]\label { tutorial-coupled:problemfile} \mbox { }
2008-09-25 16:55:15 +00:00
\lstinputlisting [basicstyle=\ttfamily \scriptsize ,numbers=left,
2011-02-04 18:08:25 +00:00
numberstyle=\tiny , numbersep=5pt, firstline=27]{ ../../tutorial/tutorialproblem_ coupled.hh}
2008-09-25 16:55:15 +00:00
\end { lst}
2010-10-18 08:59:51 +00:00
First, a new type tag is created for the problem in line
2009-06-18 16:46:37 +00:00
\ref { tutorial-coupled:create-type-tag} . In this case, the new type
tag inherits all properties defined for the \texttt { BoxTwoP} type tag,
which means that for this problem the two-phase box model is chosen as
2011-08-08 08:07:13 +00:00
discretization scheme. Further, it inherits from the spatial parameters type tag which is defined in the problem dependent saptial parameters file (line \ref { tutorial-coupled:define-spatialparameters-typetag} ). On line \ref { tutorial-coupled:set-problem} , a
2009-06-18 16:46:37 +00:00
problem class is attached to the new type tag, while the grid which
2010-10-19 09:16:57 +00:00
is going to be used is defined in line \ref { tutorial-coupled:set-grid} --
2010-12-10 15:05:12 +00:00
in this case that is \texttt { SGrid} . Since there's no uniform
2010-10-19 09:16:57 +00:00
mechanism to allocate grids in \Dune , the \texttt { Grid} property also contains
2011-02-04 15:11:02 +00:00
a static \texttt { create()} method which provides just that. Therein, 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} ). Next,
2011-09-01 09:47:38 +00:00
the appropriate fluid system, which specifies both information about
2010-11-10 14:24:22 +00:00
the fluid mixture as well as about the pure substances, has to be chosen.
The two-phase model defaults to the \texttt { FluidSystem2P} which assumes
2011-09-01 09:47:38 +00:00
immiscibility of the phases, but requires the wetting and non-wetting phases
to be explicitly set. In this case, liquid water which uses the relations from
2010-11-10 14:24:22 +00:00
IAPWS'97~\cite { IAPWS1997} is chosen as the wetting phase on line
\ref { tutorial-coupled:wettingPhase} and a liquid model oil is chosen as the
non-wetting phase on line \ref { tutorial-coupled:nonwettingPhase} .
2011-09-01 09:47:38 +00:00
The final property, which is set in line
2010-11-10 14:24:22 +00:00
\ref { tutorial-coupled:gravity} , is optional and tells the model not to
2009-06-18 16:46:37 +00:00
use gravity.
Parameters which are specific to a set-up -- like boundary and initial
conditions, source terms or temperature within the domain -- but are
required to solve the differential equations of the models are
specified via a \textit { problem} class. If the two-phase box model is
used, this class must be derived from \texttt { TwoPBoxProblem} as done
2011-09-01 09:47:38 +00:00
in line \ref { tutorial-coupled:def-problem} .
2009-06-18 16:46:37 +00:00
The problem class always has at least five methods:
2008-09-25 16:55:15 +00:00
\begin { itemize}
2009-06-18 16:46:37 +00:00
\item A method \texttt { boundaryTypes()} specifying the kind of
boundary conditions to be used for a boundary segment
\item A method \texttt { dirichlet()} specifying the actual values for
the Dirichlet conditions on a boundary segment
\item A method \texttt { neumann()} specifying the actual values for
the Neumann conditions on a boundary segment
2010-10-18 08:59:51 +00:00
\item A method for source or sink terms called \texttt { source()}
2009-06-18 16:46:37 +00:00
\item A method called \texttt { initial()} for specifying the initial
condition.
2008-09-25 16:55:15 +00:00
\end { itemize}
2011-02-25 14:01:32 +00:00
For the definition of the the boundary condition types and of the values of the Dirichlet boundaries,
two parameters are required:
\begin { description}
\item [values:] A vector which stores the result of the method. What
2011-09-01 09:47:38 +00:00
the values in this vector mean is dependent on the method: For
2011-02-25 14:01:32 +00:00
\texttt { dirichlet()} it contains the actual values of the primary
variables, for \texttt { boundaryTypes()} it contains the boundary
condition type. It has as many entries as the model has primary variables / equations.
2011-09-01 09:47:38 +00:00
For the typical case in which all equations have the same boundary
2011-02-25 14:01:32 +00:00
condition at a certain position, there are two methods that set the appropriate conditions
for all primary variables / equations: Either \texttt { setAllDirichlet()} or \texttt { setAllNeumann()}
\item [vertex:] The boundary condition and the Dirichlet values are specified at the vertex, which represents a
subcontrol volume. This avoids to specify two different boundary condition types at one subcontrol volume.
Be aware that the second parameter is a Dune grid entity with the codimension dim.
\end { description}
To ensure that no boundaries are undefined, a small safeguard value \texttt { eps\_ }
is usually added when comparing spatial coordinates. The left boundary is
hence not assigned where the first coordinate is equal to zero, but where it is
smaller than a very small value \texttt { eps\_ } .
2009-06-18 16:46:37 +00:00
Methods which make statements about boundary segments of the grid (i.e.
2011-02-25 14:01:32 +00:00
\texttt { neumann()} ) get six parameters:
2009-06-18 16:46:37 +00:00
\begin { description}
2011-02-25 14:01:32 +00:00
\item [values:] A vector \texttt { neumann()} , in which the mass fluxes per area unit
over the boundary segment are specified.
2009-06-18 16:46:37 +00:00
\item [element:] The element of the grid where the boundary segment
is located.
\item [fvElemGeometry:] The finite-volume geometry induced on the
finite element by the box scheme.
2011-02-25 14:01:32 +00:00
\item [isIt:] The \texttt { Intersection} of the boundary
segment as given by the grid.
2009-06-18 16:46:37 +00:00
\item [scvIdx:] The index of the sub-control volume in
\texttt { fvElementGeometry} adjacent to the boundary segment.
\item [boundaryFaceIdx:] The index of the boundary face in
\texttt { fvElementGeometry} which represents the boundary segment.
\end { description}
2010-10-13 15:48:08 +00:00
Similarly, the \texttt { initial()} and \texttt { source()} methods
2009-06-18 16:46:37 +00:00
specify properties of sub-control volumes and thus only get
\texttt { values} , \texttt { element} , \texttt { fvElemGeom} and
\texttt { scvIdx} as parameters.
In addition to these five methods, there might be some model-specific
2009-07-01 09:46:21 +00:00
methods. If the isothermal two-phase model is used, this includes
for example a \texttt { temperature()} method which returns the temperature in Kelvin
2009-06-18 16:46:37 +00:00
of the fluids and the rock matrix in the domain. This temperature is
then used by the model to calculate fluid properties which possibly
2011-09-01 09:47:38 +00:00
depend on it, e.g. density. The \texttt { bboxMax()} method that is used here is a vector
providing information about the spatial extends of the simulation domain. This method
2011-02-25 14:01:32 +00:00
and the respective \texttt { bboxMin()} method
can be found in the base class \texttt { Dumux::BoxProblem<TypeTag>} .
2009-06-18 16:46:37 +00:00
2009-06-30 16:55:14 +00:00
\subsection { Defining fluid properties} \label { tutorial-coupled:description-fluid-class}
2009-06-18 16:46:37 +00:00
2010-04-12 15:32:36 +00:00
The \Dumux distribution includes some common substances which can be used
out of the box. The properties of the pure substances (such as the component
2010-10-13 15:48:08 +00:00
nitrogen, water, or pseudo-component air) are stored in header files in
the folder \verb +dumux/material/components+. Each of these files
2010-04-12 15:32:36 +00:00
defines a class with the same name as the component but starting with a capital
letter, e.g. \texttt { Water} , and are derived from \texttt { Component} .
2010-10-13 15:48:08 +00:00
Most often, when two or more components are considered, fluid interactions
2010-04-12 15:32:36 +00:00
such as solubility effects come into play and properties of mixtures such as
2011-09-01 09:47:38 +00:00
density are of interest. These interactions are defined in
2010-10-13 15:48:08 +00:00
a specific \verb +fluidsystem+ in the folder \verb +dumux/material/fluidsystems+.
2010-04-12 15:32:36 +00:00
It features methods returning fluid properties like density, enthalpy, viscosity,
etc. by accessing the pure components as well as binary coefficients such as
2010-10-18 08:59:51 +00:00
Henry or diffusion coefficients, which are stored in
2010-10-13 15:48:08 +00:00
\verb +dumux/material/binarycoefficients+. New fluids which are not yet
available in the \Dumux distribution can be defined analogously.
2010-04-12 15:32:36 +00:00
2011-09-01 09:47:38 +00:00
% In this example, a class for the definition of a two-phase system is used. This allows for the choice
% of the two components oil and water and for access of the parameters that are relevant for the two-phase model.
2010-10-19 09:16:57 +00:00
2010-04-12 15:38:33 +00:00
\subsection { The definition of the parameters that are dependent on space} \label { tutorial-coupled:description-spatialParameters}
2010-04-12 15:32:36 +00:00
2011-09-01 09:47:38 +00:00
In \Dumux , the properties of the porous medium such as the \textit { intrinsic
2010-04-12 15:32:36 +00:00
permeability} , the \textit { porosity} , the \textit { heat capacity} as
well as the \textit { heat conductivity} can be defined in space using a
so-called \texttt { spatial parameters} class. However, because the soil
also has an effect on the material laws of the fluids (e.g. \textit { capillarity} ),
2011-09-01 09:47:38 +00:00
their selection and the definition of their attributes (e.g. \textit { residual
2010-04-12 15:32:36 +00:00
saturations} ) are also accomplished in the spatial parameters.
The base class \texttt { Dumux::BoxSpatialParameters<TypeTag>} holds a general
2010-04-12 15:38:33 +00:00
averaging procedure for vertex-centered box-methods.
2010-04-12 15:32:36 +00:00
Listing \ref { tutorial-coupled:spatialparametersfile} shows the file
\verb +tutorialspatialparameters_ coupled.hh+:
\begin { lst} [File tutorial/tutorialspatialparameters\_ coupled.hh]\label { tutorial-coupled:spatialparametersfile} \mbox { }
2009-06-18 16:46:37 +00:00
\lstinputlisting [basicstyle=\ttfamily \scriptsize ,numbers=left,
2011-02-04 18:08:25 +00:00
numberstyle=\tiny , numbersep=5pt, firstline=27]{ ../../tutorial/tutorialspatialparameters_ coupled.hh}
2009-06-18 16:46:37 +00:00
\end { lst}
2008-09-25 16:55:15 +00:00
2011-08-08 08:07:13 +00:00
First, a spatial parameters type tag has to be defined (line \ref { tutorial-coupled:define-spatialparameters-typetag} ), from which the problem type tag inherits the properties, which can be classified as spatial parameter properties (problem file line \ref { tutorial-coupled:create-type-tag} ). These are e.g. the spatial parameters class itself (line \ref { tutorial-coupled:set-spatialparameters} ) or a certain material law (line \ref { tutorial-coupled:rawlaw} \label { tutorial-coupled:materialLaw} ).
2010-04-12 15:32:36 +00:00
\Dumux provides several material laws in the folder
2010-10-13 15:48:08 +00:00
\verb +dumux/material/fluidmatrixinteractions+.
2010-12-10 15:05:12 +00:00
The selected one -- here it is a relation according to a regularized version of Brooks \& Corey -- is included
2010-04-12 15:32:36 +00:00
in line \ref { tutorial-coupled:rawLawInclude} . After the selection,
2010-12-10 15:05:12 +00:00
an adapter in line \ref { tutorial-coupled:eff2abs} translates between the law
for effective values (the Brooks \& Corey model) and the saturations generated as simulations results, i.e. residual saturations are considered.
As the applied raw law knows best which kind of parameters are necessary,
2010-11-11 14:52:18 +00:00
it provides a parameter class \texttt { RegularizedBrooksCoreyParams} that is
2010-04-12 15:32:36 +00:00
accessible via the member \texttt { Params} and defined in line
\ref { tutorial-coupled:matLawObjectType} . The material law object
2010-12-10 15:05:12 +00:00
is now instantiated correctly as a private object
2010-04-12 15:32:36 +00:00
in line \ref { tutorial-coupled:matParamsObject} .
2009-06-18 16:46:37 +00:00
In line \ref { tutorial-coupled:permeability} the function returning the
intrinsic permeability can be found. As can be seen, the function has
2010-04-12 15:32:36 +00:00
to be called with three different arguments.
(\texttt { Element} ) is again the current element, which also holds information
about its geometry and position, the second argument
2010-04-12 15:38:33 +00:00
(\texttt { fvElemGeom} ) holds information about the finite-volume geometry induced
2010-04-12 15:32:36 +00:00
by the box-method, and the third defines the index of the current sub-control
volume. The intrinsic permeability is a tensor and is thus returned in form of
a $ \texttt { dim } \times \texttt { dim } $ -matrix where \texttt { dim} is the dimension
2010-12-10 15:05:12 +00:00
of the problem.
2009-06-18 16:46:37 +00:00
The function \texttt { porosity()} defined in line
\ref { tutorial-coupled:porosity} is called with the same arguments as
the permeability function described before and returns the porosity
2010-12-10 15:05:12 +00:00
dependent on the position in the domain.
2010-04-12 15:32:36 +00:00
Next, the method \texttt { materialLawParams()} defines in line
2010-12-10 15:05:12 +00:00
\ref { tutorial-coupled:matLawParams} which \verb +materialLawParams+ object
should be applied at this specific position. Although in this case only one objects is returned,
in general the problem may be heterogeneous, demanding for different objects at different positions in space.
While the selection of the type of this object was already explained (line \ref { tutorial-coupled:rawLawInclude} ),
some specific parameter
2010-04-12 15:32:36 +00:00
values of the applied material law are still needed. This is
2010-10-13 15:48:08 +00:00
done in the constructor body (line \ref { tutorial-coupled:setLawParams} ).
Depending on the type of the \texttt { materialLaw} object, the adequate \texttt { set} -methods
2010-04-12 15:38:33 +00:00
are provided by the object to access all necessary parameters
2010-12-10 15:05:12 +00:00
for the applied material law. The name of the access / set functions as well as the rest of the implementation
of the material description can be found in
2011-02-04 15:11:02 +00:00
\verb +dumux/material/fluidmatrixinteractions/2p+.
2008-09-25 16:55:15 +00:00
2008-11-14 16:11:36 +00:00
\subsection { Exercises}
2008-11-26 08:29:57 +00:00
\label { tutorial-coupled:exercises}
2009-06-18 16:46:37 +00:00
The following exercises will give you the opportunity to learn how you
can change soil parameters, boundary conditions and fluid properties
2011-01-19 16:31:28 +00:00
in \Dumux .
2008-11-26 07:56:50 +00:00
2008-11-14 16:11:36 +00:00
\subsubsection { Exercise 1}
2009-06-18 16:46:37 +00:00
\renewcommand { \labelenumi } { \alph { enumi} )} For Exercise 1 you only have
2010-11-11 14:52:18 +00:00
to make some small changes in the tutorial files.
2008-11-14 16:11:36 +00:00
\begin { enumerate}
2010-11-11 14:52:18 +00:00
\item \textbf { Run the Model} \\
2011-02-25 14:01:32 +00:00
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 5e5 10} . The first number behind the simulation name defines the timespan of the simulation run in seconds, the second number defines the initial time step size. Note that the time step size is automatically optimized during the simulation. For the visualization with paraview please refer to \ref { quick-start-guide} .\\
2010-11-11 14:52:18 +00:00
\item \textbf { Changing the Model Domain and the Boundary Conditions} \\
2009-06-18 16:46:37 +00:00
Change the size of the model domain so that you get a rectangle with
edge lengths of $ \text { x } = 400 m $ and $ \text { y } = 500 m $ and with
discretization lengths of $ \Delta \text { x } = 20 $ m and $ \Delta
\text { y} = 20$ m.
Change the boundary conditions in the file
\texttt { tutorialproblem\_ coupled.hh} so that water enters from the
bottom and oil is extracted from the top boundary. The right and the
left boundary should be closed for water and oil fluxes.
Compile the main file by typing \texttt { make tutorial\_ coupled} and
run the model.
2008-11-14 16:11:36 +00:00
2009-06-18 16:46:37 +00:00
\item \textbf { Changing Fluids} \\
2011-02-04 15:11:02 +00:00
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}
2011-09-01 09:47:38 +00:00
\item Brine: The class \texttt { Dumux::Brine} acts as an adapter to the fluid system that alters a pure water class by adding some salt. 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>} as a template argument (be sure to use the complete water class with its own template parameter).
\item DNAPL: A standard set of chemical substances, such as Oil and Brine, is already included (via a list of \texttt { \# include ..} commandos) and hence easily accessible by default. This is not the case for the class \texttt { Dumux::SimpleDNAPL} , however, which is located in the folder \texttt { dumux/material/components/} . Try to include the file and select the component via the property system.
2010-11-11 14:52:18 +00:00
\end { enumerate}
2011-09-01 09:47:38 +00:00
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
2011-02-04 15:11:02 +00:00
\texttt { /dumux/material/components} .
2009-06-18 16:46:37 +00:00
2010-11-11 14:52:18 +00:00
\item \textbf { Use the \Dumux fluid system} \\
2011-02-25 14:01:32 +00:00
\Dumux usually organizes fluid mixtures via a \texttt { fluidsystem} . In order to include a fluidsystem you first have to comment the 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 { str + shift + 7} -- the same as to cancel the comment later on.\\
2011-01-19 16:31:28 +00:00
Now include the file \texttt { fluidsystems/h2o\_ n2\_ system.hh} in the material folder, and set a property \texttt { FluidSystem} with the appropriate type, \texttt { Dumux::H2O\_ N2\_ System<TypeTag>} . However, the complicated fluidsystem uses tabularized fluid data, which need to be initialized in the constructor body of the current problem by adding \texttt { GET\_ PROP\_ TYPE(TypeTag, PTAG(FluidSystem))::init();} , hence using the initialization function of the applied fluidsystem. As water flow replacing a gas is much faster, test your simulation only until 2e3 seconds and start with a time step of 1 second.\\
2010-11-11 14:52:18 +00:00
Please reverse the changes of this example, as we still use bulk phases and hence do not need such an extensive fluid system.
2009-06-18 16:46:37 +00:00
\item \textbf { Changing Constitutive Relations} \\
2010-12-10 15:05:12 +00:00
Use an unregularized linear law with an entry pressure of $ p _ e = 0 . 0 $ and maximal capillary pressure of e.g. $ p _ { c _ { max } } = 2000 . 0 $ instead of using a
regularized Brooks-Corey law for the
2010-11-11 14:52:18 +00:00
relative permeability and for the capillary pressure saturation relationship. To do that you have
2010-04-12 15:32:36 +00:00
to change the file \texttt { tutorialspatialparameters\_ coupled.hh} .
You can find the material laws in the folder
2010-10-13 15:48:08 +00:00
\verb +dumux/material/fluidmatrixinteractions+. The necessary parameters
2010-11-11 14:52:18 +00:00
of the linear law and the respective \texttt { set} -functions can be found
in the file \\
\verb +dumux/material/fluidmatrixinteractions/2p/linearmaterialparams.hh+.
2008-11-14 16:11:36 +00:00
\item \textbf { Heterogeneities} \\
2009-06-18 16:46:37 +00:00
Set up a model domain with the soil properties given in Figure
\ref { tutorial-coupled:exercise1_ d} . Adjust the boundary conditions
2010-11-11 14:52:18 +00:00
so that water is again flowing from the left to the right of the
2008-11-14 16:11:36 +00:00
\begin { figure} [h]
\psfrag { K1 =} { K $ = 10 ^ { - 8 } \text { m } ^ 2 $ }
\psfrag { phi1 =} { $ \phi = 0 . 15 $ }
\psfrag { K2 =} { \textcolor { white} { K $ = 10 ^ { - 9 } \text { m } ^ 2 $ } }
\psfrag { phi2 =} { \textcolor { white} { $ \phi = 0 . 3 $ } }
\psfrag { 600 m} { 600 m}
\psfrag { 300 m} { 300 m}
\centering
\includegraphics [width=0.5\linewidth,keepaspectratio] { EPS/exercise1_ c.eps}
2010-11-11 14:52:18 +00:00
\caption { Exercise 1f: Set-up of a model domain with a heterogeneity. $ \Delta \text { x } = 20 $ m $ \Delta \text { y } = 20 $ m.} \label { tutorial-coupled:exercise1_ d}
2008-11-14 16:11:36 +00:00
\end { figure}
2011-02-04 15:11:02 +00:00
domain. You can use the fluids of exercise 1c).\\
Hint: The current position of the element can be obtained via \texttt { element.geometry().center();} .\\
2010-11-11 14:52:18 +00:00
When does the front cross the material border? In paraview, the option \textit { View} $ \rightarrow $ \textit { Animation View} is nice to get a rough feeling of the timestep sizes.
2008-11-14 16:11:36 +00:00
\end { enumerate}
\subsubsection { Exercise 2}
2011-02-25 14:01:32 +00:00
For this exercise you should create a new problem file analogous to
2011-02-04 15:11:02 +00:00
the file \texttt { tutorialproblem\_ coupled.hh} (e.g. with the name
\texttt { ex2\_ tutorialproblem\_ coupled.hh} and new spatial parameters
2010-10-13 16:10:28 +00:00
just like \texttt { tutorialspatialparameters\_ coupled.hh} . The new problem file needs to
2011-02-04 15:11:02 +00:00
be included in the file \texttt { tutorial\_ coupled.cc} .\\
2011-09-01 09:47:38 +00:00
The new files should contain the definition of new classes with
2011-02-04 15:11:02 +00:00
names that relate to the file name, such as
\texttt { Ex2TutorialProblemCoupled} . Make sure that you also adjust the guardian
macros in lines \ref { tutorial-coupled:guardian1} and \ref { tutorial-coupled:guardian1}
in the header files (e.g. change \\
\texttt { DUMUX\_ TUTORIALPROBLEM\_ COUPLED\_ HH} to
\texttt { DUMUX\_ EX2\_ TUTORIALPROBLEM\_ COUPLED\_ HH} ). Besides also adjusting the guardian macros,
2010-04-12 15:32:36 +00:00
the new problem file should define and use a new type tag for the problem as well as a new problem class
2011-09-01 09:47:38 +00:00
e.g. \texttt { Ex2TutorialProblemCoupled} . Make sure to assign your newly defined spatial
2010-04-12 15:32:36 +00:00
parameter class to the \texttt { SpatialParameters} property for the new
2010-11-11 14:52:18 +00:00
type tag. \\
2009-06-18 16:46:37 +00:00
After this, change the \texttt { create()} method of the \texttt { Grid}
2010-04-12 15:32:36 +00:00
property so that it matches the domain described
2009-06-18 16:46:37 +00:00
by figure \ref { tutorial-coupled:ex2_ Domain} . Adapt the problem class
2009-07-01 09:46:21 +00:00
so that the boundary conditions are consistent with figure
2009-06-18 16:46:37 +00:00
\ref { tutorial-coupled:ex2_ BC} . Initially the domain is fully saturated
2010-12-10 15:05:12 +00:00
with water and the pressure is $ p _ w = 5 \times 10 ^ 5 \text { Pa } $ . Oil
2009-06-18 16:46:37 +00:00
infiltrates from the left side. Create a grid with $ 20 $ cells in
$ x $ -direction and $ 10 $ cells in $ y $ -direction. The simulation time
2010-11-11 14:52:18 +00:00
should be set to $ 1 \times 10 ^ 6 \text { s } $ with an initial time step size of
$ 100 \text { s } $ .
2009-06-18 16:46:37 +00:00
Now include your new problem file in the main file and replace the
\texttt { TutorialProblemCoupled} type tag by the one you've created and
compile the program.
2008-11-14 16:11:36 +00:00
\begin { figure} [h]
\psfrag { K1} { K $ = 10 ^ { - 7 } \text { m } ^ 2 $ }
\psfrag { phi1} { $ \phi = 0 . 2 $ }
2010-11-04 16:48:51 +00:00
\psfrag { Lin} { Brooks-Corey Law}
2010-12-10 15:05:12 +00:00
\psfrag { Lin2} { $ \lambda = 1 . 8 $ , $ p _ e = 1000 $ }
2008-11-14 16:11:36 +00:00
\psfrag { K2} { K $ = 10 ^ { - 9 } \text { m } ^ 2 $ }
\psfrag { phi2} { $ \phi = 0 . 15 $ }
2010-11-04 16:48:51 +00:00
\psfrag { BC1} { Brooks-Corey Law}
2010-12-10 15:05:12 +00:00
\psfrag { BC2} { $ \lambda = 2 $ , $ p _ e = 1500 $ }
2008-11-14 16:11:36 +00:00
\psfrag { H1y} { 50 m}
\psfrag { H2y} { 15 m}
\psfrag { H3y} { 20 m}
\psfrag { L1x} { 100 m}
\psfrag { L2x} { 50 m}
\psfrag { L3x} { 25 m}
\centering
\includegraphics [width=0.8\linewidth,keepaspectratio] { EPS/Ex2_ Domain.eps}
2008-11-26 08:29:57 +00:00
\caption { Set-up of the model domain and the soil parameters} \label { tutorial-coupled:ex2_ Domain}
2008-11-14 16:11:36 +00:00
\end { figure}
\begin { figure} [h]
2010-12-10 15:05:12 +00:00
\psfrag { pw} { $ p _ w = 5 \times 10 ^ 5 $ [\text { Pa} ]}
2008-11-14 16:11:36 +00:00
\psfrag { S} { $ S _ n = 1 . 0 $ }
2008-11-26 08:29:57 +00:00
\psfrag { qw} { $ q _ w = 2 \times 10 ^ { - 4 } $ [kg/$ \text { m } ^ 2 $ s]}
2008-11-14 16:11:36 +00:00
\psfrag { qo} { $ q _ n = 0 . 0 $ [kg/$ \text { m } ^ 2 $ s]}
\psfrag { no flow} { no flow}
\centering
\includegraphics [width=0.8\linewidth,keepaspectratio] { EPS/Ex2_ Boundary.eps}
2008-11-26 08:29:57 +00:00
\caption { Boundary Conditions} \label { tutorial-coupled:ex2_ BC}
2008-11-14 16:11:36 +00:00
\end { figure}
2008-09-25 08:11:11 +00:00
2010-11-11 14:52:18 +00:00
\begin { itemize}
\item Increase the simulation time to e.g. $ 4 \times 10 ^ 7 \text { s } $ . Investigate the saturation: Is the value range reasonable?
\item What happens if you increase the resolution of the grid?
\end { itemize}
2008-11-26 07:53:34 +00:00
\subsubsection { Exercise 3}
2009-06-18 16:46:37 +00:00
Create a new file for benzene called \texttt { benzene.hh} and implement
2010-04-12 15:32:36 +00:00
a new fluid system. (You may get a hint by looking at existing fluid
2010-11-11 14:52:18 +00:00
systems in the directory \verb +/dumux/material/fluidsystems+.) \\
2009-06-18 16:46:37 +00:00
Use benzene as a new fluid and run the model of Exercise 2 with water
2009-07-01 09:46:21 +00:00
and benzene. Benzene has a density of $ 889 . 51 \, \text { kg } / \text { m } ^ 3 $
and a viscosity of $ 0 . 00112 \, \text { Pa } \; \text { s } $ .
2009-06-18 16:46:37 +00:00
2011-01-19 16:31:28 +00:00
\clearpage \newpage
2010-11-10 10:15:37 +00:00
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "dumux-handbook"
%%% End: