1 Introduction

This paper deals with the resolution and the implementation of the spectral-element domain-decomposition method for the resolution of the following nonstationary Stokes problem:

$$\begin{aligned} \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} \displaystyle{\frac{\displaystyle \partial {\bf v}}{\displaystyle \partial t}}({\bf x},t)-\nu \Delta {\bf v}({\bf x},t)+\nabla p({\bf x},t)={ \bf f}({\bf x},t) \quad &\rm{in} \quad \Omega \times [0,T], \\ \displaystyle \operatorname{div}\,{\bf v}({\bf x},t)=0 \quad &\rm{in} \quad \Omega \times [0,T], \\ {\bf v}({\bf x},t)\,.\,{\bf n}({\bf x})=0 \quad &\rm{on} \quad \partial \Omega \times [0,T], \\ \gamma (\operatorname{\mathbf{curl}}{\bf v})({\bf x},t)={\bf 0}\quad & \rm{on} \quad \partial \Omega \times [0,T], \\ {\bf v}({\bf x},0)={\bf v}_{0} \quad &{\rm in} \quad \Omega . \end{array}\displaystyle \right . \end{aligned}$$
(1)

The domain Ω of \({\mathbb{R}}^{d}, d=2\), \(d=3\), is bounded and simply connected. Ω is its connected Lipschitz continuous boundary and T is a positive real. \({\bf f}\), \(\nu > 0\) are the data function and the viscosity. The unknowns \({\bf v}\), p are the velocity of the fluid and its pressure. Let γ be the tangential boundary operator defined as:

• When \(d=2\): if \({\bf v}=({\bf v}_{x},{\bf v}_{y})\), \(\operatorname{curl}{\bf v}=\partial _{x} {\bf v}_{y} -\partial _{y} { \bf v}_{x}\), thus \(\gamma (\operatorname{curl}{\bf v})\) is the trace on Ω of the scalar function \(\operatorname{curl}{\bf v}\).

• When \(d=3\): if \({\bf v}=({\bf v}_{x},{\bf v}_{y},{\bf v}_{z})\), \(\operatorname{\mathbf{curl}}{\bf v}=(\partial _{y} {\bf v}_{z} -\partial _{z} { \bf v}_{y},\partial _{z} {\bf v}_{x} -\partial _{x} {\bf v}_{y}, \partial _{x} {\bf v}_{y} -\partial _{y} {\bf v}_{x})\), thus \(\gamma (\operatorname{\mathbf{curl}}{\bf v})=\operatorname{\mathbf{curl}}{\bf v}\times {\bf n}\) on the boundary Ω, × represents the cross product.

Let the new unknown \(\varpi =\operatorname{\mathbf{curl}}{\bf v}\) be called the vorticity. By the property

$$ -\Delta {\bf v}= \operatorname{\mathbf{curl}}(\operatorname{\mathbf{curl}}{\bf v}) - \nabla ( \operatorname{div}{\bf v}), $$

we prove that the system (1) is equivalent to:

$$\begin{aligned} \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} \displaystyle{\frac{\displaystyle \partial {\bf v}}{\displaystyle \partial t}}({\bf x},t)+\nu \operatorname{\mathbf{curl}}\varpi ({\bf x},t)+\nabla p({ \bf x},t)={\bf f}({\bf x},t) \quad &\rm{in} \quad \Omega \times [0,T], \\ \operatorname{div}\,{\bf v}({\bf x},t)=0 \quad &\rm{in} \quad \Omega \times [0,T], \\ \varpi ({\bf x},t)=\operatorname{\mathbf{curl}}{\bf v}({\bf x},t) \quad &\rm{in} \quad \Omega \times [0,T], \\ {\bf v}({\bf x},t)\,.\,{\bf n}({\bf x})=0 \quad &\rm{on} \quad \partial \Omega \times [0,T], \\ \gamma (\varpi )({\bf x},t)={\bf 0}\quad & \rm{on} \quad \partial \Omega \times [0,T], \\ {\bf v}({\bf x},0)={\bf v}_{0} \quad &{\rm in} \quad \Omega . \end{array}\displaystyle \right . \end{aligned}$$
(2)

In the case when the domain Ω is multiply connected the conditions

$$ \operatorname{\mathbf{curl}}{\bf v}={\bf 0} \quad \operatorname{div}{\bf v}=0 \quad \rm{in} \quad \Omega , \quad \rm{and}\quad {\bf v}\cdot {\bf n}=0 \quad \rm{on} \quad \partial \Omega $$

are not enough to prove the uniqueness of the velocity, see [13]. An explicit example was given in ([4], Chap. 3). Let \(\Sigma _{i}, 1\leq i\leq I\) be open connected curves or surfaces called “cuts” that satisfy:

\(\Sigma _{i}, 1\leq i\leq I\) is included in Ω and \(\partial \Sigma _{i}\) is included in Ω;

\(\Sigma _{i}\bigcap \Sigma _{j}=\emptyset \), \(1\leq i\neq j\leq I\);

\(\Omega ^{\diamond}=\Omega {/}\big(\displaystyle \bigcup _{1}^{I} \Sigma _{i}\big)\) is a simply connected domain.

The further conditions that we needed for the uniqueness of the velocity are, for \(1\leq i\leq I\)

$$ {\bf v}\cdot {\bf n}=0 \quad \rm{on} \quad \Sigma _{i}. $$
(3)

The initial treatment of Stokes problems, incorporating velocity and pressure formulations along with pressure-based boundary conditions, was presented in [5]. However, subsequent studies by [6, 7] and [8] demonstrated a novel approach to formulating the Stokes problem, incorporating vorticity alongside velocity and pressure as unknowns.

In [9], the authors introduced an extensive numerical investigation into the spectral-element discretization of this new formulation. They utilized the Generalized Minimal Residual method (GMRES) for implementation, given the nonsymmetric nature of the matrix involved, see [10].

In this paper, we introduce two novel algorithms designed to enhance the performance of previous approaches to solving the Stokes problem in both two and three dimensions within bounded domains, with a focus on optimizing execution time. Initially, we adapted our approach to incorporate the Elimination method like the Uzawa algorithm, as outlined in [1] and [11], by removing discrete vorticity. However, the resulting matrix exhibited severe ill-conditioning, necessitating a high number of iterations for convergence. However, the Global inversion method consists of solving the linear system using the GMRES method, so it does not need to be assembled. We also use local preconditioners: each block in the global matrix in the linear system is preconditioned by the matrix resulting from its incomplete LU factorization. Notably, as is standard in spectral methods, the tensorization properties of the polynomial spaces ensure that each product of these blocks, corresponding to the subdomain \(\Omega _{k}\), with a vector, is performed with \(cN^{d+1}\) operations, significantly reducing the cost of inversion. Consequently, we achieved notably improved accuracy with a reduced number of iterations. Experimental results unequivocally demonstrate the efficacy of these enhancements.

The structure of the paper is outlined as follows: Sect. 2 presents an exposition of the discrete problems in time and in space. Section 3 elaborates on the implementation of the spectral-element discretization for our specific problem. Section 4 is dedicated to a comprehensive description and comparison of the numerical results.

2 The discrete problems

We introduce the space:

$$ {\mathbb{K}}(\Omega )=\{{\bf v}\in H_{0}({\rm div},\Omega ), {\bf v} \cdot {\bf n}=0 \rm{on} \Sigma _{i}, 1\leq i\leq I\} $$

as the space of velocity. Then, the variational formulation is: If \({\bf f}\in L^{2}(0,T;L^{2}(\Omega )^{d})\), find \((\varpi ,{\bf v},p) \in L^{2}(0,T;H_{0}(\operatorname{\mathbf{curl}},\Omega )) \times L^{2}(0,T;{\mathbb{K}}(\Omega ))\times L^{2}(0,T;L^{2}_{0}( \Omega ))\) such that

$$\begin{aligned} \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} \forall \displaystyle {\bf w}\in {\mathbb{K}}(\Omega ),\quad \displaystyle &({\frac{\displaystyle{\partial {\bf v}}}{\displaystyle \partial t}},{\bf w}) + a(\varpi ,{\bf v};{\bf w}) + b({\bf w},p)=({ \bf f},{\bf w}), \\ \forall q\in L_{0}^{2}(\Omega ),\quad &b({\bf v},q)=0, \\ \forall \boldsymbol{\vartheta }\in H_{0}(\operatorname{\mathbf{curl}},\Omega ), \quad &c(\varpi ,{\bf v};\boldsymbol{\vartheta })=0. \end{array}\displaystyle \right . \end{aligned}$$
(4)

The bilinear forms \(a(.,.;.)\), \(b(,.,)\) and \(c(.,.;.)\) are defined as follows:

$$ \textstyle\begin{array}{r@{\quad}l} \displaystyle a(\varpi ,{\bf v};{\bf w})&=\nu \displaystyle \int _{ \Omega}\operatorname{\mathbf{curl}}(\varpi )({\bf x},t).{\bf w}({\bf x})d{\bf x}, \quad b({\bf v},q)=-\displaystyle \int _{\Omega}\operatorname{div}{\bf v}({ \bf x},t) q({\bf x})d{\bf x} \\ &\text{ and } c(\varpi ,{\bf v};\boldsymbol{\vartheta })= \displaystyle \int _{\Omega}\varpi ({\bf x},t). \boldsymbol{\vartheta }({\bf x})d{\bf x}-\displaystyle \int _{\Omega}{ \bf v}({\bf x},t).\operatorname{\mathbf{curl}}\boldsymbol{\vartheta }({\bf x})d{ \bf x}. \end{array} $$

For \({\bf f}\in L^{2}(0,T;L^{2}(\Omega )^{d})\) and \({\bf v}_{0}\in {\mathbb{K}}(\Omega )\), problem (4) has a unique solution \((\varpi ,{\bf v},p)\) that belongs to \(L^{2}(0,T;H_{0}(\operatorname{\mathbf{curl}},\Omega ))\times L^{2}(0,T;{\mathbb{K}}( \Omega ))\times L^{2}(0,T;L^{2}_{0}(\Omega ))\), [1214] such that:

$$ \textstyle\begin{array}{r@{\quad}l} \parallel \varpi \parallel ^{2}_{L^{\infty}(0,t;L^{2}(\Omega )^{\frac{d(d-1)}{2}})} &+ \parallel {\bf v}\parallel ^{2}_{L^{\infty}(0,t;L^{2}( \Omega )^{d})}+ \parallel p \parallel ^{2}_{L^{2}(0,t;L_{0}^{2}( \Omega ))} \\ &\leq c\Big(\parallel {\bf v}_{0} \parallel ^{2}_{L^{2}(\Omega )^{d}} +\parallel {\bf f}\parallel ^{2}_{L^{2}(0,t;L^{2}(\Omega )^{d})} \Big). \end{array} $$

For the discretization in time of problem (4) we use the implicit Euler method. We partition the interval \([0,T]\) in the subintervals \([t_{m-1},t_{m}]\), for \(1\leq m\leq M\), \(M>0\) integer such that \(0=t_{0}< t_{1}<\cdots<t_{M}=T\). Let \(\tau _{m}=t_{m}-t_{m-1}\), \(\tau =(\tau _{1},\tau _{2},\ldots,\tau _{m})\) and \(|\tau |=\displaystyle \max _{1\leq m\leq M}\tau _{m}\).

If the data functions \(({\bf f},{\bf v}_{0})\in {L^{2}(0,t;L^{2}(\Omega )^{d})}\times { \mathbb{K}}(\Omega )\), the time-discrete problem is:

Find \((\varpi ^{m})_{0\leq m\leq M}\in (H_{0}(\operatorname{\mathbf{curl}},\Omega ))^{M+1}\), \(({\bf v}^{m})_{0\leq m\leq M}\in ({\mathbb{K}}(\Omega ))^{M+1} \rm{ and } (p^{m})_{1\leq m\leq M}\in (L^{2}_{0}(\Omega ))^{m}\) such that:

$$ {\bf v}^{0}={\bf v}_{0}\quad{\rm in}\quad {\Omega} $$
(5)

and for all \(1 \leq m \leq M\), \(\quad {\bf f}^{m}={\bf f}(.,t_{m})\),

$$\begin{aligned} \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} \displaystyle \forall {\bf w}\in {\mathbb{K}}(\Omega ),\quad &({\bf v}^{m} ,{\bf w}) + \tau _{m} a(\varpi ^{m},{\bf v}^{m};{\bf w}) + \tau _{m} b({ \bf w},p^{m}) \\ & \quad =({\bf v}^{m-1},{\bf w})+\tau _{m} ({\bf f}^{m},{\bf w}), \\ \forall q\in L_{0}^{2}(\Omega ),\quad &b({\bf v}^{m},q)=0, \\ \forall \boldsymbol{\vartheta }\in H_{0}(\operatorname{\mathbf{curl}},\Omega ), \quad &c(\varpi ^{m},{\bf v}^{m};\boldsymbol{\vartheta })=0. \end{array}\displaystyle \right . \end{aligned}$$
(6)

We define

$$ {\mathbb{A}}(\varpi ^{m},{\bf v}^{m};{\bf w})=({\bf v}^{m} ,{\bf w}) + \tau _{j}a(\varpi ^{m},{\bf v}^{m};{\bf w}) \quad {\rm and} \quad { \mathbb{L}}({\bf w})=({\bf v}^{m-1},{\bf w})+\tau _{m}({\bf f}^{m},{ \bf w}). $$

The problem (5) and (6) has a unique solution, see arguments in [1].

In what follows, we subdivide the domain Ω without overlapping into a finite number of rectangles \(\Omega _{k}\) for dimension 2 or a rectangular parallelepiped for dimension 3:

$$ \Omega =\bigcup _{k=1}^{k=K}\Omega _{k},\quad {\rm such} {\rm that} \quad \Omega _{k}\cap \Omega _{l}=\emptyset \quad {\rm for} \quad 1 \leq k\neq l\leq K. $$

We observe that the subdomain set \(\Omega _{k}\) satisfies the condition that the intersection of any two subdomains \(\bar{\Omega}_{k}\) and \(\bar{\Omega}_{l}\), where \(1 \leq k \neq l \leq K\), is either a vertex, an edge (in the case of \(d=2\)), or a face (in the case of \(d=3\)), which we identify as the cuts \(\Sigma _{i}\) defined in Sect. 2.

The discretization is performed using the spectral-element method inspired by Nèdelec cubic three-dimensional meshes ([15, Sect. 2]). We define \(\mathbb{P}{pq}(\Omega )\) (or \(\mathbb{P}{pqr}(\Omega )\)) as the polynomial space of degree p in the x-direction and q in the y-direction (and r in the z-direction). These spaces are simply denoted as \(\mathbb{P}_{n}(\Omega )\) when \(p=q=r=n\).

Building upon these definitions, and for an integer \(N \geq 2\), we introduce the local discrete spaces:

$$\begin{aligned}& {\mathbb{D}}_{N}^{k} = \textstyle\begin{cases} {\mathbb{P}}_{N,N-1}(\Omega _{k}) \times {\mathbb{P}}_{N-1,N}(\Omega _{k}) \quad & \hspace{-1.2cm} \text{if $d = 2$,} \\ {\mathbb{P}}_{N,N-1,N-1}(\Omega _{k}) \times {\mathbb{P}}_{N-1,N,N-1}( \Omega _{k}) \times {\mathbb{P}}_{N-1,N-1,N}(\Omega _{k})\, & \\ & \hspace{-1.2cm} \text{if $d = 3$,} \end{cases}\displaystyle \\& {\mathbb{C}}_{N}^{k} = \textstyle\begin{cases} {\mathbb{P}}_{N}(\Omega _{k})\quad &\text{if $d = 2$,} \\ {\mathbb{P}}_{N-1,N,N}(\Omega _{k}) \times {\mathbb{P}}_{N,N-1,N}( \Omega _{k}) \times {\mathbb{P}}_{N,N,N-1}(\Omega _{k}) & \text{if $d = 3$,} \end{cases}\displaystyle \\& {\mathbb{M}}_{N}^{k} = {\mathbb{P}}_{N-1}(\Omega _{k}). \end{aligned}$$

Then, the space of the discrete velocity in \(H_{0}(\operatorname{div},\Omega )\) is

$$ {\mathbb{D}}_{N}=\{{\bf v}_{N}\in {\mathbb{K}}(\Omega ); {\bf v}_{N}|_{ \Omega _{k}}\in {\mathbb{D}}_{N}^{k} \}. $$

The space that approximates the vorticity in \(H_{0}({\bf curl},\Omega )\) is defined as

$$ {\mathbb{C}}_{N}=\{\varphi _{N}\in H_{0}({\bf curl},\Omega ); \varphi _{N}|_{\Omega _{k}}\in {\mathbb{C}}_{N}^{k} \}. $$

Finally, the space in which we approximate the pressure is defined by

$$ {\mathbb{M}}_{N}=\{p_{N}\in L^{2}_{0}(\Omega ); p_{N}|_{\Omega _{k}} \in {\mathbb{M}}_{N}^{k} \}. $$

The functions within \({\mathbb{D}}_{N}\) exhibit a continuous normal trace across the interface \(\bar{\Omega}_{k} \cap \bar{\Omega}_{l}\). On the other hand, functions in \({\mathbb{C}}_{N}\) demonstrate a continuous trace along the interface \(\bar{\Omega}_{k} \cap \bar{\Omega}_{l}\) in two dimensions (\(d = 2\)) and a continuous tangent trace in three dimensions (\(d = 3\)). This selection ensures that our proposed discretization is entirely conforming.

Considering \(\xi _{0} = -1\) and \(\xi _{N} = 1\), we focus on the \(N-1\) Gauss–Lobatto nodes \(\xi _{i}\), where \(1 \leq i \leq N-1\), and the \(N+1\) corresponding weights \(\rho _{i}\) on the interval \([-1,1]\). These nodes \(\xi _{i}\) (for \(1 \leq i \leq N-1\)) are the roots of the derivative \(L_{N}'\) of the Nth-degree Legendre polynomial \(L_{N}\).

Let \(\mathbb{P}_{n}(-1,1)\) denote the space of polynomials restricted to \([-1,1]\) with degrees up to n. Therefore, the Gauss–Lobatto quadrature formula is:

$$ \forall \varphi _{N} \in {\mathbb{P}}_{2N-1}(-1,1), \quad \int _{-1}^{1} \varphi _{N}(\zeta )\,d\zeta = \sum _{i = 0}^{N} \varphi _{N}(\xi _{i}) \,\rho _{i}. $$
(7)

Additionally, we recall the following property (see [16]):

$$ \forall \varphi _{N} \in {\mathbb{P}}_{N}(-1,1), \quad \parallel \varphi _{N} \parallel _{L^{2}(-1,1)}^{2} \le \sum _{i = 0}^{N} \varphi _{N}^{2}(\xi _{i})\,\rho _{i} \le 3\,\parallel \varphi _{N} \parallel _{L^{2}(-1,1)}^{2}. $$
(8)

Let \(F_{k}\) be the affine bijection from \((-1,1)^{d}\) onto \(\Omega _{k}\). Using formula (8), we introduce the local discrete scalar product defined as follows: For continuous functions φ and ψ defined on \(\bar{\Omega}_{k}\):

$$ (\varphi ,\psi )_{N}^{k} = \textstyle\begin{cases} \frac{meas(\Omega _{k})}{4}\displaystyle \sum _{i = 0}^{N} \sum _{j = 0}^{N} (\varphi \circ F_{k})(\xi _{i},\xi _{j})(\psi \circ F_{k})(\xi _{i}, \xi _{j})\,\rho _{i}\rho _{j} \quad &\text{if $d = 2$,} \\ \frac{meas(\Omega _{k})}{8}\displaystyle \sum _{i = 0}^{N} \sum _{j = 0}^{N} \sum _{k = 0}^{N} (\varphi \circ F_{k})(\xi _{i},\xi _{j},\xi _{k})( \psi \circ F_{k})(\xi _{i},\xi _{j},\xi _{k})\,\rho _{i}\rho _{j} \rho _{k} \quad &\text{if $d = 3$.} \end{cases} $$

The global scalar product is defined for continuous functions φ and ψ on Ω̄ as follows:

$$ (\varphi ,\psi )_{N} =\sum _{k=1}^{K}(\varphi ,\psi )_{N}^{k}. $$

If the data function remains continuous over \(\overline{\Omega} \times [0,T]\), we derive the discrete problem from equations (10) and (11) using a combination of Galerkin’s method and numerical integration techniques.

For \({\bf v}_{N}^{0}= I_{N}({\bf v}_{0})\), and if \({\bf v}_{N}^{m-1}\) is known, find \((\varpi ^{m}_{N},{\bf v}^{m}_{N},p^{m}_{N})\) in \({\mathbb{C}_{N}}\times {\mathbb{D}}_{N}\times {\mathbb{M}}_{N}\) such that for \(1\leq m\leq M\):

$$ \begin{aligned} &\forall {\bf w}_{N} \in {\mathbb{D}}_{N}, \quad ({\bf v}_{N}^{m},{ \bf w}_{N})_{N} +\tau _{m}\nu \, ({\bf curl}\,\varpi ^{m}_{N} ,{\bf w}_{N})_{N} - \tau _{j}({\rm div}\,{\bf w}_{N}, p^{m}_{N})_{N} \\ & \quad = ({\bf v}_{N}^{m-1},{ \bf w}_{N})_{N}+\tau _{m}({\bf f}^{m},{\bf w}_{N})_{N} , \\ &\forall q_{N} \in {\mathbb{M}}_{N}, \quad ({\rm div}\,{\bf v}^{m}_{N}, q_{N})_{N} = 0, \\ &\forall \boldsymbol{\vartheta }_{N} \in {\mathbb{C}}_{N}, \quad ( \varpi ^{m}_{N},\boldsymbol{\vartheta }_{N})_{N} - ({\bf v}^{m}_{N}, { \bf curl}\,\boldsymbol{\vartheta }_{N})_{N} = 0, \end{aligned} $$
(9)

where \(I_{N}\) is the Lagrange interpolating operator with values in \({\mathbb{P}}_{N}(\Omega )\). We define the discrete bilinear forms \({\mathbb{A}}_{N}(\cdot ,\cdot ;\cdot )\), \(b_{N}(\cdot ,\cdot )\), and \(c_{N}(\cdot ,\cdot ;\cdot )\) as

$$ \begin{aligned} & {\mathbb{A}}_{N}(\varpi ^{m}_{N},{\bf v}^{m}_{N}; {\bf w}_{N}) = ({\bf v}_{N}^{m},{\bf w}_{N})_{N} +\tau _{m}\nu \, ({\bf curl}\, \varpi ^{m}_{N} ,{\bf w}_{N})_{N},\quad b_{N}({\bf w}_{N},p^{m}_{N}) = - ({\rm div}\,{\bf w}_{N}, p^{m}_{N})_{N} \\ & \text{ and } c_{N}(\varpi ^{m}_{N},{\bf v}^{m}_{N}; \boldsymbol{\vartheta }_{N} ) = (\varpi ^{m}_{N}, \boldsymbol{\vartheta }_{N})_{N} - ({\bf v}^{m}_{N}, {\bf curl}\, \boldsymbol{\vartheta }_{N})_{N}. \end{aligned} $$

We assume that the data \({\bf f}\) belongs to \(L^{2}(0,T;L^{2}(\Omega )^{d})\) and \({\bf v}_{0}\) belongs to \({\mathbb{K}}(\Omega )\), problem (9) has a unique solution; \((\varpi ^{m}_{N},{\bf v}^{m}_{N},p^{m}_{N})\) belongs to \({\mathbb{C}}_{N} \times {\mathbb{D}}_{N} \times {\mathbb{M}}_{N}\). The proof of the existence and uniqueness of the solution is elaborated in [[13], Sect. 4, Theorem 4.1] and [[1], Chapter I, Lemma 4.1].

3 The proposed algorithms

As outlined in the introduction, we introduce two resolution algorithms aimed at improving the performance of previous approaches for solving the Stokes problem in 2D and 3D bounded domains [9], with a focus on optimizing execution time.

Next, we begin by presenting the linear system. Subsequently, we describe two algorithms: the Elimination algorithm and the Global inversion method.

3.1 The linear system

In order to define the matrix system of the discrete problem, we have to choose a basis of the discrete spaces \({\mathbb{C}}_{N} \), \({\mathbb{D}}_{N}\), and \({\mathbb{M}}_{N}\).

Let \(l_{i}\), \(0 \le i \le N\), denote the Lagrange polynomials in \({\mathbb{P}}_{N}(-1,1)\) associated with the nodes \(\xi _{i}\) of degree less or equal to N such that:

$$ l_{i}\in \mathbb{P}_{N}([-1,1]),\quad l_{i}(\xi _{j})=\delta _{ij}, \quad 0\leq i,j\leq N, $$

where \(\delta _{ij}\) is the Kronecker symbol. The polynomial \(l_{i}\) is defined as

$$ l_{i}(x)={\frac{-1}{N (N+1)}} {\frac{(1-x^{2}) L_{N}^{\prime }(x)}{(x-\xi _{i})}}, \quad \quad \forall x\in [-1,1]. $$

Let \(i_{*}\) be an integer fixed between 0 and N equal to the integer part of \({\frac{N}{2}}\). We define \(I^{*}\) as the set \(\{0,\ldots ,N\} \setminus \{i^{*}\}\), and let:

$$ l_{i}^{*}(x) = l_{i}(x)\,{\frac{\xi _{i}-\xi _{i^{*}}}{x - \xi _{i^{*}}} }, \quad i \in I^{*}. $$

Now, we describe the unknown vectors in the dimension 2 for simplicity. The vector vorticity \(W^{m}\) at the time \(t_{m}\) is constructed from:

• the value of \(\varpi ^{m}_{N}\) at the nodes \(F_{k}(\xi _{i},\xi _{j})\), \(1 \le i\), \(j \le N-1\) inside each subdomain \(\Omega _{k}\);

• the value of \(\varpi ^{m}_{N}\) at the nodes \(F_{k}(\xi _{i},\pm 1)\) or \(F_{k}(\pm 1,\xi _{j})\), \(1 \le i\), \(j \le N-1\), shared by two subdomains on each edge of the subdomain \(\Omega _{k}\) that is not contained in Ω.

We multiply the vector \(W^{m}\) by the matching matrix \(Q_{\varpi}\) leading to a vector \(\hat{W^{m}}=Q_{\varpi}W\) made of K blocks \(W^{m}_{k}\). The coefficients \(\varpi ^{m}_{ij}\) are the expansion of the discrete vorticity \(\varpi ^{m}_{N}\) on the subdomain \(\Omega _{k}\). Then, we have

$$ \varpi ^{m}_{N}(x,y) \, = \sum _{i = 0}^{N} \sum _{j = 0}^{N} \varpi ^{m}_{ij} \,(l_{i}l_{j}\circ F_{k}^{-1})(x,y). $$

The values of \(\varpi ^{m}_{N}\) are equal to 0 on the boundary Ω.

Likewise, we consider \(U^{m}\) the vector that corresponds to the velocity \({\bf v}^{m}_{N}=({\bf v}^{m}_{Nx},{\bf v}^{m}_{Ny})\) at the time \(t_{m}\) it is build from:

• the values of \({\bf v}^{m}_{Nx}\) at the nodes \(F_{k}(\xi _{i},\xi _{j})\), \(1 \le i\le N-1\), \(/; j\in I^{*}\), and of \({\bf v}^{m}_{Ny}\) at the nodes \(F_{k}(\xi _{i},\xi _{j})\), \(i\in I^{*}; 1 \le j\le N-1\);

• the value of \({\bf v}^{m}_{Nx}\) at the nodes \(F_{k}(\xi _{i},\pm 1)\), \(1 \le i\le N-1\), in the edges of \(\Omega _{k}\) that are parallel to the x-axis and the value of \({\bf v}^{m}_{Ny}\) at the nodes \(F_{k}(\pm 1,\xi _{j})\), \(1 \le j\le N-1\), in the edges of \(\Omega _{k}\) that are parallel to the y-axis;

• the values of \({\bf v}^{m}_{Nx}\) at the nodes of each edge that are parallel to the y-axis and shared by two subdomains and the values of \({\bf v}^{m}_{Ny}\) at the nodes of each edge that are parallel to the x-axis and shared by two subdomains;

• in order to verify the condition (3) we delete J values on the nodes of each \(\Sigma _{j}\).

Then, we multiply the vector \(U^{m}\) by the matching matrix \(Q_{u}\) leading to a vector \(\hat{U^{m}}=Q_{u} U^{m}\) made of K blocks \(U^{m}_{k}\). The components \({\bf v}^{m}_{ij}\) of \(U^{m}_{k}\) are the expansion of the discrete velocity \({\bf v}^{m}_{N}\) at the nodes of the subdomain \(\Omega _{k}\). Hence, we write

$$ {\bf v}^{m}_{Nx}(x,y) = \sum _{i = 1}^{N-1} \sum _{j \in I^{*}} {\bf v}^{m}_{xij} \,(l_{i}l_{j}^{*}\circ F_{k}^{-1})(x,y) $$

and

$$ {\bf v}^{m}_{Ny}(x,y) = \sum _{i \in I^{*}}\sum _{j = 1}^{N-1} {\bf v}^{m}_{yij} \,(l^{*}_{i}l_{j}\circ F_{k}^{-1})(x,y). $$

The value of \({\bf v}^{m}_{N}\cdot {\bf n}\) is equal to 0 on the boundary Ω.

Finally, let the K blocks vector \(P^{m}\) at the time \(t_{m}\) where the coefficient of each of them is made from the value of the pseudopressure \({\tilde{p}^{m}}_{N}\) at the nodes \(F_{k}(\xi _{i},\xi _{j}), \text{for} i\in I^{*} \), \(j\in I^{*}\):

$$ {\tilde{p}^{m}}_{N}(x,y) = \sum _{i\in I^{*}, j\in I^{*}} p^{m}_{ij}\,(l_{i}^{*}l_{j}^{*} \circ F_{k}^{-1})(x,y). $$

The function \(\tilde{p}^{m}_{N}\) does not belong to \(L^{2}_{0}(\Omega )\); however, the real pressure \(p_{N}\) can be obtained from the formula:

$$ p^{m}_{N}(x,y) = \tilde{p}^{m}_{N}(x,y) - {\frac{1}{2^{d}}}\,(\tilde{p}^{m}_{N}, 1)_{N}. $$

We represent the discrete problem (9) as a matrix system using the bases of the vorticity, velocity, and pressure spaces. These unknowns are organized into vectors labeled W, U, and P, with dimensions \({\frac{d(d-1)}{2}} N_{k}^{d-2}(N_{k}-1)^{2}\), \(dN_{k}^{d-1}(N_{k}-1)\), and \(N_{k}^{d}-1\), respectively. Since the viscosity ν does not influence the resolution of the Stokes problem in the same way it does with the Navier–Stokes problem, we set \(\nu =1\).

If \(U^{0}=(U^{0}_{1},U^{0}_{2})\), the components of the vectors \(U^{0}_{1}\) and \(U^{0}_{2}\) are, respectively, \({\bf v}^{0}_{Nx}(\xi _{i},\xi _{j})\) and \({\bf v}^{0}_{Ny}(\xi _{i},\xi _{j})\), where \({\bf v}^{0}_{N}=({\bf v}^{0}_{Nx},{\bf v}^{0}_{Ny})\). Then, for any m, \(1\leq m\leq M\), since the vectors \(W^{m-1}\), \(U^{m-1}\), \(P^{m-1}\) are known we solve the following linear system that represents the discrete problem (9):

$$ \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} (Q^{T}_{\varpi} C Q_{\varpi}) W^{m} - (Q^{T}_{\varpi} A^{T} Q_{u}) U^{m}=0 \cr (Q_{u}^{T} A Q_{\varpi}) W^{m} + U^{m} - (Q_{u}^{T} B) P^{m}=Q_{u}^{T} F^{m} \cr (B^{T} Q_{u}) U^{m}=0, \cr \end{array}\displaystyle \right . $$
(10)

where \(X^{T}\) denotes the transposed matrix of the matrix X. The expression of matrices \(A= \begin{pmatrix} A_{1} \quad 0 \\ 0 \quad A_{2} \end{pmatrix} \), \(B=(B_{1},B_{2})\), and C are developed in ([9], Sect. 6).

Finally, for any m, \(1\leq m\leq M\), we denote \(F^{m}= \begin{pmatrix} F^{m}_{1} \cr F^{m}_{2} \cr 0 \end{pmatrix} \). The components of the second members \(F^{m}_{1}\) and \(F^{m}_{2}\) are, respectively, \(({\bf v}^{m-1}_{Nx},l_{r} l_{s}^{*})_{N}+\tau ^{m}(f^{m}_{1},l_{r} l_{s}^{*})_{N}, \, 1\leq r\leq N-1; s\in I^{*}\), and \(({\bf v}^{m-1}_{Ny},l_{r}^{*}l_{s})_{N}+\tau ^{m}(f^{m}_{2},l_{r}^{*}l_{s})_{N}, \, 1\leq s\leq N-1; r\in I^{*}\), where the data function \({\bf f}^{m}=(f^{m}_{1},f^{m}_{2})\).

3.2 Elimination algorithm

The Elimination algorithm is similar to the Uzawa algorithm, which is suitable for solving the standard Stokes problem (see [1, 11]) with only the velocity and pressure as unknowns. However, our problem involves three unknowns: velocity, pressure, and vorticity. To apply this algorithm, we eliminate the third unknown, namely vorticity. Below, we describe the steps of the resolution process.

We substitute the vorticity into the second equation of system (10), yielding:

$$ \left \{ \textstyle\begin{array}{l@{\quad}l@{\quad}l} W^{m} = [Q_{\varpi}^{-1}(C^{-1} A^{T})Q_{u}] \ U^{m} \cr [Q_{u}^{T}(A C^{-1} A^{T})Q_{u} + {\text{I}}] \ U^{m} - (Q_{u}^{T} B) P^{m}=Q_{u}^{T} F^{m} \cr (B^{T} Q_{u}) U^{m}=0. \cr \end{array}\displaystyle \right . $$
(11)

We consider the matrix \({\tilde{A}} = [Q_{u}^{T}(A C^{-1} A^{T})Q_{u} + {\text{I}}]\), where I is the identity matrix. We decouple the two unknowns, \(U^{m}\) and \(P^{m}\). The matrix C is invertible since its diagonal coefficients are nonzero (see [9], Sect. 6). The second equation of system (11) is written as:

$$ U^{m}={\tilde{A}}^{-1} Q_{u}^{T} \Big(F^{m} + B \ P^{m}\Big). $$
(12)

By inserting (12) into the third equation of the system (11) we obtain:

$$ \Big[ B^{T}(Q_{u} \tilde{A}^{-1} Q_{u}^{T}) B\Big]P^{m} = B^{T}(Q_{u} \tilde{A}^{-1} Q_{u}^{T}) F^{m}. $$
(13)

To find the discrete pressure \(P^{m}\), the linear system (13) is solved using the conjugate gradient method since the matrix \(\Big[ B^{T}(Q_{u} \tilde{A}^{-1} Q_{u}^{T}) B \Big]\) is symmetric and positive-definite. The same method is applied to system (12) to find the discrete velocity \(U^{m}\). The value of the vorticity \(W^{m}\) is then determined using the first equation of system (11).

Elimination algorithm

• Let \(P^{m}_{0}\) be arbitrary.

• Initialization step:

$$\begin{aligned}& {\tilde{A}}U^{m}_{0}=Q_{u}^{T} \Big(F^{m} + B \ P^{m}_{0}\Big)\\& (C Q_{\varpi})\ W^{m}_{0}=(A^{T} Q_{u}) U^{m}_{0}. \end{aligned}$$

• Iterations: \(q\geq 0\)

From \(U^{m}_{q}\) and \(P^{m}_{q}\):

$$ \textstyle\begin{array}{l@{\quad}l@{\quad}l@{\quad}l@{\quad}l} G^{m}_{q}= &(B Q_{u}) U^{m}_{q} \cr \tilde{A} V^{m}_{q} &= (Q_{u}^{T} B^{T}) G^{m}_{q} \cr \rho _{q} &={\frac{\Vert G^{m}_{q}\Vert ^{2}}{( Q_{u}^{T} B^{T} G^{m}_{q}, V^{m}_{q})}} \cr P^{m}_{q+1} &=P^{m}_{q}-\rho _{q} G^{m}_{q} \cr U^{m}_{q+1} &= U^{m}_{q}+\rho _{q} V^{m}_{q} \cr (C Q_{\varpi}) W^{m}_{q+1} &=(A^{T} Q_{u})\ U^{m}_{q+1}. \end{array} $$

While implementing the Elimination algorithm, we aimed to improve the convergence time. Unfortunately, convergence was achieved only after many iterations (hundreds of iterations for an error of order 10−7, as shown in Table 1 and Fig. 2. This is primarily due to the matrix à being very poorly conditioned. Therefore, we propose solving the problem using a Global inversion approach.

Table 1 Correlation between the number of iterations and the error for the Elimination method

3.3 Resolution by a global inversion

In the Global resolution, we propose to maintain the vorticity in the system (11) and invert the Global matrix:

$$ \begin{pmatrix} Q^{T}_{\varpi}CQ_{\varpi} &Q^{T}_{\varpi}(-A^{T})Q_{u} &0 \\ Q^{T}_{u}(-A)Q_{\varpi} &I &Q^{T}_{u}B \\ 0 &B^{T}Q_{u} &0 \end{pmatrix} \begin{pmatrix} W^{m} \\ U^{m} \\ P^{m} \end{pmatrix} = \begin{pmatrix} 0 \\ F^{m} \\ 0 \end{pmatrix} . $$
(14)

The choice of system (14), which relies on multiplication by Q-type matrices, ensures that the matrices A, B, and C are fully block-diagonal, with each block corresponding to one subdomain \(\omega _{k}\). In the following, system (14) is solved using the GMRES method, so it does not need to be assembled. We also use local preconditioners: each block in the Global matrix in (14) is preconditioned by the matrix resulting from its incomplete LU factorization. Notably, as is standard in spectral methods, the tensorization properties of the polynomial spaces ensure that each product of these blocks, corresponding to the subdomain \(\Omega _{k}\), with a vector, is performed with \(cN^{d+1}\) operations, significantly reducing the cost of inversion.

Convergence is achieved in fewer than 20 iterations for a relative error of approximately 10−19 (see Table 2 and Fig. 1). This excellent result was unattainable with the Elimination algorithm, as shown in Table 1.

Figure 1
figure 1

Time error curves from the solution defined in (15)

Table 2 Correlation between the number of iterations and the error for the Global inversion method

4 Numerical results

4.1 Two-dimensional experiments

In this section, first, we focus on the time convergence. We consider the square \(\Omega = {]-1,1[^{2}}\). We look at a given solution obtained thanks to the formulas \({\bf v}= {\bf curl}\,\psi \) and \(\varpi = {\bf curl}\,{\bf v}\).

The functions ψ and p are defined by

$$ \psi (x,y ) = t \sin (\pi x)\sin (\pi y) , \quad p(x,y) = e^{-t} xy. $$
(15)

The velocity is a Gaussian that is null for \(t = 0\). We consider the spectral discrete parameter \(N=40\), \(T=1\) and the time steps \(\tau \in \{10^{-1},10^{-2},10^{-3},10^{-4},10^{-5},10^{-6}\}\). Figure 1 presents the curves of time convergence for the three terms \(\log \|\varpi -\varpi ^{m}_{N} \|_{H(\operatorname{\mathbf{curl}},\Omega )}\) (in red), \(\log \|{\bf v}-{\bf v}^{m}_{N}\|_{H(\operatorname{div},\Omega )}\) (in blue), and \(\log \|p-p^{m}_{N}\|_{L^{2}(\Omega )}\) (in green) as a function of \(\log (\tau )\). We note that the time-convergence order is almost equal to 1.

Hereinafter, we consider \(\tau =10^{-6}\) and \(T=1\),

As a first step, we proceed with a Bercovier–Engelman analytical solution (see [17]) within the square \(\Omega = ]-1,1[^{2}\). This test is about the solution \((\varpi ^{m},{\bf v}^{m},p^{m})\) at the time \(t_{m}\) of the Stokes problem. This solution is equal to:

$$ \textstyle\begin{array}{l@{\quad}l@{\quad}l} \varpi ^{m}(x,y)&=&6\big((1-x^{2})(1-4x^{2})(1-y^{2})^{3} + (1-y^{2})(1-4y^{2})(1-x^{2})^{3} \big), \\ {\bf v}^{m}_{x}(x,y)&=& -6(1-y^{2})^{2}y(1-x^{2})^{3}, \\ {\bf v}^{m}_{y}(x,y)&=& 6(1-x^{2})^{2}x(1-y^{2})^{3}, \\ p^{m}(x,y)&=& xy. \end{array} $$
(16)

Figure 2 presents the error curves on the solution \((\varpi ^{m},{\bf v}^{m},p^{m})\) for N varying from 5 to 20 issued from the solution defined in (16). Figures 2a and b correspond, respectively, to the resolution by the Elimination method and the resolution by the Global inversion method. It is clearly shown that the error is better with the Global inversion resolution. Table 1 and Table 2 present the number of iterations necessary for convergence and the corresponding average error for the three unknowns (vorticity, velocity, and pressure). Comparing the two results, it is clear that the Global inversion method not only achieves better accuracy but also converges within fewer iterations.

Figure 2
figure 2

Error curves for the solution defined in (16)

From here, we consider only the resolution with the Global inversion method.

We now present four numerical experiments, in dimension \(d = 2\) and in the case where the data f and the boundary condition on velocity are defined as:

$$ {\bf f}=(1,1) \quad \text{and} \quad {\bf v}\cdot {\bf n}=0. $$
(17)

We consider four situations about the domain Ω. First, we consider the square \(]-1,1[^{2}\) without domain decomposition and \(]-1,1[^{2}\) with domain decomposition, see Fig. 3. Secondly, we consider the not convex L-shaped domain \(\Omega =]-1,1[^{2}/]0,1[^{2}\) that we decompose into three subdomains, see Fig. 4:

$$ \Omega _{1}=]-1,0[\times ]-1,0[,\quad \Omega _{2}=]-1,0[\times ]0,1[, \quad \Omega _{3}=]0,1[\times ]-1,0[. $$

Finally, we consider the multiply connected domain \(]-2,2[^{2}/]-1,1[^{2}\) divided into four equal squares and four equal rectangles, as illustrated in Fig. 4 and with the cut \(\Sigma _{1}= ]1, 2[\times \{1\}\). Figure 5 presents, respectively, from left to right and from top to bottom the discrete vorticity, the two components of the vector velocity \(({\bf v}^{m}_{x},v^{m}_{y})\) and the pressure for the data defined in (17) on a spectral mesh grid of the square \(]-1,1[^{2}\) without domain decomposition, obtained with \(N = 40\).

Figure 3
figure 3

The square with and and without domain decomposition

Figure 4
figure 4

The not convex and multiply connected domains

Figure 5
figure 5

The discrete solution on the square \(]-1,1[^{2}\) issued from (17)

Figure 6 presents, respectively, from left to right and from top to bottom the discrete vorticity, the two components of the vector velocity \(({\bf v}^{m}_{x},v^{m}_{y})\), and the pressure for the data defined in (17) on a spectral mesh grid of the square \(]-1,1[^{2}\) with domain decomposition, obtained with \(N = 40\). Figure 7 presents, respectively, from left to right and from top to bottom the discrete vorticity, the two components of the vector velocity \(({\bf v}^{m}_{x},v^{m}_{y})\), and the pressure for the data defined in (17) on a spectral mesh grid of the nonconvex L-shaped domain \(\Omega =]-1,1[^{2}/]0,1[^{2}\), obtained with \(N = 40\).

Figure 6
figure 6

The discrete solution on the decomposed square \(]-1,1[^{2}\) issued from (17)

Figure 7
figure 7

The discrete solution on the L-shaped domain \(\Omega =]-1,1[^{2}/]0,1[^{2}\) issued from (17)

Figure 8 presents, respectively, from left to right and from top to bottom the discrete vorticity, the two components of the vector velocity \(({\bf v}^{m}_{x},v^{m}_{y})\), and the pressure for the data defined in (17) on a spectral mesh grid of the decomposition of the multiply connected square ring domain, obtained with \(N = 40\).

Figure 8
figure 8

The discrete solution on the square ring domain \(]-2,2[^{2}/]-1,1[^{2}\) issued from (17)

4.2 Three-dimensional experiments

Here, the domain is \(\Omega = ]-1,1[^{3}\) with \(\tau =10^{-6}\) and \(T=1\).

We consider a given analytic solution constructed thanks to the formulas \({\bf v}^{m} = {\bf curl}\,\chi ^{m}\) and \(\varpi ^{m} = {\bf curl}\,{\bf v}^{m}\), we construct the analytic solution where \(\chi ^{m} = (\chi ^{m}_{x},\chi ^{m}_{y},\chi ^{m}_{z})\), the stream vector, and \(p^{m}\) are defined by

$$ \textstyle\begin{array}{l@{\quad}l} \chi ^{m}_{x}(x,y,z) &= (1-y^{2})^{3}(1-z^{2})3, \quad \chi ^{m}_{y}(x,y,z) = (1-x^{2})^{3}(1-z^{2})^{3}, \cr \chi ^{m}_{z}(x,y,z) &= (1-x^{2})^{3}(1-y^{2})^{3}, \quad p^{m}(x,y,z) = xyz. \cr \end{array} $$
(18)

Figure 9 presents the error curves for \(\varpi ^{m}\), \({\bf v}^{m}\), and \(p^{m}\), with N varying from 5 to 18. Given that the regularity of the solutions in (18) is \(\mathcal{C}^{\infty}\), the slopes of the error curves are very similar to those in Fig. 2b.

Figure 9
figure 9

Error curves for the solution defined from (18)

We note that for three-dimensional calculations, the matrices are not sparse and have a large order, necessitating a relatively small maximum value for \(N=18\).

5 Conclusion and future work

In this work, we highlight the efficiency of the Global inversion method compared to the Elimination method for solving the discrete problem arising from the spectral-element discretization of the time-dependent vorticity, velocity, and pressure formulation of the Stokes problem. The Global inversion method achieved good convergence. We present several numerical tests on a spectral mesh applied to nonconvex and multiply connected domains.

For future work, we aim to discretize the time-dependent nonlinear Navier–Stokes problem using the spectral-element method.