diff --git a/slides/model.md b/slides/model.md index 6c2a4c57f75ce9d857b8c1ff6bb4e90f0fcf3b7a..2123761cbb03b857f4e73b070bc245de227253b7 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. @@ -33,15 +33,15 @@ $\begin{equation*} * $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