Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
---
title: Material system
author: Tufan Ghosh
---
# Introduction to DuMux - Material system
## The DuMux Development Team, IWS-LH2, University of Stuttgart
## April 3-5, 2023
# Material system
## Challenges in simulating porous media:
* Highly heterogeneous distribution of parameters and complex nonlinear material laws
* Strong interconnection of properties **--->** difficult to achieve modularity
# Material system
## Modular structure by separating the material system into the following parts
### <ins> User-defined parameters and relationships describing the thermodynamical & electrochemical behavior of the system </ins>
- Components
- Fluid system
- Solid system
- Binary coefficients
- Fluid-matrix interactions
- Chemistry
- Eos
### <ins> Dumux-specific containers and solvers </ins>
- Fluid states
- Solid states
- Constraint solvers
# Material system: Component
<img src="img/component.png" width="200"/>
## <ins> What it does: </ins>
* **Thermodynamic relations** (e.g. molar mass, vapor pressure, density) of a **single chemical species** or a fixed mixture of species
* Provide a convenient way to access these quantities
* Not supposed to be used by models directly
## <ins> Example implementations: </ins>
* _H2O_: pure water, properties by IAPWS-97 or simplified
* _Brine_: water with a given salt concentration
# Material system: Fluid system
<img src="img/fluidsystem.png" width="300"/>
## <ins> What it does: </ins>
* Expresses the **thermodynamic relations between fluid quantities** (e.g. calculation of density or viscosity based on composition, fugacity coefficient based on temperature and pressure...)
* Stateless classes (all member functions are static)
## <ins> Example implementations: </ins>
* _TwoPImmiscible_: two immiscible fluid phases
* _H2OAir_: gas and liquid phase with components water and air
# Material system: Binary coefficients
<img src="img/binarycoefficients.png" width="350"/>
## <ins> What it does: </ins>
**Contains** data required for binary mixtures (e.g. binary diffusion coefficients, coefficients needed for constitutive relationships (like Henry coefficient))
## <ins> Example implementations: </ins>
* _H2O_Air_
* _Brine_CO2_
# Material system: Solid system
<img src="img/solidsystem.png" width="300"/>
## <ins> What it does: </ins>
* Expresses the **thermodynamic properties of the solid matrix** (e.g. calculation of the solid density and solid heat capacity based on the composition...)
* Stateless classes (all member functions are static)
## <ins> Implementations: </ins>
* _OneCSolid_: inert solid matrix of one solid component (e.g. granite)
* _CompositionalSolidPhase_: composed solid matrix of inert or reactive components (e.g. NaCl and granite)
# Material system: Fluid-matrix interactions
<img src="img/fluidmatrixinteractions.png" width="250"/>
## <ins> What it does: </ins>
* Description of the **interaction of the fluid phases with the porous medium** (e.g. capillary pressure and relative permeability relationships)
* Through modular adapters, regularization schemes can be imposed for extreme values
## <ins> Example implementations: </ins>
* _VanGenuchten_
* _BrooksCorey_
# Material system: Chemistry
<img src="img/chemistry.png" width="200"/>
## <ins> What it does: </ins>
* Expresses the **electrochemical models for a fuel cell application** (e.g. calculattion of reaction sources with an electrochemical model approach)
* Stateless classes (all member functions are static)
## <ins> Example implementations: </ins>
* _Electrochemistry_: for isothermal system
* _Electrochemistryni_: for non-isothermal system
# Material system: Equation of state (eos)
<img src="img/eos.png" width="250"/>
## <ins> What it does: </ins>
* Implements the **equation of state** for liquids and gases, and also for mixture (e.g. compute vapor pressure, molar volume, etc.)
* Stateless classes (all member functions are static)
## <ins> Example implementations: </ins>
* _Pengrobinson_: eos for liquid and gas
* _Pengrobinsonmixture_: eos for a mixture
# Material system: Fluid state
<img src="img/fluidstate.png" width="800"/>
## <ins> What it does: </ins>
* **Stores** the complete thermodynamic configuration of a system at a given spatial and temporal position (e.g. saturation, mole fraction, enthalpy)
* **Provides access** methods to all thermodynamic quantities (e.g. saturation, mole fraction, enthalpy)
# Material system: Fluid state
<img src="img/fluidstate.png" width="800"/>
## <ins> Example implementations: </ins>
* _ImmiscibleFluidState_: assumes immiscibility of the fluid phases. Phase compositions and fugacity coefficients do not need to be stored explicitly
* _CompositionalFluidState_: assumes thermodynamic equilibrium, only a single temperature needs to be stored
# Material system: Solid state
<img src="img/solidstate.png" width="800"/>
## <ins> What it does: </ins>
* **Stores** the complete solid configuration of a system at a given spatial and temporal position (e.g. solid volume fractions, solid heat capacity)
* **Provides** access methods to all solid quantities (e.g. porosity, density, temperature)
# Material system: Solid state
<img src="img/solidstate.png" width="800"/>
## <ins> Example implementations: </ins>
* _InertSolidState_: assumes an inert solid phase. Solid volume fractions do not change
* _CompositionalSolidState_: assumes a solid matrix composed out of two components. The volume fractions can change and properties such as heat capacity are adapted
# Material system: Constraint Solver
<img src="img/constraintsolver.png" width="1000"/>
# Material system: Constraint Solver
## <ins> What it does: </ins>
**Connects** the thermodynamic relations expressed by fluid systems with the thermodynamic quantities stored by fluid states (e.g. mole fraction, density)
## <ins> Example implementation: </ins>
CompositionFromFugacities: takes all component fugacities, the temperature and pressure of a phase as input and calculates the phase composition
# Example: From component to fluid system
<img src="img/component-fluidsystem.png" width="500"/>
## Example: 2 phases, immiscible
* Components: _H2O_, _Air_
* Fluid system: _TwoPImmiscible_
# Example: From component to fluid system
## Include headers in properties file:
```
// The numerical model
#include <dumux/porousmediumflow/2p/implicit/model.hh>
// The water component
#include <dumux/material/components/h2o.hh>
// The air component
#include <dumux/material/components/air.hh>
// The two-phase immiscible fluid system
#include <dumux/material/fluidsystems/2pimmiscible.hh>
// Liquid phase
#include <dumux/material/fluidsystems/1pliquid.hh>
// Gas phase
#include <dumux/material/fluidsystems/1pgas.hh>
// Solid phase
#include <dumux/material/solidsystems/1csolid.hh>
```
# Example: From component to fluid system
## Specify fluid system in properties file:
```
// we use the immiscible fluid system here
SET_PROP(WaterAirProblem, FluidSystem)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using LiquidPhase = typename FluidSystems::LiquidPhase<Scalar, H2O<Scalar> >;
using GasPhase = typename FluidSystems::GasPhase<Scalar, Air<Scalar> >;
public:
using type = typename FluidSystems::TwoPImmiscible<Scalar, LiquidPhase,
GasPhase> ;
};
```
# Example: From component to solid system
## Specify solid system in properties file:
```
// we use the inert solid system here
SET_PROP(WaterAirProblem, SolidSystem)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using ComponentT = Components::Granite<Scalar>;
public:
using type = SolidSystems::InertSolidphase<Scalar, ComponentT>;
};
```
**Note:** Specifying a solid system is only necessary if you work with a non-isothermal or mineralization model. If no solid system is specified in the problem file, the default is the inert solid phase with the constant component. For the constant component you can set properties in the input file.
# Exercise
## <ins> Tasks: </ins>
1. Get familiar with the code
2. 2p model: Implement a new component
- 2.1: Incompressible component
- 2.2: Compressible component
3. 2p2c model: Implement a new fluid system
4. Change wettability of the porous medium
5. Advanced: Use van Genuchten relationship with parameters: alpha = 0.0037 and alphalense = 0.00045, n = 4.7 and nlense = 7.3
**First step:** Go to <https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/tree/master/exercises/exercise-fluidsystem> and check out the README