Exercise #1 (DuMuX course)
## Problem set-up
N2 is injected in an aquifer previously saturated with water with an injection rate of 0.001 kg/(s*m

Preparing the exercise
- Navigate to the directory
dumux/tutorial/ex1
Exercise 1 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 N2) 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:
exercise1_2p.cc
- The problem file for the 2p problem:
injection2pproblem.hh
- The main file for the 2p2c problem:
exercise1_2p2c.cc
- The problem file for the 2p2c problem:
injection2p2cproblem.hh
- The shared spatial parameters file:
injection2pspatialparams.hh
- The shared input file:
exercise1.input
### Task 2: Compiling and running an executable
- Change to the build-directory
cd ../../build-cmake/tutorial/ex1
- Compile both executables
exercise1_2p
andexercise1_2p2c
make exercise1_2p exercise1_2p2c
- Execute the two problems and inspect the result
./exercise1_2p exercise1.input
./exercise1_2p2c exercise1.input
- you can look at the results with paraview
paraview injection-2p2c.pvd
### Task 3: Changing input parameters
In the input file exercise1.input
you can find the following section
[SpatialParams]
EntryPressureAquitard = 4.5e4
EntryPressureAquifer = 1e4
- Change the values for the aquitard entry pressure in the input file to a lower value and compare the results with the previous solution. You don't need to recompile the executable.
### Task 4: Runtime parameters
The injection rate is currently hard-coded in injection2p2cproblem.hh
to
// set the Neumann values for the Nitrogen component balance
// convert from units kg/(s*m^2) to mole/(s*m^2)
values[Indices::contiNEqIdx] = -1e-4/FluidSystem::molarMass(FluidSystem::nCompIdx);
values[Indices::contiWEqIdx] = 0.0;
We want to be able to set it at runtime. To this end,
- use the following DuMuX macro to read a runtime parameter from the input file
// read the injection rate from the input file at run time
totalAreaSpecificInflow_ = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, <TYPE>, <GROUPNAME>, <PARAMNAME>);
- Replace
<TYPE>
,<GROUPNAME>
,<PARAMNAME>
by what is appropriate for your case:-
<TYPE>
is the type of the parameter to read -
<GROUPNAME>
is the group in the input file -
<PARAMNAME>
is the name of the parameter in the input file
-
Note that due to the way the macro works, the names are specified as plain text without "quotation marks". Follow the instructions given as a
// TODO: dumux-course-task
in the injection2p2cproblem.hh
file and also remember to also set the parameter totalAreaSpecificInflow in the input file.
- Check the influence of that parameter on the simulation result by rerunning the simulation with different injection rates. Remember to also set the parameter totalAreaSpecificInflow in the input file.
Since you have changed your header file, you have to recompile the program.
### 5. Setting up a new executable (for a non-isothermal simulation)
- Set up a new cc file called
exercise1_2pni.cc
by copying and renamingexercise1_2p.cc
cp exercise1_2p.cc exercise1_2pni.cc
- In
exercise1_2pni.cc
, include the headerinjection2pniproblem.hh
instead of the isothermal problem fileinjection2pproblem.hh
. - In the main routine of
exercise1_2pni.cc
, replaceTTAG(InjectionCCProblem2P)
byTTAG(InjectionCCProblem2PNI)
. - Add a new executable in
CMakeLists.txt
by adding the lines
add_dumux_test(exercise1_2pni exercise1_2pni exercise1_2pni.cc ./exercise1_2pni exercise1.input)
- Test that everything compiles without error
make # should rerun cmake
make exercise1_2pni # builds new executable
### 6. Setting up a non-isothermal __2pni__ test problem
- Open the file
injection2pniproblem.hh
. It is a copy of theinjection2pproblem.hh
with some useful comments on how to implement a non-isothermal model. Look for comments containing
// TODO: dumux-course-task
-
The following set-up should be realized:
Boundary conditions: Dirichlet conditions for the temperature with a temperature gradient of 0.03 K/m and a starting temperature of 283 K.
Initial conditions: The same temperature gradient as in the boundary conditions with an additional lens (with position: 20 < x < 30, 5 < y < 35), which has an initial temperature of 380 K.

The non-isothermal model requires additional spatial parameters like the thermal conductivity. They are already implemented in injection2pspatialparams.hh
, you just need to uncomment them.