Skip to content
Snippets Groups Projects
To learn more about this project, read the wiki.
README.md 5.52 KiB

Exercise #1 (DuMuX course)


## Problem set-up

N_2 is injected in an aquifer previously saturated with water with an injection rate of 0.001 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/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 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 : exercise1_2p.cc
  • The main file for the 2p2c problem : exercise1_2p2c.cc
  • The problem file for the 2p problem: injection2pproblem.hh
  • 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 and exercise1_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 1e-4 kg/(s m^2).

 // 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_ = getParam<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 within the "quotation marks".<GROUPNAME> and <PARAMNAME> need to be separated by a dot (.). Follow the instructions given as a

// TODO: dumux-course-task