- Research
- Open Access
- Published:

# Legendre spectral element method for solving sine-Gordon equation

*Advances in Difference Equations*
**volume 2019**, Article number: 113 (2019)

## Abstract

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 constrained 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 one-dimensional 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.

Other numerical methods have also been used to solve the sine-Gordon equation such as Chebyshev tau meshless method [25], meshless method of lines [26], high-accuracy multiquadric quasi-interpolation [27], reduced differential transform method [28], pseudo-spectral method [29], modified cubic B-spline differential quadrature method [30], modified cubic B-spline collocation method [31], etc.

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 \(\varOmega _{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 \(\varOmega _{e}\), we define the approximate solution of order *N* as

where \({\varphi _{j}}\) is the *j*th Lagrange polynomial of order *N* on the Gauss–Legendre–Lobatto points \(\{ {{\xi _{i}}} \} _{i = 0}^{N}\) [32]:

and \(L_{N}\) is the Legendre polynomial of order *N*.

To convert the \([-1,1 ]\) to the *e*th element and its inverse, we use the mapping functions

where \(x_{e}\) and \(x_{e-1}\) are the endpoints of the *e*th element. The stiffness [33] and mass matrices [34] on each element are calculated as follows:

where

Using the Gauss quadrature, we obtain [35]

where

and

### Space discretization of the sine-Gordon equation

We obtain the weak form of Eq. (1) as follows. For each element \(\varOmega _{e}\), we find \({u^{e}} \in {U^{h}}\) such that

The second integral on the left-hand side is obtained by integration by parts. Now, taking the *k*th Lagrange function of order *N* as the test function *v* and using Eq. (2), we have

We obtain the right-hand side of Eq. (3) using the following equation [36]:

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 \(\varOmega _{e}\) at time *t*, \(M^{e}\) is a local diagonal mass matrix, and \(S^{e}\) is a local stiffness matrix on the element \(\varOmega _{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,\ldots,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

where

and

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

### Theorem 4.1

*Equation* (10) *is stable under the following condition*:

### Proof

We must show that

If \(\mu _{i}\) are the eigenvalues of the diagonal matrix *M* and \(\lambda _{i}\) are the eigenvalues of the matrix *S*, then \({\frac{ {{\lambda _{i}}}}{{{\mu _{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.

### Theorem 4.2

([38])

*Suppose that*
\(u \in {C^{2}} ( {0,T;{H^{s}} ( \varOmega )} ) \cap {C^{4}} ( {0,T;{L^{2}} ( \varOmega )} )\)
*is the exact solution of*

*and*
*U*
*is the approximation result of the spectral element method under stability conditions on*
*k*. *Then*, *for all*
\(t_{n} > 0\), *we have*

## 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_{\infty }\) 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 \(\vert {u_{ \mathrm{exact}}-u_{\mathrm{LSEM}}} \vert \) at several times \(T=1,2, \ldots,10\) with \(N =4\), \(N{_{e}}=20\), and \(k=0.01\).

Figures 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\).

Figure 6 shows the *RMS*err as a function of \(N_{e}\) for two fixed values of *k* (\(k= 0.1, 0.01\)) and \(N = 4\).

### Example 5.2

In this example, we obtain the numerical solutions of Eq. (1) the computational domain \(\varOmega = [-1,1 ]\) with the initial conditions

The analytical solution is given in [39] as

The boundary conditions are obtained from the exact solution. We compute the numerical solution in the domain \(\varOmega = [-1,1 ]\) with several values of *N*, *k*, \(N_{e}\), and time *t*. The obtained 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\le 2\) in Fig. 8 with \(N = 2\), \(N_{e} = 10\), and \(k = 0.01\).

### Example 5.3

Consider the sine-Gordon equation (1) in the range \(\varOmega = [-10,10 ]\) with the initial conditions

where \(c=0.5\) is the velocity of solitary wave, and \(\gamma = \frac{1}{ {\sqrt{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}\operatorname{err}\) and \(L_{\infty }\operatorname{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\le 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}} \le {k^{2}} \le \tilde{C}{N^{ - 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.

## References

- 1.
Vosse, F.N., Minev, P.D.: Spectral Element Methods: Theory and Applications. Eindhoven University of Technology, EUT Report 96-w-001 (1996)

- 2.
Courant, R.: Variational method for the solution of problems of equilibrium and vibration. Bull. Am. Math. Soc.

**49**, 1–23 (1943) - 3.
Patera, A.T.: A spectral element method for fluid dynamics: laminar flow in a channel expansion. J. Comput. Phys.

**54**, 468–488 (1984) - 4.
Maday, Y., Patera, A.T.: Spectral Element Methods for the Incompressible Navier–Stokes Equations, Surveys on Computational Mechanics. ASME, New York (1989)

- 5.
Bathe, K.J.: Finite Element Procedures, 2nd edn. Prentice Hall International, Englewood Cliffs (1995)

- 6.
Priolo, E., Seriani, G.A.: A numerical investigation of Chebyshev spectral element method for acoustic wave propagation. In: Proceedings of the 13th IMACS Conference Comparat, vol. 54, pp. 154–172 (1991)

- 7.
Chen, Y., Yi, N., Liu, W.: A Legendre–Galerkin spectral method for optimal control problems governed by elliptic equations. SIAM J. Numer. Anal.

**46**, 2254–2275 (2008) - 8.
Zeng, F., Ma, H., Zhao, T.: Alternating direction implicit Legendre spectral element method for Schrödinger equations. J. Shanghai Univ. Nat. Sci. Ed.

**17**(6), 724–727 (2011) - 9.
Giraldo, F.X.: Strong and weak Lagrange–Galerkin spectral element methods for the shallow water equations. Comput. Math. Appl.

**45**, 97–121 (2003) - 10.
Zampieri, E., Pavarino, L.F.: Approximation of acoustic waves by explicit Newmark’s schemes and spectral element methods. J. Comput. Appl. Math.

**185**, 308–325 (2006) - 11.
VanOs, R.G., Phillips, T.N.: The choice of spectral element basis functions in domains with an axis of symmetry. J. Comput. Appl. Math.

**201**, 217–229 (2007) - 12.
Xu, C., Maday, Y.: A spectral element method for the time-dependent two-dimensional Euler equations: applications to flow simulations. J. Comput. Appl. Math.

**91**, 63–85 (1998) - 13.
Zhuang, Q., Chen, L.: Legendre–Galerkin spectral-element method for the biharmonic equations and its applications (in press)

- 14.
Khan, A., Upadhyay, C.S., Gerritsma, M.: Spectral element method for parabolic interface problems. Comput. Methods Appl. Mech. Eng. (2018). https://doi.org/10.1016/j.cma.2018.03.011

- 15.
Ai, Q., Li, H.Y., Wang, Z.Q.: Diagonalized Legendre spectral methods using Sobolev orthogonal polynomials for elliptic boundary value problems. Appl. Numer. Math. (2018). https://doi.org/10.1016/j.apnum.2018.01.003

- 16.
Wang, Y., Qin, G., Wang, Z.Q.: An improved time-splitting method for simulating natural convection heat transfer in a square cavity by Legendre spectral element approximation. Comput. Fluids (2018). https://doi.org/10.1016/j.compfluid.2018.07.013

- 17.
Wazwaz, A.M.: A variable separated ODE method for solving the triple sine-Gordon and the triple sinh-Gordon equations. Chaos Solitons Fractals

**33**, 703–710 (2007) - 18.
Dehghan, M., Shokri, A.: A numerical method for one-dimensional nonlinear sine-Gordon equation using collocation and radial basis functions. Numer. Methods Partial Differ. Equ.

**24**, 687–698 (2008) - 19.
Dehghan, M., Mirzaei, D.: The boundary integral equation approach for numerical solution of the one-dimensional sine-Gordon equation. Numer. Methods Partial Differ. Equ.

**24**, 1405–1415 (2008) - 20.
Mohebbi, A., Dehghan, M.: High order solution of one-dimensional sine-Gordon equation using compact finite difference and DIRKN methods. Math. Comput. Model.

**51**, 537–549 (2010) - 21.
Deconinck, B., McGil, P., Sega, B.L.: The stability spectrum for elliptic solutions to the sine-Gordon equation. Physica D

**360**, 17–35 (2017) - 22.
Yousif, M.A., Mahmood, B.A.: Approximate solutions for solving the Klein–Gordon and sine-Gordon equations. J. Assoc. Arab Univ. Basic Appl. Sci.

**22**, 83–90 (2017) - 23.
Jiang, C., Sun, J., Li, H., Wang, Y.: A fourth-order AVF method for the numerical integration of sine-Gordon equation. Appl. Math. Comput.

**313**, 144–158 (2017) - 24.
Baccouch, M.: Superconvergence of the local discontinuous Galerkin method for the sine-Gordon equation in one space dimension. J. Comput. Appl. Math.

**333**, 292–313 (2018) - 25.
Shao, W., Wu, X.: The numerical solution of the nonlinear Klein–Gordon and sine-Gordon equations using the Chebyshev tau meshless method. Comput. Phys. Commun.

**185**, 1399–1409 (2014) - 26.
Hussain, A., Haq, S., Uddin, M.: Numerical solution of Klein–Gordon and sine-Gordon equations by meshless method of lines. Eng. Anal. Bound. Elem.

**37**, 1355–1366 (2013) - 27.
Jiang, Z.W., Wang, R.H.: Numerical solution of one-dimensional sine-Gordon equation using high accuracy multiquadric quasi-interpolation. Appl. Math. Comput.

**218**, 7711–7716 (2012) - 28.
Keskin, Y., Aglar, I., Ko, A.: Numerical solution of sine-Gordon equation by reduced differential transform method, vol. 1 (2011)

- 29.
Taleei, A., Dehghan, M.: A pseudo-spectral method that uses an overlapping multidomain technique for the numerical solution of sine-Gordon equation in one and two spatial dimensions. Math. Methods Appl. Sci.

**37**, 1909–1923 (2014) - 30.
Shukla, H.S., Tamsir, M.: Numerical solution of nonlinear sine-Gordon equation by using the modified cubic B-spline differential quadrature method. Beni-Suef Univ. J. Basic Appl. Sci.

**7**(4), 359–366 (2018) - 31.
Mittal, R.C., Bhatia, R.: Numerical solution of nonlinear sine-Gordon equation by modified cubic B-spline collocation method. Int. J. Partial Differ. Equ. (2014). https://doi.org/10.1155/2014/343497

- 32.
Hesthaven, J.S., Gottlieb, S., Gottlieb, D.: Spectral Method for Time-Dependent Problems. Cambridge University Press, Cambridge (2007)

- 33.
Ern, A., Guermond, J.L.: Theory and Practice of Finite Elements. Springer, New York (2004)

- 34.
Hand, L.N., Finch, J.D.: Analytical Mechanics. Cambridge University Press, Cambridge (2008)

- 35.
Pozrikidis, C.: Introduction to Finite and Spectral Element Methods Using Matlab. Chapman & Hall, London (2005)

- 36.
Argyris, J., Haase, M., Heinrich, J.C.: Finite element approximation to two dimensional sine-Gordon solitons. Comput. Methods Appl. Mech. Eng.

**86**, 1–26 (1991) - 37.
Bernardi, C., Maday, Y.: Approximations Spectrales de Problèmes aux Limites Elliptiques. Springer, Berlin (1992)

- 38.
Zampieri, E., Pavarino, L.F.: An explicit second order spectral element method for acoustic waves. Adv. Comput. Math.

**25**, 381–401 (2006) - 39.
Wei, G.W.: Discrete singular convolution for the sine-Gordon equation. Physica D

**137**, 247–259 (2000) - 40.
Bratsos, A.G.: A fourth order numerical scheme for the one dimensional sine-Gordon equation. Int. J. Comput. Math.

**85**, 1083–1095 (2008)

### Acknowledgements

The authors are thankful to the honorable reviewers and editors for their valuable suggestions and comments, which improved the paper.

### Availability of data and materials

The results and numerical data obtained in this paper have been fully tested. These results are obtained using MATLAB R2017a(win64) software and Windows 8 operating system on a intel(R) Core(TM) i7 CPU, 1.73 GHz processor with 4 GB RAM. The authors declare that all data and material in the paper are available and veritable.

### Funding

Not applicable.

## Author information

### Affiliations

### Contributions

Both authors contributed equally and significantly in writing this article. Both authors wrote, read, and approved the final manuscript.

### Corresponding author

Correspondence to Mahmoud Lotfi.

## Ethics declarations

### Competing interests

The authors declare that they have no competing interests.

## Additional information

### Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## About this article

#### Received

#### Accepted

#### Published

#### DOI

### MSC

- 65M70
- 65M06
- 74G15

### Keywords

- Sine-Gordon equation
- Legendre spectral element method
- Leap-frog method