Legendre spectral element method for solving sine-Gordon equation

In this paper, we study the Legendre spectral element method for solving the sine-Gordon equation in one dimension. Firstly, we discretize the equation by Legendre spectral element in space and then discretize the time by the second-order leap-frog method. We study the stability and convergence of the method and show the convergence of our method. Finally, we show the results with numerical examples.


Introduction
A spectral element method combines the high accuracy of spectral methods and flexibility of finite element method, and the approximate result of this method provides high accuracy and spectral convergence. In this method the solution is approximated on each element using spectral methods. One of the advantages of this method is the high accuracy and stable solving algorithm with a small number of elements under a wide range of conditions [1].
Finite element method was proposed for the first time in 1943 by Courant [2]. He solved the Poisson equation based on minimizing piecewise linear approximations on finite subdomains.
The spectral method is a conventional method for solving partial differential equations, which was first introduced by Navier for elastic sheet problems in 1825. In spectral method the solution is approximated on one general domain.
In 1984, Patera applied a spectral method to a greater number of subdomains by a division of domains. He proposed the spectral element method by combining the spectral method and the finite element method [3]. In his innovative method, Patera uses the Chebyshev polynomials as the interpolation basis functions. Legendre's spectral element was developed by Maday and Patera [4]. The use of the Lagrangian interpolation conjugate with the Gauss-Legendre-Lobatto quadrature leads to a matrix of mass with diameter structure [5]. The diagonal mass matrix is a very important property of the Legendre spectral element method and is different from the Chebyshev spectral element method [6].
The Legendre spectral element method is widely used in solving partial differential equations. Chen et al. [7] used the Legendre spectral element method to solve a con-strained optimal control problem. An alternating direction implicit (ADI) Legendre spectral element method for the two-dimensional Schrodinger equation is developed in [8], and the optimal H 1 error estimate for the linear case is given. The aim of [9] is the Lagrange-Galerkin spectral element method for solving two-dimensional shallow water equations. The authors of [10] considered the numerical approximation of the acoustic wave equation by the spectral element method based on the Gauss-Lobatto-Legendre quadrature formulas and finite difference Newmark's explicit time advancing schemes. A modified set of basis functions for use with spectral element methods is presented in [11] for solving a mixed elliptic boundary value problem. These basis functions are constructed so that the axial conditions along a plane or axis of symmetry are satisfied identically. A numerical spectral element method for the computation of fluid flows governed by the incompressible Euler equations in a complex geometry is presented in [12]. Zhuang and Chen [13] used this method to solve biharmonic equations. In [14], the authors used the spectral element method with least-square formulation for parabolic interface problems. Ai et al. [15] used fully diagonalized Legendre spectral element methods using Sobolev orthogonal/biorthogonal basis functions for solving second-order elliptic boundary value problems. A Legendre spectral element formulation of an improved time-splitting method is developed for the natural convection heat transfer problem in a square cavity by Wang and Qin [16].
The sine-Gordon equation is one of the most important partial differential equations, which applies to many scientific fields such as the motion of a rigid pendula attached to a stretched wire [17], solid state physics, nonlinear optics, and the stability of fluid motions.
We consider the one-dimension sine-Gordon equation where u is a function of x and t, and u 0 (x) and u 1 (x) are known analytic functions. Different numerical methods are presented for Eq. (1). Dehghan and Shokri [18] solved a one-dimensional sine-Gordon equation using collocation points and approximating the solution using thin plate splines radial basis function. Dehghan and Mirzaei [19] used a numerical method of the boundary integral equation to approximate the solution of onedimensional equation (1). Mohebbi and Dehghan [20] have also used the finite difference method for numerical solution of equation (1).
In [21] the authors present an analysis of the stability spectrum for all stationary periodic solutions to the sine-Gordon equation. Yousif an Mahmood [22] used the variational homotopy perturbation method for solving the Klein-Gordon and sine-Gordon equations. In [23] a new scheme, which has energy-preserving property, is proposed for solving the sine-Gordon equation with periodic boundary conditions. This method is obtained by the Fourier pseudo-spectral method and the fourth-order average vector field method. Baccouch [24] presented superconvergence results for the local discontinuous Galerkin method for the sine-Gordon nonlinear hyperbolic equation in one space dimension.
In this paper, we study the Legendre spectral element method for solving Eq. (1). First, using the Legendre spectral element method, we obtain a semi-discrete spatial form of Eq. (1), and then, using the leap-frog method, we obtain a complete discrete form of Eq. (1). We bring theorems on stability and convergence, and, finally, we show the results by a numerical example.
This paper is organized as follows: In Sect. 2, we perform a spatial discretization of Eq. (1) using the Legendre spectral element method. In Sect. 3, we perform a time discretization of Eq. (1) using the second-order leap-frog method. In Sect. 4, we present stability and convergence theorems. Finally, in Sect. 5, we present a numerical example to validate the stability and convergence of the numerical scheme with respect to the discretization parameters.

Space discretization
In this section, we explain the Legendre spectral element method and spatial discretization of Eq. (1).

Legendre spectral element method
In the Legendre spectral element method, we first divide the domain Ω into N e nonoverlapping subdomains Ω e : We define the approximation space where P N is a polynomial space of dimension less than or equal to N . Basis functions are considered as the Lagrangian interpolation polynomials defined at Gauss-Lobatto integration points on each element. If N e = 1, then we obtain the spectral Galerkin method of order N -1. If N = 1 or N = 2, then we obtain a standard Galerkin finite element method based on linear and quadratic elements, respectively. Now on each element Ω e , we define the approximate solution of order N as where ϕ j is the jth Lagrange polynomial of order N on the Gauss-Legendre-Lobatto points {ξ i } N i=0 [32]: and L N is the Legendre polynomial of order N . To convert the [-1, 1] to the eth element and its inverse, we use the mapping functions where x e and x e-1 are the endpoints of the eth element. The stiffness [33] and mass matrices [34] on each element are calculated as follows: Using the Gauss quadrature, we obtain [35]

Space discretization of the sine-Gordon equation
We obtain the weak form of Eq. (1) We obtain the right-hand side of Eq. (3) using the following equation [36]: sin u e j ϕ j .
The matrix form of the semidiscrete form of Eq. (3) is where the vector U e contains an approximation solution of order N on the element Ω e at time t, M e is a local diagonal mass matrix, and S e is a local stiffness matrix on the element Ω e .
To obtain a semidiscrete form on the general domain, we must assemble the local matrices M e and S e and obtain the general matrices M and S [35]. So Eq. (4) becomes where U is the vector of the approximate solution on the general domain Ω at time t.

Time discretization
For full discretization of Eq. (5), we first divide the interval (0, T) into subintervals [t n , t n+1 ], where t 0 = 0 and t n+1 = t n + k for n = 0, . . . , N t -1. Now, using the leap-frog method, we obtain the full discrete form of Eq. (1): where U n is the vector of approximation solution at time t n . After simplifying, Eq. (6) becomes For n = 0, we have For calculation of U -1 , we have and thus So, for n = 0, we have For n > 0, we also have Because the mass matrix M is diagonal, solving Eqs. (8) and (9) is easier than by similar methods.

Stability and convergence analysis
In this section, we analyze the stability of leap-frog method and the convergence of the spectral element method presented in the previous sections.

Stability of leap-frog method
Equation (9) can be written as and F n,n-1 = -U n-1 + k 2 sin(U n ).
Since F n,n-1 is a known vector at each step and does not play any role in the stability analysis, we need to consider the equation (10) is stable under the following condition:

Theorem 4.1 Equation
Proof We must show that If μ i are the eigenvalues of the diagonal matrix M and λ i are the eigenvalues of the matrix S, then λ i μ i are the eigenvalues of the matrix A. We must show that From this inequality we obtain According to [37], we have that and, consequently, According to Eq. (11),

Convergence of spectral element method
In [38] the convergence theorem is presented for the spectral element method for acoustic waves.

Numerical results
In this section, we consider a numerical example to validate the proposed scheme. The accuracy of the scheme is verified in the L 2 and L ∞ norms and root mean square errors.
We set where N e,N are all nodes of the domain, and U n is the vector of nodal values of the numerical solution corresponding to the discretization parameters N , N e , and k at time t n , and for each continuous function f , Example 5.1 We consider the equation and the exact solution is given by We solve this problem with the Legendre spectral element method presented in this paper with several values of N , k, and N e at final time T = 1. Table 1 shows the errors of Legendre spectral element method with several values of N at final time T = 1 with k = 0.1, 0.01 and N e = 20. Table 2 shows the maximum pointwise error |u exactu LSEM | at several times T = 1, 2, . . . , 10 with N = 4, N e = 20, and k = 0.01.  2.3081e-02 10 3.3925e-02   1 and 2 show graphs of approximate solution and absolute error and Fig. 3 shows graph of approximate and exact solution at T = 1, using present method with N = 4, N e = 20 and k = 0.1.
In the following figures (4, 5, and 6) we have used a logarithmic scale for both axes. In Fig. 4, we show the RMS err as a function of the degree of the polynomials N for two fixed values of k (k = 0.1, 0.01) and N e = 20. In Fig. 5, we report the quantity RMS err for k ranging from 0.001 to 0.1 and fixed N = 7 and N e = 20.
The analytical solution is given in [39] as The results are compared with the results in [18,30,31]. Table 3 shows the results at the different time levels. It can be seen from Table 3 that the present results are in good agreement with those in the literature. A graph comparing the exact and numerical solutions at T = 1 with N = 4, k = 0.01, and N e = 20 is depicted in Fig. 7. We also draw the space-time graph of approximate solution for t ≤ 2 in Fig. 8 with N = 2, N e = 10, and k = 0.01.
where c = 0.5 is the velocity of solitary wave, and γ = 1 √ 1+c 2 . The exact solution [31] is given as The boundary conditions can be obtained from the exact solution. The numerical solution for Example 5.3 is computed in the domain [-10, 10] using the parameter values N = 7, N e = 30, and k = 0.001. Computed results are compared with the results obtained in [30,31,40]. Table 4 shows L 2 err and L ∞ err at different time levels. From Table 4 we can see that the present results are in good agreement with those of [31,40], but it has more errors than [30]. Figure 9 shows the comparison between the numerical and exact solutions at t = 1  with N = 3, N e = 30, and k = 0.01. In Fig. 10, we show the space-time graph of approximate solution for t ≤ 10 using the present method with N = 3, N e = 30, and k = 0.1.

Conclusion and discussion
The spectral polynomials are useful tools for solving ordinary and partial differential equations. Also, the incorporation of the finite element method with spectral polynomials, that is, the use of spectral polynomials as new shape functions in the finite element method is very efficient for obtaining a numerical algorithm with high accuracy. In this paper, we constructed a Legendre spectral element method for the solution of the one-dimensional sine-Gordon equation. We used the Legendre spectral element method for discretizing the spatial space. Also, we used a leap-frog scheme for discretizing the temporal space with the stability condition C * N -1 ≤ k 2 ≤CN -3 h 2 . We presented theorems on the stability and convergence. Finally, using one test problem, we demonstrated that the algorithm is efficient for obtaining approximation solutions of the sine-Gordon equation.