1 Introduction

The nonlinear Schrödinger equation (NLSE) [1, 2]

i u t + u x x + V ( | u | 2 ) u=0,

has wide applications in many areas such as quantum mechanics, nonlinear optics, and plasma physics, etc. Extensive efforts have been devoted to studying the equation theoretically and numerically due to its broad and important applications. Various numerical methods for the nonlinear Schrödinger equation [35] such as finite element methods [6], finite difference methods [7], spectral method [8], etc. have been developed. Among these numerical methods of different categories, the multi-symplectic method has attracted special attention for its better numerical stability for long-time computations and perfect performance in preserving the multi-symplecticity of NLS equations, which is an intrinsic conservative property of the Schrödinger equations.

In this paper, we consider the nonlinear Schrödinger equation with variable coefficients

i u t +α(t) u x x +β(t) | u | 2 u=0,
(1)

where i= 1 , α(t) and β(t) are integrable real functions in t, and u(x,t) is a scalar field function with two independent variables labeled by x and t.

The nonlinear Schrödinger equation (1) can be reformulated as a multi-symplectic Hamiltonian system [9]. Hong et al. [10, 11] proposed a numerical scheme for the NLSE with variable coefficients (1) by means of Preissman integrator [12]. For this Preissman integrator, they derived a discrete multi-symplectic structure, named multi-symplectic conservation law [13]. Also, the discrete normal conservation law and a global energy transit formula in temporal direction were shown in their paper.

It is a classical way to derive multi-symplectic numerical schemes from the Hamiltonian point of view [9, 12, 14]. After applying a numerical discretization to Hamilton’s equation [1517], however, we need to rederive the discrete multi-symplectic conservation law since it is unclear what is geometrically conserved by this discretization. On this aspect, another classical way, i.e., deriving the multi-symplectic numerical schemes from the Lagrangian viewpoint and variational principle, has more advantages since it leads in a natural way to multi-symplectic integrators, and the discrete multi-symplectic structures are obtained at the same time. Based on this Lagrangian viewpoint, Chen et al. [1821] have elaborately studied the variational multi-symplectic integrators for the nonlinear Schrödinger equation. By the discrete variational principle with the discrete Lagrangian function, the discrete variational integrator is derived, and the corresponding multi-symplectic structure, i.e., the multi-symplectic form formula by Marsden [22, 23], is also obtained from the variational principle. In this work, we follow this Lagrangian viewpoint to study the multi-symplectic methods for the nonlinear Schrödinger equation with variable coefficients (1).

In this process, the discrete Lagrangian function needs to be defined for the discrete variational principle. The Lagrangian function can be discretized by using finite difference methods. In our paper, we use the nonstandard finite difference methods rather than the classical finite difference methods to approximate the Lagrangian function. The nonstandard finite difference methods developed by Mickens [2429] have better performances than the classical ones in terms of numerical stability, and they can be constructed flexibly to preserve some important properties and conservation laws of the original models. The rules of designing nonstandard finite difference schemes are listed in Section 2.

Combining the ideas of discrete variational integrators and the nonstandard finite difference methods is our starting point to study the nonlinear Schrödinger equation with variable coefficients (1), which can be reformulated as the following Euler-Lagrange equation:

L u = d d t L u t + d d x L u x ,
(2)

with the Lagrangian function

L(u, u t , u x )= 1 2 α(t) u x u ¯ x + 1 4 i(u u ¯ t u ¯ u t ) 1 4 β(t) ( u u ¯ ) 2 ,
(3)

where u ¯ and u ¯ x are the conjugates of u and u x , respectively.

The rest of the paper is organized as follows. In Section 2, we give some brief and necessary introductions to discrete variational integrators, the corresponding multi-symplectic form formulas, and the rules of nonstandard finite difference methods. In Section 3, with the triangle discretization and square discretization, we derive two discrete variational integrators for the NLS equation with variable coefficients (1) based on nonstandard finite difference methods. The discrete multi-symplectic structures are presented by multi-symplectic form formulas. Local truncation errors of the developed integrators are discussed, and the convergence orders are shown in error tables in the numerical experiment section. Section 4 is devoted to showing the numerical performances of the developed nonstandard finite difference variational integrators. It also shows that our methods have a good performance in preserving the norm conservation law.

2 Discrete variational integrators and nonstandard finite difference methods

In this section, we first introduce the concepts of discrete variational integrators, the corresponding multisymplectic structures, and the rules of nonstandard finite difference methods.

2.1 Discrete variational integrators and multi-symplectic form formulas

Assume that we have a regular quadrangular mesh in the base space, with mesh lengths Δx and Δt. The nodes in this mesh are denoted by (j,k)Z×Z, corresponding to the points ( x j , t k ):=(jΔx,kΔt) in R 2 . We denote the value of the field u at the node (j,k) by u j k . When we consider the triangle discretization, we denote a triangle at (j,k) with ordered triple ((j,k),(j+1,k),(j,k+1)) by j k . Define X to be the set of all such triangles. Then the discrete jet bundle [23, 30] is defined as follows:

J 1 Y:= { ( u j k , u j + 1 k , u j k + 1 ) R 3 : ( ( j , k ) , ( j + 1 , k ) , ( j , k + 1 ) ) X } ,

which equals X × R 3 .

Let us posit a discrete Lagrangian L d : J 1 YR. Given a triangle j k , define the function L d by L d ( u j k , u j + 1 k , u j k + 1 ) which is a discrete version of the Lagrangian density [30]. Then the action functional can be defined as

S=+ L d ( u j k , u j + 1 k , u j k + 1 ) + L d ( u j 1 k , u j k , u j 1 k + 1 ) + L d ( u j k 1 , u j + 1 k 1 , u j k ) +.

By the discrete variational principle [31], we obtain the discrete Euler-Lagrange equation by keeping the values of the field on the boundary fixed and taking variations with respect to u j k ,

D 1 L d ( u j k , u j + 1 k , u j k + 1 ) + D 2 L d ( u j 1 k , u j k , u j 1 k + 1 ) + D 3 L d ( u j k 1 , u j + 1 k 1 , u j k ) =0.

The discrete Euler-Lagrange equation is the so-called discrete variational integrator. Meanwhile, the discrete multi-symplectic structure is also generated [22, 23] in the variational principle.

By Hamilton’s principle [23, 32], the discrete multi-symplectic structure, which is preserved by the discrete variational integrator, is described by Poincaré-Cartan forms in a differential geometric language. In their paper [23], Marsden et al. showed how to obtain this structure directly from the variational principle on the Lagrangian side. They defined the structure as the multi-symplectic form formula and demonstrated that it was conserved by the discrete variational integrator in their paper.

Lemma 2.1 If u is a solution of the discrete Euler-Lagrangian equation, and V, W are first variations of u, then the following discrete multi-symplectic form formula holds:

; U 0 ( l : l U [ ( j 1 u ) ( ı j 1 V ı j 1 W Ω L l ) ] ( ) ) =0.
(4)

The details of this conclusion can be found in papers [22, 23]. This conclusion states that the discrete variational principles produce the discrete variational integrators, and that the multi-symplecticity of these variational integrators is presented by the discrete multi-symplectic form formula (4).

Vankerschaver et al. [30] revisited the multi-symplectic form formula in the work [23]. They showed that it can be obtained from the boundary Lagrangian which they defined in their paper. An easier way was presented to derive the discrete multi-symplectic form formula from the discrete variational principle, using the notations of Poincaré-Cartan forms. In this paper, we follow the same derivation for the discrete multi-symplectic form formulas to derive our discrete variational integrators.

When we use the discrete variational principle, we need to make an approximation of the Lagrangian. Here we employ nonstandard finite difference methods, instead of the standard finite difference, to approximate the Lagrangian function and derive the corresponding discrete variational integrators as well.

2.2 The nonstandard finite difference methods

The nonstandard finite difference schemes developed by Mickens et al. [2428] were proposed to compensate the weaknesses which may be found in standard finite difference methods, for example, numerical instabilities. Regarding the positivity, boundedness, and monotonicity of solutions, nonstandard finite difference schemes also have a better performance than standard finite difference ones. Because it is more flexible in its construction, a nonstandard finite difference scheme can more easily preserve certain properties and structures obeyed by the original equations and can have better dynamical consistency for dynamical problems.

These advantages of nonstandard finite difference methods have been shown in many numerical applications. González-Parra et al. [33, 34] developed some nonstandard finite difference methods to preserve the positivity condition and population conservation law of biological models. Jordan [35] and Malek [36] constructed nonstandard finite difference schemes for heat transfer problems. For symplectic systems, Mickens [28] derived a nonstandard finite difference variational integrator for symplectic ODEs. Recently, Ma et al. [37] developed a nonstandard finite difference scheme for stochastic differential equations with additive noises.

The initial foundation of nonstandard finite difference methods came from exact finite difference schemes [38]. After generalizing these results, Mickens formulated the following three basic rules [2428] in constructing nonstandard finite difference schemes.

  1. 1.

    The orders of discrete derivatives should be equal to the orders of corresponding derivatives appearing in the differential equations.

Note: If the orders of discrete derivatives are larger than those occurring in differential equations, then numerical instabilities will in general occur.

  1. 2.

    Discrete representations for derivatives, in general, have nontrivial denominator functions.

Note: For example, the discrete first-derivative is generally represented by

d u d t u i + 1 φ ( Δ t ) u i ϕ ( Δ t ) ,

where the numerator functions φ(Δt) and the denominator functions ϕ(Δt) satisfy

φ(Δt)=1+O ( ( Δ t ) ) ,ϕ(Δt)=Δt+O ( ( Δ t ) 2 ) .
  1. 3.

    Both linear and nonlinear terms should be represented by nonlocal discrete representations on the discrete computational lattice.

Note: For example,

u 2 u i u i + 1 , u 2 u i u i + 1 , u 2 ( u i 1 + u i + u i + 1 3 ) u i , u 3 2 u i 3 u i 2 u i + 1 , u 3 u i 1 u i u i + 1 .

In our paper, we combine the advantages of nonstandard finite difference methods and discrete variational principles to construct multi-symplectic numerical schemes for the nonlinear Schrödinger equation with variable coefficients (1). Their multi-symplecticities are presented by discrete multi-symplectic form formulas respectively.

3 Nonstandard finite difference variational integrators for the nonlinear Schrödinger equation with variable coefficients

We consider the nonlinear Schrödinger equation with variable coefficients (1),

i u t +α(t) u x x +β(t) | u | 2 u=0,

where u(x,t) is a scalar field function with two independent variables labeled by x and t and α(t) and β(t) are integrable real functions in t. We now use the triangle discretization and the square discretization respectively to obtain the nonstandard finite difference variational integrators.

3.1 Triangle discretization for the nonstandard finite difference variational integrator

We consider the same regular quadrangular mesh in the base space defined in Section 2.1. The triangle j k is the three-ordered triple ((j,k),(j+1,k),(j,k+1)) at (j,k). Let X be the set of all such triangles. The discrete jet bundle [23, 30] is defined as follows:

J 1 Y:= { ( u j k , u j + 1 k , u j k + 1 ) R 3 : ( ( j , k ) , ( j + 1 , k ) , ( j , k + 1 ) ) X } ,

which is equal to X × R 3 .

Now, we use the nonstandard finite difference to define the discrete Lagrangian L d on J 1 Y, which is the discrete version of the Lagrangian density [30]. Here, for the nonlinear Schrödinger equation (1) with the Lagrangian

L(u, u t , u x )= 1 2 α(t) u x u ¯ x + 1 4 i(u u t ¯ u ¯ u t ) 1 4 β(t) ( u u ¯ ) 2 ,

the discrete Lagrangian is defined as

L d ( u j k , u j + 1 k , u j k + 1 ) = 1 2 Δ t Δ x ( 1 2 α k + 1 2 u j + 1 k u j k ψ ( Δ x ) u ¯ j + 1 k u ¯ j k ψ ( Δ x ) + 1 4 i ( u j k + u j + 1 k + u j k + 1 3 u ¯ j k + 1 u ¯ j k ϕ ( Δ t ) u ¯ j k + u ¯ j + 1 k + u ¯ j k + 1 3 u j k + 1 u j k ϕ ( Δ t ) ) 1 12 β k + 1 2 ( | u j k | 2 | u j + 1 k | 2 + | u j + 1 k | 2 | u j k + 1 | 2 + | u j k + 1 | 2 | u j k | 2 ) ) ,
(5)

where α k + 1 2 =α( t k + 1 2 ), β k + 1 2 =β( t k + 1 2 ),

ϕ(Δt)=Δt+O ( ( Δ t ) 2 ) ,andψ(Δx)=Δx+O ( ( Δ x ) 2 ) .
(6)

We have obeyed the rules of constructing nonstandard finite difference schemes in Mickens’ papers [2428] in the following ways. In the triangle j k with three points ((j,k),(j+1,k),(j,k+1)):

  1. 1.

    The discrete first-derivative is represented by

    d u d t u j k + 1 u j k ϕ ( Δ t ) , d u d x u j + 1 k u j k ψ ( Δ x ) ,

where denominator functions ϕ(Δt), ψ(Δx) [22, 23] satisfy the conditions

ϕ(Δt)=Δt+O ( ( Δ t ) 2 ) ,ψ(Δx)=Δx+O ( ( Δ x ) 2 ) .
  1. 2.

    Nonlocal representation on the discrete computational lattice is given by

    u u j k + u j + 1 k + u j k + 1 3 ,

and

( u u ¯ ) 2 u j k u ¯ j k u j + 1 k u ¯ j + 1 k + u j + 1 k u ¯ j + 1 k u j k + 1 u ¯ j k + 1 + u j k + 1 u ¯ j k + 1 u j k u ¯ j k 3 = | u j k | 2 | u j + 1 k | 2 + | u j + 1 k | 2 | u j k + 1 | 2 + | u j k + 1 | 2 | u j k | 2 3 .

By discrete Hamilton’s principle [23, 30], we have the discrete Euler-Lagrangian equation

D 1 L d ( u j k , u j + 1 k , u j k + 1 ) + D 2 L d ( u j 1 k , u j k , u j 1 k + 1 ) + D 3 L d ( u j k 1 , u j + 1 k 1 , u j k ) =0,
(7)

where L d ( u j 1 k , u j k , u j 1 k + 1 ) and L d ( u j k 1 , u j + 1 k 1 , u j k ) are defined similarly to (5) by

and

L d ( u j k 1 , u j + 1 k 1 , u j k ) = 1 2 Δ t Δ x ( 1 2 α k 1 2 u j + 1 k 1 u j k 1 ψ ( Δ x ) u ¯ j + 1 k 1 u ¯ j k 1 ψ ( Δ x ) + 1 4 i ( u j k 1 + u j + 1 k 1 + u j k 3 u ¯ j k u ¯ j k 1 ϕ ( Δ t ) u ¯ j k 1 + u ¯ j + 1 k 1 + u ¯ j k 3 u j k u j k 1 ϕ ( Δ t ) ) 1 12 β k 1 2 ( | u j k 1 | 2 | u j + 1 k 1 | 2 + | u j + 1 k 1 | 2 | u j k | 2 + | u j k | 2 | u j k 1 | 2 ) ) .

Substituting L d ( u j k , u j + 1 k , u j k + 1 ), L d ( u j 1 k , u j k , u j 1 k + 1 ), and L d ( u j k 1 , u j + 1 k 1 , u j k ) into above equation (7), we arrive at a nonstandard finite difference variational integrator. We rearrange it as follows:

(8)

This is a nonstandard finite difference variational integrator for the nonlinear Schrödinger equation with variable coefficients (1).

As we have mentioned in Section 2 and Lemma 2.1, the advantages of deriving multi-symplectic numerical schemes from the discrete variational principle are that they are naturally multi-symplectic, and the discrete multi-symplectic structures are also generated in the variational principle. Now, it is meaningful to show the multi-symplectic structure of this discrete variational integrator (8) which is based on the nonstandard finite difference method.

Since we employ the triangle discretization here, we focus on three adjacent triangles around u j k and denote their area by U. Following the idea used in [30], the discrete boundary Lagrangian is given by

L U ( u U ):= ext u j k [ L d ( u j k , u j + 1 k , u j k + 1 ) + L d ( u j 1 k , u j k , u j 1 k + 1 ) + L d ( u j k 1 , u j + 1 k 1 , u j k ) ] ,
(9)

where

u U := ( u j + 1 k , u j k + 1 , u j 1 k + 1 , u j 1 k , u j k 1 , u j + 1 k 1 ) .

Taking exterior derivative twice on both sides and knowing that d 2 L U 0, we have the discrete multi-symplectic form formula of the following form [30]:

n = 1 3 l = 1 ; l n 3 Ω L n ( Δ ( l ) ) =0,
(10)

where Ω L n =d Θ L n (for n=1,2,3) and the discrete Poincaré-Cartan forms Θ L 1 , Θ L 2 , and Θ L 3 are defined by

Θ L 1 ( u j k , u j + 1 k , u j k + 1 ) := D 1 L d ( u j k , u j + 1 k , u j k + 1 ) d u j k .

Thus, for the nonlinear Schödinger equation with variable coefficients (1), the multi-symplectic form formula of the scheme (8), based on the nonstandard finite difference methods, can be obtained by

(11)

where ¯ j k =( u j k + u j + 1 k + u j k + 1 )/3, ¯ j 1 k =( u j 1 k + u j k + u j 1 k + 1 )/3, and ¯ j k 1 =( u j k 1 + u j + 1 k 1 + u j k )/3. Now, we arrive at the first conclusion of this paper.

Theorem 3.1 The nonstandard finite difference variational integrator (8) for the nonlinear Schrödinger equation (1) is multi-symplectic, and its discrete multi-symplectic structure is (11).

We now analyze the truncation error of the integrator (8). We choose ψ(Δx)=Δx and ϕ(Δt)=Δt here. By the Taylor series expansion, we have

α k + 1 2 u j + 1 k 2 u j k + u j 1 k ( Δ x ) 2 = α k u x x k j + O ( ( Δ x ) 2 ) + O ( Δ t ) , i 6 ( 2 u j k + 1 u j k ϕ ( Δ t ) + u j 1 k + 1 u j 1 k ϕ ( Δ t ) + 2 u j k u j k 1 ϕ ( Δ t ) + u j + 1 k u j + 1 k 1 ϕ ( Δ t ) ) = i u t j k + O ( ( Δ t ) 2 ) + O ( Δ x ) , 1 6 β k + 1 2 u j k ( | u j + 1 k | 2 + | u j k + 1 | 2 + | u j 1 k | 2 + | u j 1 k + 1 | 2 ) + 1 6 β k 1 2 u j k ( | u j + 1 k 1 | 2 + | u j k 1 | 2 ) = β k u j k | u j k | 2 + O ( Δ x ) + O ( Δ t ) .

Combining the above three equations, we can observe that the nonstandard finite difference variational integrator (8) has the truncation error O(Δx+Δt).

3.2 Square discretization for the nonstandard finite difference variational integrator

In this case, we denote a square at (j,k) with ordered quaternion ((j,k),(j+1,k),(j+1,k+1),(j,k+1)) by j k , and define X to be the set of all such squares. Then the discrete jet bundle [23, 30] is defined as follows:

J 1 Y:= { ( u j k , u j + 1 k , u j + 1 k + 1 , u j k + 1 ) R 4 : ( ( j , k ) , ( j + 1 , k ) , ( j + 1 , k + 1 ) , ( j , k + 1 ) ) X } ,

which is equal to X × R 4 .

According to the nonstandard finite difference method, the discrete Lagrangian L d on J 1 Y now is defined as follows:

(12)

In this case, we have used the following rules of nonstandard finite difference methods. In the square j k :

  1. 1.

    The discrete first-derivative is represented by

    d u d t u j + 1 2 k + 1 u j + 1 2 k 2 ϕ ( Δ t ) = u j k + 1 u j k 2 ϕ ( Δ t ) + u j + 1 k + 1 u j + 1 k 2 ϕ ( Δ t ) , d u d x u j + 1 k + 1 2 u j k + 1 2 2 ψ ( Δ x ) = u j + 1 k + 1 u j k + 1 2 ψ ( Δ x ) + u j + 1 k u j k 2 ψ ( Δ x ) ,

where

ϕ(Δt)=Δt+O ( ( Δ t ) 2 ) ,ψ(Δx)=Δx+O ( ( Δ x ) 2 ) .
  1. 2.

    Nonlocal representations for u and ( u u ¯ ) 2 are approximated by

    u u j + 1 2 k + 1 2 = u j k + u j + 1 k + u j + 1 k + 1 + u j k + 1 4 , ( u u ¯ ) 2 u j k u ¯ j k u j + 1 k u ¯ j + 1 k + u j + 1 k u ¯ j + 1 k u j + 1 k + 1 u ¯ j + 1 k + 1 + u j + 1 k + 1 u ¯ j + 1 k + 1 u j k + 1 u ¯ j k + 1 + u j k + 1 u ¯ j + 1 k + 1 u j k u ¯ j k 4 .

Similarly, we give the definitions of L d on the other three squares adjoint to u j k :

and

L d ( u j k 1 , u j + 1 k 1 , u j + 1 k , u j k ) = Δ x Δ t ( 1 2 α k 1 2 u j + 1 k 1 2 u j k 1 2 ψ ( Δ x ) u ¯ j + 1 k 1 2 u ¯ j k 1 2 ψ ( Δ x ) + i 4 ( u j + 1 2 k 1 2 u ¯ j + 1 2 k u ¯ j + 1 2 k 1 ϕ ( Δ t ) u ¯ j + 1 2 k 1 2 u j + 1 2 k u j + 1 2 k 1 ϕ ( Δ t ) ) 1 16 β k 1 2 ( u j k 1 u ¯ j k 1 u j + 1 k 1 u ¯ j + 1 k 1 + u j + 1 k 1 u ¯ j + 1 k 1 u j + 1 k u ¯ j + 1 k + u j + 1 k u ¯ j + 1 k u j k u ¯ j k + u j k u ¯ j k u j k 1 u ¯ j k 1 ) ) .

From the discrete variational principle, taking the derivative of the action functional with respect to u j k , we have the discrete Euler-Lagrangian equation in this square discretization [22, 23, 30], which is defined by

(13)

After substituting the four discrete Lagrangian L d ( u j k , u j + 1 k , u j + 1 k + 1 , u j k + 1 ), L d ( u j 1 k , u j k , u j k + 1 , u j 1 k + 1 ), L d ( u j 1 k 1 , u j k 1 , u j k , u j 1 k ), and L d ( u j k 1 , u j + 1 k 1 , u j + 1 k , u j k ) into above equation (13), we have

(14)

This scheme is multi-symplectic and symmetric with respect to (j+1,k) and (j1,k). Following the steps given in the above examples, we have the multi-symplectic form formula

(15)

Now, we summarize our conclusion as follows.

Theorem 3.2 The nonstandard finite difference variational integrator (14) for the nonlinear Schrödinger equation with variable coefficients (1) is multi-symplectic, and its discrete multi-symplectic form formula is shown by (15).

Now, we discuss the truncation error for the nonstandard finite difference variational integrator (14). Here, we choose ψ(Δx)=Δx and ϕ(Δt)=Δt. By the Taylor series expansion, we have

1 2 ( α k + 1 2 u j + 1 k + 1 2 2 u j k + 1 2 + u j 1 k + 1 2 ( Δ x ) 2 + α k 1 2 u j + 1 k 1 2 2 u j k 1 2 + u j 1 k 1 2 ( Δ x ) 2 ) = α k u x x k j + O ( ( Δ x ) 2 + ( Δ t ) 2 ) , i 4 Δ t ( u j + 1 2 k + 1 + u j 1 2 k + 1 u j 1 2 k 1 u j + 1 2 k 1 ) = u t j k + O ( ( Δ x ) 2 + ( Δ t ) 2 ) , 1 2 ( 1 4 β k + 1 2 u j k ( | u j + 1 k | 2 + 2 | u j k + 1 | 2 + | u j 1 k | 2 ) + 1 4 β k 1 2 u j k ( | u j + 1 k | 2 + 2 | u j k 1 | 2 + | u j 1 k | 2 ) ) = β k | u j k | 2 u j k + O ( ( Δ x ) 2 + ( Δ t ) 2 ) .

From the above equations, we can readily observe that the nonstandard finite difference variational integrator (14) has a truncation error O( ( Δ x ) 2 + ( Δ t ) 2 ). To verify that the integrator has anticipated convergence accuracy, we investigate the numerical convergence order in our numerical experiments. See Section 4.

4 Numerical simulations

In this section, we report the performance of the nonstandard finite difference variational integrator (14) for solving the nonlinear Schrödinger equation with variable coefficients (1). The nonstandard finite difference variational integrator (14) is an implicit nine-points stencil. We just choose the denominator functions ϕ(Δt)=Δt and ψ(Δx)=Δx here. Consider the following two sets of variable coefficients and initial conditions:

i u t + α μ ( t ) u x x + β μ ( t ) | u | 2 u = 0 , u ( x , 0 ) = v μ ( x ) , μ = 1 , 2 ,
(16)

where

α 1 ( t ) = 1 2 cos ( t ) , β 1 ( t ) = cos ( t ) sin ( t ) + 3 , v 1 ( x ) = 1 3 sech ( 1 3 ) exp ( i ( x 2 1 ) 6 ) , α 2 ( t ) = 1 2 ( cos ( t ) + 2 cos ( 2 t ) ) , β 2 ( t ) = cos ( t ) + 2 cos ( 2 t ) sin ( t ) + sin ( 2 t ) + 5 , v 2 ( t ) = 1 5 sech ( x 5 ) exp ( i ( x 2 1 ) 10 ) .

These two problems correspond to periodic and quasi-periodic solitary-waves. When μ=1, the problem has a periodic solitary-wave solution

u p (x,t)= P 1 p (x,t) P 2 p (x,t) P 3 p (x,t),

where

P 1 p ( x , t ) = 1 ( sin ( t ) + 3 ) 1 2 , P 2 p ( x , t ) = sech ( x sin ( t ) + 3 ) , P 3 p ( x , t ) = exp ( i ( x 2 1 ) 2 ( sin ( t ) + 3 ) ) .

When μ=2, the problem has a quasi-periodic solitary-wave solution

u q p (x,t)= P 1 q p (x,t) P 2 q p (x,t) P 3 q p (x,t),

where

P 1 q p ( x , t ) = 1 ( sin ( t ) + sin ( 2 t ) + 5 ) 1 2 , P 2 q p ( x , t ) = sech ( x sin ( t ) + sin ( 2 t ) + 5 ) , P 3 q p ( x , t ) = exp ( i ( x 2 1 ) 2 ( sin ( t ) + sin ( 2 t ) + 5 ) ) .

We use the same boundary conditions in the above two problems, i.e.,

u(40,t)=u(40,t)=0.

4.1 Simulation results for the problem (16)

First, for the periodic problem μ=1, we plot the waveform in Figure 1. One can observe that the nonstandard finite difference variational integrator (14) displays the numerical properties of the periodic solitary-wave clearly and precisely.

Figure 1
figure 1

The waveforms of (16) withμ=1by integrator (14). The waveforms of the NLSE with variable coefficients (16) (μ=1) by the nonstandard finite difference variational integrator (14) with Δt=0.1 and Δx=0.1.

We define the l 2 -error e k of the numerical solution at time step t k as

e k = Δ x j | u j k u p ( x j , t k ) | 2 .

In Figure 2, we show the l 2 -error e k of variational integrator (14) for the problem μ=1.

Figure 2
figure 2

l 2 -error e k of integrator (14) for (16) withμ=1. Numerical l 2 -error e k of the nonstandard finite difference variational integrator (14) for the NLSE with variable coefficients (16) (μ=1), from t=0 to t=60 with Δt=0.1 and Δx=0.1.

Now, we use the variational integrator (14) to solve the nonlinear Schrödinger equation (16) with μ=2. Figure 3 depicts the waveforms of the numerical solution obtained by the variational integrator (14). Figure 4 displays the l 2 -errors of the variational integrator (14).

Figure 3
figure 3

The waveforms of (16) withμ=2by integrator (14). The waveforms of the NLSE with variable coefficients (16) (μ=2) computed with the nonstandard finite difference variational integrator (14) with Δt=0.1 and Δx=0.1.

Figure 4
figure 4

l 2 -error e k of integrator (14) for (16) withμ=2. Numerical l 2 -error e k of the nonstandard finite difference variational integrator (14) for the NLSE with variable coefficients (16) (μ=2), from t=0 to t=60 with Δt=0.1 and Δx=0.1.

4.2 Accuracy and numerical stability

To investigate the numerical convergence of the proposed scheme (14), we conduct a series of numerical tests with varying mesh sizes. The l 2 -errors at t=1.5, t=3, and t=3.5 are listed in Table 1. The orders in the table are calculated with the formula [39, 40]

Order ln ( Error ( Δ x 1 ) / Error ( Δ x 2 ) ) ln ( Δ x 1 / Δ x 2 ) .

Overall, it is clear that the error decreases as the mesh size goes to zero, indicating the convergence of our nonlinear integrator (14). Moreover, the numerical orders clearly exhibit second-order convergence when the mesh size decreases with fixing Δt=0.1Δx.

Table 1 l 2 -errors and convergence orders of integrator (14) for the problem μ=1 with Δt=0.1Δx

The numerical stability of the nonstandard finite difference variational integrator (14) is demonstrated in Figure 5. l 2 -error curves are plotted with increasing time step sizes Δt=0.1,0.2,0.4,0.6, respectively. We can see that our method performs very well even with large time steps and it is unrestricted by the CFL conditions [41]. The l 2 -errors are bounded without blowing up. Thus, the nonstandard finite difference variational integrator (14), based on an implicitly temporal discretization, is unconditionally stable from the viewpoint of numerical simulations. In general, nonstandard finite difference methods have better numerical stability than the standard finite difference method.

Figure 5
figure 5

l 2 -error e k of integrator (14) with increasing time step sizes. The l 2 -errors of integrator (14) for the NLSE with variable coefficients (16) (μ=1) with time step sizes Δt=0.1,0.2,0.4,0.6, and Δx=0.05.

4.3 Norm conservation laws

We know that the nonlinear Schrödinger equation has the following global norm conservation law:

R | u | 2 dx=constant.

The discrete version of this norm conservation law [42] can be written as

Norm k 2 :=Δx j | u j k | 2 =constant.

To show the performance of our integrator (14) on this aspect, we plot the norm conservation Norm k 2 in Figure 6 and Figure 7. We find that our method preserves the norm conservation law pretty well with very small periodic oscillation. The norm is constant within a percentage error of 0.4% in Figure 6. For Figure 7, the norm is constant within a percentage error of 3%.

Figure 6
figure 6

Norm conservation performance of integrator (14) for (16) μ=1. Norm conservation Norm k 2 of the nonstandard finite difference variational integrator (14) for the NLSE with variable coefficients (16) (μ=1), from t=0 to t=60 with Δt=0.1 and Δx=0.1.

Figure 7
figure 7

Norm conservation performance of integrator (14) for (16) μ=2. Norm conservation Norm k 2 of the nonstandard finite difference variational integrator (14) for the NLSE with variable coefficients (16) (μ=2), from t=0 to t=60 with Δt=0.1 and Δx=0.1.

4.4 Comparison with standard finite difference methods

A numerical test is made to compare the nonstandard finite difference method with the standard finite difference method. For the nonlinear Schrödinger equation (16) with μ=1, we have a standard finite difference scheme

i u j k + 1 u j k Δ t + α k + 1 u j + 1 k + 1 2 u j k + 1 + u j 1 k + 1 ( Δ x ) 2 + β j + 1 | u j k + 1 | 2 u j k + 1 =0,
(17)

where the spatial and temporal derivatives are approximated by using the classical central differencing and the implicit Euler method, respectively.

The l 2 -error of (17) is plotted in Figure 8. Furthermore, the norm conservation Norm k 2 is presented in Figure 9. From the two figures, it is easy to see that the standard finite difference method does not perform as well as the nonstandard finite difference method (14). The norm conservation law is totally lost by the standard finite difference scheme (17).

Figure 8
figure 8

l 2 -error of the implicit Euler method (17) and the NSFD variational integrator (14). l 2 -error of the implicit Euler method (17) and the NSFD variational integrator (14) for the NLSE with variable coefficients (16) (μ=1). Δt=0.1 and Δx=0.1.

Figure 9
figure 9

Norm k 2 of the implicit Euler method (17) and the NSFD variational integrator (14). Norm k 2 of the implicit Euler method (17) and the NSFD variational integrator (14) for the NLSE with variable coefficients (16) (μ=1). Δt=0.1 and Δx=0.1.

The nonstandard finite difference method has better stability and better performance on conservation laws. Actually, the well-known numerical method, the Crank-Nicolson scheme,

i u j k + 1 u j k Δ t + α k + 1 2 ( u j + 1 k 2 u j k + u j 1 k ) + ( u j + 1 k + 1 2 u j k + 1 + u j 1 k + 1 ) 2 ( Δ x ) 2 + 1 4 β k + 1 2 ( | u j k | 2 + | u j k + 1 | 2 ) ( u j k + u j k + 1 ) = 0 ,

also has some flavor of the nonstandard finite difference method, i.e., discretizing the equation at half time-grid points. The Crank-Nicolson scheme for the nonlinear Schrödinger equations also preserves the conservation law very well [10]; however, it is not multi-symplectic for the NLSE, which is a multi-symplectic PDE. We also compare our method (14) with the Crank-Nicolson scheme here. From the l 2 -errors shown in Figure 10, we find both of them work well. To compare these two approaches in terms of computational efficiency, we perform a set of numerical tests with different spatial and temporal mesh sizes. Figure 11 depicts the l 2 -errors versus the computational time consumed by each approach to achieve those errors. One can observe that our method is competitive to the Crank-Nicolson method in this case. What is more, our method costs less computational time to get error levels less than 10−2.

Figure 10
figure 10

l 2 -errors of the Crank-Nicolson scheme and the NSFD variational integrator (14). l 2 -errors of the Crank-Nicolson scheme and the NSFD variational integrator (14) for the NLSE with variable coefficients (16) (μ=1). Δt=0.1 and Δx=0.1.

Figure 11
figure 11

The l 2 -errors as a function of the CPU time for the NSFD variational integrator (14), Crank-Nicolson scheme and implicit Euler method (17). The l 2 -errors for the terminating time T=5 as a function of the CPU time for the NSFD variational integrator (14), the Crank-Nicolson scheme and the implicit Euler method (17) for the problem (16) (μ=1).

In all, the numerical tests verify that the nonstandard finite difference variational integrator is capable of preserving characteristics of the original equations. It is accurate, efficient, and suitable for solving the nonlinear Schrödinger equations with variable coefficients (1).

5 Conclusion

In this paper, we have considered the nonlinear Schrödinger equation with variable coefficients. We have derived two discrete variational integrators based on the nonstandard finite difference methods, and have presented the corresponding discrete multi-symplectic structures via multi-symplectic form formulas. We have shown that it is feasible to combine the idea of discrete variational integrators and nonstandard finite difference methods to construct the multi-symplectic schemes for the NLS equation. The convergence and the stability of our methods have been discussed. The numerical experiments have shown the effectiveness and efficiency of these nonstandard finite difference variational integrators. Some comparisons with standard finite difference schemes have been made to demonstrate the features of the proposed integrators.