1 Introduction

Mathematical description of physical phenomena in which physical quantities are transferred inside a physical system due to diffusion and convection leads to the well-known advection–diffusion equation [1, 2]. Specifically, this type of partial differential equation is used to describe dispersion in two-dimensional tidal currents, transport of pollutants in the atmosphere, heat transfer in a draining film, dispersion in finite porous media, and water transfer in soils [37]. Motivated by these significant applications, researchers have taken considerable efforts to solve advection–diffusion equation. In [8], Zhang et al. provided the finite element method for the fractional advection–diffusion equation with non-homogeneous initial-boundary condition. Authors in [9] developed an implicit meshless approach for numerical simulation of fractional advection–diffusion equation. The numerical method is presented by using a Lax–Wendroff-type time discretization procedure for solving the fractional advection–diffusion equation [10]. Ding and Jiang considered the fractional Laplacian operator for analytical solutions of multi-term time space fractional advection–diffusion equation with mixed boundary conditions on a finite domain in [11]. Recently, researchers have used several numerical methods to solve approximate fractional advection–diffusion equation involving the Kansa method, the finite difference method, a moving least squares meshless, Laplace transform, Bernstein dual Petrov–Galerkin method, the finite volume method, and the local discontinuous Galerkin method [1219]. Moreover, Cartaladea et al. introduced an approximation for the fractional advection–diffusion equation according to lattice Boltzmann method by Bhatnagar–Gross–Krook or multiple-relaxation time collision operators [20]. To solve fractional advection–diffusion equation, Chen formulated a fully-discrete numerical method by using the classical finite difference method [21]. In [22], an efficient shifted Legendre collocation method was proposed for numerical solution of the variable-order fractional Galilei advection–diffusion equation. Also, a Legendre–Gauss–Lobatto collocation method was proposed to solve the fractional advection diffusion equation in [23].There have also been some studies on solving fractional advection–diffusion equation with other derivatives. Partohaghighi et al. [24] used a transformation involving a fictitious coordinate to solve the fractional advection–diffusion equation with the Atangana–Baleanu–Caputo derivative. The Riesz derivative is approximated by the second-order fractional weighted and shifted Gruünwald–Letnikov formula to solve the time-space fractional advection–diffusion equation [25].

The major purposes of this study are briefly given as follows:

  • Introducing a new version of the time fractional advection–diffusion equation on an unbounded space domain with vanishing boundary conditions.

  • Establishing a hybrid method based on the Chebyshev cardinal functions and the modified Legendre functions for solving this equation.

So, we focus on the equation

$$ \textstyle\begin{cases} {}^{c}_{0}{D_{t}^{\alpha }}u(x,t)+\lambda u_{x}(x,t)-\gamma u_{xx}(x,t)=f(x,t), & (x,t)\in \mathbb{R}\times [0,T], \\ \lim_{| x | \rightarrow \infty } u(x,t) =0, \\ u(x,0)=g(x), \end{cases} $$
(1.1)

where \({}^{c}_{0}{D_{t}^{\alpha }}\) is the Caputo fractional derivative of order \(\alpha \in (0,1]\), λ and γ are positive real constants, and f and g are known functions.

The proposed method uses mutually the Chebyshev cardinal functions and the modified Legendre functions together with the collocation method to transform equation (1.1) into a system of algebraic equations which can be easily solved. To do this, first, using an appropriate change of variable, the problem expressed in relation (1.1) is transformed into an equivalent problem over bounded time and space domains. Then, the Chebyshev cardinal functions and the modified Legendre functions are employed to approximate solution of the elicited problem over time and space domains, respectively. Next, by inserting this approximation into the transformed equation, employing the fractional derivative matrix of the Chebyshev cardinal functions and the ordinary derivative matrix of the modified Legendre functions, and applying the collocation technique, we derive a system of algebraic equations. Eventually, solution of this system leads to the solution of the original problem.

The framework of this paper is as follows: In Sect. 2 the fractional calculus is stated. Shifted Chebyshev cardinal and the modified Legendre functions are introduced in Sect. 3. The hybrid method is presented in Sect. 4. Some examples are studied in Sect. 5. Conclusion of this study is given in Sect. 6.

2 Fractional calculus

In this section, we review the definition of fractional derivative in the Caputo sense.

Definition 1

([26])

Assume that \(\alpha \in (n-1,n]\), \(n\in \mathbb{N}\), and \(f(t)\) is sufficiently continuous. Then

$$ {}^{c}_{0}{D_{t}^{\alpha }}f(t) = \textstyle\begin{cases} \frac{1}{\Gamma (n-\alpha )} \int _{0}^{t} \frac{f^{(n)}(\tau )}{(t-\tau )^{\alpha +1-n}} \,d\tau , & \alpha \in (n-1,n), \\ \frac{d^{n}}{dt^{n}}f(t), & \alpha =n \in \mathbb{N}, \end{cases} $$
(2.1)

is called the Caputo fractional derivative of order α.

Corollary 1

([8])

If \(\alpha \in (n-1,n]\), \(n \in \mathbb{N}\), \(r,s \in \mathbb{R}\), and \({}^{c}_{0}{D_{t}^{\alpha }}f(t)\) and \({}^{c}_{0}{D_{t}^{\alpha }}g(t)\) exist, then

$$ {}^{c}_{0}{D_{t}^{\alpha }} \bigl(rf(t)+sg(t) \bigr) =r {}^{c}_{0}{D_{t}^{\alpha }}f(t)+s {}^{c}_{0}{D_{t}^{\alpha }}g(t), $$
(2.2)

which confirms that the Caputo fractional derivative is a linear operator.

Corollary 2

([26])

If \(k\in \mathbb{N}\cup \{0\}\) and \(\alpha \in (n-1,n]\), then

$$ {}^{c}_{0}{D_{t}^{\alpha }}t^{k}= \textstyle\begin{cases} \frac{\Gamma (k+1)}{\Gamma (k+1-\alpha )}t^{k-\alpha }, & k\geq n, \\ 0, & k< n. \end{cases} $$
(2.3)

3 Basis functions

Herein, we introduce two classes of the basis functions which will be used in approximating solution of the problem under consideration.

3.1 The shifted Chebyshev cardinal functions

Definition 2

([27])

The shifted Chebyshev cardinal functions of order m are defined over \([0,T]\) by

$$ \varphi _{i}(t)=\prod_{ \substack{ j=1 \\ j\neq i } }^{m+1} \biggl(\frac{t-t_{j}}{t_{i}-t_{j}} \biggr), \quad i=1,2,\ldots ,m+1, $$
(3.1)

where \(t_{i}=\frac{T}{2} (1-\cos (\frac{(2i-1)\pi }{2(m+1)} ) )\).

A function \(u(t)\in C ([0,T] )\) can be expressed by the shifted Chebyshev cardinal functions as follows:

$$ u(t)\simeq \sum_{i=1}^{m+1} c_{i} \varphi _{i}(t)\triangleq C^{T} \varPhi _{m} (t), $$
(3.2)

where

C= [ c 1 c 2 c m + 1 ] T = [ u ( t 1 ) u ( t 2 ) u ( t m + 1 ) ] T
(3.3)

and

Φ m (t)= [ φ 1 ( t ) φ 2 ( t ) φ m + 1 ( t ) ] T .
(3.4)

Remark 1

([27])

The cardinal functions in relation (3.1) can be redefined simpler as follows:

$$ \varphi _{i}(t)=\frac{1}{\hat{\gamma }_{i}} \sum _{k=0}^{m}\hat{b}_{ik}t^{m-k}, \quad i=1,2, \ldots ,m+1, $$
(3.5)

where

$$ \hat{\gamma _{i}}=\prod_{ \substack{ l=1 \\ l\neq i } }^{m+1} (t_{i}-t_{l} ), $$

and

$$ \hat{b}_{ik}= \textstyle\begin{cases} 1, & k=0, \\ -\frac{1}{k} \sum _{l=1}^{k} \hat{a}_{il}\hat{b}_{ik-1}, & k=1,2, \ldots ,m, \end{cases} $$

in which

$$ \hat{a}_{il}=\sum_{ \substack{ r=1 \\ r\neq i } }^{m+1} t_{r}^{l}. $$

Theorem 3.1

If \(\varPhi _{m}(t)\) is the vector defined in relation (3.4) and \(\alpha \in (0,1]\), then

$$ {}^{c}_{0}{D_{t}^{\alpha }} \varPhi _{m}(t)\simeq D_{m}^{(\alpha )} \varPhi _{m}(t), $$
(3.6)

where \(D_{m}^{(\alpha )}\) is an \((m+1)\times (m+1)\) matrix (known as the fractional derivative matrix of the shifted Chebyshev cardinal functions) with entries

$$ d_{ij}^{(\alpha )}=\frac{1}{\hat{\gamma }_{i}}\sum _{k=0}^{m-1} \hat{b}_{ik} \frac{(m-k)!\ t_{j}^{m-k-\alpha }}{\Gamma (m-k-\alpha +1)}, \quad i,j=1,2,\ldots , m+1, $$

in which the coefficients \(\hat{b}_{ik}\) have been already introduced in Remark 1.

Proof

From relations (2.2) and (3.5), we get

$$ {}^{c}_{0}{D_{t}^{\alpha }}\varphi _{i}(t)= {}^{c}_{0}{D_{t}^{\alpha }} \Biggl(\frac{1}{\hat{\gamma }_{i}} \sum_{k=0}^{m} \hat{b}_{ik}t^{m-k} \Biggr)= \frac{1}{\hat{\gamma }_{i}}\sum _{k=0}^{m}\hat{b}_{ik} \bigl( {}^{c}_{0}{D_{t}^{\alpha }}t^{m-k} \bigr),\quad i=1,2, \ldots ,m+1. $$

From Eq. (2.3) and the above relation, we obtain

$$ {}^{c}_{0}{D_{t}^{\alpha }}\varphi _{i}(t)= \frac{1}{\hat{\gamma }_{i}}\sum_{k=0}^{m-1} \hat{b}_{ik} \frac{(m-k)!\ t^{m-k-\alpha }}{\Gamma (m-k-\alpha +1)}, \quad i=1,2,\ldots , m+1. $$

Now, we can approximate \({}^{c}_{0}{D_{t}^{\alpha }}\varphi _{i}(t)\) for \(i=1,2,\ldots , m+1\) as follows:

$$ {}^{c}_{0}{D_{t}^{\alpha }}\varphi _{i}(t)\simeq \sum_{j=1}^{m+1}d_{ij}^{( \alpha )} \varphi _{j}(t), $$

where

$$ d_{ij}^{(\alpha )}=\frac{1}{\hat{\gamma }_{i}}\sum _{k=0}^{m-1} \hat{b}_{ik} \frac{(m-k)!\ t_{j}^{m-k-\alpha }}{\Gamma (m-k+1-\alpha )},\quad j=1,2, \ldots , m+1. $$

Thus, the proof is completed. □

3.2 The modified Legendre functions

The modified Legendre functions are defined over \([-1,1]\) by

$$ \psi _{i}(x)=\sqrt{ \biggl(i+\frac{1}{2} \biggr) \bigl(1-x^{2} \bigr)}L_{i}(x), \quad i=0,1,2,\ldots , s, $$
(3.7)

where \(L_{i}\) is the ith Legendre polynomial of order i that can be generated by the recurrence relation

$$ (i+1)L_{i+1}(x)=(2i+1)xL_{i}(x)-iL_{i-1}(x), \quad i=1,2,\ldots , s, $$

with \(L_{0}(x)=1\) and \(L_{1}(x)=x\). The modified Legendre functions are orthogonal on \([-1,1]\) with respect to the weight function \(\varpi (x)=\frac{1}{\sqrt{1-x^{2}}}\) and

$$ \langle \psi _{i},\psi _{j} \rangle = \int _{-1}^{1}\psi _{i}(x) \psi _{j}(x)\varpi (x)\,dx=\frac{1}{2i+1}\delta _{ij}. $$

We can approximate a function \(u(x) \in L_{\varpi }^{2}([-1,1])\) with conditions \(u(-1)=u(1)=0\) via the modified Legendre functions as follows:

$$ u(x)\simeq \sum_{i=0}^{s} \tilde{c}_{i}\psi _{i}(x)\triangleq \tilde{C}^{T}\Psi _{s}(x), $$
(3.8)

where

C ˜ = [ c ˜ 0 c ˜ 1 c ˜ s ] T ,

in which

$$ \tilde{c}_{i}= \int _{-1}^{1}u(x)\psi _{i}(x) \varpi (x)\,dx, $$

and

Ψ s (x)= [ ψ 0 ( x ) ψ 1 ( x ) ψ s ( x ) ] T .
(3.9)

The differentiation of the vector \(\Psi _{s}(x)\) can be expressed as follows:

$$ \frac{d\Psi _{s}(x)}{dx}\simeq \mathbf{P}_{s}^{(1)} \Psi _{s}(x), $$
(3.10)

where \(P_{s}^{(1)}\) is a matrix of order \(s+1\) with entries

$$ p_{ij}^{(1)}= \int _{-1}^{1}\psi _{i-1}^{\prime }(x) \psi _{j-1}(x)\,dx, \quad i,j=1,2,\ldots ,s+1. $$
(3.11)

Moreover, for any natural number r, we have

$$ \frac{d^{r}\Psi _{s}(x)}{dx^{r}}=\mathbf{P}_{s}^{(r)}\Psi _{s}(x), $$
(3.12)

where

$$ \mathbf{P}_{s}^{(r)}= \underbrace{\mathbf{P}_{s}^{(1)}\times \mathbf{P}_{s}^{(1)}\times \cdots\times \mathbf{P}_{s}^{(1)}}_{ r\text{ time}}. $$
(3.13)

4 Analysis of the method

In this section, we establish a numerical method for solving problem (1.1) by using the basis functions introduced in the previous section. To solve Eq. (1.1), first the problem is transformed from \(\mathbb{R}\times [0,T]\) into \([-1,1]\times [0,T]\) by using the change of variable \(x=\operatorname{arctanh}(\vartheta )\). Thus, by defining \(u(\operatorname{arctanh}(\vartheta ),t)\triangleq \bar{u}(\vartheta ,t) \), we obtain

$$ u_{x}(x,t)=\bigl(1-\vartheta ^{2} \bigr)\bar{u}_{\vartheta }(\vartheta ,t) $$
(4.1)

and

$$ u_{xx}(x,t)=\bigl(1-\vartheta ^{2} \bigr)^{2} \bar{u}_{\vartheta \vartheta }( \vartheta ,t)-2\vartheta \bigl(1-\vartheta ^{2}\bigr) \bar{u}_{\vartheta }( \vartheta ,t). $$
(4.2)

Now, by replacing Eqs. (4.1) (4.2) into Eq. (1.1), we obtain the equivalent problem

$$ \textstyle\begin{cases} {}^{c}_{0}{D_{t}^{\alpha }}\bar{u}(\vartheta ,t)+ [\lambda (1- \vartheta ^{2})+2\gamma \vartheta (1-\vartheta ^{2} ) ]\bar{u}_{\vartheta }(\vartheta ,t)-\gamma (1-\vartheta ^{2})^{2} \bar{u}_{\vartheta \vartheta }(\vartheta ,t) \\ \quad =\bar{f}(\vartheta ,t),\quad (\vartheta ,t)\in [-1,1]\times [0,T], \\ \bar{u}(-1,t) =\bar{u}(1,t)=0, \\ \bar{u}(\vartheta ,0)=\bar{g}(\vartheta ), \end{cases} $$
(4.3)

where \(\bar{f}(\vartheta ,t)=f (\operatorname{arctanh}(\vartheta ),t )\) and \(\bar{g}(\vartheta )=g (\operatorname{arctanh}(\vartheta ) )\). For solving Eq. (4.3), let

$$ \bar{u}(\vartheta ,t)\simeq \sum_{i=0}^{s} \sum_{j=1}^{m+1}u_{ij} \psi _{i}(\vartheta )\varphi _{j}(t) \triangleq \Psi _{s}^{T}( \vartheta )U\varPhi _{m}(t), $$
(4.4)

in which \(U=[u_{ij}]\) is an \((s+1)\times (m+1)\) unknown matrix, and \(\Psi _{s}(\vartheta )\) and \(\Phi _{m}(t)\) are defined in Eqs. (3.9) and (3.4), respectively. From Eqs. (3.6) and (3.10), we obtain

$$ \begin{aligned} &{}^{c}_{0}{D_{t}^{\alpha }} \bar{u}(\vartheta ,t)\simeq \Psi _{s}^{T}( \vartheta )UD_{m}^{(\alpha )}\Phi _{m}(t),\qquad \bar{u}_{\vartheta }( \vartheta ,t)\simeq \Psi _{s}^{T}( \vartheta ) \bigl(\mathbf{P}_{s}^{(1)} \bigr)^{T}U\Phi _{m}(t), \\ &\bar{u}_{\vartheta \vartheta }( \vartheta ,t) \simeq \Psi _{s}^{T}(\vartheta ) \bigl( \mathbf{P}_{s}^{(2)} \bigr)^{T}U\Phi _{m}(t). \end{aligned} $$
(4.5)

Using Eq. (4.5), we define the following residual function for problem (4.3):

$$\begin{aligned} R(\vartheta ,t) \triangleq& \Psi _{s}^{T} \bigl( U\mathbf{D}_{m}^{( \alpha )}+ \bigl[\lambda \bigl(1- \vartheta ^{2} \bigr)+2 \gamma \vartheta \bigl(1-\vartheta ^{2} \bigr) \bigr] \bigl(\mathbf{P}_{s}^{(1)} \bigr)^{T}U-\gamma \bigl(1-\vartheta ^{2} \bigr)^{2} \bigl( \mathbf{P}_{s}^{(2)} \bigr)^{T}U \bigr) \\ &{}\times \varPhi _{m}(t)-\bar{f}( \vartheta ,t) \simeq 0. \end{aligned}$$
(4.6)

Moreover, using Eqs. (4.3) and (4.4), we define

$$ \Delta (\vartheta ) \triangleq \Psi _{s}^{T}( \vartheta )U\varPhi _{m}(0)- \bar{g}(\vartheta )\simeq 0. $$
(4.7)

Eventually, we obtain a system of \((s+1)(m+1)\) equations by inserting the collocation points \(\vartheta _{i}=-\cos (\frac{(2i-1)\pi }{2(s+1)} )\) and \(t_{j}=\frac{T}{2} (1-\cos (\frac{(2j-1)\pi }{2(m+1)} ))\) into Eqs. (4.6) and (4.7) as follows:

$$ \textstyle\begin{cases} R(\vartheta _{i},t_{j})=0, & i=1,2,\ldots , s+1,\ j=2,3,\ldots , m+1, \\ \Delta (\vartheta _{i})=0, & i=1,2,\ldots , s+1. \end{cases} $$
(4.8)

Solving the above system leads to obtaining an approximate solution for problem (4.3). Finally, the approximate solution of Eq. (1.1) is obtained as \(u(x,t)=\bar{u}(\tanh (x),t)\) for \((x,t)\in \mathbb{R}\times [0,T]\).

5 Numerical simulation

This section demonstrates the accuracy of the presented scheme for solving the problem introduced in Eq. (1.1) by solving some test problems.

Example 1

As the first example, we consider Eq. (1.1) with \(\lambda =\gamma =2\) and the exact solution \(u(x,t)=\frac{\sin (t)}{(1+x^{2})^{10}}\). Note that the initial condition and the right-hand side function can be identified using the exact solution. The proposed method has been used to solve this equation for various values of α. The maximum absolute errors of the obtained numerical solutions for various values of α have been presented in Table 1. Figure 1 shows the approximate solution and the absolute error function for \(\alpha =0.9\) with (\(s=30\), \(m=15\)). By considering these results, it is clear that the presented hybrid method is very accurate for solving this example.

Figure 1
figure 1

Numerical results in Example 1 for \(\alpha =0.9\) with (\(s=30\), \(m=15\)) when \((x,t) \in [-10,10]\times [0,1]\)

Table 1 Maximum absolute errors in Example 1

Example 2

Consider the time fractional advection–diffusion equation (1.1) with \(\lambda =1\), \(\gamma =2\) and the exact solution \(u(x,t)=\sinh (t)\exp (-5x^{2}) \). The maximum absolute errors of the obtained numerical results for various values of α are given in Table 2. The obtained results of solving this equation for \(\alpha =0.9\) when (\(s=30\), \(m=15\)) are plotted in Fig. 2. From the obtained results, we conclude that the presented scheme is an efficient tool for solving this example.

Figure 2
figure 2

Numerical results in Example 2 for \(\alpha =0.9\) with \((s=30, m=15)\) when \((x,t) \in [-10,10]\times [0,1]\)

Table 2 Maximum absolute errors in Example 2

Example 3

Consider the time fractional advection–diffusion equation (1.1) with \(\lambda =2\), \(\gamma =1\) and the exact solution \(u(x,t)=\frac{\exp (t)}{(1+x^{2})^{10}}\). The presented scheme is used to solve this equation and the maximum absolute errors of the obtained numerical results are given in Table 3. The obtained results for \(\alpha = 0.8\) with (\(s=30\), \(m = 15\)) are shown in Fig. 3. According to the obtained results, we see that the proposed method is very accurate for solving this example.

Figure 3
figure 3

Numerical results in Example 3 for \(\alpha =0.8\) with (\(s=30\), \(m=15\)) when \((x,t) \in [-10,10]\times [0,1]\)

Table 3 Maximum absolute errors in Example 3

Example 4

Finally, consider the time fractional advection–diffusion equation (1.1) with \(\lambda =\gamma =1\) and the exact solution \(u(x,t)=\cos (t)\exp (-5x^{2}) \). Table 4 provides the maximum absolute errors of the obtained numerical solutions for various values α. The obtained results for \(\alpha = 0.8\) with (\(s=30\), \(m = 15\)) are plotted in Fig. 4. These results confirm that the presented approach is an efficient tool for solving this problem.

Figure 4
figure 4

Numerical results in Example 4 for \(\alpha =0.8\) with (\(s=30\), \(m=15\)) when \((x,t) \in [-10,10]\times [0,1]\)

Table 4 Maximum absolute errors in Example 4

6 Conclusion

In this paper, we have used two types of orthogonal basis functions (namely the Chebyshev cardinal functions and the modified Legendre functions) to solve the time fractional advection–diffusion equation on an unbounded space domain with vanishing boundary conditions. In the proposed method, first, by using a suitable change of variable that satisfies the boundary conditions, the problem under consideration is mapped on a bounded space domain. Then, the Chebyshev cardinal functions are used to approximate solution of the problem over the time domain and the modified Legendre functions are utilized to approximate the solution over the space domain. The numerical results obtained by solving some test problems confirm high accuracy of the method.