Skip to content

Commit 8e8d14c

Browse files
committed
references
1 parent 391e9c4 commit 8e8d14c

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

33.3 KB
Loading
-33.5 KB
Binary file not shown.

demos/adaptive_multigrid/adaptive_multigrid.py.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Our approach strongly follows the similar problem in this `lecture course <https
5151

5252
def solve_poisson(mesh, params):
5353
V = FunctionSpace(mesh, "CG", 1)
54-
uh = Function(V, name="Solution")
54+
uh = Function(V, name="solution")
5555
v = TestFunction(V)
56-
bc = DirichletBC(V, Constant(0), "on_boundary")
56+
bc = DirichletBC(V, 0, "on_boundary")
5757
f = Constant(1)
5858
F = inner(grad(uh), grad(v))*dx - inner(f, v)*dx
5959

@@ -146,16 +146,16 @@ Our approach will be to compute the estimator over all elements and selectively
146146
error_est = eta_.norm()
147147
return eta, error_est
148148

149-
The next step is to choose which elements to refine. For this we use Dörfler marking [Dörfler1996]:
149+
The next step is to choose which elements to refine. For this we use Dörfler marking :cite:`Dorfler1996`:
150150

151151
.. math::
152152
\eta_K \geq \theta \text{max}_L \eta_L
153153
154-
The logic is to select an element :math:`K` to refine if the estimator is greater than some factor :math:`\theta` of the maximum error estimate of the mesh, where :math:`\theta` ranges from 0 to 1. In our code we choose :math:`theta=0.5`.
154+
The logic is to select an element :math:`K` to refine if the estimator is greater than some factor :math:`\theta` of the maximum error estimate of the mesh, where :math:`\theta` ranges from 0 to 1. In our code we choose :math:`\theta=0.5`.
155155
With these helper functions complete, we can solve the system iteratively. In the max_iterations is the number of total levels we want to perform multigrid on. We will solve for 15 levels. At every level :math:`l`, we first compute the solution using multigrid with patch relaxation up till level :math:`l`. We then use the current approximation of the solution to estimate the error across the mesh. Finally, we refine the mesh and repeat. ::
156156

157157
theta = 0.5
158-
max_iterations = 10
158+
max_iterations = 15
159159
est_errors = []
160160
dofs = []
161161
for i in range(max_iterations):
@@ -187,10 +187,10 @@ With these helper functions complete, we can solve the system iteratively. In th
187187
plt.ylabel("Error estimate of the energy norm")
188188
plt.xlabel("Number of degrees of freedom")
189189
plt.legend()
190-
plt.savefig(f"output/adaptive_convergence_{max_iterations-1}.png")
190+
plt.savefig("output/adaptive_convergence.png")
191191

192192

193-
To perform Dörfler marking, refine the current mesh, and add the mesh to the :class:`.AdaptiveMeshHierarchy`, we use the ``amh.adapt(eta, theta)`` method. In this method the input is the recently computed error estimator :math:`eta` and the Dörfler marking parameter :math:`theta`. The method always performs this on the current fine mesh in the hierarchy. There is another method for adding a mesh to the hierarchy: ``amh.add_mesh(mesh)``. In this method, refinement on the mesh is performed externally by some custom procedure and the resulting mesh directly gets added to the hierarchy.
193+
To perform Dörfler marking, refine the current mesh, and add the mesh to the :class:`.AdaptiveMeshHierarchy`, we use the ``amh.adapt(eta, theta)`` method. In this method the input is the recently computed error estimator ``eta`` and the Dörfler marking parameter ``theta``. The method always performs this on the current fine mesh in the hierarchy. There is another method for adding a mesh to the hierarchy: ``amh.add_mesh(mesh)``. In this method, refinement on the mesh is performed externally by some custom procedure and the resulting mesh directly gets added to the hierarchy.
194194
The meshes now refine according to the error estimator. The error estimators at levels 3,5, and 15 are shown below. Zooming into the vertex of the L-shape at level 15 shows the error indicator remains strongest there. Further refinements will focus on that area.
195195

196196
+-------------------------------+-------------------------------+-------------------------------+
@@ -216,11 +216,14 @@ The solutions at level 4 and 15 are shown below.
216216

217217
The convergence follows the expected optimal behavior:
218218

219-
.. figure:: adaptive_convergence_9.png
219+
.. figure:: adaptive_convergence.png
220220
:align: center
221221
:alt: Convergence of the error estimator.
222222

223-
References
224-
----------
225-
[Dörfler1996] W. Dörfler. A convergent adaptive algorithm for poisson’s equation. SIAM Journal on Numerical Analysis, 33(3):1106–1124, 1996.
226223

224+
A runnable python version of this demo can be found :demo:`here<adaptive_multigrid.py>`.
225+
226+
.. rubric:: References
227+
228+
.. bibliography:: demo_references.bib
229+
:filter: docname in docnames

demos/demo_references.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,14 @@ @Article{Farrell2015
380380
pages = {A2026--A2045},
381381
doi = {10.1137/140984798},
382382
}
383+
384+
@article{Dorfler1996,
385+
title={A convergent adaptive algorithm for Poisson’s equation},
386+
author={D{\"o}rfler, Willy},
387+
journal={SIAM Journal on Numerical Analysis},
388+
volume={33},
389+
number={3},
390+
pages={1106--1124},
391+
year={1996},
392+
publisher={SIAM}
393+
}

0 commit comments

Comments
 (0)