Skip to content
Snippets Groups Projects
Name Last commit Last update
..
exercises/exercise-dunemodule/README.md

Exercise #4 (DuMuX course)

This exercise describes how to create a new DuMuX module and how to create a corresponding GitLab project.

This is the suggested workflow to develop code on top of DuMuX.

Task 1: Create new dune module


  • Execute the following command (bash environment) in the top-folder, i.e. above the dumux folder
./dune-common/bin/duneproject
  • Follow the introductions and specify
    • as name of the new module: dumux-example
    • as module dependencies: dumux
    • a version at your choice
    • your email address



### Task 2: Rerun dunecontrol to configure your new project

The following command will configure your new module

./dune-common/bin/dunecontrol --opts=<opts file> --only=dumux-example all



### Task 3: Create a new test case within your new DuMuX module
  • Create a new folder (in your module folder), e.g. appl
mkdir appl
  • Copy some test case from the dumux module, e.g. test_1p from test/porousmediumflow/1p/implicit/compressible

  • Copy the problem, spatialparams, cc source file, input file

  • Adjust the CMakeLists.txt file to include your new subdirectory

  • Add a new CMakeLists.txt in the folder appl with the content

# add a new finite volume 1p test
dune_add_test(NAME test_1p_compressible_tpfa
              SOURCES test_1p.cc
              COMPILE_DEFINITIONS TYPETAG=OnePCompressibleTpfa
              CMD_ARGS test_1pfv.input)

# add a symlink for the input file
dune_symlink_to_source_files(FILES "test_1p.input")
  • Reconfigure your module by running in the topmost directory of your new module
cmake build-cmake
  • Build and execute the test problem
cd build-cmake
make build_tests
cd appl
./test_1p_compressible_tpfa test_1p.input



### Task 4: Create a new GitLab project

Note: If you don't have an account create one. We allow anyone to host repositories on our GitLab instance as long as it is DuMuX related.

  • Click the New project button

  • Specify your project name and click the Create project button

  • Follow the given instructions for an existing folder

Important: Before executing the git add . command, you should add your cmake build folder to .gitignore. The easiest way to do so is to copy the .gitignore file from the dumux module into your module path. If everything worked, executing git status should not show build-cmake anymore. Never put your executables or other build files under version control. Only source files (*.hh, *.cc, *.input, CMakeLists.txt) should be under version control.