The method#

Model problems#

A problem (dolfinx_padapt.problems.Problem) has one or more fields, each with a value shape and a degree relative to the degree of the cell. It provides the residual on the cells and boundary of one degree, the coupling terms on the interfaces between two degrees, the error indicator and the error measures. The library has the following problems:

The source problems use a manufactured solution \(u_{ex}\), with \(f\) and \(g\) computed from it, such that the error can be measured. The problems with vector valued or several fields are only implemented for the submesh approach.

Discretisation#

Discontinuous Galerkin spaces are coupled with the symmetric interior penalty (SIPG) method [Arn82, ABCM02], and the Dirichlet condition is imposed weakly with Nitsche’s method [Nit71]. Continuous spaces are only coupled by these terms on the interfaces between cells of different degrees. A field on the boundary (the latent variable of the Signorini problem) lives on a submesh of the facets of each degree, with the continuity of the trace of the fields on the cells. For the Laplacian, the residual is written once, with the boundary terms in \(u - g\),

\[\begin{split} \begin{align} F(u; v) =&\ \sum_K \int_K \nabla u\cdot\nabla v - s v~\mathrm{d}x + \sum_{F\in\mathcal{F}_i} \int_F -\{\nabla u\}\cdot[v] - [u]\cdot\{\nabla v\} + \frac{\sigma}{\{h\}}[u]\cdot[v]~\mathrm{d}s\\ &+ \int_{\partial\Omega} -\nabla u\cdot n\, v - (u - g)\nabla v\cdot n + \frac{\sigma}{h}(u - g) v~\mathrm{d}s, \end{align} \end{split}\]

where \([u] = u^+n^+ + u^-n^-\) and \(\{\nabla u\}=\frac{1}{2}(\nabla u^+ + \nabla u^-)\). The stiffness matrix and the load vector are extracted with ufl.lhs() and ufl.rhs(). The eigenvalue problem has \(g=0\) and the mass matrix as its right hand side. For linear elasticity, the stress replaces the gradient, and for the Stokes equations the velocity and pressure are also coupled through \(\{p\}[v\cdot n]\) on the facets. The building blocks are in dolfinx_padapt.dg.

The penalty parameter is \(\sigma = \alpha p^2\) [ERiviere07], where \(p\) is \(\max(p^+, p^-)\) on an interior facet and the degree of the cell on the boundary (dolfinx_padapt.forms.Penalty.local), or \(p_{max}\) on every facet (dolfinx_padapt.forms.Penalty.global_).

The adaptive loop#

Starting from degree \(p_{min}\) on every cell, dolfinx_padapt.adaptivity.solve_adaptive()

  1. creates the space for the current degrees,

  2. assembles and solves the problem: an eigenvalue problem with SLEPc, a linear problem with dolfinx.fem.petsc.LinearProblem, and a nonlinear problem with dolfinx.fem.petsc.NonlinearProblem (Newton’s method), inside the outer iteration of the problem (e.g. the proximal point iterations of the Signorini problem, dolfinx_padapt.proximal.proximal_point()),

  3. computes the error indicator,

  4. marks cells, and increases their degree by one (p-refinement), splits them (h-refinement), or chooses between the two from the smoothness of the solution (hp-refinement), see below.

The degree of each cell is owned by the approach, within the range \([p_{min}, p_{max}]\) of its Parameters, and stored as cell tags (dolfinx_padapt.degrees.DegreeField), where the value of a tag is the degree. Every integral gets a unique tag: \(\mathrm{d}x(i)\) and \(\mathrm{d}s(i)\) for the cells of degree \(i\), and \(\mathrm{d}S(i, j)\) for the facets between the cells of degree \(i \leq j\). The interior facets are computed once with dolfinx.fem.compute_integration_domains(), and grouped by the degrees of their two cells, where the cell with the lowest degree is the “+” restriction.

All forms, for every combination of degrees, are compiled once with dolfinx.fem.compile_form(), and every iteration only calls dolfinx.fem.create_form() with the new spaces and integration entities.

Error indicator#

We use the per-cell residual indicator of [Lar00] (see also [DuranPRodriguez03]), as in the AMR demo of the DOLFINx tutorial, with the polynomial weights of the hp-DG indicator of [HSchotzauW07]:

\[\begin{split} \begin{align} \eta_K^2 =&\ \frac{h_K^2}{p_K^2}\Vert s(u_h) + \Delta u_h\Vert^2_{K} + \frac{h_K}{p_K}\left\Vert\frac{[\nabla u_h\cdot n]}{2}\right\Vert^2_{\partial K\setminus\partial\Omega}\\ &+ \alpha^2\frac{p_K^3}{h_K}\left(\left\Vert\frac{[u_h]}{2}\right\Vert^2_{\partial K\setminus\partial\Omega} + \Vert u_h - g\Vert^2_{\partial K\cap\partial\Omega}\right). \end{align} \end{split}\]

An interior facet contributes to both of its cells, each with its own \(h_K\) and \(p_K\). The flux jumps are included on every interior facet, also for continuous spaces, where the jumps \([u_h]\) vanish inside a region of one degree, but the flux jumps do not.

Marking#

The cells with \(\eta_K > \theta \max_{K'}\eta_{K'}\) [BabuvskaR78] are marked with dolfinx.mesh.mark_maximum() (or with dolfinx.mesh.mark_equidistribution()), among the cells with \(p_K<p_{max}\). Cells at the maximal degree are left out, as the error at a singularity would otherwise keep selecting the same cells.

Optionally, the degree of the cells with \(\eta_K < \theta_c \max_{K'}\eta_{K'}\) and \(p_K > p_{min}\) is lowered by one (dolfinx_padapt.adaptivity.mark_cells_for_coarsening()), but never below \(p_{min}\). The cells marked for enrichment are not coarsened, and \(\theta_c\) should be much smaller than \(\theta\), such that the cells do not alternate between being enriched and coarsened. As the spaces and forms are created from the cell tags at every iteration, lowering a degree is no different from increasing it.

h- and hp-refinement#

With h-refinement (dolfinx_padapt.adaptivity.Refinement.h), the marked cells are split with the algorithm of [PC00], and the new cells get the degree of their parent cell. Meshes with curved (higher order) geometry are refined through the straight mesh with the same topology, and the nodes of the refined mesh are placed with the coordinates of the original mesh, interpolated with the known parent cells (dolfinx_padapt.refinement.refine_curved()). Optionally, the new nodes on the boundary are moved to the exact boundary. The forms are compiled once, for the initial mesh, and are only created on the refined meshes.

With hp-refinement (dolfinx_padapt.adaptivity.Refinement.hp), the degree of a marked cell is increased if the solution is smooth on it, and the cell is split otherwise (or at the maximal degree). The smoothness is estimated from the decay of the Legendre coefficients of the solution on the cell [HSuli05, Mav94] (dolfinx_padapt.smoothness). See the hp demo.

[Arn82]

Douglas N. Arnold. An interior penalty finite element method with discontinuous elements. SIAM Journal on Numerical Analysis, 19(4):742–760, 1982. doi:10.1137/0719052.

[ABCM02]

Douglas N. Arnold, Franco Brezzi, Bernardo Cockburn, and L. Donatella Marini. Unified analysis of discontinuous Galerkin methods for elliptic problems. SIAM Journal on Numerical Analysis, 39(5):1749–1779, 2002. doi:10.1137/S0036142901384162.

[BabuvskaR78]

Ivo Babuška and Werner C. Rheinboldt. Error estimates for adaptive finite element computations. SIAM Journal on Numerical Analysis, 15(4):736–754, 1978. doi:10.1137/0715049.

[CKSchotzauS02]

Bernardo Cockburn, Guido Kanschat, Dominik Schötzau, and Christoph Schwab. Local discontinuous Galerkin methods for the Stokes system. SIAM Journal on Numerical Analysis, 40(1):319–343, 2002. doi:10.1137/S0036142900380121.

[DFK+25]

Jørgen S. Dokken, Patrick E. Farrell, Brendan Keith, Ioannis P. A. Papadopoulos, and Thomas M. Surowiec. The latent variable proximal point algorithm for variational problems with inequality constraints. Computer Methods in Applied Mechanics and Engineering, 445:118181, 2025. doi:10.1016/j.cma.2025.118181.

[DuranPRodriguez03]

Ricardo G. Durán, Claudio Padra, and Rodolfo Rodríguez. A posteriori error estimates for the finite element approximation of eigenvalue problems. Mathematical Models and Methods in Applied Sciences, 13(8):1219–1229, 2003. doi:10.1142/S0218202503002878.

[ERiviere07]

Yekaterina Epshteyn and Béatrice Rivière. Estimation of penalty parameters for symmetric interior penalty Galerkin methods. Journal of Computational and Applied Mathematics, 206(2):843–872, 2007. doi:10.1016/j.cam.2006.08.029.

[HSchotzauW07]

Paul Houston, Dominik Schötzau, and Thomas P. Wihler. Energy norm a posteriori error estimation of hp-adaptive discontinuous Galerkin methods for elliptic problems. Mathematical Models and Methods in Applied Sciences, 17(1):33–62, 2007. doi:10.1142/S0218202507001826.

[HSuli05]

Paul Houston and Endre Süli. A note on the design of hp-adaptive finite element methods for elliptic partial differential equations. Computer Methods in Applied Mechanics and Engineering, 194(2–5):229–243, 2005. doi:10.1016/j.cma.2004.04.009.

[KS24]

Brendan Keith and Thomas M. Surowiec. Proximal Galerkin: a structure-preserving finite element method for pointwise bound constraints. Foundations of Computational Mathematics, 26(1):385–481, 2024. doi:10.1007/s10208-024-09681-8.

[Lar00]

Mats G. Larson. A posteriori and a priori error analysis for finite element approximations of self-adjoint elliptic eigenvalue problems. SIAM Journal on Numerical Analysis, 38(2):608–625, 2000. doi:10.1137/S0036142997320164.

[Mav94]

Catherine Mavriplis. Adaptive mesh strategies for the spectral element method. Computer Methods in Applied Mechanics and Engineering, 116(1–4):77–86, 1994. doi:10.1016/S0045-7825(94)80010-3.

[Nit71]

Joachim Nitsche. Über ein Variationsprinzip zur Lösung von Dirichlet-Problemen bei Verwendung von Teilräumen, die keinen Randbedingungen unterworfen sind. Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg, 36(1):9–15, 1971. doi:10.1007/BF02995904.

[PC00]

A. Plaza and G. F. Carey. Local refinement of simplicial grids based on the skeleton. Applied Numerical Mathematics, 32(2):195–218, 2000. doi:10.1016/S0168-9274(99)00022-7.

[SchotzauST02]

Dominik Schötzau, Christoph Schwab, and Andrea Toselli. Mixed hp-DGFEM for incompressible flows. SIAM Journal on Numerical Analysis, 40(6):2171–2194, 2002. doi:10.1137/S0036142901399124.