diff --git a/slides/index.md b/slides/index.md index b35e0f2d8f56cd4e1e84ae192b9b8f85ae3b5f0c..c155343f15abd089109483b1adc9700d691389be 100644 --- a/slides/index.md +++ b/slides/index.md @@ -24,7 +24,7 @@ subtitle: Overview * [Property System](./properties.html) * [Constitutive models (material)](./materialsystem.html) -* [New DuMu^x^ model equations](./model.html) +* [Implementing a new model in DuMu^x^](./model.html) * [New Dune module](./dunemodule.html) ## diff --git a/slides/model.md b/slides/model.md index 6c2a4c57f75ce9d857b8c1ff6bb4e90f0fcf3b7a..76bef5a1ab6bba11c3dfc077d18f4e3c3c4e8448 100644 --- a/slides/model.md +++ b/slides/model.md @@ -1,8 +1,8 @@ --- -title: Models in DuMuX +title: Implementing a Model in DuMuX --- -# Implementing a new DuMu<sup>X</sup> model +# What is a DuMu<sup>X</sup> model ## What is a DuMu<sup>X</sup> model A DuMu<sup>X</sup> model is an implementation of a discretized **mathematical model**, generally given by partial differential equations. @@ -29,19 +29,19 @@ $\begin{equation*} |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*}$ -* $S_h$: storage term -* $F_{B,\sigma}$: flux term over sub control volume face (scvf) -* $q$ source term +* $S_h:$ storage term +* $F_{B,\sigma}:$ flux term over sub control volume face (scvf) +* $q:$ source term -How to implement these terms in DuMu<sup>X</sup>? +Where to implement these terms in DuMu<sup>X</sup>? -**local residual** +`LocalResidual` -# Local Residual +# `LocalResidual` -## Local Residual +## `LocalResidual` -Implements these terms within +Implements terms of a PDE in the functions * `computeStorage(...)` * `computeFlux(...)` @@ -57,12 +57,10 @@ $\begin{equation} with -$\begin{aligned} - c: &\:\text{concentration} \\ - D: &\:\text{constant diffusion coefficient} \\ - \Omega: &\:\text{spatial domain} \\ - T: &\:\text{end time} -\end{aligned}$ +- $c:$ concentration +- $D:$ constant diffusion coefficient +- $\Omega:$ spatial domain +- $T:$ end time ## Example: Diffusion equation Discrete model using the Box discretization: @@ -73,12 +71,10 @@ $\begin{equation} with -$\begin{aligned} - c_B^n: &\:\text{concentration at time $t_n$ and control volume $B$} \\ - c^n_h: &\:\text{global discrete solution at time $t_n$, interpolated using \textbf{basis functions}} \\ - \mathbf{n}: &\:\text{unit outer normal vector} \\ - \sigma: &\:\text{sub control volume face (scvf)} \\ -\end{aligned}$ +- $c_B^n:$ concentration at time $t_n$ and control volume $B$ +- $c^n_h:$ global discrete solution at time $t_n$, interpolated using __basis functions__ +- $\mathbf{n}:$ unit outer normal vector +- $\sigma:$ sub control volume face (scvf) ## Example: Diffusion equation Discrete model using the Box discretization: @@ -89,7 +85,7 @@ $\begin{equation} <img src=img/box_scv_scvf.png width="90%"> -## Local residual +## `LocalResidual` The local residual of the diffusion model: ```cpp template<class TypeTag> @@ -122,11 +118,9 @@ F_{B,\sigma} = -D \nabla c_h^{n+1} \cdot \boldsymbol{n}_{B,\sigma} \vert \sigma with -$\begin{aligned} - c^n_h: &\:\text{global discrete solution at time $t_n$, interpolated using \textbf{basis functions}} \\ - \mathbf{n}: &\:\text{unit outer normal vector} \\ - \sigma: &\:\text{sub control volume face (scvf)} \\ -\end{aligned}$ +- $c^n_h:$ global discrete solution at time $t_n$, interpolated using __basis functions__ +- $\mathbf{n}:$ unit outer normal vector +- $\sigma:$ sub control volume face (scvf) ## Flux term ```cpp @@ -168,17 +162,19 @@ NumEqVector computeFlux(...) const NumEqVector flux; // Compute the flux - flux[Indices::massBalanceEqIdx] = -1.0*vtmv( - scvf.unitOuterNormal(), problem.diffusionCoefficient(), gradConcentration - )*scvf.area(); + flux[Indices::massBalanceEqIdx] = -1.0*scvf.area()*vtmv( + scvf.unitOuterNormal(), + problem.diffusionCoefficient(), + gradConcentration + ); return flux; } ``` -## Local Residual +## `LocalResidual` -A **local residual** implements the discretized mathematical model. +A `LocalResidual` implements the discretized mathematical model. For its implementation different model-specific properties have to be set @@ -236,18 +232,13 @@ i.e. `TTag::DiffusionModel` # Exercise: Model ## Exercise: Model -Implementation of a **nonlinear diffusion model** +Implementation of a **nonlinear diffusion model** for denoising of an MRI image -<figure> - <center> - <img src="../exercises/extradoc/exercisemodel_mri_denoise.gif" alt="denoising"/> - <figcaption> Denosing of MRI image using nonlinear diffusion model.</figcaption> - </center> -</figure> +<img src="../exercises/extradoc/exercisemodel_mri_denoise.gif" alt="denoising" width="300"/> ## Tasks - Implement local residual - Set model properties - Use model in test case -- Customize volume variables \ No newline at end of file +- Customize volume variables