From 030de211d6da27a38e0275ede2a2722096c32d45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Sat, 1 Apr 2023 20:05:38 +0200
Subject: [PATCH] [material] some improvements

---
 slides/materialsystem.md | 194 +++++++++++++++++++--------------------
 1 file changed, 93 insertions(+), 101 deletions(-)

diff --git a/slides/materialsystem.md b/slides/materialsystem.md
index fb5fe17a..22021f03 100644
--- a/slides/materialsystem.md
+++ b/slides/materialsystem.md
@@ -1,116 +1,107 @@
 ---
-title: Material system
+title: The DuMuX Material System
 ---
 
-# Introduction to DuMuX- Material system
 
-## Challenges in simulating porous media:
+## Challenges in simulating porous media
 
 * Highly heterogeneous distribution of parameters and complex nonlinear material laws
 
-* Strong interconnection of properties **--->** difficult to achieve modularity
+* Strong interconnection of properties $\rightarrow$ difficult to achieve __modularity__
 
-## Modular structure:
+## How to achieve modularity?
 
-<ins> User-defined parameters and relationships: </ins>
+- User-defined parameters and relationships:
+    - Components / Fluid system / Binary coefficients
+    - Solid system
+    - Fluid-matrix interactions
+    - Chemistry
+- Dumux-specific containers and solvers:
+    - Fluid states
+    - Solid states
+    - Constraint solvers
 
-* Components
-* Fluid system
-* Solid system
-* Binary coefficients
-* Fluid-matrix interactions
-* Chemistry
 
-## <ins> Dumux-specific containers and solvers </ins>
 
-- Fluid states
-- Solid states
-- Constraint solvers
+# Components
 
-# Material system: Component
+## Components
 
-## 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
+* Define **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>
+## Example implementations
 
 * _H2O_ : pure water, properties by IAPWS-97 or simplified
 
 * _Brine_ : water with a given salt concentration
 
-# Material system: Fluid system
 
-## Fluid system
+# Fluid systems
 
-<img src="img/fluidsystem.png" width="300"/>
+## Fluid systems
 
-## <ins> What it does: </ins>
+Express the **thermodynamic relations between fluid quantities** (e.g. calculation of density or viscosity based on composition; fugacity coefficient based on temperature and pressure...)
 
-Expresses the **thermodynamic relations between fluid quantities** (e.g. calculation of density or viscosity based on composition, fugacity coefficient based on temperature and pressure...)
+<img src="img/fluidsystem.png" width="400"/>
 
-## <ins> Example implementations: </ins>
+
+## Example implementations
 
 * _TwoPImmiscible_ : two immiscible fluid phases
 
 * _H2OAir_ : gas and liquid phase with components water and air
 
-# Material system: Binary coefficients
+
+# Binary coefficients
 
 ## Binary coefficients
 
-<img src="img/binarycoefficients.png" width="350"/>
+  **Contain** data and equations required for binary mixtures, for instance, binary diffusion coefficients or coefficients needed for constitutive relationships (e.g. Henry coefficient)
 
-## <ins> What it does: </ins>
+<img src="img/binarycoefficients.png" width="500"/>
 
-  **Contains** data and equations required for binary mixtures (e.g. binary diffusion coefficients, coefficients needed for constitutive relationships (like Henry coefficient))
 
-## <ins> Example implementations: </ins>
+## Example implementations
 
 * _H2O_Air_ : Henry coefficient, gas diffusion coefficient, liquid diffusion coefficent for water and air
 
-# Material system: Solid system
 
-## Solid system
+# Solid systems
 
-<img src="img/solidsystem.png" width="300"/>
+## Solid systems
 
-## <ins> What it does: </ins>
+Express the **thermodynamic properties of the solid matrix** (e.g. calculation of the solid density and solid heat capacity based on the composition)
 
-Expresses the **thermodynamic properties of the solid matrix** (e.g. calculation of the solid density and solid heat capacity based on the composition...)
+<img src="img/solidsystem.png" width="400"/>
 
-<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._
 
 
-## <ins> Implementations: </ins>
+## Implementations
 
 * _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
 
-## Fluid-materix interactions
+# Fluid-matrix interactions
 
-<img src="img/fluidmatrixinteractions.png" width="250"/>
-
-## <ins> What it does: </ins>
+## Fluid-matrix interactions
 
 * Description of the **interaction of the fluid phases with the porous medium** (e.g. capillary pressure-saturation and relative permeability relationships)
 * Through modular adapters, regularization schemes can be imposed for extreme values
 
-## <ins> Example implementations: </ins>
+<img src="img/fluidmatrixinteractions.png" width="250"/>
+
+
+## Example implementations
 
-* Available parametrizations for the capillary pressure-saturation relationship are:
-    * _Van Genuchten_
-    * _Brooks Corey_
+* Capillary pressure-saturation relation after _Van Genuchten_
+* Capillary pressure-saturation relation after _Brooks and Corey_
+* Effective diffusivity after _Millington and Quirk_
 
 ## Van-Genuchten
 $\begin{equation}
@@ -119,7 +110,7 @@ p_c = \frac{1}{\alpha}\left(S_e^{-1/m} -1\right)^{1/n}
 
 <img src="img/pc-Sw_VanGenuchten.png" width="500"/>
 
-**--->** Necessary are here the empirical parameters $\alpha$ and $n$.
+$\rightarrow$ the empirical parameters $\alpha$ and $n$ have to be specified
 
 ## Brooks-Corey
 $\begin{equation}
@@ -128,76 +119,73 @@ p_c = p_d S_e^{-1/\lambda}
 
 <img src="img/pc-Sw_BrooksCorey.png" width="500"/>
 
-**--->** Necessary parameters are here the entry pressure $p_d$ and the shape factor $\lambda$.
+$\rightarrow$ the empirical parameters $p_d$ and $\lambda$ have to be specified
 
-# Material system: Chemistry
+
+# Chemistry
 
 ## Chemistry
 
-<img src="img/chemistry.png" width="200"/>
+Reactions between different components. They are extra models or are incoporated via the introduction of a source term.
 
-## <ins> What it does: </ins>
+<img src="img/chemistry.png" width="350"/>
 
-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._
+## Example implementations
 
-## <ins> Example implementations: </ins>
 Expresses the **electrochemical models for a fuel cell application**:
 
 * _Electrochemistry_ : for isothermal system
 * _Electrochemistryni_ : for non-isothermal system
 
-# Material system: Fluid state
 
-## Fluid state
+# Fluid states
 
-<img src="img/fluidstate.png" width="800"/>
+## Fluid states
 
-## <ins> What it does: </ins>
+ * **Store** the complete thermodynamic configuration of a system at a given spatial and temporal position (e.g. saturation, mole fraction, enthalpy)
+ * **Provide access** methods to all thermodynamic quantities (e.g. saturation, mole fraction, enthalpy)
 
- * **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)
+<img src="img/fluidstate.png" width="800"/>
 
-## <ins> Example implementations: </ins>
+
+## Example implementations
 
  * _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
+# Solid states
 
-## Solid state
+## Solid states
 
-<img src="img/solidstate.png" width="800"/>
+ * **Store** the complete solid configuration of a system at a given spatial and temporal position (e.g. solid volume fractions, solid heat capacity)
+ * **Provide** access methods to all solid quantities (e.g. porosity, density, temperature)
 
-## <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)
+<img src="img/solidstate.png" width="800"/>
 
-## <ins> Example implementations: </ins>
+## Example implementations
 
 * _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.
 
-# Material system: Constraint Solver
+# Constraint Solvers
 
-## Constraint solver
+## Constraint solvers
 
-<img src="img/constraintsolver.png" width="1000"/>
+**Connect** the thermodynamic relations expressed by fluid systems with the thermodynamic quantities stored by fluid states (e.g. mole fraction, density)
 
-## <ins> What it does: </ins>
+<img src="img/constraintsolver.png" width="800"/>
 
-**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>
+## Example implementation
 
 _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
 
-## Component **--->** fluid system
+# Example: From components to fluid system
+
+## Components $\rightarrow$ fluid system
 
 <img src="img/component-fluidsystem.png" width="500"/>
 
@@ -206,18 +194,19 @@ _CompositionFromFugacities_ : takes all component fugacities, the temperature an
  * Components: _H2O_, _Air_
  * Fluid system: _TwoPTwoC_
 
-## Include headers in properties file: components
+## Relevant headers
 
 ```cpp
-// The two-phase fluid system for compents water and air
+// Predefined fluid system for components water and air
 #include <dumux/material/fluidsystems/h2oair.hh>
-// The water component
+
+// H2OAir allows to customize the water phase. Here, we want
+// to use tabulated H2O for fast evaluation of the properties.
 #include <dumux/material/components/h2o.hh>
-// The air component
-#include <dumux/material/components/air.hh>
+#include <dumux/material/components/tabulatedcomponent.hh>
 ```
 
-## Specify fluid system in properties file:
+## Setting the `FluidSystem` property
 
 ```cpp
 template<class TypeTag>
@@ -225,18 +214,19 @@ struct FluidSystem<TypeTag, TTag::H2OAir>
 {
 private:
     using Scalar = GetPropType<TypeTag, Properties::Scalar>;
+    using Liquid = Components::TabulatedComponent<Components::H2O<Scalar>>;
+    using Policy = FluidSystems::H2OAirDefaultPolicy<
+        /*fastButSimplifiedRelations=*/true
+    >;
 public:
-    using type = FluidSystems::H2OAir<Scalar,
-                 Components::TabulatedComponent
-                 <Components::H2O<Scalar>>,
-                 FluidSystems::H2OAirDefaultPolicy
-                 </*fastButSimplifiedRelations=*/true>,
-                 true /*useKelvinEquation*/>;
+    using type = FluidSystems::H2OAir<
+        Scalar, Liquid, Policy, /*useKelvinVapourPressure*/true
+    >;
 };
 ```
 
 
-# Example: From component to solid system
+# Example: From components to solid system
 
 ## Example: 2 phases, miscible
 
@@ -253,21 +243,23 @@ 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>;
+    using type = SolidSystems::CompositionalSolidPhase<
+        Scalar, ComponentOne, ComponentTwo
+    >;
 };
 ```
 
 
 # Exercise
 
-## <ins> Tasks: </ins>
+## Tasks:
 
 1. Get familiar with the code
 2. 2p model: Implement a new component (incompressible and compressible)
 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
+5. Advanced: Use van Genuchten relationship with parameters: $\alpha = 0.0037$ and $\alpha_\mathrm{lense} = 0.00045$, $n = 4.7$ and $n_\mathrm{lense} = 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
+## First step:
 
+Go to <https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/tree/master/exercises/exercise-fluidsystem> and check out the README
-- 
GitLab