1 Introduction

The magnetohydrodynamics (MHD) equations describe the dynamics of a charged system under the interaction with a magnetic field and the conservation of the mass, momentum, and energy for the plasma system. Such a dynamics is considered constrained as the magnetic field of the system is evolved with the constraint of zero divergence, namely, ∇⋅B=0. Numerical modeling of plasmas has shown that the observance of the zero divergence of the magnetic field plays an important role in reproducing the correct physics in the plasma fluid [1]. Various numerical techniques have been devised to ensure the computed magnetic field to maintain divergence-free [2]. In the original work of [1] a projection approach was used to correct the magnetic field to have a zero divergence.

A more natural way to satisfy this constraint is through a class of the so-called constrained transport (CT) numerical methods based on the ideas in [3]. As noted in [4], a piecewise \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) vector field on a finite element triangulation of a spatial domain can be a global \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) field if and only if the normal components on the interface of adjacent elements are continuous. Thus, in most of the CT algorithms for the MHD, the surface averaged magnetic flux over the surface of a 3-D element is used to represent the magnetic field while the volume averaged conserved quantities (mass, momentum, and energy) are used.

In the two seminal papers [5, 6], Nédélec proposed to use quantities (moments of normal and tangential components of vector fields) on edges and faces to define the finite dimensional space in \(\boldsymbol{\mathcal{H} }(\mathbf{div})\) and \(\boldsymbol{\mathcal{H}}(\mathbf{curl})\), respectively. The specific construction of the basis functions in both spaces, specifically in \(\boldsymbol{\mathcal{H}}(\mathbf{div})\), can be done in various ways such as the hierarchical type of basis proposed in [7] for both \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) and \(\boldsymbol{\mathcal{H}}(\mathbf{curl})\). Unfortunately, the proposed hierarchical basis for \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) in [7] turns out to be erroneous as can be easily checked; for the quadratic polynomial approximation of the proposed edge-based basis functions happen to be linearly dependent.

In this paper, we will first present a new hierarchical basis functions in \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) in the tetrahedral case, for completeness, together with a review of the hierarchical basis of \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) for rectangles in 2-D and for a cube in 3-D. An important common feature of the hierarchical basis functions is the fact that for order p≥4 in the case of simplexes, the basis functions will include interior bubble basis functions which have zero normal components on the whole boundary of the element. Therefore, a simple way to enforce the property of being divergence-free can be easily accomplished by adding one single (p+1)th order (any qth order, q≥max(m,p+1),m=4 for tetrahedral element, m=3 for triangular element, and m=2 for quadrilateral or hexahedral element) interior bubble function on each element to a pth order \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) basis. This extra bubble basis will be able to satisfy the local divergence-free condition. Due to the fact of normal continuity of the pth order basis across the element interface and zero normal component of the added-in qth order interior bubble functions, the augmented function space satisfies the divergence-free condition globally. The \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) basis on general meshes other than the reference elements mentioned above are usually constructed by a Piola transform [8] and more recent studies of the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) basis functions on general quadrilateral and hexahedral elements can be found in [810], however, they will not be discussed further in this paper.

The rest of the paper is organized as follows. The constructions of the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) bases are given in Sects. 25 for rectangular and triangular elements in 2-D, and cubic and tetrahedral elements in 3-D. The divergence-free condition is discussed in Sect. 6. Numerical results on the matrix conditioning are given in Sect. 7. Concluding remarks are given in Sect. 8.

2 Basis Functions for the Quadrilateral Element

In [11], Zaglmayr gave a hierarchical basis for quadrilateral \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming element. In this section we summarize the result in [11].

The basis functions are constructed on the reference element—a unit square \(\mathcal{Q}:=[0,1]^{2}\) [11] with vertexes of V 1(0,0), V 2(1,0), V 3(1,1) and V 4(0,1). The coordinate system for the reference element is in terms of the variables (ξ,η). A bilinear function λ i , which is associated with a specific vertex V i , has been utilized for the construction. The multiplicative factors of the bilinear function λ i have been used to form the linear function σ i , viz.

$$ \begin{array}{@{}l@{\qquad}l} \lambda_{1}:=(1-\xi)(1-\eta),&\sigma_{1}:=(1-\xi)+(1-\eta),\\ \lambda_{2}:=\xi(1-\eta),&\sigma_{2}:=\xi+(1-\eta),\\ \lambda_{3}:=\xi\eta,&\sigma_{3}:=\xi+\eta,\\ \lambda_{4}:=(1-\xi)\eta,&\sigma_{4}:=(1-\xi)+\eta. \end{array} $$
(1)

The bilinear function has this favorable property:

$$ \lambda_{i}|_{V_{j}} = \delta_{ij}, $$
(2)

where δ ij is the Kronecker delta. The edge e:=[V i ,V j ], which points from vertex V i to vertex V j , is parameterized by

$$ \zeta_{e} := \sigma_{j} - \sigma_{i} \in[-1, 1]. $$
(3)

For convenience of basis construction, the linear edge-extension parameter is also defined, viz.

$$ \lambda_{e} := \lambda_{i} + \lambda_{j} \in[0, 1], $$
(4)

which is 1 on edge e:=[V i ,V j ] and 0 on the opposite edge. Note that the unit tangential vector τ e and the outward unit normal vector n e can be deduced as

$$ \vec{\tau}_{e} = \frac{1}{2} \nabla\zeta_{e}, \quad\mathbf{n}_{e} = \nabla\lambda_{e}. $$
(5)

2.1 Edge-Based Functions

These functions are further grouped into two categories: the lowest-order and higher-order functions.

Lowest-Order Functions

These functions are associated with the four edges. By construction each function is perpendicular to the associated edge and has unit normal component on the associated edge. Furthermore the divergence of each function is unit. The shape function is given by

$$ \psi_{e_{i}}^{RT_{0}} = \frac{1}{2} \lambda_{e_{i}} ( \nabla\times\zeta_{e_{i}} ) , \quad i = \{1, 2, 3, 4 \}, $$
(6)

which has the property

$$ \vec{\tau}_{e_{i}} \cdot\psi_{e_{i}}^{RT_{0}} = 0, \qquad\mathbf{n}_{e_{i}} \cdot\psi_{e_{i}}^{RT_{0}}|_{e_{i}} = 1, \qquad \nabla\cdot\psi_{e_{i}}^{RT_{0}} = 1. $$
(7)

Higher-Order Functions

The function is taken to be a curl field of a scalar function in order to be free of divergence. The basis function is

$$ \psi_{e_{i}}^{j+1} = \nabla\times \bigl( \lambda _{e_{i}} L_{j+2} ( \zeta_{e_{i}} ) \bigr) , \quad i = \{1, 2, 3, 4\},\ 0 \le j \le p - 1, $$
(8)

where the function L n (•) is the so-called integrated Legendre polynomial of degree n (as given in (29) with t=1) [11]. The obvious property is

$$ \nabla\cdot\psi_{e_{i}}^{j+1} = 0, \quad i = \{1, 2, 3, 4\},\ 0 \le j \le p - 1. $$
(9)

2.2 Interior Functions

The interior functions are classified into three categories.

Type 1 (Curl Field)

The shape functions are given as

$$ \psi_{ij}^{Q_{1}} = \nabla\times \bigl( L_{i+2}(2\xi- 1)L_{j+2}(2\eta- 1) \bigr) , \quad0 \le i, j \le p - 1. $$
(10)

These functions are divergence free, viz.

$$ \nabla\cdot\psi_{ij}^{Q_{1}} = 0, \quad0 \le i, j \le p - 1. $$
(11)

Type 2

The formula of these functions is given as

(12)

On the boundary of the reference element the normal component of these functions vanishes, viz.

$$ \mathbf{n}_{e} \cdot\psi_{ij}^{Q_{2}}|_{e} = 0, \quad0 \le i, j \le p - 1, $$
(13)

which justifies one type of interior functions.

Type 3

The formula of these functions is

$$ \psi_{i}^{Q_{3}^{\xi}}=L_{i+2}(2\xi-1)\hat{ \mathbf{i}}_{\xi},\qquad\psi _{i}^{Q_{3}^{\eta}}=L_{i+2}(2 \eta-1)\hat{\mathbf{j}}_{\eta},\quad0\leq i\leq p-1. $$
(14)

Again on the boundary of the reference element the normal component of these functions vanishes, viz.

$$ \mathbf{n}_{e}\cdot\psi_{i}^{Q_{3}^{\xi}}\big|_{e}=0,\qquad\mathbf{n}_{e}\cdot \psi_{i}^{Q_{3}^{\eta}}\big|_{e}=0,\quad0\leq i\leq p-1. $$
(15)

Table 1 shows the decomposition of the space Q p+1,p ×Q p,p+1 for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming quadrilateral element.

Table 1 Decomposition of the space Q p+1,p ×Q p,p+1 for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming quadrilateral element

3 Basis Functions for the Hexahedral Element

The reference element is defined for a unit cube \(\mathcal{H}:=[0,1]^{3}\) in [11]. The vertexes of the cube are V 1(0,0,0), V 2(1,0,0), V 3(1,1,0), V 4(0,1,0), V 5(0,0,1), V 6(1,0,1), V 7(1,1,1), and V 8(0,1,1). The basis functions are expressed in terms of the trilinear function λ j , which is 1 at the vertex V j and 0 at all other vertexes. Along with the linear function σ j and in terms of the coordinates variables (ξ,η,ζ) they are given as

$$ \begin{array}{@{}l@{\qquad}l} \lambda_{1}:=(1-\xi)(1-\eta)(1-\zeta), &\sigma_{1}:=(1-\xi)+(1-\eta )+(1-\zeta),\\ \lambda_{2}:=\xi(1-\eta)(1-\zeta),&\sigma_{2}:=\xi+(1-\eta)+(1-\zeta),\\ \lambda_{3}:=\xi\eta(1-\zeta),&\sigma_{3}:=\xi+\eta+(1-\zeta),\\ \lambda_{4}:=(1-\xi)\eta(1-\zeta),&\sigma_{4}:=(1-\xi)+\eta+(1-\zeta).\\ \lambda_{5}:=(1-\xi)(1-\eta)\zeta,&\sigma_{5}:=(1-\xi)+(1-\eta)+\zeta,\\ \lambda_{6}:=\xi(1-\eta)\zeta,&\sigma_{6}:=\xi+(1-\eta)+\zeta,\\ \lambda_{7}:=\xi\eta\zeta,&\sigma_{7}:=\xi+\eta+\zeta,\\ \lambda_{8}:=(1-\xi)\eta\zeta,&\sigma_{8}:=(1-\xi)+\eta+\zeta. \end{array} $$
(16)

The edge e:=[V i ,V j ], which points from vertex V i to vertex V j , is parameterized by

$$ \mu_{e} := \sigma_{j} - \sigma_{i} \in[-1, 1]. $$
(17)

The tangential vector associated with the edge e is given by \(\vec{\tau}_{e} = \frac{1}{2}\nabla\mu_{e}\). The edge extension parameter λ e :=λ i +λ j ∈[0,1] is 1 on the edge e and 0 on all other edges that are parallel to the edge e. The face f=[V i ,V j ,V k ,V ] where the vertexes V i and V k are not connected by an edge can be parameterized by

$$ (\xi_{f}, \eta_{f}) := ( \sigma_{i} - \sigma_{j}, \sigma_{i} - \sigma_{\ell}) \in[-1,1] \times[-1,1]. $$
(18)

The linear face extension parameter λ f =λ i +λ j +λ k +λ is equal to 1 on the face f and 0 on the opposite face. The outward unit normal vector of face f can be obtained by n f =∇λ f .

3.1 Face-Based Functions

In this subsection we record the results in [11]. We have also fixed one error in [11]. These functions are associated with the six faces whose formulas are classified into two groups.

Lowest-Order Raviart–Thomas Functions

$$ \psi_{f_{i}}^{\mathcal{RT}_{0}} = \lambda_{f} \mathbf{n}_{f}, \quad i = 1, 2, \ldots, 6. $$
(19)

Higher-Order Functions (Divergence-Free)

These functions are constructed as curl fields of certain vectors in order to be divergence-free. The formulas are given as [11]:

(20)
(21)
(22)

3.2 Interior Functions

The interior functions are further classified into three categories. The triplet (ξ 1,η 2,ζ 3):=(2ξ−1,2η−1,2ζ−1) is used in the formulas. The function n (•) is the classical un-normalized Legendre polynomial of degree n. While we here record the results in [11], we have implemented the correction of a number of mistakes in [11] as well.

Type 1 (Divergence-Free)

These functions are taken to be the curl fields of certain vector functions that are associated with the \(\boldsymbol{\mathcal{H}}(\mathbf{curl})\)-conforming element.

$$ \begin{array}{@{}l} \psi_{i,j,k}^{\mathcal{H}_{1}^{1}}=4L_{i+2}(\xi_{1})\ell_{j+1}(\eta_{2} )\ell_{k+1}(\zeta_{3})\hat{\mathbf{i}}_{\xi}-4\ell_{i+1}(\xi_{1})\ell _{j+1}(\eta_{2})L_{k+2}(\zeta_{3})\hat{\mathbf{k}}_{\zeta},\\[2mm] \quad 0\leq i,j,k\leq p-1.\\[2mm] \psi_{i,j,k}^{\mathcal{H}_{1}^{2}}=4\ell_{i+1}(\xi_{1})L_{j+2}(\eta_{2} )\ell_{k+1}(\zeta_{3})\hat{\mathbf{j}}_{\eta}-4\ell_{i+1}(\xi_{1})\ell _{j+1}(\eta_{2})L_{k+2}(\zeta_{3})\hat{\mathbf{k}}_{\zeta},\\[2mm] \quad 0\leq i,j,k\leq p-1.\\[2mm] \psi_{j,k}^{\mathcal{H}_{1}^{3}}=2\ell_{j+1}(\eta_{2})L_{k+2}(\zeta_{3} )\hat{\mathbf{k}}_{\zeta}-2L_{j+2}(\eta_{2})\ell_{k+1}(\zeta_{3}) \hat{\mathbf{j}}_{\eta},\\[2mm] \quad 0\leq j,k\leq p-1.\\[2mm] \psi_{i,k}^{\mathcal{H}_{1}^{4}}=2L_{i+2}(\xi_{1})\ell_{k+1}(\zeta_{3} )\hat{\mathbf{i}}_{\xi}-2\ell_{i+1}(\xi_{1})L_{k+2}(\zeta_{3}) \hat{\mathbf{k}}_{\zeta},\\[2mm] \quad 0\leq i,k\leq p-1.\\[2mm] \psi_{i,j}^{\mathcal{H}_{1}^{5}}=2L_{i+2}(\xi_{1})\ell_{j+1}(\eta_{2} )\hat{\mathbf{i}}_{\xi}-2\ell_{i+1}(\xi_{1})L_{j+2}(\eta_{2})\hat{\mathbf{j} }_{\eta},\\[2mm] \quad 0\leq i,j\leq p-1. \end{array} $$
(23)

Type 2

These functions are linear combinations of certain components in the above type.

$$ \begin{array}{@{}l} \psi_{i,j,k}^{\mathcal{H}_{2}^{1}}=L_{i+2}(\xi_{1})\ell_{j+1}(\eta_{2} )\ell_{k+1}(\zeta_{3})\hat{\mathbf{i}}_{\xi}+\ell_{i+1}(\xi_{1})L_{j+2} (\eta_{2})\ell_{k+1}(\zeta_{3})\hat{\mathbf{j}}_{\eta},\\[2mm] \quad 0\leq i,j,k\leq p-1.\\[2mm] \psi_{j,k}^{\mathcal{H}_{2}^{2}}=L_{j+2}(\eta_{2})\ell_{k+1}(\zeta_{3} )\hat{\mathbf{j}}_{\eta}+\ell_{j+1}(\eta_{2})L_{k+2}(\zeta_{3})\hat {\mathbf{k}}_{\zeta},\quad 0\leq j,k\leq p-1.\\[2mm] \psi_{i,k}^{\mathcal{H}_{2}^{3}}=\ell_{i+1}(\xi_{1})L_{k+2}(\zeta_{3} )\hat{\mathbf{k}}_{\zeta}+L_{i+2}(\xi_{1})\ell_{k+1}(\zeta_{3})\hat {\mathbf{i}}_{\xi},\quad 0\leq i,k\leq p-1.\\[2mm] \psi_{i,j}^{\mathcal{H}_{2}^{4}}=L_{i+2}(\xi_{1})\ell_{j+1}(\eta_{2} )\hat{\mathbf{i}}_{\xi}+\ell_{i+1}(\xi_{1})L_{j+2}(\eta_{2})\hat{\mathbf{j} }_{\eta},\quad 0\leq i,j\leq p-1. \end{array} $$
(24)

Type 3

These functions are taken as certain components in Type 2.

$$ \begin{array}{@{}l@{\quad}l} \psi_{i}^{\mathcal{H}_{3}^{1}}=L_{i+2}(\xi_{1})\hat{\mathbf{i}}_{\xi},& 0\leq i\leq p-1.\\ \psi_{j}^{\mathcal{H}_{3}^{2}}=L_{j+2}(\eta_{2})\hat{\mathbf{j}}_{\eta}, & 0\leq j\leq p-1.\\ \psi_{k}^{\mathcal{H}_{3}^{3}}=L_{k+2}(\zeta_{3})\hat{\mathbf{k}}_{\zeta}, & 0\leq k\leq p-1. \end{array} $$
(25)

Two remarks are in place.

  • All the interior basis functions are linearly independent, which can be verified easily.

  • The normal traces of these interior functions vanish on the boundary \(\partial\mathcal{H}\) of the reference hexahedral element. This is due to the fact that on a certain face f either one of the standard unit vectors is perpendicular to the normal vector of the face n f or to the fact that the integrated Legendre polynomials are evaluated at 1 or −1, which leads to 0.

Table 2 shows the decomposition of the space Q p+1,p,p ×Q p,p+1,p ×Q p,p,p+1 for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming hexahedral element.

Table 2 Decomposition of the space \((\mathbb{Q}_{n}(K))^{3}\) for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming hexahedral element

4 Basis Functions for the Triangular Element

The result on the basis construction has been reported in [12]. For the completeness of the current study, we record the basis functions in this section.

Any point in the 2-simplex K 2 is uniquely located in terms of the local coordinate system (ξ,η). The vertexes are numbered as v 0(0,0),v 1(1,0),v 2(0,1). The barycentric coordinates are given as

$$ \lambda_{0}:=1-\xi-\eta,\qquad\lambda_{1}:=\xi,\qquad\lambda_{2}:=\eta. $$
(26)

The directed tangent on a generic edge e j =[j 1,j 2] is similarly defined as in (40) for the 3-dimensional case. In the same manner the edge is also parameterized as in (41). A generic edge can be uniquely identified with

$$ \mathbf{e}_{j}:=[j_{1},j_{2}],\quad j_{1}=\{0,1\},\ j_{1}<j_{2}\leq2,\ j=j_{1}+j_{2}. $$
(27)

The 2-dimensional vectorial curl operator of a scalar quantity, which is used in our construction, needs a proper definition. We use the following 2-D curl operator

$$ \mathbf{curl}(u):=\nabla\times u:= \biggl[ \frac{\partial u}{\partial\eta },-\frac{\partial u}{\partial\xi} \biggr] ^{\tau}. $$
(28)

Based upon the shape functions for the 3-dimensional \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming tetrahedral elements in Sect. 5 and using the technique of dimension reduction we construct the basis for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming triangular elements in two dimensions. However, it is easy to see that the two groups for the face functions cannot be appropriately modified for our purpose. Instead we borrow the idea of Zaglmayr in the dissertation [11], viz., we combine the edge-based shape functions in [11] with our newly constructed edge-based and bubble interior functions. In [11] Zaglmayr had applied the so-called scaled integrated Legendre polynomials in the construction, viz.

$$ \mathcal{L}_{n}^{s}(x,t):=t^{n-1} \int_{-t}^{x}\ell_{n-1} \biggl( \frac{\xi}{t} \biggr)\,d\xi,\quad n\geq2,\ t\in(0,1], $$
(29)

where n (x) is the nth order Legender polynomial.

4.1 Edge Functions

For the completeness of our basis construction, in this subsection we record the results in [11]. Associated with each edge the formulas for these functions are given as

$$ \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{N_{0}} = \lambda_{k_{2}} \nabla\times \lambda_{k_{1}} - \lambda_{k_{1}} \nabla\times\lambda_{k_{2}} $$
(30)

for the lowest-order approximation and

$$ \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{j} = \nabla\times \bigl( \mathcal{L}_{j+2}^{s} ( \gamma_{\mathbf{e}_{k}}, \lambda_{k_{2}} + \lambda_{k_{1}} ) \bigr) , \quad j = 0, \ldots, p-1 $$
(31)

for higher-order approximations.

4.2 Interior Functions

The interior functions are further classified into two categories: edge-based and bubble interior functions. By construction the normal component of each interior function vanishes on either edge of the reference 2-simplex K 2, viz.

$$ \mathbf{n}^{\mathbf{e}_{j}} \cdot\varPhi^{\mathbf{t}} = 0, \quad j = \{1,2,3\}, $$
(32)

where \(\mathbf{n}^{\mathbf{e}_{j}}\) is the unit outward normal vector to edge e j .

Edge-Based Interior Functions

The tangential component of each edge-based function does not vanish only on the associated edge e k :=[k 1,k 2] but vanishes on the other two edges, viz.

$$ \tau^{\mathbf{e}_{j}}\cdot\varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t} ,i}=0,\quad\mathbf{e}_{j}\neq\mathbf{e}_{k}, $$
(33)

where \(\tau^{\mathbf{e}_{j}}\) is the directed tangent along the edge e j :=[j 1,j 2]. The following basis functions are proposed here:

$$ \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},i} = C_{i} \lambda_{k_{1}} \lambda_{k_{2}} (1 - \lambda_{k_{1}})^{i} P_{i}^{(0,2)} \biggl( \frac {2\lambda_{k_{2}}}{1 - \lambda_{k_{1}}} - 1 \biggr) \frac{\tau^{\mathbf{e} _{k}}}{|\tau^{\mathbf{e}_{k}}|}, $$
(34)

where the function \(P_{i}^{(0,2)}(\bullet)\) is the classical un-normalized Jacobi polynomial of degree i with a single variable [13], and the scaling coefficient is given by

$$ C_{i} = \sqrt{2(i + 2)(i + 3)(2i + 3)(2i + 5)}, \quad i = 0, 1, \ldots, p-2. $$
(35)

The following orthonormal property of edge-based interior functions can be proved:

$$ \bigl\langle\varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},m}, \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},n}\bigr\rangle\big|_{K^{2}} = \delta_{mn}, \quad\{m,n\} = 0,1,\ldots,p-2. $$
(36)

Interior Bubble Functions

The interior bubble functions vanish on the entire boundary ∂K 2 of the reference 2-simplex K 2. The formulas of these functions are given as

(37)

where

$$C_{m,n}=\sqrt{\frac{(m+3)(m+4)(2m+5)(2m+n+6)(2m+n+7)(2m+2n+8)}{(m+1)(m+2)(n+1)(n+2)}}, $$

and

$$0\leq\{m,n\},m+n\leq p-3. $$

One can again prove the orthonormal property of the interior bubble functions

$$ \bigl\langle\varPhi_{m_{1},n_{1}}^{\mathbf{t},\vec{e}_{i}},\varPhi_{m_{2},n_{2}}^{\mathbf{t},\vec{e}_{j}}\bigr\rangle\big|_{K^{2}}=\delta_{m_{1}m_{2}}\delta_{n_{1}n_{2}}, $$
(38)

where

$$0\leq\{m_{1},m_{2},n_{1},n_{2} \},m_{1}+n_{1},m_{2}+n_{2}\leq p-3,\quad \{i,j\}=1,2. $$

Table 3 shows the decomposition of the space \(( \mathbb{P}_{p}(K))^{2}\) for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming triangular element.

Table 3 Decomposition of the space \(( \mathbb{P}_{p}(K))^{2}\) for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming triangular element

5 Basis Functions for the Tetrahedral Element

Our constructions are motivated by the work on the construction of \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming hierarchical bases for tetrahedral elements [7]. We construct shape functions for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming tetrahedral element on the canonical reference 3-simplex. The shape functions are grouped into several categories based upon their geometrical entities on the reference 3-simplex [7]. The basis functions in each category are constructed so that they are orthonormal on the reference element.

Any point in the 3-simplex K 3 is uniquely located in terms of the local coordinate system (ξ,η,ζ). The vertexes are numbered as v 0(0,0,0),v 1(1,0,0),v 2(0,1,0),v 3(0,0,1). The barycentric coordinates are given as

$$ \lambda_{0}:=1-\xi-\eta-\zeta,\qquad\lambda_{1}:=\xi,\qquad\lambda_{2} :=\eta,\qquad\lambda_{3}:=\zeta. $$
(39)

The directed tangent on a generic edge e j =[j 1,j 2] is defined as

$$ \tau^{\mathbf{e}_{j}}:=\tau^{\lbrack j_{1},j_{2}]}=\mathbf{v}_{j_{2} }-\mathbf{v}_{j_{1}},\quad j_{1}<j_{2}. $$
(40)

The edge is parameterized as

$$ \gamma_{\mathbf{e}_{j}}:=\lambda_{j_{2}}-\lambda_{j_{1}},\quad j_{1}<j_{2}. $$
(41)

A generic edge can be uniquely identified with

$$ \mathbf{e}_{j}:=[j_{1},j_{2}],\quad j_{1}=0,1,2,\ j_{1}<j_{2}\leq3,\ j=j_{1}+j_{2}+\mathrm{sign}(j_{1}), $$
(42)

where sign(0)=0. Each face on the 3-simplex can be identified by the associated three vertexes, and is uniquely defined as

$$ \mathbf{f}_{j_{1}}:=[j_{2},j_{3},j_{4}],\quad0\leq\{j_{1},j_{2},j_{3} ,j_{4}\}\leq3,\ j_{2}<j_{3}<j_{4}. $$
(43)

The standard bases in \(\mathbb{R}^{n}\) are noted as \(\vec{e}_{i}\), i=1,…,n, and n={2,3}.

5.1 Face Functions

The face functions are further grouped into two categories: edge-based face functions and face bubble functions.

Edge-Based Face Functions

These functions are associated with the three edges of a certain face \(\mathbf{f}_{j_{1}}\), and by construction all have non-zero normal components only on the associated face \(\mathbf{f}_{j_{1}}\), viz.

$$ \mathbf{n}^{\mathbf{f}_{j_{k}}}\cdot\varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},i}=0,\quad j_{k}\neq j_{1}, $$
(44)

where \(\mathbf{n}^{\mathbf{f}_{j_{k}}}\) is the unit outward normal vector to face \(\mathbf{f}_{j_{k}}\).

The edge-based face functions for higher order have been proposed in [7] as follows:

$$ \widetilde{\varPhi}_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},i}=l_{i} (\gamma_{\mathbf{e}_{k}})\lambda_{k_{1}}\nabla\lambda_{k_{2}}\times \nabla\lambda_{k_{3}},\quad i=0,\ldots,p-1. $$
(45)

For instance, for the face opposite to the vertex v 0(0,0,0), f 0:=[1,2,3], the face functions related to edge e[1,2] are given by

$$ \widetilde{\varPhi}_{\mathbf{e}[1,2]}^{\mathbf{f}_{0},i}=l_{i}(\lambda _{3}-\lambda_{2})\lambda_{1}\nabla \lambda_{2}\times\nabla\lambda _{3},\quad i=0,\ldots,p-1. $$
(46)

However, it can be checked that the basis function given in (45) in fact are not independent for p=2 (as the sum of the 12 basis functions given in (45) for p=2 on all six faces in fact equals 0, which can be easily verified by the symbolic Maple program—the Maple code is available from the first author) and thus the proposed basis function is not complete. To remedy this degeneracy, two kinds of construction of hierarchical high-order independent edge-based face functions will be presented here, for which the first one was first reported in [12] while the second kind is proposed here below in (51).

  • First kind high-order independent edge-based face functions

In [12], the following orthonormal basis functions are given:

$$ \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},i}=C_{i}\lambda_{k_{3} }(1- \lambda_{k_{1}})^{i}P_{i}^{(3,0)} \biggl( \frac{2\lambda_{k_{2}}}{1-\lambda_{k_{1}}}-1 \biggr) \frac{\nabla\lambda_{k_{1}}\times\nabla \lambda_{k_{2}}}{|\nabla\lambda_{k_{1}}\times\nabla\lambda_{k_{2}}|}, $$
(47)

where

$$C_{i}=\sqrt{3(2i+4)(2i+5)},\quad i=0,1,\ldots,p-1, $$

and

$$k_{1}=\{j_{2},j_{3}\},\qquad k_{2}=\{j_{3},j_{4}\},\qquad k_{1}<k_{2},\qquad k_{3}=\{j_{2},j_{3},j_{4}\}\setminus\{k_{1},k_{2}\}. $$

One can prove the orthonormal property of these edge-based face functions,

$$ \bigl\langle\varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},m},\varPhi_{\mathbf{e} [k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},n}\bigr\rangle\big|_{K^{3}}=\delta_{mn},\quad \{m,n\}=0,1,\ldots,p-1, $$
(48)

where δ mn is the Kronecker delta. Note that, with this construction, the edge-based face functions are all linearly independent, which is also verified by the fact that in the spectrum of the mass (Gram) matrix, none of the eigenvalues is 0.

  • Second kind high-order independent edge-based face functions

An alternative approach using the idea of recursion from [7] can also be used to construct independent edge-based face functions as follows.

For p=1, for each edge we have one face function for this edge as proposed in [7],

$$ \widetilde{\varPhi}_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},0} =\lambda_{k_{1}}\nabla\lambda_{k_{2}}\times\nabla\lambda_{k_{3}}, $$
(49)

and for p=2, one additional new basis function can be constructed as

$$ \widetilde{\varPhi}_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{f}_{j_{1}},1} =\lambda_{k_{1}}\lambda_{k_{2}}\nabla\lambda_{k_{3}}\times\nabla\lambda _{k_{1}}, $$
(50)

which can be shown to satisfy the condition (44), and for p≥3, the basis functions are given by

(51)

It can be shown again numerically that there are exactly p functions that are independent and whose normal component is non-zero only on the associated edge e k .

Face Bubble Functions

The face bubble functions which belong to each specific group are associated with a particular face \(\mathbf{f}_{j_{1}}\). They vanish on all edges of the reference 3-simplex K 3, and the normal components of which vanish on other three faces, viz.

$$ \mathbf{n}^{\mathbf{f}_{j_{k}}} \cdot\varPhi _{m,n}^{\mathbf{f}_{j_{1}}} = 0, \quad j_{k} \neq j_{1}. $$
(52)

The explicit formula is given as

(53)

where

$$ \iota= C_{m}^{n} \lambda_{j_{2}} \lambda_{j_{3}} \lambda_{j_{4}}, $$
(54)

where

(55)

and

$$ 0 \le\{m,n\}, m+n \le p-3. $$
(56)

By construction the face bubble functions share again the orthonormal property on the reference 3-simplex K 3:

(57)

5.2 Interior Functions

The interior functions are classified into three categories: edge-based, face-based, and bubble interior functions. By construction the normal component of each interior function vanishes on either face of the reference 3-simplex K 3, viz.

$$ \mathbf{n}^{\mathbf{f}_{j}} \cdot\varPhi^{\mathbf{t}} = 0, \quad j = \{0,1,2,3\}. $$
(58)

Edge-Based Interior Functions

The tangential component of each edge-based function does not vanish only on the associated edge e k :=[k 1,k 2] but vanishes on all other five edges, viz.

$$ \tau^{\mathbf{e}_{j}} \cdot\varPhi_{\mathbf{e} [k_{1},k_{2}]}^{\mathbf{t},i} = 0, \quad\mathbf{e}_{j} \neq\mathbf{e}_{k}, $$
(59)

where \(\tau^{\mathbf{e}_{j}}\) is the directed tangent along the edge e j :=[j 1,j 2]. The shape functions are given as

$$ \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},i}=C_{i}\lambda_{k_{1}} \lambda_{k_{2}}(1-\lambda_{k_{1}})^{i}P_{i}^{(1,2)} \biggl( \frac {2\lambda_{k_{2}}}{1-\lambda_{k_{1}}}-1 \biggr) \frac{\tau^{\mathbf{e}_{k}} }{|\tau^{\mathbf{e}_{k}}|}, $$
(60)

where

$$C_{i}=(i+3)\sqrt{\frac{(2i+4)(2i+5)(2i+7)}{i+1}},\quad i=0,1,\ldots,p-2. $$

Again one can prove the orthonormal property of edge-based interior functions:

$$ \bigl\langle\varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},m}, \varPhi_{\mathbf{e}[k_{1},k_{2}]}^{\mathbf{t},n}\bigr\rangle\big|_{K^{3}} = \delta_{mn}, \quad\{m,n\} = 0,1,\ldots,p-2. $$
(61)

Face-Based Interior Functions

These functions which are associated with a particular face \(\mathbf{f} _{j_{1}}\) have non-zero tangential components on their associated face only, and have no contribution to the tangential components on all other three faces, viz.

$$ \mathbf{n}^{\mathbf{f}_{j_{k}}}\times\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1} }}=\mathbf{0},\quad j_{k}\neq j_{1}. $$
(62)

Further each face-based interior function vanishes on all the edges of the 3-simplex K 3, viz.

$$ \tau^{\mathbf{e}_{k}}\cdot\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1}}}=0. $$
(63)

The formulas of these functions are given as

$$ \begin{array}{@{}l} \displaystyle\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1}}^{1}}= \iota(1-\lambda_{j_{2}} )^{m}(1-\lambda_{j_{2}}- \lambda_{j_{3}})^{n}P_{m}^{(2n+3,2)} \biggl( \frac{2\lambda_{j_{3}}}{1-\lambda_{j_{2}}}-1 \biggr) \\[4mm] \phantom{\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1}}^{1}}=} \displaystyle{}\times P_{n}^{(0,2)} \biggl( \frac{2\lambda_{j_{4}}}{1-\lambda_{j_{2}}-\lambda_{j_{3}}}-1 \biggr) \frac{\tau^{[j_{2},j_{3}]}}{|\tau^{[j_{2},j_{3} ]}|}, \\[4mm] \displaystyle\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1}}^{2}}=\iota(1-\lambda_{j_{2}})^{m}(1-\lambda_{j_{2}}-\lambda_{j_{3}})^{n}P_{m}^{(2n+3,2)} \biggl( \frac{2\lambda_{j_{3}}}{1-\lambda_{j_{2}}}-1 \biggr) \\[4mm] \displaystyle\phantom{\varPhi_{m,n}^{\mathbf{t},\mathbf{f}_{j_{1}}^{2}}=} {}\times P_{n}^{(0,2)} \biggl( \frac{2\lambda_{j_{4}}}{1-\lambda_{j_{2}}-\lambda_{j_{3}}}-1 \biggr) \frac{\tau^{[j_{2},j_{4}]}}{|\tau^{[j_{2},j_{4} ]}|}, \end{array} $$
(64)

where ι is given in (54) and 0≤{m,n},m+np−3. The face-based interior functions enjoy the orthonormal property on the reference 3-simplex K 3:

(65)

Interior Bubble Functions

The interior bubble functions vanish on the entire boundary ∂K 3 of the reference 3-simplex K 3. The formulas of these functions are given as

(66)

where

$$\chi=C_{\ell,m,n}\lambda_{0}\lambda_{1} \lambda_{2}\lambda_{3}(1-\lambda _{1})^{m}(1- \lambda_{1}-\lambda_{2})^{n}, $$

where

$$C_{\ell,m,n}=C_{\ell,m,n}^{1}C_{\ell,m,n}^{2}, $$

where

$$C_{\ell,m,n}^{1}= \sqrt{\frac{(\ell+2m+2n+9)(\ell+2m+2n+10)(2\ell +2m+2n+11)(m+2n+6)}{(\ell+1)(m+1)(n+1)}}, $$
$$C_{\ell,m,n}^{2}=\sqrt{\frac{(m+2n+7)(2m+2n+8)(n+3)(n+4)(2n+5)}{(\ell +2)(m+2)(n+2)}}, $$

and

$$0\leq\{\ell,m,n\},\ell+m+n\leq p-4. $$

Again, one can show the orthonormal property of the interior bubble functions

$$\bigl\langle\varPhi_{\ell_{1},m_{1},n_{1}}^{\mathbf{t},\vec{e}_{i}},\varPhi_{\ell_{2} ,m_{2},n_{2}}^{\mathbf{t},\vec{e}_{j}}\bigr\rangle\big|_{K^{3}}=\delta_{\ell_{1}\ell_{2} }\delta_{m_{1}m_{2}}\delta_{n_{1}n_{2}}, $$

where

$$0\leq\{\ell_{1},\ell_{2},m_{1},m_{2},n_{1},n_{2}\},\ell_{1}+m_{1}+n_{1} ,\ell_{2}+m_{2}+n_{2}\leq p-4,\quad\{i,j\}=1,2,3. $$

In Table 4 we summarize the decomposition of the space \(( \mathbb{P}_{p}(K))^{3}\) for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming tetrahedral element.

Table 4 Decomposition of the space \(( \mathbb{P}_{p}(K))^{3}\) for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming tetrahedral element

6 The Divergence-Free Condition

For a pth order polynomial approximation, in order to ensure the divergence-free condition, the idea is to include a higher-order interior bubble function χ b , say \(\chi_{b}^{p+1}\) or \(\chi_{b}^{q} ,q=\max(m,p+1)\) for the simplexes ( m=3 for triangular element and m=4 for tetrahedral element) and q=max(2,p+1) for rectangular and hexahedral elements, as an extra basis function. To satisfy the condition

$$ \nabla\cdot\mathbf{B}=0 $$
(67)

for the Maxwell equation or

$$ \nabla\cdot\mathbf{u}=0 $$
(68)

for the incompressible fluid flow, one can impose the condition

$$ \nabla\cdot\bigl(\mathbf{u+}C_{\chi}\chi_{b}^{q}\bigr)=0 $$
(69)

to solve the unknown coefficient C χ . For the triangular element, the interior bubble function for degree p is given in (37). For the tetrahedral element, the interior bubble function of degree p is given in (66). For the quadrilateral element, one can construct the interior bubble function of degree p as

$$ \chi_{\mathcal{Q}_{b}}^{p}=L_{p+2}(2\xi-1)L_{2}(2\eta-1)\hat{\mathbf{i}}_{\xi }+L_{2}(2\xi-1)L_{p+2}(2\eta-1)\hat{\mathbf{j}}_{\eta}. $$
(70)

For the hexahedral element, one can construct the interior bubble function of degree p as

(71)

7 Conditioning of Matrices

The purpose of this section is twofold. Firstly, we check numerically that the newly constructed basis functions for \(\boldsymbol{\mathcal{H}}(\mathbf{div} )\)-conforming triangular and tetrahedral elements are linearly independent, which is manifested by the fact that, for each particular approximation order up to degree four, the condition number of the corresponding mass matrix is finite. Secondly, we want to show that for the approximation up to order three both the mass and the stiffness matrices are reasonably well-conditioned.

The components of the mass matrix are defined as

$$ M_{\ell_{1},\ell_{2}}:=\langle\varPhi_{\ell_{1}},\varPhi _{\ell_{2}}\rangle|_{K^{d}}, \quad d=2,3. $$
(72)

The mass matrix M is symmetric and positive definite, and therefore has real positive eigenvalues. The condition number of a real symmetric positive definite matrix A is calculated by the formula

$$ \kappa(A) = \frac{\lambda_{\max}}{\lambda_{\min}}, $$
(73)

where λ max and λ min are the maximum and minimum eigenvalues of the matrix A, respectively. For the incompressible fluid flows, e.g., governed by the Navier–Stokes equations [14] or by the magnetohydrodynamics equations [15], the authors [14, 15] have applied the mixed finite element for the spatial discretization. In particular, they [14, 15] have used the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming element for the Laplacian Δu of the velocity u. In this case, we have the stiffness matrix S, which is defined component-wise as

$$ S_{\ell_{1},\ell_{2}}:=\langle\nabla\varPhi_{\ell_{1}} : \nabla\varPhi_{\ell_{2}}\rangle|_{K^{d}}, \quad d=2,3. $$
(74)

The stiffness matrix S is symmetric and semi-positive definite, and therefore has real non-negative eigenvalues. The condition number of the stiffness matrix S is calculated by the formula (73) with the 0 eigenvalue excluded.

With the triangular element and for the polynomial approximations p={1,2,3,4}, the conditioning is summarized in Table 5.

Table 5 Condition numbers of the mass matrix M and stiffness matrix S from the basis for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming triangular element

From the table we can see that the condition number is bounded for each order of approximation. Moreover, up to the fourth order, the mass and stiffness matrices are both well conditioned.

With the tetrahedral element and for the polynomial approximations p={1,2,3,4}, the condition numbers of the mass matrix are shown in Table 6.

Table 6 Condition numbers of the mass matrix M and stiffness matrix S from the bases with two different kinds of edge-based face function for the \(\boldsymbol{\mathcal{H}}(\mathbf{div})\)-conforming tetrahedral element

Again, from this table we see that the condition number is finite for each order of approximation. Further up to the third order, both the mass and the stiffness matrices are well conditioned. For order p=2 the conditioning is better with the first kind edge-based face basis, while for p=4, the conditioning is better with the second kind edge-based face basis. For the third order p=3, the performance with both kinds of edge-based face basis is about the same.

8 Concluding Remarks

In this paper we focus our attention on hierarchical \(\boldsymbol{\mathcal{H}}(\mathbf{div})\) basis functions for solving the magnetohydrodynamics (MHD) equations numerically so that the divergence-free condition on the magnetic field is rigorously guaranteed. The idea is to use an interior bubble function from the proposed high-order hierarchical basis as the additional freedom to impose the divergence-free Gauge condition for the magnetic field. We have summarized four bases for the \(\boldsymbol{\mathcal{H} }(\mathbf{div})\)-conforming elements, viz. the quadrilateral and triangular elements for 2-D and the hexahedral and tetrahedral elements for 3-D. The linear independence of the basis functions for the two simplicial elements has numerically been checked. Good matrix (mass and stiffness) conditioning has also been shown up to the fourth order for 2-D and up to the third order for 3-D. Further work will include the implementation of the proposed divergence-free basis to solve the magnetohydrodynamics (MHD) equations in 2-D and 3-D.