Exercise Basics (DuMuX course)
Problem set-up
N_2
is injected in an aquifer previously saturated with water with an injection rate of 0.0001 kg/(s*m^2
).
The aquifer is situated 2700 m below sea level and the domain size is 60 m x 40 m. It consists of two layers, a moderately permeable one (\Omega_1
) and a lower permeable one (\Omega_2
).

Preparing the exercise
- Navigate to the directory
dumux-course/exercises/exercise-basic
This exercise deals with two problems: a two-phase immiscible problem (2p) and a two-phase compositional problem (2p2c). They both set up the same scenario with the difference that the 2p2c assumes a miscible fluid state for the two fluids (water and gaseous N_2
) and the 2p model assumes an immiscible fluid state.
Task 1: Getting familiar with the code
Locate all the files you will need for this exercise
- The main file for the 2p problem :
2pmain.cc
- The main file for the 2p2c problem :
2p2cmain.cc
- The problem file for the 2p problem:
injection2pproblem.hh
- The problem file for the 2p2c problem:
injection2p2cproblem.hh
- The properties file for the __2p__problem:
properties2p.hh
- The properties file for the __2p2c__problem:
properties2p2c.hh
- The shared spatial parameters file:
injection2pspatialparams.hh
- The shared input file:
params.input
Task 2: Compiling and running an executable
- Change to the build-directory
cd ../../build-cmake/exercises/exercise-basic
- Compile both executables
exercise_basic_2p
andexercise_basic_2p2c
make exercise_basic_2p exercise_basic_2p2c
- Execute the two problems and inspect the result
./exercise_basic_2p params.input
./exercise_basic_2p2c params.input
- you can look at the results with paraview
paraview injection-2p2c.pvd
Task 3: Setting up a new executable (for a non-isothermal simulation)
- Copy the main file
2pmain.cc
and rename it to2pnimain.cc
- In
2pnimain.cc
, include the headerproperties2pni.hh
instead ofproperties2p.hh
. - In
2pnimain.cc
, changeInjection2pCC
toInjection2pNICC
in the lineusing TypeTag = Properties::TTag::Injection2pNICC;
- Add a new executable in
CMakeLists.txt
by adding the lines
# the two-phase non-isothermal simulation program
dune_add_test(NAME exercise_basic_2pni
SOURCES 2pnimain.cc)
- Test that everything compiles without error
make # should rerun cmake
make exercise_basic_2pni # builds new executable
Task 4: Setting up a non-isothermal 2pni test problem
- Open the files
injection2pniproblem.hh
andproperties2pni.hh
. These are a copies of theinjection2pproblem.hh
properties2pni.hh
files, with some useful comments on how to implement a non-isothermal model. Look for comments containing
// TODO: dumux-course-task 4
-
The following set-up should be realized:
Boundary conditions: Dirichlet conditions at the left boundary. For the primary variable 'temperature' use a varying temperature of
\displaystyle T(y) = 283~\text{K} + 0.03~\frac{\text{K}}{\text{m}} \cdot \left( d_\text{aquifer} - y \right)
,
with the aquifer depth\displaystyle d_\text{aquifer}=2700~\text{m}
. Assign Neumann no-flow for the energy balance to the rest of the boundaries.Initial conditions: The same temperature gradient as in the boundary conditions with an exception in the subdomain (20 < x < 30, 5 < y < 35), where you assign a constant initial temperature of 380 K.

The non-isothermal model requires additional parameters like the thermal conductivity of the solid component. They are already implemented and set in params.input
, you just need to uncomment them.