1 Introduction

B-Spline collocation methods are a family of important methods for solving singularly perturbed initial/boundary value problems. These methods not only give the numerical solutions of singular perturbation problems, but also give the continuously differentiable approximate solutions. There are many literatures using B-spline methods to solve singularly perturbed initial/boundary value problems, such as Blatov et al. [2], Kadalbajoo et al. [8,9,10,11], Lodhi and Mishra [15], Luo et al. [16], Shivhare et al. [18, 19], Singh et al. [20]. However, as far as we know, there is no literature using B-spline collocation method to solve singular perturbation problems with non-smooth data (discontinuous source term/convection coefficient).

In this paper, we present a quadratic B-spline collocation method to solve the following singularly perturbed semilinear reaction–diffusion problem with a discontinuous source term:

$$\begin{aligned} \left\{ \begin{array}{ll} Tu(x)\equiv -\varepsilon u''(x)+b(x,u)=f(x), &{} \quad x\in (0,d)\cup (d,1),\\ u\left( x-\right) =u\left( x+\right) , &{}\quad x=d,\\ \sqrt{\varepsilon }\left( u'\left( x-\right) -u'\left( x+\right) \right) =0, &{} \quad x=d,\\ u(0)=\gamma _{0},\ u(1)=\gamma _{1}, \end{array} \right. \end{aligned}$$
(1.1)

where \(0<\varepsilon \ll 1\) is a small parameter, \(\gamma _{0}\) and \(\gamma _{1}\) are two constants, b is a sufficiently smooth function satisfying \(b_{u}\ge \beta >0\) on \([0,1]\times {\mathbb {R}}\), f(x) is a smooth function on \([0,d)\cup (d,1]\) while it has a discontinuity at \(x=d\). It is shown in [3] that the problem (1.1) has a unique solution \(u(x)\in C^{1}[0,1]\cap C^{n+2}((0,d)\cup (d,1))\) if \(f(x)\in C^{n}((0,d)\cup (d,1))\) for \(n\ge 0\). The semilinear problem (1.1) can be rewritten as

$$\begin{aligned} \left\{ \begin{array}{ll} Lu(x)\equiv -\varepsilon u''(x)+b_{u}(x,\theta (x)u)u(x)=f(x)-b(x,0), &{} \quad x\in (0,d)\cup (d,1),\\ u\left( x-\right) =u\left( x+\right) , &{} \quad x=d,\\ \sqrt{\varepsilon }\left( u'\left( x-\right) -u'\left( x+\right) \right) =0, &{}\quad x=d,\\ u(0)=\gamma _{0},\ u(1)=\gamma _{1}, \end{array} \right. \end{aligned}$$
(1.2)

where \(0<\theta (x)<1\). It has been proved in [3] that the maximum principle for (1.2) holds true. The stability result is derived in [3] using the maximum principle as follow

$$\begin{aligned} \max _{0\le x\le 1}\left| u(x)\right| \le \beta ^{-1}\left( \max _{0\le x\le 1}\left| b(x,0)\right| +\max _{0\le x\le 1}\left| f(x)\right| \right) . \end{aligned}$$

Furthermore, using the maximum principle and the inequality estimation techniques, it is proved in [3, Lemma 1] that the exact solution u(x) and its derivatives satisfy the following bounds

$$\begin{aligned} \left| u^{(k)}(x)\right| \le \left\{ \begin{array}{ll} C\left[ 1+\varepsilon ^{-k/2}e^{-\beta x/\sqrt{\varepsilon }}+\varepsilon ^{-k/2}e^{-\beta (d-x)/\sqrt{\varepsilon }}\right] , &{} x\in (0,d),\ k=0,1,\dots ,q,\\ C\left[ 1+\varepsilon ^{-k/2}e^{-\beta (1-x)/\sqrt{\varepsilon }}+\varepsilon ^{-k/2}e^{-\beta (x-d)/\sqrt{\varepsilon }}\right] , &{} x\in (d,1),\ k=0,1,\dots ,q, \end{array} \right. \nonumber \\ \end{aligned}$$
(1.3)

where C is a sufficiently large positive constant, the maximal order q depends on the smoothness of function f(x) on \([0,d)\cup (d,1]\).

The existing literatures mainly use the finite difference methods on layer adapted meshes to solve the singularly perturbed problems with non-smooth data (see for example [1, 4,5,6,7, 12, 13]). So far, the B-spline collocation method has not been applied to solve the singularly perturbed problem with non-smooth data.

The aim of this work is to study the possibility of using a quadratic B-spline collocation method on a Shishkin-type mesh for solving the singularly perturbed problem with a discontinuous source term (1.1). The singular perturbation parameter and the discontinuous source term lead to the existence of boundary and interior layers in the exact solution, and a jump in the second-order derivative of the exact solution at the discontinuous point. Since the second-order derivative of the exact solution is discontinuous, the collocation equation at the discontinuous point cannot be obtained directly from the first equation in (1.1). On a Shishkin-type mesh, we construct the quadratic B-spline collocation equations on the left and right sides of the discontinuous point by using the method given in [14], respectively. Then, combined with the conditions satisfied at the the discontinuous point, the collocation equations are obtained at the discontinuous point. By solving the collocation equations, we can get the approximate solution with piecewise quadratic differentiability. It is proved that the scheme is stable and almost second-order uniformly convergent. Numerical experiments support the theoretical results. As far as we know, this is the first time that the B-spline method is applied to solve the singularly perturbed problems with non-smooth data.

Notation. Throughout the paper, C stands for a generic positive constant independent of the discretization parameter N and C in different places can represent different constants. To simplify the notation, \(g_{i}=g(x_{i})\) and \(g_{i-1/2}=g((x_{i-1}+x_{i})/2)\) for any function g are denoted on [0, 1] and \(\left\| \cdot \right\| \) is denoted as the (pointwise) maximum norm on [0, 1].

2 Discretization Scheme

In this section, we construct a discretization scheme based on a quadratic B-spline collocation method to solve the singularly perturbed semilinear reaction–diffusion problem with discontinuous source term. Since problem (1.1) has boundary and interior layers, we use a Shishkin-type mesh to adapt the boundary and interior layers. Let N be the discretization parameter divisible by 8 and the mesh transition parameters \(\sigma _{1}\) and \(\sigma _{2}\) be defined as

$$\begin{aligned} \sigma _{1}=\min \left\{ \frac{d}{4},\frac{4\sqrt{\varepsilon }}{\beta } \ln N\right\} ,\ \ \ \ \sigma _{2}=\min \left\{ \frac{1-d}{4},\frac{4\sqrt{\varepsilon }}{\beta } \ln N\right\} . \end{aligned}$$

Then the domain [0, 1] can be divided into six subintervals \(\left[ 0,\sigma _{1}\right] , \left[ \sigma _{1},d-\sigma _{2}\right] , \left[ d-\sigma _{2},d\right] , \left[ d,d+\sigma _{2}\right] , \left[ d+\right. \) \(\left. \sigma _{2},1-\sigma _{1}\right] \) and \([1-\sigma _{1},1]\). \(\frac{N}{8}\) mesh elements are placed in each of the subintervals \(\left[ 0,\sigma _{1}\right] , \left[ d-\sigma _{2},d\right] , \left[ d,d+\right. \) \(\left. \sigma _{2}\right] , [1-\sigma _{1},1]\) and \(\frac{N}{4}\) mesh elements are placed in each of the subintervals \(\left[ \sigma _{1}, d-\sigma _{2}\right] , \left[ d+\sigma _{2}, 1-\sigma _{1}\right] \) respectively. Let \(\Omega ^{N}=\left\{ x_{i}\left| 0\le i\le N\right. \right\} \) be the constructed Shishkin-type mesh. Thus, the mesh sizes \(h_{i}=x_{i}-x_{i-1}\) for \(1\le i\le N\) satisfy

$$\begin{aligned} h_{i}=\left\{ \begin{array}{ll} \frac{8\sigma _{1}}{N}, &{} i=1,\dots ,\frac{N}{8},\frac{7N}{8},\dots , N,\\ \frac{4\left( d-\sigma _{1}-\sigma _{2}\right) }{N}, &{} i=\frac{N}{8}+1,\dots ,\frac{3N}{8},\\ \frac{8\sigma _{2}}{N}, &{} i=\frac{3N}{8}+1,\dots ,\frac{5N}{8},\\ \frac{4\left( 1-d-\sigma _{1}-\sigma _{2}\right) }{N}, &{} i=\frac{5N}{8}+1,\dots ,\frac{7N}{8}. \end{array} \right. \end{aligned}$$
(2.1)

The quadratic B-spline basis functions \(B_{i}(x)\), as given in [14], are defined as

$$\begin{aligned} B_{0}(x)= & {} \left\{ \begin{array}{ll} \frac{\left( x_{1}-x\right) ^{2}}{h_{1}^{2}}, &{} x_{0}\le x\le x_{1},\\ 0, &{} \textrm{otherwise}, \end{array} \right. \ \ \ B_{1}(x)=\left\{ \begin{array}{ll} \frac{h_{1}^{2}-\left( x_{1}-x\right) ^{2}}{h_{1}^{2}}-\frac{\left( x-x_{0}\right) ^{2}}{\left( h_{1}+h_{2}\right) h_{1}}, &{} x_{0}\le x\le x_{1},\\ \frac{\left( x_{2}-x\right) ^{2}}{\left( h_{1}+h_{2}\right) h_{1}}, &{} x_{1}\le x\le x_{2},\\ 0, &{} \textrm{otherwise}, \end{array} \right. \\ B_{i}(x)= & {} \left\{ \begin{array}{ll} \frac{\left( x-x_{i-2}\right) ^{2}}{\left( h_{i-1}+h_{i}\right) h_{i-1}}, &{} x_{i-2}\le {x}\le x_{i-1},\\ \frac{\left( x-x_{i-2}\right) \left( x_{i}-x\right) }{\left( h_{i-1}+h_{i}\right) h_{i}} +\frac{\left( x_{i+1}-x\right) \left( x-x_{i-1}\right) }{\left( h_{i}+h_{i+1}\right) h_{i}}, &{} x_{i-1}\le x\le x_{i},\\ \frac{\left( x_{i+1}-x\right) ^{2}}{\left( h_{i}+h_{i+1}\right) h_{i+1}}, &{} x_{i}\le x\le x_{i+1},\\ 0, &{} \textrm{otherwise}, \end{array} \right. 2\le i<\frac{N}{2},\frac{N}{2}+2\le i<N, \\ B_{N}(x)= & {} \left\{ \begin{array}{ll} \frac{\left( x_{N-2}-x\right) ^{2}}{\left( h_{N-1}+h_{N}\right) h_{N-1}}, &{} x_{N-2}\le x\le x_{N-1},\\ \frac{h_{N}^{2}-\left( x_{N-1}-x\right) ^{2}}{h_{N}^{2}}-\frac{\left( x-x_{N}\right) ^{2}}{\left( h_{N}+h_{N-1}\right) h_{N}}, &{} x_{N-1}\le x\le x_{N},\\ 0, &{} \textrm{otherwise}, \end{array} \right. \end{aligned}$$

and

$$\begin{aligned} B_{N+1}(x)=\left\{ \begin{array}{ll} \frac{\left( x_{N-1}-x\right) ^{2}}{h_{N}^{2}}, &{} x_{N-1}\le x\le x_{N},\\ 0, &{} \textrm{otherwise}. \end{array} \right. \end{aligned}$$

Since the source term f(x) has a jump at point \(x=d\), the second-order derivative of the exact solution is discontinuous at point \(x=d\), which leads to the special technique that needs to be used to construct the collocation equation at this point. To this end, we introduce the following four basis functions

$$\begin{aligned} B_{N/2}^{-}(x)= & {} \left\{ \begin{array}{llll} \frac{\left( x_{N/2-2}-x\right) ^{2}}{\left( h_{N/2-1}+h_{N/2}\right) h_{N/2-1}}, &{} x_{N/2-2}\le x\le x_{N/2-1},\\ \frac{h_{N/2}^{2}-\left( x_{N/2-1}-x\right) ^{2}}{h_{N/2}^{2}}-\frac{\left( x-x_{N/2}\right) ^{2}}{\left( h_{N/2}+h_{N/2-1}\right) h_{N/2}}, &{} x_{N/2-1}\le x\le x_{N/2},\\ 0, &{} \textrm{otherwise}, \end{array} \right. \\ B_{N/2+1}^{-}(x)= & {} \left\{ \begin{array}{ll} \frac{\left( x_{N/2-1}-x\right) ^{2}}{h_{N/2}^{2}}, &{} x_{N/2-1}\le x\le x_{N/2},\\ 0, &{} \textrm{otherwise}. \end{array} \right. \\ {}{} & {} B_{N/2}^{+}(x)=\left\{ \begin{array}{ll} \frac{\left( x_{N/2+1}-x\right) ^{2}}{h_{N/2+1}^{2}}, &{} x_{N/2}\le x\le x_{N/2+1},\\ 0, &{} \textrm{otherwise}, \end{array} \right. \end{aligned}$$

and

$$\begin{aligned} B_{N/2+1}^{+}(x)= & {} \left\{ \begin{array}{ll} \frac{h_{N/2+1}^{2}-\left( x_{N/2+1}-x\right) ^{2}}{h_{N/2+1}^{2}}-\frac{\left( x-x_{N/2}\right) ^{2}}{\left( h_{N/2+1}+h_{N/2+2}\right) h_{N/2+1}}, &{} x_{N/2}\le x\le x_{N/2+1},\\ \frac{\left( x_{N/2+2}-x\right) ^{2}}{\left( h_{N/2+1}+h_{N/2+2}\right) h_{N/2+1}}, &{} x_{N/2+1}\le x\le x_{N/2+2},\\ 0, &{} \textrm{otherwise}. \end{array} \right. \end{aligned}$$

The approximation solution U(x) to the exact solution u(x) of problem (1.1) is constructed as

$$\begin{aligned} U(x)=\left\{ \begin{array}{ll} U^{(1)}(x), &{}\quad 0\le x\le d,\\ U^{(2)}(x), &{}\quad d\le x\le 1, \end{array} \right. \end{aligned}$$
(2.2)

where

$$\begin{aligned}{} & {} U^{(1)}(x)=\sum _{i=0}^{N/2-1}a_{i}^{(1)}B_{i}(x)+a_{N/2}^{(1)}B_{N/2}^{-}(x)+a_{N/2+1}^{(1)}B_{N/2+1}^{-}, \ \ \ \ \ \ \ \ \ \ \ x\in [0,d], \\{} & {} U^{(2)}(x)=a_{N/2}^{(2)}B_{N/2}^{+}(x)+a_{N/2+1}^{(2)}B_{N/2+1}^{+} +\sum _{i=N/2+2}^{N+1}a_{i}^{(2)}B_{i}(x), \ \ \ \ \ \ \ \ x\in [d,1]. \end{aligned}$$

and they satisfy the following collocation equations

$$\begin{aligned}{} & {} \left\{ \begin{array}{ll} TU^{(1)}(x_{i-1/2})=f_{i-1/2}, &{} 1{\le } i{\le } \frac{N}{2},\\ U^{(1)}(x_{0})=0, \end{array} \right. \ \ \left\{ \begin{array}{ll} TU^{(2)}(x_{i-1/2})=f_{i-1/2}, &{} \frac{N}{2}+1{\le } i{\le } N,\\ U^{(2)}(x_{N})=0, \end{array} \right. \ \ \ \ \nonumber \\ \end{aligned}$$
(2.3)

and

$$\begin{aligned} U^{(1)}(x_{N/2})=U^{(2)}(x_{N/2}),\ \ \ \ \ \sqrt{\varepsilon }\left( \frac{dU^{(1)}}{dx}(x_{N/2}-)-\frac{dU^{(2)}}{dx}(x_{N/2}+)\right) =0, \nonumber \\ \end{aligned}$$
(2.4)

which are equivalent to

$$\begin{aligned} \left\{ \begin{array}{ll} \left[ T^{N}{} \textbf{a}^{(1)}\right] _{i-1/2}=f_{i-1/2}, &{} 1\le i\le \frac{N}{2},\\ a_{N/2+1}^{(1)}=a_{N/2}^{(2)},\\ \sqrt{\varepsilon }\left( -\frac{a_{N/2}^{(1)}}{h_{N/2}}+\frac{a_{N/2+1}^{(1)}}{h_{N/2}}+\frac{a_{N/2}^{(2)}}{h_{N/2+1}}-\frac{a_{N/2+1}^{(2)}}{h_{N/2+1}}\right) =0,\\ \left[ T^{N}{} \textbf{a}^{(2)}\right] _{i-1/2}=f_{i-1/2}, &{} \frac{N}{2}+1\le i\le N,\\ a_{0}^{(1)}=a_{N+1}^{(2)}=0 \end{array} \right. \end{aligned}$$
(2.5)

with \(\textbf{a}^{(1)}=\left( a_{0}^{(1)},\dots ,a_{N/2+1}^{(1)}\right) ^{T}, \textbf{a}^{(2)}=\left( a_{N/2}^{(2)},\dots ,a_{N+1}^{(2)}\right) ^{T}\),

$$\begin{aligned} \left[ T^{N}{} \textbf{a}^{(k)}\right] _{i-1/2}= & {} -\varepsilon \left[ \frac{2\left( a_{i+1}^{(k)}-a_{i}^{(k)}\right) }{h_{i}\left( h_{i}+h_{i+1}\right) } -\frac{2\left( a_{i}^{(k)}-a_{i-1}^{(k)}\right) }{h_{i}\left( h_{i-1}+h_{i}\right) }\right] \nonumber \\{} & {} +b\left( x_{i-1/2},q_{i}^{-}a_{i-1}^{(k)}+\left( 1-q_{i}^{-}-q_{i}^{+}\right) a_{i}^{(k)}+q_{i}^{+}a_{i+1}^{(k)}\right) ,\ \ \ \ \ \ \ k=1,2 \end{aligned}$$

and

$$\begin{aligned} q_{i}^{-}=\frac{h_{i}}{4\left( h_{i-1}+h_{i}\right) }, \ \ \ q_{i}^{+}=\frac{h_{i}}{4\left( h_{i}+h_{i+1}\right) },\ \ \ \ \ h_{0}=h_{N+1}=0. \end{aligned}$$

Let \(\textbf{a}\equiv \left( a_{0},a_{1},\dots ,a_{N+3}\right) ^{T}=\left( a_{0}^{(1)},\dots ,a_{N/2+1}^{(1)},a_{N/2}^{(2)},\dots ,a_{N+1}^{(2)}\right) ^{T}\). Then, the linearized form of discrete Eq. (2.5) can be written as

$$\begin{aligned} L^{N}{} \textbf{a}_{i}\equiv \left\{ \begin{array}{ll} -\varepsilon \left[ \frac{2\left( a_{i+1}-a_{i}\right) }{h_{i}\left( h_{i}+h_{i+1}\right) } -\frac{2\left( a_{i}-a_{i-1}\right) }{h_{i}\left( h_{i-1}+h_{i}\right) }\right] +b_{u}\left( x_{i-1/2},\xi _{i}\right) \left[ q_{i}^{-}a_{i-1}\right. \\ \left. +\left( 1-q_{i}^{-}-q_{i}^{+}\right) a_{i}+q_{i}^{+}a_{i+1}\right] =f_{i-1/2}-b\left( x_{i-1/2},0\right) , &{} i=1,\dots ,N/2,\\ a_{i}-a_{i+1}=0, &{} i=N/2+1,\\ \sqrt{\varepsilon }\left( -\frac{a_{i-2}}{h_{i-2}}+\frac{a_{i-1}}{h_{i-2}}+\frac{a_{i}}{h_{i-1}}-\frac{a_{i+1}}{h_{i-1}}\right) =0, &{} i=N/2+2,\\ -\varepsilon \left[ \frac{2\left( a_{i+1}-a_{i}\right) }{h_{i-2}\left( h_{i-2}+h_{i-1}\right) } -\frac{2\left( a_{i}-a_{i-1}\right) }{h_{i-2}\left( h_{i-3}+h_{i-2}\right) }\right] +b_{u}\left( x_{i-2-1/2},\xi _{i}\right) \\ \cdot \left[ q_{i-2}^{-}a_{i-1}+\left( 1-q_{i-2}^{-}-q_{i-2}^{+}\right) a_{i}+q_{i-2}^{+}a_{i+1}\right] \\ =f_{i-2-1/2}-b\left( x_{i-2-1/2},0\right) , &{} i=N/2+3,\dots ,N+2, \end{array} \right. \nonumber \\ \end{aligned}$$
(2.6)

where \(\xi _{i}=\lambda _{i}\left[ q_{i}^{-}a_{i-1}+\left( 1-q_{i}^{-}-q_{i}^{+}\right) a_{i}+q_{i}^{+}a_{i+1}\right] \) for \(1\le i\le N/2\) and \(\xi _{i}=\lambda _{i}\left[ q_{i-2}^{-} a_{i-1}+\left( 1-q_{i-2}^{-}\right. \right. \) \( \left. \left. -q_{i-2}^{+}\right) a_{i}+q_{i-2}^{+}a_{i+1}\right] \) for \(N/2+3\le i\le N+2\) with \(0<\lambda _{i}<1\).

The following theorem gives the stability of the discrete scheme.

Theorem 2.1

The solution \(\textbf{a}\) of the discretization scheme (2.5) satisfies

$$\begin{aligned} \left\| \textbf{a}\right\| \le C\left\| L^{N}{} \textbf{a}\right\| , \end{aligned}$$

where C is a positive constant independent of N.

Proof

Let

$$\begin{aligned} \left[ \Lambda a\right] _{i}=\left\{ \begin{array}{ll} -\frac{\varepsilon }{b_{u}\left( x_{i-1/2},\xi _{i}\right) \left( 1-q_{i}^{-}-q_{i}^{+}\right) }\left[ \frac{2\left( a_{i+1}-a_{i}\right) }{h_{i}\left( h_{i}+h_{i+1}\right) } -\frac{2\left( a_{i}-a_{i-1}\right) }{h_{i}\left( h_{i-1}+h_{i}\right) }\right] +a_{i}, &{} i=1,\dots ,\frac{N}{2},\\ a_{i}-a_{i+1}, &{} i=\frac{N}{2}+1,\\ \sqrt{\varepsilon }\left( -\frac{a_{i-2}}{h_{i-2}}+\frac{a_{i}}{h_{i-2}}+\frac{a_{i}}{h_{i-1}}-\frac{a_{i+1}}{h_{i-1}}\right) , &{} i=\frac{N}{2}+2,\\ -\frac{\varepsilon }{b_{u}\left( x_{i-2-1/2},\xi _{i}\right) \left( 1-q_{i-2}^{-}-q_{i-2}^{+}\right) } &{} \\ \left[ \frac{2\left( a_{i+1}-a_{i}\right) }{h_{i-2}\left( h_{i-2}+h_{i-1}\right) } -\frac{2\left( a_{i}-a_{i-1}\right) }{h_{i-2}\left( h_{i-3}+h_{i-2}\right) }\right] +a_{i}, &{} i=\frac{N}{2}+3,\dots ,N+2. \end{array} \right. \end{aligned}$$

It is easy to see that \(\Lambda \) is an M-matrix, which implies \(\left\| \Lambda ^{-1}\right\| \le 1\). Then using the similar method given in [14, Theorem 3], we can prove the result of the theorem holds true. \(\square \)

Next we derive the convergence analysis of the quadratic B-spline collocation method.

Theorem 2.2

Let U(x) be the cubic B-spline collocation approximation solution of problem (2.2)–(2.4) and u(x) be the exact solution of problem (1.1). Then we have the following error estimate

$$\begin{aligned} \left\| u(x)-U(x)\right\| \le CN^{-2}\ln ^{2}N, \end{aligned}$$

where C is a positive constant independent of N.

Proof

Let \(Y^{(1)}(x)\) and \(Y^{(2)}(x)\) be the unique quadratic spline interpolation functions to the solution u(x) on [0, d] and [d, 1] respectively, where

$$\begin{aligned}{} & {} Y^{(1)}(x)=\sum _{i=0}^{N/2-1}c_{i}^{(1)}B_{i}(x)+c_{N/2}^{(1)}B_{N/2}^{-}(x)+c_{N/2+1}^{(1)}B_{N/2+1}^{-}, \ \ \ \ \ \ \ \ \ \ \ x\in [0,d],\\{} & {} Y^{(2)}(x)=c_{N/2}^{(2)}B_{N/2}^{+}(x)+c_{N/2+1}^{(2)}B_{N/2+1}^{+} +\sum _{i=N/2+2}^{N+1}c_{i}^{(2)}B_{i}(x), \ \ \ \ \ \ \ \ x\in [d,1] \end{aligned}$$

and

$$\begin{aligned} Y^{(1)}\left( x_{N/2}\right) =Y^{(2)}\left( x_{N/2}\right) , \ \ \ \ \ \ \ \sqrt{\varepsilon }\left( \frac{dY^{(1)}}{dx}\left( x_{N/2}-\right) -\frac{dY^{(2)}}{dx}\left( x_{N/2}+\right) \right) =0. \end{aligned}$$

Following the error estimates given in [14, Theorem 2], we have

$$\begin{aligned} \left\| u(x)-Y^{(1)}(x)\right\| _{[0,d]}\le CN^{-3}\ln ^{3}N, \ \ \ \ \left\| u(x)-Y^{(2)}(x)\right\| _{[d,1]}\le CN^{-3}\ln ^{3}N,\nonumber \\ \end{aligned}$$
(2.7)
$$\begin{aligned} \sqrt{\varepsilon }\left| \left( u-Y^{(1)}\right) '\left( x_{N/2}-\right) \right| \le CN^{-2}\ln ^{2}N, \ \ \ \ \sqrt{\varepsilon }\left| \left( u-Y^{(2)}\right) '\left( x_{N/2}+\right) \right| \le CN^{-2}\ln ^{2}N, \nonumber \\ \end{aligned}$$
(2.8)

and

$$\begin{aligned} \varepsilon \max _{1\le i\le N/2}\left| \left( u-Y^{(1)}\right) _{i-1/2}''\right| \le CN^{-2}\ln ^{2}N,\ \ \varepsilon \max _{N/2+1\le i\le N}\left| \left( u-Y^{(2)}\right) _{i-1/2}''\right| \le CN^{-2}\ln ^{2}N, \nonumber \\ \end{aligned}$$
(2.9)

where we have used the bounds of the exact solution and its derivatives (1.3), the mesh transition parameters \(\sigma _{1}\) and \(\sigma _{2}\), and the mesh sizes (2.1). Let \(\textbf{c}\equiv \left( c_{0},c_{1},\dots ,c_{N+3}\right) ^{T}=\left( c_{0}^{(1)},\dots ,c_{N/2+1}^{(1)},c_{N/2}^{(2)},\dots ,c_{N+1}^{(2)}\right) ^{T}\). Then we have

$$\begin{aligned}{} & {} L^{N}\left( a_{i}-c_{i}\right) \\{} & {} \quad =\left\{ \begin{array}{ll} -\varepsilon \left( u-Y^{(1)}\right) _{i-1/2}''+b_{u}\left( x_{i-1/2},\eta _{i}\right) \left( u-Y^{(1)}\right) _{i-1/2}, &{} i=1,2,\dots ,N/2,\\ \left( u-Y^{(1)}\right) _{i-1}+\left( u-Y^{(2)}\right) _{i-1}, &{} i=N/2+1,\\ \sqrt{\varepsilon }\left( u-Y^{(2)}\right) '\left( x_{i-2}+\right) -\varepsilon \left( u-Y^{(1)}\right) '\left( x_{i-2}-\right) , &{} i=N/2+2,\\ -\varepsilon \left( u-Y^{(2)}\right) _{i-2-1/2}''+b_{u}\left( x_{i-2-1/2},\eta _{i}\right) \left( u-Y^{(2)}\right) _{i-2-1/2}, &{} i=N/2+3,\dots ,N+2, \end{array} \right. \qquad \end{aligned}$$

where \(\eta _{i}=\rho _{i}\left( u-Y^{(1)}\right) _{i-1/2}\) for \(1\le i\le N/2\) and \(\eta _{i}=\rho _{i}\left( u-Y^{(2)}\right) _{i-2-1/2}\) for \(N/2+3\le i\le N+2\) with \(0<\rho _{i}<1\). Thus we can get

$$\begin{aligned} \left\| \textbf{a}-\textbf{c}\right\| \le CN^{-2}\ln ^{2}N, \end{aligned}$$
(2.10)

where we have used Theorem 2.1 and the estimates (2.7)–(2.9). Next, it is easy to see that \(B_{i}(x)\ge 0\),

$$\begin{aligned} \sum _{k=0}^{N/2-1}B_{k}(x)+B_{N/2}^{-}(x)+B_{N/2+1}^{-}=1, \ \ \ \ \ \sum _{k=N/2+2}^{N+1}B_{k}(x)+B_{N/2}^{+}(x)+B_{N/2+1}^{+}=1. \end{aligned}$$

Hence, we can obtain

$$\begin{aligned} \left\| U^{(1)}(x)-Y^{(1)}(x)\right\| \le \left\| \textbf{a}^{(1)}-\textbf{c}^{(1)}\right\| ,\ \ \ \ \left\| U^{(2)}(x)-Y^{(2)}(x)\right\| \le \left\| \textbf{a}^{(2)}-\textbf{c}^{(2)}\right\| . \nonumber \\ \end{aligned}$$
(2.11)

Therefore, combining (2.7) and (2.10)–(2.11), we have

$$\begin{aligned}{} & {} \left\| u-U^{(1)}\right\| _{[0,d]}\le \left\| u^{(1)}-Y^{(1)}\right\| _{[0,d]}+\left\| Y^{(1)}-U^{(1)}\right\| _{[0,d]}\le CN^{-2}\ln ^{2}N,\\{} & {} \left\| u-U^{(2)}\right\| _{[d,1]}\le \left\| u^{(2)}-Y^{(2)}\right\| _{[d,1]}+\left\| Y^{(2)}-U^{(2)}\right\| _{[d,1]}\le CN^{-2}\ln ^{2}N. \end{aligned}$$

From the above inequalities, we conclude that the result of theorem holds true. \(\square \)

3 Numerical Experiments

In this section, the following numerical example is solved to corroborate in practice the efficiency of the developed method, which is taken from [3].

Example Consider the following singularly perturbed convection–diffusion problem with non-smooth data:

$$\begin{aligned} \left\{ \begin{array}{ll} -\varepsilon u''(x)+b(x,u)=f(x), &{} x\in (0,1/2)\cup (1/2,1),\\ u\left( x-\right) =u\left( x+\right) , &{} x=1/2,\\ \sqrt{\varepsilon }\left( u'\left( x-\right) -u'\left( x+\right) \right) =0, &{} x=1/2,\\ u(0)=u(1)=0, \end{array} \right. \end{aligned}$$
(3.1)

where

$$\begin{aligned} b(x,u)=1-e^{-u},\ \ \ \ \ f(x)=\left\{ \begin{array}{ll} 1-e^{-(1-2x)^{2}}, &{} 0\le x\le 1/2,\\ 1-e^{-\sqrt{2-2x}}, &{} 1/2<x\le 1. \end{array} \right. \end{aligned}$$
Fig. 1
figure 1

The computed solution for Example with \(\varepsilon =2^{-20}\) and \(N=128\)

The Newton iterative method is used to solve the nonlinear collocation equation (2.5). The initial guesses for Example are taken as \([a_{i}^{(m)}]^{(0)}=0\) and the stoping criterion is

$$\begin{aligned} \max _{0\le i\le N}\left| [a_{i}^{(m)}]^{(k)}-[a_{i}^{(m)}]^{(k-1)}\right| \le 10^{-5}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ m=1,2. \end{aligned}$$

The computed solution for Example with \(\varepsilon =2^{-20}\) and \(N=128\) is depicted in Fig. 1, which shows that the solution has obvious boundary and inner layers. Since the exact solution of the example is not available, the double mesh principle is adopted to calculate the maximum pointwise error and the corresponding convergence rate, which are denoted by \(e^{N}=\displaystyle {\max \nolimits _{1\le i\le N}\left| U^{N}_{i-1/2}-U^{2N}_{i-1/2}\right| }\) and \(r^{N}=\log _{2}\left( \frac{e^{N}}{e^{2N}}\right) \) for the scheme (2.2)–(2.4) on the Shishkin-type mesh \(\Omega ^{N}\) respectively. The numerical results are given in Table 1, which show that the quadratic B-spline approximate solution converges to the exact solution with almost second-order accuracy. Therefore, numerical experiments verify the effectiveness of the theoretical results.

Table 1 Error estimates and convergence rates of the scheme (2.2)–(2.4) for Example

4 Conclusion and Discussion

In this paper, a quadratic B-spline collocation method on a Shishkin-type mesh is used to solve the singularly perturbed problem with a discontinuous source term (1.1). There is a jump in the second-order derivative of the exact solution at the discontinuous point due to the discontinuous source term. The quadratic B-spline collocation equations are constructed on the left and right sides of the discontinuous point respectively. The collocation equations at the discontinuous point are also derived using the conditions satisfied at the discontinuous point. Then the nonlinear collocation equation is solved by the Newton iterative method and the approximate solution with piecewise quadratic differentiability is obtained. It is proved that the scheme is stable and almost second-order uniformly convergent. Numerical experiments confirm the correctness of the theoretical results. Although the convergence order of our discrete scheme is lower than some existing literatures, for example [17], the numerical solution obtained by applying the quadratic B-spline method is piecewise continuously differentiable, which indicates that our spline method has some advantages in solving singular perturbation problems. However, it is still difficult to extend this quadratic B-spline method to the singularly perturbed convection–diffusion problem, mainly because the convection term will cause difficulties in the stability analysis of the quadratic B-spline collocation scheme.