1 Introduction

The linear and nonlinear Schrödinger equations are very important in modern physics. These equations have many applications to explain several occurrences in physics and engineering. The interested readers can find the most applications of Schrödinger equation in Teschl (2009). In the present work, we consider the nonlinear Schrödinger equation (NLSE) with the following form

$$\begin{aligned}&i\partial _{t} \varPsi +\alpha \nabla ^2 \varPsi =\omega (\mathbf{x} ,t)\varPsi +\beta |\varPsi |^2\varPsi , \qquad t \in (0,T] ,\nonumber \\&\quad \mathbf{x} \in \varOmega \subset \mathbb {R}^d ,\ d=2,3, \end{aligned}$$
(1)

subject to the Dirichlet boundary condition

$$\begin{aligned} \varPsi (\mathbf{x} ,t)=g(\mathbf{x} ,t),\qquad \mathbf{x} \in \partial \varOmega ,\ t\in (0,T], \end{aligned}$$

and the initial condition

$$\begin{aligned} \varPsi (\mathbf{x} ,0)=h(\mathbf{x} ),\qquad \mathbf{x} \in \varOmega , \end{aligned}$$

where \( i^2=-1, \)\( \varPsi \) is an unknown complex-valued function, \(\omega \) is an arbitrary potential function, gh are specific functions and \( \alpha , \beta \) are real constants.

As regards, the solution of NLSE is of essential importance to explain several phenomena in engineering and physics; thus, solving this equation is very necessary. Many researchers studied several numerical methods for NLSE (1). In Jin et al. (2015), Shi et al. (2016), Wang and Huang (2017), Shi et al. (2017), the finite element methods were used. In Hong et al. (2019), Li et al. (2012), Yıldırım Aksoy et al. (2017), Gao and Xie (2011), Hu and Chen (2016), Dehghan (2006), the authors employed different types of finite difference techniques for solving various models of Schrödinger equation. Some meshless schemes have been applied for solving many kinds of linear and nonlinear Schrödinger equations (Kaplan and Dereli 2017; Zhang and Chen 2016; Dereli 2012; Dehghan and Mohammadi 2017, 2016; Ilati and Dehghan 2019).

In the past two decades, in order to avoid mesh production, many researchers studied meshfree methods. Dehghan and Shokri (2007) proposed a numerical algorithm based on a collocation scheme by employing the multi-quadrics and thin-plate spline radial basis functions to solve the linear Schrödinger equation. Authors of Abbasbandy et al. (2013) applied a meshless method based on the non-symmetric radial basis function collocation method to solve NLSE (1). In a meshfree method, a set of nodes is scattered in the problem domain instead of meshing it and a certain weight function with local compact support is associated with each of these nodes. The meshless local Petrov–Galerkin (MLPG) method (Ilati and Dehghan 2016, 2015, 2017) is an efficient meshfree method to solve partial differential equations with complicated domains. This method was first introduced by Atluri and Zhu (1998) and later developed in-depth by Atluri and Shen Atluri and Shen (2002). One of the most important properties of this method is the use of local weak form in each sub-domain instead of a global weak form. The MLPG method based on the moving least squares (MLS) approximation has been widely applied in a broad field of partial differential equations. Dehghan and Mirzaei (2008) used the MLPG method based on the MLS approximation for solving NLSE (1).

Solving the nonlinear part in meshfree methods based on the weak form can be usually difficult and complicated. To remove this complexity, different approaches have been used. For example, in Dehghan and Mirzaei (2008) to deal with nonlinearity, a predictor–corrector approach is used. Also, the authors applied a scheme based on the Newton method to meet the nonlinear part of NLSE (1) (Abbasbandy et al. 2013). In the present study, we use an efficient operator splitting technique to overcome nonlinearity. The operator splitting schemes have much superiority, particularly for some hard issues. Some of these operator splitting schemes are mostly used to study physical components and subsystems such as velocity, density and pressure. The proposed splitting algorithm has the second-order accuracy based on the Strang splitting scheme. The main idea of this technique is to separate the original problem into linear and nonlinear subproblems. In this case, one needs to solve each part separately for small time steps and then interconnect the solutions at last for every time step. This is simpler compared to the original equation for obtaining the approximate solution by using the analytical or numerical solutions of subproblems in a specific instruction (Dehghan and Taleei 2011; Bai and Zhang 2011; Bao and Shen 2005; Degond et al. 2008; Kassam and Trefethen 2005; Liao et al. 2018; Ducomet et al. 2015; Wang and Zhang 2019; Wang et al. 2013). Here, the nonlinear subproblem can be solved exactly.

In the MLPG method based on MLS approximation, the imposition of the Dirichlet boundary condition is not always easy, because the MLS shape functions do not have the Kronecker delta property. We use the moving Kriging (MK) interpolation instead of MLS approximation to build shape functions of the MLPG scheme. By doing this, the MLPG shape functions have the Kronecker delta property. So, we can apply the Dirichlet boundary condition directly and easily. Some authors have discussed and extended the MLPG approach based on the MK interpolation (Gu 2003; Phaochoo et al. 2016; Shokri and Habibirad 2016; Bui et al. 2011; Dai et al. 2013; Kaewumpai 2015; Xing-Guo et al. 2010; Zheng and Dai 2011).

In this paper, we will apply a combination of the MLPG method based on MK interpolation and the Strang splitting scheme to obtain the numerical solution of 2D and 3D nonlinear Schrödinger equations. We call the proposed method, as a time-splitting MLPG scheme.

The organization of this paper is as follows: In Sect. 2, we will explain the MK interpolation. In Sect. 3, we demonstrate the MLPG scheme with the Heaviside step function as the test function for solving the linear part of NLSE. Since the shape functions of MLPG based on MLS approximation do not have Kronecker delta property, we cannot impose the essential boundary condition, directly. Thus, we use the MK interpolation instead of MLS. So, the MLPG shape functions have the mentioned property and one can impose the Dirichlet boundary condition directly and easily. The Crank–Nicolson method is used in time discretization since it has the same accuracy as Strang splitting scheme. Also, the nonlinear part will be solved exactly. A series of numerical experiments are performed for 2D and 3D nonlinear Schrödinger equations in Sect. 4. Finally, a brief conclusion is given in Sect. 5.

2 The Moving Kriging Interpolation

In this section, we use the MK interpolation to represent trial function with the values of unknown variable at some randomly located points. Like the MLS approximation, the MK interpolation approach can be expanded in each sub-domain \( \varOmega ^{'}\subset \varOmega \). Let \( \varPsi _{h}(\mathbf {x}) \) be an approximate solution of \( \varPsi (\mathbf {x}) \) defined in \(\varOmega \) which is represented by a set of randomly located nodes. The MK interpolation \( \varPsi _{h}(\mathbf {x}) \) at node \( \mathbf {x} \) has the following form

$$\begin{aligned} \varPsi _{h}(\mathbf {x})=\sum _{i=1}^{N} \phi _{i}(\mathbf {x})\psi _{i}=\varPhi (\mathbf {x})\mathbf {\psi }, \end{aligned}$$
(2)

where

$$\begin{aligned} \varPhi (\mathbf {x})=\mathbf {p}^T(\mathbf {x})A + \mathbf {r}^T(\mathbf {x})B. \end{aligned}$$
(3)

Also, matrices A and B are as follows

$$\begin{aligned} A =&(P^TR^{-1}P)^{-1}P^TR^{-1}, \end{aligned}$$
(4)
$$\begin{aligned} B =&R^{-1}(I-PA), \end{aligned}$$
(5)

where I is an unit matrix with size \(N\times N\), and \(\mathbf {p}(\mathbf {x})\) is

$$\begin{aligned} \mathbf {p}^T(\mathbf {x}) = [p_1(\mathbf {x})\cdots p_m(\mathbf {x})], \end{aligned}$$
(6)

in which \(p_j(\mathbf {x}),j=1,2,\ldots ,m\) are m polynomial basis functions. For example, in two-dimensional (2D) problem, the linear basis is \(\mathbf {p}^T(\mathbf {x})=[1,x,y]\) and the quadratic basis is \(\mathbf {p}^T(\mathbf {x})=[1,x,y,x^2,y^2,xy]\). Also, in 3D problems the linear basis is \(\mathbf {p}^T(\mathbf {x})=[1,x,y,z]\). In this paper, we use the linear basis in our computations for 2D and 3D problems. Matrix P in (3) and (4) is given with the following form

$$\begin{aligned} P=\left[ \begin{array}{ccc} p_1(\mathbf {x}_1) &{} \cdots &{} p_m(\mathbf {x}_1)\\ \cdots &{} \cdots &{} \cdots \\ p_1(\mathbf {x}_N) &{} \cdots &{} p_m(\mathbf {x}_N)\\ \end{array}\right] . \end{aligned}$$
(7)

The vector \(\mathbf {r}(\mathbf {x})\) in (3) is as follows

$$\begin{aligned} \mathbf {r}^T(\mathbf {x}) = \left[ \begin{array}{ccc} \eta (\mathbf {x},\mathbf {x}_1)&\cdots&\eta (\mathbf {x},\mathbf {x}_N) \end{array}\right] , \end{aligned}$$
(8)

where \(\eta (\mathbf {x},\mathbf {x}_j) \) is the correlation function between any pair of points \(\mathbf {x}\) and \(\mathbf {x}_j\). Many functions can be used as a correlation function (Gu 2003; Zheng and Dai 2011). In this work, we use the Gaussian function with the following form

$$\begin{aligned} \eta (\mathbf {x},\mathbf {x}_j) = \left\{ \begin{array}{ll} \frac{\exp [-(d_j/c_j)^2]-\exp [-(r_j/c_j)^2]}{1-\exp [-(r_j/c_j)^2]},&{} 0\le d_j\le r_j,\\ 0, &{} d_j\ge r_j, \end{array}\right. \end{aligned}$$
(9)

where \(d_j=\Vert \mathbf {x}-\mathbf {x}_j\Vert \), \(c_j\) is a constant controlling the shape of correlation function and \(r_j\) is the size of support domain (Abbasbandy and Shirzadi 2011). The size of support domain \( r_j \) must be selected to have a sufficient number of nodes covered in every sub-domain associated with each node. Also, \(r_j\) should be small suitable to protect the local character of MK interpolation. Moreover, a very small \(r_j\) may occur a relatively large error in computing the entries of matrix system. The correlation matrix R is as follows

$$\begin{aligned} \quad R = \left[ \begin{array}{ccc} \eta (\mathbf {x}_1,\mathbf {x}_1) &{} \cdots &{} \eta (\mathbf {x}_1,\mathbf {x}_N)\\ \cdots &{} \cdots &{} \cdots \\ \eta (\mathbf {x}_N,\mathbf {x}_1) &{} \cdots &{} \eta (\mathbf {x}_N,\mathbf {x}_N)\\ \end{array}\right] . \end{aligned}$$
(10)

The first-order partial derivative of shape function \(\varPhi (\mathbf {x})\) in (3) with respect to \( \mathbf {x}_i \) is as follows

$$\begin{aligned} \varPhi _{,i}(\mathbf {x})=\mathbf {p}^T_{,i}(\mathbf {x})A + \mathbf {r}^T_{,i}(\mathbf {x})B, \end{aligned}$$
(11)

in which \( (.)_{,i} \) denote the first derivative.

Unlike to the shape function of MLS, the shape function obtained by MK interpolation has the following \(\delta \) Kronecker property:

$$\begin{aligned} \phi _{k}(\mathbf {x}_{j})=\left\{ \begin{array}{ll} 1,\quad (k=j;k,j=1,2,\ldots , N ),\\ 0,\quad (k\ne j;k,j=1,2,\ldots , N). \end{array} \right. \end{aligned}$$
(12)

In the following, we use this property to impose the Dirichlet boundary condition directly and easily. To see the other properties of MK interpolation, one can refer to Gu (2003); Chen and Liew (2011); Dai et al. (2013).

Fig. 1
figure 1

Graph of global and local domains in 2D (left) and 3D(right)

3 The Time-Splitting MLPG Method for NLSE

In this section, we introduce an efficient combination of MLPG and time-splitting schemes to solve the NLSE (1). Consider the following NLSE

$$\begin{aligned} i\partial _{t} \varPsi =(\mathcal {N}+\mathcal {L})\varPsi , \end{aligned}$$
(13)

where \(\mathcal {N}= \omega (\mathbf{x} ,t)+\beta |\varPsi |^2\) and \( \mathcal {L}=-\alpha \nabla ^2 \) are nonlinear and linear operators, respectively. The basic idea in time-splitting technique for numerical solution of NLSE (1) is separating this equation to the following subproblems

$$\begin{aligned}&i\partial _{t} \varPsi =\omega (\mathbf{x} ,t)\varPsi +\beta |\varPsi |^2\varPsi , \end{aligned}$$
(14)
$$\begin{aligned}&i\partial _{t} \varPsi +\alpha \nabla ^2 \varPsi =0 . \end{aligned}$$
(15)

In this work, the nonlinear subproblem (14) can be solved exactly and Eq. (15) will be solved by the MLPG method.

Suppose \( \tau \) be the time step, let \( t_k=k\tau \) and \( \varPsi ^{k} \) be an approximation of \( \varPsi (\mathbf{x} ,t_k) \) where \( k=0,1,2,\ldots N_t,\) and \( N_t = T/\tau \). From \( t_k \) to \( t_{k+1} \), the second-order Strang split-time scheme for (13) is as follows (Dehghan and Taleei 2011)

$$\begin{aligned} \varPsi ^{*}&=\exp \left( -i\frac{\tau }{2}(\omega (\mathbf{x} ,t) +\beta |\varPsi ^k |^2)\right) \varPsi ^{k}, \end{aligned}$$
(16)
$$\begin{aligned} \varPsi ^{**}&=\exp (\tau \mathcal {L})\varPsi ^{*}, \end{aligned}$$
(17)
$$\begin{aligned} \varPsi ^{k+1}&=\exp \left( -i\frac{\tau }{2}(\omega (\mathbf{x} ,t) +\beta |\varPsi ^{**}|^2)\right) \varPsi ^{**}, \end{aligned}$$
(18)

where \( \varPsi ^{k}=\varPsi (\mathbf{x} ,t_k) \) and \( \varPsi ^{k+1}=\varPsi (\mathbf{x} ,t_{k+1}) \). The nonlinear part in (16) and (18) will be solved analytically, and the following linear part

$$\begin{aligned} i\partial _{t} \varPsi +\alpha \nabla ^2 \varPsi =0 , \end{aligned}$$

will be solved by the MLPG method in the space variable and Crank–Nicolson technique in time. The Crank–Nicolson method has the same order of accuracy as the Strang splitting scheme described in this paper. So, in this work, this method is used for the time discretization.

Let \( \mathbf{x} _1, \mathbf{x} _2,\mathbf{x} _3,\ldots ,\mathbf{x} _n \) be suitably scattered nodes in the global domain \( \varOmega \subset \mathbb {R}^d (d=2,3), \) bounded by \(\partial \varOmega \). Instead of calculating the global weak form, the MLPG scheme constructs the weak form over a local sub-domain such as \( {\varOmega _\mathbf{x} } \) which is a small area for any point in the global domain \( \varOmega \). These sub-domains can be of any geometric shape and size (Atluri and Zhu 1998) which overlap each other and cover the entire problem domain \( \varOmega \). In this work, we choose the circle shape in 2D and sphere in 3D (Fig. 1). For each node \( \mathbf{x} _{k}\in {\varOmega _\mathbf{x} ^{k}} \), the local weak form of Eq. (15) can be constructed as

$$\begin{aligned} \int _{{\varOmega _\mathbf{x} ^{k}} }\left( i\partial _{t} \varPsi +\alpha \nabla ^2 \varPsi \right) \nu \mathrm{d}\varOmega =0, \end{aligned}$$
(19)

in which \( \nu \) is a test function. Using integration by parts and the divergence theorem, one obtains

$$\begin{aligned} \int _{{\varOmega _\mathbf{x} ^{k}}}\left( i\partial _{t} \varPsi \right) \nu \mathrm{d}\varOmega +\alpha \left[ \int _{{\partial \varOmega _\mathbf{x} ^{k}}}\left( \nabla \varPsi .\mathbf{n} \right) \nu \mathrm{d}\varGamma -\int _{{\varOmega _\mathbf{x} ^{k}}}\nabla \varPsi . \nabla \nu \mathrm{d}\varOmega \right] =0, \end{aligned}$$
(20)

where \( {\partial \varOmega _\mathbf{x} ^{k}} \) is the boundary of local sub-domain \( {\varOmega _\mathbf{x} ^{k}} \) and \( \mathbf{n} \) is unit outward normal vector in \( {\partial \varOmega _\mathbf{x} ^{k}} \) (\( \mathbf{n} =( n_x,n_y) \) in 2D and \( \mathbf{n} =( n_x,n_y,n_z) \) in 3D). If the test function \( \nu \) is assumed as the following Heaviside step function

$$\begin{aligned} \quad \nu = \left\{ \begin{array}{ll} 1,\quad \mathbf{x} \in \varOmega _\mathbf{x} ^{k},\\ 0,\quad \mathbf{x} \notin \varOmega _\mathbf{x} ^{k},\\ \end{array}\right. \end{aligned}$$
(21)

, the local weak form (20) can be written as

$$\begin{aligned} \int _{{\varOmega _\mathbf{x} ^{k}}}\left( i\partial _{t} \varPsi \right) \mathrm{d}\varOmega +\alpha \int _{{\partial \varOmega _\mathbf{x} ^{k}}}\left( \nabla \varPsi .\mathbf{n} \right) \mathrm{d}\varGamma =0. \end{aligned}$$
(22)

Note that, \({\partial \varOmega _\mathbf{x} ^{k}}=\varGamma _\mathbf{x} ^{k} \cup L_\mathbf{x} ^{k}\) where \(L_\mathbf{x} ^{k}\) is a part of \({\partial \varOmega _\mathbf{x} ^{k}}\) over which no boundary condition is specified and \(\varGamma _\mathbf{x} ^{k}=\partial \varOmega _\mathbf{x} ^{k} \cap \varGamma \) (see Fig. 1). So, in Eq. (22) we have

$$\begin{aligned} \int _{\partial \varOmega _\mathbf{x} ^{k}}(.)\mathrm{d}\varGamma =\int _{\varGamma _\mathbf{x} ^{k}}(.)\mathrm{d}\varGamma +\int _{L_\mathbf{x} ^{k}}(.)\mathrm{d}\varGamma . \end{aligned}$$

Assuming just N points in the neighborhood node, \( \mathbf{x} _{k} \) have effect on the numerical solution, results in

$$\begin{aligned} \varPsi _{h} (\mathbf{x} ,t)=\sum _{j=1}^{N}\phi _j(\mathbf{x} ) \hat{\varPsi }_j(t). \end{aligned}$$
(23)

Substituting the MK interpolation (23) in Eq. (22), the following system for all nodes will be obtained

$$\begin{aligned} i\ C\partial _t {\hat{\varvec{\varPsi }}}_{h}(t) =-\alpha K{\hat{\varvec{\varPsi }}}_{h}(t) , \end{aligned}$$
(24)

where

$$\begin{aligned} C_{k,j}=\int _{{\varOmega _\mathbf{x} ^k}} \phi _{j} \mathrm{d}\varOmega , \qquad K_{k,j}= \int _{{\varGamma _\mathbf{x} ^k}}\left( \nabla \phi _{j} .\mathbf{n} \right) \mathrm{d}\varGamma +\int _{{L _\mathbf{x} ^k}}\left( \nabla \phi _{j} .\mathbf{n} \right) \mathrm{d}\varGamma . \end{aligned}$$

Applying the Crank–Nicolson technique, we get the following form

$$\begin{aligned} \left( C-\mu K\right) {\varvec{\varPsi }}^{n+1}=\left( C+\mu K\right) {\varvec{\varPsi }}^{n}, \end{aligned}$$
(25)

in which \( \mu =\frac{\alpha i }{2}\tau \) and \( \varvec{\varPsi } ^{l}=[\hat{\varPsi }^{l}_{1},\ldots ,\hat{\varPsi }^{l}_{N}]^{T}, \quad l= n,n+1\). So, the complete discrete form of Eq. (22) will be constructed.

4 Numerical Examples

In this part, we choose four test problems of NLSE to illustrate the validity and capability of the time-splitting MLPG scheme. In these examples, we report the following relative error

$$\begin{aligned} \epsilon _r =\sqrt{\frac{\sum _{j=1}^{N}(\varPsi _{j}^\mathrm{exact}-\varPsi _{j}^\mathrm{numerical})^2}{\sum _{j=1}^{N}(\varPsi _{j}^\mathrm{exact})^2}}, \end{aligned}$$

where \( \varPsi ^\mathrm{exact} \) and \( \varPsi ^\mathrm{numerical} \) are analytical and numerical solutions, respectively. Also, the figure of absolute error \( |\varPsi ^\mathrm{exact}-\varPsi ^\mathrm{numerical}| \) will be shown for some test problems. We use \( 8 \times 8 \) Gauss points in each local sub-domain \( \varOmega ^{k}_\mathbf{x} \) and 7 Gauss points on each local boundary \( \varGamma ^{k} _\mathbf{x} \) for numerical Gauss integration.

Definition 1

Fasshauer (2007) The global data density of X in \(\varOmega \) is as follows

$$\begin{aligned} h=h_{\varOmega ,X}=\sup _\mathbf{x \in \varOmega } \min _\mathbf{x _i \in X}\Vert \mathbf{x} -\mathbf{x} _i\Vert , \end{aligned}$$

where, in the case of using the regular nodes in global domain, h is the step size of spatial variables xy or z (in 3D) \( (h=\varDelta x=\varDelta y=\varDelta z) \). Also, the constants in correlation function (9) are \( d_j=h/2 \) , \( r_j=4d_j \) and \( c_j=4r_j \).

Fig. 2
figure 2

Halton scattered nodes

To evaluate the efficiency of our method, we report its order in time variable as

$$\begin{aligned} c-\text {order}=\frac{\log \left( \frac{ \epsilon _{r_{1}}}{ \epsilon _{r_{2}}}\right) }{\log \left( \frac{\tau _1}{\tau _2}\right) }, \end{aligned}$$

where \( \epsilon _{r_{1}}\) and \( \epsilon _{r_{2}}\) are relative errors correspond to \(\tau _1\) and \(\tau _2\), respectively. In all test problems in 2D, we use regular and irregular nodes in the global domain. In the case of irregular nodes, we apply the Halton nodes (see Fig. 2).

Remark

We have done our calculations by applying MATLAB software with a Core i7-7700 PC with a 3.60 GHz CPU and 32-GB RAM.

4.1 Test problem 4.1

In this test problem, we take NLSE (1) in 2D as the following form

$$\begin{aligned} i\frac{\partial \varPsi }{\partial t}+0.5\left( \varPsi _{xx}+ \varPsi _{yy}\right) =-2|\varPsi |^2 \varPsi , \qquad (x,y)\in \varOmega . \end{aligned}$$
(26)

The exact solution is Wang (2010)

$$\begin{aligned} \varPsi (x,y,t)=e^{i(2x+2y-3t)} sech\left( x+y-4t\right) . \end{aligned}$$
(27)

The initial and Dirichlet boundary conditions will be obtained from the exact solution. Table 1 reports the relative errors for real and imaginary parts in different times, \( t=0.25,0.50,0.75,1.00,2.00 \), where the time step is \( \tau =0.001 \). The computations are done by \( 22\times 22 \) uniform nodes in global domain \( \varOmega =[0,2]\times [0,2] \).

Table 1 \( \epsilon _{r} \) errors for Test problem 4.1 in different times
Table 2 \( \epsilon _{r} \) errors for Test problem 4.1 in different rectangular domains with \( \tau =0.0001 \)
Table 3 \( \epsilon _{r} \) errors for Test problem 4.1 in \(\varOmega ^{*} \) with different time steps

The first column of Table 2 shows various domains, and the second column shows different uniform nodes in these rectangular domains. Moreover, the third and fourth columns present relative error of real and imaginary parts, respectively. Also, the numerical results for this test problem in global domain \( \varOmega ^{*} \) (see Fig. 2 ) are shown in Table 3. From this table, we conclude that the time-splitting MLPG method has a good accuracy in irregular nodes and almost \( O(\tau ^2) \) order in time variable.

Fig. 3
figure 3

Absolute errors of real (left) and imaginary (right) parts at \( t=1 \) in Test problem 4.1 on \( \varOmega = [0,3] \times [0,3] \)

The absolute error of real (left) and imaginary (right) parts in \( \varOmega = [0,3] \times [0,3]\) at \( t=1 \) is depicted in Fig. 3. These tables and Fig. 3 show that the approximated solution by the time-splitting MLPG method and the exact solution are in a good agreement for a large space and time domain in this test problem.

4.2 Test problem 4.2

We consider the second test problem for NLSE (1) as follows

$$\begin{aligned} i\partial _{t} \varPsi +\alpha \nabla ^2 \varPsi =\omega (\mathbf{x} ,t)\varPsi +|\varPsi |^2\varPsi ,\quad (x,y)\in \varOmega , \end{aligned}$$
(28)

where \( \alpha =\beta =1 \) and the initial condition is

$$\begin{aligned} \varPsi (x,y,0)=x^2-y^2+i(1+x y). \end{aligned}$$

Also, the potential function has the following form

$$\begin{aligned} \omega (x,y)&=-\exp (-2t)(x^2-y^2)^2-(xy+1)^2 \nonumber \\&\quad -\frac{i\exp (-t)(x^2-y^2)^2\left[ \exp (-t)(x^2-y^2)^2-i (xy+1) \right] }{\exp (-t)(x^2-y^2)+(xy+1)}. \end{aligned}$$

Moreover, the exact solution is Dehghan and Mirzaei (2008)

$$\begin{aligned} \varPsi (x,y,t)=(x^2-y^2)\exp (-t)+i(1+xy). \end{aligned}$$
(29)

Similar to the previous example, the Dirichlet boundary condition will be obtained from the exact solution. Table 4 presents the relative errors of real (Re-part) and imaginary (Im-part) parts in domain \( \varOmega =[0,1]\times [0,1] \), for \( 11\times 11 \) uniform nodes at different times, \( t=0.5,1.0,2.0,\ldots ,6.0 \), with \( \tau =0.001 \). The second and the third columns of this table show the relative error for real part by our technique and the MLPG method based on MLS (Dehghan and Mirzaei 2008). Also, columns four and five demonstrate the relative error of imaginary part by our scheme and the MLPG method based on MLS (Dehghan and Mirzaei 2008), respectively. Moreover, the last two columns present the CPU-time dependent to our method and scheme of Dehghan and Mirzaei (2008). The results of this table illustrate that the time-splitting MLPG method is superior and faster than the MLPG method based on MLS (Dehghan and Mirzaei 2008). Table 5 illustrates the errors for different numbers of nodes (space steps) in domain \(\varOmega \). Here, the time step and final time are \(\tau =0.01\) and \(t=1\), respectively. As can been seen, by increase the number of nodes, the errors will be decreased. So, our scheme is capable in these cases.

Table 4 \( \epsilon _{r} \) errors for Test problem 4.2 in different times
Table 5 \( \epsilon _{r} \) errors for Test problem 4.2 with different number of nodes at \(t = 1\) with \(\tau = 0.01\)
Table 6 \( \epsilon _{r} \) errors for Test problem 4.2 in different rectangular domains with \( \tau =0.0001 \)

Table 6 provides the \( \epsilon _r \) errors of real (Re-part) and imaginary (Im-part) parts in different domains, with the final time \( t=1 \) and time step \( \tau =0.0001 \). One can observe that the presented scheme has a good performance in large domains. The behavior of exact and approximate solutions for real (left) and imaginary (right) parts at \( t=6 \) with \( \tau =0.0001\) on \( \varOmega =[0,6]\times [0,6]\) is depicted in Fig. 4. The absolute errors obtained by the proposed method for real (left) and imaginary (right) parts are shown in Fig. 5. These figures show that the time-splitting MLPG results are in good agreement with the exact solution for this test problem.

Fig. 4
figure 4

Real and imaginary parts of exact (right) and numerical solutions (left) at \( t=6 \) with \( \tau =0.0001\), for Test problem 4.2

Table 7 \( \epsilon _{r} \) errors for Test problem 4.2 in \(\varOmega ^{*} \) with different time steps

Also, Table 7 presents the relative errors for real (Re-part) and imaginary (Im-part) parts for this test problem in the global domain \( \varOmega ^{*} \) (see Fig. 2 ). This table reveals that the time-splitting MLPG scheme has a good efficiency in irregular nodes with approximately \( O(\tau ^2) \) order in the time variable.

Fig. 5
figure 5

Absolute errors of real (left) and imaginary (right) parts at \( t=6 \), for Test problem 4.2 on \( \varOmega = [0,6] \times [0,6] \)

Tables 4, 5, 6, 7 and Figs. 4, 5 reveal that the accuracy of our scheme is suitable to obtain numerical solution of this test problem.

4.3 Test problem 4.3

In this test problem, we consider the NLSE (1) in the following form

$$\begin{aligned} i\frac{\partial \varPsi }{\partial t}+0.5 (\varPsi _{xx}+\varPsi _{yy})=(1-\sin ^{2}(x)\sin ^{2}(y))\varPsi +|\varPsi |^2 \varPsi , \qquad (x,y)\in \varOmega =[0,2\pi ]\times [0,2\pi ]. \end{aligned}$$
(30)

The exact solution is Xu and Zhang (2012)

$$\begin{aligned} \varPsi (x,y,t)=\exp (-2it)\sin (x)\sin (y). \end{aligned}$$
(31)

The boundary conditions are as follows

$$\begin{aligned}&\frac{\partial \varPsi (0,y,t)}{\partial x}=\exp (-2it)\sin (y),\quad y\in [0,2\pi ],t\ge 0 ,\\&\frac{\partial \varPsi (2\pi ,y,t)}{\partial x}+\varPsi (2\pi ,y,t)=\exp (-2it)\sin (y),\quad y\in [0,2\pi ],t\ge 0 ,\\&\frac{\partial \varPsi (x,0,t)}{\partial y}=\exp (-2it)\sin (x),\quad x\in [0,2\pi ],t\ge 0 ,\\&\varPsi (x,2\pi ,t)=0, \quad x\in [0,2\pi ],t\ge 0 , \end{aligned}$$

Also, the initial condition is

$$\begin{aligned} \varPsi (x,y,0)=\sin (x)\sin (y). \end{aligned}$$

We solve this test problem by the time-splitting MLPG method, and the results will be compared with the exact solution. Also, we change the MK interpolation by MLS approximation and report the \(\epsilon _r\) errors of real (Re-part) and imaginary (Im-part) parts between our computations and the exact solution in Table 8. Here, \(\varOmega =[0,2\pi ]\times [0,2\pi ]\), the first column of this table is time step size, and columns 2, 4, 6 show the errors for real and imaginary parts related to MK. Moreover, computations affiliated with MLS illustrate in columns 3, 4, 6. As can been seen, our method based on MK is more accurate than MLS. The last two columns of this table indicate the time running of our scheme for these two cases. One can see, the time-splitting MLPG method based on MK is faster than MLS. A property of the meshless method is their efficiency on irregular domains. To show this property, we solve Eq. (30) with the Dirichlet boundary condition on the domain as shown in Fig.  6. Hence,

$$\begin{aligned} \varOmega =\left\{ (x,y)\in \mathbb {R}^2:x=r\cos (\theta ),y=r\sin (\theta ),~ \theta \in [0,2\pi ]\right\} , \end{aligned}$$

in which

$$\begin{aligned} r=0.5\sqrt{\sin (5\theta )^{2}+\sin (2\theta )^{2}+\cos (\theta )^{2}}. \end{aligned}$$

We use 629 points on boundary of \( \varOmega \) and 689 uniform nodes in interior of this domain. The results for this domain are reported in different times,\(t=1,2,5,7\), with \(\tau =0.01\) in Table 9.

Table 8 \( \epsilon _{r} \) errors of real and imaginary parts for Test problem 4.3 at different time steps
Fig. 6
figure 6

Irregular domain, for Test problem 4.3

Table 9 \( \epsilon _{r} \) errors for Test problem 4.3 in different times
Fig. 7
figure 7

Numerical solution and absolute errors of real (left) and imaginary (right) parts for Test problem 4.3 on Domain Fig. 6

The last column of this table is CPU-time. Also, the behavior of real and imaginary parts and related error between our scheme and exact solution are plotted in Fig. 7.

The results of Tables 8, 9 and Fig. 7 show the accuracy and capability of time-splitting MLPG scheme compared to the exact solution, for this test problem in the regular and irregular domains.

4.4 Test problem 4.4

In the final test problem, the proposed method is discussed for NLSE (1) in 3D. We consider the following partial differential equation

$$\begin{aligned} i\frac{\partial \varPsi }{\partial t}+0.5 \left( \varPsi _{xx}+\varPsi _{yy}+\varPsi _{zz}\right) =\left( 1-\sin ^{2}(x)\sin ^{2}(y)\sin ^{2}(z)\right) \varPsi +|\varPsi |^2 \varPsi . \end{aligned}$$
(32)

The exact solution is Xu and Zhang (2012)

$$\begin{aligned} \varPsi (x,y,z,t)=\exp (-i5t/2)\sin (x)\sin (y)\sin (z). \end{aligned}$$
(33)

Our calculations are done in two cubic domains \( \varOmega _1=[0,\pi ]\times [0,\pi ]\times [0,\pi ] \) and \( \varOmega _2= [0,2\pi ]\times [0,2\pi ]\times [0,2\pi ] \) for this test problem (see Fig. 8). The Dirichlet boundary condition is homogeneous in both domains \( \varOmega _1 \) and \( \varOmega _2 \). Also, the initial condition is

$$\begin{aligned} \varPsi (x,y,z,0)=\sin (x)\sin (y)\sin (z). \end{aligned}$$

Table 10 shows the relative error between the exact and numerical solutions for \( 11\times 11\times 11 \) uniform nodes in \( \varOmega _{1} \) at different values of times up to 1. Moreover, Table 11 reports the results for this test problem in \(22\times 22\times 22 \) regular points in \( \varOmega _{2} \).

Fig. 8
figure 8

\( 11\times 11\times 11 \) regular nodes in \( \varOmega _{1} \) (left) and \( 22\times 22\times 22\) uniform nodes in \( \varOmega _{2} \)(right)

Table 10 \( \epsilon _{r} \) errors for Test problem 4.4 in \( \varOmega _{1} \)
Table 11 \( \epsilon _{r} \) errors for Test problem 4.4 in \( \varOmega _{2} \)
Fig. 9
figure 9

Contour plots of absolute errors in three different plans of \( \varOmega _2 \) at \( t=0.25\) (left) and \( t=0.50 \) (right) for Test problem 4.4

Figure 9 demonstrates the contour plots of absolute error in three different plans

$$\begin{aligned} S_1&=\{x=\frac{2\pi }{3},0\le y\le 2\pi ,0\le z\le 2\pi \},\\ S_2&=\{0\le x\le 2\pi ,y=\frac{2\pi }{3},0\le z\le 2\pi \},\\ S_3&=\{0\le x\le 2\pi ,0\le y\le 2\pi ,z=\frac{2\pi }{3}\}, \end{aligned}$$

of \( \varOmega _2 \) at \( t=0.25\) (left) and \( t=0.50 \) (right) with \( \tau =0.001 \). These results reveal that the time-splitting MLPG scheme has a good performance for solving this test problem in 3D.

5 Conclusion

In this work, we discussed about an efficient combination of the meshless local Petrov–Galerkin method and the Strang splitting scheme for solving nonlinear Schrödinger equation. Since the solution of nonlinear partial differential equations with meshfree methods based on the weak form could be complicated, the time-splitting scheme was chosen. In every time step, the NLSE was separated into linear and nonlinear parts. We used the MLPG method for the linear part, and the nonlinear part was solved analytically. So, in every time step, we solved only a system of linear algebraic equations. In the MLPG method, the shape functions were built by the moving Kriging interpolation scheme. These shape functions have the delta function property, and therefore, the Dirichlet boundary condition could be implemented easily. To test the proposed method, we studied three test problems in two dimensions and one example in three dimensions. The numerical results showed the efficiency and validity of the time-splitting MLPG scheme for solving NLSE in these dimensions.