Skip to content
Snippets Groups Projects
Commit 96f35439 authored by Martin Schneider's avatar Martin Schneider Committed by Leon Keim
Browse files

[ex][model][slides] Update Model Exercise Slides

[ex][model][slides] Replace discrete eq from first model slide

[ex][model][slides] move area in fluxes

[slides] fix typo

[ex][model][slides] Change discrete eq

[ex][model][slides] Proposel for new property instructions
parent cbf94508
No related branches found
No related tags found
1 merge request!241[ex][model] Update doc
Pipeline #46646 passed
......@@ -9,29 +9,27 @@ A DuMu^x^ model is an implementation of a discretized **mathematical model**, ge
## What is a DuMu^x^ model
Mathematical model (PDE):
$\begin{equation*}
\small
$$
\begin{aligned}
\frac{\partial S(u)}{\partial t} + \nabla \cdot \mathbf{F}(u) = q, \quad \forall (t,\mathbf{x}) \in (0,T] \times \Omega
\end{equation*}$
\end{aligned}
$$
<img src=img/model_domain_discretization.png width="100%">
Discrete model, e.g. using finite volumes:
$\begin{equation*}
\small
|B| \frac{S_h(\mathbf{u}^{n+1}_h) - S_h(\mathbf{u}^{n}_h)}{\Delta t} + \sum_{\sigma \in \Sigma_B} F_{B,\sigma}(\mathbf{u}^{n+1}_h) = \int_{B} q^{n+1} \, dx, \quad \forall t_{n+1}\leq T, \; \forall B
\end{equation*}$
## What is a DuMu^x^ model
Discrete model, e.g. using finite volumes:
$\begin{equation*}
Discrete model using finite volumes:
$$
\begin{aligned}
\small
|B| \frac{S_h(\mathbf{u}^{n+1}_h) - S_h(\mathbf{u}^{n}_h)}{\Delta t} + \sum_{\sigma \in \Sigma_B} F_{B,\sigma}(\mathbf{u}^{n+1}_h) = \int_{B} q \, dx, \quad \forall t_{n+1}\leq T, \; \forall B
\end{equation*}$
|B| \frac{S_B(\mathbf{u}^{n+1}_h) - S_B(\mathbf{u}^{n}_h)}{\Delta t} + \sum_{\sigma \in \Sigma_B} F_{B,\sigma}(\mathbf{u}^{n+1}_h) = |B| q_B(\mathbf{u}^{n+1}_h), \quad \forall t_{n+1}\leq T, \; \forall B
\end{aligned}
$$
* $S_h:$ storage term
* $B:$ control volume
* $S_B:$ storage term
* $F_{B,\sigma}:$ flux term over sub control volume face (scvf)
* $q:$ source term
* $q_B:$ source term
Where to implement these terms in DuMu^x^?
......@@ -51,9 +49,11 @@ Implements terms of a PDE in the functions
## Example: Diffusion equation
Mathematical model (PDE):
$\begin{equation}
\frac{\partial c}{\partial t} - \nabla \cdot (D \nabla c) = 0 \:\: \mathrm{in}\; \Omega \times (0,T] \\
\end{equation}$
$$
\begin{aligned}
\frac{\partial c}{\partial t} - \nabla \cdot (D \nabla c) = 0 \:\: \mathrm{in}\; \Omega \times (0,T]
\end{aligned}
$$
with
......@@ -65,9 +65,11 @@ with
## Example: Diffusion equation
Discrete model using the Box discretization:
$\begin{equation}
\vert B \vert \frac{c_B^{n+1}-c_B^{n}}{\Delta t} - \sum_{\sigma \in \Sigma_{B}} \left[ D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \vert \sigma \vert \right] = 0,
\end{equation}$
$$
\begin{aligned}
\vert B \vert \frac{c_B^{n+1}-c_B^{n}}{\Delta t} - \sum_{\sigma \in \Sigma_{B}} \vert \sigma \vert \left[ D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \right] = 0,
\end{aligned}
$$
with
......@@ -79,11 +81,13 @@ with
## Example: Diffusion equation
Discrete model using the Box discretization:
$\begin{equation}
\vert B \vert \frac{c_B^{n+1}-c_B^{n}}{\Delta t} - \sum_{\sigma \in \Sigma_{B}} \left[ D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \vert \sigma \vert \right] = 0,
\end{equation}$
$$
\begin{aligned}
\vert B \vert \frac{c_B^{n+1}-c_B^{n}}{\Delta t} - \sum_{\sigma \in \Sigma_{B}} \vert \sigma \vert \left[ D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \right] = 0,
\end{aligned}
$$
<img src=img/box_scv_scvf.png width="90%">
<img src=img/box_scv_scvf.png width="80%">
## `LocalResidual`
The local residual of the diffusion model:
......@@ -112,9 +116,11 @@ NumEqVector computeStorage(const Problem& problem,
## Flux term
$\begin{equation}
F_{B,\sigma} = -D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \vert \sigma \vert
\end{equation}$
$$
\begin{aligned}
F_{B,\sigma} = - \vert \sigma \vert D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma}
\end{aligned}
$$
with
......@@ -182,9 +188,19 @@ For its implementation different model-specific properties have to be set
# Model properties
## Model properties
All properties are defined within the namespace `Dumux::Properties`.
```cpp
namespace Dumux::Properties {
//define all properties
} // end namespace Dumux::Properties
```
## Model type tag
The property tag is an empty struct with the respective name, e.g. `DiffusionModel`
The property type tag is an empty struct with the respective name, e.g. `DiffusionModel`.
All properties related to the desired model can be attributed using the property type tag.
```cpp
namespace Dumux::Properties::TTag {
......@@ -192,18 +208,11 @@ namespace Dumux::Properties::TTag {
struct DiffusionModel {};
} // end namespace Dumux::Properties::TTag
```
## Model properties
We can set nodel properties for the `DiffusionModel` type tag
All properties are defined within the namespace `Dumux::Properties`
```cpp
namespace Dumux::Properties {
//define all properties
} // end namespace Dumux::Properties
```
## Defining model properties
The type of the local residual is the class `DiffusionModelLocalResidual` defined from earlier
```cpp
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::DiffusionModel>
......@@ -211,7 +220,9 @@ struct LocalResidual<TypeTag, TTag::DiffusionModel>
```
## Defining model properties
The model traits specify information about the model:
```cpp
template<class TypeTag>
struct ModelTraits<TypeTag, TTag::DiffusionModel>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment