README.md 2.6 KB
Newer Older
Timo Koch's avatar
Timo Koch committed
1
# Exercise Properties (DuMuX course)
2
<br>
3

4
5
## Problem set-up

Bernd Flemisch's avatar
Bernd Flemisch committed
6
The problem setup is identical to the two-phase incompressible test from DuMu<sup>x</sup>.
7
8
9

## Preparing the exercise

Timo Koch's avatar
Timo Koch committed
10
* Navigate to the directory `exercise-properties`
11

Bernd Flemisch's avatar
Bernd Flemisch committed
12
_Exercise Properties_ deals with a two-phase immiscible incompressible problem (__2p__). The goal is to learn how to adapt compile-time parameters by employing the _DuMu<sup>x</sup> property system_.
13
14
15
16
17
18

<br><br>
### Task 1: Getting familiar with the code
<hr>

Locate all the files you will need for this exercise
19
* The __main file__: `main.cc`
Bernd Flemisch's avatar
Bernd Flemisch committed
20
* The __problem file__: `problem.hh`
21
* The __properties file__: `properties.hh`
Bernd Flemisch's avatar
Bernd Flemisch committed
22
* The __spatial parameters file__: `spatialparams.hh`
23
* The __input file__: `params.input`
Bernd Flemisch's avatar
Bernd Flemisch committed
24
* One header file containing:
25
26
27
  * a custom __local residual__ in: `mylocalresidual.hh`


28
<br><br><br>
29
30
31
32
33
34
### Task 2: Compiling and running the program
<hr>

* Change to the build-directory

```bash
Simon Scholz's avatar
Simon Scholz committed
35
cd ../build-cmake/exercises/exercise_properties
36
37
```

Timo Koch's avatar
Timo Koch committed
38
* Compile the executable `exercise_properties`
39
40

```bash
Timo Koch's avatar
Timo Koch committed
41
make exercise_properties
42
43
44
45
46
```

* Run the problem and inspect the result

```bash
Timo Koch's avatar
Timo Koch committed
47
./exercise_properties
48
```
49
Note: Because the input file has the same name as the executable, DuMu<sup>x</sup> will find it automatically.
50

Bernd Flemisch's avatar
Bernd Flemisch committed
51

52
<br><br><br>
Felix Weinhardt's avatar
Felix Weinhardt committed
53
### Task 3: Implement a custom local residual
Bernd Flemisch's avatar
Bernd Flemisch committed
54
55
<hr>

56
Types that are properties can be changed on the problem level by using the property system. In the following task, we implement our own 2p local residual, i.e. the class that computes the element residual in every Newton iteration. The file `mylocalresidual.hh` contains a copy of the original local residual class used for all immiscible models renamed to `template<class TypeTag> class MyLocalResidual`.
57

58
* Make DuMu<sup>x</sup> use this new local residual by including the header `mylocalresidual.hh` and setting the corresponding property in the `Property` namespace in the file `properties.hh`
59
60

```c++
61

62
63
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::TwoPIncompressible>
64
{
Bernd Flemisch's avatar
Bernd Flemisch committed
65
    using type = MyLocalResidual<TypeTag>;
66
67
68
};
```

Bernd Flemisch's avatar
Bernd Flemisch committed
69
Simplify the original local residual by using the assumption that only incompressible fluid phases are present. As a consequence, one can balance phase volume instead of phase mass:
70

Bernd Flemisch's avatar
Bernd Flemisch committed
71
* Eliminate the density from the `computeStorage` and the `computeFlux` methods.
72

73
* Adapt the relevant routine in the problem file such that volume instead of mass is injected. The density of the employed NAPL is 1460 kg/m<sup>3</sup> . For a first try, you can use the hardcoded value.
74

Bernd Flemisch's avatar
Bernd Flemisch committed
75
* Generalize your approach by using the component's `liquidDensity(t, p)` function instead of the hardcoded value.