Introduction

In this paper, we propose a numerical method based on Haar wavelet to obtain solution of the following elliptic partial differential equations (EPDEs):

$$\begin{aligned} \begin{aligned} {\mathrm {L}}(\mathbf{u })&= Q(x,y),\\ \Gamma (\mathbf{u })&=H(x,y), \end{aligned} \end{aligned}$$
(1)

where \({\mathrm {L}}\) is a differential operator (both linear and nonlinear) of the following form:

$$\begin{aligned} {\mathrm {L}} = F(\nabla ,\nabla ^2), \end{aligned}$$
(2)

\(\Gamma \) is the boundary operator and the functions Q(xy) and H(xy) are the source functions. The function u is the solution of the EPDE (1) defined on two-dimensional rectangular or square domain.

EPDEs have been used widely in applied mathematics, physics and engineering. The EPDEs are used to model real physical situations such as, the flow of air pollutants, temperature deflection, electrostatic potential, velocity potential, stream function, fluid flow [1, 2], etc. Analytical solutions of the EPDEs can be found only for simple models. When the model equations are closely related to experimental and practical situations then analytical solutions rarely exist and alternative numerical methods are used for numerical simulations of such model equations. Several numerical methods have been developed by different researchers for numerical solution of EPDEs [35]. Mostly numerical methods convert the model equations containing partial differential equations into discretized model equations that appear in the form of a set of algebraic linear or nonlinear equations.

Keeping in view the size of the problem and the advantages of a direct solver, we prefer LU-factorization as it aims to calculate exact solution in a finite number of operations. However for very large scale problems, the main limitation of direct solvers is the large memory requirement needed for mathematical operations. In contrast to this, iterative solvers are memory efficient but they do not always work well in all situations. Performances of the iterative solvers are sometime hampered by convergence issues, the nature of the governing equation being solved and other physical dynamics, like dealing with highly oscillatory solutions [6].

Due to the excellent properties of the Haar wavelet, a recent surge has been witnessed in the application of Haar wavelet (see [7, 8] and the references therein). Haar wavelet based approximation methods have attracted attention for various engineering and scientific problems [7, 917]. In [7] Haar wavelet collocation method (HWCM) has been used for linear elliptic PDEs. The major stumbling block in the implementation of the algorithm [7] is the computational cost of the algorithm which is prohibitively large and practically renders the method ineffective when implemented either on a denser grid or on a system of PDEs in higher dimensions. In the current work, we propose a modification of HWCM. In modified HWCM the issue of the cost of the algorithm [7] has been addressed by Haar wavelet approximation of fourth order mixed derivative instead of second order derivatives. Another advantage of the current method is the use of Kronecker tensor products which results in a very easy and simple implementation of the algorithm in a computer programming language. The new algorithm is implemented on two-dimensional steady state linear and nonlinear PDEs. A distinguishing feature of the method is that it can be applied to a variety of boundary conditions (BCs) with a little modification.

Suppose \(\mathbf{A }\) is an \(m\times n\) matrix and \(\mathbf{B }\) is a \(p\times q\) matrix, then the Kronecker tensor product of \(\mathbf{A }\) and \(\mathbf{B }\) denoted by \(\mathbf{A }\otimes \mathbf{B }\) is the matrix of order \(mp\times nq\) and is defined as follows:

$$\begin{aligned} \mathbf{A }\otimes \mathbf{B }= \left[ \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} a_{11}\mathbf{B }&{}a_{12}\mathbf{B }&{}\cdots &{}a_{1n}\mathbf{B }\\ a_{21}\mathbf{B }&{}a_{22}\mathbf{B }&{}\cdots &{}a_{2n}\mathbf{B }\\ \cdots &{}\cdots &{}\cdots &{}\cdots \\ a_{m1}\mathbf{B }&{}a_{m2}\mathbf{B }&{}\cdots &{}a_{mn}\mathbf{B } \end{array}\right] . \end{aligned}$$

Note that in MATLAB the Kronecker tensor product can be implemented easily and efficiently using the built-in function kron().

The rest of the paper is distributed as follows. In Sect. 2 definition of Haar wavelet is discussed. In Sect. 3, we discuss the numerical method along with different kinds of BCs. The numerical results are compared with the results obtained from other existed methods in Sect. 4. Some conclusions are drawn in the Sect. 5.

Haar Wavelet

A wavelet family \((\psi _{j,i}(x))_{j\in {\mathbb {N}},i\in {\mathbb {Z}}}\) is an orthonormal subfamily of the Hilbert space \(L^2({\mathbb {R}})\) with the property that all functions in the wavelet family are generated from a fixed function \(\psi \) called mother wavelet through dilations and translations. The wavelet family satisfies the following relation:

$$\begin{aligned} \psi _{j,i}(x)=2^{j/2}\psi (2^jx-i). \end{aligned}$$

The Haar wavelet family defined on the interval [0, 1) consists of the following functions:

$$\begin{aligned} h_1(x)= {\left\{ \begin{array}{ll} 1 &{} {\mathrm {for}}\ x\in [0,1) \\ 0 &{} {\mathrm {elsewhere}} \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} h_i(x)= {\left\{ \begin{array}{ll} 1 &{} {\mathrm {for}}\ x\in [\alpha ,\beta )\\ -1 &{} {\mathrm {for}}\ x\in [\beta ,\gamma )\\ 0 &{} {\mathrm {elsewhere}}, \qquad i=2,3,\ldots , \end{array}\right. } \end{aligned}$$

where

$$\begin{aligned} \begin{aligned} \alpha&=\frac{k}{m}, \quad \beta =\frac{(k+0.5)}{m}, \quad \gamma =\frac{(k+1)}{m};\\ m&=2^j,\quad j=0,1,\ldots ,\quad k=0,1,\ldots ,m-1. \end{aligned} \end{aligned}$$

The integer j indicates the level of the wavelet and k is the translation parameter. The relation between im and k is given by \(i=m+k+1\). The function \(h_1(x)\) is called scaling function whereas \(h_2(x)\) is the mother wavelet for the Haar wavelet family.

Any square integrable function f(x) defined on [0, 1) can be expressed as a linear combination of members of Haar wavelet family and is given as follows:

$$\begin{aligned} f(x)=\sum _{i=1}^\infty a_i h_i(x), \end{aligned}$$

where \(a_i\) are constants.

For approximation purpose we consider a maximum value J of the integer j, level of the Haar wavelet in the above definition. The integer J is then called maximum level of resolution. We also define the integer \(M=2^J\). With these notations any square integrable function f(x) defined on [0, 1) can be approximated as linear combination of finite members of Haar wavelet family and is given as follows:

$$\begin{aligned} f(x)\approx \sum _{i=1}^{2M} a_i h_i(x). \end{aligned}$$
(3)

The following notations are introduced:

$$\begin{aligned} p_{i,1}(x)=\int _0^x h_i(x')\,{\mathrm {d}}x', \end{aligned}$$

and

$$\begin{aligned} p_{i,n+1}(x)=\int _0^x p_{i,n}(x')\,{\mathrm {d}}x', \quad n=1,2,\ldots \end{aligned}$$

These integrals can be evaluated using the definition of Haar wavelet and are given as follows:

$$\begin{aligned} p_{i,n}(x)= {\left\{ \begin{array}{ll} 0 &{} {\mathrm {for}}\ x\in [0,\alpha )\\ \frac{1}{n!}(x-\alpha )^n &{} {\mathrm {for}}\ x\in [\alpha ,\beta )\\ \frac{1}{n!}\left[ (x-\alpha )^n-2(x-\beta )^n \right] &{} {\mathrm {for}}\ x\in [\beta ,\gamma )\\ \frac{1}{n!}\left[ (x-\alpha )^n-2(x-\beta )^n+(x-\gamma )^n \right] &{} {\mathrm {for}}\ x\in [\gamma ,1),\quad n=1,2,\ldots \end{array}\right. } \end{aligned}$$

where \(i=2,3,\ldots \) For \(i=1\), we have

$$\begin{aligned} p_{1,n}(x)=\frac{x^n}{n!}, \quad n=1,2,\ldots \end{aligned}$$

Numerical Method

In this section we will discuss a new collocation method based on Haar wavelet for EPDEs having Dirichlet, Neumann, mixed and periodic types of BCs. For Haar wavelet approximation the following collocation points are used:

$$\begin{aligned} x_k= & {} \frac{k-0.5}{n},\quad k=1,2,\ldots ,N, \end{aligned}$$
(4)
$$\begin{aligned} y_l= & {} \frac{l-0.5}{n},\quad l=1,2,\ldots ,N, \end{aligned}$$
(5)

where \(N=2M\) and M is the maximum level of resolution of the Haar wavelet. The computation domain for the given EPDEs (1) is \([0, 1]\times [0, 1]\) but can be extended to \([a, b]\times [a, b], \forall \,a,b\in {\mathbb {R}} \) through linear transformation.

Assume the following Haar wavelet approximation:

$$\begin{aligned} \frac{\partial ^4 u}{\partial x^2\partial y^2}=\sum _{i=1}^{N}\sum _{j=1}^{N}\lambda _{ij}h_i(x)h_j(y). \end{aligned}$$
(6)

Integrating Eq. (6) with respect to y, we obtain

$$\begin{aligned} \frac{\partial ^3 u}{\partial x^2\partial y}= & {} \frac{\partial ^4 u}{\partial x^2\partial y}(x,0)+\sum _{i=1}^{N}\sum _{j=1}^{N}\lambda _{ij}h_i(x)p_{j,1}(y), \end{aligned}$$
(7)
$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}= & {} \frac{\partial ^4 u}{\partial x^2}(x,0)+ y \frac{\partial ^4 u}{\partial x^2\partial y}(x,0)+\sum _{i=1}^{N}\sum _{j=1}^{N}\lambda _{ij}h_i(x)p_{j,2}(y). \end{aligned}$$
(8)

Using Haar approximations for the single-valued functions \(\frac{\partial ^4 u}{\partial x^2}(x,0)\) and \(\frac{\partial ^4 u}{\partial x^2\partial y}(x,0)\), we can write

$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}=\sum _{i=1}^{N}\alpha _i h_i(x)+ y \sum _{i=1}^{N}\beta _i h_i(x) +\sum _{i=1}^{N}\sum _{j=1}^{N}\lambda _{ij}h_i(x)p_{j,2}(y). \end{aligned}$$
(9)

Substituting the collocation points defined in Eqs. (4) and (5), we have

$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}(x_k,y_l)= & {} \sum _{i=1}^{N}\alpha _i h_i(x_k)+ y_l \sum _{i=1}^{N}\beta _i h_i(x_l)\nonumber \\&+\sum _{i=1}^{N}\sum _{j=1}^{N}\lambda _{ij}h_i(x_k)p_{j,2}(y_l),\quad k,l=1,2,\ldots ,N. \end{aligned}$$
(10)

The matrix \(\mathbf{H }\) of Haar functions having order \(N\times N\) is defined as follows:

$$\begin{aligned} \mathbf{H }=[h_{ji}]=[h_i(x_j)]. \end{aligned}$$
(11)

In a similar manner, we define

$$\begin{aligned} \begin{aligned} \mathbf{P }_{\mathbf{1 }}&=[p_{i,1}(x_j)],\\ \mathbf{P }_{\mathbf{2 }}&=[p_{i,2}(x_j)]. \end{aligned} \end{aligned}$$
(12)

Thus, in matrix notation Eq. (10) can be written as

$$\begin{aligned} \mathbf{u }_{\mathbf{xx }}=(\mathbf{H }\otimes \mathbf{1 }_N){\varvec{\alpha }}+ (\mathbf{H }\otimes \mathbf{y }){\varvec{\beta }} + (\mathbf{H } \otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}, \end{aligned}$$
(13)

where

$$\begin{aligned} \begin{aligned} \mathbf{u }_{\mathbf{xx }}&=\left[ \frac{\partial ^2 u}{\partial x^2}\left( x_1,y_1\right) ,\ldots ,\frac{\partial ^2 u}{\partial x^2}\left( x_1,y_N\right) ,\ldots ,\frac{\partial ^2 u}{\partial x^2}\left( x_N,y_1\right) ,\ldots ,\frac{\partial ^2 u}{\partial x^2}\left( x_N,y_N\right) \right] ^T,\\ \mathbf{1 }_N&=[1,1,\ldots ,1]^T,\quad {\varvec{\alpha }}=\left[ \alpha _1,\alpha _2,\ldots ,\alpha _N\right] ^T, \quad {\varvec{\beta }}=\left[ \beta _1,\beta _2,\ldots ,\beta _N\right] ^T, \\ \mathbf{y }&=\left[ y_1,y_2,\ldots ,y_N\right] ^T,\\ {\varvec{\lambda }}&=\left[ \lambda _{11},\lambda _{12},\ldots ,\lambda _{1N}, \lambda _{21},\lambda _{22}, \ldots ,\lambda _{2N},\ldots ,\lambda _{N1},\lambda _{N2},\ldots ,\lambda _{NN}\right] ^T. \end{aligned} \end{aligned}$$
(14)

Similarly, integrating Eq. (6) with respect to x, we obtain

$$\begin{aligned} \mathbf{u }_{\mathbf{yy }}=\left( \mathbf{1 }_N\otimes \mathbf{H }\right) {\varvec{\gamma }}+ \left( \mathbf{x }\otimes \mathbf{H }\right) {\varvec{\delta }} + \left( \mathbf{P }_{\mathbf{2 }}\otimes \mathbf{H }\right) {\varvec{\lambda }}, \end{aligned}$$
(15)

where

$$\begin{aligned} {\varvec{\gamma }}=[\gamma _1,\gamma _2,\ldots ,\gamma _N]^T, \quad {\varvec{\delta }}=[\delta _1,\delta _2,\ldots ,\delta _N]^T, \quad \mathbf{x }=[x_1,x_2,\ldots ,x_N]^T. \end{aligned}$$
(16)

The numerical method for different types of BCs will be explained separately in the following subsections.

Dirichlet BCs

The Dirichlet BCs for EPDEs are defined as follows:

$$\begin{aligned} u(0,y)= & {} g(0,y),\quad u(1,y)=g(1,y),\qquad y\in [0,1), \end{aligned}$$
(17)
$$\begin{aligned} u(x,0)= & {} g(x,0),\quad u(x,1)=g(x,1),\qquad x\in [0,1). \end{aligned}$$
(18)

Integrating Eq. (10) and using the BCs, we obtain

$$\begin{aligned} \mathbf{u }_{\mathbf{x }}= & {} \mathbf{1 }_N\otimes (g(1,\mathbf{y })-g(0,\mathbf{y }))+ ((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{1 }_N){\varvec{\alpha }} +((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{y }){\varvec{\beta }}\nonumber \\&+((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}, \end{aligned}$$
(19)
$$\begin{aligned} \mathbf{u }= & {} \mathbf{1 }_N\otimes g(0,\mathbf{y })+\mathbf{x }\otimes (g(1,\mathbf{y })-g(0,\mathbf{y }))+ ((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{1 }_N){\varvec{\alpha }}\nonumber \\&+((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{y }){\varvec{\beta }} +((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}, \end{aligned}$$
(20)

where

$$\begin{aligned} \mathbf{p }=[p_{1,2}(1),p_{2,2}(1),\ldots ,p_{N,2}(1)]^T. \end{aligned}$$
(21)

Similarly,

$$\begin{aligned} \mathbf{u }_{\mathbf{y }}= & {} (g(\mathbf{x },1)-g(\mathbf{x },0))\otimes \mathbf{1 }_N+ (\mathbf{1 }_N\otimes (\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N \mathbf{p }^{\mathbf{T }})){\varvec{\gamma }} +(\mathbf{x }\otimes (\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N \mathbf{p }^{\mathbf{T }})){\varvec{\delta }}\nonumber \\&+\,(\mathbf{P }_{\mathbf{2 }}\otimes (\mathbf{P }_{\mathbf{1 }}- \mathbf{1 }_N\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }}, \end{aligned}$$
(22)
$$\begin{aligned} \mathbf{u }= & {} g(\mathbf{x },0)\otimes \mathbf{1 }_N+ (g(\mathbf{x },1)- g(\mathbf{x },0))\otimes \mathbf{y }+ (\mathbf{1 }_N\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y } \mathbf{p }^{\mathbf{T }})){\varvec{\gamma }}\nonumber \\&+\,(\mathbf{x }\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y } \mathbf{p }^{\mathbf{T }})){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes (\mathbf{P }_{\mathbf{2 }}- \mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }}. \end{aligned}$$
(23)

Discretizing Eq. (2) and substituting the expressions of \(\mathbf{u }\) and its partial derivatives, a system of equations having \(N^2\) equations and \(N^2+4N\) unknowns is obtained. The additional 4N equations are obtained by comparing the two expressions of u given in Eqs. (20) and (23) respectively and substituting the values \(x=0\), \(x=1\), \(y=0\) and \(y=1\) one by one. These equations are given below.

$$\begin{aligned}&(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\gamma }}= g(0,\mathbf{y })-g(0,0)\mathbf{1 }_N-(g(0,1)-g(0,0))\mathbf{y },\\&(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\gamma }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\delta }} + (\mathbf{p }^{\mathbf{T }}\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }}\\&\quad =g(1,\mathbf{y })-g(1,0)\mathbf{1 }_N-(g(1,1)-g(1,0))\mathbf{y },\\&(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\alpha }}= g(\mathbf{x },0)-g(0,0)\mathbf{1 }_N-(g(1,0)-g(0,0))\mathbf{x },\\&(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\beta }} +((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }}\\&\quad =g(\mathbf{x },1)-g(0,1)\mathbf{1 }_N- (g(1,1)-g(0,1))\mathbf{x }. \end{aligned}$$

Combining all these equations results in a \((N^2+4N)\times (N^2+4N)\) linear or nonlinear system. Solution of this system yields the unknowns \({\varvec{\lambda }},{\varvec{\alpha }},{\varvec{\beta }},{\varvec{\gamma }}\) and \({\varvec{\delta }}\). The approximate solution u(xy) and its derivatives at any point of the domain can be calculated using these values.

Neumann BCs

The Neumann BCs for EPDEs are given below.

$$\begin{aligned} \frac{\partial u}{\partial x}(0,y)= & {} g_x(0,y),\quad \frac{\partial u}{\partial x}(1,y)=g_x(1,y),\qquad y\in [0,1), \end{aligned}$$
(24)
$$\begin{aligned} \frac{\partial u}{\partial y}(x,0)= & {} g_y(x,0),\quad \frac{\partial u}{\partial y}(x,1)=g_y(x,1),\qquad x\in [0,1). \end{aligned}$$
(25)

For Neumann BCs, we integrate Eq. (10) and obtain the following expressions.

$$\begin{aligned} \mathbf{u }_{\mathbf{x }}= & {} \mathbf{1 }_N\otimes g_x(0,\mathbf{y })+(\mathbf{P }_{\mathbf{1 }}\otimes \mathbf{1 }_N){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{1 }}\otimes \mathbf{y }){\varvec{\beta }} +(\mathbf{P }_{\mathbf{1 }}\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}, \end{aligned}$$
(26)
$$\begin{aligned} \mathbf{u }= & {} (\mathbf{1 }_N\otimes \mathbf{I }_N)u(0,\mathbf{y }) +\mathbf{x }\otimes g_x(0,\mathbf{y }) +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{1 }_N){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{y }){\varvec{\beta }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }},\nonumber \\ \end{aligned}$$
(27)

where \(\mathbf{I }_N\) is the identity matrix of order \(N\times N\). Similarly,

$$\begin{aligned} \mathbf{u }_{\mathbf{y }}= & {} g_y(\mathbf{x },0)\otimes \mathbf{1 }_N +(\mathbf{1 }_N\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\lambda }}, \end{aligned}$$
(28)
$$\begin{aligned} \mathbf{u }= & {} (\mathbf{I }_N\otimes \mathbf{1 }_N)u(\mathbf{x },0) + g_y(\mathbf{x },0)\otimes \mathbf{y } +(\mathbf{1 }_N\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}.\nonumber \\ \end{aligned}$$
(29)

These expressions when substituted in Eq. (1) give rise to a system of equations having \(N^2\) equations but \(N^2+6N\) unknowns \({\varvec{\lambda }},{\varvec{\alpha }},{\varvec{\beta }}, {\varvec{\gamma }},{\varvec{\delta }}, u(0,\mathbf{y })\) and \(u(\mathbf{x },0)\). Integrating Eq. (10) and using the BCs we get the following N equations:

$$\begin{aligned} \alpha _1\mathbf{1 }_N +\beta _1\mathbf{y } +(\mathbf{e }_{\mathbf{1 }}^{\mathbf{T }}\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}=g_x(1,\mathbf{y })-g_x(0,\mathbf{y }), \end{aligned}$$
(30)

where \(\mathbf{e }_{\mathbf{1 }}=[1\; 0 \cdots 0]^{\mathbf{T }}\). Similarly,

$$\begin{aligned} \gamma _1\mathbf{1 }_N +\delta _1\mathbf{x } +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{e }_{\mathbf{1 }}^{\mathbf{T }} ){\varvec{\lambda }}=g_y(\mathbf{x },1)-g_y(\mathbf{x },0). \end{aligned}$$
(31)

Another 4N equations are obtained by comparing two expressions of \(\mathbf{u }\) given in Eqs. (27) and (29), and substituting \(x=0\), \(x=1\), \(y=0\) and \(y=1\) one by one. These equations are given below.

$$\begin{aligned}&\mathbf{I }_Nu(0,\mathbf{y }) -\mathbf{P }_{\mathbf{2 }}{\varvec{\gamma }}-\mathbf{1 }_Nu(0,0)=g_y(0,0)\mathbf{y },\nonumber \\&\mathbf{I }_Nu(0,\mathbf{y }) +(\mathbf{p }^{\mathbf{T }}\otimes \mathbf{1 }_N){\varvec{\alpha }} +(\mathbf{p }^{\mathbf{T }}\otimes \mathbf{y }){\varvec{\beta }} -\mathbf{P }_{\mathbf{2 }}{\varvec{\gamma }} -\mathbf{P }_{\mathbf{2 }}{\varvec{\delta }}-\mathbf{1 }_Nu(1,0)=g_y(1,0)\mathbf{y }-g_x(0,\mathbf{y }),\nonumber \\&\mathbf{I }_Nu(\mathbf{x },0) -\mathbf{P }_{\mathbf{2 }}{\varvec{\alpha }}-\mathbf{1 }_Nu(0,0)=g_x(0,0)\mathbf{x },\nonumber \\&\mathbf{I }_Nu(\mathbf{x },0) -\mathbf{P }_{\mathbf{2 }}{\varvec{\alpha }} -\mathbf{P }_{\mathbf{2 }}{\varvec{\beta }} +(\mathbf{1 }_n\otimes \mathbf{p }^{\mathbf{T }}){\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{p }^{\mathbf{T }}){\varvec{\delta }} -\mathbf{1 }_Nu(0,1)=g_x(0,1)\mathbf{x }-g_y(\mathbf{x },0).\nonumber \\ \end{aligned}$$
(32)

The above 4N equations involve three more unknowns u(0, 0), u(1, 0) and u(0, 1). Substituting \(y=0\) and \(y=1\) in Eq. (30), and \(x=0\) in Eq. (31), we obtain the following three equations:

$$\begin{aligned}&\alpha _1=g_x(1,0)-g_x(0,0)\nonumber \\&\alpha _1+\beta _1+ (\mathbf{e }_{\mathbf{1 }}^{\mathbf{T }}\otimes \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }}=g_x(1,1)-g_x(0,1)\\&\gamma _1=g_y(0,1)-g_y(0,0).\nonumber \end{aligned}$$
(33)

The numerical solution is obtained in a similar way as discussed in the case of Dirichlet BCs in the previous subsection.

Mixed BCs

In this section, two types of mixed BCs will be considered.

Type I

The first type of mixed BCs for EPDEs are given as follows:

$$\begin{aligned} u(0,y)= & {} g(0,y),\quad u(1,y)=g(1,y),\qquad y\in [0,1), \end{aligned}$$
(34)
$$\begin{aligned} \frac{\partial u}{\partial y}(x,0)= & {} g_y(x,0),\quad \frac{\partial u}{\partial y}(x,1)=g_y(x,1),\qquad x\in [0,1). \end{aligned}$$
(35)

Using BCs (34) the following expressions are obtained.

$$\begin{aligned} \mathbf{u }_{\mathbf{x }}= & {} \mathbf{1 }_N\otimes (g(1,\mathbf{y })-g(0,\mathbf{y }))+ ((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{1 }_N){\varvec{\alpha }} +((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} )\otimes \mathbf{y }){\varvec{\beta }}\nonumber \\&+((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N \mathbf{p }^{\mathbf{T }})\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}, \end{aligned}$$
(36)
$$\begin{aligned} \mathbf{u }= & {} \mathbf{1 }_N\otimes g(0,\mathbf{y }) +\mathbf{x }\otimes (g(1,\mathbf{y })-g(0,\mathbf{y }))+ ((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }} )\otimes \mathbf{1 }_N){\varvec{\alpha }}\nonumber \\&+((\mathbf{P }_{\mathbf{2 }}-\mathbf{x } \mathbf{p }^{\mathbf{T }})\otimes \mathbf{y }){\varvec{\beta }} +((\mathbf{P }_{\mathbf{2 }}-\mathbf{x } \mathbf{p }^{\mathbf{T }})\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}. \end{aligned}$$
(37)

Similarly, using BCs (35), we obtain

$$\begin{aligned} \mathbf{u }_{\mathbf{y }}= & {} g_y(\mathbf{x },0)\otimes \mathbf{1 }_N +(\mathbf{1 }_N\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\lambda }}, \end{aligned}$$
(38)
$$\begin{aligned} \mathbf{u }= & {} (\mathbf{I }_N\otimes \mathbf{1 }_N)u(\mathbf{x },0) + g_y(\mathbf{x },0)\otimes \mathbf{y } +(\mathbf{1 }_N\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}.\nonumber \\ \end{aligned}$$
(39)

These expressions when substituted in Eq. (1) give rise to a system of equations having \(N^2\) equations but \(N^2+5N\) unknowns \({\varvec{\lambda }},{\varvec{\alpha }},{\varvec{\beta }}, {\varvec{\gamma }},{\varvec{\delta }}\) and \(u(\mathbf{x },0)\). Integrating Eq. (15) and using the BCs we get the following N equations.

$$\begin{aligned} \gamma _1\mathbf{1 }_N +\delta _1\mathbf{x } +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{e }_{\mathbf{1 }}^{\mathbf{T }} ){\varvec{\lambda }}=g_y(\mathbf{x },1)-g_y(\mathbf{x },0). \end{aligned}$$
(40)

Comparing the two expressions of \(\mathbf{u }\) and substituting values of \(x=0,1\) and \(y=0,1\) we obtain the following 4N equations.

$$\begin{aligned}&g(0,\mathbf{y })=\mathbf{P }_{\mathbf{2 }} {\varvec{\gamma }}+\mathbf{1 }_nu(0,0)+g_y(0,0)\mathbf{y },\nonumber \\&g(1,\mathbf{y })=\mathbf{P }_{\mathbf{2 }} {\varvec{\gamma }}+\mathbf{P }_{\mathbf{2 }} {\varvec{\delta }}+ \mathbf{1 }_Nu(1,0)+g_y(1,0)\mathbf{y } +(\mathbf{1 }_n\mathbf{p }^{\mathbf{T }} \otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }},\nonumber \\&g(0,0)\mathbf{1 }_N+(g(1,0)-g(0,0))\mathbf{x }+ (\mathbf{P }_{\mathbf{2 }}-\mathbf{x } \mathbf{p }^{\mathbf{T }}){\varvec{\alpha }}=u (\mathbf{x },0),\nonumber \\&g(0,1)\mathbf{1 }_N+(g(1,1)-g(0,1))\mathbf{x }+ (\mathbf{P }_{\mathbf{2 }}-\mathbf{x } \mathbf{p }^{\mathbf{T }}){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{x } \mathbf{p }^{\mathbf{T }}){\varvec{\beta }}\nonumber \\&\qquad + ((\mathbf{P }_{\mathbf{2 }}- \mathbf{x }\mathbf{p }^{\mathbf{T }}) \otimes \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }}\nonumber \\&\quad =\mathbf{I }_Nu(\mathbf{x },0)+ (\mathbf{1 }_N\otimes \mathbf{p }^{\mathbf{T }}) {\varvec{\gamma }} +(\mathbf{x }\otimes \mathbf{p }^{\mathbf{T }}) {\varvec{\delta }} +g_y(\mathbf{x },0) +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{1 }_N \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }}.\nonumber \end{aligned}$$
(41)

The solution procedure is similar to previous cases.

Type II

The second type of mixed BCs considered here are given below.

$$\begin{aligned} \frac{\partial u}{\partial x}(0,y)= & {} g_x(0,y),\quad u(1,y)=g(1,y),\qquad y\in [0,1), \end{aligned}$$
(42)
$$\begin{aligned} \frac{\partial u}{\partial y}(x,0)= & {} g_y(x,0),\quad u(x,1)=g(x,1),\qquad x\in [0,1). \end{aligned}$$
(43)

Different expressions of \(\mathbf{u }\) and its derivatives are given as follows:

$$\begin{aligned} \mathbf{u }_{\mathbf{x }}= & {} \mathbf{1 }_N\otimes g_x(0,\mathbf{y })+(\mathbf{P }_{\mathbf{1 }} \otimes \mathbf{1 }_N){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{1 }}\otimes \mathbf{y }) {\varvec{\beta }}+(\mathbf{P }_{\mathbf{1 }} \otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}, \end{aligned}$$
(44)
$$\begin{aligned} \mathbf{u }= & {} \mathbf{1 }_N\otimes g(1,\mathbf{y }) - (\mathbf{1 }_N-\mathbf{x })\otimes g_x(0,\mathbf{y }) \nonumber \\&-((\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} -\mathbf{P }_{\mathbf{2 }}) \otimes \mathbf{1 }_N){\varvec{\alpha }} -((\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} -\mathbf{P }_{\mathbf{2 }}) \otimes \mathbf{y }){\varvec{\beta }} \nonumber \\&-((\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} -\mathbf{P }_{\mathbf{2 }}) \otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}, \end{aligned}$$
(45)
$$\begin{aligned} \mathbf{u }_{\mathbf{y }}= & {} g_y(\mathbf{x },0) \otimes \mathbf{1 }_N+(\mathbf{1 }_N\otimes \mathbf{P }_{\mathbf{1 }} ){\varvec{\gamma }}+(\mathbf{x }\otimes \mathbf{P }_{\mathbf{1 }} ){\varvec{\delta }}+(\mathbf{P }_{\mathbf{2 }} \otimes \mathbf{P }_{\mathbf{1 }}){\varvec{\lambda }}, \end{aligned}$$
(46)
$$\begin{aligned} \mathbf{u }= & {} g(\mathbf{x },1)\otimes \mathbf{1 }_N - g_y(\mathbf{x },0)\otimes (\mathbf{1 }_N-\mathbf{y }) -(\mathbf{1 }_N\otimes (\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} -\mathbf{P }_{\mathbf{2 }})){\varvec{\gamma }}\nonumber \\&-(\mathbf{x }\otimes (\mathbf{1 }_N \mathbf{p }^{\mathbf{T }}-\mathbf{P }_{\mathbf{2 }})) {\varvec{\delta }}-(\mathbf{P }_{\mathbf{2 }}\otimes (\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}- \mathbf{P }_{\mathbf{2 }})){\varvec{\lambda }}, \end{aligned}$$
(47)

Comparing the two different expressions of u and substituting \(x=0,1\) and \(y=0,1\) the following equations are obtained:

$$\begin{aligned}&g(1,\mathbf{y })-g_x(0,\mathbf{y })-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}{\varvec{\alpha }}- \mathbf{y }\mathbf{p }^{\mathbf{T }}{\varvec{\beta }} -(\mathbf{p }^{\mathbf{T }}\otimes \mathbf{P }_{\mathbf{2 }}) {\varvec{\lambda }}\nonumber \\&\quad = g(0,1)\mathbf{1 }_N -g_y(0,0) (\mathbf{1 }_N-\mathbf{y }) -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} - \mathbf{P }_{\mathbf{2 }}) {\varvec{\gamma }},\nonumber \\&g(1,\mathbf{y }) = g(1,1) \mathbf{1 }_N -g_y(1,0) (\mathbf{1 } - \mathbf{y }) -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} - \mathbf{P }_{\mathbf{2 }}) {\varvec{\gamma }} -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}\nonumber \\&\qquad -\mathbf{P }_{\mathbf{2 }}){\varvec{\delta }} - (\mathbf{p }^{\mathbf{T }} \otimes (\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}-\mathbf{P }_{\mathbf{2 }})) {\varvec{\lambda }},\nonumber \\&g(1,0)\mathbf{1 }_N-g_x(0,0)(\mathbf{1 }_N-\mathbf{x }) -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} - \mathbf{P }_{\mathbf{2 }}) {\varvec{\alpha }} = g(\mathbf{x },1) - g_y(\mathbf{x },0)\nonumber \\&\qquad -\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}{\varvec{\gamma }} - \mathbf{x }\mathbf{p }^{\mathbf{T }}{\varvec{\delta }} -(\mathbf{P }_{\mathbf{2 }} \otimes \mathbf{p }^{\mathbf{T }} ) {\varvec{\lambda }},\nonumber \\&g(1,1) \mathbf{1 }_N-g_x(0,1)(\mathbf{1 }_N-\mathbf{x }) -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} - \mathbf{P }_{\mathbf{2 }}) {\varvec{\alpha }} -(\mathbf{1 }_N\mathbf{p }^{\mathbf{T }} - \mathbf{P }_{\mathbf{2 }}){\varvec{\beta }}\nonumber \\&\qquad -((\mathbf{1 }_N\mathbf{p }^{\mathbf{T }}-\mathbf{P }_{\mathbf{2 }})\otimes \mathbf{p }^{\mathbf{T }}) {\varvec{\lambda }} = g(\mathbf{x },1).\nonumber \end{aligned}$$
(48)

The solution procedure is similar.

Periodic BCs

The periodic BCs for EPDEs are given as follows:

$$\begin{aligned} \begin{aligned} u(0,y)&=u(1,y),\quad \frac{\partial u}{\partial x}(0,y)=\frac{\partial u}{\partial x}(1,y),\qquad y\in [0,1),\\ u(x,0)&=u(x,1),\quad \frac{\partial u}{\partial y}(x,0)=\frac{\partial u}{\partial y}(x,1),\qquad x\in [0,1). \end{aligned} \end{aligned}$$
(49)

Integrating Eq. (10) and using BCs the following expressions are obtained:

$$\begin{aligned} \mathbf{u }_{\mathbf{x }}= & {} ((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})\otimes \mathbf{1 }_N){\varvec{\alpha }} +((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})\otimes \mathbf{y }){\varvec{\beta }}\nonumber \\&+((\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}, \end{aligned}$$
(50)
$$\begin{aligned} \mathbf{u }= & {} (\mathbf{1 }_N\otimes \mathbf{I }_N)u(0,\mathbf{y }) +((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }})\otimes \mathbf{1 }_N){\varvec{\alpha }}\nonumber \\&+((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }})\otimes \mathbf{y }){\varvec{\beta }} +((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }})\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}. \end{aligned}$$
(51)

Similarly,

$$\begin{aligned} \mathbf{u }_{\mathbf{y }}= & {} (\mathbf{1 }_N\otimes (\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})){\varvec{\gamma }} +(\mathbf{x }\otimes (\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})){\varvec{\delta }}\nonumber \\&+(\mathbf{P }_{\mathbf{2 }}\otimes (\mathbf{P }_{\mathbf{1 }}-\mathbf{1 }_N\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }}, \end{aligned}$$
(52)
$$\begin{aligned} \mathbf{u }= & {} (\mathbf{I }_N\otimes \mathbf{1 }_N)u(\mathbf{x },0) +(\mathbf{1 }_N\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\gamma }}\nonumber \\&+(\mathbf{x }\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\delta }} +(\mathbf{P }_{\mathbf{2 }}\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }}. \end{aligned}$$
(53)

Additional equations obtained are given below.

$$\begin{aligned}&\alpha _1\mathbf{1 }_N +\beta _1\mathbf{y } +(\mathbf{e }_{\mathbf{1 }}^{\mathbf{T }}\otimes \mathbf{P }_{\mathbf{2 }}){\varvec{\lambda }}=0,\nonumber \\&\gamma _1\mathbf{1 }_N +\delta _1\mathbf{x } +(\mathbf{P }_{\mathbf{2 }}\otimes \mathbf{e }_{\mathbf{1 }}^{\mathbf{T }}){\varvec{\lambda }}=0,\nonumber \\&(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\gamma }}-\mathbf{I }_Nu(0,\mathbf{y })+u(0,0)=0,\nonumber \\&(\mathbf{p }^{\mathbf{T }}\otimes (\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }})){\varvec{\lambda }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\gamma }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{y }\mathbf{p }^{\mathbf{T }}){\varvec{\delta }} -\mathbf{I }_Nu(0,\mathbf{y }) +u(1,0)=0,\nonumber \\&(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\alpha }} -\mathbf{I }_Nu(\mathbf{x },0) +u(0,0)=0,\\&((\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }})\otimes \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\alpha }} +(\mathbf{P }_{\mathbf{2 }}-\mathbf{x }\mathbf{p }^{\mathbf{T }}){\varvec{\beta }} -\mathbf{I }_Nu(\mathbf{x },0) +u(0,1)=0,\nonumber \\&\alpha _1=0,\nonumber \\&\alpha _1+\beta _1+(\mathbf{e }_{\mathbf{1 }}^{\mathbf{T }}\otimes \mathbf{p }^{\mathbf{T }}){\varvec{\lambda }}=0,\nonumber \\&\gamma _1=0;\nonumber \end{aligned}$$
(54)

The solution procedure is similar to the previous cases.

Numerical Experiments

In this section, numerical and graphical results obtained from modified HWCM is presented. The method is applied to four Test Problems with known exact solutions. Test Problem 1 is a Helmholtz equation which is a linear EPDE. This problem is considered in order to show the better efficiency of the modified HWCM as compared to HWCM [7]. Test Problems 2 and 3 are linear Poisson equations with constant and variable sources respectively. These steady-state problems have several applications in fluid dynamics, electrostatics, heat transfer and mass transfer. Finally Test Problem 4 is a generalized nonlinear Poisson equation. This problem is considered in order to show the applicability of modified HWCM to nonlinear problems as well.

The algorithm is implemented in MATLAB on Intel Core i7 processor with 32 GB RAM. The performance of the method is demonstrated using the \(L_\infty \) norm which is defined as

$$\begin{aligned} L_\infty =\max \limits _{i,j}| u_{{\mathrm {app}}}(x_i,y_j)-u_{{\mathrm {ex}}}(x_i,y_j)|,\quad i,j=1,2,\ldots ,N, \end{aligned}$$
(55)

where \(u_{{\mathrm {app}}}(x_i,y_j)\) is the numerical and \(u_{{\mathrm {ex}}}(x_i,y_j)\) is the exact solution at the point \((x_i,y_j)\).

Helmholtz Equation

Test Problem 1

Consider the Helmholtz equation [7]:

$$\begin{aligned} \frac{\partial ^2u}{\partial x^2}+\frac{\partial ^2u}{\partial y^2}+900\;u(x,y)=f(x,y),\quad 0\le x,y\le 1, \end{aligned}$$
(56)

subject to Dirichlet BCs. The function f(xy) is taken such that the exact solution of the problem is \(u(x,y)=e^{xy^2}\). Comparison of the CPU time of the present method with our earlier method [7] is given in Table 1. It is clear from the table that in addition to good accuracy, the new algorithm is almost 7 times faster than the previous algorithm [7].

Table 1 Comparison of CPU time of present method with method [7] for Test Problem 1

Poisson Equation

Test Problem 2

(Constant source) Consider the Poisson equation:

$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}+\frac{\partial ^2 u}{\partial y^2}=Q,\quad -a\le x\le a,\ -b\le y\le b, \end{aligned}$$
(57)

where Q is a constant, subject to the Dirichlet BCs:

$$\begin{aligned} \begin{aligned} u(-a,y)&=0, u(a,y)=0,\quad -b\le y\le b,\\ u(x,-b)&=0, u(x,b)=0,\quad -a\le x\le a. \end{aligned} \end{aligned}$$
(58)

Equation (57) describes the steady-state two-dimensional diffusion (cross-wind integrated) of a pollutant in the absence of wind with constant source strength Q in a finite domain [1]. It also describes the steady-state transport of oxygen in a slab of tissue with a constant oxygen consumption rate [18]. In addition to this, it also represents the steady-state temperature distribution in a rectangular region with heat loss (production) at a constant rate Q [2].

The solution of Eq. (57) with BCs (58) is symmetric with respect to both x- and y-axis. Due to this reason Eq. (57) is solved in the region \((0<x<a,\;0<y<b)\) subject to the following BCs [1]:

$$\begin{aligned} \begin{aligned} u(a,y)&=0, \frac{\partial u}{\partial x}(0,y)=0,\quad 0\le y\le b\\ u(x,b)&=0, \frac{\partial u}{\partial y}(x,0)=0,\quad 0\le x\le a. \end{aligned} \end{aligned}$$
(59)

The exact solution of the problem is given as follows [1]:

$$\begin{aligned} u(x,y)=\frac{2Q}{a}\sum _{k=0}^\infty \frac{\left( -1\right) ^k}{\left( \lambda _k\right) ^{3/2}}\left( \frac{\cosh \sqrt{\lambda _k}y}{\cosh \sqrt{\lambda _k}b}-1\right) \cos \left( \sqrt{\lambda _k} x\right) , \end{aligned}$$
(60)

where \(\sqrt{\lambda _k}=\frac{(2k+1)\pi }{2a}\).

Maximum absolute errors for different number of collocation points are shown in Table 2. Like the other test problems an efficient and accurate solution has been obtained through the new algorithm.

Table 2 Maximum absolute errors and CPU time for Test Problem 2

Test Problem 3

(Variable source) Consider Poisson equation with variable source:

$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}+\frac{\partial ^2 u}{\partial y^2}=f(x,y),\quad -a\le x\le a,\ -b\le y\le b, \end{aligned}$$
(61)

where source is a function of both x and y. The BCs are same as considered in Test Problem 2 which are given in Eq. (58).

Important applications of Eq. (61) occur in fluid dynamics (u is stream function and f is vorticity), electrostatics (u is electric potential and f is the ratio of charge density to dielectric constant), heat transfer (u is temperature and f is the loss/generation of heat) and mass transfer (u is concentration and f is source/sink term) [2].

The solution of Eq. (61) is expected to be symmetric in x and y [2] and therefore we consider the region \((0<x<a,\;0<y<b)\) with the BCs (59).

We assume that f(xy) is the same function as the exact solution of Test Problem 2 which is given in Eq. (60). With this f, the exact solution of Eq. (61) is given below [1]:

$$\begin{aligned} u(x,y)= & {} \frac{Q}{a} \sum _{k=0}^\infty \left[ \frac{(-1)^k}{(\lambda _k)^{5/2}}\right] \left[ \left\{ 2+\sqrt{\lambda _k}y\frac{\sinh \sqrt{\lambda _k}y}{\cosh \sqrt{\lambda _k}b} \right\} \right. \nonumber \\&-\left. \left\{ 2+\sqrt{\lambda _k}b\frac{\sinh \sqrt{\lambda _k}b}{\cosh \sqrt{\lambda _k}b}\right\} \left( \frac{\cosh \sqrt{\lambda _k}y}{\cosh \sqrt{\lambda _k}b} \right) \right] \cos \left( \sqrt{\lambda _k}x \right) , \end{aligned}$$
(62)

where \(\sqrt{\lambda _k}=\frac{(2k+1)\pi }{2a}\).

Maximum absolute errors for different number of collocation points are shown in Table 3. It is conformed from the table that a converging solution has been reproduced by the new algorithm in a fairly less CPU time.

Table 3 Maximum absolute errors and CPU time for Test Problem 3

Generalized Nonlinear Poisson Equation

Test Problem 4

Consider a nonlinear Poisson problem [19]:

$$\begin{aligned} \frac{\partial ^2 u}{\partial x^2}+\frac{\partial ^2 u}{\partial y^2}+\left( \frac{\partial u}{\partial y}\right) ^2=f(x,y),\quad 0\le x\le 1,\ 0\le y \le 1, \end{aligned}$$
(63)

subject to the following Dirichlet BCs:

$$\begin{aligned} \begin{aligned} u(0,y)&=0,\quad u(1,y)=y+a,\\ u(x,0)&=ax, \quad u(x,1)=x(x+a), \end{aligned} \end{aligned}$$
(64)

where a is any constant. The analytical solution of the problem is \(u(x,y)=x(xy+a)\). For simplicity, the value of the constant a is taken to be zero. The numerical results are shown in Table 4. The nonlinear system of equations obtained after substituting the Haar wavelet approximations which may be solved using either Newton’s method or Broyden’s method. For numerical experiments we have used Broyden’s method as it is more economical in terms of CPU time. The initial guess for the Broyden’s method was taken to be zero and the iterations were terminated when the convergence criterion \(10^{-6}\) was satisfied. The number of iterations and the CPU time for different number of grid points are also shown in Table 4. It is evident from the table that the new method has obtained the desired accuracy in 11 iteration keeping the CPU time in a reasonable limit.

Table 4 Maximum absolute errors and CPU time for Test Problem

Conclusion

A modified Haar wavelet collocation method is presented for numerical solution of elliptic partial differential equations. The method can solve both linear as well as nonlinear EPDEs numerically. The method can be applied to different types of boundary conditions easily with a slight modification. The method is tested on several benchmark problems. It is observed that the proposed method is more efficient.