README.md 3.13 KB
Newer Older
Timo Koch's avatar
Timo Koch committed
1
# Exercise New Dune Module (DuMuX course)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

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
<hr>

* Execute the following command (bash environment) in the top-folder, i.e. above the dumux folder

```bash
./dune-common/bin/duneproject
```

* Follow the introductions and specify
    * as name of the new module: `dumux-example`
    * as module dependencies: `dumux`
21
    * a version at your choice (the version of your project, not of dumux.)
22
23
24
25
26
27
28
29
30
31
32
33
    * your email address

<hr><br><br>
### Task 2: Rerun dunecontrol to configure your new project
<hr>

The following command will configure your new module

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

34
35
You need to run this command in the folder with content dumux, dumux-course, dune-common, dune-geometry, dune-grid, dune-istl, etc. `<opts file>` needs to be replaced (please replace the angle brackets also) by an options file, e.g. by `./dumux/optim.opts` or `./dumux/debug.opts`. optim.opts is faster - debug.opts allows for debugging.

36
37
38
39
40
41
42
43
44
45
<hr><br><br>
### Task 3: Create a new test case within your new DuMuX module
<hr>

* Create a new folder (in your module folder), e.g. `appl`

```bash
mkdir appl
```

46
* Copy some test case from the dumux module, e.g. test_1p from test/porousmediumflow/1p/implicit/compressible/stationary
47
* Copy the problem, spatialparams, cc source file, input file
48

49
* Adjust the CMakeLists.txt file within the dumux-example (or your module name)-folder to include your new subdirectory
50
51
52
53

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

```cmake
54
# add a new finite volume 1p test
55
56
dune_add_test(NAME test_1p_compressible_stationary_tpfa
              SOURCES main.cc
57
              COMPILE_DEFINITIONS TYPETAG=OnePCompressibleTpfa
58
              CMD_ARGS params.input)
59
60

# add a symlink for the input file
61
dune_symlink_to_source_files(FILES "params.input")
62

63
64
65
66
67
68
69
70
71
72
73
74
75
76
```

* Reconfigure your module by running in the topmost directory of your new module

```bash
cmake build-cmake
```

* Build and execute the test problem

```bash
cd build-cmake
make build_tests
cd appl
Katharina Heck's avatar
Katharina Heck committed
77
./test_1p_compressible_tpfa test_1p.input
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
```

<hr><br><br>
### Task 4: Create a new GitLab project
<hr>

* Login with your username and password at https://git.iws.uni-stuttgart.de/

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
98
under version control. Only source files (`*.hh`, `*.cc`, `*.input`, `CMakeLists.txt`) should be under version control.