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

Exercise Runtime Parameters (DuMuX course)


## Problem set-up

Here we will expand on what we've covered in the basics exercise, and the problem set up will remain the same.

Preparing the exercise

  • Navigate to the directory dumux-course/exercises/exercise-runtimeparams/



Task 1: Understanding Input Parameters


For this task we will edit the following files:
  • The shared problem file: injection2pproblem.hh
  • And the shared input file: exercise_runtimeparams.input

Parameters can either be directly defined within your program, or specified via the input file. Within every main file, (*.cc), the following function is called, which will read in the input file parameters

// parse command line arguments and input file
Parameters::init(argc, argv);

This input file should either be named the same as the executable file, with a trailing *.input, as is standard in our CMake system, or be explicitly written as the first shell argument after the executable file is called.

./exercise_runtimeparams
    (Calls a file (exercise_runtimeparams.input) as the default input file.)
./exercise_runtimeparams exercise1.input
    (Calls the input file provided (exercise1.input) as the input file.)

In the input file exercise_runtimeparams.input you can find the following section

[SpatialParams]
PermeabilityAquitard = 1e-15 # m^2
EntryPressureAquitard = 4.5e4 # Pa
PermeabilityAquifer = 1e-12 # m^2
EntryPressureAquifer = 1e4 # Pa

When a parameter is defined directly within your program, you'll need to recompile your program everytime you change the value. When a parameter is passed via the input file, this is not the case. If we decided to vary the entry pressure in our geologic units a few times via the parameters listed above, there would be no need to recompile between simulation runs.

  • Task 1: Change the aquitard's 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 2: Setting a variable to collect a runtime parameter