From 916b9b53e718707407be705a359896a190492fbd Mon Sep 17 00:00:00 2001 From: hartmann Date: Tue, 20 Nov 2001 16:05:57 +0000 Subject: [PATCH] Whole introduction. git-svn-id: https://svn.dealii.org/trunk@5219 0785d39b-7218-0410-832d-ea1e28bc413d --- .../step-12.data/intro.html | 587 ++++++++++++++++++ 1 file changed, 587 insertions(+) diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/step-12.data/intro.html b/deal.II/doc/tutorial/chapter-2.step-by-step/step-12.data/intro.html index c59cfdf609..d6b84599c7 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/step-12.data/intro.html +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/step-12.data/intro.html @@ -1,2 +1,589 @@

Introduction

+ + +

+Overview +

+This example is devoted to the discontinuous Galerkin method, or +in short: DG method. It treats following topics. + +

+ +

+Introduction +

+The DG method was first introduced to discretize simple transport +equations. Over the past years DG methods have been applied to a +variety of problems and many different schemes were introduced +employing a big zoo of different convective and diffusive fluxes. As +this example's purpose is to illustrate some implementational issues +of the DG discretization only, here we simply consider the linear +transport equation +

+
+ + + + + + +
 \begin{displaymath}
+\nabla\cdot \left\{\beta u\right\}=f \qquad\mbox{in }\Omega,
+\end{displaymath} +(1)
+
+

+subject to the boundary conditions +

+
+ + + +\begin{displaymath}u=g\quad\mbox{on }\partial\Omega_-.
+\end{displaymath} +
+
+

+Here, + +$\beta=\beta(x)$ +is a vector field, f a source function, u the +(scalar) solution function, g a boundary value function and +

+
+ + + +\begin{displaymath}\partial\Omega_-:=\{x\in\partial\Omega, \beta(x)\cdot n(x)<0\}
+\end{displaymath} +
+
+

+the inflow boundary of the domain, whereas n denotes the unit outer +normal to boundary + +$\partial\Omega$ +of the domain. This equation, +(1), is the conservative version of the +transport equation already considered in step 9 of this tutorial. + +

+Discretization +

+To follow the general theory of deriving DG discretizations for purely +hyperbolic equations we first consider the general hyperbolic problem +

+
+ + + +\begin{displaymath}\nabla\cdot F(u)=f \qquad\mbox{in }\Omega,
+\end{displaymath} +
+
+

+subject to appropriate boundary conditions. Here F denotes the flux +function of the equation under consideration that for in our case, see equation, +(1), is represented by + +$F(u)=\beta u$. +For +deriving the DG discretization we start with a variational, +mesh-dependent formulation of the problem, +

+
+ + + +\begin{displaymath}\sum_K\left\{-(F(u),\nabla v)_K+(F(u)\cdot n, v)_{\partial K}\right\}=(f,v)_\Omega,
+\end{displaymath} +
+
+

+that originates from (1) by multiplication with +a test function and integration by parts on each cell K of the +triangulation. Here + +$(\cdot, \cdot)_K$ +and + +$(\cdot, \cdot)_{\partial
+K}$ +simply denote the integrals over the cell and the boundary of +the cell, respectively. To discretize the problem, the functions uand v are replaced by discrete functions uh and vh that in the +case of discontinuous Galerkin methods belong to the space Vh of +discontinuous piecewise polynomial functions of some degree p. Due +to the discontinuity of the discrete function uh on interelement +faces, the flux + +$F(u)\cdot n$ +must be replaced by a numerical + flux function + +$H(u_h, \hat u_h, n)$, +where + +$u_h\vert _{\partial K}$denotes the inner trace (w.r.t. the cell K) of uh and + +$\hat
+u_h\vert _{\partial K}$ +the outer trace, i.e. the value of uh on the +neighboring cell. Furthermore the numerical flux function H, among +other things, is consistent, i.e. +

+
+ + + +\begin{displaymath}H(u,u,n)=F(u)\cdot n,
+\end{displaymath} +
+
+

+and conservative, i.e. +

+
+ + +  + + + +
+H(v,w,n)=-H(w,v,-n). + +(2)
+
+

+This yields the following discontinuous Galerkin + discretization: find + +$u_h\in V_h$ +such that +

+
+ + + + + + +
 \begin{displaymath}
+\sum_K\left\{-(F(u_h),\nabla v_h)_K+(H(u_h,\hat u_h,n), v_h)_{\partial K}\right\}=(f,v)_\Omega, \quad\forall v_h\in V_h.
+\end{displaymath} +(3)
+
+

+Boundary conditions are realized by replacing $\hat u_h$ +on the inflow boundary + +$\partial\Omega_-$ +by the boundary function g. +In the special case of the transport equation +(1) the numerical flux in its simplest form +is given by +

+
+ + + + + + +
 \begin{displaymath}
+H(u_h,\hat u_h,n)(x)=\left\{\begin{array}{ll}
+(\beta\cdot ...
+...)(x),&\mbox{for } \beta(x)\cdot n(x)\geq 0.
+\end{array}\right.
+\end{displaymath} +(4)
+
+

+Hence, the discontinuous Galerkin scheme for the transport equation +(1) is given by: find + +$u_h\in V_h$ +such that for all + +$v_h\in V_h$ +following equation holds: +
+ \begin{multline}
+\sum_K\left\{-(u_h,\beta\cdot\nabla v_h)_K+(\beta\cdot n\, u_h...
+...ht\}\\
+=(f,v)_\Omega-(\beta\cdot n\, g, v_h)_{\partial\Omega_-},
+\end{multline} +
+where + +$\partial K_-:=\{x\in\partial K, \beta(x)\cdot n(x)<0\}$ +denotes +the inflow boundary and + +$\partial K_+=\partial K\setminus \partial
+K_-$ +the outflow part of cell K. This equation will be +refered to as first version of the DG method in the following. We +note that after integrating by parts again, we end up with: find + + +$u_h\in V_h$ +such that +

+
+ + + +\begin{displaymath}\sum_K\left\{(\nabla\cdot\{\beta u_h\},\nabla v_h)_K-(\beta\c...
+..._{\partial K_-}\right\}=(f,v)_\Omega, \quad\forall v_h\in V_h,
+\end{displaymath} +
+
+

+where + +$[u_h]=u_h-\hat u_h$ +denotes the jump of the discrete function +between two neighboring cells, that on the boundary of the domain is defined to be + +[uh]=uh-g. This is the discontinuous Galerkin +scheme for the transport equation given in its original notation. +Nevertheless, we will base the implementation of the scheme on the form +given by (3) and (4), or +(5), respectively. + +

+Finally we rewrite (3) in terms of a summation over all faces +where each face + +$\Gamma=\partial
+K\cap\partial \hat K$ +between two neighboring cells K and $\hat K$occurs twice: Find + +$u_h\in V_h$ +such that +

+
+ + + + + + +
 \begin{displaymath}
+-\sum_K(F(u_h),\nabla v_h)_K+\sum_\Gamma\left\{(H(u_h,\hat ...
+...s\partial\Omega}\right\}=(f,v)_\Omega \quad\forall v_h\in V_h,
+\end{displaymath} +(5)
+
+

+By employing conservativity (2) of the numerical flux +this equation simplifies to: find + +$u_h\in V_h$ +such that +

+
+ + + + + + +
 \begin{displaymath}
+-\sum_K(F(u_h),\nabla v_h)_K+\sum_\Gamma(H(u_h,\hat u_h,n),...
+...Gamma\cap\partial\Omega}=(f,v)_\Omega \quad\forall v_h\in V_h.
+\end{displaymath} +(6)
+
+

+Whereas the outer unit normal + + +$n\vert _{\partial K}$ +is uniquely defined this is not so for $n_\Gamma$. +$n_\Gamma$ +might be the normal from +either side of the face. Hence, we need to fix the normal n on the face to +be one of the two normals and denote the other normal by +-n. This way we get -n in the second face term in +(6) that finally produces the minus sign in +the jump [vh] in equation (7). + +

+For the linear transport equation (1) this +equation (7) simplifies to +
+ \begin{multline}
+-\sum_K(u_h,\beta\cdot\nabla v_h)_K+\sum_\Gamma\left\{(\beta\c...
+...ht\}\\
+=(f,v)_\Omega-(\beta\cdot n\, g, v_h)_{\partial\Omega_-},
+\end{multline} +
+what will be refered to as second version of the DG method. + +

+Implementation +

+As already mentioned at the beginning of this example we will +implement the assembling of the system matrix in two different ways. +The first one will be based on the first version (5) +of the DG method that includes a sum of integrals over all cell +boundaries + +$\partial K$. +This is realized by a loop over all cells and +a nested loop over all faces of each cell. Thereby each inner face + + +$\Gamma=\partial
+K\cap\partial \hat K$ +is treated twice, the first +time when the outer loop treats cell K and the second time when it +treats cell $\hat K$. +This way some values like the shape function +values at quadrature points on faces need to be computed twice. + +

+To overcome this overhead and for comparison, we implement the +assembling of a matrix also in a second and different way. This will +be based on the second version (8) that +includes a sum of integrals over all faces $\Gamma$. +Here, several +difficulties occur. +

Before we start with the description of the code we first introduce +its main ingredients. The main class is called +DGMethod. It comprises all basic objects like the +triangulation, the dofhandler, the system matrix and solution vectors. +Furthermore it has got some member functions, the most prominent of +which are the assemble_system1 and assemble_system2 +functions that implement the two different ways mentioned above for +assembling the system matrix. Within these assembling routines several +different cases must be distinguished while performing the nested +loops over all cells and all faces of each cell and assembling the +respective face terms. While sitting on the current cell and looking +at a specific face there are the cases +
+
1. +
face is at boundary, +
2. +
neighboring cell is finer, +
3. +
neighboring cell is of the same refinement level, and +
4. +
neighboring cell is coarser +
where `neighboring cell' denotes one of the two cells adjacent to the +face which is not the current cell. In all these cases the assembling +of the face terms are either the same or similar to each other. Hence, +we can implement the assembling of the face terms either by `copy and +paste' (the lazy way, that revenges not later than the scheme or the +equation might want to be changed afterwards) or by calling a separate +function that covers all four cases. To be a bit educational within +this tutorial we perform the latter approach, of course. We go even +further and encapsulate this function and everything that is needed +for assembling the specific equation under consideration within a +class called DGTransportEquation. This class includes objects +of all equation-specific functions, as there are the RHS and +the BoundaryValues class, both derived from the Function +class, and the Beta class representing the vector field. +Furthermore the DGTransportEquation class comprises member +functions assemble_face_terms1 and +assemble_face_terms2 that are invoked by the +assemble_system1 and assemble_system2 functions of the +DGMethod, respectively, and the function +assemble_cell_term that is the same for both assembling +routines. The DGTransportEquation class can then easily be +replaced by a different class that implements a different equation and +a different DG method. Indeed, the implementation of the +assemble_system1 and assemble_system2 functions will +be general enough to serve for different DG methods, different +equations, even for systems of equations (!) and, under small +modifications, for nonlinear problems. -- 2.39.5