1 Introduction

Early work on mesh and degree adaptivity schemes for the finite element method [30, 44, 65] already showed the advantages of adaptive schemes to achieve a required accuracy in an economic manner. The use of mesh adaptive methods is substantially more extended due to the popularity of low-order methods in the computational mechanics community. This is largely due, as discussed later, to the fact that mesh adaptation is easier to implement, compared to degree adaptivity, in standard finite element codes. But, with recent needs on high fidelity simulations for fluids and wave propagation phenomena [14, 25, 63], the interest in degree adaptive (or the combination of mesh and degree adaptivity) processes has increased [4, 23, 24, 31].

One of the main reasons for the increasing popularity of degree adaptive schemes in the last years is the rise of discontinuous Galerkin (DG) methods as a viable alternative for convection dominated flow and wave propagation problems [13, 15, 21, 26, 43, 58]. In a standard continuous Galerkin framework, the implementation of variable degree of approximation is cumbersome, whereas its application in a DG context is straightforward due to the weak imposition of the continuity of the solution by means of numerical fluxes. Despite traditional DG methods have not been able to consistently prove its superiority against low-order techniques traditionally employed in industry (e.g. finite volume methods), the recently proposed hybridisable DG (HDG) [11] has shown its superiority compared to traditional DG methods [9, 27, 33]. The ability to substantially reduce the number of degrees of freedom combined with the possibility to obtain a post-processed solution that converges at a faster rate to the exact solution are the two main properties of HDG methods behind its superiority compared to other DG methods [10, 12, 38, 56]. Moreover, this is achieved while preserving the well-known advantages of DG for stabilising convection and circumventing the so-called Ladyzhenskaya-Babuška-Brezzi (LBB) condition in the incompressible limit.

A key aspect in any adaptive scheme is the ability to devise cheap and reliable error measures for a given numerical solution in order to decide the regions where a more accurate solution is required [1]. Error indicators and error estimators are typically employed to asses the error of a simulation with an adaptive framework [29]. Error indicators are computationally inexpensive but they are problem dependent whereas error estimators are considerably more expensive but more general [19, 46, 47]. A cheap, general and reliable error estimator was proposed in [23, 24] by exploiting the ability of the HDG method to construct a post-processed solution, more accurate than the HDG solution.

One of the aspects that is normally ignored when devising degree adaptive schemes is the geometric representation of domains with curved boundaries. Despite it is now well known that a poor representation of the geometry can have an important effect on the results of a finite element simulation [2, 7, 54, 60], the most extended practice consists on maintaining the shape of the elements during the degree adaptive process [23, 24, 31]. In the majority of cases, a polynomial representation of the boundary is selected whereas the polynomial degree of the functional approximation changes at each iteration of the degree adaptive scheme.

This work analyses and discusses three approaches to perform a degree adaptive process in domains with curved boundaries. The first one corresponds to the approach typically employed in practice, consisting of fixing the shape of the curved elements and changing the degree of the functional approximation as dictated by the degree adaptivity procedure. The second approach proposed in this work is to employ the so-called NURBS-enhanced finite element method (NEFEM) that enables to exactly represent the geometry of the computational domain, given by a CAD model, irrespectively of the degree of the polynomials used to approximate the solution. The third approach, despite not considered useful from a practical point of view, consists of changing the geometry representation of the computational domain to represent with the same degree of polynomials both the geometry and the solution at each iteration of the degree adaptive process. This approach is not considered of interest from a practical point of view because it requires communication with the CAD model at each iteration and re-generation of nodal distributions for curved elements.

The second approach proposed here considers, for the first time, the combination of the so-called NURBS-enhanced finite element method (NEFEM) and the HDG rationale. The resulting method combines all the advantages of both methods, that is the efficiency of HDG and the ability of NEFEM to decouple the functional approximation from the geometric representation, usually tied in traditional isoparametric implementations.

A number of numerical examples is considered in order to compare the different degree adaptivity approaches. Furthermore, this work presents a simple idea to verify computational methods that are able to use different degrees of approximation for the solution in different elements. The idea is based on an existing local a priori error estimator developed in [18] for elliptic problems.

The remainder of the paper is organised as follows. Section 2 briefly presents the model problem considered (i.e. Stokes flows) and the HDG formulation. The spatial discretisation of the HDG weak formulation is presented in Sect. 3 for both isoparametric and NEFEM, with particular emphasis on the differences between both formulations. The details about the proposed error estimator and degree adaptivity process proposed are presented in Sect. 4, including a discussion of the three approaches considered to perform a degree adaptive process. In Sect. 5 a simple technique to verify the implementation of a solver with variable degree of approximation is presented and used to test the implementation of the HDG code for Stokes flows with isoparametric and NEFEM. Section 6 presents a comparison of the different degree adaptive approaches and a number of numerical examples are used in section to show the potential of the proposed approach. Finally, Sect. 8 summarises the main conclusions of the work that has been presented.

2 Hybridisable Discontinuous Galerkin for Stokes Flow

2.1 Problem statement

Let us consider an open bounded domain \(\varOmega \in \mathbb {R}^{\mathtt {n_{sd}}}\) with boundary \(\partial \varOmega \), where \(\mathtt {n_{sd}}\) the number of spatial dimensions. The strong form of the stationary Stokes problem is obtained by neglecting the transient and convective effects in the full incompressible Navier–Stokes equations [20]. The so-called velocity-pressure formulation is obtained by invoking the Stoke’s law and results in

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{aligned} &{}-{\varvec{\nabla }{\cdot }}(\nu \varvec{\nabla } \varvec{u} - p\varvec{I}) = \varvec{s} &{}&{} \text {in}\, \varOmega , \\ &{}\varvec{\nabla }\cdot \varvec{u} = 0 &{}&{} \text {in}\,\varOmega , \\ &{}\varvec{u} = \varvec{u}_D &{}&{} \text {on}\, \varGamma _D , \\ &{}\varvec{n} \cdot (\nu \varvec{\nabla } \varvec{u} - p\varvec{I}) = \varvec{t} &{}&{} \text {on}\, \varGamma _N, \end{aligned} \end{array}\right. } \end{aligned}$$
(1)

where \(\varvec{u}\) is the velocity vector, \(\nu \) is the kinematic viscosity, p denotes the dynamic pressure, \(\varvec{s}\) is a body force, \(\varvec{u}_D\) is the imposed velocity on the Dirichlet boundary \(\varGamma _D\), \(\varvec{n}\) is the outward unit normal vector to \(\partial \varOmega \) and \(\varvec{t}\) is the pseudo-traction vector imposed on the Neumann boundary \(\varGamma _N\). The disjoint boundaries \(\varGamma _D\) and \(\varGamma _N\) satisfy \(\partial \varOmega = \overline{\varGamma }_D \cup \overline{\varGamma }_N\).

In what follow, \(\bigl ({\cdot },{\cdot }\bigr )_{D}\) denotes the \(\mathcal {L}_2\) scalar product in a generic subdomain \(D \subset \varOmega \), that is

$$\begin{aligned} \bigl ({u},{v}\bigr )_{D} = \int _{D}uv d\varOmega \qquad \bigl ({\varvec{u}},{\varvec{v}}\bigr )_{D} = \int _{D}\varvec{u} \cdot \varvec{v} d\varOmega \quad \text {and} \quad \bigl ({\varvec{U}},{\varvec{V}}\bigr )_{D} = \int _{D}\varvec{U}\,\varvec{:}\,\varvec{V} d\varOmega , \end{aligned}$$

for scalars, vectors and second order tensors respectively. Analogously, \(\bigl \langle {\cdot },{\cdot }\bigr \rangle _{S}\) denotes the \(\mathcal {L}_2\) scalar product in any domain \(S\subset \varGamma \cup \partial \varOmega \).

The free divergence condition in Eq. (1) induces the compatibility condition

$$\begin{aligned} \bigl \langle {\varvec{u}_D \cdot \varvec{n}},{1}\bigr \rangle _{\varGamma _D} + \bigl \langle {\varvec{u} \cdot \varvec{n}},{1}\bigr \rangle _{\varGamma _N} = 0. \end{aligned}$$
(2)

It is worth noting that, if only Dirichlet boundary conditions are considered (i.e. \(\varGamma _N = \emptyset \)), an additional constraint on the pressure must be imposed to avoid its indeterminacy. It is common [10, 12, 38] to impose the mean pressure on the element boundary, namely

$$\begin{aligned} \bigl \langle {p},{1}\bigr \rangle _{\partial \varOmega } = 0. \end{aligned}$$
(3)

2.2 HDG Weak Formulation

The domain \(\varOmega \) is assumed partitioned in \(\texttt {n}_{\texttt {el}}\) disjoint subdomains \(\varOmega _e\) with boundaries \(\partial \varOmega _e\), which define an internal interface \(\varGamma \)

$$\begin{aligned} \varGamma : =\left[ \bigcup _{e=1}^{\mathtt {n_{el}}}\partial \varOmega _e\right] \setminus \partial \varOmega . \end{aligned}$$
(4)

The corresponding strong form of the Stokes system given in Eq. (1) can be written in mixed form and in the broken computational domain as

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{aligned} &{}\varvec{L} +\varvec{\nabla } \varvec{u} = \varvec{0} &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{\nabla }\cdot (\nu \varvec{L} + p\varvec{I}) = \varvec{s} &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{\nabla }\cdot \varvec{u} = 0 &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{u} = \varvec{u}_D &{}&{} \text {on }\partial \varOmega _e\cap \varGamma _D, \\ &{}\varvec{u} = \hat{\varvec{u}} &{}&{} \text {on }\partial \varOmega _e\setminus \varGamma _D , \\ &{}\varvec{n}\cdot (\nu \varvec{L}+p\varvec{I}) = -\varvec{t} &{}&{} \text {on }\partial \varOmega _e\cap \varGamma _N, \\ &{}\llbracket \varvec{u}\otimes \varvec{n}\rrbracket = \varvec{0} &{}&{} \text {on }\varGamma , \\ &{}\llbracket \varvec{n}\cdot (\nu \varvec{L}+p\varvec{I})\rrbracket = \varvec{0} &{}&{} \text {on }\varGamma , \end{aligned} \end{array}\right. } \end{aligned}$$
(5)

for \(e=1,\cdots ,\texttt {n}_{\texttt {el}}\), where \(\varvec{I}\) is the identity tensor of dimension \(\texttt {n}_{\texttt {sd}}\), \(\varvec{L} = -\varvec{\nabla }\varvec{u}\) is a new variable (the second order velocity gradient tensor) which is introduced after splitting the second order momentum conservation equation in two first order equations and \(\hat{\varvec{u}}\) is an independent variable representing the trace of the solution in \(\partial \varOmega _e\setminus \varGamma _D\).

The free divergence condition in Eq. (5) induces the compatibility condition

$$\begin{aligned} \bigl \langle {\varvec{u}_D \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {\hat{\varvec{u}} \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D} = 0. \end{aligned}$$
(6)

The last two equations in (5) impose the continuity of velocity and continuity of the normal component of the pseudo-stress across the interior faces respectively, where the jump \(\llbracket \cdot \rrbracket \) operator has been introduced following the definition in [37], such that, along each portion of the interface \(\varGamma \) it sums the values from the element on the left and right of say, \(\varOmega _e\) and \(\varOmega _l\), namely

$$\begin{aligned} \llbracket \odot \rrbracket = \odot _e + \odot _l. \end{aligned}$$

The HDG method solves problem (5) in two stages, see for instance [8, 11, 40,41,42]. First, an element-by-element problem is defined with \((\varvec{L},\varvec{u},p)\) as unknowns. This is the so-called local problem and is given by

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{aligned} &{}\varvec{L} +\varvec{\nabla } \varvec{u} = \varvec{0} &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{\nabla }\cdot (\nu \varvec{L} + p\varvec{I}) = \varvec{s} &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{\nabla }\cdot \varvec{u} = 0 &{}&{} \text {in }\varOmega _e, \\ &{}\varvec{u} = \varvec{u}_D &{}&{} \text {on }\partial \varOmega _e\cap \varGamma _D, \\ &{}\varvec{u} = \hat{\varvec{u}} &{}&{} \text {on }\partial \varOmega _e\setminus \varGamma _D , \\ &{}\bigl \langle {p},{1}\bigr \rangle _{\partial \varOmega _e} = \rho _e, &{}\quad &{} \end{aligned} \end{array}\right. } \end{aligned}$$
(7)

for \(e=1,\cdots ,\texttt {n}_{\texttt {el}}\), where the last equation in (7) has been introduced to remove the indeterminacy of the pressure and \(\rho _e\) denotes the mean pressure on the boundary of element \(\varOmega _e\). The local problem is used to obtain the solution in each element, \(\varvec{L}\), \(\varvec{u}\) and p, for \(e=1,\cdots ,\texttt {n}_{\texttt {el}}\), in terms of \(\hat{\varvec{u}}\) and \(\rho \) along the interface \(\varGamma \cup \varGamma _N\).

Second, a global problem is defined to determine the traces of the velocity and the mean pressure, denoted by \(\hat{\varvec{u}}\) and \(\rho \), on the element boundaries. This is given by

$$\begin{aligned} {\left\{ \begin{array}{ll} \begin{aligned} &{}\llbracket \varvec{u}\otimes \varvec{n}\rrbracket = \varvec{0} &{}&{} \text {on }\varGamma , \\ &{}\llbracket \varvec{n}\cdot (\nu \varvec{L}+p\varvec{I})\rrbracket = \varvec{0} &{}&{} \text {on }\varGamma , \\ &{}\varvec{n}\cdot (\nu \varvec{L}+p\varvec{I}) = -\varvec{t} &{}&{} \text {on }\varGamma _N \end{aligned} \end{array}\right. } \end{aligned}$$
(8)

where the first equation is automatically satisfied due to the unique definition of the hybrid variable \(\hat{\varvec{u}}\) on each face of the mesh skeleton and the condition \(\varvec{u}=\hat{\varvec{u}}\) on \(\varGamma \), as imposed in the local problem.

The weak formulation for each element equivalent to (7) is as follows: for \(e=1,\cdots ,\texttt {n}_{\texttt {el}}\), given \(\varvec{u}_D\) on \(\varGamma _D\) and \(\hat{\varvec{u}}\) on \(\varGamma \cup \varGamma _N\), find \((\varvec{L}, \varvec{u}, p) \in \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} \times \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}} \times \mathcal {L}_2(\varOmega _e)\) that satisfies

$$\begin{aligned}&- \bigl ({\varvec{G}},{\varvec{L}}\bigr )_{\varOmega _e} + \bigl ({{\varvec{\nabla }{\cdot }}\varvec{G}},{\varvec{u}}\bigr )_{\varOmega _e} = \bigl \langle {\varvec{n} \cdot \varvec{G}},{\varvec{u}_D}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {\varvec{n} \cdot \varvec{G}},{\hat{\varvec{u}}}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D }\end{aligned}$$
(9a)
$$\begin{aligned}&-\bigl ({\varvec{\nabla } \varvec{v}},{\nu \varvec{L}}\bigr )_{\varOmega _e} -\bigl ({{\varvec{\nabla }{\cdot }}\varvec{v}},{p}\bigr )_{\varOmega _e} + \bigl \langle {\varvec{v}},{\varvec{n} \cdot \widehat{(\nu \varvec{L} + p \varvec{I})} }\bigr \rangle _{\partial \varOmega _e} = \bigl ({\varvec{v}},{\varvec{s}}\bigr )_{\varOmega _e} \end{aligned}$$
(9b)
$$\begin{aligned}&\bigl ({\varvec{\nabla } w},{\varvec{u}}\bigr )_{\varOmega _e} = \bigl \langle {w},{\varvec{u}_D \cdot \varvec{n}}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {w},{\hat{\varvec{u}} \cdot \varvec{n}}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D } \end{aligned}$$
(9c)
$$\begin{aligned}&\bigl \langle {p},{1}\bigr \rangle _{\partial \varOmega _e} = \rho _e \end{aligned}$$
(9d)

for all \((\varvec{G}, \varvec{v}, w) \in \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} \times \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}} \times \mathcal {L}_2(\varOmega _e)\), where the numerical trace of the normal flux is defined as

$$\begin{aligned} \varvec{n} \cdot \widehat{(\nu \varvec{L} + p \varvec{I})} := {\left\{ \begin{array}{ll} \varvec{n} \cdot (\nu \varvec{L} + p \varvec{I}) +\tau (\varvec{u} - \varvec{u}_D) &{} \text {on } \partial \varOmega _e\cap \varGamma _D\\ \varvec{n} \cdot (\nu \varvec{L} + p \varvec{I}) +\tau (\varvec{u} - \hat{\varvec{u}} ) &{} \text {elsewhere}, \end{array}\right. } \end{aligned}$$
(10)

with \(\tau \) being a stabilisation parameter, whose selection has an important effect on the stability, accuracy and convergence properties of the resulting HDG method. The influence of the stabilisation parameter has been studied extensively by Cockburn and co-workers, see for instance [8, 11, 39,40,41,42].

Introducing the definition of the numerical trace of the normal flux in Eq. 9 leads to the weak form of the local problem: for \(e=1,\cdots ,\texttt {n}_{\texttt {el}}\), find \((\varvec{L}, \varvec{u}, p) \in \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} \times \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}} \times \mathcal {L}_2(\varOmega _e)\) such that

$$\begin{aligned} - \bigl ({\varvec{G}},{\varvec{L}}\bigr )_{\varOmega _e} + \bigl ({{\varvec{\nabla }{\cdot }}\varvec{G}},{\varvec{u}}\bigr )_{\varOmega _e}&= \bigl \langle {\varvec{n} \cdot \varvec{G}},{\varvec{u}_D}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {\varvec{n} \cdot \varvec{G}},{\hat{\varvec{u}}}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D } , \end{aligned}$$
(11a)
$$\begin{aligned}&\qquad - \bigl ({\varvec{\nabla } \varvec{v}},{\nu \varvec{L}}\bigr )_{\varOmega _e} + \bigl \langle {\varvec{v}},{ \varvec{n} \cdot \nu \varvec{L}}\bigr \rangle _{\partial \varOmega _e} + \bigl \langle {\varvec{v}},{\tau \varvec{u} }\bigr \rangle _{\partial \varOmega _e}\nonumber \\&\qquad -\bigl ({{\varvec{\nabla }{\cdot }}\varvec{v}},{p}\bigr )_{\varOmega _e} + \bigl \langle {\varvec{v}},{p \varvec{n} }\bigr \rangle _{\partial \varOmega _e}\nonumber \\&= \bigl ({\varvec{v}},{\varvec{s}}\bigr )_{\varOmega _e} + \bigl \langle {\varvec{v}},{\tau \varvec{u}_D }\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {\varvec{v}},{\tau \hat{\varvec{u}} }\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D }, \end{aligned}$$
(11b)
$$\begin{aligned} \bigl ({\varvec{\nabla } w},{\varvec{u}}\bigr )_{\varOmega _e}&= \bigl \langle {w},{\varvec{u}_D \cdot \varvec{n}}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} + \bigl \langle {w},{\hat{\varvec{u}} \cdot \varvec{n}}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D } \end{aligned}$$
(11c)
$$\begin{aligned} \bigl \langle {p},{1}\bigr \rangle _{\partial \varOmega _e}&= \rho \end{aligned}$$
(11d)

for all \((\varvec{G}, \varvec{v}, w) \in \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} \times \left[ \mathcal {H}^{1}(\varOmega _e)\right] ^{\texttt {n}_{\texttt {sd}}} \times \mathcal {L}_2(\varOmega _e)\).

For the global problem, the weak formulation equivalent to (8) is: find \(\hat{\varvec{u}}\! \in \! \left[ \mathcal {L}_2(\varGamma \cup \varGamma _N)\right] ^{\texttt {n}_{\texttt {sd}}}\) and \(\rho \in \mathbb {R}^{\texttt {n}_{\texttt {el}}}\) that satisfies

$$\begin{aligned}&\sum _{e=1}^{\texttt {n}_{\texttt {el}}} \Big \{ \bigl \langle {\varvec{\mu }},{\varvec{n}\cdot \widehat{(\nu \varvec{L}+p\varvec{I})}}\bigr \rangle _{\partial \varOmega _e\setminus \partial \varOmega } + \bigl \langle {\varvec{\mu }},{\varvec{n}\cdot \widehat{(\nu \varvec{L}+p\varvec{I})} + \varvec{t}}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _N} \Big \}= 0 \end{aligned}$$
(12a)
$$\begin{aligned}&\bigl \langle {\hat{\varvec{u}} \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D } = - \bigl \langle {\varvec{u}_D \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D} \qquad \text {for }e=1,\cdots ,\texttt {n}_{\texttt {el}}, \end{aligned}$$
(12b)

for all \(\varvec{\mu } \in \left[ \mathcal {L}_2(\varGamma \cup \varGamma _N)\right] ^{\texttt {n}_{\texttt {sd}}}\).

Introducing the definition of the numerical trace of the normal flux in Eq. 12 leads to the weak form of the global problem: find \(\hat{\varvec{u}} \in \left[ \mathcal {L}_2(\varGamma \cup \varGamma _N)\right] ^{\texttt {n}_{\texttt {sd}}}\) and \(\rho \in \mathbb {R}^{\texttt {n}_{\texttt {el}}}\) such that, for all \(\varvec{\mu } \in \left[ \mathcal {L}_2(\varGamma \cup \varGamma _N)\right] ^{\texttt {n}_{\texttt {sd}}}\),

$$\begin{aligned}&\sum _{e=1}^{\texttt {n}_{\texttt {el}}} \Big \{ \Big . \bigl \langle {\varvec{\mu }},{\varvec{n}\cdot \nu \varvec{L}}\bigr \rangle _{\partial \varOmega _e\setminus \varGamma _D } + \bigl \langle {\varvec{\mu }},{ \tau \varvec{u} }\bigr \rangle _{\partial \varOmega _e\setminus (\varGamma _D \cup \varGamma _S)} + \bigl \langle {\varvec{\mu }},{p \varvec{n}}\bigr \rangle _{\partial \varOmega _e\setminus \varGamma _D ) }\nonumber \\&\quad \Big . - \bigl \langle {\varvec{\mu }},{ \tau \hat{\varvec{u}}}\bigr \rangle _{\partial \varOmega _e\setminus \varGamma _D } \Big \}= -\sum _{e=1}^{\texttt {n}_{\texttt {el}}} \left\{ \bigl \langle {\varvec{\mu }},{\varvec{t}}\bigr \rangle _{\partial \varOmega _e\cap \varGamma _N} \right\} , \end{aligned}$$
(13a)
$$\begin{aligned}&\bigl \langle {\hat{\varvec{u}} \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \setminus \varGamma _D} = - \bigl \langle {\varvec{u}_D \cdot \varvec{n}},{1}\bigr \rangle _{\partial \varOmega _e \cap \varGamma _D}. \end{aligned}$$
(13b)

3 Spatial Discretisation

This section presents the discretisation of the HDG weak forms derived in the previous section. Both the standard isoparametric and the so-called NEFEM formulations are presented. Special attention is paid to the differences between both formulations as this represents the first time NEFEM is considered in an HDG framework.

3.1 Isoparametric Elements

Standard isoparametric formulations map each element \(\varOmega _e\) and face \(\varGamma _e\) in the physical domain into a reference element, \(\widetilde{\varOmega }\), and a reference face, \(\widetilde{\varGamma }\), where polynomial functional approximations characterize the discrete finite dimensional spaces. Namely, \({\mathcal {P}}^k (\widetilde{\varOmega })\) and \({\mathcal {P}}^{\hat{k}} (\widetilde{\varGamma })\) are the spaces of polynomial functions of degree at most \(k \ge 1\) and \(\hat{k} \ge 1\) in the reference element and the reference face respectively. Finally, the approximations for each variable are defined as

$$\begin{aligned} \varvec{u}(\varvec{\xi }) \simeq \varvec{u}^h(\varvec{\xi })= & {} \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \mathbf {u}_j N_j(\varvec{\xi }) \qquad \in \bigl [\{ v\in \mathcal {L}_2(\varOmega ); \, v\vert _{\varOmega _e} \in {\mathcal {P}}^k (\widetilde{\varOmega }) \}\bigr ]^{\texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(14)
$$\begin{aligned} p(\varvec{\xi }) \simeq p^h(\varvec{\xi })= & {} \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \text {p}_j N_j(\varvec{\xi })\qquad \in \{ q\in \mathcal {L}_2(\varOmega ); \, q\vert _{\varOmega _e} \in {\mathcal {P}}^k (\widetilde{\varOmega }) \} , \end{aligned}$$
(15)
$$\begin{aligned} \varvec{L}(\varvec{\xi }) \simeq \varvec{L}^h(\varvec{\xi })= & {} \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \mathbf {L}_j N_j(\varvec{\xi }) \qquad \in \bigl [\{ v\in \mathcal {L}_2(\varOmega ); \, v\vert _{\varOmega _e} \in {\mathcal {P}}^k (\widetilde{\varOmega }) \}\bigr ]^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(16)
$$\begin{aligned} \hat{\varvec{u}}(\varvec{\eta }) \simeq \hat{\varvec{u}}^h(\varvec{\eta })= & {} \sum _{j=1}^{\texttt {n}_{\texttt {fn}}} \hat{\mathbf {u}}_j \hat{N}_j(\varvec{\eta }) \qquad \in \bigl [\{ v\in \mathcal {L}_2(\varGamma ); \, v\vert _{\varGamma _e} \in {\mathcal {P}}^{\hat{k}} (\widetilde{\varGamma }) \}\bigr ]^{\texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(17)

where \(\mathbf {u}_j\) , \(\text {p}_j\), \(\mathbf {L}_j\) and \(\hat{\mathbf {u}}_j\) are nodal values, \(N_j\) are polynomial shape functions of order k in the reference element, \(\texttt {n}_{\texttt {en}}\) is the number of nodes per element, \(\hat{N}_j\) are polynomial shape functions of order \(\hat{k}\) in the reference face and \(\texttt {n}_{\texttt {fn}}\) is the corresponding number of nodes per face. Note that equal interpolation is used for all element variables (i.e. velocity, pressure and gradient of velocity). Recall that HDG allows for equal interpolation because of the numerical fluxes and the stabilisation parameter \(\tau \). They ensure solvability and stability, see [8], without the need of an enriched space for the gradient variable, or a reduced space for the trace variable.

An isoparametric mapping is used to link the reference element \(\hat{\varOmega }\) and the computational element \(\varOmega _e^h\)

$$\begin{aligned} \varvec{\varphi }\; :\widetilde{\varOmega } \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}}\longrightarrow & {} \varOmega _e^h \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}}\nonumber \\ \varvec{\xi }\longmapsto & {} \varvec{\varphi }(\varvec{\xi }):= \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \varvec{x}_j N_j(\varvec{\xi }), \end{aligned}$$
(18)

where \(\varvec{x}_j\) are the nodal coordinates of the computational element \(\varOmega _e^h\).

It is worth noting that in general, when the physical element \(\varOmega _e\) is curved, the isoparametric mapping is non-linear and the approximation defined in the reference element do not induce a polynomial interpolation in the physical space. In addition, the computational element \(\varOmega _e^h\) is just an approximation of \(\varOmega _e\), see [53] for a detailed discussion.

Similarly, an isoparametric mapping is used to link the reference face \(\hat{\varGamma }\) and the computational face \(\varGamma _e^h\)

$$\begin{aligned} \varvec{\psi }\; : \widetilde{\varGamma } \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}-1}\longrightarrow & {} \varGamma _e^h \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}}\nonumber \\ \varvec{\eta }\longmapsto & {} \varvec{\psi }(\varvec{\eta }):= \sum _{j=1}^{\texttt {n}_{\texttt {fn}}} \varvec{x}_j \hat{N}_j(\varvec{\eta }), \end{aligned}$$
(19)

where \(\varvec{x}_j\) denote the face nodal coordinates.

Using the mappings in Eqs. (18) and (19), the integrals appearing in the weak form of the local problems are transformed to the reference element and reference face/edge respectively. Then, the nodal interpolations given by Eqs. (14)–(17) are introduced, leading to a system of equations for each element with the following structure

$$\begin{aligned} \left[ \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} \mathbf {A}_{LL} &{} \mathbf {A}_{Lu} &{} \varvec{0} &{} \varvec{0}\\ \mathbf {A}_{uL} &{} \mathbf {A}_{uu} &{} \mathbf {A}_{up} &{} \varvec{0}\\ \varvec{0} &{} \mathbf {A}_{pu} &{} \varvec{0} &{}\varvec{a}_{\rho p}^T\\ \varvec{0} &{} \varvec{0} &{}\varvec{a}_{\rho p} &{} 0 \end{array}\right] \left\{ \begin{array}{c} \mathbf {L}\\ \mathbf {u}\\ \mathbf {p}\\ \zeta \end{array}\right\} = \left\{ \begin{array}{c} \mathbf {f}_L\\ \mathbf {f}_u\\ \mathbf {f}_p\\ 0 \end{array}\right\} + \left[ \begin{array}{c} \mathbf {A}_{L\hat{u}}\\ \mathbf {A}_{u\hat{u}}\\ \mathbf {A}_{p\hat{u}}\\ \varvec{0} \end{array}\right] \hat{\mathbf {u}}+ \left\{ \begin{array}{c} \varvec{0}\\ \varvec{0}\\ \varvec{0}\\ 1 \end{array}\right\} \rho , \end{aligned}$$
(20)

where \(\zeta \) is the Lagrange multiplier corresponding to the constraint of Eq. (11d).

Analogously, using the isoparametric mappings, the nodal interpolations of the corresponding variables and introducing the expression of \(\mathbf {L}\), \(\mathbf {u}\) and \(\mathbf {p}\) from Eq. (20) in the global problem of Eq. (13), a global system of equations is obtained

$$\begin{aligned} \widehat{\mathbf {K}} \hat{\mathbf {U}} = \hat{\mathbf {f}}, \end{aligned}$$
(21)

where the vector of unknowns \(\hat{\mathbf {U}}\) contains the nodal values of the trace of the velocity on the elementa faces and the mean pressure within each element.

3.2 NEFEM Elements

In NEFEM, the boundary of the computational domain \(\partial \varOmega \) is exactly represented by NURBS. In what follows, in order to simplify the presentation and without loss of generality, the NURBS are restricted to two dimensional problems, see [52] for a detailed description of the three dimensional case. An edge is given by \(\varGamma _e := \varvec{C}([\lambda ^e_a,\lambda ^e_b])\), where \(\varvec{C}\) is the NURBS boundary parametrisation and \(\lambda _a\) and \(\lambda _b\) are the parametric coordinates (in the parametric space of the NURBS) of the end points of \(\varGamma _e\).

The discrete approximations are defined now as:

$$\begin{aligned} \varvec{u}(\varvec{x}) \simeq \varvec{u}^h(\varvec{x})&= \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \mathbf {u}_j N_j(\varvec{x})&\in \bigl [\{ v\in \mathcal {L}_2(\varOmega ); \, v\vert _{\varOmega _e} \in {\mathcal {P}}^k (\varOmega _e) \}\bigr ]^{\texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(22)
$$\begin{aligned} p(\varvec{x}) \simeq p^h(\varvec{x})&= \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \text {p}_j N_j(\varvec{x})&\in \{ q\in \mathcal {L}_2(\varOmega ); \, q\vert _{\varOmega _e} \in {\mathcal {P}}^k (\varOmega _e) \} , \end{aligned}$$
(23)
$$\begin{aligned} \varvec{L}(\varvec{x}) \simeq \varvec{L}^h(\varvec{x})&= \sum _{j=1}^{\texttt {n}_{\texttt {en}}} \mathbf {L}_j N_j(\varvec{x})&\in \bigl [\{ v\in \mathcal {L}_2(\varOmega ); \, v\vert _{\varOmega _e} \in {\mathcal {P}}^k (\varOmega _e) \}\bigr ]^{\texttt {n}_{\texttt {sd}}\times \texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(24)
$$\begin{aligned} \hat{\varvec{u}}(\varvec{\lambda }) \simeq \hat{\varvec{u}}^h(\varvec{\lambda })&= \sum _{j=1}^{\texttt {n}_{\texttt {fn}}} \hat{\mathbf {u}}_j \hat{N}_j(\varvec{\lambda })&\in \bigl [\{ v\in \mathcal {L}_2(\varGamma ); \, v\vert _{[\lambda ^e_a,\lambda ^e_b]} \in {\mathcal {P}}^{\hat{k}} ([\lambda ^e_a,\lambda ^e_b]) \}\bigr ]^{\texttt {n}_{\texttt {sd}}} , \end{aligned}$$
(25)

where \(\mathbf {u}_j\), \(\text {p}_j\), \(\mathbf {L}_j\) and \(\hat{\mathbf {u}}_j\) are nodal values, \(N_j\) are polynomial shape functions of order k in the physical element, \(\texttt {n}_{\texttt {en}}\) is the number of nodes per element, \(\hat{N}_j\) are polynomial shape functions of order \(\hat{k}\) in \([\lambda ^e_a,\lambda ^e_b]\) and \(\texttt {n}_{\texttt {fn}}\) is the corresponding number of nodes per face.

The main differences of NEFEM with respect to the isoparametric formulation are:

  • The exact description of the computational domain is considered by means of its NURBS boundary representation.

  • The approximation of the elemental variables directly in the physical space, with Cartesian coordinates.

  • The approximation of the trace of the velocity is defined in the parametric space of the NURBS. It is worth noting that other options could be considered such as defining the approximation directly in the physical space. The main advantage of defining the approximation in the parametric space of the NURBS is that the number of unknowns remains the same as in the isoparametric formulation. In contrast, if the approximation of this variable is selected in the physical space it would require further degrees of freedom [53, 54].

In addition, from the computational point of view, NEFEM uses specifically designed numerical quadratures that provide a more efficient alternative to standard quadratures defined in a reference triangle [51, 52]. For instance, in two dimensions, the following mapping is introduced between a reference rectangle and the physical element

$$\begin{aligned} \varvec{\psi }: R \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}}\longrightarrow & {} \varOmega _e \subset \mathbb {R}^{\texttt {n}_{\texttt {sd}}} \nonumber \\ \varvec{\lambda }\longmapsto & {} \varvec{\psi } (\varvec{\lambda }):= (1-\vartheta ) \varvec{C}(\lambda _1) + \lambda _2 \varvec{x}_I, \end{aligned}$$
(26)

where \(R = [\lambda ^e_a,\lambda ^e_b] \times [0,1]\) and \(\varvec{x}_I\) is the internal vertex of \(\varOmega _e\).

Using the mapping in Eq. (26) and the NURBS boundary representation given by \(\varvec{C}\), the integrals appearing in the weak form of the local problems are transformed to the reference rectangle and the parametric space of the NURBS respectively. Then, the nodal interpolations given by Eqs. (22), (23), (24) and (25) are introduced, leading to a system of equations similar to Eq. (20). Analogously, the global problem with NEFEM leads to a global system of equations similar to Eq. (21).

4 Error Estimation and Adaptivity

In HDG, the possibility to obtain a postprocessed solution [11] that converges at a higher rate (i.e. \(k+2\)) than the HDG solution, not only provides a higher accurate solution to the problem at hand but it can also be used to build an inexpensive, reliable and computable error estimator [23, 24]. In this section, particular attention is paid to the fact that, when the degree of approximation is changed in a curved element, a choice must be made regarding the geometric definition of the element.

An element by element measure of the error is defined by employing the HDG solution and the postprocessed solution as proposed in [24]

$$\begin{aligned} E_e = \left[ \frac{1}{|\varOmega _e|} \int _{\varOmega _e} \left( \varvec{u}^\star - \varvec{u} \right) \cdot \left( \varvec{u}^\star - \varvec{u} \right) d\varOmega \right] ^{1/2}, \end{aligned}$$
(27)

where the normalisation becomes critical when meshes with different element sizes are considered [18].

For elliptic problems, and by using that the influence of pollution errors becomes negligible if the mesh is sufficiently refined in the area where the pollution error is generated [28], the following a priori error estimate was derived in [18]

$$\begin{aligned} \varepsilon _e = \Vert \varvec{u} - \varvec{u}_h \Vert _{\varOmega _e} \le C h_e^{k_e + 1 + \texttt {n}_{\texttt {sd}}/2}, \end{aligned}$$
(28)

for \(e=1,\ldots ,\texttt {n}_{\texttt {el}}\), where C is a constant, \(h_e\) the characteristic element size of \(\varOmega _e\) and \(k_e\) the degree of approximation used in \(\varOmega _e\). It is worth noting that the error estimate of Eq. (28) was initially derived for the standard finite element method but its extension to the HDG method is straightforward.

By applying a standard Richardson extrapolation, it is possible to predict the required change in the degree of approximation in order to ensure that the error in each element is lower than a desired accuracy \(\epsilon \), namely

$$\begin{aligned} \varDelta k_e = \left\lceil \frac{\log (\varepsilon /E_e)}{\log (h_e)} \right\rceil \end{aligned}$$
(29)

for \(e=1,\ldots ,\texttt {n}_{\texttt {el}}\), where \(\lceil \cdot \rceil \) denotes the ceiling function.

The adaptive procedure consist on solving the Stokes problem using the HDG formulation as described in Sect. 3 and estimating the required degree of approximation in each element according to Eq. (29). The process is repeated until convergence is achieved, meaning that the error in each element \(\varepsilon _e\) is lower than the desired error \(\epsilon \).

4.1 Geometry Update

The technique described to drive a degree adaptive process only focuses on the degree of approximation used for the functional approximation, but in the presence of curved boundaries it is known that high-order approximations of both the solution and the geometry are required to exploit the full potential of a high-order method [2, 17, 34, 55]. This aspect is usually ignored as degree adaptive procedures are applied to problems involving polygonal boundaries, see for instance [16, 22, 45, 61]. Here three options are discussed and assessed and compared later using numerical examples.

The first, and the one typically considered in a degree adaptive process, technique consists of defining a polynomial representation of the curved boundaries that is maintained during the adaptive process, irrespectively of the degree of approximation used for the solution [23, 24, 35]. This option is attractive because when the degree of approximation is changed in an element, there is no need to communicate with a CAD library to re-generate the nodal distributions in curved elements at each iteration of the degree adaptive process. The strategy is illustrated in Fig. 1. The first row of plots show triangular elements where the geometric approximation is linear (\(q=1\)) and the polynomial degree of approximation of the solution increases from \(k=1\) to \(k=3\). The second row shows a similar situation where the boundary of the computational domain is described using quadratic polynomials (\(q=2\)) and the degree of approximation of the solution is increased from \(k=2\) to \(k=4\). The boundary of the computational domain is denoted by \(\partial \varOmega ^h\) whereas the exact boundary is denoted by \(\partial \varOmega \).

Fig. 1
figure 1

Illustration of a degree adaptation in an element with linear (top) and quadratic (bottom) approximation of the geometry

The second alternative, proposed in this work, consists of using NEFEM, where the exact boundary representation of the computational domain is considered irrespectively of the degree of approximation considered for the solution. As NEFEM encapsulates the necessary information to define the approximation and perform the numerical integration in curved elements in contact with a NURBS boundary, communication with a CAD library is avoided. The strategy is illustrated in Fig. 2, showing a NEFEM element where the exact boundary representation is considered and a degree of approximation for the solution being increased from \(k=1\) to \(k=3\).

Fig. 2
figure 2

Illustration of a degree adaptation in a NEFEM element

A third alternative, not considered in practice, consists of communicating with the CAD model after each iteration of the degree adaptive process in order to re-generate the nodal distribution of curved elements by placing the nodes over the true boundary. The strategy is illustrated in Fig. 3, showing a triangular element where both the degree of the functional approximation and the degree of the polynomials used to approximate the solution are updated at each iteration. This strategy has not been considered in practical applications due to the cost associated to communicating with the CAD model at each iteration.

Fig. 3
figure 3

Illustration of a degree adaptation in an element where the same degree of approximation is used for both the solution and the geometry

Remark 1

It is important to note that the first strategy, where the geometry remains unchanged, does not guarantee the convergence of the numerical solution to the physical solution in domains with curved boundaries because the distance between the computational domain and the physical domain does not converge to zero with as the degree of approximation is increased, see [6, 49] for more details. For the second strategy, proposed here, convergence to the physical solution is guaranteed because no geometrical error is introduced [54]. Finally, for the third approach, convergence is also guaranteed if the distance between the computational boundary and the physical boundary tends to zero as the order of the approximation is increased and the derivatives of the isoparametric mapping up to order \(k+1\) are bounded by \(h^s\), for \(s=2,\ldots ,k+1\) [6, 49], where h denotes the characteristic element size. It is worth noting that a specifically designed nodal distribution for curved elements is required in the third approach to guarantee that the second hypothesis is fulfilled [6].

5 Validation of the HDG Formulation with Variable Degree of Approximation

The first example provides a novel and simple technique to fully validate a solver that employs variable different degree of approximation in different elements for the solution of elliptic problems. The idea consists of utilising the local a priori error estimate of Eq. (28) that states how the error, measured in an element, decreases when the mesh is refined.

To illustrate the proposed technique and validate the HDG isoparametric and NEFEM implementations with variable degree of approximation, the Stokes equations are solved in a circle of radius 0.5 centred at (0.5, 0.5) with Dirichlet boundary conditions. The viscosity is considered as \(\nu =1\) and source and boundary conditions are taken such that the analytical solution is given by

$$\begin{aligned} \varvec{u} = \begin{pmatrix} x^2(1-x)^2(2y-6y^2+4y^3)\\ -y^2(1-y)^2(2x-6x^2+4x^3) \end{pmatrix} \qquad p = x(1-x). \end{aligned}$$
(30)

Six triangular meshes of the domain are generated using nested refinement. The first three meshes are shown in Fig. 4, where the colour of each element represents the degree of approximation used, ranging from \(k=1\) to \(k=6\). In each mesh, there is one element per degree of approximation highlighted with a thicker line and darker colour, representing the region where the error is measured to test the local a priori error estimate. It is worth noting that the meshes shown in Fig. 4 are NEFEM meshes, as the exact boundary representation is always employed, even for \(k=1\), whereas for the computations both NEFEM and isoparametric meshes are employed.

Fig. 4
figure 4

First three NEFEM meshes where the colour indicates the degree of approximation used in each element and the highlighted element represents the region where the error is measured for each degree of approximation. a Mesh 1. b Mesh 2. c Mesh 3

The results of the h-convergence study are presented in Figs. 5 and 6. Figure 5 shows the error of the solution \(\varvec{u}\) and the postprocessed solution \(\varvec{u}^\star \) in the \(\mathcal {L}_2(\varOmega _e)\) norm for isoparametric and NEFEM elements for \(k=1, \ldots , 5\). The optimal rate of convergence is obtained in all cases for both the solution \(\varvec{u}\) (rate \(k+2\)) and the postprocessed solution \(\varvec{u}^\star \) (rate \(k+3\)).

Fig. 5
figure 5

Error of the solution \(\varvec{u}\) and the postprocessed solution \(\varvec{u}^\star \) in the \(\mathcal {L}_2(\varOmega _e)\) norm for different degrees of approximation in each element. a HDG Isoparametric. b HDG NEFEM

In Fig. 6 a similar analysis is conducted, but now the error is measured for the dual variable \(\varvec{L}\) and the pressure p, also in the \(\mathcal {L}_2(\varOmega _e)\) norm and for isoparametric and NEFEM elements.

Fig. 6
figure 6

Error of the dual variable \(\varvec{L}\) and the pressure p in the \(\mathcal {L}_2(\varOmega _e)\) norm for different degrees of approximation in each element. a HDG Isoparametric. b HDG NEFEM

Again, the optimal rate of convergence is obtained in all cases for both \(\varvec{L}\) and p (rate \(k+2\)).

6 Comparison of Degree Adaptivity Strategies

The same model problem employed in the previous example is utilised to compare the strategies described in Sect. 4.1 to update the geometry during a degree adaptive process. The computational domain selected, shown in Fig. 7, features an oscillatory boundary and represents a common problem encountered in biological transport applications, see for instance [50]. More precisely, the curved part of the boundary is given by the curve \(f(x) = (1 + \cos (5\pi x))/10\).

Dirichlet boundary conditions are imposed on the polygonal part of the boundary whereas a Neumann boundary condition, corresponding to the exact traction derived from the solution in Eq. (30) is imposed on the oscillatory part of the boundary.

Fig. 7
figure 7

Computational domain for the test problem used to compare the different geometry update options in a degree adaptive process

6.1 No Geometric Update

First, the degree adaptive process with no communication with the CAD model is studied, as illustrated in Fig. 1. The process starts with a degree of approximation \(k=1\) in all elements. At each iteration the degree of the functional approximation is adapted according to the strategy presented in Sect. 4 whereas a linear approximation of the geometry is kept irrespectively of the degree of the functional approximation. Figure 8 shows the original mesh, the estimated error and the exact error, computed by using the known analytical solution. The \(\mathcal {L}_2\) norm of the error is represented as a constant value in each element, showing a good agreement between the estimated and the exact error.

Fig. 8
figure 8

First iteration of the degree adaptivity procedure with HDG isoparametric elements. a Degree. b Estimated error. c Exact error

After six iterations of the adaptivity process, the degree of approximation is adapted in each element as shown in Fig. 9a but a linear geometric approximation of the curved boundary is still considered. The estimated error in each element, shown in Fig. 9b, is below the desired error which is \(0.5 \times 10^{-2}\) in this example but the computation of the exact error, shown in Fig. 9c, reveals a significant disparity when compared to the estimated error.

Fig. 9
figure 9

Sixth iteration of the degree adaptivity procedure with no geometric update using HDG isoparametric elements and \(q=1\). a Degree. b Estimated error. c Exact error

To better analyse the results, Fig. 10 shows the evolution of the maximum estimated error in each element and the maximum exact in each element for different geometric approximations of the curved boundary. Figure 10a corresponds to the case illustrated in Figs. 8 and 9, where a linear approximation of the geometry is considered (\(q=1\)). It can be clearly observed that, as the degree adaptive process evolves, the difference between estimated and exact error becomes more and more sizeable. In the sixth iteration, the adaptive process shows convergence, with an estimated error less than the desired error \(0.5 \times 10^{-2}\) but this is two orders of magnitude lower than the exact error, clearly indicating that the error estimator is not reliable because the estimator assumes that the geometry is exactly represented.

Fig. 10
figure 10

Evolution of the estimated and exact errors during a degree adaptivity process for different degrees of the polynomials used to approximate the geometry (q). a \(q=1\). b \(q=2\). c \(q=3\). d \(q=4\)

As a linear approximation of the geometry is well known to be not suitable when high order functional approximations are considered [2, 7, 54, 60], the same experiment is repeated by using a more accurate boundary representation. The plots in Fig. 10b–d show the evolution of the maximum estimated error in each element and the maximum exact in each element for quadratic, cubic and quartic approximation of the geometry. In all cases it is clearly observed that the error estimator is not reliable because the adaptive process converges but the exact error is more than one order of magnitude higher than the desired error.

The degree of approximation, estimated error and exact error obtained in the last iteration of the adaptive process for \(q=4\) is represented in Fig. 11. The results show that even with a more accurate geometric approximation, the exact error in the elements close to the curved boundary is much higher than the estimated error. There is clear evidence that, if no communication with a CAD model is undertaken during the degree adaptive process, the original mesh must be pre-adapted manually in order to ensure that the geometric error is small enough in order to ensure that the error estimator is reliable, clearly compromising the robustness of the whole adaptivity process.

Fig. 11
figure 11

Sixth iteration of the degree adaptivity procedure with no geometric update using HDG isoparametric elements and \(q=4\). a Degree. b Estimated error. c Exact error

6.2 NEFEM HDG

The strategy proposed in this work consists of utilising NEFEM, where the geometry is always given by its CAD boundary representation, irrespective of the degree of the functional approximation. In the context of a degree adaptive process, this means that no communication the CAD model is required as the exact boundary representation is already used by the NEFEM solver.

The process starts with a degree of approximation \(k=1\) in all elements. At each iteration the degree of the functional approximation is adapted according to the strategy presented in Sect. 4 and a new nodal distribution is generated for each curved element.

Figure 12 shows the original mesh, the estimated error and the exact error, computed by using the known analytical solution. It is worth emphasising that, even when the degree of the functional approximation used is linear (\(k=1\)) the exact boundary representation is considered, as shown in Fig. 12a. The results show a very similar distribution for the estimated and exact errors.

Fig. 12
figure 12

First iteration of the degree adaptivity procedure with geometric update using HDG NEFEM elements. a Degree. b Estimated error. c Exact error

In this case, after only three iterations of the degree adaptive process convergence is achieved. The degree of approximation used in each element, the estimated and the exact errors in each element are represented in Fig. 13.

Fig. 13
figure 13

Third iteration of the degree adaptivity procedure with geometric update using HDG NEFEM elements. a Degree. b Estimated error. c Exact error

Remark 2

As discussed in Sect. 4.1, an alternative, not employed in practice due to the high cost induced by the re-generation of the mesh at each iteration of the adaptive process, consists of changing both the degree of approximation for the solution and for the geometry during the adaptivity process, as illustrated in Fig. 3.

To illustrate the superiority of NEFEM, Fig. 14 shows the evolution of the maximum estimated error in each element and the maximum exact error in each element for isoparametric and NEFEM approaches and for two magnitudes of the desired error. Figure 10a corresponds to the case previously illustrated, where the desired error is \(0.5 \times 10^{-2}\), whereas Fig. 10b shows the same study but with a desired error of \(0.5 \times 10^{-3}\). In both cases the superiority of NEFEM is clear as the desired error is achieved by substantially reducing the computational cost (i.e. the number of iterations of the degree adaptive process and the number of degrees of freedom required to achieve the required accuracy).

Fig. 14
figure 14

Estimated and exact errors for isoparametric and NEFEM. a Desired error \(0.5\times 10^{-2}\). b Desired error \(0.5\times 10^{-3}\)

In addition, it is worth emphasising that the isoparametric approach requires communication with the CAD model in each iteration to re-generated the high-order nodal distribution. These nodal distributions in curved elements must be specifically designed to ensure optimal convergence of the isoparametric approach [3, 5], while for NEFEM the Cartesian approximation of the solution ensures that the accuracy of the approximation is much less sensitive to the quality of the nodal distribution.

7 Numerical Examples

This section presents four numerical examples to illustrate the potential of NEFEM when combined with HDG to perform a degree adaptive process. The examples involve geometries with curved boundaries and where coarse meshes are considered to show the robustness of the proposed methodology. In all the examples the high-order isoparametric and NEFEM meshes are generated using the techniques described in [48, 64] and [57] respectively.

7.1 Flow in a Channel with Randomly Distributed Ellipses

The first example, similar to a test case presented in [36], considers the flow around a set of randomly distributed set of 25 ellipses in a channel. Dirichlet boundary conditions are considered in the whole domain corresponding to a parabolic velocity profile on the left (inflow) and right (outflow) boundaries and zero (no-slip) Dirichlet boundary condition on the top and bottom walls and on the boundary of the ellipses, as illustrated in Fig. 15.

Fig. 15
figure 15

Computational domain and boundary conditions for the problem involving a flow in a channel with randomly distributed ellipses

A coarse mesh with 2,443 triangular elements is first considered. As no analytical solution is available, a reference solution is computed in a much finer mesh with 28,150 elements and by employing a degree of approximation \(k=4\). This reference solution is used to measure the accuracy of the adaptive computations performed in much coarse meshes.

An adaptive process is performed using a quadratic approximation of the curved boundaries and standard isoparametric elements with a desired error of \(0.5 \times 10^{-3}\). Figure 16a shows the computational mesh and degree of approximation after five iterations. In the vicinity of the ellipses the majority of elements have a cubic degree of approximation where the elements in contact with the ellipses need a higher order of approximation to capture all the flow features. The highest order of approximation is \(k=6\), used, as expected, with the regions with higher curvature of the boundary. Figure 16b, c show the estimated and the reference errors after the adaptive process converged. The discrepancy between the estimated and the reference errors is clearly observed. Despite the adaptive process converges, meaning that all elements have an estimated error below the desired error, a total of 408 elements have a reference error above the desired tolerance.

Fig. 16
figure 16

Final degree distribution, estimated and reference errors for an adaptive computation with isoparametric HDG and quadratic approximation of the curved boundaries in a coarse mesh with 2443 elements. a Degree. b Estimated error. c Exact error

When the same computation is performed by considering a cubic approximation of the geometry (not reported for brevity), the adaptive process converges again in five iterations. he highest order of approximation used in a few elements is now \(k=7\), indicating that a different geometric representation leads to a different degree of approximation required to achieve convergence. In addition, the error estimator is again not reliable as there are 15 elements where the reference error is above the desired error.

It is apparent that an adaptive computation with isoparametric elements requires an initial pre-adaptation of the mesh and the degree of approximation used to approximate the geometry in order to obtain a reliable error estimator. Next, the finer mesh with 4,048 triangular elements depicted in Fig. 17a is considered. When a quadratic approximation of the geometry is considered, the adaptive process converges in four iterations but the results are still not satisfactory as there are 155 elements where the estimated error, shown in Fig. 17b, is above the desired error, represented in Fig. 17c.

Fig. 17
figure 17

Final degree distribution, estimated and reference errors for an adaptive computation with isoparametric HDG and quadratic approximation of the curved boundaries in a finer mesh with 4048 elements. a Degree. b Estimated error. c Exact error

Finally, if a cubic approximation of the geometry is employed the adaptive process converges in only three iterations with one element still showing an error above the desired tolerance. The results clearly indicate that in the presence of curved boundaries the level of pre-adaptation required negates all the advantages of an an automatic adaptive process as the initial mesh has to be designed in such a way so that the error in the first computation is near the desired error.

Fig. 18
figure 18

Final degree distribution, estimated and reference errors for an adaptive computation with HDG-NEFEM in a coarse mesh with 2443 elements. a Degree. b Estimated error. c Exact error

To show the potential of NEFEM in this scenario, an adaptive process is performed employing the coarse mesh with 2,443 triangular elements and starting with a degree of approximation \(k=1\). The adaptive process converges in four iterations. The final degree of approximation used in each element is shown in Fig. 18a, with two elements having the maximum degree of approximation, \(k=6\), required to achieve the desired error. The estimated and reference errors, depicted in Fig. 18b, c, respectively, shows a consistent behaviour that illustrates the reliability of the proposed strategy to estimate the error due to the use of the exact boundary representation. It is worth noting that in the majority of the elements surrounding the ellipses a degree of approximation \(k=3\) is enough to obtain the required error, illustrating why cubic isoparametric elements outperformed the use of quadratic elements in the previous computations.

The velocity field computed with NEFEM on the mesh shown in Fig. 18a is depicted in Fig. 19.

To better analyse the effect of an accurate boundary representation in a degree adaptive procedure, Fig. 20 shows the evolution of the estimated and exact errors as a function of the number of iterations of the adaptive process by using the coarse mesh with 2,443 elements. For a desired error of \(0.5 \times 10^{-3}\) a quadratic approximation of the geometry prevents convergence of the exact error whereas better results are obtained with a cubic representation of the geometry. It is worth noting that in both cases the exact error stagnates, indicating that the geometric error dominates over the interpolation error. Even when a cubic representation of the geometry is considered, the exact error is not decreasing after the third iteration.

Fig. 19
figure 19

Magnitude of velocity and isolines computed with HDG-NEFEM on the mesh shown in Fig. 18a after four iterations of the degree adaptive process

Fig. 20
figure 20

Evolution of the estimated and exact errors during the degree adaptivity process for \(q=2\) and \(q=3\) with isoparametric HDG in the coarse mesh with 2443 elements and a desired error of \(0.5 \times 10^{-3}\). a \(q=2\). b \(q=3\)

To further illustrate the limitations of an isoparametric formulation during a degree adaptivity procedure, the same analysis is repeated with a lower desired error, namely \(0.5 \times 10^{-4}\). Figure 21 shows the evolution of the estimated and exact errors as a function of the number of iterations of the adaptive process by using the coarse mesh with 2,443 elements.

Fig. 21
figure 21

Evolution of the estimated and exact errors during the degree adaptivity process for \(q=2\) and \(q=3\) with isoparametric HDG in the coarse mesh with 2443 elements and a desired error of \(0.5 \times 10^{-4}\). a \(q=2\). b \(q=3\)

The results show that a cubic approximation of the geometry is not enough because the difference between the estimated and exact error in the final computation with cubic elements is almost an order of magnitude. This suggests, once more that the initial mesh has to be pre-adapted to achieve a reliable degree adaptive process.

Finally, Fig. 22 shows the results obtained with NEFEM using the coarse mesh with 2,443 elements and starting with a linear approximation of the solution \(k=1\). The robustness of the proposed approach is clearly illustrated as convergence of both the estimated and exact errors is achieved in the coarse mesh even for a desired error of \(0.5 \times 10^{-4}\). It is worth emphasising that with NEFEM the adaptive process provides a reliable error estimator even when the desired error is several orders of magnitude lower than the error of the computation in the first mesh. The results clearly indicate that no pre-adaptation of the mesh is required with NEFEM as the geometry is exactly represented irrespectively of the spatial discretisation. Therefore, the adaptive process is purely driven by the functional approximation and not by the geometric error as it happens with an isoparametric formulation.

Further numerical experiments, not reported here, indicate that NEFEM is also superior to an isoparametric approach where the mesh is re-generated at each iteration of the adaptive procedure by using the same degree of the approximation for both the geometry and the solution. In all cases, not only the time required by NEFEM is lower (due to the extra time required to communicate with the CAD model and the mesh generator) but also due to the fact that more iterations of the adaptive process are required with an isoparametric formulation.

Fig. 22
figure 22

Evolution of the estimated and exact errors during the degree adaptivity process for NEFEM HDG in the coarse mesh with 2443 elements. a Desired error \(0.5\times 10^{-3}\). b Desired error \(0.5\times 10^{-4}\)

7.2 Flow in a Channel with Wavy Boundaries

The next example considers the flow in a channel with oscillatory boundaries. This problem, of interest to the micro and nano-fluidics community, is often considered to study the flow structure induced by the different phase of the oscillations of the top and bottom boundaries [32, 62]. The two extreme cases are considered here, where the oscillations are exactly on phase and completely out of phase. Figure 23a shows the coarse computational mesh employed with HDG-NEFEM and the final degree of approximation obtained after ten iterations of the degree adaptive process for the case where the boundary oscillations are on phase. Similarly, Fig. 23b shows the mesh and degree of approximation obtained after eight iterations of the degree adaptive process for the case where the boundary oscillations are completely out of phase.

Fig. 23
figure 23

Mesh and degree of approximation of the converged degree adaptive procedure with HDG-NEFEM for the computation of the flow in a channel with oscillations of the top and bottom boundaries. a On phase oscillations. b Out of phase oscillations

The velocity fields obtained for both cases are represented in Fig. 24 showing the ability of the proposed approach to capture the different flow structure induced by the oscillatory boundaries.

Fig. 24
figure 24

Magnitude of velocity computed with HDG-NEFEM after convergence of the degree adaptive procedure on the meshes shown in Fig. 23. a On phase oscillations. b Out of phase oscillations

7.3 Flow in a Porous Media

The next example, taken from [59], considers the flow in the interstices of a porous media. The geometry consists of the surroundings of a large number of particles in the porous media. Figure 25 shows the mesh and degree of approximation after eight iterations of the degree adaptivity procedure.

Fig. 25
figure 25

Mesh and degree of approximation of the converged degree adaptive procedure with HDG-NEFEM and velocity field. a Degree. b Velocity

It is worth noting that a linear degree of approximation is used in many elements in contact with curved boundaries. This shows that the proposed adaptivity strategy is completely driven by the complexity of the solution and not by the complexity of the geometry.

7.4 Flow in a Channel with Thin Obstacles

The last example shows a further benefit of using NEFEM by demonstrating its unique ability to obtain accurate solutions with ultra-coarse meshes even when geometric features, smaller than the element size, are present in the boundary representation of the computational domain.

Fig. 26
figure 26

Mesh and degree of approximation of the converged degree adaptive procedure with HDG-NEFEM for the computation of the flow in a channel with high curvature. a Whole domain. b Zoom

The flow in a channel with a number of thin obstacles is considered. The thickness of the obstacles is approximately 0.08 whereas the minimum element size of the mesh that has been generated, using the technique proposed in [57], is 0.32. The degree adaptive process is started, as in previous examples, with a linear approximation of the solution and convergence is achieved in four iterations. The final degree of approximation in each element is represented in Fig. 26a. Figure 26 shows a detailed view of a region in the channel showing the elements near the end of some of the obstacles. This plot shows not only that the element size is independent on the geometric complexity but it also demonstrates the robustness of the proposed degree adaptive technique. The adaptivity process is clearly driven only by the complexity of the solution as a different degree of approximation is employed in elements with almost identical geometric complexity due to the different complexity of the solution.

The velocity field, obtained on the mesh shown in Fig. 26, is represented in Fig. 27.

Fig. 27
figure 27

Velocity computed with HDG-NEFEM after convergence of the degree adaptive procedure in the mesh of Fig. 26

8 Concluding Remarks

A new degree adaptive methodology that combines the advantages of the HDG formulation and NEFEM has been presented. The proposed method results in a cheap and reliable error estimator due to the cheap computation of a post-processed solution provided by HDG and the ability to exactly represent curved boundaries irrespectively of the polynomial degree used for the functional approximation that is characteristic of NEFEM.

The proposed approach is compared against two alternative options to perform degree adaptivity. The first approach, broadly used in practice, consists of keeping the shape of the curved elements during the degree adaptivity process. It is found that this approach leads to an unreliable error estimator. The numerical examples show that even when the estimated error is below the required tolerance, the exact error can be orders of magnitude higher. The second approach, not used in practice, consists of changing the shape of the curved elements during the adaptive process. The main drawback is its high cost due to the need to constantly communicate with the CAD model and re-generate the nodal distributions for curved elements.

The proposed approach considers, for the first time, the implementation of the NEFEM rationale in an HDG framework. A number of numerical examples have been presented to compare the performance of the proposed methodology and to shows its superiority on a number of problems involving domains with curved boundaries.