README.md 7.59 KB
Newer Older
1
# Exercise Biomineralization
Simon Scholz's avatar
Simon Scholz committed
2

3
The aim of this exercise is to get a first glimpse at the _DuMuX_ way of implementing mineralization and reaction processes. In the scope of this exercise, the setting of boundary conditions is revisited and a new reaction term is implemented.
Simon Scholz's avatar
Simon Scholz committed
4
5
6

## Problem set-up

7
The domain has a size of 20 x 15 m and contains a sealing aquitard in the middle. The aquitard is interrupted by a "fault zone" and thereby connects the upper drinking water aquifer and the lower CO2-storage aquifer. Initially, the domain is fully water saturated and biofilm is present in the lower CO2-storage aquifer. Calcium and urea are injected in the upper drinking water aquifer by means of a Neumann boundary condition. The remaining parts of the upper and the entire lower boundary are Neumann no-flow while on the right side a Dirichlet boundary conditions is applied according to the initial values.
Simon Scholz's avatar
Simon Scholz committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21


Disclaimer: Please note, that this is not a realistic scenario. One does not want to store gaseous CO2 in such a subcritical setting.

![](../extradoc/exercisebiomin_setup.png)


## Preparing the exercise

* Navigate to the directory `dumux-course/exercises/exercise-biomineralization`

### 1. Getting familiar with the code

Locate all the files you will need for this exercise
Simon Scholz's avatar
Simon Scholz committed
22
* The __main file__ : `exercisebiomin.cc`
Simon Scholz's avatar
Simon Scholz committed
23
24
25
26
27
28
29
30
31
32
33
34
35
* The __input file__: `exercisebiomin.input`
* The __problem file__ : `biominproblem.hh`
* The __spatial parameters file__: `biominspatialparams.hh`

Furthermore you will find the following folders:
* `chemistry`: Provides a way to formulate reactions in therms of source/sink terms.
* `components`: Provides some additional components e.g. biofilm and urea.
* `fluidsystems`: Stores headers containing data/methods on fluid mixtures of pure components.
* `solidsystems`:  Stores headers containing data/methods on solid mixtures of the components.

To see more chemistry, components, fluidsystems and solidsystems implementations, have a look at the folder `dumux/material`.

__Special note on solidsystems:__
36
There are two types of solid components. Reactive and inert. For each reactive component one mass balance is solved. The inert components compose the "unchanging" (inert) rock matrix.
Simon Scholz's avatar
Simon Scholz committed
37
38
39

### 2. Implement a chemical equation

40
In the following the basic steps required to set the new chemical equation are outlined. Here, this is done in the __chemistry__ folder in the prepared file: `simplebiominreactions.hh` within the function reactionSource().
Simon Scholz's avatar
Simon Scholz committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Please be aware, that the chemistry file already provides some convenience functions (e.g. ``moleFracToMolality()``).

__Task__

Add a kinetic reaction by first calculating the current mass of available biofilm. Note that the density and volume fraction of biofilm are already defined for you.

$`\displaystyle mass_{biofilm} = \rho_{biofilm} * \phi_{biofilm}`$

Next, we want to implement the rate of ureolysis. This can be done with the following simplified equation:

$`\displaystyle  r_{urea} = k_{urease} * Z_{urease,biofilm} * m_{urea} / (K_{urea} + m_{urea})`$,

where $`\displaystyle  r_{urea}`$ is the rate of ureolysis, $`\displaystyle  k_{urease}`$ the urease enzyme activity, $`\displaystyle m_{urea}`$ the molality of urea and $`\displaystyle K_{urea}`$ the half-saturation constant for urea for the ureolysis rate.

Note, that the urease concentration $`\displaystyle Z_{urease,biofilm}`$ has a kinetic term of urease production per biofilm :

$`\displaystyle Z_{urease,biofilm} = k_{urease,biofilm} * mass_{biofilm}`$

The last step is defining the source term for each component according to the chemical equation:

61
$`\displaystyle Ca^{2+} + CO(NH)_{2} + 2 H_{2}O -> 2 NH_{4}^{+} + CaCO_{3}`$
Simon Scholz's avatar
Simon Scholz committed
62
63
64

which is:

65
Calcium ion + Urea + 2 Water → 2 Ammonium ions + Calcite
Simon Scholz's avatar
Simon Scholz committed
66

67
68
Note that since the chemistry is simplified for this dumux-course example, the component Ammonium is neglected and you thus cannot set its source term, even though it is produced in the real reaction.

Simon Scholz's avatar
Simon Scholz committed
69
70
### 3. Make use of your newly created chemical equation

71
To enable your newly created chemical equation, the chemistry file has to be included in your problem file.
Simon Scholz's avatar
Simon Scholz committed
72
73
74
75
76

```c++
#include "chemistry/simplebiominreactions.hh"   // chemical reactions
```

77
Additionally the TypeTag of your chemistry file needs to be set in the problem file, within the class ExerciseFourBioMinProblem:
Simon Scholz's avatar
Simon Scholz committed
78
79

```c++
80
using Chemistry = typename Dumux::SimpleBiominReactions<NumEqVector, VolumeVariables>;
Simon Scholz's avatar
Simon Scholz committed
81
82
83
84
```

__Task__

85
Now the source/sink term can be updated in the problem file in its function source(). You can access the newly created chemistry file and call the reactionSource()-function from it. Make sure to call the chemistry.reactionSource()-function with the correct arguments. Return the updated source terms in the end.
Simon Scholz's avatar
Simon Scholz committed
86
The volume variables can be set using the element volume variables and the sub control volume:
Simon Scholz's avatar
Simon Scholz committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

```c++
const auto& volVars = elemVolVars[scv];
```

In order to compile and execute the program, change to the build-directory

```bash
cd build-cmake/exercises/exercise-biomineralization
```

and type

```bash
make exercisebiomin
102
./exercise_biomin exercise_biomin.input
Simon Scholz's avatar
Simon Scholz committed
103
104
105
106
107
108
109
110
```

### 4. Seal leakage pathway in the aquitard

 In the input file, you will find some parameters concerning the mineralization process. We want to seal the leakage pathway in the aquitard. The  leakage pathway is assumed to be sealed when the porosity is reduced to `0.07` or less.

 __Task:__

Simon Scholz's avatar
Simon Scholz committed
111
 Vary input parameters in the input file to seal the leakage pathway. The overall injection duration in days (`InjBioTime`), the initial biomass (`InitBiofilm`), the overall injection rate (`InjVolumeflux`) and the injected concentrations of urea and calcium (`ConcUrea` and `ConcCa`) are available for variation. When changing the concentrations, keep in mind that both urea and calcium are needed for the reaction and their mass ratio should be 2 calcium to 3 urea for a good molar ratio of 1 mol urea per 1 mol of calcium, see also the molar masses in the component files.
Simon Scholz's avatar
Simon Scholz committed
112
113
114
115
116
117
118
119
120
121
122
123

 The result for the porosity should like like this:

 ![](../extradoc/exercisebiomin_porosityFinal.png)


### 5. CO2 injection to test aquitard integrity

Now the sealed aquitard is tested with a CO2-Injection into the lower CO2-storage aquifer.

__Task:__

124
Implement a new boundary condition on the left boundary, injecting CO2 from 2 m to 3 m from the bottom. Make sure, that the injection time for the calcium and urea is finished. You can use the predefined value `gasFlux` directly and divide it by the molar mass of CO2.
Simon Scholz's avatar
Simon Scholz committed
125
126
127
128
Run two simulations and compare them side by side by creating two input files, or overwriting the input file in the command line:
```bash
./exercisebiomin -Problem.Name biominNoUrea -Injection.ConcUrea 0
```
129
The result for the biomineralization process during the CO2 injection should look like this:
Simon Scholz's avatar
Simon Scholz committed
130
131
132
133
134

![](../extradoc/exercisebiomin_injectionFinal.png)

### Bonus: Paraview Magic: Compare different results using Programmable Filter

Simon Scholz's avatar
Simon Scholz committed
135
In the last step, the manual comparison of the results can be quite difficult. Paraview offers the option to use programmable python filters. To use them, make sure two result files with __different names__ are loaded. Mark both of them and click on `Filters --> Alphabetical --> Programmable Filter`. Now a new field opens on the left side. Copy the following lines there:
Simon Scholz's avatar
Simon Scholz committed
136
137

```python
138
139
140
S_gas_0 = inputs[0].CellData['S_gas'];
S_gas_1 = inputs[1].CellData['S_gas'];
output.CellData.append(abs(S_gas_0-S_gas_1),'diffS_gas');
Simon Scholz's avatar
Simon Scholz committed
141
142
```

143
Click `Apply` and select `diffS_gas` as new output. You should now see the difference between the two result files. You can also change the output to a not absolute value by changing the last line to:
Simon Scholz's avatar
Simon Scholz committed
144
145

```python
146
output.CellData.append((S_gas_0-S_gas_1),'diffS_gas');
Simon Scholz's avatar
Simon Scholz committed
147
```