Skip to content
Snippets Groups Projects
materialsystem.md 8.28 KiB
Newer Older
Tufan Ghosh's avatar
Tufan Ghosh committed
---
title: Material system
---

Roman Winter's avatar
Roman Winter committed
# Introduction to DuMuX- Material system
Tufan Ghosh's avatar
Tufan Ghosh committed

## Challenges in simulating porous media:

* Highly heterogeneous distribution of parameters and complex nonlinear material laws

* Strong interconnection of properties **--->** difficult to achieve modularity

Roman Winter's avatar
Roman Winter committed
## Modular structure:
Roman Winter's avatar
Roman Winter committed
<ins> User-defined parameters and relationships: </ins>
Roman Winter's avatar
Roman Winter committed
* Components
* Fluid system
* Solid system
* Binary coefficients
* Fluid-matrix interactions
* Chemistry
Roman Winter's avatar
Roman Winter committed
## <ins> Dumux-specific containers and solvers </ins>
Roman Winter's avatar
Roman Winter committed
- Fluid states
- Solid states
- Constraint solvers
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Component

Roman Winter's avatar
Roman Winter committed
## Component

Tufan Ghosh's avatar
Tufan Ghosh committed
<img src="img/component.png" width="200"/>

## <ins> What it does: </ins>

Roman Winter's avatar
Roman Winter committed
* **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
Tufan Ghosh's avatar
Tufan Ghosh committed

## <ins> Example implementations: </ins>

Roman Winter's avatar
Roman Winter committed
* _H2O_ : pure water, properties by IAPWS-97 or simplified
Roman Winter's avatar
Roman Winter committed
* _Brine_ : water with a given salt concentration
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Fluid system

Roman Winter's avatar
Roman Winter committed
## Fluid system

Tufan Ghosh's avatar
Tufan Ghosh committed
<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...)
Tufan Ghosh's avatar
Tufan Ghosh committed

## <ins> Example implementations: </ins>

Roman Winter's avatar
Roman Winter committed
* _TwoPImmiscible_ : two immiscible fluid phases

* _H2OAir_ : gas and liquid phase with components water and air
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Binary coefficients

Roman Winter's avatar
Roman Winter committed
## Binary coefficients

Tufan Ghosh's avatar
Tufan Ghosh committed
<img src="img/binarycoefficients.png" width="350"/>

## <ins> What it does: </ins>

  **Contains** data and equations required for binary mixtures (e.g. binary diffusion coefficients, coefficients needed for constitutive relationships (like Henry coefficient))
Roman Winter's avatar
Roman Winter committed
## <ins> Example implementations: </ins>
* _H2O_Air_ : Henry coefficient, gas diffusion coefficient, liquid diffusion coefficent for water and air
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Solid system

Roman Winter's avatar
Roman Winter committed
## Solid system

Tufan Ghosh's avatar
Tufan Ghosh committed
<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...)

<ins> Note to solid system </ins>

_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._

Tufan Ghosh's avatar
Tufan Ghosh committed

## <ins> Implementations: </ins>

Roman Winter's avatar
Roman Winter committed
* _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)
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Fluid-matrix interactions

Roman Winter's avatar
Roman Winter committed
## Fluid-materix interactions

Tufan Ghosh's avatar
Tufan Ghosh committed
<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-saturation and relative permeability relationships)
Roman Winter's avatar
Roman Winter committed
* Through modular adapters, regularization schemes can be imposed for extreme values

Tufan Ghosh's avatar
Tufan Ghosh committed
## <ins> Example implementations: </ins>
* Available parametrizations for the capillary pressure-saturation relationship are:
    * _Van Genuchten_
    * _Brooks Corey_

## Van-Genuchten
$\begin{equation}
p_c = \frac{1}{\alpha}\left(S_e^{-1/m} -1\right)^{1/n}
\end{equation}$

<img src="img/pc-Sw_VanGenuchten.png" width="500"/>

**--->** Necessary are here the empirical parameters $\alpha$ and $n$.

## Brooks-Corey
$\begin{equation}
p_c = p_d S_e^{-1/\lambda}
\end{equation}$

<img src="img/pc-Sw_BrooksCorey.png" width="500"/>

**--->** Necessary parameters are here the entry pressure $p_d$ and the shape factor $\lambda$.
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Chemistry

Roman Winter's avatar
Roman Winter committed
## Chemistry

Tufan Ghosh's avatar
Tufan Ghosh committed
<img src="img/chemistry.png" width="200"/>

## <ins> What it does: </ins>

Reactions between different components. There are extra models or they are realized with the introduction of a source term.

**Note:** _This contains some specific example implementations. One can implement specific things according to their need._
Tufan Ghosh's avatar
Tufan Ghosh committed

## <ins> Example implementations: </ins>
Expresses the **electrochemical models for a fuel cell application**:

Roman Winter's avatar
Roman Winter committed
* _Electrochemistry_ : for isothermal system
* _Electrochemistryni_ : for non-isothermal system
Tufan Ghosh's avatar
Tufan Ghosh committed

# Material system: Fluid state

Roman Winter's avatar
Roman Winter committed
## Fluid state

Tufan Ghosh's avatar
Tufan Ghosh committed
<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)

## <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.
Tufan Ghosh's avatar
Tufan Ghosh committed
# Material system: Solid state

Roman Winter's avatar
Roman Winter committed
## Solid state

Tufan Ghosh's avatar
Tufan Ghosh committed
<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)

## <ins> Example implementations: </ins>

* _InertSolidState_ : assumes an inert solid phase. Solid volume fractions do not change. This is the **default**.
* _CompositionalSolidState_ : assumes a solid matrix composed out of two components. The volume fractions can change and properties such as heat capacity are adapted.
Roman Winter's avatar
Roman Winter committed
# Material system: Constraint Solver
Roman Winter's avatar
Roman Winter committed
## Constraint solver
Roman Winter's avatar
Roman Winter committed
<img src="img/constraintsolver.png" width="1000"/>
Tufan Ghosh's avatar
Tufan Ghosh committed

## <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)
Tufan Ghosh's avatar
Tufan Ghosh committed
## <ins> Example implementation: </ins>

_CompositionFromFugacities_ : takes all component fugacities, the temperature and pressure of a phase as input and calculates the phase composition
Tufan Ghosh's avatar
Tufan Ghosh committed
# Example: From component to fluid system

## Component **--->** fluid system
Tufan Ghosh's avatar
Tufan Ghosh committed
<img src="img/component-fluidsystem.png" width="500"/>

## Example: 2 phases, miscible
Tufan Ghosh's avatar
Tufan Ghosh committed

 * Components: _H2O_, _Air_
 * Fluid system: _TwoPTwoC_
Roman Winter's avatar
Roman Winter committed
## Include headers in properties file: components
Roman Winter's avatar
Roman Winter committed
```cpp
// The two-phase fluid system for compents water and air
#include <dumux/material/fluidsystems/h2oair.hh>
Tufan Ghosh's avatar
Tufan Ghosh committed
// The water component
#include <dumux/material/components/h2o.hh>
// The air component
#include <dumux/material/components/air.hh>
Tufan Ghosh's avatar
Tufan Ghosh committed
## Specify fluid system in properties file:

Roman Winter's avatar
Roman Winter committed
```cpp
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::H2OAir>
Tufan Ghosh's avatar
Tufan Ghosh committed
{
private:
    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Tufan Ghosh's avatar
Tufan Ghosh committed
public:
    using type = FluidSystems::H2OAir<Scalar,
                 Components::TabulatedComponent
                 <Components::H2O<Scalar>>,
                 FluidSystems::H2OAirDefaultPolicy
                 </*fastButSimplifiedRelations=*/true>,
                 true /*useKelvinEquation*/>;
Tufan Ghosh's avatar
Tufan Ghosh committed
};
```


# Example: From component to solid system

## Example: 2 phases, miscible

 * Components: _CaO_, _CaO2H2_ (slaked lime)
 * Solid system: _OnePNCMin_

Tufan Ghosh's avatar
Tufan Ghosh committed
## Specify solid system in properties file:

Roman Winter's avatar
Roman Winter committed
```cpp
// The solid system
template<class TypeTag>
struct SolidSystem<TypeTag, TTag::ThermoChem>
    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
    using ComponentOne = Components::ModifiedCaO<Scalar>;
    using ComponentTwo = Components::CaO2H2<Scalar>;
    using type = SolidSystems::CompositionalSolidPhase
                 <Scalar, ComponentOne, ComponentTwo>;
Tufan Ghosh's avatar
Tufan Ghosh committed
};
```


# Exercise

## <ins> Tasks: </ins>

1. Get familiar with the code
Roman Winter's avatar
Roman Winter committed
2. 2p model: Implement a new component (incompressible and compressible)
Tufan Ghosh's avatar
Tufan Ghosh committed
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