1 Introduction

Nonlinear partial differential equations are widely used to describe many complex phenomena in various fields including the scientific work and engineering fields. In particular, fractional differential equations (FDEs) containing the fractional derivative are widely used as models to express many important physical phenomena such as fluid mechanics, plasma physics, classical mechanics, quantum mechanics, nuclear physics, solid state physics, chemical kinematics, chemical physics, and so on. For the basic theory and different applications of derivatives and integrals of fractional order in various domains, we refer the readers to [1]. In order to better illustrate the described physical phenomena, we need to obtain the solutions of FDEs. However, the analytical solutions are usually difficult to obtain. So numerical solutions for FDEs have been paid much attention by many authors, and so far many numerical methods for obtaining the approximate solutions of FDEs have been developed. Among the numerical methods, the finite difference method is the most widely used method to solve FDEs, and many types of FDEs have been solved so far by use of explicit and implicit finite difference methods, compact finite difference methods, alternating direction implicit difference methods, and so on. For example, in [2, 3], the authors developed two valid difference schemes for the fractional advection-diffusion equations and proved the stability and convergence, whereas in [46], difference schemes for the fractional advection-dispersion equations were established. In [79], compact finite difference schemes were proposed to solve the fractional advection-dispersion equations, the fractional convection-dispersion equations, and the fractional diffusion equations respectively, whereas in [10], a compact alternating direction implicit scheme for a class of two-dimensional time fractional diffusion equations was developed. In [1115], various finite difference schemes for the fractional subdiffusion equations and the fractional diffusion-wave equations were established.

Among the works mentioned, we notice that most of the current research on numerical methods for solving FDEs are concerned with the constant-coefficient case, and relatively less attention has been paid to the cases with variable coefficient. In [16, 17], the authors presented compact finite difference schemes with convergence order \(O(\tau^{2-\alpha}+h^{4})\) (\(0<\alpha<1\)) for fractional subdiffusion equation with spatially variable coefficient, whereas Wang et al. [18] proposed a Petrov-Galerkin finite element method for variable-coefficient fractional diffusion equations and proved the well-posedness and optimal-order convergence of this method. Chen et al. [19] presented a fast semiimplicit difference method with convergence order \(O(\tau+h)\) for a nonlinear two-sided space-fractional diffusion equation with variable diffusivity coefficients and also developed a fast accurate iterative method by decomposing the dense coefficient matrix into a combination of Toeplitz-like matrices, whereas Wang [20] established a compact finite difference method with convergence order \(O(\tau^{3-\alpha}+\tau^{2}+h^{4})\) (\(1<\alpha<2\)) for a class of time fractional convection-diffusion-wave equations with variable coefficients.

In this paper, we consider the following time fractional parabolic equation with spatially variable coefficient and nonhomogeneous source term:

$$ ^{C}_{0}D^{\alpha}_{t}u(x,t)= \frac{ \partial}{ \partial x}\biggl(a(x)\frac{ \partial^{3} u(x,t)}{ \partial x^{3}}\biggr)+f(x,t),\quad 0< \alpha< 1, $$
(1)

which is subject to the initial and periodic boundary value conditions

$$ \left \{ \textstyle\begin{array}{@{}l} u(x,0)=\varphi(x),\quad x\in\mathbb{R},\\ u(x,t)=u(x+L,t),\quad x\in\mathbb{R}, t\in[0,T], \end{array}\displaystyle \right . $$
(2)

where \({}^{C}_{0}D^{\alpha}_{t}u(x,t)=\frac{ 1}{ \Gamma(1-\alpha)}\int_{0}^{t}\frac{ u_{t}'(x,s)}{ (t-s)^{\alpha}}\,ds\) denotes the Caputo derivative of order α on \(u(x,t)\), L is the period of \(u(x,t)\) with respect to the variable x, and \(a(x)\) is assumed to be smooth enough and satisfy \(a(x)\leq L_{1}<0\).

The aim of this work is to develop a finite difference scheme with spatial fourth-order accuracy for the above problems. First, in Section 2, we give the derivation of the finite difference scheme for solving problems (1)-(2). Then, in Sections 3 and 4, we carry out theoretical analysis including unique solvability, stability, and convergence for the finite difference scheme by use of the Fourier analysis method. In Section 5, numerical experiments are given to support the theoretical analysis. Some conclusions are presented at the end of this paper.

2 The finite difference scheme

We consider \(x\in[0,L]\) due to the periodic boundary value condition. Let \(M, N\) be two positive integers, and \(h=\frac{ L}{ M}\) and \(\tau=\frac{ T}{ N}\) denote the spatial and temporal step sizes, respectively. Define \(x_{i}=i*h\) (\(0\leq i\leq M\)), \(t_{n}=n\tau\) (\(0\leq n\leq N\)), \(\Omega_{h}=\{ x_{i}|0\leq i\leq M\}\), \(\Omega_{\tau}=\{t_{n}|0\leq n\leq N\}\), \((i,n)=(x_{i},t^{n})\), and then the domain \([0,L]\times[0,T]\) is covered by \(\Omega_{h}\times\Omega_{\tau}\). Let \(V_{h}=\{u_{i}^{n}|0\leq i\leq M, 0\leq n\leq N\}\) be the grid function on the mesh \(\Omega_{h}\times\Omega_{\tau}\), \(U_{i}^{n}=u(x_{i},t^{n})\) and \(u_{i}^{n}\) denote the exact and numerical solutions at the point \((i,n)\), respectively, and \(U^{n}=(U_{1}^{n}, U_{2}^{n},\ldots, U_{M}^{n})^{T}, u^{n}=(u_{1}^{n}, u_{2}^{n},\ldots, u_{M}^{n})^{T}\).

Lemma 1

Suppose \(u(x)\in C^{(8,2)}([x_{i-3},x_{i+3}]\times[0,T])\) and define two operators \(\psi_{1}, \psi_{2}\) such that

$$ \left \{ \textstyle\begin{array}{@{}l} \psi_{1} U_{i}^{n}=\frac{ 1}{ h^{3}}(\frac{ 1}{ 8}U_{i-3}^{n} -U_{i-2}^{n}+\frac{ 13}{ 8}U_{i-1}^{n} -\frac{ 13}{ 8}U_{i+1}^{n}+U_{i+2}^{n} -\frac{ 1}{ 8}U_{i+3}^{n}),\\ \psi_{2}U_{i}^{n}=\frac{ 1}{ h^{4}}(-\frac{ 1}{ 6}U_{i-3}^{n}+2U_{i-2}^{n}-\frac{ 13}{ 2}U_{i-1}^{n}+\frac{ 28}{ 3}U_{i}^{n}-\frac{ 13}{ 2}U_{i+1}^{n}+2U_{i+2}^{n}-\frac{ 1}{ 6}U_{i+3}^{n}), \end{array}\displaystyle \right . $$
(3)

where \(U_{i}^{n}=u(x_{i},t^{n})\). Then

$$ \left \{ \textstyle\begin{array}{@{}l} |u_{xxx}(x_{i},t^{n})-\psi_{1} U_{i}^{n}|\leq\frac{ 7}{ 120}\max_{x_{i-3}\leq x\leq x_{i+3}}|u^{(7)}_{x}(x,t)|h^{4},\\ |u_{xxxx}(x_{i},t^{n})-\psi_{2} U_{i}^{n}|\leq\frac{ 7}{ 240}\max_{x_{i-3}\leq x\leq x_{i+3}}|u^{(8)}_{x}(x,t)|h^{4}. \end{array}\displaystyle \right . $$
(4)

The proof of Lemma 1 can be completed by applying the expansion of Taylor’s formula to the right term of Eq. (3).

Lemma 2

[16], Lemma 2.1 (The L1 formula)

Suppose that \(0<\alpha<1\) and \(u(t)\in C^{2}[0,t_{n}]\). Then

$$\begin{aligned} &\Biggl\vert \frac{ 1}{ \Gamma(1-\alpha)} \int _{0}^{t_{n}}\frac{ u'(s)}{ (t_{n}-s)^{\alpha}}\,ds-\frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha )} \\ &\qquad{}\times\Biggl[a_{0}^{(\alpha)} u(t_{n})-\sum _{k=1}^{n-1}\bigl(a_{n-k-1}^{(\alpha)}-a_{n-k}^{(\alpha )} \bigr)u(t_{k})-a_{n-1}^{(\alpha)} u(t_{0})\Biggr] \Biggr\vert \\ &\quad\leq\frac{ 1}{ \Gamma(2-\alpha)}\biggl[\frac { 1-\alpha}{ 12} +\frac{ 2^{2-\alpha}}{ 2-\alpha}- \bigl(1+2^{-\alpha}\bigr)\biggr]\max_{t_{0}\leq t\leq t_{n}}\bigl\vert u^{\prime\prime}(t)\bigr\vert \tau^{2-\alpha}, \end{aligned}$$
(5)

where \(t_{0}=0\), \(a_{k}^{(\alpha)}=(k+1)^{1-\alpha}-k^{1-\alpha}, k\geq0\).

Lemma 3

[21], Lemma 1.4.8

Suppose that \(0<\alpha<1\) and \(a_{k}^{(\alpha)}, k\geq0\), are defined as in Lemma  2. Then

$$ \left \{ \textstyle\begin{array}{@{}l} 1=a_{0}^{(\alpha)}>a_{1}^{(\alpha)}>a_{2}^{(\alpha)}>\cdots>a_{k}^{(\alpha)}>\cdots>0,\quad \lim_{k\rightarrow\infty}a_{k}^{(\alpha)}=0,\\ (1-\alpha)k^{-\alpha}< a_{k-1}^{(\alpha)}< (1-\alpha)(k-1)^{-\alpha}. \end{array}\displaystyle \right . $$
(6)

In order to establish the finite difference scheme for solving problems (1)-(2), we rewrite Eq. (1) in the following form:

$$ {}^{C}_{0}D^{\alpha}_{t}u(x,t)=a'(x)u_{xxx}+a(x)u_{xxxx}+f(x,t),\quad 0< \alpha< 1, $$
(7)

Due to Lemmas 1 and 2, at the point \((i,n)\), we obtain

$$ \begin{aligned}[b] &\frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha )}\Biggl[a_{0}^{(\alpha)} U_{i}^{n}- \sum_{k=1}^{n-1}\bigl(a_{n-k-1}^{(\alpha)}-a_{n-k}^{(\alpha)} \bigr)U_{i}^{k}- a_{n-1}^{(\alpha)} U_{i}^{0}\Biggl]\\ &\quad=a'_{i} \psi_{1} U_{i}^{n}+a_{i} \psi_{2} U_{i}^{n}+f_{i}^{n}+R_{i}^{n}( \tau,h), \end{aligned} $$
(8)

where \(a'_{i}=a'(x_{i}), a_{i}=a(x_{i})\), \(f_{i}^{n}=f(x_{i},t^{n})\), \(\psi_{1}, \psi _{2}\) are defined as in Lemma 1, and

$$\begin{aligned} \bigl\vert R_{i}^{n}(\tau,h)\bigr\vert \leq{}& \frac{ 1}{ \Gamma(2-\alpha)}\biggl[\frac{ 1-\alpha}{ 12} +\frac{ 2^{2-\alpha}}{ 2-\alpha}- \bigl(1+2^{-\alpha}\bigr)\biggr]\max_{t_{0}\leq t\leq t_{n}}\bigl\vert u_{t}^{\prime\prime}(x,t)\bigr\vert \tau^{2-\alpha} \\ &{}+\frac{ 7}{ 120}\max_{0\leq x\leq L}\bigl\vert u^{(7)}_{x}(x,t)\bigr\vert h^{4}+ \frac{ 7}{ 240}\max_{0\leq x\leq L}\bigl\vert u^{(8)}_{x}(x,t) \bigr\vert h^{4}. \end{aligned}$$

So the finite difference scheme approximating Eq. (1) at the point \((i,n)\) under conditions (2) can be established as follows:

$$ \left \{ \textstyle\begin{array}{@{}l} \frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha)}[a_{0}^{(\alpha)} u_{i}^{n}-\sum_{k=1}^{n-1}(a_{n-k-1}^{(\alpha )}-a_{n-k}^{(\alpha)})u_{i}^{k}-a_{n-1}^{(\alpha)} u_{i}^{0}]\\ \quad=a'_{i}\psi_{1} u_{i}^{n}+a_{i}\psi_{2} u_{i}^{n}+f_{i}^{n},\quad 1\leq n\leq N,\\ u_{i}^{0}=\varphi(x_{i}),\\ u_{i}^{n}=u_{i\pm M}^{n},\quad 1\leq i\leq M, 1\leq n\leq N. \end{array}\displaystyle \right . $$
(9)

Combining (8) and (9), we can obtain that the local truncating error \(R_{i}^{n}(\tau,h)=O(\tau^{2-\alpha}+h^{4})\).

3 Unique solvability of the difference scheme

In this section, we research the unique solvability of the difference scheme (9) by use of the Fourier analysis method. To this end, the first equation in (9) can be rewritten as follows:

$$ \bigl[s -24h^{4}\bigl(a'_{i} \psi_{1}+a_{i}\psi_{2}\bigr)\bigr]u_{i}^{n}= \sum_{k=0}^{n-1}b_{k}^{n}u_{i}^{k}+24h^{4}f_{i}^{n}, \quad 1\leq i\leq M, $$
(10)

where \(s=\frac{ 24h^{4}\tau^{-\alpha}}{ \Gamma(2-\alpha)}\), \(b_{0}^{n}=s a_{n-1}^{(\alpha)}, b_{k}^{n}=s(a_{n-k-1}^{(\alpha)}-a_{n-k}^{(\alpha)}), k=1,2,\ldots,n-1\), \((a'_{i}\psi_{1}+a_{i}\psi_{2})u_{i}^{n}=\frac{ 1}{ 24h^{4}}[\lambda_{i,i-3}u_{i-3}^{n}+\lambda_{i,i-2}u_{i-2}^{n}+\lambda _{i,i-1}u_{i-1}^{n}+\lambda_{i,i}u_{i}^{n}+\lambda_{i,i+1}u_{i+1}^{n}+\lambda _{i,i+2}u_{i+2}^{n}+\lambda_{i,i+3}u_{i+3}^{n}], 1\leq i\leq M\), \(u_{i}^{n}=u_{i\pm M}^{n}\), and

$$ \left \{ \textstyle\begin{array}{@{}l} \lambda_{i,i}=224a_{i},\\ \lambda_{i,i+1}=-39ha'_{i}-156a_{i},\\ \lambda_{i,i+2}=24ha'_{i}+48a_{i},\\ \lambda_{i,i+3}=-3ha'_{i}-4a_{i},\\ \lambda_{i,i-1}=39ha'_{i}-156a_{i},\\ \lambda_{i,i-2}=-24ha'_{i}+48a_{i},\\ \lambda_{i,i-3}=3ha'_{i}-4a_{i}, \end{array}\displaystyle \right .\quad i=1,2, \ldots,M. $$
(11)

Let \(v^{n}(x), z^{n}(x)\) be two periodic functions with period L, and denote their restrictions on \([0,L]\) by

$$\begin{aligned}& v^{n}(x)=\left \{ \textstyle\begin{array}{@{}l@{\quad}l} u_{i}^{n},& x\in[x_{i-1},x_{i+\frac{1}{2}}), i=1,2,\ldots,M-1,\\ u_{M}^{n},& x\in[x_{M-1},x_{M}], \end{array}\displaystyle \right . \\& z^{n}(x)=\left \{ \textstyle\begin{array}{@{}l@{\quad}l} f_{i}^{n},& x\in[x_{i-1},x_{i}), i=1,2,\ldots,M-1,\\ f_{M}^{n},& x\in[x_{M-1},x_{M}]. \end{array}\displaystyle \right . \end{aligned}$$

Furthermore, let the expansions of the Fourier series of \(v^{n}(x) \) and \(z^{n}(x)\) be

$$ v^{n}(x)=\sum_{l=-\infty}^{\infty} \widetilde{v}_{l}^{n}\exp \biggl(\frac{ 2\pi lxj}{ L}\biggr), \qquad z^{n}(x)=\sum_{l=-\infty}^{\infty} \widetilde{z}_{l}^{n} \exp\biggl(\frac{ 2\pi lxj}{ L}\biggr), $$
(12)

where

$$\widetilde{v}_{l}^{n}=\frac{ 1}{ L} \int_{0}^{L} v^{n}(x)\exp\biggl(- \frac{ 2\pi lxj}{ L}\biggr)\,dx,\qquad \widetilde{z}_{l}^{n}= \frac{ 1}{ L} \int_{0}^{L} z^{n}(x)\exp\biggl(- \frac{ 2\pi lxj}{ L}\biggr)\,dx, $$

and j denotes the imaginary unit.

Define the discrete \(L_{2}\) norm by

$$\bigl\Vert u^{n}\bigr\Vert _{2}=\Biggl(\sum _{i=1}^{M}h\bigl\vert u_{i}^{n} \bigr\vert ^{2}\Biggr)^{\frac{1}{2}}. $$

Then the following equalities hold according to the Parseval identity:

$$\begin{aligned}& \bigl\Vert u^{n}\bigr\Vert _{2}=\biggl( \int_{0}^{L}\bigl\vert v^{n}(x)\bigr\vert ^{2}\,dx\biggr)^{\frac{1}{2}}=\Biggl(\sum _{l=-\infty}^{\infty}\bigl\vert \widetilde{v}_{l}^{n} \bigr\vert ^{2}\Biggr)^{\frac{1}{2}}, \\& \bigl\Vert f^{n}\bigr\Vert _{2}=\biggl( \int_{0}^{L}\bigl\vert z^{n}(x)\bigr\vert ^{2}\,dx\biggr)^{\frac{1}{2}}=\Biggl(\sum _{l=-\infty}^{\infty}\bigl\vert \widetilde{z}_{l}^{n} \bigr\vert ^{2}\Biggr)^{\frac{1}{2}}. \end{aligned}$$

Substituting (12) into (11) yields that

$$\begin{aligned} &\sum_{l=-\infty}^{\infty}\bigl\{ \bigl[s -24h^{4}\bigl(a'_{i}\psi_{1}+a_{i} \psi_{2}\bigr)\bigr]\exp(\beta xj)\bigr\} \widetilde{v}_{l}^{n} \\ &\quad= \sum_{l=-\infty}^{\infty} \Biggl[\sum _{k=0}^{n-1}b_{k}^{n} \widetilde{v}_{l}^{k}\exp(\beta xj)+24h^{4} \widetilde{z}_{l}^{n}\exp(\beta xj)\Biggr], \end{aligned}$$
(13)

where \(\beta=\frac{ 2\pi l}{ L}\), and

$$\begin{aligned} &24h^{4}\bigl(a'_{i} \psi_{1}+a_{i}\psi_{2}\bigr)\exp(\beta xj) \\ &\quad=\exp(\beta xj)\bigl[\lambda_{i,i-3}\exp(-3\beta hj)+ \lambda_{i,i-2}\exp(-2\beta hj)+\lambda_{i,i-1}\exp(-\beta hj)+ \lambda_{i,i} \\ &\qquad{}+\lambda_{i,i+1}\exp(\beta hj)+\lambda_{i,i+2}\exp(2\beta hj)+\lambda _{i,i+3}\exp(3\beta hj)\bigr] \\ &\quad=\exp(\beta xj) (y_{1}+y_{2}j), \end{aligned}$$
(14)

where

$$\begin{aligned} y_{1}&=\bigl[224-8\cos(3\beta h)+96\cos(2\beta h)-312\cos(\beta h) \bigr]a_{i} \\ &=-32a_{i}\bigl[\cos^{3}(\beta h)-6\cos^{2}(\beta h)+9\cos^{3}(\beta h)-7\bigr], \\ y_{2}&=h\bigl[-78\sin(\beta h)+48\sin(2\beta h)-6\sin(3\beta h) \bigr]a'_{i}. \end{aligned}$$

Since \(a_{i}<0\), we can deduce that \(y_{1}\) is indeed nondecreasing with respect to \(\cos(\beta h)\), which implies that \(y_{1}\leq96a_{i}<0\).

Due to the previous observations, we can get that

$$ \sum_{l=-\infty}^{\infty} \bigl[(s-y_{1}-y_{2}j)\widetilde {v}_{l}^{n} \bigr]\exp(\beta xj)=\sum_{l=-\infty}^{\infty}\Biggl[ \sum_{k=0}^{n-1}b_{k}^{n} \widetilde{v}_{l}^{k} +24h^{4}\widetilde{z}_{l}^{n} \Biggr]\exp(\beta xj). $$
(15)

Multiplying both sides of (15) by \(\exp(-\beta xj)\) and integrating from 0 to L, we get that

$$ (s-y_{1}-y_{2}j)\widetilde{v}_{l}^{n}= \sum_{k=0}^{n-1}b_{k}^{n} \widetilde{v}_{l}^{k}+24h^{4}\widetilde{z}_{l}^{n}, \quad l=0,\pm1,\pm2,\ldots,\pm\infty. $$
(16)

In order to prove the unique solvability of the finite difference scheme (9), we only need to prove that there is only the zero solution for the following homogeneous difference equation:

$$ \left \{ \textstyle\begin{array}{@{}l} \frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha)} u_{i}^{n}-a'_{i}\psi_{1} u_{i}^{n}-a_{i}\psi_{2} u_{i}^{n}=0, \quad 1\leq n\leq N,\\ u_{i}^{0}=\varphi(x_{i}),\\ u_{i}^{n}=u_{i\pm M}^{n}, \quad 1\leq i\leq M, 1\leq n\leq N. \end{array}\displaystyle \right . $$
(17)

On the other hand, similarly to the process above, the following equation can be obtained due to (17):

$$ (s-y_{1}-y_{2}j)\widetilde{v}_{l}^{n}=0, $$
(18)

which implies that \(\widetilde{v}_{l}^{n}=0\) since \(|s-y_{1}-y_{2}j|=\sqrt{(s-y_{1})^{2}+y_{2}^{2}}>0\). Furthermore, \(v^{n}(x)=0\) and \(\|u^{n}\|_{2}=0\), which implies that \(u_{i}^{n}=0, i=1,2,\ldots,M\). So there is only the zero solution for the homogeneous difference equation (17). Then we have the following theorem.

Theorem 1

The finite difference scheme (9) is uniquely solvable.

4 Stability and convergence

In this section, we analyze the stability and convergence for the finite difference scheme (9).

Lemma 4

For Eq. (16), we have the estimate

$$ \bigl\vert \widetilde{v}_{l}^{n}\bigr\vert \leq(1+ \tau)^{n}\Bigl(\bigl\vert \widetilde{v}_{l}^{0} \bigr\vert +\max_{1\leq s\leq n}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr). $$
(19)

Proof

We use mathematical induction method to prove (19).

When \(n=1\), due to (16), we obtain

$$(s-y_{1}-y_{2}j)\widetilde{v}_{l}^{1}=b_{0}^{1} \widetilde{v}_{l}^{0}+24h^{4}\widetilde{z}_{l}^{1} =s\widetilde{v}_{l}^{0}+24h^{4} \widetilde{z}_{l}^{1}, $$

which implies that

$$\begin{aligned} \bigl\vert \widetilde{v}_{l}^{1}\bigr\vert &=\biggl\vert \frac{ s\widetilde{v}_{l}^{0}+24h^{4}\widetilde{z}_{l}^{1}}{ s-y_{1}-y_{2}j}\biggr\vert \\ &\leq\frac{ s}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\bigl\vert \widetilde{v}_{l}^{0} \bigr\vert +\frac{ 24h^{4}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\bigl\vert \widetilde{z}_{l}^{1} \bigr\vert \\ &\leq\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert + \Gamma(2-\alpha)\tau^{\alpha}\bigl\vert \widetilde {z}_{l}^{1} \bigr\vert \\ &\leq\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert + \tau^{\alpha}\bigl\vert \widetilde{z}_{l}^{1}\bigr\vert . \end{aligned}$$

If \(\tau\geq1\), then \(\tau^{\alpha}\leq\tau\leq1+\tau\), whereas \(\tau^{\alpha}\leq1 \leq1+\tau\) if \(0<\tau< 1\). So \(\tau^{\alpha}\leq 1+\tau\) for \(\tau>0\). Then

$$\bigl\vert \widetilde{v}_{l}^{1}\bigr\vert \leq\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert +(1+\tau)\bigl\vert \widetilde {z}_{l}^{1}\bigr\vert \leq(1+\tau) \bigl(\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert +\bigl\vert \widetilde{z}_{l}^{1}\bigr\vert \bigr), $$

which implies that (19) holds for \(n=1\).

Suppose that (19) holds for levels \(1,2,\ldots,n-1\). Then, for level n, due to (16), we obtain

$$\begin{aligned} \bigl\vert \widetilde{v}_{l}^{n}\bigr\vert ={}& \biggl\vert \frac{ \sum_{k=0}^{n-1}b_{k}^{n}\widetilde{v}_{l}^{k}+24h^{4}\widetilde {z}_{l}^{n}}{ s-y_{1}-y_{2}j}\biggr\vert \\ \leq{}&\frac{ 1}{ \vert s -y_{1}-y_{2}j\vert }\sum_{k=0}^{n-1} \bigl\vert b_{k}^{n}\bigr\vert \bigl\vert \widetilde {v}_{l}^{k}\bigr\vert +\biggl\vert \frac{ 24h^{4}\widetilde{z}_{l}^{n}}{ s-y_{1}-y_{2}j} \biggr\vert \\ \leq{}&\frac{ 1}{ \vert s -y_{1}-y_{2}j\vert }\sum_{k=0}^{n-1} \bigl\vert b_{k}^{n}\bigr\vert (1+\tau)^{k}\bigl\vert \widetilde {v}_{l}^{0}\bigr\vert + \frac{ 1}{ \vert s -y_{1}-y_{2}j\vert }\sum_{k=0}^{n-1}\Bigl[\bigl\vert b_{k}^{n}\bigr\vert (1+\tau)^{k}\max _{1\leq s\leq k}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr] \\ &{}+\biggl\vert \frac{ 24h^{4}\widetilde{z}_{l}^{n}}{ s-y_{1}-y_{2}j}\biggr\vert \\ ={}& \frac{ 1}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\sum_{k=0}^{n-1}\bigl\vert b_{k}^{n}\bigr\vert (1+\tau )^{k}\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert +\frac{ 1}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}} \sum_{k=0}^{n-1}\Bigl[\bigl\vert b_{k}^{n}\bigr\vert (1+\tau)^{k}\max _{1\leq s\leq k}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr] \\ &{}+\biggl\vert \frac{ 24h^{4}\widetilde{z}_{l}^{n}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\biggr\vert \\ \leq{}&\Bigl(\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert +\max_{1\leq s\leq n-1}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr)\frac{ (1+\tau)^{n-1}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\sum_{k=0}^{n-1} \bigl\vert b_{k}^{n}\bigr\vert +\biggl\vert \frac {24h^{4}\widetilde{z}_{l}^{n}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\biggr\vert . \end{aligned}$$

Since \(\sum_{k=0}^{n-1}|b_{k}^{n}|=s a_{0}^{\alpha}=s\) due to the definition of \(b_{k}^{n}, k=0,1,\ldots,n-1\), and Lemma 3, we have

$$\begin{aligned} \bigl\vert \widetilde{v}_{l}^{n}\bigr\vert &\leq \Bigl( \bigl\vert \widetilde{v}_{l}^{0}\bigr\vert +\max _{1\leq s\leq n-1}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr)\frac{ s(1+\tau)^{n-1}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}+\biggl\vert \frac{ 24h^{4}\widetilde{z}_{l}^{n}}{ \sqrt{(s -y_{1})^{2}+y_{2}^{2}}}\biggr\vert \\ &\leq\Bigl(\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert + \max_{1\leq s\leq n-1}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr) (1+\tau)^{n-1}+\biggl\vert \frac{ 24h^{4}\widetilde{z}_{l}^{n}}{ s}\biggr\vert \\ &= \Bigl(\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert + \max_{1\leq s\leq n-1}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr) (1+\tau)^{n-1}+\Gamma(2-\alpha)\tau ^{\alpha} \bigl\vert \widetilde{z}_{l}^{n}\bigr\vert \\ &\leq\Bigl(\bigl\vert \widetilde{v}_{l}^{0}\bigr\vert + \max_{1\leq s\leq n-1}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr) (1+\tau)^{n-1}+(1+\tau)\bigl\vert \widetilde {z}_{l}^{n}\bigr\vert \\ &\leq (1+\tau)^{n}\Bigl(\bigl\vert \widetilde{v}_{l}^{0} \bigr\vert +\max_{1\leq s\leq n}\bigl\vert \widetilde{z}_{l}^{s} \bigr\vert \Bigr), \end{aligned}$$

which implies that (19) holds. So the proof is complete according to the mathematical induction method. □

Theorem 2

The difference scheme (9) is absolutely stable on the initial value and the right term.

Proof

From Lemma 4 and the Parseval identity we deduce that

$$\begin{aligned} \bigl\Vert u^{n}\bigr\Vert _{2}&\leq(1+ \tau)^{n} \Bigl(\bigl\Vert u^{0}\bigr\Vert _{2}+\max_{1\leq s\leq n}\bigl\Vert f^{s}\bigr\Vert _{2}\Bigr) \\ &\leq e^{n\tau}\Bigl(\bigl\Vert u^{0}\bigr\Vert _{2}+\max_{1\leq s\leq n}\bigl\Vert f^{s}\bigr\Vert _{2}\Bigr) \\ & \leq e^{T}\Bigl(\bigl\Vert u^{0}\bigr\Vert _{2}+\max_{1\leq s\leq n}\bigl\Vert f^{s}\bigr\Vert _{2}\Bigr). \end{aligned}$$
(20)

On the other hand, let \(\widetilde{u}_{i}^{n}, i=1,2,\ldots,M\), be the solutions of the difference equation

$$ \left \{ \textstyle\begin{array}{@{}l} \frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha)}[a_{0}^{(\alpha)} \widetilde{u}_{i}^{n}-\sum_{k=1}^{n-1}(a_{n-k-1}^{(\alpha )}-a_{n-k}^{(\alpha)})\widetilde{u}_{i}^{k}] -a_{n-1}^{(\alpha)} \widetilde{u}_{i}^{0}]\\ \quad=a'_{i}\psi_{1} \widetilde{u}_{i}^{n}+a_{i}\psi_{2} \widetilde{u}_{i}^{n}+\widetilde{f}_{i}^{n},\quad 1\leq n\leq N,\\ \widetilde{u}_{i}^{0}=\widetilde{\varphi}(x_{i}),\\ \widetilde{u}_{i}^{n}=\widetilde{u}_{i\pm M}^{n},\quad 1\leq i\leq M, 1\leq n\leq N. \end{array}\displaystyle \right . $$
(21)

Then, combining (9) and (21), we deduce that

$$\begin{aligned} &\frac{ \tau^{-\alpha}}{ \Gamma(2-\alpha)}\Biggl[a_{0}^{(\alpha)} \bigl(u_{i}^{n}- \widetilde{u}_{i}^{n}\bigr)-\sum _{k=1}^{n-1}\bigl(a_{n-k-1}^{(\alpha)}-a_{n-k}^{(\alpha)} \bigr) \bigl(u_{i}^{k}-\widetilde{u}_{i}^{k} \bigr) -a_{n-1}^{(\alpha)} \bigl(u_{i}^{0}- \widetilde{u}_{i}^{0}\bigr)\Biggr] \\ &\quad=a'_{i} \psi_{1} \bigl(u_{i}^{n}-\widetilde{u}_{i}^{n} \bigr)+a_{i}\psi_{2} \bigl(u_{i}^{n}- \widetilde{u}_{i}^{n}\bigr)+\bigl(f_{i}^{n}- \widetilde{f}_{i}^{n}\bigr),\quad 1\leq n\leq N. \end{aligned}$$
(22)

Similarly to the deduction of (20), we have

$$ \bigl\Vert u^{n}-\widetilde{u}^{n}\bigr\Vert _{2}\leq e^{T}\Bigl(\bigl\Vert u^{0}- \widetilde{u}^{0}\bigr\Vert _{2}+\max_{1\leq s\leq n} \bigl\Vert f^{s}-\widetilde{f}^{s}\bigr\Vert _{2}\Bigr), $$
(23)

which implies that small vibration from the initial value or the right source term also leads to small variation in the solutions. So the finite difference scheme (9) is absolutely stable on the initial value and the right term. The proof is complete. □

Remark 1

If \(a(x)>0\), then from the expression of \(y_{1}\) we can deduce that \(y_{1}>0\), which implies that Lemma 4 may not hold, and then the finite difference scheme (9) may be conditionally stable or be unstable.

In order to investigate the convergence of the finite difference scheme (9), let \(\varepsilon_{i}^{n}=U_{i}^{n}-u_{i}^{n}, i=1,2,\ldots,M, n=0,1,\ldots,N\), denote the deviation between the exact and numerical solutions, and \(\varepsilon^{n}=(\varepsilon_{1}^{n}, \varepsilon_{2}^{n},\ldots, \varepsilon_{M}^{n})^{T}\). Then \(\varepsilon_{i}^{0}=0\), and due to (9)-(11), we have

$$ \bigl[s -24h^{4}\bigl(a'_{i} \psi_{1}+a_{i}\psi_{2}\bigr)\bigr] \varepsilon_{i}^{n}=\sum_{k=0}^{n-1}b_{k}^{n} \varepsilon_{i}^{k} +24h^{4}R_{i}^{n}( \tau,h), $$
(24)

where \(R_{i}^{n}(\tau,h)\) is defined as in Eq. (8).

Similarly to the deduction of (20), we can get that

$$\begin{aligned} \bigl\Vert \varepsilon^{n}\bigr\Vert _{2}& \leq e^{T}\Bigl(\bigl\Vert \varepsilon^{0}\bigr\Vert _{2}+\max_{1\leq s\leq n}\bigl\Vert R^{s}(\tau,h) \bigr\Vert _{2}\Bigr) \\ &=e^{T}\max_{1\leq s\leq n}\bigl\Vert R^{s}( \tau,h)\bigr\Vert _{2}\leq C_{1}\tau^{2-\alpha}+C_{2}h^{4}, \end{aligned}$$
(25)

where

$$\begin{aligned}& C_{1}=\frac{ e^{T}}{ \Gamma(2-\alpha)}\biggl[\frac{ 1-\alpha}{ 12} + \frac{ 2^{2-\alpha}}{ 2-\alpha}-\bigl(1+2^{-\alpha}\bigr)\biggr]\max_{t_{0}\leq t\leq t_{n}} \bigl\vert u_{t}^{\prime\prime}(x,t)\bigr\vert , \\& C_{2}=e^{T}\biggl(\frac{ 7}{ 120}\max _{0\leq x\leq L}\bigl\vert u^{(7)}_{x}(x,t)\bigr\vert +\frac{ 7}{ 240}\max_{0\leq x\leq L}\bigl\vert u^{(8)}_{x}(x,t)\bigr\vert \biggr). \end{aligned}$$

So we arrive at the following theorem.

Theorem 3

The finite difference scheme (9) is convergent with the fourth-order convergence in spatial direction.

5 Numerical experiments

In this section, we carry out numerical experiments to support the theoretical results. For further use, let \(e(\tau,h)=\max_{1\leq n\leq N}|U^{n}-u^{n}|\) and \(Rate_{h}=\frac{ \ln(e(\tau,h_{1})/e(\tau,h_{2}))}{ \ln(h_{1}/h_{2})}\) denote the maximum error and the convergence order in spatial direction, respectively.

Example 1

Consider problems (1)-(2) with an exact analytical solution \(u(x,t)=(t^{5}+1)\sin(2\pi x)\), \(L=1\), which satisfies

$$\left \{ \textstyle\begin{array}{@{}l} a(x)=-(x^{2}+2),\\ u(x,0)=\varphi(x)=\sin(2\pi x),\\ f(x,t)=-16\pi^{3} x(t^{5}+1)\cos(2\pi x)\\ \hphantom{f(x,t)=}{}+[32\pi^{4} (t^{5}+1)+16\pi^{4} x^{2}(t^{5}+1)+\frac{ 120t^{5-\alpha}}{ \Gamma(6-\alpha)}]\sin(2\pi x). \end{array}\displaystyle \right . $$

In Figures 1-2, the approximating errors and states between the exact solutions and numerical solutions are shown, whereas in Tables 1 and 2, the maximum errors and convergence orders in spatial directions with \(t\in[0,0.1]\) are listed.

Figure 1
figure 1

Errors with \(\pmb{h=1/50}\) ; \(\pmb{\tau=0.01}\) ; \(\pmb{\alpha=0.7}\) .

Figure 2
figure 2

Comparison between exact solutions and numerical solutions with \(\pmb{\alpha=0.7}\) , \(\pmb{h=1/50}\) , \(\pmb{\tau=0.01}\) , \(\pmb{t=0.2}\) .

Table 1 The maximum errors and convergence order in spatial direction with \(\pmb{\tau=10^{-3}}\)
Table 2 The maximum errors and convergence order in spatial direction with \(\pmb{\tau=10^{-2}}\)

Example 2

Consider problems (1)-(2) with an exact analytical solution \(u(x,t)=(t^{2}+1)\sin(2\pi x)\), \(L=1\), and

$$\left \{ \textstyle\begin{array}{@{}l} a(x)=-(x^{2}+2),\\ u(x,0)=\varphi(x)=\sin(2\pi x),\\ f(x,t)=-16\pi^{3} x(t^{2}+1)\cos(2\pi x)+[32\pi^{4} (t^{2}+1)+16\pi^{4} x^{2}(t^{2}+1)+\frac{ 2t^{2-\alpha}}{ \Gamma(3-\alpha)}]\sin(2\pi x). \end{array}\displaystyle \right . $$

Comparison between the exact and numerical solutions and the approximating errors under different conditions are shown in Figures 3-4, whereas the maximum errors and convergence orders in spatial directions with \(t\in[0,0.1]\) are listed in Tables 3 and 4.

Figure 3
figure 3

Errors with \(\pmb{h=1/40}\) ; \(\pmb{\tau=0.01}\) ; \(\pmb{\alpha=0.5}\) .

Figure 4
figure 4

Comparison between exact solutions and numerical solutions with \(\pmb{\alpha=0.5}\) , \(\pmb{h=1/40}\) , \(\pmb{\tau=0.01}\) , \(\pmb{t=0.1}\) .

Table 3 The maximum errors and convergence orders in spatial direction with \(\pmb{\tau=10^{-3}}\)
Table 4 The maximum errors and convergence orders in spatial direction with \(\pmb{\tau=10^{-2}}\)

Example 3

Consider problems (1)-(2) with an exact analytical solution \(u(x,t)=(3+t+t^{2-\alpha})\ln(\cos x+3)\), \(L=2\pi\), and

$$\left \{ \textstyle\begin{array}{@{}l} a(x)=-e^{x}-1,\\ u(x,0)=\varphi(x)=3\ln(\cos x+3),\\ f(x,t)=[\frac{ t^{1-\alpha}}{ \Gamma(2-\alpha)}+\frac{ \Gamma(3-\alpha)t^{2-2\alpha }}{ \Gamma(3-2\alpha)}]\ln(\cos x+3)\\ \hphantom{f(x,t)=}{}+e^{x}[\frac{ (3+t+t^{2-\alpha})\sin x}{ 3+\cos x}-\frac{ 3(3+t+t^{2-\alpha})\cos x\sin x}{ (3+\cos x)^{2}}-\frac{ 2(3+t+t^{2-\alpha})\sin^{3} x}{ (3+\cos x)^{3}}]\\ \hphantom{f(x,t)=}{} +(e^{x}+2)[\frac{ (3+t+t^{2-\alpha })\cos x}{ 3+\cos x}+\frac{ (3+t+t^{2-\alpha})(4\sin^{2} x-3\cos ^{2}x)}{ (3+\cos x)^{2}}\\ \hphantom{f(x,t)=}{} -\frac{ 12(3+t+t^{2-\alpha})\cos x\sin^{2} x}{ (3+\cos x)^{3}}-\frac{ 6(3+t+t^{2-\alpha})\sin^{4} x}{ (3+\cos x)^{4}}]. \end{array}\displaystyle \right . $$

The maximum errors and convergence orders in spatial directions with \(\tau=10^{-3}\) and \(t\in[0,0.05]\) are listed in Table 5.

Table 5 The maximum errors and convergence orders in spatial direction with \(\pmb{\tau =10^{-3}}\) and \(\pmb{t\in[0,0.05]}\)

Example 4

Consider problems (1)-(2) with an exact analytical solution \(u(x,t)=(2+t^{3-\alpha})(\cos x+2)e^{\cos x}\), \(L=2\pi\), and

$$\left \{ \textstyle\begin{array}{@{}l} a(x)=\sin x-4,\\ u(x,0)=\varphi(x)=2(\cos x+2)e^{\cos x},\\ f(x,t)=\frac{ \Gamma(4-\alpha)t^{3-2\alpha}}{ \Gamma(4-2\alpha)}(\cos x+2)e^{\cos x})-e^{\cos x}\cos x\\ \hphantom{f(x,t)=}{}\times [\sin x+6 \cos x \sin x-3 \sin^{3} x-(2+\cos x) \sin^{3} x+(3 (2+\cos x))\sin x \cos x\\ \hphantom{f(x,t)=}{} +(2+\cos x) \sin x]-e^{\cos x}(\sin x-4)[\cos x-8 \sin^{2} x-18 \cos x \sin ^{2} x\\ \hphantom{f(x,t)=}{}+6 \cos^{2} x+4 \sin^{4} x+(2+\cos x) \sin^{4} x-6 (2+\cos x) \sin^{2} x \cos x\\ \hphantom{f(x,t)=}{}+3 (2+\cos x) \cos^{2} x-4 (2+\cos x) \sin^{2} x+(2+\cos x) \cos x]. \end{array}\displaystyle \right . $$

In Table 6, the maximum errors and convergence orders in spatial directions with \(\tau=10^{-4}\) and \(t\in[0,0.01]\) are listed, whereas in Figures 5-6, comparison between the exact and numerical solutions is shown under certain conditions.

Figure 5
figure 5

The exact solutions with \(\pmb{h=1/40}\) ; \(\pmb{\tau=10^{-4}}\) ; \(\pmb{\alpha=0.85}\) .

Figure 6
figure 6

The numerical solutions with \(\pmb{h=1/40}\) ; \(\pmb{\tau=10^{-4}}\) ; \(\pmb{\alpha=0.85}\) .

Table 6 The maximum errors and convergence orders in spatial direction with \(\pmb{\tau =10^{-4}}\) and \(\pmb{t\in[0,0.01]}\)

From Figures 1-6 we can see that the numerical solutions can well approximate the exact solutions with small errors, and the results in Tables 1-6 show that the convergence order in spatial direction is about of fourth order, which is in accordance with the theoretical analysis.

6 Conclusions

In this paper, we have developed a unconditionally stable finite difference scheme with spatial fourth-order accuracy for a class of time fractional parabolic equations with variable coefficient and proved the unique solvability, stability, and convergence of it by use of the Fourier analysis method. Numerical experiments for supporting the theoretical analysis results were carried out. It is worth noting that for fractional differential equations with periodic boundary conditions, higher-order difference schemes can be also developed, provided that the approximating orders in Lemma 1 increase.