1 Introduction

The Navier–Stokes equations play an important role in studying incompressible viscous fluid flows, see, e.g., [28, 29, 36]. We were mostly concerned with the fluid flows with non-slip boundary conditions. But, in some practical cases, we have to consider slip boundary conditions. Ma and Wang [30, 31] discussed steady problems with slip boundary conditions. Guermond and Quartpelle [10], and Orszag et al.[34] dealt with a special problem with similar boundary conditions. Mucha [33] studied the fluid flows in an infinite pipe, with more general boundary conditions. Recently, Guo [16] investigated the \(n\)-dimensional Navier–Stokes equations with slip boundary conditions, and proved the existence, uniqueness and regularity of solutions. On the other hand, in various numerical methods with domain decompositions, we should impose other kinds of boundary conditions on the interfaces of adjacent subdomains, see Feitauer and Schwab [6], and Gatica and Hsiao [7]. We also refer to the work of John and Liakos [26].

In numerical simulations of incompressible viscous fluid flows, we usually considered the primitive form of the Navier–Stokes equations with the velocity and the pressure, for which finite difference method and finite element method have been used successfully, see, [3, 4, 8, 13, 27, 28, 35] and the references therein. Some authors also provided spectral schemes for the Navier–Stokes equations, see, e.g., [1, 2, 12, 14, 19, 24, 32]. Whereas, all of the above work are only available for the fluid flows with periodical or non-slip boundary conditions. As we know, in actual computations, the main difficulty for non-periodical problems is how to ensure the incompressibility of numerical solutions. For finite difference method, we approximated the incompressibility by certain finite difference equation as in [13, 28]. For finite element method, we approximated a weak form of the continuity equations as in [8]. But for spectral method, it is not easy to construct non-periodical and divergence-free base functions. In order to remove this trouble, we may adopt the artificial compressibility method given by Chorin [3], which brings additional errors unfortunately. The mostly used method is the projection method started by Chorin [4] and Téman [35]. However, it is non-trivial to deal with the value of pressure on the boundaries, cf. [9]. Meanwhile, some authors designed spectral schemes based on the stream function form of the Navier–Stokes equations, see [17, 23]. In this case, the numerical solutions fulfill the incompressibility and the non-slip boundary conditions automatically. But, we need to solve nonlinear partial differential equations of fourth order. On the other hand, the vorticity-stream function form of the Navier–Stokes equations was also adopted for numerical simulations of incompressible fluid flows, see [11, 29, 36] and the references therein. Whereas, for the fluid flows with non-slip boundary conditions, how to deal with the boundary values of vorticity is rather a problem. In some literatures, one assumed that the value of vorticity is given on the boundary. Indeed, this treatment is not physical and so also brings additional errors.

In this work, we investigate the spectral method for the Navier–Stokes equations with slip boundary conditions. The main strategy is to use the generalized Jacobi functions proposed by Guo et al. [20, 21] recently. More precisely, we introduce an orthogonal family induced by the generalized Jacobi functions, and then use it to approximate the unknown velocity. Since these base functions are divergence-free, the corresponding numerical solutions fulfill the incompressibility automatically. Therefore, in this case, we need neither the artificial compressibility method nor the projection method. This fact simplifies actual computation and numerical analysis essentially. Moreover, for the \(n\)-dimensional problems, we only need to evaluate the unknown coefficients of expansions of \(n-1\) components of the velocity actually. This feature also saves computational time. As the mathematical foundation of the proposed new approach, we establish some approximation results, with which we prove the spectral accuracy in space of the proposed new method. The numerical results demonstrate its high effectiveness and coincide with the analysis very well. The main idea, the approximation results and the techniques developed in this paper are also applicable to numerical simulations of other problems with divergence-free solutions, such as certain partial differential equations describing electro-magnetic fields.

This paper is organized as follows. The next section is for preliminaries. In Sect. 3, we provide the spectral scheme and present some numerical results. Section 4 is for some approximation results. In Sect. 5, we prove the spectral accuracy in space of the numerical solutions of two dimensional fluid flows. In Sect. 6, we analyze the numerical error for three dimensional fluid flows. The final section is for concluding remarks, as well as discussions on the possibility of using the proposed method for the Darwin model of approximation to the Maxwell equations, cf. Degond and Raviat [5].

2 Preliminaries

In this section, we introduce a new orthogonal system, and explore the reasonable expansions of divergence free functions, which play important roles in designing and analyzing the spectral method for the Navier–Stokes equations with slip boundary conditions.

2.1 A New Orthogonal System in One Dimension

Let \(I=\left\{ ~x~|~|x|<1\right\} \) and \(\chi (x)\) be a certain weight function. For any integer \(r\ge 0\), we define the weighted Sobolev spaces \(H^r_{\chi }(I)\) and \(H^r_{0,\chi }(I)\) in the usual way, with the inner product \((u,v)_{H^r_\chi (I)}\), the semi-norm \(|v|_{H^r_\chi (I)}\) and the norm \(||v||_{H^r_\chi (I)}\). In particular, \(L^2_{\chi }(I)=H^0_{\chi }(I)\), with the inner product \((u,v)_{L^2_\chi (I)}\) and the norm \(||v||_{L^2_\chi (I)}\). For simplicity, we omit the subscript \(\chi \) in notations whenever \(\chi (x)\equiv 1\).

Let \({\alpha },{\beta }>-1\). The Jacobi polynomials are given by

$$\begin{aligned} (1-x)^{{\alpha }}(1+x)^{{\beta }}J^{({\alpha },{\beta })}_{l}(x)=\frac{(-1)^{l}}{2^{l} l!}{\partial }^{l}_{x}((1-x)^{l+{\alpha }}(1+x)^{l+{\beta }}),\quad l\ge 0. \end{aligned}$$
(2.1)

In particular, the Legendre polynomials \(L_{l}(x)=J^{(0,0)}_{l}(x),~~ l\ge 0\). We have

$$\begin{aligned} {\partial }_{x}J^{({\alpha },{\beta })}_{l}(x)=\frac{1}{2}(l+{\alpha }+{\beta }+1)J^{({\alpha }+1, {\beta }+1)}_{l-1}(x),\quad l\ge 1. \end{aligned}$$
(2.2)

The Jacobi weight function \(\chi ^{({\alpha },{\beta })}(x)=(1-x)^{{\alpha }}(1+x)^{{\beta }}\). We have

$$\begin{aligned} \displaystyle \int \limits \limits _{I}J^{({\alpha },{\beta })}_{l}(x)J^{({\alpha },{\beta })}_{l^{^{\prime }}}(x) \chi ^{({\alpha },{\beta })}(x) dx={\gamma }^{({\alpha },{\beta })}_{l}{\delta }_{l,l^{^{\prime }}}, \quad l,l^{^{\prime }}\ge 0, \end{aligned}$$
(2.3)

where \({\delta }_{l,l^{^{\prime }}}\) is the Kronecker symbol, and

$$\begin{aligned} {\gamma }^{({\alpha },{\beta })}_{l}=\frac{2^{{\alpha }+{\beta }+1}{\Gamma }(l+{\alpha }+1){\Gamma }(l+{\beta }+1)}{(2l+{\alpha }+{\beta }+1){\Gamma }(l+1){\Gamma }(l+{\alpha }+{\beta }+1)}. \end{aligned}$$
(2.4)

We introduce the polynomials

$$\begin{aligned} G_{l}(x)=\frac{(-1)^{l}}{2^{l-2}(l-1)!} {\partial }_{x}^{l-2}((1-x^{2})^{l-1}),\quad l\ge 2. \end{aligned}$$
(2.5)

Clearly, \(G_{l}(\pm 1)=0\). Moreover, we see from (2.1) that

$$\begin{aligned} G_{l}(x)=\frac{1}{l-1}(1-x^{2})J^{(1,1)}_{l-2}(x), \quad l\ge 2. \end{aligned}$$
(2.6)

The polynomial \((l-1)G_{l}(x)\) is exactly the same as the generalized Jacobi function \(j^{(-1,-1)}_{l}(x)\) proposed in [20, 21]. In fact, in order to derive the divergence-free basis simply, we use the notation \(G_{l}(x)=\dfrac{1}{l-1}j^{(-1,-1)}_{l}(x)\). Thus, by virtue of (2.16) of [21], we have

$$\begin{aligned} {\partial }_{x}G_{l+1}(x)=-2L_{l}(x),\quad l\ge 1. \end{aligned}$$
(2.7)

Thanks to (2.6) and (2.2) with \({\alpha }={\beta }=0\), we obtain

$$\begin{aligned} G_{l+1}(x)=\frac{2}{l(l+1)}(1-x^{2}){\partial }_{x}L_{l}(x),\quad l\ge 1. \end{aligned}$$
(2.8)

On the other hand, we use (B.9) of [21] to derive that

$$\begin{aligned} G_{l+1}(x)=\frac{2}{2l+1}(L_{l-1}(x)-L_{l+1}(x)),\quad l\ge 1. \end{aligned}$$
(2.9)

Obviously, \({\partial }^{k}_{x}G_{l+1}(x)=0\) for \(k>l+1\ge 2\). Furthermore, we use (2.7) and (2.2) repeatedly to obtain

$$\begin{aligned} {\partial }_{x}^{k}G_{l+1}(x)=-\frac{(l+k-1)!}{2^{k-2}l!}J^{(k-1, k-1)}_{l-k+1}(x),\quad k\le l+1,~~l\ge 1. \end{aligned}$$
(2.10)

Consequently, we use (2.10) and (2.3) to obtain

$$\begin{aligned} \displaystyle \int \limits \limits _{I}{\partial }_{x}^{k}G_{l+1}(x){\partial }_{x}^{k}G_{l^{^{\prime }}+1}(x) (1-x^{2})^{k-1}dx=D_{l,k}{\delta }_{l,l^{^{\prime }}},\quad k\le l+1,~~l\ge 1, \end{aligned}$$
(2.11)

with

$$\begin{aligned} D_{l,k}=\frac{8(l+k-1)!}{(2l+1)(l-k+1)!}, \quad k\le l+1,~~l\ge 1. \end{aligned}$$
(2.12)

In numerical analysis of spectral method for incompressible flows with slip boundary conditions, we need some approximation results in one dimension. For any non-negative integer N, \(\mathcal{P}_N(I)\) stands for the set of all algebraic polynomials of degree at most N, and

$$\begin{aligned} \mathcal{Q}_N(I)=\text{ span } \left\{ ~ G_{l+1}(x) \mid 1\le l \le N-1\right\} . \end{aligned}$$

The orthogonal projection \(P_{N,I}: L^2(I)\rightarrow \mathcal{P}_N(I)\) is defined by

$$\begin{aligned} (P_{N,I} v-v, \phi )_{L^2(I)}=0,\quad \forall ~ \phi \in \mathcal{P}_N(I). \end{aligned}$$
(2.13)

The orthogonal projection \(\tilde{P}_{N,I}: L^2_{\chi ^{(-1,-1)}}(I) \rightarrow \mathcal{Q}_N(I)\) is defined by

$$\begin{aligned} (\tilde{P}_{N,I}v-v, \phi )_{L^2_{\chi ^{(-1,-1)}}(I)}=0,\quad \forall ~ \phi \in \mathcal{Q}_N(I). \end{aligned}$$
(2.14)

The orthogonal projection \(P_{N,I}^{1,0}: H_0^1(I)\rightarrow \mathcal{Q}_N(I)\) is defined by

$$\begin{aligned} (\partial _x(P^{1,0}_{N,I} v-v),\partial _x\phi )_{L^2(I)} =0, \quad \forall ~ \phi \in \mathcal{Q}_N(I). \end{aligned}$$
(2.15)

By virtue of Theorems 2.1 of [22] (also cf. [15]), we have that if \(v\in L^2(I),~\partial _x^rv\in L^2_{\chi ^{(r,r)}}(I)\), integers \(r\ge 0\) and \(r \le N+1\), then

$$\begin{aligned} \Vert P_{N,I}v -v \Vert _{L^2(I)} \le c N^{-r}\Vert \partial _x^rv\Vert _{{L^2_{\chi ^{(r,r)}}(I)}}. \end{aligned}$$
(2.16)

Since the basis functions \(lG_{l+1}(x)\) are exactly the same as the generalized Jacobi functions \(j_{l+1}^{(-1,-1)}(x)\), we know from (2.39) of [21] that if \(v\in L^2_{\chi ^{(-1,-1)}}(I),~ \partial _x^rv\in L^2_{\chi ^{(r-1,r-1)}}(I)\), integers \(N\ge 2, 1 \le r \le N+1\) and \(0\le \mu \le r\), then

$$\begin{aligned} \Vert \partial _x^\mu (\tilde{P}_{N,I}v-v) \Vert _{L^2_{\chi ^{(\mu -1,\mu -1)}}(I)} \le c N^{\mu -r}\Vert \partial _x^rv\Vert _{L^2_{\chi ^{(r-1,r-1)}}(I)}. \end{aligned}$$
(2.17)

Moreover, it was shown in (3.10) of [21] that

$$\begin{aligned} P^{1,0}_{N,I}v=\tilde{P}_{N,I}v, \quad \forall ~ v\in H^1_0(I). \end{aligned}$$
(2.18)

Accordingly, we obtain from (2.17) that if \(v\in H^1_0(I),~\partial _x^rv\in L^2_{\chi ^{(r-1,r-1)}}(I)\), integers \(N\ge 2\) and \( 1 \le r \le N+1,\) then

$$\begin{aligned} \Vert \partial _x^\mu (P^{1,0}_{N,I} v-v)\Vert _{L^2_{\chi ^{(\mu -1, \mu -1)}}(I)} \le c N^{\mu -r}\Vert \partial _x^rv\Vert _{{L^2_{\chi ^{(r-1, r-1)}}(I)}}, \quad \mu =0,1. \end{aligned}$$
(2.19)

2.2 Expansions of Divergence Free Functions

Let \(\mathbf{x}=(x_{1},x_{2},\ldots ,x_{n})^T, {\Omega }=\left\{ ~ \mathbf{x}~|~|x_{i}|<1,~1\le i\le n\right\} \) with the boundary \({\partial }{\Omega }\), and \(\bar{\Omega }={\Omega }\cup {\partial }{\Omega }\). Also, let \(\chi _{i}(\mathbf{x })=(1-x_{i}^{2})\) and the space

$$\begin{aligned} L^{2}_{\chi _{i}^{-1}}({\Omega })=\left\{ ~v~|~ v \text{ is } \text{ measurable } \text{ on } {\Omega } \text{ and } \Vert v\Vert _{L^{2}_{\chi _{i}^{-1}}({\Omega })}<\infty \right\} , \end{aligned}$$

equipped with the following inner product and norm,

$$\begin{aligned} (u,v)_{L^{2}_{\chi _{i}^{-1}}({\Omega })}=\displaystyle \int \limits \limits _{{\Omega }}(1-x_{i}^{2})^{-1}u (\mathbf{x})v(\mathbf{x})d \mathbf{x}, \quad \Vert v\Vert _{L^{2}_{\chi _{i}^{-1}} ({\Omega })}=(v,v)_{L^{2}_{\chi _{i}^{-1}}({\Omega })}^{\frac{1}{2}},\quad 1\le i\le n. \end{aligned}$$

The vector function \(\mathbf{v }(\mathbf{x })=(v^{(1)}(\mathbf{x}), v^{(2)}(\mathbf{x}),\ldots ,v^{(n)}(\mathbf{x }))^{T}\). We introduce the space

$$\begin{aligned} W({\Omega })=\left\{ ~\mathbf{v }(~\mathbf x )~|~v^{(j)}(\mathbf x )\in L^{2}_{\chi _{j}^{-1}}({\Omega }),~1\le j\le n\right\} . \end{aligned}$$

If \(\mathbf v \in W({\Omega })\), then

$$\begin{aligned} v^{(j)}(\mathbf x )=0, \quad \text{ for } ~|x_{j}|=1,~~1\le j\le n. \end{aligned}$$
(2.20)

Let \(l_{i}\) be non-negative integers and \(l=(l_{1},l_{2},\ldots ,l_{n})^{T}\). For any \(l\) with \(l_{j}\ge 1\) and \(l_{i}\ge 0 (i\ne j)\), we introduce the following polynomials (cf. [16]),

$$\begin{aligned} \psi ^{(j)}_{l}(\mathbf x )=\psi ^{(j)}_{ l_{1},l_{2},\ldots ,l_{n}}(\mathbf x )=G_{l_{j}+1}(x_{j}) \mathop {\prod }\limits _{\mathop {1 \le i\le n}\limits _{i\ne j}} L_{l_{i}}(x_{i}). \end{aligned}$$
(2.21)

The set of all \(\psi ^{(j)}_{l}(\mathbf x )\) is a complete \(L^{2}_{\chi _{j}^{-1}}({\Omega })\)-orthogonal system. Thanks to (2.3) with \({\alpha }={\beta }=0\) and (2.11) with \(k=0\), we deduce that for \(1\le j\le n,\)

$$\begin{aligned} \displaystyle \int \limits \limits _{{\Omega }}(1-x_{j}^{2})^{-1}\psi ^{(j)}_{l}(\mathbf x ) \psi ^{(j)}_{l^{^{\prime }}}(\mathbf x )d \mathbf x =\eta ^{(j)}_{l}{\delta }_{l, l^{^{\prime }}}, \quad l_{j} \ge 1 \text{ and } l_{i}\ge 0 \text{ for } i\ne j, \end{aligned}$$
(2.22)

where \({\delta }_{l, l^{^{\prime }}}\) is the \(n\)-dimensional Kronecker symbol, and

$$\begin{aligned} \eta ^{(j)}_{l}\!=\!\eta ^{(j)}_{l_{1},l_{2},\ldots ,l_{n}}\!=\! \frac{2^{n+2}}{l_{j}(l_{j}+1)}\big (\prod _{1\le \nu \le n}(2l_{\nu }+1)\big )^{-1},~~~~l_{j}\ge 1 \text{ and } l_{i}\ge 0 \text{ for } i\ne j.\qquad \end{aligned}$$
(2.23)

For any \(\mathbf v \in W({\Omega })\), its components can be expanded as

$$\begin{aligned} v^{(j)}(\mathbf x )=\sum _{l_{j}=1}^{\infty } \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \sum _{l_{i}=0}^{\infty }\hat{v}^{(j)}_{l}\psi ^{(j)}_{l} (\mathbf x )=\sum _{l_{j}=1}^{\infty } \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \sum _{l_{i}=0}^{\infty }\hat{v}^{(j)}_{l_{1},l_{2}, \ldots ,l_{n}}\psi ^{(j)}_{l_{1},l_{2},\ldots , l_{n}}(\mathbf x ),\quad 1\le j\le n,\nonumber \\ \end{aligned}$$
(2.24)

where

$$\begin{aligned} \hat{v}^{(j)}_{l}=\hat{v}^{(j)}_{l_{1},l_{2},\ldots , l_{n}}=\frac{1}{\eta ^{(j)}_{l}}\displaystyle \int \limits \limits _{{\Omega }}(1-x_{j}^{2})^{-1} v^{(j)}(\mathbf x )\psi ^{(j)}_{l}(\mathbf x )d\mathbf x . \end{aligned}$$
(2.25)

Now, by using (2.25), (2.21), (2.8), an integration by parts and (2.23) successively, we derive that if \(l_{j}\ge 1\) and \(l_{i}\ge 0\) for \(i\ne j\), then

$$\begin{aligned} \hat{v}^{(j)}_{l}&= \displaystyle \frac{2}{l_{j}(l_{j}+1)\eta ^{(j)}_{l}}\displaystyle \int \limits \limits _{{\Omega }}v^{(j)}(\mathbf x ) {\partial }_{x_{j}}L_{l_{j}}(x_{j})\left( \mathop {\prod }\limits _{\mathop {1\le \nu \le n}\limits _{\nu \ne j}} L_{l_{\nu }}(x_{\nu })\right) d\mathbf x \nonumber \\&= -\displaystyle \frac{2}{l_{j}(l_{j}+1)\eta ^{(j)}_{l}}\displaystyle \int \limits \limits _{{\Omega }} {\partial }_{x_{j}}v^{(j)}(\mathbf x )\left( \prod _{1\le \nu \le n}L_{l_{\nu }} (x_{\nu })\right) d\mathbf x \nonumber \\&= \displaystyle -\frac{1}{2^{n+1}}\left( \prod _{1\le \nu \le n}(2l_{\nu } +1)\right) \displaystyle \int \limits \limits _{{\Omega }}{\partial }_{x_{j}}v^{(j)}(\mathbf x ) \left( \prod _{1\le \nu \le n}L_{l_{\nu }}(x_{\nu })\right) d\mathbf x . \end{aligned}$$
(2.26)

Due to (2.26), we find that if \(\mathbf v \in W({\Omega }), {\nabla }\cdot \mathbf v (\mathbf x )=0\) and all \(l_{i}\ge 1\), then

$$\begin{aligned} \displaystyle \sum _{j=1}^{n}\hat{v}^{(j)}_{l}=\displaystyle -\frac{1}{2^{n+1}}\left( \prod _{1\le \nu \le n}(2l_{\nu }+1)\right) \displaystyle \int \limits \limits _{{\Omega }}{\nabla }\cdot \mathbf v (\mathbf x )\left( \prod _{1\le \nu \le n}L_{l_{\nu }}(x_{\nu })\right) d\mathbf x =0. \end{aligned}$$
(2.27)

Next, let \(\mathcal{B }_j\) be the set consisting of all \(l=(l_{1},l_{2},\ldots ,l_{n})^T\) with \(l_j\ge 1\), and at least one component \(l_i (i\ne j)\) vanishes. Then, we use (2.24), (2.7) and (2.27) successively to deduce that

$$\begin{aligned} {\nabla }\cdot \mathbf v (\mathbf x )&=\displaystyle \sum _{j= 1}^{n}\sum _{l_{j}=1 }^{\infty } \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \sum _{l_{i}=0}^{\infty } \hat{v}^{(j)}_l{\partial }_{x_{j}} \psi ^{(j)}_{l}(\mathbf x )=\displaystyle -2\sum _{j= 1}^{n} \sum _{l\in \mathcal{B }_{j}}\hat{v}^{(j)}_{l}\left( \prod _{1\le \nu \le n}L_{l_{\nu }}(x_{\nu })\right) .\qquad \;\; \end{aligned}$$
(2.28)

We multiply (2.28) by \(\prod _{1\le \nu \le n}L_{l_{\nu }^{\prime }}(x_{\nu })\) and integrate the resulting equality over the domain \({\Omega }\). Then, we use (2.3) with \({\alpha }={\beta }=0\) to obtain \(\hat{v}^{(j)}_{l^{\prime }}=0\) for \(l^{\prime }\in \mathcal{B }_{j}\).

The previous statements imply that if \(\mathbf v \in W({\Omega })\) and \({\nabla }\cdot \mathbf v (\mathbf x )=0\) on \(\bar{\Omega }\), then we could expand the components of \(\mathbf v (\mathbf x )\) as

$$\begin{aligned} v^{(j)}(\mathbf x )=\sum _{i=1}^n\sum _{l_{i}= 1}^{\infty }\hat{v}^{(j)}_{l}\psi ^{(j)}_{l}(\mathbf x )= \sum _{i=1}^n\sum _{l_{i}= 1}^{\infty }\hat{v}^{(j)}_{l_{1}, l_{2},\ldots ,l_{n}}\psi ^{(j)}_{l_{1},l_{2},\ldots ,l_{n}}(\mathbf x ),\quad 1\le j\le n, \end{aligned}$$
(2.29)

where the coefficients \(\hat{v}^{(j)}_{l}\) satisfy the equality

$$\begin{aligned} \sum _{j=1}^{n}\hat{v}^{(j)}_{l}=\sum _{j=1}^{n}\hat{v}^{(j)}_{l_{1}, l_{2},\ldots ,l_{n}}=0,\quad \mathrm{for~ all~} l_i\ge 1, 1\le i \le n. \end{aligned}$$
(2.30)

3 Spectral Method for Flows with Slip Boundary Conditions

3.1 Spectral Scheme

We denote the velocity by \(\mathbf U (\mathbf x ,t) =(U^{(1)}(\mathbf x ,t), U^{(2)}(\mathbf x ,t),\ldots , U^{(n)}(\mathbf x ,t))^{T}\), and the pressure by \(P(\mathbf x ,t)\). The constant \(\nu >0\) stands for the kinetic viscosity. The body force \(\mathbf f (\mathbf x ,t)=(f^{(1)}(\mathbf x ,t), f^{(2)}(\mathbf x ,t), \ldots ,f^{(n)}(\mathbf x ,t))^{T}\). \(\mathbf U _0(\mathbf x )\) describes the initial state of velocity. We denote by n the unit vector in the outward normal direction, and denote by \(\varvec{\tau }\) the unit vector in the tangential direction on \({\partial }{\Omega }\). The notation \({\partial }_\mathbf{n}\) means the outward normal derivative of \(\mathbf U (\mathbf x ,t)\) on \({\partial }{\Omega }\). Let \(T>0\). The primitive form of Navier–Stokes equations with slip boundary conditions described in [16, 30, 31] is as follows,

$$\begin{aligned} \left\{ \begin{array}{ll} {\partial }_{t}\mathbf U (\mathbf x ,t)+(\mathbf U (\mathbf x ,t)\cdot {\nabla }) \mathbf U (\mathbf x ,t)-\nu {\Delta }\mathbf U (\mathbf x ,t)+{\nabla }P(\mathbf x ,t)=\mathbf f (\mathbf x ,t),&{}\quad \mathrm{~ in~}~{\Omega },~~ 0< t \le T, \\ {\nabla }\cdot \mathbf U (\mathbf x ,t)=0, &{}\quad \mathrm{~ on~}~\bar{\Omega },~~ 0\le t\le T,\\ \mathbf U (\mathbf x ,t)\cdot \mathbf{n}={\partial }_\mathbf{n}(\mathbf U (\mathbf x ,t)\cdot \varvec{\tau })=0,&{} \quad \mathrm{~ on~}~{\partial }{\Omega },~~ 0\le t\le T,\\ \mathbf U (\mathbf x ,0)=\mathbf U _{0}(\mathbf x ), &{}\quad \mathrm{~ on~} ~\bar{\Omega }.\\ \end{array}\right. \nonumber \\ \end{aligned}$$
(3.1)

Let \(\mathbf L ^{2}({\Omega })=(L^{2}({\Omega }))^{n}\) and \(\mathbf H ^{1}({\Omega })=(H^{1}({\Omega }))^{n}\). For any vector functions \(\mathbf u ,\mathbf v \in \mathbf L ^{2}({\Omega })\), the inner product and the norm are given by

$$\begin{aligned} (\mathbf u ,\mathbf v )_\mathbf{L ^{2}({\Omega })}=\sum _{j=1}^{n}(u^{(j)}, v^{(j)})_{L^{2}({\Omega })}, \quad ||\mathbf v ||_\mathbf{L ^{2} ({\Omega })}=(\mathbf v ,\mathbf v )_\mathbf{L ^{2}({\Omega })}^{\frac{1}{2}}. \end{aligned}$$

We define the inner product \((\mathbf u , \mathbf v )_\mathbf{H ^{r}({\Omega })}\), the semi-norm \(|\mathbf v |_\mathbf{H ^r({\Omega })}\) and the norm \(||\mathbf v ||_\mathbf{H ^r({\Omega })}\) similarly.

We shall use the following notations,

$$\begin{aligned} a(\mathbf u ,\mathbf w )&= \displaystyle \sum ^n_{j=1}\displaystyle \sum ^n_{i=1}\displaystyle \int \limits \limits _{{\Omega }} \partial _{x_i}u^{(j)}(\mathbf x )\partial _{x_i}w^{(j)}(\mathbf x ) d\mathbf x ,\quad \! \forall ~ \mathbf u ,\mathbf w \in \mathbf H ^{1}({\Omega }),\\ b(\mathbf u ,\mathbf z ,\mathbf w )&= \displaystyle \sum ^n_{j=1}\displaystyle \sum ^n_{i=1} \displaystyle \int \limits \limits _{{\Omega }}z^{(i)}(\mathbf x )\partial _{x_i}u^{(j)}(\mathbf x ) w^{(j)}(\mathbf x ) d\mathbf x ,\quad \forall ~ \mathbf u , \mathbf z ,\mathbf w \in \mathbf H ^{1}({\Omega }). \end{aligned}$$

According to (2) of [16], we know that if \(\mathbf w (\mathbf x )\cdot \mathbf{n}={\partial }_\mathbf{n}(\mathbf w (\mathbf x )\cdot \varvec{\tau })=0\) on \({\partial }{\Omega }\), then

$$\begin{aligned} ({\Delta }\mathbf u ,\mathbf w )_\mathbf{L ^2({\Omega })} =-a(\mathbf u,w ). \end{aligned}$$
(3.2)

Thanks to (3) of [16], we assert that if \(\mathbf u,w,z \in \mathbf H ^1({\Omega }), {\nabla }\cdot \mathbf z (\mathbf x )=0\) in \({\Omega }\) and \(\mathbf z (\mathbf x )\cdot \mathbf{n}=0\) on \({\partial }{\Omega }\), then

$$\begin{aligned} b(\mathbf u,z,w )=-b(\mathbf w,z,u ). \end{aligned}$$
(3.3)

Let

$$\begin{aligned} V({\Omega })&= \left\{ ~\mathbf w ~|~\mathbf w \in \mathbf H ^1({\Omega }),{\nabla }\cdot \mathbf w (\mathbf x )=0 \text{ on } \bar{\Omega } \text{ and } \mathbf w (\mathbf x )\cdot \mathbf{n}=0 \text{ on } {\partial }{\Omega }\right\} ,\\ {\fancyscript{H}}({\Omega })&= \left\{ ~\mathbf w ~|~\mathbf w \in \mathbf L ^2({\Omega }),{\nabla }\cdot \mathbf w (\mathbf x )=0 \text{ on } \bar{\Omega } \text{ and } \mathbf w (\mathbf x )\cdot \mathbf{n}=0 \text{ on } {\partial }{\Omega }\right\} . \end{aligned}$$

The dual space of \(V({\Omega })\) is denoted by \(V^{\prime }({\Omega })\).

By using (3.2) and (3.3), we derive a weak formulation of (3.1). It is to seek \(\mathbf U \in L^{2}(0,T;V({\Omega }))\cap L^{\infty }(0,T;{\fancyscript{H}}({\Omega }))\), such that

$$\begin{aligned} \left\{ \begin{array}{ll} ({\partial }_{t}\mathbf U (t), \mathbf w )_\mathbf{L ^{2}({\Omega })} +b(\mathbf U (t), \mathbf U (t),\mathbf w ) +\nu a(\mathbf U (t),\mathbf w ) = (\mathbf f (t),\mathbf w )_\mathbf{L ^{2}({\Omega })},&{}\quad \forall ~ \mathbf w \in ~ V({\Omega }),~0<t\le T,\\ \mathbf U (\mathbf x ,0)=\mathbf U _0(\mathbf x ), &{}\quad \text{ on }\quad \bar{\Omega }. \end{array}\right. \nonumber \\ \end{aligned}$$
(3.4)

According to Theorem 2.1 of [16], we know that if \(\mathbf U _0\in {\fancyscript{H}}({\Omega })\) and \(\mathbf f \in L^2(0,T;V^{\prime }({\Omega }))\), then (3.4) admits at least one solution. Especially, such solution is unique for \(n=2\). Moreover, it was shown in Theorem 4.1 of [16] that if \(n=3\) and \(\mathbf U \in L^2(0,t;V({\Omega }))\bigcap L^{8}(0,T;\mathbf L ^4({\Omega }))\bigcap L^{\infty }(0,T;{\fancyscript{H}}({\Omega }))\), then it is the unique solution of (3.4). More results on the regularity of solutions could be found in [16].

We are going to design the spectral method for solving (3.4). For this purpose, we introduce the following finite-dimensional sets,

$$\begin{aligned} \mathcal{Q }^{(j)}_{N}({\Omega })&= span\left\{ ~\psi ^{(j)}_{l}(\mathbf x )~ |~1\le l_{i}\le N , 1\le i\le n\right\} ,\quad 1\le j\le n,\\ \mathcal{Q }_{N}({\Omega })&= \mathcal{Q }_{N}^{(1)}({\Omega })\otimes \mathcal{Q }_{N}^{(2)}({\Omega })\otimes \cdots \otimes \mathcal{Q }_{N}^{(n)}({\Omega }), \quad V_{N}({\Omega })=V({\Omega }) \bigcap \mathcal{Q }_{N}({\Omega }). \end{aligned}$$

Let \(\chi ^{-1}(x)=(\chi _{1}^{-1}(x_1), \chi _{2}^{-1}(x_2), \ldots ,\chi _{n}^{-1}(x_n))\). We define the space

$$\begin{aligned} \mathbf L _{\chi ^{-1}}^{2}({\Omega })=L^{2}_{\chi ^{-1}_{1}}({\Omega })\otimes L^{2}_{\chi ^{-1}_{2}}({\Omega })\otimes \cdots \otimes L^{2}_{\chi ^{-1}_{n}}({\Omega }), \end{aligned}$$

with the following inner product and norm,

$$\begin{aligned} (\mathbf u ,\mathbf v )_\mathbf{L ^{2}_{\chi ^{-1}}({\Omega })}= \displaystyle \sum ^{n}_{j=1}(u^{(j)},v^{(j)})_{L^{2}_{\chi ^{-1}_{j}} ({\Omega })}, \quad ||\mathbf v ||_\mathbf{L ^{2}_{\chi ^{-1}} ({\Omega })}=(\mathbf v ,\mathbf v )_\mathbf{L ^{2}_{\chi ^{-1}}({\Omega })}^{\frac{1}{2}}. \end{aligned}$$

The orthogonal projection \(\tilde{P}_{N,\Omega }: \mathbf L ^{2}_{\chi ^{-1}}({\Omega })\rightarrow V_{N}({\Omega })\) is defined by

$$\begin{aligned} (\tilde{P}_{N,\Omega }\mathbf v -\mathbf v ,\phi )_{ \mathbf L ^2_{\chi ^{-1}}({\Omega })}=0,\quad ~~~~\forall ~\phi \in V_{N}({\Omega }). \end{aligned}$$
(3.5)

The spectral scheme for solving (3.4) is to find \(\mathbf u _{N}(t)\ \in V_{N}({\Omega })\) for all \(0\le t\le T\), such that

$$\begin{aligned} \left\{ \begin{array}{ll} ({\partial }_{t}\mathbf u _{N}(t), \phi )_\mathbf{L ^{2}({\Omega })} \!+\! b(\mathbf u _{N}(t), \mathbf u _{N}(t), \phi )\!+\!\nu a(\mathbf u _{N}(t),\phi )\!=\! (\mathbf f (t), \phi )_\mathbf{L ^{2}({\Omega })}, &{}\quad ~\forall ~ \phi \in {V}_{N}({\Omega }),~0<t\le T,\\ \mathbf u _{N}(\mathbf x ,0)=\mathbf u _{0,N}(\mathbf x )=\tilde{P}_{N,\Omega }\mathbf U _{0}(\mathbf x ),&{}\quad ~ \mathrm{~ on~}~\bar{\Omega }. \end{array}\right. \nonumber \\ \end{aligned}$$
(3.6)

We now check the boundedness of numerical solutions. We set

$$\begin{aligned} E(\mathbf v ,{\sigma },t)=||\mathbf v (t)||^{2}_\mathbf{L ^2({\Omega })} +{\sigma }\displaystyle \int \limits \limits _{0}^{t}| \mathbf v (\xi )|_\mathbf{H ^1({\Omega })}^2d\xi , \quad {\sigma }\ge 0. \end{aligned}$$
(3.7)

Let \(\mathbf H ^{-1}({\Omega })\) be the dual space of \(\mathbf H ^{1}({\Omega })\). Taking \(\phi =2\mathbf u _{N}(t)\) in (3.6), we use (3.3) and the Poincaré inequality to deduce that

$$\begin{aligned} \partial _t\Vert \mathbf u _{N}(t)\Vert ^{2}_\mathbf{L ^{2}({\Omega })}+2\nu | \mathbf u _{N}(t)|^{2}_\mathbf{H ^1({\Omega })}&\le c\Vert \mathbf f (t) \Vert _\mathbf{H ^{-1}({\Omega })}\Vert \mathbf u _{N}(t)\Vert _\mathbf{H ^{1}({\Omega })}\\&\le \nu |\mathbf u _{N}(t)|^{2}_\mathbf{H ^1({\Omega })}+\dfrac{c}{\nu } \Vert \mathbf f (t)\Vert ^{2}_\mathbf{H ^{-1}({\Omega })}. \end{aligned}$$

Integrating the above inequality with respect to \(t\), we reach that

$$\begin{aligned} E(\mathbf u _{N},\nu ,t)\le \Vert \mathbf u _{0,N} \Vert ^{2}_\mathbf{L ^2({\Omega })}+\frac{c}{\nu }\displaystyle \int \limits \limits _{0}^{t}\Vert \mathbf f (\xi )\Vert ^{2}_\mathbf{H ^{-1}({\Omega })}d\xi . \end{aligned}$$
(3.8)

Remark 3.1

We may consider the slip boundary conditions as

$$\begin{aligned} \mathbf U (\mathbf x ,t)\cdot \mathbf{n}=0, \quad {\partial }_\mathbf{n}(\mathbf U (\mathbf x ,t)\cdot \varvec{\tau })=\mathbf g (\mathbf x ,t),~ \quad ~\mathrm{~ on~}~{\partial }{\Omega },~~ 0< t\le T. \end{aligned}$$

More precisely, let \(S_i=\left\{ ~\mathbf x ~|~x_i=\pm 1\right\} \) and \({\partial }_\mathbf{n}U^{(j)}(\mathbf x ,t)=g^{(j)}_i(\mathbf x ,t)\) on \(S_i\), for \( i\ne j,1\le i,j\le n\). Besides,

$$\begin{aligned} Q(\mathbf g (t),\mathbf w )=\displaystyle \sum ^n_{j=1} \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \displaystyle \int \limits \limits _{S_i}g^{(j)}_i(\mathbf x ,t)w^{(j)}(\mathbf x )dS. \end{aligned}$$

Then, the weak formulation of the related problem is to seek \(\mathbf U \in L^{2}(0,T;V({\Omega }))\cap L^{\infty }(0,T;{\fancyscript{H}}({\Omega }))\), such that

$$\begin{aligned} \left\{ \begin{array}{ll} ({\partial }_{t}\mathbf U (t), w)_\mathbf{L ^{2}({\Omega })}+b(\mathbf U (t), \mathbf U (t),\mathbf w ) +\nu a(\mathbf U (t),\mathbf w ) = Q(\mathbf g (t),\mathbf w )+(\mathbf f (t),\mathbf w )_{ \mathbf L ^{2}({\Omega })}, &{}\quad \forall ~ \mathbf w \in V({\Omega }),~0<t\le T,\\ \mathbf U (\mathbf x ,0)=\mathbf U _0(\mathbf x ), &{}\quad \text{ on }~~\bar{\Omega }. \end{array}\right. \qquad \end{aligned}$$
(3.9)

We can deal with the existence, uniqueness and regularity of solutions of the above problem by an argument similar to the proof of Theorems 2.1 and 4.1 of [16]. The corresponding spectral scheme is to find \(\mathbf u _{N}(t)\ \in V_{N}({\Omega })\) for all \(0\le t\le T\), such that

$$\begin{aligned} \left\{ \begin{array}{ll} ({\partial }_{t}\mathbf u _{N}(t), \phi )_\mathbf{L ^{2}({\Omega })} +b(\mathbf u _{N}(t),\mathbf u _{N}(t), \phi )+\nu a(\mathbf u _{N}(t),\phi )= Q(\mathbf g (t),\phi )+(\mathbf f (t), \phi )_\mathbf{L ^{2}({\Omega })}, &{}\quad \forall ~ \phi \in {V}_{N}({\Omega }), ~0<t\le T,\\ \mathbf u _{N}(\mathbf x ,0)=\mathbf u _{0,N}(\mathbf x )= \tilde{P}_{N,\Omega }\mathbf U _{0}(\mathbf x ), &{} \quad ~ \mathrm{~ on~}~\bar{\Omega }. \end{array}\right. \qquad \end{aligned}$$
(3.10)

Moreover,

$$\begin{aligned} E(\mathbf u _{N},\nu ,t)\le \Vert \mathbf u _{0,N} \Vert ^{2}_\mathbf{L ^2({\Omega })}+\frac{c}{\nu }\displaystyle \int \limits \limits _{0}^{t} (\Vert \mathbf f (\xi )\Vert ^{2}_\mathbf{H ^{-1}({\Omega })} + \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} || g^{(j)}_i||_{L^2(S_i)}^2)d\xi . \end{aligned}$$

3.2 Numerical Implementation

In this subsection, we describe the numerical implementation for the spectral scheme (3.6). For simplicity, we focus on the two-dimensional fluid flows.

Let \(\tilde{\psi }_{l_{1},l_{2}}(\mathbf x ) = (\tilde{\psi }^{(1)}_{l_{1},l_{2}}(\mathbf x ), \tilde{\psi }^{(2)}_{l_{1},l_{2}}(\mathbf x ))^{T}\) with the components \(\tilde{\psi }^{(1)}_{l_{1},l_{2}}(\mathbf x )= \psi ^{(1)}_{l_{1},l_{2}}(\mathbf x )\) and \(\tilde{\psi }^{(2)}_{l_{1}, l_{2}}(\mathbf x )=-\psi ^{(2)}_{l_{1},l_{2}}(\mathbf x )\). Due to (2.21) and (2.7), we have \({\nabla }\cdot \tilde{\psi }_{l_{1},l_{2}}(\mathbf x )=0\). Thus, they are divergence-free base functions. According to (2.29) and (2.30), we could expand the components of the numerical solution \(\mathbf u _{N}(\mathbf x ,t)\) of (3.6) with \(n=2\), as follows,

$$\begin{aligned} u^{(j)}_N(\mathbf x ,t)=\displaystyle \sum ^{N}_{l_{1}=1} \sum ^{N}_{l_{2}=1}d_{N,l_{1},l_{2}}(t)\tilde{\psi }^{(j)}_{l_{1}, l_{2}}(\mathbf x ),\quad j=1,2. \end{aligned}$$
(3.11)

Clearly, \({\nabla }\cdot \mathbf u _{N}(\mathbf x ,t)=0\). In other words, the numerical solution \(\mathbf u _{N}(\mathbf x ,t)\) fulfills the incompressibility automatically. Moreover, with the base functions \(\tilde{\psi }^{(j)}_{l_{1},l_{2}}(\mathbf x )\), the expansions of the two components \(u^{(j)}_{N}(\mathbf x ,t)~(j=1,2)\) possess the same coefficients \(d_{N,l_{1},l_{2}}(t)\). This feature saves the work essentially.

By inserting the expansions (3.11) into (3.6) with \(\phi (\mathbf x )=\tilde{\psi }_{k_{1},k_{2}}(\mathbf x )\), we obtain the following nonlinear system of ordinary differential equations,

$$\begin{aligned}&\displaystyle \sum ^{N}_{l_{1}=1}\sum ^{N}_{l_{2}=1}a_{k_1,k_2,l_{1},l_{2}} \partial _{t}d_{N,l_{1},l_{2}}(t)+\nu \displaystyle \sum ^{N}_{l_{1}=1} \sum ^{N}_{l_{2}=1}b_{k_1,k_2,l_{1},l_{2}}d_{N,l_{1},l_{2}}(t)\nonumber \\&\quad =q_{k_1,k_2}(t)+g_{k_1,k_2}(t),\quad 1\le k_1,k_2\le N, \end{aligned}$$
(3.12)

where

$$\begin{aligned} a_{k_1,k_2,l_{1},l_{2}}&= \displaystyle \sum _{j=1,2}\displaystyle \int \int \limits _{{\Omega }}\tilde{\psi }^{(j)}_{k_1,k_2}(x_1,x_2) \tilde{\psi }^{(j)}_{l_{1},l_{2}}(x_1,x_2)dx_1dx_2,\quad 1\le k_1,k_2\le N,\\ b_{k_1,k_2,l_{1},l_{2}}&= \displaystyle \sum _{j=1,2}\displaystyle \sum _{i=1,2}\displaystyle \int \int \limits _{{\Omega }}{\partial }_{x_i} \tilde{\psi }^{(j)}_{k_1,k_2}(x_1,x_2){\partial }_{x_i} \tilde{\psi }^{(j)}_{l_{1},l_{2}}(x_1,x_2)dx_1dx_2,~\quad 1 \le k_1,k_2\le N,\\ q_{k_1,k_2}(t)&= -\displaystyle \sum _{j=1,2}\displaystyle \int \int \limits _{{\Omega }} \big (u^{(1)}_{N}(x_1,x_2,t){\partial }_{x_1}u^{(j)}_{N}(x_1,x_2,t)\\&+u^{(2)}_{N}(x_1,x_2,t){\partial }_{x_2}u^{(j)}_{N} (x_1,x_2,t)\big )\tilde{\psi }^{(j)}_{k_1,k_2}(x_1,x_2)dx_1dx_2, \,\,\quad ~ 1\le k_1,k_2\le N,\\ g_{k_1,k_2}(t)&= \displaystyle \sum ^{2}_{j=1}\displaystyle \int \int \limits _{{\Omega }} f^{(j)}(x_1,x_2,t)\tilde{\psi }^{(j)}_{k_1,k_2}(x_1,x_2)dx_1dx_2, \quad \,\,\quad 1\le k_1,k_2\le N. \end{aligned}$$

Let \(c_\lambda =\displaystyle \frac{2}{2{\lambda }+1}\). Clearly,

$$\begin{aligned} \displaystyle \int \limits _{-1}^1L_{\lambda }(z)L_{\mu }(z)dz=c_\lambda \delta _{\lambda ,\mu }. \end{aligned}$$
(3.13)

On the other hand, by virtue of (2.9) and (2.3) with \({\alpha }={\beta }=0\), a calculation shows

$$\begin{aligned} \displaystyle \int \limits _{-1}^1 G_{\lambda +1}(z)G_{\mu +1}(z)dz= \left\{ \begin{array}{ll} \displaystyle 2c_{\lambda }c_{{\mu }}\left( \frac{1}{2\lambda -1}+ \frac{1}{2\lambda +3}\right) ,&{}\lambda =\mu ,\\ \displaystyle -2c_{\lambda }c_{\mu }\frac{1}{2\lambda -1},&{} \lambda =\mu +2,\\ 0,&{} \mathrm{otherwise}. \end{array}\right. \end{aligned}$$
(3.14)

Therefore,

$$\begin{aligned} a_{k_1,k_2,l_{1},l_{2}}\!=\! \left\{ \!\begin{array}{ll} \displaystyle 2c_{k_{1}}c_{l_{1}}c_{k_{2}}\left( \frac{1}{2k_1-1}+ \frac{1}{2k_1+3}\right) \!+\!2c_{k_{2}}c_{l_{2}}c_{k_{1}}\left( \frac{1}{2k_2-1}+ \frac{1}{2k_2+3}\right) , &{}\quad k_1=l_1,k_2=l_2,\\ \displaystyle -2c_{k_{1}}c_{l_{1}}c_{k_{2}}\frac{1}{2k_1-1}, &{} \quad ~~ k_1=l_1+2,k_2=l_2,\\ \displaystyle -2c_{k_{2}}c_{l_{2}}c_{k_{1}}\frac{1}{2k_2-1}, &{} \quad ~~ k_1=l_1,k_2=l_2+2,\\ 0, &{}\quad \mathrm{otherwise}. \end{array}\right. \end{aligned}$$

Furthermore, we have

$$\begin{aligned} \partial _zL_\lambda (z)=\displaystyle \sum _{\sigma =0}^{\left[ \frac{\lambda -1}{2}\right] }(2\lambda -4\sigma -1)L_{\lambda -2\sigma -1}(z). \end{aligned}$$

Let \(\beta _{\lambda ,\mu }= \min (\lambda ,\mu )(\min (\lambda ,\mu )+1)\). With the aid of the above equality and (3.13), a careful calculation leads to

$$\begin{aligned} \displaystyle \int \limits _{-1}^1\partial _zL_{\lambda }(z)\partial _zL_{\mu } (z)dz=\left\{ \begin{array}{ll} \beta _{\lambda ,\mu },&{} \mathrm{if~both~ of~}\lambda \mathrm{~and~}{\mu }\mathrm{~are~even~(or~ odd),}\\ 0,&{} \mathrm{otherwise}. \end{array}\right. \end{aligned}$$
(3.15)

Besides, we use (2.7) and (2.3) with \({\alpha }={\beta }=0\) to obtain

$$\begin{aligned} \displaystyle \int \limits _{-1}^1\partial _zG_{\lambda +1}(z)\partial _zG_{\mu +1} (z)dz=4c_\lambda \delta _{\lambda ,\mu }. \end{aligned}$$
(3.16)

Thereby, we use (3.13)–(3.16) to deduce that

$$\begin{aligned} b_{k_1,k_2,l_{1},l_{2}}=\displaystyle \sum ^3_{\sigma =1}b_{k_1,k_2, l_{1},l_{2}}^{(\sigma )} \end{aligned}$$

where

$$\begin{aligned} b_{k_1,k_2,l_{1},l_{2}}^{(1)}&= \left\{ \begin{array}{ll} \displaystyle 8c_{k_{1}}c_{k_{2}},&{} k_1=l_1,k_2=l_2,\\ 0,&{}\mathrm{otherwise}. \end{array}\right. \\ b_{k_1,k_2,l_{1},l_{2}}^{(2)}&= \left\{ \begin{array}{ll} \displaystyle 2c_{k_1}c_{l_1}\left( \frac{1}{2k_1-1}+\frac{1}{2k_1+3}\right) \beta _{k_2,l_2},&{} k_1=l_1, \mathrm{and~both~ of~}l_2\mathrm{~and~} k_2\mathrm{~are~even~(or~odd),}\\ \displaystyle -2c_{k_1}c_{l_1}\frac{1}{2k_1-1}\beta _{k_2,l_2}, &{} k_1=l_1+2, \mathrm{and~both~ of~}l_2\mathrm{~and~} k_2\mathrm{~are~even~(or~ odd),}\\ 0,&{}\mathrm{otherwise}. \end{array}\right. \\ b_{k_1,k_2,l_{1},l_{2}}^{(3)}&= \left\{ \begin{array}{ll} \displaystyle 2c_{k_2}c_{l_2}\left( \frac{1}{2k_2-1}+\frac{1}{2k_2+3}\right) \beta _{k_1,l_1},&{} k_2=l_2, \mathrm{and~both~ of~}l_1\mathrm{~and~} k_1\mathrm{~are~even~(or~ odd),}\\ \displaystyle -2c_{k_2}c_{l_2}\frac{1}{2k_2-1}\beta _{k_1,l_1},&{} k_2=l_2+2,\mathrm{and~both~ of~}l_1\mathrm{~and~} k_1\mathrm{~are~even~(or~ odd),}\\ 0,&{}\mathrm{otherwise}. \end{array}\right. \end{aligned}$$

We could rewrite the system (3.12) as a compact matrix form.

Remark 3.2

For the \(n\)-dimensional flows, we may take the base functions

$$\begin{aligned} \tilde{\psi }_{l}(\mathbf x )=(\tilde{\psi }^{(1)}_{l}(\mathbf x ), \tilde{\psi }^{(2)}_{l}(\mathbf x ),\ldots ,\tilde{\psi }^{(n)}_{l} (\mathbf x ))^{T}, \end{aligned}$$

with the components \(\tilde{\psi }^{(j)}_{l}(\mathbf x )= \psi ^{(j)}_{l}(\mathbf x )\) for \(1\le j\le n-1\), and \(\tilde{\psi }^{(n)}_{l}(\mathbf x )=-(n-1)\psi ^{(n)}_{l}(\mathbf x )\). Then \({\nabla }\cdot \tilde{\psi }_{l}(\mathbf x )=0\). Accordingly, we expand the components of the numerical solution as

$$\begin{aligned} u^{(j)}_N(\mathbf x ,t)&= \displaystyle \sum _{1\le i\le n}\sum _{1\le l_i\le N}d_{N,l}^{(j)}(t)\tilde{\psi }^{(j)}_{l}(\mathbf x ),\quad 1\le j\le n-1,\\ u^{(n)}_N(\mathbf x ,t)&= \displaystyle \frac{1}{n-1}\displaystyle \sum _{1\le i\le n}\displaystyle \sum _{1\le l_i\le N}\displaystyle \sum _{1\le j\le n-1}d_{N,l}^{(j)}(t)\tilde{\psi }^{(n)}_{l}(\mathbf x ). \end{aligned}$$

Therefore, we only need to evaluate \(n-1\) groups of unknown coefficients \(d_{N,l}^{(j)}(t),~1\le j\le n-1.\) This is one of advantages of our new method.

3.3 Numerical Results

We now use the spectral scheme (3.6) [or equivalently (3.12)] to solve problem (3.1) with \(n=2\) numerically. In actual computation, we use the explicit fourth order Runge–Kutta approximation in time, with the step size \(\tau \). The corresponding numerical solution is denoted by \(\mathbf u _{N,\tau }(\mathbf x , t)=({u}_{N,\tau }^{(1)}(\mathbf x ,t),{u}_{N,\tau }^{(2)}(\mathbf x , t))^T.\) For description of numerical errors, we denote the nodes and the weights of the Legendre–Gauss quadrature by \(\xi _{i}\) and \(\omega _{i}\), respectively. The numerical errors are measured by the quantity

$$\begin{aligned} E_{N,\tau }(t)&= \Big (\displaystyle \sum _{i=0}^{N}\displaystyle \sum _{j=0}^{N}\big ((U^{(1)}(\xi _{i},\xi _{j},t)- u^{(1)}_{N,\tau }(\xi _{i},\xi _{j},t))^{2}\\&+(U^{(2)}(\xi _{i},\xi _{j},t)- u^{(2)}_{N,\tau }(\xi _{i},\xi _{j},t))^{2}\big )\omega _{i}\omega _{j}\Big )^{\frac{1}{2}} \approx \Vert \mathbf U (t)- \mathbf u _{N,\tau }(t)\Vert _\mathbf{L ^2({\Omega })}. \end{aligned}$$

We first take the test function \(\mathbf U (x_1,x_2,t)\) with the components:

$$\begin{aligned} \begin{array}{ll} U^{(1)}(x_1,x_2,t)\!=\!\displaystyle \left( \frac{1}{12}x_1^4-\frac{1}{2} x_1^2+\frac{5}{12}\right) \left( \frac{1}{3}x_2^3-x_2\right) +\sqrt{t+1} \sin \pi x_1 \cos \pi x_2,\\ U^{(2)}(x_1,x_2,t)\!=\!\displaystyle -\left( \frac{1}{3}x_1^3-x_1\right) \left( \frac{1}{12}x_2^4-\frac{1}{2}x_2^2+\frac{5}{12}\right) -\sqrt{t+1} \cos \pi x_1 \sin \pi x_2. \end{array}\qquad \end{aligned}$$
(3.17)

In Table 1, we list the numerical errors \(E_{N,\tau }(1)\) of scheme (3.6) with different mode \(N\) and time step \(\tau \). Obviously, the numerical errors decay fast when \(N\) increases and \(\tau \) decreases. It coincides very well with the analysis presented in Sect. 5, see the error estimate (5.12) of this paper. We also observe that the spectral scheme (3.6) works well even for the flows with small kinetic viscosity \(\nu \).

Table 1 Numerical errors \(E_{N\tau }(1)\) of scheme (3.6) with test function (3.17)

We next take the test function \(\mathbf U (x_1,x_2,t)\) with the components:

$$\begin{aligned} \begin{array}{ll} \displaystyle U^{(1)}(x_1,x_2,t)\!=\!-(1-x_1^2)(-\frac{1}{2}x_2^3+\frac{5}{2}x_2)\displaystyle e^{-\frac{x_1^2+x_2^2}{4}}-6x_2(1-x_1^2)^3(1-x_2^2)^2\sin kt,\\ \displaystyle U^{(2)}(x_1,x_2,t)\!=\!(-\frac{1}{2}x_1^3+\frac{5}{2}x_1)(1-x_2^2)\displaystyle e^{-\frac{x_1^2+x_2^2}{4}}+6x_1(1-x_2^2)^3(1-x_1^2)^2\sin kt. \end{array}\qquad \end{aligned}$$
(3.18)

In actual computation, we take \(k=2\). In Table 2, we list the numerical errors \(E_{N,\tau }(1)\) of scheme (3.6) with different mode \(N\) and time step \(\tau \). They indicate again the rapid convergence of scheme (3.6) as \(N\) increases and \(\tau \) decreases. This also confirms well the error estimate of numerical solutions, see (5.12) of this paper.

Finally, we check the stability of long-time calculation of scheme (3.6). For instance, we consider problem (3.1) with the test function (3.18). In Fig. 1, we plot the values of \(\log _{10}E_{N,\tau }(t)\) for \(0\le t\le 30\), with \(\nu =10^{-2},N=16\) and \(\tau =0.001\). They show the stability of long-time calculation.

Table 2 Numerical errors \(E_{N\tau }(1)\) of scheme (3.6) with test function(3.18)
Fig. 1
figure 1

Error evaluation of scheme (3.6) with test function (3.18)

Remark 3.3

For the two-dimensional Navier–Stokes equations with slip boundary conditions, we might design the spectral method based on the vorticity-stream function form, see [25]. But in that case, we have to solve a system consisting of the vorticity equation and the Poisson equation for the stream function. Conversely, if we use the proposed scheme (3.6), we only need to solve the primitive equation directly. Moreover, due to the incompressibility of the base functions (cf. (2.30)), we are required only to evaluate one group of unknown coefficients, which are the common coefficients of expansions for the components \(u^{(j)}_{N,\tau } (\mathbf x , t),~j=1,2\), see (3.11). This simplifies computation and saves computational time.

Remark 3.4

For three dimensional fluid flows, we set \(\tilde{\psi }^{(1)}_{l_{1}, l_{2}, l_{3}}(\mathbf x )= \psi ^{(1)}_{l_{1}, l_{2}, l_{3}}(\mathbf x ), \tilde{\psi }^{(2)}_{l_{1}, l_{2}, l_{3}}(\mathbf x )= \psi ^{(2)}_{l_{1}, l_{2}, l_{3}}(\mathbf x )\) and \(\tilde{\psi }^{(3)}_{l_{1},l_{2},l_{3}}(\mathbf x )= -\psi ^{(3)}_{l_{1},l_{2},l_{3}}(\mathbf x )\). We expand the components of the numerical solution \(\mathbf u _{N}(\mathbf x ,t)\) as follows,

$$\begin{aligned} \begin{array}{ll} u^{(j)}_N(\mathbf x ,t)=\displaystyle \sum ^{N}_{l_{1}=1} \sum ^{N}_{l_{2}=1}\sum ^{N}_{l_{3}=1}d_{N,l_{1},l_{2}, l_{3}}^{(j)}(t)\tilde{\psi }^{(j)}_{l_{1},l_{2},l_{3}} (\mathbf x ),\quad j=1,2,\\ u^{(3)}_N(\mathbf x ,t)=\displaystyle \sum ^{N}_{l_{1}=1} \sum ^{N}_{l_{2}=1}\sum ^{N}_{l_{3}=1}(d_{N,l_{1},l_{2}, l_{3}}^{(1)}(t)+d_{N,l_{1},l_{2},l_{3}}^{(2)}(t)) \tilde{\psi }^{(3)}_{l_{1},l_{2},l_{3}}(\mathbf x ). \end{array} \end{aligned}$$

According to (2.29) and (2.30) with \(n=3\), we have \({\nabla }\cdot \mathbf u _{N}(\mathbf x ,t)=0\). Therefore, the incompressibility and the boundary conditions are fulfilled automatically. Moreover, we only have to evaluate the two groups of the coefficients \(d_{N,l_{1},l_{2},l_{3}}^{(1)}(t)\) and \(d_{N,l_{1},l_{2},l_{3}}^{(2)}(t)\), and so save the work.

4 Some Approximation Results

In this section, we establish some results on several orthogonal approximations, which serve as the mathematical foundation of the spectral method using the divergence-free base functions. To do this, we need some preparations.

We set \(I_{i}=\left\{ ~x_i~|~-1<x_i<1~\right\} \). For any scalar function \(v(\mathbf x )\), the projections \(P_{N,I_i}v(\mathbf x )\) and \(\tilde{P}_{N,I_i}v(\mathbf x )\) are defined by (2.13) and (2.14), respectively. Also, let

$$\begin{aligned} P_{N,{\Omega }/ I_j}v(\mathbf x )=P_{N,I_1}\circ P_{N,I_2}\circ \cdots \circ P_{N,I_{j-1}}\circ P_{N,I_{j+1}} \circ \cdots P_{N,I_n}v(\mathbf x ). \end{aligned}$$

For any vector function \(\mathbf v (\mathbf x )\) with the components \(v^{(j)}(\mathbf x ),~1\le j\le n\), we introduce the related vector function \(_{*}\mathbf v _{N}(\mathbf x )\), with the components as

$$\begin{aligned} \begin{array}{ll} {}_{*} v^{(j)}_{N}(\mathbf x )&{}={\tilde{P}}_{N,I_{j}}P_{N,{\Omega }/I_{j}}v^{(j)} (\mathbf x )\\ &{}=P_{N,I_{1}}\circ P_{N,I_{2}}\circ \cdots \circ P_{N,I_{j-1}}\circ \tilde{P}_{N,I_{j}}\circ P_{N,I_{j+1}} \circ \cdots \circ P_{N,I_{n}}v^{(j)}(\mathbf x ), \quad 1\le j\le n. \end{array}\quad \end{aligned}$$
(4.1)

Proposition 4.1

For the orthogonal projection \({\tilde{P}}_{N,\Omega }v(\mathbf x )\) defined by (3.5), we have

$$\begin{aligned} {\tilde{P}}_{N,\Omega }\mathbf v (\mathbf x )={}_*\mathbf v _{N}(\mathbf x ), \quad \forall ~ v\in V({\Omega }). \end{aligned}$$
(4.2)

Proof

Clearly, \(_{*}\mathbf v _{N}\in \mathcal{Q }_{N}({\Omega })\) and so \(_{*}\mathbf v _{N}(\mathbf x )\cdot \mathbf{n}=0\) on \({\partial }{\Omega }\). Next, with the aid of (2.13), (2.14) and (2.29), we have

$$\begin{aligned} _{*}v^{(j)}_{N}(\mathbf x )=\displaystyle \sum _{i=1}^{n} \displaystyle \sum _{l_{i}=1}^{N}\hat{v}^{(j)}_{l_{1},l_{2}, \ldots ,l_{n}}\psi ^{(j)}_{l_{1},l_{2},\ldots , l_{n}}(\mathbf x ),\quad 1\le j\le n. \end{aligned}$$
(4.3)

Thanks to (2.7) and (2.30), we deduce that

$$\begin{aligned} {\nabla }\cdot {} _{*}\mathbf v _{N}(\mathbf x )=-2 \displaystyle \sum ^{n}_{i=1}\displaystyle \sum ^{N}_{l_{i}=1} \displaystyle \sum ^{n}_{j=1}\hat{v}^{(j)}_{l_{1},l_{2},\ldots ,l_{n}} \displaystyle \prod _{1\le \nu \le n}L_{l_{\nu }}(x_\nu )=0. \end{aligned}$$

The previous statements implies \(_{*}\mathbf v _{N}\in V_{N}({\Omega })\).

Furthermore, we use (2.29) and (4.3) to obtain

$$\begin{aligned} v^{(j)}(\mathbf x )-_*v^{(j)}_{N}(\mathbf x )=\displaystyle \sum _{i=1}^{n}(\displaystyle \sum _{p=1}^{i-1}\displaystyle \sum _{l_{p}=1}^{N}(\displaystyle \sum _{l_{i}=N+1}^{\infty } (\displaystyle \sum _{q=i+1}^{n}\displaystyle \sum _{l_{q}=1}^{\infty } \hat{v}_{l_{1},l_{2},\ldots ,l_{n}}^{(j)}\psi _{l_{1},l_{2}, \ldots ,l_{n}}^{(j)}(\mathbf x )))),\quad 1\le j\le n. \nonumber \\ \end{aligned}$$
(4.4)

Let \(\phi (\mathbf x )=(\phi ^{(1)}(\mathbf x ), \phi ^{(2)}(\mathbf x ),\ldots ,\phi ^{(n)}(\mathbf x ))^T\in V_{N}({\Omega })\). By virtue of (4.4), (2.3) with \({\alpha }={\beta }=0\) and (2.11) with \(k=0\), it can be checked that

$$\begin{aligned} (v^{(j)}-_*v^{(j)}_{N},\phi ^{(j)})_{{L}_{\chi ^{-1}_{j}}^{2}({\Omega })}=0, \quad \forall ~\phi \in V_{N}({\Omega }),~ 1\le j\le n. \end{aligned}$$

This fact leads to

$$\begin{aligned} (\mathbf v -{}_*\mathbf v _{N}(x),\phi )_\mathbf{L _{\chi ^{-1}}^{2} ({\Omega })}=0,\quad \forall ~\phi \in V_{N}({\Omega }). \end{aligned}$$

Consequently, \({\tilde{P}}_{N,\Omega }\mathbf v (\mathbf x ) ={}_*\mathbf v _{N}(\mathbf x )\) for any \( \mathbf v \in V({\Omega })\). \(\square \)

In the forthcoming discussions, we need another orthogonal projection. For this purpose, we let \({\Omega }_{m}=\left\{ ~(x_{1},x_{2}, \ldots ,x_{m})^T~|~|x_{i}|<1~\mathrm{for ~}1\le i\le m~\right\} \) and define the scalar function space \(L^{2}({\Omega }_{m})\) and the weighted space \(L^{2}_{\chi }({\Omega }_{m})\) as usual. Meanwhile, \(\mathcal{P }_{N}({\Omega }_{m})=\mathcal{P }_{N}(I_1)\otimes \mathcal{P }_{N}(I_2)\otimes \cdots \otimes \mathcal{P }_{N}(I_m)\). The orthogonal projection \(P_{N,{\Omega }_{m}}:L^{2}({\Omega }_{m})\rightarrow \mathcal{P }_{N}({\Omega }_{m})\) is defined by

$$\begin{aligned} (v-P_{N,{\Omega }_{m}}v,\phi )_{L^{2}({\Omega }_{m})}=0,\quad \forall ~\phi \in \mathcal{P }_{N}({\Omega }_{m}). \end{aligned}$$

In particular, \(L^{2}({\Omega })=L^{2}({\Omega }_{n}), \mathcal{P }({\Omega })=\mathcal{P }({\Omega }_{n})\) and \(P_{N,{\Omega }}v(\mathbf x )=P_{N,{\Omega }_{n}}v(\mathbf x )\).

Throughout this paper, we denote by \(c\) a generic positive constant independent of any function and \(N\).

Proposition 4.2

If the scalar function \(v\in L^{2}({\Omega }_{m})\), integers \(r\ge 0\) and \(r\le N+1\), then

$$\begin{aligned} \Vert v-P_{N,{\Omega }_{m}}v\Vert _{L^{2}({\Omega }_{m})}\le cN^{-r}\displaystyle \sum _{i=1}^{m} \Vert {\partial }^{r}_{x_{i}}v\Vert _{L^{2}_{\chi ^{r}_{i}}({\Omega }_{m})}, \end{aligned}$$
(4.5)

provided that the norms involved at the right side of the above inequality is finite.

Proof

We prove the desired result by induction. Clearly, (2.16) implies the result (4.5) with \(m=1\). We now assume that the inequality (4.5) is valid in \(m-1\) dimensions. Since, \(P_{N,{\Omega }_{m}}v(\mathbf x )=(P_{N,{\Omega }_{m-1}}\circ P_{N,I_{m}})v(\mathbf x ),\) we have

$$\begin{aligned} \Vert P_{N,{\Omega }_{m}}v-v\Vert _{L^{2}({\Omega }_{m})}\le J_{1}+J_{2} \end{aligned}$$
(4.6)

where

$$\begin{aligned} J_{1}=\Vert P_{N,{\Omega }_{m-1}}\circ P_{N,I_{m}}v-P_{N,I_{m}}v\Vert _{L^{2}({\Omega }_{m})},\quad J_{2}=\Vert P_{N,I_{m}}v-v\Vert _{L^{2}({\Omega }_{m})}. \end{aligned}$$

By virtue of the assumption of induction and (2.16), we verify that

$$\begin{aligned} J_{1}\le cN^{-r}\displaystyle \sum _{i=1}^{m-1}\Vert {\partial }^{r}_{x_{i}}P_{N,I_{m}}v\Vert _{L^{2}_{\chi ^{r}_{i}}({\Omega }_{m})} \le cN^{-r}\displaystyle \sum _{i=1}^{m-1}\Vert {\partial }^{r}_{x_{i}} v\Vert _{L^{2}_{\chi ^{r}_{i}}({\Omega }_{m})}. \end{aligned}$$

Evidently,

$$\begin{aligned} J_{2}\le cN^{-r}\Vert {\partial }^{r}_{x_{m}}v\Vert _{L^{2}_{\chi ^{r}_{m}}({\Omega }_{m})}. \end{aligned}$$

Substituting the above inequalities into (4.6), we complete the induction. \(\square \)

We are now in position to estimate \(\Vert {\tilde{P}}_{N,\Omega }\mathbf v - \mathbf v \Vert _\mathbf{L ^{2}_{\chi ^{-1}}({\Omega })}\). We introduce the quantity

$$\begin{aligned} A_{r}(\mathbf v )=\displaystyle \sum _{j=1}^{n}(\displaystyle \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \Vert {\partial }^{r}_{x_{i}}v^{(j)}\Vert _{L^{2}_{\chi ^{r}_{i}}({\Omega }/I_{j}; L^{2}_{\chi ^{-1}_{j}}(I_{j}))}+\Vert {\partial }^{r}_{x_{j}}v^{(j)}\Vert _{L^{2} ({\Omega }/I_{j};L^{2}_{\chi _{j}^{r-1}}(I_{j}))}). \end{aligned}$$

Lemma 4.1

If \(\mathbf v \in V({\Omega })\) and \(A_{r}(\mathbf v )\) is finite for integers \(N\ge 2\) and \(1\le r\le N+1\), then

$$\begin{aligned} \Vert {\tilde{P}}_{N,\Omega }\mathbf v -\mathbf v \Vert _\mathbf{L ^{2}_{\chi ^{-1}} ({\Omega })}\le c N^{-r}A_{r}(\mathbf v ). \end{aligned}$$
(4.7)

Proof

We denote the \(j\)’th component of \(({\tilde{P}}_{N,\Omega }\mathbf v ) (\mathbf x )\) by \(({\tilde{P}}_{N,\Omega }v)^{(j)}(\mathbf x )\). Due to (4.1) and (4.2), we have \(({\tilde{P}}_{N,\Omega }v)^{(j)} (\mathbf x )={\tilde{P}}_{N,I_{j}}P_{N,{\Omega }/I_{j}}v^{(j)}(\mathbf x )\). Hence,

$$\begin{aligned} \Vert ({\tilde{P}}_{N,\Omega }v)^{(j)}-v^{(j)}\Vert _{L^{2}_{\chi _{j}^{-1}}({\Omega })}\le J_{1}^{(j)}+J_{2}^{(j)} \end{aligned}$$
(4.8)

where

$$\begin{aligned} J_{1}^{(j)}=\Vert {\tilde{P}}_{N,I_{j}}P_{N,{\Omega }/I_{j}}v^{(j)}-P_{N,{\Omega }/I_{j}} v^{(j)}\Vert _{L^{2}_{\chi _{j}^{-1}}({\Omega })},\quad J_{2}^{(j)}= \Vert P_{N,{\Omega }/I_{j}}v^{(j)}-v^{(j)}\Vert _{L^{2}_{\chi _{j}^{-1}}({\Omega })}. \end{aligned}$$

By virtue of (2.17) with \(\mu =0\) and (4.5), we deduce that

$$\begin{aligned} J_{1}^{(j)}\le cN^{-r}||{\partial }^{r}_{x_{j}}P_{N,{\Omega }/I_{j}}v^{(j)} ||_{L^{2}({\Omega }/I_{j};L^{2}_{\chi ^{r-1}_{j}}(I_{j}))}\le cN^{-r}||{\partial }^{r}_{x_{j}}v^{(j)} ||_{L^{2}({\Omega }/I_{j};L^{2}_{\chi ^{r-1}_{j}}(I_{j}))}. \end{aligned}$$

Using (4.5) again yields

$$\begin{aligned} J_{2}^{(j)}\le cN^{-r}\displaystyle \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \Vert {\partial }^{r}_{x_{i}}v^{(j)}\Vert _{L^{2}_{\chi ^{r}_{i}} ({\Omega }/I_{j};L^{2}_{\chi ^{-1}_{j}}(I_{j}))}. \end{aligned}$$

By substituting the above two inequalities into (4.8), we assert that for \(1\le j\le n,\)

$$\begin{aligned}&\Vert ({\tilde{P}}_{N,\Omega }v)^{(j)}-v^{(j)}\Vert _{L^{2}_{\chi _{j}^{-1}}({\Omega })}\le cN^{-r}\nonumber \\&\quad \left( \displaystyle \mathop {\sum }\limits _{\mathop {1\le i\le n}\limits {i\ne j}} \Vert {\partial }^{r}_{x_{i}}v^{(j)}\Vert _{L^{2}_{\chi ^{r}_{i}}({\Omega }/I_{j}; L^{2}_{\chi ^{-1}_{j}}(I_{j}))} +\Vert {\partial }^{r}_{x_{j}}v^{(j)}\Vert _{L^{2} ({\Omega }/I_{j};L^{2}_{\chi ^{r-1}_{j}}(I_{j}))}\right) . \end{aligned}$$
(4.9)

Then, by summing (4.9) for \(1\le j\le n,\) the desired result (4.7) follows immediately. \(\square \)

We now turn to the orthogonal projection \({\tilde{P}}^{1}_{N,\Omega }:V({\Omega })\rightarrow V_{N}({\Omega })\), defined by

$$\begin{aligned} a(\mathbf v -{\tilde{P}}^{1}_{N,\Omega }\mathbf v ,\phi )=0,\quad \forall ~\phi \in V_{N}({\Omega }). \end{aligned}$$
(4.10)

This projection plays an important role for estimating the errors of numerical solutions of the spectral method (3.6). In order to describe the approximation error, we introduce the quantity

$$\begin{aligned} B_{r}(\mathbf v )&= \displaystyle \sum _{j=1}^{n}\Big ( \mathop {\displaystyle \sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \Vert {\partial }^{r-1}_{x_{i}}{\partial }_{x_{j}}v^{(j)}\Vert _{L^{2}_{\chi ^{r-1}_{i}}({\Omega })} +\mathop {\displaystyle \sum }\limits _{\mathop {1\le k\le n}\limits _{k\ne i,j}} \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{k}}v^{(j)}\Vert _{L^{2}_{\chi ^{r-1}_{k}}({\Omega }/ I_{j};L^{2}_{\chi ^{-1}_{j}}(I_{j}))}\\&+\Vert {\partial }^{r}_{x_{j}}v^{(j)}\Vert _{L^{2}({\Omega }/I_{j};L^{2}_{ \chi ^{r-1}_{j}}(I_{j}))}+\Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{j}}v^{(j)} \Vert _{L^{2}({\Omega }/I_{j};L^{2}_{\chi ^{r-2}_{j}}(I_{j}))}\\&+\Vert {\partial }_{x_{i}}^rv^{(j)}\Vert _{L^{2}({\Omega }/I_{i};L^{2}_{\chi ^{r-1}_{i}} (I_{i}))}\Big ). \end{aligned}$$

Lemma 4.2

If \(\mathbf v \in V({\Omega })\) and \(B_{r}(\mathbf v )\) is finite for integers \(N\ge 2\) and \(1\le r\le N+1\), then

$$\begin{aligned} \Vert {\tilde{P}}^{1}_{N,\Omega }\mathbf v -\mathbf v \Vert _\mathbf{H ^{1}({\Omega })}\le cN^{\frac{3}{2}-r}B_{r}(\mathbf v ). \end{aligned}$$
(4.11)

Proof

Let \({}_{*}\mathbf v _{N}(\mathbf x )\) be the same as in (4.2), with the components \({}_{*}v^{(j)}_{N}(\mathbf x )={\tilde{P}}_{N,I_j}P_{N,{\Omega }/ I_j}v^{(j)}(\mathbf x )\) as in (4.1). By projection theorem,

$$\begin{aligned} |{\tilde{P}}^{1}_{N,\Omega }\mathbf v -\mathbf v |_\mathbf{H ^{1}({\Omega })}= \displaystyle \inf _{\phi \in V_{N}({\Omega })}|\phi -\mathbf v |_{ \mathbf H ^{1}({\Omega })} \le |{}_{*}\mathbf v _{N}-\mathbf v |_\mathbf{H ^{1}({\Omega })}. \end{aligned}$$
(4.12)

We first estimate \(\Vert {\partial }_{x_{j}}({}_{*}v^{(j)}_{N} -v^{(j)})\Vert _{{L}^{2}({\Omega })}\). By using (2.17) with \(\mu =1\) and (4.5) twice, we derive that

$$\begin{aligned} \begin{array}{ll} &{}\Vert {\partial }_{x_{j}}({}_{*}v^{(j)}_{N}-v^{(j)})\Vert _{{L}^{2}({\Omega })}\\ &{}\quad \le \Vert {\partial }_{x_{j}}({\tilde{P}}_{N,I_j}P_{N,{\Omega }/ I_j}v^{(j)}-P_{N,{\Omega }/ I_j}v^{(j)})\Vert _{{L}^{2}({\Omega })} +\Vert {\partial }_{x_{j}}(P_{N,{\Omega }/ I_j}v^{(j)}-v^{(j)})\Vert _{{L}^{2}({\Omega })}\\ &{}\quad \le cN^{1-r}\big (\Vert P_{N,{\Omega }/ I_j}{\partial }^{r}_{x_{j}}v^{(j)}\Vert _{L^{2}({\Omega }/I_{j};L^{2}_{\chi ^{r-1}_{j}} (I_{j}))} +\mathop {\displaystyle \sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}} \Vert {\partial }^{r-1}_{x_{i}}{\partial }_{x_{j}}v^{(j)}\Vert _{L^{2}_{\chi ^{r-1}_{i}} ({\Omega })}\big )\\ &{}\quad \le cN^{1-r}\big (\Vert {\partial }^{r}_{x_{j}}v^{(j)}\Vert _{L^{2} ({\Omega }/I_{j};L^{2}_{\chi ^{r-1}_{j}}(I_{j}))} +\mathop {\displaystyle \sum }\limits _{\mathop {1\le i\le n}\limits _{i\ne j}}\Vert {\partial }^{r-1}_{x_{i}}{\partial }_{x_{j}}v^{(j)} \Vert _{L^{2}_{\chi ^{r-1}_{i}}({\Omega })}\big ). \end{array} \end{aligned}$$
(4.13)

We next deal with the upper-bound of \(\Vert {\partial }_{x_{i}}(P_{N,I_{i}}v^{(j)}-v^{(j)})\Vert _{L^{2}(I_{i})}\) for \(i\ne j\). We can follow the same line as the proof of Theorem 2.4 of [15], coupled with the inequality (2.16), to show that if scalar function \(v\in L^{2}(I_{i}),~{\partial }^{s}_{x_{i}}v\in L^{2}_{\chi _{i}^{s-1}}(I_{i})\) and integer \(s\ge 1\), then

$$\begin{aligned} \Vert {\partial }_{x_{i}}(P_{N,I_{i}}v-v)\Vert _{L^{2}(I_{i})}&\le cN^{\frac{3}{2} -s}\Vert {\partial }^{s}_{x_{i}}v\Vert _{L^{2}_{\chi _{i}^{s-1}}(I_{i})}. \end{aligned}$$
(4.14)

This also implies that for \(s\ge 1\),

$$\begin{aligned} \Vert {\partial }_{x_{i}}(P_{N,I_{i}}v)\Vert _{L^{2}(I_{i})}\le \Vert {\partial }_{x_{i}}v\Vert _{L^{2}(I_{i})} +cN^{\frac{3}{2}-s} \Vert {\partial }^{s}_{x_{i}}v\Vert _{L^{2}_{\chi _{i}^{s-1}}(I_{i})}. \end{aligned}$$
(4.15)

Now, let

$$\begin{aligned} {\tilde{P}}_{N,{\Omega }/ I_i}v^{(j)}(x)&= P_{N,I_1}\circ P_{N,I_2}\circ \cdots \circ P_{N,I_{i-1}} \circ P_{N,I_{i+1}}\circ \cdots \circ P_{N,I_{j-1}} \circ {\tilde{P}}_{N,I_{j}}\\&\circ P_{N,I_{j+1}}\circ \cdots \circ P_{N,I_n}v^{(j)}(x),~ \text{ for } j\ge i. \end{aligned}$$

The meaning of \({\tilde{P}}_{N,{\Omega }/I_{i}}v^{(j)}(x) \text{ for } j<i\) is similar. Obviously,

$$\begin{aligned} \Vert {\partial }_{x_{i}}({}_{*}v^{(j)}_{N}-v^{(j)})\Vert _{{L}^{2}({\Omega })}\le J_1^{(j)}+J_2^{(j)} \end{aligned}$$
(4.16)

where

$$\begin{aligned} J_1^{(j)}=\Vert {\partial }_{x_{i}}({\tilde{P}}_{N,{\Omega }/I_{i}}P_{N,I_{i}}v^{(j)} -P_{N,I_{i}}v^{(j)})\Vert _{L^{2}({\Omega })}, \quad J_2^{(j)}=\Vert {\partial }_{x_{i}}(P_{N,I_{i}}v^{(j)}-v^{(j)})\Vert _{L^{2}({\Omega })}. \end{aligned}$$

By using an inequality similar to (4.9), we deduce that for \(r\ge 1\) and \(i\ne j\),

$$\begin{aligned} J_1^{(j)}\le cN^{1-r} \big (\mathop {\displaystyle \sum }\limits _{\mathop {1\le k\le n}\limits _{k\ne i,j}} \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{k}}P_{N,I_{i}}v^{(j)} \Vert _{L^{2}_{\chi ^{r-1}_{k}} ({\Omega }/ I_{j};L^{2}_{\chi ^{-1}_{j}} (I_{j}))}+\Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{j}}P_{N,I_{i}}v^{(j)} \Vert _{L^{2}({\Omega }/I_{j};L^{2}_{\chi ^{r-2}_{j}}(I_{j}))}\big ). \end{aligned}$$

Moreover, the inequality (4.15) with \(v(\mathbf x )={\partial }^{r-1}_{x_{k}}v^{(j)}(\mathbf x )\) and \(s=1\) implies

$$\begin{aligned} \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{k}}P_{N,I_{i}}v^{(j)}\Vert _{ L^{2}_{\chi ^{r-1}_{k}}({\Omega }/I_{j};L^{2}_{\chi ^{-1}_{j}} (I_{j})))}\le (1+cN^{\frac{1}{2}})\Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{k}} v^{(j)}\Vert _{L^{2}_{\chi ^{r-1}_{k}}({\Omega }/I_{j};L^{2}_{\chi ^{-1}_{j}} (I_{j}))}. \end{aligned}$$

Similarly,

$$\begin{aligned} \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{j}}P_{N,I_{i}}v^{(j)}\Vert _{L^{2}({\Omega }/ I_{j};L^{2}_{\chi ^{r-2}_{j}}(I_{j}))}\le (1+cN^{\frac{1}{2}}) \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{j}}v^{(j)}\Vert _{L^{2}({\Omega }/ I_{j};L^{2}_{\chi ^{r-2}_{j}}(I_{j}))}. \end{aligned}$$

On the other hand, we use (4.14) with \(s=r\) to obtain

$$\begin{aligned} J_2^{(j)}\le cN^{\frac{3}{2}-r}\Vert {\partial }^{r}_{x_{i}}v^{(j)}\Vert _{L^{2} ({\Omega }/I_{i};L^{2}_{\chi _{i}^{r-1}}(I_{i}))}. \end{aligned}$$

Inserting the above four inequalities in to (4.16), we conclude that for \(r\ge 1\) and \(i\ne j\),

$$\begin{aligned} \Vert {\partial }_{x_{i}}({}_{*}v^{(j)}_{N}-v^{(j)})\Vert _{{L}^{2}({\Omega })}&\le cN^{\frac{3}{2}-r} \Big (\mathop {\displaystyle \sum }\limits _{\mathop {1\le k\le n}\limits _{k \ne i,j}} \Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{k}}v^{(j)}\Vert _{L^{2}_{\chi ^{r-1}_{k}}({\Omega }/ I_{j};L^{2}_{\chi ^{-1}_{j}}(I_{j}))}\nonumber \\&+\Vert {\partial }_{x_{i}}{\partial }^{r-1}_{x_{j}}v^{(j)}\Vert _{L^{2}({\Omega }/ I_{j};L^{2}_{\chi ^{r-2}_{j}}(I_{j}))}+\Vert {\partial }^{r}_{x_{i}}v^{(j)}\Vert _{L^{2} ({\Omega }/I_{i};L^{2}_{\chi _{i}^{r-1}}(I_{i}))}\Big ).\nonumber \\ \end{aligned}$$
(4.17)

Finally, by substituting (4.13) and (4.17) into (4.12), together with the Poincaré inequality, we reach the desired result (4.11). \(\square \)

Remark 4.1

Let \(P^{1,0}_{N,I_i}\) be the orthogonal projection from \(H^1_0(I_i)\) onto \(\mathcal{P}_N(I_i)\cap H^1_0(I_i)\). Usually, we take the compared function \(\phi (\mathbf x )\) with the components \(\phi ^{(j)}(\mathbf x )= P^{1,0}_{N,I_1}\circ P^{1,0}_{N,I_2}\circ \cdots \circ P^{1,0}_{N,I_n}v^{(j)}(\mathbf x ),1\le j\le n,\) in the inequality like (4.12). But, in this case, \({\nabla }\cdot \phi \ne 0.\) Thus, it can not be used in our case. In opposite, we took \(\phi (\mathbf x )={}_{*}v_{N}(\mathbf x )\) in the proof of Lemma 4.2, with \({\nabla }\cdot {}_{*}v_{N}\phi = 0\). Consequently, we obtained the approximation result (4.11), which in turn, ensures the spectral accuracy of scheme (3.6) for incompressible fluid flows with slip boundary conditions.

5 Error Analysis for Two-Dimensional Flows

In this section, we analyze the error of numerical solution of spectral scheme (3.6) with \(n=2\). Let \(\mathbf U ^*_{N}={\tilde{P}}^{1}_{N,\Omega }\mathbf U \). By virtue of (4.10), we have from (3.4) that

$$\begin{aligned}&({\partial }_t \mathbf U ^*_{N}(t),\phi )_\mathbf{L ^2({\Omega })}+ b(\mathbf U ^*_{N}(t),\mathbf U ^*_{N}(t),\phi )+\nu a(\mathbf U ^*_{N}(t),\phi )\nonumber \\&\quad +\displaystyle \sum ^{3}_{j=1} G_j(\phi ,t)=(\mathbf f (t),\phi )_\mathbf{L ^2({\Omega })},\quad \forall ~\phi \in V_{N}({\Omega }) \end{aligned}$$
(5.1)

where

$$\begin{aligned} G_1(\phi ,t)&= ({\partial }_t(\mathbf U (t)-\mathbf U ^*_{N}(t)),\phi )_\mathbf{L ^2({\Omega })},\\ G_2(\phi ,t)&= b(\mathbf U ^*_{N}(t),\mathbf U (t)-\mathbf U ^*_{N}(t),\phi ),\\ G_3(\phi ,t)&= b(\mathbf U (t)-\mathbf U ^*_{N}(t),\mathbf U (t),\phi ). \end{aligned}$$

Furthermore, we put \(\tilde{\mathbf{U }}_{N}=\mathbf u _{N}-\mathbf U ^*_{N}\). By subtracting (5.1) from (3.6), we obtain

$$\begin{aligned} \left\{ \begin{array}{ll} ({\partial }_t \tilde{\mathbf{U }}_{N}(t), \phi )_\mathbf{L ^2({\Omega })} +b(\tilde{\mathbf{U }}_{N}(t), \mathbf U ^*_{N}(t)+\tilde{\mathbf{U }}_{N}(t),\phi )+b (\mathbf U ^*_{N}(t),\tilde{\mathbf{U }}_{N}(t),\phi )+\nu a(\tilde{\mathbf{U }}_{N}(t),\phi )\\ \quad = \displaystyle \sum ^{3}_{j=1}G_j(\phi ,t), \quad \quad \quad \quad \forall \phi \in V_{N}({\Omega }),\\ \tilde{\mathbf{U }}_{N}(0)=\tilde{P}_{N,\Omega }\mathbf U _0-{\tilde{P}}^{1}_{N,\Omega }\mathbf U _0. \end{array}\right. \end{aligned}$$
(5.2)

Taking \(\phi =2\tilde{\mathbf{U }}_{N}\in V_{N}({\Omega })\) in the first formula of (5.2), we use (3.3) to reach that

$$\begin{aligned} {\partial }_t\Vert \tilde{\mathbf{U }}_{N}(t)\Vert ^2_\mathbf{L ^2({\Omega })}\!+\!2b (\mathbf U ^{*}_{N}(t),\tilde{\mathbf{U }}_{N}(t), \tilde{\mathbf{U }}_{N}(t))+2\nu |\tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^1({\Omega })}^2 \!=\!\displaystyle 2\sum ^{3}_{j=1}G_j(\tilde{\mathbf{U }}_{N}, t).\quad \end{aligned}$$
(5.3)

According to (21) of [16], for any \(\mathbf v \in V({\Omega })\),

$$\begin{aligned} \Vert \mathbf v \Vert _\mathbf{L ^{4}({\Omega })}^{2}\le \Vert \mathbf v \Vert _\mathbf{L ^{2}({\Omega })}| \mathbf v |_\mathbf{H ^{1}({\Omega })}. \end{aligned}$$
(5.4)

Therefore, we use the Hölder inequality, (5.4) and (4.11) with \(r=2\) successively to deduce that

$$\begin{aligned} 2| b(\mathbf{U }^{*}_{N}(t),\tilde{\mathbf{U }}_{N}(t), \tilde{\mathbf{U }}_{N}(t))|&\le 2\Vert \tilde{\mathbf{U }}_{N} (t)\Vert _{\mathbf{L }^4({\Omega })}^{2}|\mathbf{U }^*_{N} (t)|_{\mathbf{H }^1({\Omega })}\nonumber \\&\le c\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _{\mathbf{L }^2({\Omega })}| \tilde{\mathbf{U }}_{N}(t)|_{\mathbf{H }^1({\Omega })}|\mathbf{U }^*_{N} (t)|_{\mathbf{H }^1({\Omega })}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H }^1({\Omega })}^2+\frac{c}{\nu }| \mathbf{U }^*_{N} (t)|_{\mathbf{H }^1({\Omega })}^{2}\Vert \tilde{\mathbf{U }}_{N} (t)\Vert _{\mathbf{L }^2({\Omega })}^2\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H }^1({\Omega })}^2+\frac{c}{\nu }(| \mathbf{U } (t)|^{2}_{\mathbf{H }^1({\Omega })}\nonumber \\&+N^{-\frac{1}{2} }B^{2}_{2}(\mathbf{U } (t)))\Vert \tilde{\mathbf{U }}_{N}(t)\Vert ^{2}_{\mathbf{L }^{2}({\Omega })}. \end{aligned}$$
(5.5)

Next, by using the Cauchy inequality, the Poincaré inequality and (4.11), we derive that

$$\begin{aligned} 2| G_1(\tilde{\mathbf{U }}_{N},t)|&\le 2 \Vert {\partial }_t(\mathbf{U }(t) -\mathbf{U }^{*}_{N}(t))\Vert _{\mathbf{L }^2({\Omega })}\Vert \tilde{\mathbf{U }}_{N} (t)\Vert _{\mathbf{L }^2({\Omega })}\nonumber \\&\le c \Vert {\partial }_t(\mathbf{U }(t)-\mathbf{U }^{*}_{N}(t))\Vert _{\mathbf{L }^2 ({\Omega })}|\tilde{\mathbf{U }}_{N}(t)|_{\mathbf{H }^1({\Omega })}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H }^1({\Omega })}^2+\frac{c}{\nu }N^{3-2r}B_{r}^{2} ({\partial }_t \mathbf{U }(t)). \end{aligned}$$
(5.6)

Furthermore, we use (3.3), the Hölder inequality, the Poincaré inequality, (5.4) and (4.11) successively, to verify that

$$\begin{aligned} 2| G_2(\tilde{\mathbf{U }}_{N},t)|&= 2| b(\tilde{\mathbf{U }}_{N}(t), \mathbf{U }(t)-\mathbf{U }^{*}_{N}(t),\mathbf{U }^{*}_{N}(t))|\nonumber \\&\le 2 |\tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^1({\Omega })}^2\Vert \mathbf{U } (t)-\mathbf{U }^{*}_{N}(t)\Vert _\mathbf{L ^4({\Omega })}\Vert \mathbf{U }^{*}_{N} (t)\Vert _\mathbf{L ^{4}({\Omega })}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N}(t) |_\mathbf{H ^1({\Omega })}^2+\frac{c}{\nu }\Vert \mathbf{U }(t)-\mathbf{U }^{*}_{N} (t)\Vert _\mathbf{L ^4({\Omega })}^2\Vert \mathbf{U }^{*}_{N}(t)\Vert _\mathbf{L ^4 ({\Omega })}^2\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_\mathbf{H ^1({\Omega })}^2+\displaystyle \frac{c}{\nu }\Vert \mathbf{U }(t)-\mathbf{U }^{*}_{N}(t)\Vert _\mathbf{L ^2({\Omega })} |\mathbf{U }(t)\nonumber \\&-\mathbf{U }^{*}_{N}(t)|_\mathbf{H ^1({\Omega })} \Vert \mathbf{U }^{*}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}| \mathbf{U }^{*}_{N}(t)|_\mathbf{H ^1({\Omega })}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N}(t) |_\mathbf{H ^1({\Omega })}^2 +\dfrac{c}{\nu }N^{3-2r}(\Vert \mathbf{U } (t)\Vert _\mathbf{L ^{2}({\Omega })}+N^{-\frac{1}{2}}B_{2}(\mathbf{U }(t))) (|\mathbf{U }(t)|_\mathbf{H ^{1}({\Omega })}\nonumber \\&+N^{-\frac{1}{2}}B_{2} (\mathbf{U }(t)))B^{2}_{r}(\mathbf{U }(t)). \end{aligned}$$
(5.7)

Similarly, we use (3.3), the Hölder inequality, (5.4) and (4.11) to deduce that

$$\begin{aligned} 2|G_3(\tilde{\mathbf{U }}_{N},t)|&= 2| b(\tilde{\mathbf{U }}_{N}(t), \mathbf U (t),\mathbf U (t)-\mathbf U ^{*}_{N}(t))|\nonumber \\&\le \frac{\nu }{4} |\tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^1({\Omega })}^2 +\dfrac{c}{\mu }\Vert \mathbf U (t)\Vert _\mathbf{L ^2({\Omega })}| \mathbf U (t)|_\mathbf{H ^1({\Omega })}\Vert \mathbf U (t)-\mathbf U ^{*}_{N}(t) \Vert _\mathbf{L ^2({\Omega })}|\mathbf U (t)\nonumber \\&-\mathbf U ^{*}_{N} (t)|_\mathbf{H ^1({\Omega })}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_\mathbf{H ^1({\Omega })}^2 +\frac{c}{\nu }N^{3-2r}\Vert \mathbf U (t)\Vert _\mathbf{L ^2({\Omega })}| \mathbf U (t)|_\mathbf{H ^1({\Omega })} B^{2}_{r}(\mathbf U (t)). \end{aligned}$$
(5.8)

In addition, with the aid of (4.7) and (4.11), we have

$$\begin{aligned} \Vert \tilde{\mathbf{U }}_{N}(0)\Vert _\mathbf{L ^2({\Omega })}&\le \Vert \tilde{P}_{N,\Omega }\mathbf U _0-\mathbf U _0\Vert _\mathbf{L ^2 ({\Omega })}+\Vert {\tilde{P}}^{1}_{N,\Omega }\mathbf U _0-\mathbf U _0\Vert _\mathbf{L ^2 ({\Omega })}\nonumber \\&\le \Vert \tilde{P}_{N,\Omega }\mathbf U _0-\mathbf U _0 \Vert _\mathbf{L ^2_{\chi ^{-1}}({\Omega })}+\Vert {\tilde{P}}^{1}_{N,\Omega } \mathbf U _0-\mathbf U _0\Vert _\mathbf{L ^2({\Omega })}\nonumber \\&\le cN^{1-r}A_{r-1}(\mathbf U _0)+cN^{\frac{3}{2}-r}B_{r}(\mathbf U _0). \end{aligned}$$
(5.9)

We now set

$$\begin{aligned} V(\mathbf v ,t)&= |\mathbf v (t)|_\mathbf{H ^{1}({\Omega })}^{2}+N^{-\frac{1}{2}}B^{2}_{2}(\mathbf v (t)),\\ R_{r}(\mathbf v ,t)&= B^{2}_{r}({\partial }_{t}\mathbf v (t))+\Vert \mathbf v (t) \Vert _\mathbf{L ^{2}({\Omega })}|\mathbf v (t)|_\mathbf{H ^{1}({\Omega })}B^{2}_{r} (\mathbf v (t))\\&+(\Vert \mathbf v (t)\Vert _\mathbf{L ^{2}({\Omega })}+N^{-\frac{1}{2}}B_{2} (\mathbf v (t)))(|\mathbf v (t)|_\mathbf{H ^{1}({\Omega })}+N^{-\frac{1}{2}} B_{2}(\mathbf v (t)))B^{2}_{r}(\mathbf v (t)). \end{aligned}$$

Besides,

$$\begin{aligned} \rho _{r}(\mathbf v )=N^{-\frac{1}{2}}A^{2}_{r-1}(\mathbf v )+B^{2}_{r} (\mathbf v ). \end{aligned}$$

Let \(E(\mathbf v ,\sigma ,t)\) be the same as in (3.7). Substituting (5.5)–(5.8) into (5.3), we reach that

$$\begin{aligned} {\partial }_t\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^2+\nu | \tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^1({\Omega })}^2\le \frac{c}{\nu } V(\mathbf U ,t)\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^2 + \frac{c}{\nu }N^{3-2r}R_{r}(\mathbf U ,t). \end{aligned}$$

It reads

$$\begin{aligned} {\partial }_{t}E(\tilde{\mathbf{U }}_{N},\nu ,t)\le \frac{c}{\nu } V(\mathbf U ,t)E(\tilde{\mathbf{U }}_{N}(t),\nu ,t) + \frac{c}{\nu }N^{3-2r}R_{r}(\mathbf U ,t). \end{aligned}$$

Multiplying the above inequality by \(e^{-\frac{c}{\nu }\int _{0}^tV(\mathbf U ,\xi )d\xi }\), integrating the resulting inequality with respect to \(t\), and using (5.9), we obtain

$$\begin{aligned} E(\tilde{\mathbf{U }}_{N},\nu ,t) \le cN^{3-2r}e^{\frac{c}{\nu } \int \nolimits {0}^tV(\mathbf U ,\xi )d\xi }\left( \frac{1}{\nu }\displaystyle \int \limits \limits _0^t e^{-\frac{c}{\nu }\int \nolimits _{0}^\xi V(\mathbf U ,\eta )d\eta }R_{r} (\mathbf U ,\xi )d\xi +\rho _{r}(\mathbf U _0)\right) .\nonumber \\ \end{aligned}$$
(5.10)

On the other hand, (4.11) implies

$$\begin{aligned} E(\mathbf U ^*_{N}-\mathbf U ,\nu ,t) \le cN^{3-2r}(B^{2}_{r} (\mathbf U (t))+\nu \displaystyle \int \limits \limits _0^t B^{2}_{r}(\mathbf U (\xi ))d\xi ). \end{aligned}$$
(5.11)

Finally, a combination of (5.10) and (5.11) leads to the following conclusion.

Theorem 5.1

Let \(\mathbf U (\mathbf x ,t)\) and \(\mathbf u _{N}(\mathbf x ,t)\) be the solutions of (3.4) and (3.6) with \(n=2\), respectively. Then for integers \(N\ge 2\) and \( 1 \le r \le N+1\),

$$\begin{aligned} E(\mathbf u _{N}-\mathbf U ,\nu ,t)&\le cN^{3-2r}\Big (e^{\frac{c}{\nu }\int _{0}^t V(\mathbf U ,\xi )d\xi } \big (\displaystyle \frac{1}{\nu }N^{-\frac{1}{2}}\displaystyle \int \limits \limits _0^t e^{-\frac{c}{\nu }\int _{0}^\xi V(\mathbf U ,\eta )d\eta }R_{r} (\mathbf U ,\xi )d\xi +\rho _{r}(\mathbf U _0)\big )\nonumber \\&+B^{2}_{r}(\mathbf U (t))+\nu \displaystyle \int \limits \limits _0^t B^{2}_{r}(\mathbf U (\xi ))d\xi \Big ), \end{aligned}$$
(5.12)

provided that the norms appearing at the right side of the above inequality are finite.

Remark 5.1

We could derive the same error estimate of numerical solution of scheme (3.10) for solving problem (3.9) with \(n=2\).

6 Error Analysis for Three-Dimensional Flows

In this section, we analyze the error of numerical solution of spectral scheme (3.6) with \(n=3\). Let \(\mathbf U ^*_{N}={\tilde{P}}^{1}_{N,\Omega }\mathbf U \) and \(\tilde{\mathbf{U }}_{N}=\mathbf u _{N}-\mathbf U ^*_{N}\). Following the same line as in the derivation of (5.3), we also obtain

$$\begin{aligned} {\partial }_t\Vert \tilde{\mathbf{U }}_{N}(t)\Vert ^2_\mathbf{L ^2({\Omega })}+2b (\mathbf U ^{*}_{N}(t),\tilde{\mathbf{U }}_{N}(t), \tilde{\mathbf{U }}_{N}(t))+2\nu |\tilde{\mathbf{U }}_{N}(t) |_\mathbf{H ^{1}({\Omega })}^2 =\displaystyle 2\sum ^{3}_{j=1} G_j(\tilde{\mathbf{U }}_{N},t),\qquad \end{aligned}$$
(6.1)

where \(G_j(\tilde{\mathbf{U }}_{N},t)\) are the same as in (5.3), but \(n=3\).

By using the imbedding theory, interpolation between the spaces \(\mathbf L ^{2}({\Omega })\) and \(\mathbf H ^{1}({\Omega })\), and the Poincaré inequality successively, we deduce that for any \(\mathbf v \in V({\Omega })\),

$$\begin{aligned} \Vert \mathbf v \Vert _\mathbf{L ^{4}({\Omega })}\le c\Vert \mathbf v \Vert _\mathbf{H ^{\frac{3}{4}}({\Omega })}\le c\Vert \mathbf v \Vert ^{\frac{1}{4}}_\mathbf{L ^{2}({\Omega })}\Vert \mathbf v \Vert ^{\frac{3}{4}}_\mathbf{H ^{1}({\Omega })} \le c\Vert \mathbf v \Vert ^{\frac{1}{4}}_\mathbf{L ^{2}({\Omega })}| \mathbf v |^{\frac{3}{4}}_\mathbf{H ^{1}({\Omega })}. \end{aligned}$$
(6.2)

Therefore, we use (3.3), the Hölder inequality and (6.2) to deduce that

$$\begin{aligned} 2| b(\mathbf U ^{*}_{N}(t),\tilde{\mathbf{U }}_{N}(t), \tilde{\mathbf{U }}_{N}(t))|&= 2| b(\tilde{\mathbf{U }}_{N} (t),\tilde{\mathbf{U }}_{N}(t),\mathbf U ^{*}_{N}(t))|\\&\le 2\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^4({\Omega })}| \tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^{1}({\Omega })}\Vert \mathbf U ^*_{N}(t)\Vert _\mathbf{L ^4({\Omega })}\\&\le c\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^{\frac{1}{4}} |\tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^{1}({\Omega })}^{\frac{7}{4} }\Vert \mathbf U ^*_{N}(t)\Vert _\mathbf{L ^4({\Omega })}\\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N}(t) |_\mathbf{H ^{1} ({\Omega })}^2+\frac{c}{\nu }\Vert \mathbf U ^*_{N} (t)\Vert _\mathbf{L ^4({\Omega })}^{8}\Vert \tilde{\mathbf{U }}_{N}(t) \Vert _\mathbf{L ^2({\Omega })}^2. \end{aligned}$$

Moreover, using (6.2) again yields

$$\begin{aligned} \Vert \mathbf U ^*_{N}(t)\Vert _\mathbf{L ^4({\Omega })}\le c\Vert \mathbf U ^*_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^{\frac{1}{4}}| \mathbf U ^*_{N}(t)|_\mathbf{H ^1({\Omega })}^{\frac{3}{4}}. \end{aligned}$$

This fact, together with (4.11) with \(r=2\), implies

$$\begin{aligned} \Vert \mathbf U ^*_{N}(t)\Vert _\mathbf{L ^4({\Omega })}\le c(\Vert \mathbf U (t)\Vert _\mathbf{L ^2({\Omega })}+N^{-\frac{1}{2}} B_2(\mathbf U (t)))^{\frac{1}{4}}(| \mathbf U (t)|_\mathbf{H ^1({\Omega })} +N^{-\frac{1}{2} }B_2(\mathbf U (t)))^{\frac{3}{4}}. \end{aligned}$$

The previous statements lead to

$$\begin{aligned}&2| b(\mathbf U ^{*}_{N}(t),\tilde{\mathbf{U }}_{N}(t), \tilde{\mathbf{U }}_{N}(t))|\le \dfrac{\nu }{4}| \tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^{1}({\Omega })}^2\nonumber \\&\quad +\dfrac{c}{\nu }(\Vert \mathbf U (t)\Vert _\mathbf{L ^{2}({\Omega })} +N^{-\frac{1}{2}}B_{2}(\mathbf U (t)))^{2}(|\mathbf U (t)|_\mathbf{H ^{1}({\Omega })}+N^{-\frac{1}{2}}B_{2}(\mathbf U (t)))^{6}\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^2. \nonumber \\ \end{aligned}$$
(6.3)

Like (5.6), we have

$$\begin{aligned} 2|G_1(\tilde{\mathbf{U }}_{N},t)|\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^{1} ({\Omega })}^2+\frac{c}{\nu }N^{3-2r}B_{r}^{2}({\partial }_t \mathbf U (t)). \end{aligned}$$
(6.4)

Next, we use (3.3), the Hölder inequality, (6.2) and (4.11) successively, to verify that

$$\begin{aligned} 2|G_2(\tilde{\mathbf{U }}_{N},t)|&= 2| b(\tilde{\mathbf{U }}_{N}(t), \mathbf U (t)-\mathbf U ^{*}_{N}(t),\mathbf U ^{*}_{N}(t))|\nonumber \\&\le 2 |\tilde{\mathbf{U }}_{N}(t)|_{\mathbf{H }^{1}({\Omega })}\Vert \mathbf U (t)-\mathbf U ^{*}_{N}(t)\Vert _{\mathbf{L }^4({\Omega })}\Vert \mathbf U ^{*}_{N}(t)\Vert _{\mathbf{L }^{4}}({\Omega })\nonumber \\&\le \frac{\nu }{4}| \tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H }^{1}({\Omega })}^2+\frac{c}{\nu }\Vert \mathbf U (t) -\mathbf U ^{*}_{N}(t)\Vert _{\mathbf{L }^{4}({\Omega })}^2\Vert \mathbf U ^{*}_{N} (t)\Vert _{\mathbf{L }^{4}({\Omega })}^2\nonumber \\&\le \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H } ^{1}({\Omega })}^{2}+ \frac{c}{\nu }\Vert \mathbf U (t)-\mathbf U ^{*}_{N}(t)\Vert _{\mathbf{L }^{2}({\Omega })}^{\frac{1}{2}} |\mathbf U (t)\nonumber \\&\quad -\mathbf U ^{*}_{N}(t)|_{\mathbf{H }^{1}({\Omega })}^{\frac{3}{2}} \Vert \mathbf U ^{*}_{N}(t)\Vert _{\mathbf{L }^{2}({\Omega })}^{\frac{1}{2}}| \mathbf U ^{*}_{N}(t)|_{\mathbf{H }^{1}({\Omega })}^{\frac{3}{2}}\nonumber \\&\le \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_{\mathbf{H }^{1}({\Omega })}^2+\dfrac{c}{\nu }N^{3-2r}(\Vert \mathbf U (t)\Vert _{\mathbf{L }^{2}({\Omega })}+N^{-\frac{1}{2}}B_{2}(\mathbf U (t)))^{\frac{1}{2}}{(}|\mathbf U (t)|_{\mathbf{H }^{1}({\Omega })} \nonumber \\&\quad +N^{-\frac{1}{2}}B_{2}(\mathbf U (t)){)}^{\frac{3}{2}}B^{2}_{r} (\mathbf U (t)). \end{aligned}$$
(6.5)

Similarly, we use (3.3), the Hölder inequality, (6.2) and (4.11) to deduce that

$$\begin{aligned} 2| G_3(\tilde{\mathbf{U }}_{N},t)|&= 2| b(\tilde{\mathbf{U }}_{N}(t), \mathbf{U }(t),\mathbf{U }(t)-\mathbf{U }^{*}_{N}(t))|\nonumber \\ \displaystyle&\le \frac{\mu }{4}|\tilde{\mathbf{U }}_{N} (t)|_\mathbf{H ^{1}({\Omega })}+\dfrac{c}{\mu }\Vert \mathbf{U }(t) \Vert _\mathbf{L ^2({\Omega })}^{\frac{1}{2}}| \mathbf{U }(t)|_{ \mathbf H ^1({\Omega })}^{\frac{3}{2}}\Vert \mathbf{U }(t)-\mathbf{U }^{*}_{N} (t)\Vert _\mathbf{L ^2({\Omega })}^{\frac{1}{2}}|\mathbf U (t)\nonumber \\&-\mathbf U ^{*}_{N}(t))|_\mathbf{H ^1({\Omega })}^{\frac{3}{2}}\nonumber \\&\le \displaystyle \frac{\nu }{4}|\tilde{\mathbf{U }}_{N} (t)|_\mathbf{H ^{1}({\Omega })}^2 +\frac{c}{\nu }N^{3-2r}\Vert \mathbf U (t)\Vert _\mathbf{L ^2({\Omega })}^{\frac{1}{2}}| \mathbf U (t)|_\mathbf{H ^1 ({\Omega })}^{\frac{3}{2}}B^{2}_{r}(\mathbf U (t)). \end{aligned}$$
(6.6)

Moreover,

$$\begin{aligned} \Vert \tilde{\mathbf{U }}_{N}(0)\Vert _{\mathbf{L }^2({\Omega })} \le cN^{1-r} A_{r-1}(\mathbf{U }_0)+cN^{\frac{3}{2}-r}B_{r}(\mathbf U _0). \end{aligned}$$
(6.7)

We now set

$$\begin{aligned} V(\mathbf{v },t)&= (\Vert \mathbf{v }(t)\Vert _\mathbf{L ^{2}({\Omega })}+ N^{-\frac{1}{2}}B_{2}(\mathbf{v }(t)))^{2}(|\mathbf{v } (t)|_{\mathbf{H }^{1}({\Omega })}+N^{-\frac{1}{2}} B_{2} (\mathbf{v }(t)))^{6},\\ R_{r}(\mathbf{v },t)&= B^{2}_{r}({\partial }_{t}\mathbf{v }(t)) +\Vert v(t)\Vert ^{\frac{1}{2}}_\mathbf{L ^{2}({\Omega })}|\mathbf{v } (t)|^{\frac{3}{2}}_\mathbf{H ^{1}({\Omega })}B^{2}_{r}(\mathbf{v }(t))\\&+(\Vert \mathbf{v }(t)\Vert _\mathbf{L ^{2}({\Omega })}+N^{-\frac{1}{2}} B_{2}(\mathbf{v }(t)))^{\frac{1}{2}}(|\mathbf{v }(t)|_\mathbf{H ^{1} ({\Omega })}+N^{-\frac{1}{2}}B_{2}(\mathbf{v }(t)))^{\frac{3}{2}}B^{2}_{r} (\mathbf{v }(t)). \end{aligned}$$

Besides,

$$\begin{aligned} \rho _{r}(\mathbf v )=N^{-\frac{1}{2}}A^{2}_{r-1}(\mathbf v ) +B^{2}_{r}(\mathbf v ). \end{aligned}$$

Let \(E(\mathbf v ,\sigma ,t)\) be the same as in (3.7). Substituting (6.3)–(6.6) into (6.1), we reach that

$$\begin{aligned} {\partial }_t\Vert \tilde{\mathbf{U }}_{N}(t)\Vert _\mathbf{L ^2({\Omega })}^2+\nu | \tilde{\mathbf{U }}_{N}(t)|_\mathbf{H ^1({\Omega })}^2\le \frac{c}{\nu }V(\mathbf U ,t)\Vert \tilde{\mathbf{U }}_{N}(t) \Vert _\mathbf{L ^2({\Omega })}^2 + \frac{c}{\nu }N^{3-2r}R_{r}(\mathbf U ,t). \end{aligned}$$

Finally, an argument similar to the last part of the derivation of (5.12) leads to the following conclusion.

Theorem 6.1

Let \(\mathbf U (\mathbf x ,t)\) and \(\mathbf u _{N}(\mathbf x ,t)\) be the solutions of (3.4) and (3.6) with \(n=3\), respectively. Then for integers \(N\ge 2\) and \(1\le r \le N+1\),

$$\begin{aligned} E(\mathbf u _{N}-\mathbf U ,\nu ,t)&\le cN^{3-2r}\Big (e^{\frac{c}{\nu }\int _{0}^t V(\mathbf U ,\xi )d\xi } \big (\displaystyle \frac{1}{\nu }N^{-\frac{1}{4}}\displaystyle \int \limits \limits _0^t e^{-\frac{c}{\nu }\int _{0}^\xi V(\mathbf U ,\eta )d\eta }R_{r} (\mathbf U ,\xi )d\xi +\rho _{r}(\mathbf U _0)\big )\\&+B^{2}_{r}(\mathbf U (t))+\nu \displaystyle \int \limits \limits _0^t B^{2}_{r}(\mathbf U (\xi ))d\xi \Big ), \end{aligned}$$

provided that the norms appearing at the right side of the above inequality are finite.

Remark 6.1

We could derive the same error estimate of numerical solution of scheme (3.10) for solving problem (3.9) with \(n=3\).

7 Concluding Discussion

In this paper, we proposed the spectral method for Navier–Stokes equations with slip boundary conditions. We introduced an orthogonal family induced by the generalized Jacobi functions, which are divergence-free. By using such base functions, the corresponding numerical solutions fulfill the incompressibility automatically. Therefore, we need neither the artificial compressibility method nor the projection method. Moreover, we only have to evaluate the unknown coefficients of expansions of \(n-1\) components of the velocity. These facts simplify actual computations and numerical analysis essentially, and also save computational time. The numerical results demonstrated the high effectiveness of the suggested algorithm, even for problems with small kinetic viscosity.

In this paper, we also established some approximation results, with which we prove the spectral accuracy in space of the proposed spectral method for two and three dimensional fluid flows with slip boundary conditions.

The main idea, the approximation results and the techniques developed in this work are also very useful for spectral methods of other problems with divergence-free solutions, such as certain partial differential equations describing electro-magnetic fields. As an example, we consider the Darwin model of approximation to the Maxwell equations. Let \(\Omega \) be a cube and \(S_i=\left\{ ~\mathbf x ~|~x_i=\pm 1\right\} ,~1\le i\le 3\). \(\mathbf B (\mathbf x ,t)\) denotes the magnetic field with the components \(B^{(j)}(\mathbf x ,t),~1\le j\le 3.\) \(\mathbf B _0(\mathbf x )\) describes the initial magnetic field. \(\mathbf J (\mathbf x ,t)\) stands for the density of electric current with the components \(J^{(j)}(\mathbf x ,t),~1\le j\le 3.\) The constant \(\mu \) is the relative permeability. As pointed out by Degond and Raviat [5], for solving this model, we need to solve three boundary value problems for any fixed time \(t\). For instance, one of them is of the following form,

$$\begin{aligned} \left\{ \begin{array}{ll} -{\Delta }\mathbf B (\mathbf x ,t)=\mu \mathrm{Rot}\mathbf J (\mathbf x ,t),&{}\mathrm{~ in~}~{\Omega },~~ 0\le t \le T, \\ {\nabla }\cdot \mathbf B (\mathbf x ,t)=0,&{}\mathrm{~ on~}~\bar{\Omega },~~ 0\le t\le T,\\ \mathbf B (\mathbf x ,t)\cdot \mathbf{n}=\mathbf B _0(\mathbf x )\cdot \mathbf{n},&{}\mathrm{~ on~}~{\partial }{\Omega },~~ 0\le t\le T,\\ \mathrm{Rot}\mathbf B (\mathbf x ,t)\times \mathbf{n}=\mu \mathbf J (\mathbf x ,t)\times \mathbf{n},&{}\mathrm{~ on~}~{\partial }{\Omega },~~ 0\le t\le T.\\ \end{array}\right. \end{aligned}$$
(7.1)

According to the boundary conditions, \(B^{(j)}(\mathbf x ,t)=B^{(j)}_0(\mathbf x )\) on \(S_j,~1\le j\le 3\). Moreover, a careful calculation shows that

$$\begin{aligned} \begin{array}{l} \partial _{x_1}B^{(2)}(\mathbf x ,t)=\mu J^{(3)}(\mathbf x ,t)+\partial _{x_2}B^{(1)}_0(\mathbf x ),\quad \partial _{x_1}B^{(3)}(\mathbf x ,t)=-\mu J^{(2)}(\mathbf x ,t)+\partial _{x_3}B^{(1)}_0(\mathbf x ),\\ \quad \mathrm{~ on~}S_1,\\ \partial _{x_2}B^{(3)}(\mathbf x ,t)=\mu J^{(1)}(\mathbf x ,t)+ \partial _{x_3}B^{(2)}_0(\mathbf x ),\quad \partial _{x_2}B^{(1)} (\mathbf x ,t)=-\mu J^{(3)}(\mathbf x ,t)+\partial _{x_1}B^{(2)}_0 (\mathbf x ),\\ \quad \mathrm{~ on~}S_2,\\ \partial _{x_3}B^{(1)}(\mathbf x ,t)=\mu J^{(2)}(\mathbf x ,t)+ \partial _{x_1}B^{(3)}_0(\mathbf x ),\quad \partial _{x_3}B^{(2)} (\mathbf x ,t)=-\mu J^{(1)}(\mathbf x ,t)+\partial _{x_2}B^{(3)}_0 (\mathbf x ),\\ \quad \mathrm{~on~}S_3.\\ \end{array}\nonumber \\ \end{aligned}$$
(7.2)

Clearly, the right sides of the above six equalities are known functions. Furthermore, all \( B^{(j^{\prime })}(\mathbf x ,t)\) are the tangential components of \(\mathbf B (\mathbf x ,t)\) on \(S_j, j\ne j^{\prime }\). Therefore,

$$\begin{aligned} {\partial }_\mathbf{n}(\mathbf B (\mathbf x ,t)\cdot \varvec{\tau })=\mathbf G (\mathbf x ,t),~\quad \mathrm{~ on~}~{\partial }{\Omega },~~ 0\le t \le T, \end{aligned}$$

where \(\mathbf G (\mathbf x ,t)\) is a known vector function with the components as the right sides of (7.2). Next, let \(\mathbf B (\mathbf x ,t)=\mathbb B (\mathbf x ,t)+\mathbf B _0(\mathbf x )\). Since \({\nabla }\cdot \mathbf B _0(\mathbf x )=0 \), the problem (7.1) is reformulated to

$$\begin{aligned} \left\{ \begin{array}{ll} -{\Delta }\mathbb B (\mathbf x ,t)={\Delta }\mathbf B _0(\mathbf x )+\mu \mathrm{Rot}\mathbf J (\mathbf x ,t),&{}\mathrm{~ in~}{\Omega },~~ 0\le t \le T, \\ {\nabla }\cdot \mathbb B (\mathbf x ,t)=0,&{} \mathrm{~ on~}\bar{\Omega },~~ 0\le t\le T,\\ \mathbb B (\mathbf x ,t)\cdot \mathbf{n}=0,&{}\mathrm{~ on~}{\partial }{\Omega },~~ 0\le t\le T,\\ {\partial }_\mathbf{n}(\mathbb B (\mathbf x ,t)\cdot \varvec{\tau })=\mathbf G (\mathbf x ,t)-{\partial }_\mathbf{n}(\mathbf B _0(\mathbf x )\cdot \varvec{\tau }),&{}\mathrm{~ on~}{\partial }{\Omega },~~ 0\le t\le T.\\ \end{array}\right. \end{aligned}$$
(7.3)

We could solve the above problem by using the spectral method proposed in this paper, as discussed in Remark 3.1.

For solving the Navier–Stokes equations with non-slip boundary conditions, we need another special divergence-free basis. To do this, we let \(J^{(\alpha ,\beta )}_{l}(x)\) be the Jacobi polynomials as before, and introduce the following polynomials,

$$\begin{aligned} \begin{array}{ll} G_{l}(x)=\frac{1}{l-1}(1-x^{2})J^{(1,1)}_{l-2}(x),&{}l\ge 2,\\ F_{l}(x)=\frac{1}{(l-2)(l-3)}(1-x^{2})^2J^{(2,2)}_{l-4}(x),&{} l\ge 4. \end{array} \end{aligned}$$

Furthermore,

$$\begin{aligned} \sigma ^{(j)}_{ l}(\mathbf x )=\sigma ^{(j)}_{l_{1},l_{2},\ldots ,l_{n}}(\mathbf x )=F_{l_{j}+1}(x_{j}) \mathop {\prod }\limits _{\mathop {1 \le i\le n}\limits _{i\ne j}} G_{l_{i}}(x_{i}). \end{aligned}$$

For any \(n\)-dimensional divergence-free vector \(\mathbf v \) satisfying homogeneous boundary conditions, we could expand its components as (cf. [18])

$$\begin{aligned} v^{(j)}(\mathbf x )=\sum _{i=1}^n\sum _{l_{i}= 3}^{\infty } \hat{v}^{(j)}_{l}\sigma ^{(j)}_{l}(\mathbf x )=\sum _{i=1}^n\sum _{l_{i}= 3}^{\infty }\hat{v}^{(j)}_{l_{1},l_{2},\ldots ,l_{n}} \sigma ^{(j)}_{l_{1},l_{2},\ldots ,l_{n}}(\mathbf x ), \quad 1\le j\le n, \end{aligned}$$

where the coefficients \(\hat{v}^{(j)}_{l}\) satisfy the equality

$$\begin{aligned} \sum _{j=1}^{n}\hat{v}^{(j)}_{l}=\sum _{j=1}^{n}\hat{v}^{(j)}_{l_{1}, l_{2},\ldots ,l_{n}}=0, \quad l_{i}\ge 3, 1\le i\le n. \end{aligned}$$