-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstep39.tex
208 lines (190 loc) · 6.49 KB
/
step39.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section[DG]{Discontinuous Galerkin methods}
\frame{\tableofcontents[currentsection,hideothersubsections]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Discontinuous Galerkin methods}
\begin{frame}
\frametitle{Origin of DG methods}
\begin{itemize}
\item Discontinuous Galerkin methods were developed for hyperbolic PDE
\begin{itemize}
\item Linear transport: Reed/Hill, LeSaint/Raviart
\item Nonlinear conservation laws: Cockburn/Shu
\end{itemize}
\item They feature basis functions with no continuity across cell boundaries
\item Soon, an extension to singularly perturbed problems became
necessary
\begin{gather*}
-\varepsilon\Delta u + (w\!\cdot\!\nabla) u = f
\end{gather*}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{DG Methods for elliptic problems}
\begin{itemize}
\item Continuity is necessary for $H^1$-conformity
\item Modify bilinear form for \textbf{consistency}
\item Example: boundary edges
\begin{itemize}
\item<2-> \red Remove \black natural boundary condition
\item<3-> \blue Symmetrize the bilinear form \black
\item<3-> Additional terms are indefinite
\item<4-> \green Stabilize\black
\end{itemize}
\end{itemize}
\begin{align*}
(\nabla u, \nabla v)_\Omega&
\uncover<2->{\red -(\partial_n u, v)_{\partial \Omega}\black}
\uncover<3->{\blue -(u, \partial_n v)_{\partial \Omega}\black}
\uncover<4->{\green +\tfrac{\kappa}{h}(u, v)_{\partial \Omega}\black}
\\&=
(f,v)_\Omega
\uncover<3->{\blue -(u^D, \partial_n v)_{\partial \Omega}\black}
\uncover<4->{\green +\tfrac{\kappa}{h}(u^D, v)_{\partial \Omega}\black}
\end{align*}
\end{frame}
\begin{frame}
\frametitle{Structure of DG code}
\begin{itemize}
\item Integrals over cells as before
\item Integrals over interfaces between cells, e.g.
\begin{gather*}
\int_F \bigl(u^L(x)-u^R(x)\bigr) \bigl(v^L(x)-v^R(x)\bigr)
\,ds
\end{gather*}
\begin{itemize}
\item Terms generate 4 matrices!
\end{itemize}
\item Same integrals with one side refined (hanging nodes)
\item Integrals over boundary faces
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Structure of error estimates}
\begin{itemize}
\item Typically two components: cells and faces
\begin{align*}
\eta_K &= \| h_K^2 f+\Delta u_h\|_K \\
\eta_F &= \| h_F \operatorname{jump}(\partial_n u_h) \|_F
\end{align*}
\item Can be added up, such that $\eta_K$ is augmented by all
$\eta_F$ for this cell.
\item Results in a cell vector which can be used for refinement
strategy
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Generic loops}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Generic loops through MeshWorker}
\begin{itemize}
\item Goal: see loops from an abstract point of view:
\begin{block}{Generic linear, stationary program}
\lstinputlisting{assembly3.pseudocode}
\end{block}
\item Application program only implements the local operators
\item No handling of degrees of freedom or target objects needed
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Arguments to local integrator}
\begin{itemize}
\item\texttt{MeshWorker::DoFInfo}
\begin{itemize}
\item Information on the current cell and its degrees of freedom
\item Return values in base class \texttt{LocalResults}
\end{itemize}
\item\texttt{MeshWorker::IntegrationInfo}
\begin{itemize}
\item \texttt{FEValues}
\item Optional function values in quadrature points
\end{itemize}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{The local integrator class}
\begin{block}{}\small
\lstinputlisting{tutcode/step39-1.cc}
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
\frametitle{The cell matrix}
\begin{block}{}\footnotesize
\lstinputlisting{code/cell_matrix.cc}
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
\frametitle{The cell matrix}
\begin{block}{}\small
\lstinputlisting{code/cell_matrix2.cc}
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{The boundary matrix}
\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-3.cc}
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{The interface matrix}
\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-4.cc}
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Setting up the loop I: IterationInfo}
\begin{itemize}
\item<1-> Handle \texttt{FEValues} objects
\item<2-> Provide values of data vectors
\end{itemize}
\only<1>{\begin{block}{Assemble matrix}\small
\lstinputlisting{tutcode/step39-5.cc}
\end{block}}
\only<2>{\begin{block}{Compute estimator}\footnotesize
\lstinputlisting{tutcode/step39-5a.cc}
\end{block}}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Setting up the loop II: Assembler}
\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-6a.cc}
\end{block}
\only<1>{\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-6b.cc}
\end{block}}
\only<2->{\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-6c.cc}
\end{block}
\begin{block}{}\footnotesize
\lstinputlisting{tutcode/step39-6d.cc}
\end{block}}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Setting up the loop III: run!}
\begin{block}{}\small
\lstinputlisting{tutcode/step39-7.cc}
\end{block}
\pause
\begin{block}{Multigrid}\small
\lstinputlisting{tutcode/step39-7b.cc}
\end{block}
\end{frame}
\subsection{Problems}
\input{exercises/step39}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "slides"
%%% End: