Locally conservative finite difference schemes for the modified KdV equation

Finite difference schemes that preserve two conservation laws of a given partial differential equation can be found directly by a recently-developed symbolic approach. Until now, this has been used only for equations with quadratic nonlinearity. In principle, a simplified version of the direct approach also works for equations with polynomial nonlinearity of higher degree. For the modified Korteweg-de Vries equation, whose nonlinear term is cubic, this approach yields several new families of second-order accurate schemes that preserve mass and either energy or momentum. Two of these families contain Average Vector Field schemes of the type developed by Quispel and coworkers. Numerical tests show that each family includes schemes that are highly accurate compared to other mass-preserving methods that can be found in the literature.

1. Introduction. Conservation laws are among the most fundamental properties of a given system of partial differential equations (PDEs); all solutions must satisfy every conservation law. Consequently, there is a need to understand how to construct finite difference schemes that preserve multiple conservation laws of a given system. For simplicity, we will limit our discussion to scalar PDEs for u(x, t), where x is a spatial variable and t denotes time. (The generalization to systems with two or more independent variables is straightforward, but the notation becomes messier.) A local conservation law of a given PDE, that is zero on the set of all solutions of the PDE. Here and henceforth, square brackets around a differentiable expression denote the expression and a finite number of its differential consequences using the total derivatives D x and D t . In this notation, Div F = 0 when [A = 0]. The functions F and G are, respectively, the flux and density of the conservation law.
For suitable boundary conditions, the existence of such a conservation law implies that G dx is an invariant, which means that it is constant on any solution. Some classes of PDEs have conservation laws and/or invariants built in as part of their structure. In particular, Hamiltonian PDEs are of the form where D is a skew-adjoint differential operator, δ/δu denotes the variational derivative and H is a given function. For every Hamiltonian PDE, the Hamiltonian functional H is an invariant. Any Hamiltonian PDE can be embedded in a multisymplectic system; all such systems have a conservation law that expresses the invariance of a multisymplectic form [6,7]. Multisymplectic finite difference schemes, which are extensions of symplectic methods for Hamiltonian ordinary differential equations (ODEs), preserve this conservation law [2,3,8,9,[32][33][34].
Sanz-Serna, de Frutos and Durán were among the first to study the benefits of using finite difference methods to preserve invariants of a Hamiltonian PDE [16][17][18]21], using what is effectively a semi-discretization in time. An alternative approach is to discretize in space first, then apply an invariant-conserving method in time to preserve the approximated Hamiltonian functional. With this approach, invariants can be conserved by symplectic methods [3,8,11,38], discrete line integral methods [5,10] or discrete gradient methods [12,15,22,23].
Among the most useful discrete gradient methods for approximating Hamiltonian PDEs is the Average Vector Field (AVF) method introduced in [12], which generalizes Quispel and McLaren's energy-preserving approach for Hamiltonian ODEs [40]. According to [12], the AVF method "is distinguished by its features of linear covariance, automatic preservation of linear symmetries, reversibility with respect to linear reversing symmetries and often by its simplicity." Here is an outline of this method for a given PDE of the form (1).
Relative to a generic lattice point n = (m, n), the uniform grid points are In the following, u is approximated by either the semidiscretization U i ≈ u(x i , t) or the full discretization u i,j ≈ u(x i , t j ). The vectors whose i-th components are U i and u i,j are denoted by U and u j respectively, and ∇ is the differential operator whose i-th component is ∂/∂U i . Let H(U)∆x be a semidiscretization of H and let D be a discrete skew-adjoint operator (typically depending on u 0 and u 1 ) that approximates D. The AVF method approximates (1) by In [35], McLachlan and Quispel proved that if the spatial discretization preserves a semidiscrete conservation law of the Hamiltonian PDE, the application of any discrete gradient method in time [13,24,27,36,41] yields a fully discrete (local) conservation law of the Hamiltonian. This is a powerful result, because conservation laws contain far more information than integral invariants do.
The current paper focuses on numerical methods that preserve two conservation laws of the modified Korteweg-de Vries (mKdV) equation, This PDE possesses a bi-Hamiltonian structure: there are two different ways to write it in the Hamiltonian form (1), namely with and with The mKdV equation has infinitely many independent conservation laws [39]. Those for mass, momentum and energy, respectively, are [1,37]: For suitable (e.g. zero) boundary conditions, integrating (7)-(9) over the spatial domain yields the invariants For discretizations of the mKdV equation, the following notation is helpful. The forward shift operators in space and time are defined, for all functions f on the grid, by ). The forward difference operators D m , D n and forward average operators µ m , µ n are D m = 1 ∆x (S m −I), D n = 1 ∆t (S n −I), µ m = 1 2 (S m +I), µ n = 1 2 (S n +I), where I is the identity operator.
The AVF method (3) for (5) uses This gives the following 10-point energy-conserving scheme (and its shifts): To apply the AVF method (3) to (6), let H = − j 1 2 U 2 j and let D be the diagonal matrix whose entry D j in the row and column indexed by j acts on functions f (m, n, [u]) as 3 (µ n u j−1,0 + µ n u j,0 + µ n u j+1,0 ) (D m µ n u j−1,0 ) f. This yields the 10-point momentum-conserving scheme m µ m µ n u −2,0 + D n u 0,0 . A new direct approach that enables multiple conservation laws to be preserved was introduced recently in [25,26] and greatly simplified in [20]. This approach, which does not exploit either Hamiltonian structures or integrability, can be applied (at least, in principle) to any system of PDEs whose conservation laws are polynomial in [u]; see §4 of [20] for a non-Hamiltonian, non-integrable example.
In the next sections we show that the two AVF schemes AVF EC and AVF MC are particular members of two parametrized families of methods that can be found by using this approach.
The rest of this paper is organized as follows. Section 2 describes the simplified direct approach to finding finite difference schemes that preserve two local conservation laws, for mass and either momentum or energy. In §3, we apply this strategy to the mKdV equation and obtain several families of conservative schemes. In §4, numerical tests confirm the theoretical results and demonstrate the effectiveness of the new schemes compared with multisymplectic and narrow box schemes, each of which preserves mass, but not momentum or energy.

2.
A strategy for preserving conservation laws. Given a (not necessarily Hamiltonian) PDE, a conservation law is in characteristic form if it satisfies Div F = QA.
The function Q is called the characteristic of the conservation law. For simplicity, we assume throughout that the domain V is contractible.
Remark 1. The vector space of total divergences is the kernel of the Euler operator, From Remark 1, if E(QA) = 0, there exists F such that Div F = QA is a conservation law.
A finite difference approximation of (11) on the grid is a partial difference equation, A(m, n, [u 0,0 ]) = 0, (13) where square brackets [ ] around an expression defined on the grid denote the expression and a finite number of its shifts. From here on, tildes denote approximations to the corresponding continuous quantities. We will abbreviate u 0,0 to u wherever this does not cause confusion.
The aim is to find finite difference schemes that satisfy a discrete analogue of each preserved conservation law, This difference conservation law is in characteristic form if just as for the continuous case, the multiplier function Q is called the characteristic (see [29] for more details). The following result, due to Kuperschmidt [31] and generalized in [30], is a discrete version of Remark 1 and plays a pivotal role in our approach.
Remark 2. The kernel of the difference Euler operator is the vector space of all difference divergences (14).
Given a PDE (11) with p conservation laws in characteristic form (12) that one wishes to preserve, our strategy is to seek approximations Q i and A such that From Remark 2, there exist F i such that each Q i A = Div F i is a discretization of the corresponding continuous conservation law. This strategy can be implemented efficiently as follows.
1. Choose a rectangular stencil that is large enough to contain second-order approximations of A and all Q i . 2. On the given stencil, the most general finite difference approximations A and Q 1 will depend on a large number of coefficients. 3. Impose consistency conditions giving second-order accuracy of the approximations at the centre of the stencil (which need not be a grid point). 4. Reduce the number of free parameters remaining by making some key terms as compact as possible; typically, these include highest derivatives and highestorder nonlinear terms. 5. Some of the remaining parameters are determined by solving symbolically, whenever a solution exists. The discrete flux F 1 and density G 1 , which satisfy Q 1 A = D m F 1 + D n G 1 , can be reconstructed from the characteristics [28]. 6. Steps 2 onward are iterated to preserve more conservation laws. If E( Q i A) = 0 has no solutions for some i, the corresponding conservation law cannot be preserved on the chosen stencil without violating at least one of the earlier conservation laws.
Solving (15) is a crucial step in the procedure; it is made tractable by the compactness conditions and the restriction to second-order approximations. Without these constraints, the only practical approach is to seek a Groebner basis (see [14]) for the polynomial system that determines the coefficients. This can take weeks of symbolic computation, even for scalar equations whose conservation laws have nothing worse than quadratic nonlinearities, approximated on the smallest possible stencil. The complexity increases exponentially with the degree of the polynomial nonlinearity and the size of the stencil. By contrast, the compactness and second-order conditions simplify the calculations to the point that schemes preserving multiple conservation laws can be found in just a few minutes; a Groebner basis may not even be needed. These simplifications were introduced in [20] and used to obtain several parametrized families of schemes, some of which are highly accurate, for the KdV equation and a nonlinear wave equation with quadratic nonlinearity.
Recently, Frasca-Caccia [19] outlined a new one-parameter family of mass-and energy-conserving 10-point schemes for the mKdV equation, which has cubic nonlinearity. In the current paper, the simplified strategy is used to extend this result to schemes that preserve mass and either momentum or energy, using 8-point and 10-point stencils. This demonstrates that the simplified strategy is not limited to quadratic nonlinearity. Figure 1. Example of a rectangular stencil for mKdV. PDEs and conservation laws are preserved to second order at the central point (x, t); densities and fluxes are second-order at (x, t − ∆t/2) and (x − ∆x/2, t), respectively.
3. Conservative methods for the mKdV equation. Each of the conservation laws (7)-(9) is in characteristic form; their characteristics are For simplicity, we consider only one-step schemes for the mKdV equation (4). Therefore, our stencils are as shown in Figure 1, with B −A ≥ 4. On such stencils, we construct schemes for the mKdV equation of the form so that the mass conservation law (7) is preserved. From this starting-point, the strategy described in §2 is used to preserve either (8) or (9). Linear terms in F 1 , G 1 and Q 2 or Q 3 are approximated by linear combinations of the values of u at the stencil points, with undetermined coefficients: Similarly, the cubic terms in Q 3 and F 1 are approximated by cubics: The undetermined coefficients satisfy consistency conditions to ensure that the schemes are second-order accurate at the centre of the stencil. (14) is secondorder accurate at the centre (x, t) if the approximations of F and G are second-order accurate at the points (x − ∆x/2, t) and (x, t − ∆t/2), respectively.

Remark 3. An approximation of a conservation law in the form
We now use the simplified strategy to obtain families of schemes, all of which depend on parameters that are O(∆x 2 , ∆t 2 ). It is possible to find values of the parameters that partially remove the leading terms of the local truncation error. However, there is no choice of the parameters that eliminates the second-order error terms identically; the optimal parameter values depend on the particular problem being approximated. No scheme in these families preserves all three conservation laws, though some come fairly close to doing so.
Energy-conserving methods. To simplify the symbolic calculation giving energyconserving schemes on the 8-point stencil, we use the following approximations to the second derivatives in F 1 and Q 3 , respectively: . All other terms in A and Q 3 are of the form (19) or (20), subject only to second-order consistency and In this way, we find a family of schemes that depends on two parameters. One of these parameters is O(∆x 4 , ∆t 4 ); as this is negligible on fine grids, we set this parameter to zero, obtaining a family of schemes A(λ) with Each of these schemes preserves the following discrete version of the conservation law (9): In both G 3 and F 3 there are terms that do not have any counterpart in the continuous density and flux. These all vanish as the stepsizes tend to zero. Assuming that ∆t < ∆x, the leading error terms are O(∆x 2 ). We use the notation EC 8 (λ 1 ) = A(λ 1 ∆x 2 ); the parameter λ 1 may be chosen to minimise the local truncation error.
Momentum-conserving methods. The momentum-conserving schemes introduced in this section are obtained by specifying that u xx = D 2 m µ n u −2,0 , and choosing the following compact approximations of G 1 and Q 2 : Then F 1 is determined from the general forms (19) and (20) by requiring consistency and This gives a three-parameter family of schemes that preserve mass and momentum. 1 Two of the parameters are O(∆x 4 , ∆t 4 ), so we set these to zero and obtain the oneparameter family A(λ) with G 1 given in (21) and . For any value of λ, the discrete momentum conservation law is preserved, with Q 2 given in (21) and All terms in F 1 , F 2 and G 2 that do not approximate any quantity in the continuous expressions vanish as the stepsizes tend to zero. They are identically zero if λ = 0. If ∆t < ∆x, the leading term in the local truncation error is O(∆x 2 ); by choosing λ = λ 2 ∆x 2 optimally, one may be able to remove at least part of this error. In the numerical tests section, we use the notation MC 8 (λ 2 ) = A(λ 2 ∆x 2 ).
Energy-conserving methods. To develop mass and energy conserving schemes on the 10-point stencil, we approximate G 1 and the cubic term of Q 3 on the most compact possible sub-stencils. This gives the one-parameter family of schemes found in [19], where λ = O(∆x 2 , ∆t 2 ). The discrete local energy conservation law satisfied by each scheme in this family is 1 Without the constraint on G 1 in (21), there is another parameter. Removing (instead) the constraint on Q 2 yields two other families of schemes.

LOCALLY CONSERVATIVE SCHEMES FOR THE MKDV EQUATION 315
where Q 3 = ϕ 0,0 and This family of schemes is written as Note that EC 10 (0) is the AVF scheme AVF EC that was derived in §1.
Momentum-conserving methods. The complexity of the symbolic computation for solving is reduced by using the most compact second-order approximations of G 1 and Q 2 . This gives a family depending on 27 parameters. For simplicity, we discuss here only members of this family having a compact approximation of the nonlinear term in F 1 , ignoring parameters that are O(∆x 4 , ∆t 4 ). This yields a one-parameter family A(λ) with . The discrete local conservation law for momentum is where Q 2 = µ n µ m u −1,0 and F 2 = 1 12 (µ n u −1,0 )(µ n u 0,0 ) (µ n u −1,0 ) 2 + (µ n u 0,0 ) 2 + (µ n u −1,0 )(µ n u 0,0 ) Again, all quantities that do not approximate any term in the corresponding continuous conservation law are identically zero when λ = 0. We denote this family of schemes by MC 10 (λ 4 ) = A(λ 4 ∆x 2 ).
4. Numerical tests. In this section we consider the mKdV equation (4) on a domain V = [a, b]×[0, T ], with periodic boundary conditions. We use some benchmark tests to show the effectiveness of the schemes developed in §3 compared with two well-known conservative methods (see [3,4]). The narrow box scheme is obtained by applying a standard finite volume discretization, giving This compact one-step scheme is a more efficient version of the popular Preissmann scheme [2,4]. Each of these schemes is in divergence form, preserving a discrete version of the mass conservation law (7). For every test in this section, the computational time is roughly the same for all of the numerical schemes. Therefore, the main difference between schemes is the solution error at the final time t = T , evaluated as On a grid with M points in space and N points in time, we evaluate the error in the conservation laws by measuring the error in the global invariants in (10) as follows: Whenever G 2 or G 3 is not defined for one of the schemes considered here, the corresponding error is instead evaluated as where v i,j = u(a + i∆x, j∆t) for schemes defined on the 10-point stencil and v i,j = 1 2 u(a + (i − 1)∆x, j∆t) + u(a + i∆x, j∆t) for 8-point schemes.
For each numerical test and family of schemes, we state the parameter value that minimizes the solution error (22). None of the schemes preserve three conservation laws, so we state the parameter values λ i that optimize the error in the unpreserved invariant given by (24) or (25). We also include the results for the simplest schemes, obtained by setting each λ i to zero. As EC 10 (0) ≡ AVF EC and MC 10 (0) ≡ AVF MC , this enables comparison with the AVF schemes.
The first benchmark problem is the interaction of two solitons, with the exact solution We set c 1 = 2.5, c 2 = 0.5, 0 minimize the error in the invariant that is not preserved by the scheme. As the modulus of λ 4 is very large, the corresponding term in MC 10 (λ 4 ) is not merely a perturbation; it undermines the correct Table 1. Errors in conservation laws and solutions for the twosoliton problem for the mKdV equation, with ∆x = 0.1, ∆t = 0.025. An asterisk denotes the error that is minimized. behaviour of the solution. So for this problem, minimizing the error in energy turns out to be a poor criterion for choosing the parameter. Table 1 shows the errors at the final time T = 10 in the conservation laws and the solution. We also show the error in the phase shift of the fastest and the slowest soliton, evaluated as, respectively, where x i (resp.x i ) denotes the location of the soliton peak in the exact and (resp. numerical) solution, using piecewise cubic interpolation of approximations at the grid points. The quantity Err φ = Err φ1 − Err φ2 ,   measures the extent to which the numerical solution underestimates the phase shift produced by the interaction of the two solitons. Table 1 shows that the new conservative schemes each preserve two discrete invariants (up to rounding errors). Each family includes schemes that are highly accurate -more so than the multisymplectic and narrow box schemes. The small values of Err φ1 , Err φ2 and Err φ indicate that the best schemes also reproduce the correct phase shifts. Attempting to minimize the error in the unpreserved conservation law does not optimize the numerical solution; nevertheless, this approach gives MC 8 and EC 10 schemes that are more accurate than the narrow box and multisymplectic schemes. This is not true for EC 8 and MC 10 schemes.
The upper plot in Figure 2 shows the initial condition and the numerical solution at T = 10 given by the most accurate of our schemes, EC 10 (0.04). The lower plot compares various numerical solutions with the exact solution at T = 10, near to the top of the faster soliton. The approximations at the grid points are connected by piecewise cubic interpolation, except for the solution of EC 10 (0.04) (for which the interpolation would cover the exact solution). The narrow box scheme is quite accurate for this problem, but it is outclassed by the AVF scheme EC 10 (0) and more so by EC 10 (0.04).
We now study the same problem on a coarser grid with ∆x = 0.2 and ∆t = 0.05. For each family, the parameter values minimizing the error in the solution or the unpreserved invariant are as given in Table 2; they are close to the optimal values for the finer grid. The solution error for the most accurate scheme in each family is around 4 times greater than on the finer grid, as expected. Figure 3 compares the exact solution with various numerical solutions near to the top of the fastest soliton, again using piecewise cubic interpolation. As a second benchmark problem, we approximate the breather solution (see [42]),  Table 3 shows the error in the conservation laws and the solution at the final time: EC 8 (2.22) is the most accurate scheme, while MC 8 (−0.165), EC 10 (0.92) and MC 10 (1.15) are the best in their respective families at minimizing the solution error. The error in the unpreserved conservation law is minimized by choosing λ 1 = 0.49, λ 2 = −0.128, λ 3 = 0.78 and λ 4 0. As for the two-soliton problem, minimizing the error in the non-conserved invariant is a poor criterion for choosing the parameter in MC 10 , so we do not show this result. By contrast, choosing the values of the parameters in MC 8 and EC 10 that minimize the error in the unpreserved invariant yields fairly accurate approximations.
The upper part of Figure 4 shows the numerical solution given by EC 8 (2.22). The lower part compares the exact solution and the numerical solutions given by EC 8 (2.22), the multisymplectic scheme and EC 10 (0) (which is the most accurate AVF scheme for this problem) at the final time. The graph of the solution of the narrow box scheme is very close to the solution of EC 10 (0), so is not shown in the figure. These schemes are more accurate than the multisymplectic scheme, but the frequency of the breather oscillations is best caught by EC 8 (2.22), whose solution almost overlaps the exact profile.

5.
Conclusions. The approach introduced in [20], which uses a fast symbolic computation to find finite difference schemes that preserve two conservation laws, is not restricted to quadratic nonlinearity. By considering stencils with eight and ten nodes, we have introduced four new one-parameter families of schemes that preserve two conservation laws of the mKdV equation, which has a cubic nonlinearity.
The AVF schemes introduced by Quispel and co-workers are found by this approach; typically, each is the simplest member of its family. However, the need to obtain a skew-adjoint approximation of the skew-adjoint differential operator means that AVF methods are restricted to stencils with an odd number of points in space.
Each of the families includes schemes that are very accurate. However, none of them preserve the first three conservation laws. Nevertheless, the value of the parameter can be chosen to minimize the error in the third invariant. Our numerical tests have shown that this criterion leads to reasonably accurate solutions for some, but not all, families.