# Finite difference method for boundary value problem for nonlinear elliptic equation with nonlocal conditions

## Abstract

In the paper the convergence of a finite difference scheme for two-dimensional nonlinear elliptic equation in the rectangular domain with the integral boundary condition is considered. The majorant is constructed for the error of the solution of the system of difference equations, and the estimation of this error is obtained. With this aim, the idea of application of the M-matrices for the theoretical investigation of the system of difference equations was developed. Main results for the convergence of the difference schemes are obtained considering the structure of the spectrum and properties of the M-matrices for a wider class of boundary value problems for nonlinear equations with nonlocal conditions. The main advantage of the suggested method is that the error of approximate solution is estimated in the maximum norm.

## 1 Introduction

Many physical phenomena have been formulated as a mathematical model with nonlocal boundary conditions. A short overview of these models is presented in many papers (see, for example, works [1, 2]). Particulary, many problems in thermoelasticity can be formulated as nonlocal problems (see [3,4,5] and the references therein). Two of the latest new mathematical models in the biotechnology are presented in [6, 7]. A separate class of such nonlocal models is boundary value problem for elliptic equation with nonlocal boundary conditions .

Numerical methods for boundary value problem of linear and nonlinear elliptic equations with various types of nonlocal conditions have been intensively investigated during past decades. Finite difference methods for linear elliptic equations with Bicadze–Samarski or multipoint nonlocal conditions were analyzed in works [8, 9]. In the papers [10,11,12], the main goal was the investigation of the existence and uniqueness of the solution of difference problem with integral conditions, as well as estimation of the error in certain norms.

Various iterative methods for the systems of linear difference equations, derived from elliptic equations with nonlocal conditions, and proofs of convergence of these methods can be found in [13,14,15]. In the articles [16,17,18,19], the iterative methods are generalized for the systems of nonlinear difference equations with nonlocal conditions. Some other difference methods for elliptic equations with nonlocal conditions were described in [13, 20,21,22].

In most cases of elliptic equations with nonlocal conditions, the matrix of the discrete problem is characterized by the properties appropriate for M-matrices [23,24,25]. This was used to prove the convergence of iterative methods for linear and nonlinear elliptic equations with nonlocal conditions [17, 26].

Application of the M-matrices for the elliptic and parabolic differential equations with Dirichlet boundary conditions has been described by Varga  (for some new research in this field, see the works [27,28,29]).

In the present paper, the idea of application of M-matrices for theoretical investigation of difference methods with nonlocal conditions is further developed. Namely, M-matrices are used to prove the convergence of difference schemes. It is well known that the property of diagonal dominance of the matrix of discrete problem is necessary for applicability of the maximum principle. However, matrices with nonlocal conditions are not diagonally dominant. We can overcome this problem by applying the methodology of M-matrices.

We will use that in the spectrum of the matrix there are no eigenvalues with negative real part. This became apparent after investigating the structure of the spectrum of two-dimensional differential and appropriate difference operators with nonlocal conditions (see the works [14, 30,31,32,33,34,35,36] and the references therein). As far as authors know, the idea of application of M-matrices for the convergence of the difference schemes in the case of nonlocal boundary conditions is applied for the first time. We note that in the case of nonlocal conditions, the matrix of system of finite difference equations is neither diagonally dominated nor symmetric.

Using the structure of the spectrum and properties of M-matrices, we succeed in proving the convergence of difference schemes for a wider class of nonlinear equations with nonlocal conditions than it was proved before. This is the main result of the research.

The structure of the paper is the following. In Sect. 2, the differential problem is formulated and its discrete approximation is provided. The difference problem for the error of the solution is investigated in Sect. 3. In Sect. 4, the main properties of the matrix of difference problem are described, the case of matrix being as M-matrix is analyzed. The auxiliary lemmas on the evaluation of the solution of the system of the equations with an M-matrix are provided in Sect. 5. The majorant for the error is constructed in Sect. 6. The results of numerical experiments are presented in Sect. 7. In Sect. 8, we conclude and generalize some results.

## 2 Problem formulation

Let us solve a nonlinear elliptic equation in a rectangular domain $$D=\{0< x<1, 0<y<1\}$$

$$\frac{\partial ^{2} u}{\partial x^{2}} +\frac{\partial ^{2} u}{\partial y^{2}}=f(x,y,u), \quad (x,y)\in D,$$
(1)

with the integral condition

$$u(0,y)=\gamma \int _{0}^{1}u(x,y)\,dx +\mu _{1}(y), \quad 0< y< 1,$$
(2)

and Dirichlet boundary conditions at the points of the remaining three sides of the rectangle:

\begin{aligned} \begin{aligned} & u(1,y)=\mu _{2}(y),\quad 0\le y \le 1, \\ &u(x,0)=\mu _{3}(x),\quad\quad u(x, 1)=\mu _{4}(x), \quad 0 \le x \le 1, \end{aligned} \end{aligned}
(3)

where $$\mu _{1}$$, $$\mu _{2}$$, $$\mu _{3}$$, and $$\mu _{4}$$ are given sufficiently smooth functions, which satisfy compatibility conditions at the points $$(1, 0)$$ and $$(1,1)$$. We assume that the following hypotheses are true:

H1. :

$$\partial f/\partial u \ge 0$$ for all the values $$(x, y) \in D$$ and u;

H2. :

γ is a given real number and $$0\le \gamma \le 2- \delta$$, $$0<\delta \le 2$$.

Let us consider difference problem, corresponding to the differential problem

\begin{aligned} &\delta ^{2}_{x}U_{ij}+\delta ^{2}_{y}U_{ij} =f_{ij}(U_{ij}), \quad i, j= \overline{1,N-1}, \end{aligned}
(4)
\begin{aligned} & U_{0j}=\gamma h \Biggl(\frac{U_{0j}+U_{Nj}}{2}+ \sum _{i=1}^{N-1}U_{ij} \Biggr)+(\mu _{1})_{j}, \quad j=\overline{1,N-1}, \end{aligned}
(5)
\begin{aligned} & U_{Nj}=(\mu _{2})_{j},\quad\quad U_{i0}=(\mu _{3})_{i}, \quad\quad U_{iN}=(\mu _{4})_{i}, \quad i, j=\overline{0,N}, \end{aligned}
(6)

where $$h=1/N$$ is stepsize, N is a positive integer, $$f_{ij}(U_{ij})=f(x _{i}, y_{j}, U_{ij})$$,

$$\delta ^{2}_{x}U_{i j}:=\frac{U_{i-1,j}-2U_{ij}+U_{i+1,j}}{h^{2}}, \qquad \delta ^{2}_{y}U_{i j}:=\frac{U_{i,j-1}-2U_{ij}+U_{i,j+1}}{h^{2}}.$$

The solution of the system of difference equations (4)–(6) by the iterative methods was investigated in . It follows from the results there that under hypotheses H1 and H2, the unique solution of the system of difference equations (4)–(6) exists. In the present paper, the error estimation for this solution and the convergence of difference scheme (4)–(6) are considered.

Let us denote by $$u_{ij}=u(x_{i}, y_{j})$$ the solution of differential problem (1)–(3) and by $$U_{ij}$$ the solution of difference problem. Then the error is

$$z_{ij}=u_{ij}-U_{ij}.$$
(7)

Suppose that the differential problem (1)–(3) possesses unique, sufficiently smooth solution such that its derivatives up to the fourth order are bounded. Then

\begin{aligned} &\delta ^{2}_{x}u_{ij}+\delta ^{2}_{y}u_{ij} =f_{ij}(u_{ij})+R_{ij}(h), \quad i, j=\overline{1,N-1}, \end{aligned}
(8)
\begin{aligned} & u_{0j}=\gamma h \Biggl(\frac{u_{0j}+u_{Nj}}{2}+ \sum _{i=1}^{N-1}u_{ij} \Biggr)+(\mu _{1})_{j}+R_{j}(h), \quad j= \overline{1,N-1}, \end{aligned}
(9)
\begin{aligned} & u_{Nj}=(\mu _{2})_{j},\quad\quad u_{i0}=(\mu _{3})_{i}, \quad \quad u_{iN}=(\mu _{4})_{i}, \quad i, j=\overline{0,N}, \end{aligned}
(10)

where

\begin{aligned} \begin{aligned} & \bigl\vert R_{ij}(h) \bigr\vert \le \frac{h^{2}}{6}M_{4}, \\ & \bigl\vert R_{j}(h) \bigr\vert \le \frac{h^{2}}{12}M_{2} \gamma < \frac{h ^{2}}{6}M_{2}, \\ & M_{4}=\max \biggl( \biggl\vert \frac{\partial ^{4} u}{\partial x^{4}} \biggr\vert , \biggl\vert \frac{\partial ^{4} u}{\partial y^{4}} \biggr\vert \biggr), \quad\quad M _{2}=\max \biggl\vert \frac{\partial ^{2} u}{\partial x^{2}} \biggr\vert . \end{aligned} \end{aligned}
(11)

It follows from (4)–(6) and (8)–(10) that

\begin{aligned}& -\delta ^{2}_{x}z_{ij}-\delta ^{2}_{y}z_{ij}+d_{ij}z_{ij}=-R_{ij}(h), \quad i, j=\overline{1,N-1}, \end{aligned}
(12)
\begin{aligned}& z_{0j}-\gamma h \Biggl(\frac{z_{0j}+z_{Nj}}{2}+ \sum _{i=1}^{N-1}z_{ij} \Biggr)=R_{j}(h), \quad j=\overline{1,N-1}, \end{aligned}
(13)
\begin{aligned}& z_{Nj}=z_{i0}=z_{iN}=0, \quad i, j= \overline{0,N}, \end{aligned}
(14)

where

$$d_{ij}=\frac{\partial f_{ij(u_{ij})}}{\partial u}\ge 0,$$
(15)

i.e., $$d_{ij}$$ is an unknown nonnegative constant.

### Remark 1

Conditions (14) for system (12)–(13) mean that there are no unknowns $$z_{Nj}$$, $$z_{i0}$$, and $$z_{iN}$$ in the expression on the left-hand side of equations (12).

## 3 The investigation of the difference problem for the error

We will estimate the error $$z_{ij}$$ as the solution of the system of equations (12)–(14) in Sects. 35. Firstly, we reduce this system to two systems of lower order. In order to do this, we express $$z_{0j}$$ from equations (13):

$$z_{0j}=\alpha \sum_{i=1}^{N-1}z_{ij}+ \beta R_{j}(h), \quad j= \overline{1,N-1},$$
(16)

where

$$\alpha =\frac{\gamma h}{1-{\gamma h}/{2}}, \quad\quad \beta =\frac{1}{1- {\gamma h}/{2}}.$$

Taking into account H2 and $$0< h\le 1/2$$, we get

$$1 \le \frac{1}{ 1-{\gamma h}/{2}}\le 2,$$

so

$$0\le \alpha \le 2\gamma h, \quad 1\le \beta \le 2.$$
(17)

Substituting (16) into (12), where $$i=1$$, all equations (12) could be rewritten as follows:

\begin{aligned}& -\delta ^{2}_{x}z_{ij}-\delta ^{2}_{y}z_{ij}+d_{ij}z_{ij}=-R_{ij}(h), \quad i=\overline{2,N-1}, j=\overline{1,N-1}, \end{aligned}
(18)
\begin{aligned}& \frac{1}{h^{2}} \Biggl(-\alpha \sum_{i=1}^{N-1}z _{ij} +2z_{1j}-z_{2j} \Biggr)-\delta ^{2}_{y}z_{1j}+d_{1j}z_{1j}=-R_{1j}(h)+ \frac{ \beta R_{j}(h)}{h^{2}}, \\& j=\overline{1,N-1}. \end{aligned}
(19)

Systems (12)–(14) and (18), (19), (16), (14) are equivalent. So (12)–(14) is being reduced to two separate systems of lower order: one system is (18), (19), (14) and the other system is (16). In system (18), (19), (14) only the unknowns $$z_{ij}$$, $$i, j=\overline{1,N-1}$$, in the internal points of the domain D are presented. So the number of equations and unknowns in the system is equal to $$(N-1)^{2}$$. Furthermore, the unknowns $$z_{0j}$$ in (16) are expressed by unknowns $$z_{ij}$$, $$i, j= \overline{1,N-1}$$. This allows us to first solve (18), (19), (14) and (16) only afterwards.

Now we write system (18), (19), (14) in the matrix form:

$$\mathbf{A} \mathbf{z}=\mathbf{R},$$
(20)

where $$\mathbf{z}=\{z_{ij}\}$$ is the vector of length $$(N-1)^{2}$$, $$\mathbf{R}=\{r_{ij}\}$$ is the vector of length $$(N-1)^{2}$$ with elements

$$r_{ij}= \textstyle\begin{cases} -R_{ij}(h), & i=\overline{2,N-1}, j=\overline{1,N-1}, \\ -R_{1j}(h)+\frac{\beta R_{j}(h)}{h^{2}}, & i=1, j=\overline{1,N-1}. \end{cases}$$
(21)

Matrix A is formed in the following way:

$$\mathbf{A}= \boldsymbol{\varLambda }-\mathbf{C}+\mathbf{D},$$
(22)

where $$\boldsymbol{\varLambda }=\boldsymbol{\varLambda _{1}}+ \boldsymbol{\varLambda _{2}}$$ is the square matrix of order $$(N-1)^{2}$$, corresponding to a difference operator $$-\delta _{x}^{2}-\delta _{y} ^{2}$$ in the rectangular domain with the Dirichlet type homogeneous boundary conditions according to Remark 1. D is a diagonal matrix with elements $$d_{ij}$$ that are defined by (15). Matrix C consists of multipliers $$h^{-2} \alpha$$ next to unknowns $$z_{ij}$$ in the first summand of (19). More exactly, C is a block matrix

$$\mathbf{C}=\operatorname{diag}(\mathbf{C}_{1}, \mathbf{C}_{1},\ldots, \mathbf{C}_{1}),$$
(23)

where

${\mathbf{C}}_{1}=\frac{1}{{h}^{2}}\left(\begin{array}{cccc}\alpha & \alpha & \cdots & \alpha \\ 0& 0& \cdots & 0\\ \cdots & \cdots & \cdots & \cdots \\ 0& 0& \cdots & 0\end{array}\right),$
(24)

the number of blocks of matrix C and order of matrix $$\mathbf{C}_{1}$$ are $$N-1$$.

Furthermore, all three forms of system (12)–(14) will be used: the equivalent system (18), (19), (16), (14) with the order $$N(N-1)$$; partial system (18), (19), (14) with the order $$(N-1)^{2}$$; the matrix form (20) of system (18), (19), (14).

We will use also the notation $$\mathbf{A}_{1}=\boldsymbol{\varLambda }- \mathbf{C}$$. So system (20) can be written as follows:

$$(\mathbf{A}_{1}+\mathbf{D}) \mathbf{z}=\mathbf{R}.$$
(25)

## 4 Properties of the matrix A

Now we will use a few properties of M-matrices. We reformulate some of these properties, applied for the system of difference equations (20) as new lemmas.

### Definition 1

([23,24,25])

A real square matrix $$\mathbf{A}=\{a_{kl}\}$$, $$k, l=\overline{1, n}$$ with $$a_{kl}\le 0$$ for all $$k\neq l$$ is called an M-matrix if A is nonsingular and $$\mathbf{A}^{-1}$$ is nonnegative.

It follows from the definition that $$a_{kk}>0$$. Throughout the rest of this paper, we will denote $$\mathbf{A}>0 (\mathbf{A}\ge 0)$$ if $$a_{kl}>0$$ ($$a_{kl}\ge 0$$) for all kl. Additionally, $$\mathbf{A}< \mathbf{B}$$ if $$a_{kl}< b_{kl}$$. Similar notation for vectors is also used. The following property of M-matrices is correct [23,24,25].

### Lemma 1

If A is such that $$a_{kl}<0$$ ($$k\neq l$$), then the following statements are equivalent:

1. (i)

$$\mathbf{A}^{-1}$$ exists and $$\mathbf{A}^{-1}\ge 0$$;

2. (ii)

The real parts of all the eigenvalues of the matrix A are positive: $$\operatorname{Re}\lambda (\mathbf{A})>0$$.

The main properties of matrix A for the system of equations (20) as lemmas are formulated below.

### Lemma 2

The diagonal elements of the matrix A of system (20) are positive.

Indeed, the diagonal elements of matrix Λ are $$4/h^{2}$$, diagonal elements of matrix D are nonnegative ($$d_{ij}\ge 0$$ according to H1). The diagonal elements of matrix C are $$h^{-2}\alpha$$ or 0. Then the least diagonal element of matrix A is

$$\frac{4}{h^{2}}+d_{ij}-\frac{\alpha }{h^{2}}>0,$$

because $$0\le \alpha \le 2\gamma h$$.

### Lemma 3

The nondiagonal elements of matrix A of system (20) are nonpositive.

The statement of lemma follows from the fact that nondiagonal elements of matrix Λ are $$-h^{-2}$$ or 0, nondiagonal elements of matrix C are $$h^{-2}\alpha$$ or 0, and matrix D is diagonal.

### Lemma 4

All eigenvalues of matrix $$\boldsymbol{\varLambda }-\mathbf{C}$$ are positive.

### Proof

When $$d_{ij}=0$$, the eigenvalue problem corresponding to the system of difference equations (12)–(14) is

\begin{aligned} &\delta ^{2}_{x}v_{ij}+\delta ^{2}_{y}v_{ij}+\lambda v_{ij}=0, \quad i, j=\overline{1,N-1}, \end{aligned}
(26)
\begin{aligned} & v_{0j}-\gamma h \Biggl(\frac{v_{0j}+v_{Nj}}{2}+ \sum _{i=1}^{N-1}v_{ij} \Biggr)=0, \quad j= \overline{1,N-1}, \end{aligned}
(27)
\begin{aligned} & v_{Nj}=v_{i0}=v_{iN}=0, \quad i, j= \overline{0,N}. \end{aligned}
(28)

This eigenvalue problem is equivalent for the eigenvalue problem for the matrix $$\mathbf{A}_{1}=\boldsymbol{\varLambda }-\mathbf{C}$$ (for more details, see [17, 26]). It follows from  that all eigenvalues of matrix $$\mathbf{A}_{1}$$ are positive when $$0\le \gamma \le \gamma _{0}$$, $$\gamma _{0}\approx 3.42$$. □

It follows from Lemmas 14:

### Corollary 1

Matrices $$\mathbf{A}_{1}=\boldsymbol{\varLambda }-\mathbf{C}$$ and $$\mathbf{A}=\boldsymbol{\varLambda }-\mathbf{C}+\mathbf{D}$$ are M-matrices, so $$(\boldsymbol{\varLambda }-\mathbf{C})^{-1}\ge 0$$, $$\mathbf{A}^{-1} \ge 0$$.

## 5 Comparison theorem

In this section, some properties of M-matrices, adapted for the evaluation of the solution for the system of difference equations, will be reformulated. We consider the system of equations

$$\mathbf{A}\mathbf{u}=\mathbf{f},$$
(29)

where A is an M-matrix.

### Lemma 5

If the matrix A in system (29) is an M-matrix and $$\mathbf{f}\ge 0$$, then $$\mathbf{u}\ge 0$$.

The statement of lemma follows from $$\mathbf{u}= \mathbf{A}^{-1} \mathbf{f}$$ and $$\mathbf{A}^{-1}\ge 0$$, $$\mathbf{f}\ge 0$$.

Let us denote the elements of vector u as $$\{u_{k}\}$$, i.e., $$\mathbf{u}=\{u_{k}\}$$. The vector with elements $$\vert u_{k}\vert$$ can be denoted as $$\vert \mathbf{u}\vert$$, i.e., $$\vert \mathbf{u}\vert =\{\vert u_{k}\vert \}$$.

### Lemma 6

(Comparison theorem)

Suppose that u and w are the solutions of two systems

\begin{aligned} & \mathbf{A}\mathbf{u}=\mathbf{f}, \\ & \mathbf{A}\mathbf{w}=\mathbf{g}, \end{aligned}

where A is an M-matrix, $$\mathbf{g}\ge 0$$. If $$\mathbf{\vert f\vert }\le \mathbf{g}$$, then $$\vert \mathbf{u}\vert \le \mathbf{w}$$.

### Proof

As $$\mathbf{A}^{-1}\ge 0$$, then

$$\vert \mathbf{u} \vert = \bigl\vert \mathbf{A}^{-1}\mathbf{f} \bigr\vert \le \bigl\vert \mathbf{A}^{-1} \bigr\vert \vert \mathbf{f} \vert =\mathbf{A}^{-1} \vert \mathbf{f} \vert \le \mathbf{A}^{-1}\mathbf{g}= \mathbf{w}.$$

□

### Remark 2

In addition, suppose that an M-matrix is diagonally dominant in a weak sense

$$a_{kk}\ge \sum_{\substack{l=1, \\ l\neq k}}^{n} \vert a_{kl} \vert , \quad a_{kl}\le 0.$$
(30)

We interpret (29) as the system of difference equations obtained from the elliptic equation with Dirichlet boundary condition. Then inequality (30) guarantees that the maximum principle is valid for this system . In this case Lemma 6 coincides with the corollary from the maximum principle, usually called the comparison theorem. The function w mentioned in the comparison theorem and Lemma 6 is called the majorant. In this sense, the theory of M-matrices could be interpreted as an extension of the maximum principle for the case when the matrix of the system of difference equations is not diagonally dominant.

### Lemma 7

Suppose that u and w are the solutions of two systems

\begin{aligned} & (\mathbf{A}+\mathbf{D})\mathbf{u}=\mathbf{f}, \\ & \mathbf{A}\mathbf{w}=\mathbf{g}, \end{aligned}

where A is an M-matrix, $$\mathbf{D}\ge 0$$ is the diagonal matrix, $$\mathbf{g}\ge 0$$. If $$\vert \mathbf{f}\vert \le \mathbf{g}$$, then $$\vert \mathbf{u}\vert \le \mathbf{w}$$.

### Proof

As $$\mathbf{D}\ge 0$$ and A is an M-matrix, then

$$\mathbf{A}^{-1}\ge (\mathbf{A}+\mathbf{D})^{-1}\ge 0.$$

So

$$\vert \mathbf{u} \vert \le (\mathbf{A}+\mathbf{D})^{-1} \vert \mathbf{f} \vert \le \mathbf{A}^{-1}\mathbf{g}=\mathbf{w}.$$

□

### Remark 3

It follows from the vector inequality $$\vert \mathbf{u}\vert \le \mathbf{w}$$ that $$\vert {u}_{k}\vert \le {w}_{k}$$. So the statements of Lemmas 6 and 7 could be interpreted as follows:

$$\max_{1\le k\le n} \vert {u}_{k} \vert \le \max _{1\le k\le n}{w}_{k}.$$

So the statements of Lemmas 6 and 7 could be reformulated as

$$\Vert \mathbf{u} \Vert _{\infty } \le \Vert \mathbf{w} \Vert _{\infty },$$

where

$$\Vert \mathbf{u} \Vert _{\infty }=\max_{1\le i, j\le n} \vert {u}_{ij} \vert .$$

## 6 Construction of majorant and the main theorem

In this section the majorant for the solution of the system of difference equations (20) is constructed using the statements of Lemmas 6 and 7, and the error z is evaluated. We define the following function:

$$w(x, y)=\frac{M}{\varepsilon }\frac{h^{2}}{24} \bigl(1-\varepsilon x ^{2}-\varepsilon y^{2}-(1-2\varepsilon )x \bigr),$$
(31)

where $$M=\max (M_{2}, M_{4})$$, $$\varepsilon =\delta /13$$, $$\delta =2- \gamma$$. As $$0\le \gamma \le 2-\delta$$, then $$0< \delta <2$$, $$0<\varepsilon < 2/13$$. It is important to emphasize that $$\delta \neq 0$$, $$\varepsilon \neq 0$$.

It is obvious that

$$w_{ij}\ge 0, \quad i,j=\overline{0,N}.$$
(32)

Certainly, $$w(x, y)\ge w(1, 1)=0$$. For the function $$w(x, y)$$, we provide the system of equations

$$\mathbf{ A}_{1}\mathbf{w}=\mathbf{g}$$
(33)

with the matrix $$\mathbf{ A}_{1}$$ defined by formula (25). In other words, taking the known matrix $$\mathbf{ A}_{1}$$ and the function w, we calculate vector g, $$i,j=\overline{1, N-1}$$. We write for the function w difference equations, similarly to (12), (13). From (31) we get

\begin{aligned} &\frac{\partial ^{2} w}{\partial x^{2}}=\frac{\partial ^{2} w}{\partial y^{2}}=-\frac{Mh^{2}}{12}, \\ &\frac{\partial ^{4} w}{\partial x^{4}}=\frac{ \partial ^{4} w}{\partial y^{4}}=0. \end{aligned}

So, it follows that

$$-\delta _{x}^{2}w_{ij}-\delta _{y}^{2}w_{ij}=-\frac{\partial ^{2} w}{ \partial x^{2}}- \frac{\partial ^{2} w}{\partial y^{2}}= \frac{Mh^{2}}{6}.$$
(34)

Now we write down an analog of equations (19) for function (31). Note that in the case of the condition $$f^{\prime \prime }(x)=\mathrm{const}$$, the truncation error of the trapezoid rule can be expressed in the following way:

$$\int _{a}^{b}f(x)\,dx-h \Biggl(\frac{f_{0}+f_{N}}{2}+ \sum_{i=1}^{N-1}f_{i} \Biggr)=- \frac{h^{2}(b-a)}{12}f^{\prime \prime }.$$

So

$$h \Biggl(\frac{w_{0j}+w_{Nj}}{2}+\sum_{i=1}^{N-1}w_{ij} \Biggr)= \int _{0} ^{1}w(x, y)\,dx+\frac{h^{2}}{12} \frac{\partial ^{2} w}{\partial x^{2}}.$$

As $${\partial ^{2} w}/{\partial x^{2}}<0$$, then

$$h \Biggl(\frac{w_{0j}+w_{Nj}}{2}+\sum_{i=1}^{N-1}w_{ij} \Biggr)< \int _{0} ^{1}w(x, y)\,dx.$$
(35)

Let us denote

$$g_{j}=w_{0j}-\gamma h \Biggl( \frac{w_{0j}+w_{Nj}}{2}+\sum_{i=1}^{N-1}w _{ij} \Biggr), \quad j=\overline{1, N-1}.$$
(36)

Now we get

$$g_{j}>\frac{Mh^{2}}{24\varepsilon } \bigl(1-\varepsilon y^{2} \bigr) - \gamma \int _{0}^{1}w(x, y)\,dx = \frac{Mh^{2}}{24\varepsilon } \biggl(1-\frac{ \gamma }{2}-\varepsilon y^{2} - \frac{2\varepsilon }{3}\gamma +\varepsilon y^{2}\gamma \biggr).$$

Substituting $$\varepsilon =\delta /13$$ and $$\delta =2-\gamma$$ to the right-hand side of the last equality, we get

\begin{aligned}[b] g_{j}&>\frac{Mh^{2}}{24} \biggl(\frac{2-\gamma }{2\varepsilon }-y^{2} - \frac{2 \gamma }{3}+ y^{2}\gamma \biggr) \ge \frac{Mh^{2}}{24} \biggl(\frac{\delta }{2}\frac{13}{\delta }-1 - \frac{2\gamma }{3} \biggr)\\&\ge \frac{Mh^{2}}{24}\frac{25}{6}>\frac{Mh^{2}}{6}> \frac{Mh^{2}\gamma }{12}.\end{aligned}
(37)

Equations (34), (36) are analogous to equations (12), (13). Recall that in Sect. 3 we express $$w_{0j}$$ from (36)

$$w_{0j}=\alpha \sum_{i=1}^{N-1}w_{ij}+ \beta g_{j}, \quad j=\overline{1, N-1},$$
(38)

where α and β are the same as in (16). Substituting (38) into (34), when $$i=1$$, we can rewrite equations (34) as follows:

\begin{aligned}& -\delta _{x}^{2}w_{ij}-\delta _{y}^{2}w_{ij}=\frac{Mh^{2}}{6} , \quad i= \overline{2,N-1}, j=\overline{1,N-1}, \end{aligned}
(39)
\begin{aligned}& \frac{1}{h^{2}} \Biggl( -\alpha \sum _{i=1}^{N-1}w_{1j}+2w_{1j}-w_{2j} \Biggr)-\delta _{y}^{2}w_{ij}=\frac{Mh^{2}}{6}+ \frac{\beta g_{j}}{h^{2}}, \quad j=\overline{1,N-1}. \end{aligned}
(40)

Now, as before, we write (39), (40) in a matrix form (33). To express the elements of the vector $$\mathbf{g}=\{g _{ij}\}$$, we note that function w unlike $$\mathbf{z}=\{z_{ij}\}$$ does not satisfy the homogeneous boundary conditions (14). This is the reason why the unknowns with the indexes $$(0, j)$$, $$(i, 0)$$, and $$(i, N)$$ are present in equations (34) and not in (12). Coefficients to these unknowns are not the elements of the matrix $$\mathbf{A}_{1}$$, so these additional components should be added to the expression of components of vector g. So in the system of equations (33) we have

$$g_{ij}= \textstyle\begin{cases} \frac{Mh^{2}}{6}+\frac{\tilde{w}_{ij}}{h^{2}}, & i=\overline{2,N-1}, j=\overline{1,N-1}, \\ \frac{Mh^{2}}{6}+\frac{\beta g_{j}(h)}{h^{2}}+\frac{\tilde{w}_{ij}}{h ^{2}}, & i=1, j=\overline{1,N-1}, \end{cases}$$
(41)

where

$$\tilde{w}_{ij}= \textstyle\begin{cases} {w}_{Nj}>0, & i=N-1, j=\overline{1,N-1}, \\ {w}_{i0}>0, & i=\overline{1,N-1}, j=1, \\ {w}_{iN}>0, & i=\overline{1,N-1}, j=N-1, \\ 0, & \text{otherwise}, \end{cases}$$
(42)

$$g_{j}$$ satisfies inequality (37).

Now the main result of the research on the estimate of the error of the difference method can be formulated and convergence of the method can be proved.

### Theorem 8

If hypotheses H1 and H2 are true and the truncation errors satisfy inequalities (11), then for finite difference method (4)(6)

$$\vert z_{ij} \vert \le \frac{C_{1}Mh^{2}}{\delta }, \quad i= \overline{0,N-1}, j=\overline{1,N-1},$$
(43)

where $$z_{ij}=u_{ij}-U_{ij}$$, $$u_{ij}$$ is the solution of differential problem and $$U_{ij}$$ is the solution of difference problem, $$M=\max (M_{2}, M_{4})$$, $$C_{1}$$ is constant, which does not depend on either h or on the solution of differential problem.

### Proof

The matrix A of systems (20) and $$\mathbf{A}_{1}$$ of (33) are the M-matrices (Corollary 1). Inequalities for the components of the vectors R and g can be written. Namely, it follows from (11), (21) and (41), (42) that

$$\vert r_{ij} \vert \le \frac{h^{2}}{6}M_{4}\le \frac{h^{2}}{6}M\le g_{ij}, \quad i=\overline{2,N-1}, j= \overline{1,N-1}.$$

Similarly, from the same formulae, taking into consideration (37), it follows

\begin{aligned} \vert r_{1j} \vert &\le \bigl\vert R_{1j}(h) \bigr\vert +\frac{\beta \vert R_{j}(h) \vert }{h^{2}}\le \frac{h ^{2} M}{6}+\frac{\beta h^{2} M}{6h^{2}} \\ &\le \frac{h^{2}}{6}M+ \frac{\beta g_{j}}{h^{2}}\le {g}_{1j}, \quad j= \overline{1,N-1}. \end{aligned}

Therefore

$$\vert r_{ij} \vert \le g_{ij}, \quad i=\overline{1,N-1}, j= \overline{1,N-1}.$$

Now Lemmas 6 and 7 could be applied to the solutions of systems (20), (33). It follows from the lemmas that

$$\vert z_{ij} \vert \le w_{ij}, \quad i, j= \overline{1,N-1}.$$

Taking into account (31), we have

$$w_{ij}\le w_{00}=\frac{Mh^{2}}{24\varepsilon }=\frac{13Mh^{2}}{24 \delta }.$$

So

$$\vert z_{ij} \vert \le \frac{13Mh^{2}}{24\delta }, \quad i, j=\overline{1,N-1}.$$
(44)

Now $$z_{0j}$$ is estimated from (16) and (44):

\begin{aligned} \vert z_{0j} \vert &\le 2\gamma h \sum _{i=1}^{N-1} \vert z_{ij} \vert +2 \bigl\vert R_{j}(h) \bigr\vert \\ &\le \frac{13M\gamma h^{2}}{24\delta }+\frac{h ^{2}M_{2}}{3}\le \biggl(\frac{13 }{24\delta }+ \frac{1}{3} \biggr)Mh^{2} \le \frac{29}{24\delta }Mh^{2}. \end{aligned}
(45)

Inequality (43) follows from (44), (45). The convergence of the difference scheme when $$h\rightarrow 0$$ follows from (43). □

## 7 Numerical results

To justify the theoretical results and investigate the efficiency of numerical schemes in the case of nonlocal boundary conditions, we consider a model problem where the analytical solution is explicitly known. The theoretical results presented in the previous sections do not depend upon the numerical method that is used to solve nonlinear system of finite difference equations (4)–(6). This system can be solved using one of the iterative methods designed for problems with nonlocal conditions [16,17,18]. We can also use some classical method used for solving nonlinear systems, for example, . Here we have used a generalization of the alternating-direction implicit (ADI) method for problems with nonlocal boundary conditions  defined on two-dimensional uniform grids on $$D=[0, 1] \times [0, 1]$$. Meshes of different sizes with $$h=h_{x}=h_{y}$$ and variation of parameter γ were used in simulations.

### Test 1

Problem with nonlocal BC. The first numerical example is a simple test case for validating the error estimates and demonstrating the performance of the finite-difference method for several values of parameter of nonlocality γ.

We consider a model problem (1)–(3)  in a unit square domain D

$$\frac{\partial ^{2} u}{\partial x^{2}} +\frac{\partial ^{2} u}{\partial y^{2}}=-\frac{\pi ^{2}}{4}u(1-u)+g(x,y), \quad (x,y)\in D,$$
(46)

with the integral condition (2) and Dirichlet boundary conditions (3). The function $$g(x, y)$$ is chosen so that the function

$$u(x,y)=\bigl(1-x^{2}\bigr)\sin \biggl( \frac{\pi }{2} y\biggr)$$
(47)

is the analytical solution of the problem, i.e.,

$$g(x,y)=2\sin \biggl(\frac{\pi }{2} y\biggr)+ \frac{\pi ^{2}}{4}\bigl(1-x^{2}\bigr)^{2}\sin ^{2} \biggl(\frac{\pi }{2} y\biggr).$$
(48)

The boundary conditions were prescribed to satisfy the given exact solution (47). The accuracy of the ADI method applied to problems with nonlocal or Dirichlet boundary conditions was estimated by calculating the maximum norm of the absolute error

$$E_{h}=\max_{i,j} \bigl\vert u(x_{i}, y_{j})-U_{ij} \bigr\vert .$$

We also measured the relative true error

$$\epsilon _{h}=\max_{i, j} \biggl\vert \frac{u(x_{i}, y_{j})-U_{ij}}{u(x_{i}, y_{j})} \biggr\vert .$$

The results of the numerical test for different γ on uniform mesh with $$N = 100$$ intervals in each direction are listed in Table 1.

In order to calculate order of accuracy p, we have run iterations on uniform mesh with $$N=100$$ intervals in each direction. Numerical results are reported in Table 2 and demonstrate the accuracy of the second order for ADI method both for the Dirichlet boundary condition and for the integral boundary condition.

We determined from the numerical results in Table 1 that the error of the solution slightly increases as γ grows, when $$0 \leq \gamma < 2$$. This agrees well with the fact that approximation error $$R_{j}(h)$$ of nonlocal conditions (2) is linearly dependent on γ (see (11)).

From the results in Table 2, we see that error which theoretically is $$\mathcal{O}(h^{2})$$ (Theorem 8) matches theory rather well both in the case of Dirichlet condition ($$\gamma =0$$) and in the case of nonlocal condition ($$\gamma =1$$).

We also note that Test 1 was also successfully solved with $$\gamma \in [2; 3.224]$$. When $$\gamma > 2$$, the matrix corresponding to difference operator $$\delta _{x}^{2}$$ with nonlocal condition (5) has negative eigenvalue and ADI might not converge (for more details, see [14,15,16]).

### Test 2

Problem with parameter c. In the second test we consider problem (46), (2)–(3). The functions f and g are chosen so that the function

$$u(x,y)=\bigl(1-x^{2}\bigr)\sin \biggl( \frac{\pi }{2} y\biggr)+cx^{2}$$
(49)

is exact solution of the problem, i.e.,

$$f(x, y, u)=-\frac{\pi ^{2}}{4}u(1-u) +g(x, y),$$
(50)

where

\begin{aligned} g(x, y)&=-\sin \biggl(\frac{\pi }{2} y\biggr) \biggl(2+\frac{\pi ^{2}}{4} \bigl(1-x^{2}\bigr) \biggr) \\ &\quad{} +2c+\frac{\pi ^{2}}{4} \biggl( \bigl(1-x^{2}\bigr)\sin \biggl(\frac{\pi }{2} y\biggr)+cx ^{2} \biggr) \biggl(1-\bigl(1-x^{2}\bigr)\sin \biggl( \frac{\pi }{2} y\biggr)-cx^{2} \biggr). \end{aligned}

Let us explain the role of additional term $$cx^{2}$$ in (49). Recall that approximation error for problem (8) depends on constants $$M_{2}$$ and $$M_{4}$$ from (11). Varying $$c>0$$ lets us investigate the influence of the approximation error of nonlocal condition (which is bounded by constant $$M_{2}$$) without changing approximation error of differential equation (which is bounded by constant $$M_{4}$$).

Tables 3 and 4 present the performance of the algorithm for various values of constant c. Note that for large values of c the error increases.

We may observe that the actual convergence follows very closely the expected theoretical error. Numerical tests reinforce the theoretical convergence results.

## 8 Remarks and generalizations

The integral condition (2) could be interpreted as some kind of generalization of the Dirichlet boundary condition. Namely, when $$\gamma =0$$, the nonlocal condition (2) becomes Dirichlet condition. When $$\gamma =0$$, then $$\delta =2$$ and

$$\vert z_{ij} \vert \le \frac{13M_{4}}{48}h^{2}, \quad i,j=\overline{1,N-1},$$
(51)

follows from (44).

As it was mentioned in Sect. 5 (Remark 2), in the case $$\gamma =0$$ the error $$z_{ij}$$ could be estimated by the maximum principle. So, it is interesting to compare the estimate got with the estimate received using the maximum principle :

$$\vert z_{ij} \vert \le \frac{M_{4}}{12}h^{2}.$$
(52)

In both estimates, the order of the error subject to h is the same, but the constant in estimate (51) is approximately three times more in the case of nonlocal condition. It could be explained simply. It depends on the definition of majorant $$w(x, y)$$. For the maximum principle the majorant is usually defined as in :

$$w(x, y)= \frac{h^{2}M_{4}}{24}\bigl(2-x^{2}-y^{2} \bigr).$$
(53)

The maximal value of this function is approximately three times less than the maximal value of majorant (31) chosen in this research. It has to be noted that both majorants coincide if $$\varepsilon =1/2$$ is taken in (31). But in (31), a smaller value of ε ($$\varepsilon =\delta /13$$) guarantees inequality (37) for all values $$0\le \gamma <2$$. And this is not true for $$\varepsilon =1/2$$. Indeed, let us take in (31) $$\varepsilon =1/2$$. It follows in this case that the inequality

$$\frac{Mh^{2}}{24} \biggl(\frac{2-\gamma }{2\varepsilon }- y^{2} - \frac{2 \gamma }{3} + y^{2}\gamma \biggr)\ge \gamma \frac{Mh^{2}}{12}$$

with $$\varepsilon =1/2$$ will be true when $$0\le \gamma \le 3/11$$. So, we get an interesting conclusion. When $$0\le \gamma \le 3/11$$, then $$\varepsilon =1/2$$ in the definition of majorant (31) can be taken. In this case we can get estimation (52) instead of estimation (44).

Majorant $$w(x, y)$$ is constructed according to formula (31) in the case $$0\le \gamma \le 2-\delta$$, $$\delta >0$$. But the matrix A of system (20) is an M-matrix with the values for $$\gamma \in [0, \gamma _{0})$$, $$\gamma _{0}\approx 3.42$$ . It is not clear how the majorant can be defined for $$\gamma \ge 2$$.

The theory of M-matrices was first used in the comparison theorem instead of the maximum principle for the estimation of the error of approximate solution. This idea let us estimate error in the maximum norm in the case $$\gamma > 1$$.

The numerical results presented in Sect. 7 confirm theoretical results about the estimate of the error. Method’s error is second order, independent of the type of boundary conditions (Dirichlet with $$\gamma = 0$$ or nonlocal with $$\gamma > 0$$). Moreover, the numerical experiment provides additional information about quantitative dependence of error of the solution on γ and $$M_{2}$$.

We prove the convergence of the difference scheme for one concrete case of nonlocal condition. Furthermore, this methodology may also be applied in another case when, for the operator with nonlocal conditions, all the eigenvalues are positive only.

## References

1. Dehghan, M.: Efficient techniques for the second-order parabolic equation subject to nonlocal specifications. Appl. Numer. Math. 52(1), 39–62 (2005)

2. Martín-Vaquero, J., Vigo-Aguiar, J.: On the numerical solution of the heat conduction equations subject to nonlocal conditions. Appl. Numer. Math. 59(10), 2507–2514 (2009)

3. Jesevičiūtė, Ž., Sapagovas, M.: On the stability of the finite-difference schemes for parabolic equations subject to integral conditions with applications for thermoelasticity. Comput. Methods Appl. Math. 8(4), 360–373 (2008)

4. Mesloub, S.: On a higher order two dimensional thermoelastic system combining a local and nonlocal boundary conditions. Electron. J. Qual. Theory Differ. Equ. 2012, 50 (2012)

5. Marin, M., Öchsner, A.: The effect of a dipolar structure on the Hölder stability in Green–Naghdi thermoelasticity. Contin. Mech. Thermodyn. 29(6), 1365–1374 (2017)

6. Ivanauskas, F., Laurinavičius, V., Sapagovas, M., Nečiporenko, A.: Reaction–diffusion equation with nonlocal boundary condition subject to PID-controlled bioreactor. Nonlinear Anal., Model. Control 22(2), 261–272 (2017)

7. Čiegis, R., Suboč, O., Čiegis, R.: Numerical simulation of nonlocal delayed feedback controller for simple bioreactors. Informatica 29(2), 233–249 (2018)

8. Il’in, V.A., Moiseev, E.I.: Two-dimensional nonlocal boundary value problem for Poisson’s operator in differential and difference variants. Math. Model. 2, 132–156 (1990) (in Russian)

9. Ashyralyev, A.: Numerical solution to Bitsadze Samarskii type elliptic overdetermined multipoint IVBVP. Bound. Value Probl. 2018, 74 (2013)

10. Avalishvili, G., Avalishvili, M., Gordeziani, D.: On a nonlocal problem with integral boundary conditions for a multidimensional elliptic equation. Appl. Math. Lett. 24, 566–571 (2011)

11. Berikelashvili, G., Khomeriki, N.: On the convergence rate of a difference solution of the Poisson equation with fully nonlocal constraints. Nonlinear Anal., Model. Control 19(3), 367–381 (2014)

12. Sapagovas, M.: Difference method of increased order of accuracy for the Poisson equation with nonlocal conditions. Differ. Equ. 44(7), 1018–1028 (2008)

13. Pao, C.: Numerical solutions of reaction–diffusion equations with nonlocal boundary conditions. J. Comput. Appl. Math. 136, 227–243 (2001)

14. Sapagovas, M., Štikonas, A., Štikonienė, O.: Alternating direction method for the Poisson equation with variable weight coefficients in an integral condition. Differ. Equ. 47(8), 1163–1174 (2011)

15. Sapagovas, M., Štikonienė, O.: A fourth-order alternating-direction method for difference schemes with nonlocal condition. Lith. Math. J. 49(3), 309–317 (2009)

16. Čiupaila, R., Sapagovas, M., Štikonienė, O.: Numerical solution of nonlinear elliptic equation with nonlocal condition. Nonlinear Anal., Model. Control 18(4), 412–426 (2013)

17. Sapagovas, M., Griškonienė, V., Štikonienė, O.: Application of m-matrices to numerical investigation of a nonlinear elliptic equation with an integral condition. Nonlinear Anal., Model. Control 22(4), 489–504 (2017)

18. Sapagovas, M., Štikonienė, O.: Alternating-direction method for a mildly nonlinear elliptic equation with nonlocal integral conditions. Nonlinear Anal., Model. Control 16(2), 220–230 (2011)

19. Wang, Y.: Solutions to nonlinear elliptic equations with a nonlocal boundary condition. Electron. J. Differ. Equ. 2002, 5 (2002)

20. Martín-Vaquero, J.: Polynomial-based mean weighted residuals methods for elliptic problems with nonlocal boundary conditions in the rectangle. Nonlinear Anal., Model. Control 19(3), 448–459 (2014)

21. Nie, C., Shu, S., Yu, H., An, Q.: A high order composite scheme for the second order elliptic problem with nonlocal boundary and its fast algorithms. Appl. Math. Comput. 227, 212–221 (2014)

22. Volkov, E.A., Dosiyev, A.A., Buranay, S.C.: On the solution of a nonlocal problem. Comput. Math. Appl. 66(3), 330–338 (2013)

23. Berman, A., Plemmons, R.J.: Nonnegative Matrices in the Mathematical Sciences. SIAM, Philadelphia (1994)

24. Voevodin, V., Kuznetsov, Y.: Matrices and Computations. Nauka, Moscow (1984) (in Russian)

25. Varga, R.: Matrix Iterative Analysis, 2nd edn. Springer Series in Computational Mathematics, vol. 27. Springer, Berlin (2000)

26. Štikonienė, O., Sapagovas, M., Čiupaila, R.: On iterative methods for some elliptic equations with nonlocal conditions. Nonlinear Anal., Model. Control 19(3), 517–535 (2014)

27. Kuznetsov, Y., Prokopenko, A.: A new multilevel algebraic preconditioner for the diffusion equation in heterogeneous media. Numer. Linear Algebra Appl. 17, 759–769 (2010)

28. Blanc, X., Labourasse, E.: A positive scheme for diffusion problems on deformed meshes. Z. Angew. Math. Mech. 96(6), 660–680 (2016)

29. Notay, Y.: A robust algebraic multilevel preconditioner for non-symmetric M-matrices. Numer. Linear Algebra Appl. 7, 243–267 (2000)

30. El-Sayed, A.M.A., El-Azab, M.S., Elsaid, A., Helal, S.M.: Eigenvalue problem for elliptic partial differential equations with nonlocal boundary conditions. J. Fract. Calc. Appl. 5(14), 1–11 (2014)

31. Gulin, A.V.: On the spectral stability in subspaces for difference schemes with nonlocal boundary conditions. Differ. Equ. 49(7), 844–852 (2013)

32. Ivanauskas, F., Meškauskas, T., Sapagovas, M.: Stability of difference schemes for two-dimensional parabolic equations with nonlocal boundary conditions. Appl. Math. Comput. 215(7), 2716–2732 (2009)

33. Jachimavičienė, J., Sapagovas, M.: Locally one-dimensional difference scheme for a pseudoparabolic equation with nonlocal conditions. Lith. Math. J. 52(1), 53–61 (2012)

34. Jakubelienė, K., Sapagovas, M.: On the stability of a difference scheme for a two-dimensional parabolic equation with an integral condition. Lith. Math. J. 53(3), 311–323 (2013)

35. Sapagovas, M., Štikonienė, O., Čiupaila, R., Jokšienė, Ž.: Convergence of iterative methods for elliptic equations with integral boundary conditions. Electron. J. Differ. Equ. 2016, 118 (2016)

36. Štikonas, A.: A survey on stationary problems, Green’s functions and spectrum of Sturm–Liouville problem with nonlocal boundary conditions. Nonlinear Anal., Model. Control 19(3), 301–334 (2014)

37. Samarskii, A.A.: The Theory of Difference Schemes. Dekker, New York (2001)

38. Pavaloiu, I., Pop, N.: Interpolation and Applications. LAP Lambert Academic Publishing, Saarbrucken (2017)

39. Pao, C.V.: Block monotone iterative methods for numerical solutions of nonlinear elliptic equations. Numer. Math. 72, 239–262 (1995)

### Acknowledgements

The authors would like to thank the referees for helpful suggestions.

Not applicable.

Not applicable.

## Author information

Authors

### Contributions

All authors equally have made contributions. All authors read and approved the final manuscript.

### Corresponding author

Correspondence to Kristina Jakubėlienė.

## Ethics declarations

### Competing interests

There are no competing interests regarding this research work. 