Debian Codegraph @

demo/documented/auto-adaptive-poisson/common.txt

raw
1 In this demo we will use goal oriented adaptivity and error control
2 which applies a duality technique to derive error estimates taken
3 directly from the computed solution which then are used to weight
4 local residuals. To this end, we derive an :math:`\textit{a
5 posteriori}` error estimate and error indicators. We define a goal
6 functional :math:`\mathcal{M} : V \rightarrow \mathbb{R}`, which
7 expresses the localized physical properties of the solution of a
8 simulation. The objective of goal oriented adaptive error control is
9 to minimize computational work to obtain a given level of accuracy in
10 :math:`\mathcal{M}`.
11
12 We will thus illustrate how to:
13
14 * Solve a linear partial differential equation with automatic adaptive mesh refinement
15 * Define a goal functional
16 * Use :py:class:`AdaptiveLinearVariationalSolver <dolfin.cpp.fem.AdaptiveLinearVariationalSolver>`
17
18 The two solutions for u in this demo will look as follows, where the
19 first is the unrefined while the second is the refined solution:
20
21 .. image:: ../u_unrefined.png
22 :scale: 75 %
23
24 .. image:: ../u_refined.png
25 :scale: 75 %
26
27
28 Equation and problem definition
29 -------------------------------
30
31 The Poisson equation is the canonical elliptic partial differential
32 equation. For a domain :math:`\Omega \subset \mathbb{R}^n` with
33 boundary :math:`\partial \Omega = \Gamma_{D} \cup \Gamma_{N}`, the
34 Poisson equation with particular boundary conditions reads:
35
36
37 .. math::
38
39 - \nabla^{2} u &= f \quad {\rm in} \ \Omega, \\
40 u &= 0 \quad {\rm on} \ \Gamma_{D}, \\
41 \nabla u \cdot n &= g \quad {\rm on} \ \Gamma_{N}. \\
42
43 Here, :math:`f` and :math:`g` are input data and n denotes the outward
44 directed boundary normal. The variational form of Poisson equation
45 reads: find :math:`u \in V` such that
46
47 .. math::
48
49 a(u, v) = L(v) \quad \forall \ v \in \hat{V},
50
51 which we will call the continous primal problem, where :math:`V`,
52 :math:`\hat{V}` are the trial- and test spaces and
53
54
55 .. math::
56
57 a(u, v) &= \int_{\Omega} \nabla u \cdot \nabla v \, {\rm d} x, \\
58 L(v) &= \int_{\Omega} f v \, {\rm d} x + \int_{\Gamma_{N}} g v \, {\rm d} s.
59
60 The expression :math:`a(u, v)` is the bilinear form and :math:`L(v)`
61 is the linear form. It is assumed that all functions in :math:`V`
62 satisfy the Dirichlet boundary conditions (:math:`u = 0 \ {\rm on} \
63 \Gamma_{D}`).
64
65 The above definitions is that of the continuous problem. In the actual
66 computer implementation we use a descrete formulation which reads:
67 find :math:`u \in V_h` such that
68
69
70 .. math::
71
72 a(u_h, v) = L(v) \quad \forall \ v \in \hat{V}_h.
73
74 We will refer to the above equation as the discrete primal
75 problem. Here, :math:`V_h` and :math:`\hat{V_h}` are finite
76 dimensional subspaces.
77
78 The weak residual is defined as
79
80 .. math::
81
82 r(v) = L(v) - a(u_h, v).
83
84 By the Galerkin orthogonality, we have
85
86
87 .. math::
88
89 r(v) = L(v) - a(u_h, v) = a(u_h, v) - a(u_h, v) = 0\,\, \forall v \in \hat{V}_{h},
90
91 which means that the residual vanishes for all functions in
92 :math:`\hat{V}_{h}`. This property is used further in the derivation
93 of the error estimates. wish to compute a solution :math:`u_h` to the
94 discrete primal problem defined above such that for a given tolerance
95 :math:`\mathrm{TOL}` we have
96
97 .. math::
98
99 \eta = \left| \mathcal{M}(u_h) - \mathcal{u_h} \right| \leq \mathrm{TOL}.
100
101 Next we derive an :math:`\textit{a posteriori}` error estimate by
102 defining the discrete dual variational problem: find :math:`z_h \in
103 V_h^*` such that
104
105 .. :math::
106
107 a^*(z_h,v) = \mathcal{v}, \quad \forall v \in \hat{V}_h^*.
108
109 Here :math:`V^*, \hat{V}_h^*` are the dual trial- and test spaces and
110 :math:`a^* : V^* \times \hat{V}^* \rightarrow \mathbb{R}` is the
111 adjoint of :math:`a` such that :math:`a^*(v,w) = a(w,v)`. We find that
112
113 .. math::
114
115 \mathcal{M}(u - \mathcal{u_h}) = a^*(z, u - u_h) = a(u - u_h, z) = a(u,z) - a(u_h,z) = L(z) - a(u_h,z) = r(z)
116
117 and by Galerkin orthogonality we have :math:`r(z) = r(z - v_h)\,\,
118 \forall v_h \in \hat{V}_h`. Note that the residual vanishes if
119 :math:`z \in \hat{V}_h^*` and has to either be approximated in a
120 higher order element space or one may use an extrapolation. The choice
121 of goal functional depends on what quantity you are interested in.
122 Here, we take the goal functional to be defined as
123
124 .. math::
125
126 \mathcal{M}(u) = \int_{\Omega} u dx.
127
128
129 We use :math:`D\ddot{o}rfler` marking as the mesh marking procedure.
130
131 In this demo, we shall consider the following definitions of the input functions, the domain, and the boundaries:
132
133 * :math:`\Omega = [0,1] \times [0,1]\,` (a unit square)
134 * :math:`\Gamma_{D} = \{(0, y) \cup (1, y) \subset \partial \Omega\}\,` (Dirichlet boundary)
135 * :math:`\Gamma_{N} = \{(x, 0) \cup (x, 1) \subset \partial \Omega\}\,` (Neumann boundary)
136 * :math:`g = \sin(5x)\,` (normal derivative)
137 * :math:`f = 10\exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)\,` (source term)
138