Keywords

1 Introduction

Mathematical modeling, as one of the ways to obtain new knowledge, today is one of the main research methods in various fields of natural science. Gas movement in a wind tunnel, tsunami wave propagation, plasma scattering in a trap, weather changes and other numerous phenomena in science and technology are described by various mathematical models represented in the form of integral and partial differential equations. Modern computational algorithms make it possible with sufficient accuracy to solve these systems of equations in two-dimensional and three-dimensional approximations when solving various classes of problems, taking into account real geometries and nonstationarity of the process. Further progress in the development of numerical methods is associated with the development of new numerical algorithms and an increase in the speed and power of modern computing technology [1].

Modern problems of mathematical physics impose different requirements on the applied numerical algorithms, the main ones of which are:

  • high order of approximation (provides a more accurate solution on sufficiently coarse grids);

  • stability of algorithms (allowing calculations with large time steps);

  • conservativeness (correct resolution of discontinuous solutions);

  • monotonicity (no oscillations in areas of high gradients);

  • efficiency (as minimizing the number of arithmetic operations per grid point);

  • the universality of algorithms (the possibility of their extension to multidimensional 2D, 3D problems);

  • adaptation of algorithms to irregular or unstructured meshes;

  • the ability to parallelize computations (when using multiple computing processors - cores).

In this article, various finite-difference schemes are described and studied in detail, with the help of which one can solve the simplest model equations. We will restrict ourselves to consideration - the first order wave equation. These equations are called model equations because they are used to study the properties of solutions to more complex partial differential equations. Thus, the heat conduction equation can be considered as a model for other parabolic partial differential equations, for example, boundary layer equations. All considered model equations have analytical solutions for some boundary and initial conditions. Knowing these solutions, it is easy to evaluate and compare the various finite difference methods used to solve more complex partial differential equations. Of the many existing finite-difference methods for solving partial differential equations, this article mainly describes methods that have properties characteristic of a whole class of similar methods. Some finite-difference methods useful for solving equations are not presented, since they are similar to those described [2, 3].

For comparison, the most popular finite difference schemes were used, such as: explicit Euler scheme, upstream scheme, Lax scheme, implicit Euler scheme, leapfrog method, Lax - Wendroff method, McCormack method, Warming - Cutler - Lomax method, Abarbanel–Gottlieb–Turkel method.

In this article, as a model equation, we will choose Eq. (1), which we will call the one-dimensional wave equation of the first order, or simply the wave equation. The one-dimensional wave equation is a linear hyperbolic equation describing the propagation of a wave with a velocity u along the x-axis. It simulates in an elementary form nonlinear equations describing gas-dynamic flows:

$$\frac{\partial u}{{\partial t}} + \frac{\partial F}{{\partial x}} = 0.$$
(1)

In the general case, both the unknown \(u\) and \(F\left( u \right)\) the function are vectors.

For the stability of the numerical schemes, the CFL criterion was used.

The Courant-Friedrichs-Levy criterion (CFL criterion) is a necessary condition for the stability of an explicit numerical solution of partial differential equations. As a consequence, in many computer simulations the time step must be less than a certain value or the results will be incorrect. The physical criterion of CFL means that a liquid particle in one time step should not move more than one spatial step. Or, in other words, the computational scheme cannot correctly calculate the propagation of a physical disturbance, which in reality moves faster than the computational scheme allows “tracking”, that is, one step in space for one step in time.

$$\left| u \right|\frac{\Delta t}{{\Delta x}} \le C$$

Here the constant C = 1 depends on the equation, but does not depend on ∆t and ∆x.

2 Description of Schemes

2.1 Explicit Euler Method

This method leads to two simple explicit one-step difference schemes but only one scheme was presented in the article:

$$\begin{gathered} \frac{{u_{i}^{n + 1} - u_{i}^{n} }}{\Delta t} + \frac{{F_{i + 1}^{n} - F_{i - 1}^{n} }}{2\Delta x} = 0, \hfill \\ u_{i}^{n + 1} = u_{i}^{n} - \frac{\Delta t}{{2\Delta x}}\left( {F_{i + 1}^{n} - F_{i - 1}^{n} } \right). \hfill \\ \end{gathered}$$
(2)

with an approximation error \(O\left( {\Delta t,\left( {\Delta x} \right)^{2} } \right)\), respectively. Both of these schemes have the first order of approximation, since the leading term in the expression for the error is of the first order (\(\Delta t\)). Difference schemes (2) are explicit, since each difference equation contains only one unknown \(u_{i}^{n + 1}\). Unfortunately, the analysis of the stability of difference schemes (2) by the Neumann method leads to the fact that both of them are absolutely unstable and, therefore, are unsuitable for the numerical solution of the wave equation.

2.2 Differences Upstream

A simple explicit scheme (2) (Euler’s method) can be made stable if, when approximating the spatial derivative, one uses not forward differences, but backward differences in cases where the wave velocity c is positive. If the wave velocity is negative, then the stability of the scheme is ensured by using forward differences. This issue will be considered in more detail in the book [3] when describing the method of splitting the matrix coefficients. When using backward differences, difference equations take the form [4]:

$$\begin{gathered} \frac{{u_{i}^{n + 1} - u_{i}^{n} }}{\Delta t} + \frac{{F_{i + 1}^{n} - F_{i - 1}^{n} }}{2\Delta x} = 0, \hfill \\ u_{i}^{n + 1} = u_{i}^{n} - c\frac{\Delta t}{{2\Delta x}}\left( {F_{i}^{n} - F_{i - 1}^{n} } \right).\,\,\, \hfill \\ \end{gathered}$$
(3)

This difference scheme has the first order of accuracy with an approximation error \(O\left( {\Delta t,\Delta x} \right)\). It follows from the Neumann stability condition that the scheme is stable for \(\frac{\Delta t}{{\Delta x}} \le 1\).

2.3 Lax’s Scheme

Difference scheme (2) (Euler’s method) can be made stable by replacing it with the spatial average \(\frac{{u_{i + 1}^{n} - u_{i - 1}^{n} }}{2}\). As a result, we obtain the well-known Lax scheme [5]:

$$\begin{gathered} \frac{{u_{i}^{n + 1} - \left( {\frac{{u_{i + 1}^{n} - u_{i - 1}^{n} }}{2}} \right)}}{\Delta t} + \frac{{F_{i + 1}^{n} - F_{i - 1}^{n} }}{2\Delta x} = 0, \hfill \\ u_{i}^{n + 1} = \left( {\frac{{u_{i + 1}^{n} - u_{i - 1}^{n} }}{2}} \right) - \frac{\Delta t}{{2\Delta x}}\left( {F_{i + 1}^{n} - F_{i - 1}^{n} } \right). \hfill \\ \end{gathered}$$
(4)

This is an explicit one-step scheme of the first order of accuracy with an \(O\left( {\Delta t,\left( {\Delta x} \right)^{2} /\Delta t} \right)\) approximation error. She’s stable with \(\frac{\Delta t}{{\Delta x}} \le 1\).

2.4 Implicit Euler Method

All three methods of Euler, versus Stream and Lax are explicit methods. Consider an implicit difference scheme [6,7,8,9].

$$\frac{{u_{i}^{n + 1} - u_{i}^{n} }}{\Delta t} + \frac{{F_{i + 1}^{n + 1} - F_{i - 1}^{n + 1} }}{2\Delta x} = 0,$$
(5)

This is a first-order scheme with an approximation error \(O\left( {\Delta t,\left( {\Delta x} \right)^{2} } \right)\). Analysis of the Neumann stability (Fourier analysis) shows that it is stable at any time step, that is, it is absolutely stable. However, when using this scheme, at each time step, you have to solve the sweep.

$$u_{i}^{n + 1} = u_{i}^{n} - \frac{\Delta t}{{2\Delta x}}\left( {F_{i + 1}^{n + 1} - F_{i - 1}^{n + 1} } \right).$$
(6)

2.5 Leapfrog Method (Leapfrog Method)

Until now, only schemes of the first order of accuracy for solving a linear wave equation have been considered. The simplest second-order accurate method is the step-over method. Applying it to the first-order wave equation, we obtain an explicit one-step three-layer time difference scheme:

$$\frac{{u_{i}^{n + 1} - u_{i}^{n - 1} }}{2\Delta t} + \frac{{F_{i + 1}^{n} - F_{i - 1}^{n} }}{2\Delta x} = 0.$$
(7)

The step-by-step method is called three-layer in time, since in order to determine the value of and at the \(n + 1\)-th time step, it is necessary to know the values at the \(n - 1\)-th and n-th time steps.

The method has an approximation error of \(O\left( {\left( {\Delta t} \right)^{2} ,\left( {\Delta x} \right)^{2} } \right)\) and is stable for \(\frac{\Delta t}{{\Delta x}} \le 1\).

2.6 Lax-Wendroff Method

The Lax - Wendroff scheme [10] can be constructed based on the Taylor series expansion:

$$\begin{gathered} \frac{{u_{i}^{n + 1} - u_{i}^{n} }}{\Delta t} + \frac{{F_{i + 1}^{n} - F_{i - 1}^{n} }}{2\Delta x} = \frac{{F_{i + 1}^{n} - 2F_{i}^{n} + F_{i - 1}^{n} }}{2\Delta x}, \hfill \\ u_{i}^{n + 1} = u_{i}^{n} - \frac{\Delta t}{{2\Delta x}}\left( {F_{i + 1}^{n} - F_{i - 1}^{n} } \right) + \frac{{\left( {\Delta t} \right)^{2} }}{{2\left( {\Delta x} \right)^{2} }}\left( {F_{i + 1}^{n} - 2F_{i}^{n} + F_{i - 1}^{n} } \right). \hfill \\ \end{gathered}$$
(8)

This is an explicit one-step scheme of the second order of accuracy with an approximation error of \(O\left( {\left( {\Delta t} \right)^{2} ,\left( {\Delta x} \right)^{2} } \right)\), stable at \(\frac{\Delta t}{{\Delta x}} \le 0.01\).

2.7 McCormack Method

McCormack’s method [11] is widely used to solve the equations of gas dynamics. McCormack is especially handy for solving nonlinear partial differential equations. Applying the explicit predictor-corrector method to the linear wave equation, we obtain the following difference scheme:

Predictor

$$\begin{gathered} \frac{{\overline{{u_{i}^{n + 1} }} - u_{i}^{n} }}{\Delta t} + \frac{{F_{i + 1}^{n} - F_{i}^{n} }}{2\Delta x} = 0, \hfill \\ \overline{{u_{i}^{n + 1} }} = u_{i}^{n} - \frac{\Delta t}{{\Delta x}}\left( {F_{i + 1}^{n} - F_{i}^{n} } \right). \hfill \\ \end{gathered}$$
(9)

Corrector

$$\begin{gathered} \frac{{u_{i}^{n + 1} - \left( {u_{i}^{n} + \overline{{u_{i}^{n + 1} }} } \right)/2}}{\Delta t/2} + \frac{{F_{i}^{n} - F_{i - 1}^{n} }}{\Delta x} = 0, \hfill \\ u_{i}^{n + 1} = \left( {u_{i}^{n} + \overline{{u_{i}^{n + 1} }} - \frac{\Delta t}{{\Delta x}}\left( {\overline{{F_{i}^{n + 1} }} - \overline{{F_{i - 1}^{n + 1} }} } \right)} \right), \hfill \\ O\left( {\left( {\Delta t} \right)^{2} ,\left( {\Delta x} \right)^{2} } \right). \hfill \\ \end{gathered}$$
(10)

Initially (the predictor) the estimate of the \(\overline{{u_{i}^{n + 1} }}\) value and at the \(n + 1\)-th time step is found, and then (the corrector) the final value of \(u_{i}^{n}\) is determined at the \(n + 1\)-th time step. Note that in the predictor pro and input \(\frac{\partial u}{{\partial x}}\) is approximated by forward differences, and in the corrector - by backward differences. You can do the opposite, which is useful in solving some problems. Such problems include, in particular, problems with moving discontinuities.

2.8 Warming - Cutler - Lomax Method

Warming et al. [12] proposed a method of the third order of accuracy, which at the first two time steps coincides with the McCormack method and at the third with Rusanov’s method:

Step 1

$$\overline{{u_{i}^{n + 1} }} = u_{i}^{n} - c\frac{2\Delta t}{{3\Delta x}}\left( {F_{i + 1}^{n} - F_{i}^{n} } \right),$$
(11)

Step 2

$$\overline{\overline{{u_{i}^{n + 1} }}} = \left( {u_{i}^{n} + \overline{{u_{i}^{n + 1} }} - c\frac{2}{3}\frac{\Delta t}{{\Delta x}}\left( {\overline{{F_{i}^{n + 1} }} - \overline{{F_{i - 1}^{n + 1} }} } \right)} \right).$$
(12)

Step 3

$$\begin{gathered} \,\,\,\,\,\,\,\,\,\,\,u_{i}^{n + 1} = u_{i}^{n} - 1/24c\frac{\Delta t}{{\Delta x}}\left( { - 2F_{i + 2}^{n} + 7F_{i + 1}^{n} - 7F_{i - 1}^{n} + 2F_{i - 2}^{n} } \right) \hfill \\ - 3/8c\frac{\Delta t}{{\Delta x}}\left( {\overline{\overline{{F_{i + 1}^{n + 1} }}} - \overline{\overline{{F_{i - 1}^{n + 1} }}} } \right) - \omega /24\left( {u_{i + 2}^{n} - 4u_{i + 1}^{n} + 6u_{i}^{n} - 4u_{i - 1}^{n} + u_{i - 2}^{n} } \right). \hfill \\ \end{gathered}$$
(13)

This is an explicit three-step scheme of the third order of accuracy with an approximation error \(O\left( {\left( {\Delta t} \right)^{3} ,\left( {\Delta x} \right)^{3} } \right)\), stable at \(\frac{\Delta t}{{\Delta x}} \le 0.01\).

2.9 The Abarbanel–Gottlieb–Turkel Method

The article [13] presents a scheme of four step schemes of the fourth order of accuracy. This scheme has the following form:

Step 1

$$u_{{j + \frac{1}{2}}}^{\left( 1 \right)} = \frac{1}{2}\left( {u_{j + 1}^{n} + u_{j}^{n} } \right) - \frac{\Delta t}{{2\Delta x}}\left( {F_{j + 1}^{n} - F_{j}^{n} } \right),$$
(14)

Step 2

$$u_{j}^{\left( 2 \right)} = \frac{1}{8}\left\{ {10u_{j}^{n} - \left( {u_{j + 1}^{n} + u_{j - 1}^{n} } \right)} \right\} - \frac{\Delta t}{{2\Delta x}}\left( {F_{{j + \frac{1}{2}}}^{\left( 1 \right)} - F_{{j - \frac{1}{2}}}^{\left( 1 \right)} } \right),$$
(15)

Step 3

$$\begin{gathered} u_{{j + \frac{1}{2}}}^{\left( 3 \right)} = \frac{1}{16}\left\{ {9\left( {u_{j + 1}^{n} + u_{j}^{n} } \right) - \left( {u_{j + 2}^{n} + u_{j - 1}^{n} } \right)} \right\} \hfill \\ - \frac{\Delta t}{{8\Delta x}}\left( {8\left( {F_{j + 1}^{\left( 2 \right)} - F_{j}^{\left( 2 \right)} } \right) + 3\left( {F_{j + 1}^{n} - F_{j}^{n} } \right) - \left( {F_{j + 2}^{n} - F_{j - 1}^{n} } \right)} \right), \hfill \\ \end{gathered}$$
(16)

Step 4

$$\begin{gathered} u_{j}^{n + 1} = u_{j}^{n} - \frac{1}{96}\frac{\Delta t}{{\Delta x}}\left( \begin{gathered} 16\left( {F_{{j + \frac{1}{2}}}^{\left( 3 \right)} - F_{{j - \frac{1}{2}}}^{\left( 3 \right)} } \right) + 16\left( {F_{j + 1}^{\left( 2 \right)} - F_{j - 1}^{\left( 2 \right)} } \right) \hfill \\ + 56\left( {F_{{j + \frac{1}{2}}}^{\left( 1 \right)} - F_{{j - \frac{1}{2}}}^{\left( 1 \right)} } \right) - 8\left( {F_{{j + \frac{3}{2}}}^{\left( 1 \right)} - F_{{j - \frac{3}{2}}}^{\left( 1 \right)} } \right) \hfill \\ \end{gathered} \right) \hfill \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \frac{1}{96}\frac{\Delta t}{{\Delta x}}\left( {10\left( {F_{j + 1}^{n} - F_{j - 1}^{n} } \right) - \left( {F_{j + 2}^{n} - F_{j - 2}^{n} } \right)} \right). \hfill \\ \end{gathered}$$
(17)

This is an explicit four-step scheme of the fourth order of accuracy with an approximation error \(O\left( {\left( {\Delta t} \right)^{4} ,\left( {\Delta x} \right)^{4} } \right)\) stable at \(\Delta t/\Delta x \le 1\).

When use methods of the third and fourth order of accuracy, the increase in the accuracy of the algorithm has to be paid for by an increase in the computation time and the complexity of the difference scheme. This must be carefully considered when choose a method for solving a partial differential equation. Usually, for most applications, methods of the second order of accuracy can be obtained with sufficient accuracy.

3 The Discussion of the Results

In Fig. 1 shows graphs comparing the results of various schemes with experimental data.

Figure 1 shows the explicit Euler scheme, the implicit Euler scheme, the leapfrog method, the Lax - Wendroff method, the McCormack method gives the same results. The upstream schemes, the Warming - Cutler – Lomax and Abarbanel–Gottlieb–Turkel methods give results close to experimental data.

Now let’s consider how changing the grids affects the results of the first-order versus-flow, second-order McCormack, third-order Warming-Cutler-Lomax and fourth-order Abarbanel–Gottlieb–Turkel methods.

In Fig. 2 shows the effect of meshes in the resultant upstream circuit.

Figure 2 shows the upstream diagram when the computational grids change, approximates the experimental data, but the upstream diagram is not stable when time changes because this diagram is explicit and gives the first order of accuracy.

In Fig. 3 shows the effect of grids in the resulting McCormack scheme.

Figure 3 you can see McCormack’s method describes the process more accurately, but due to the second order of accuracy, the result oscillates.

Fig. 1.
figure 1

Comparison of the results of various schemes with experimental data: 1) explicit Euler scheme, 2) upstream scheme, 3) Lax scheme, 4) implicit Euler scheme, 5) leapfrog method, 6) Lax - Wendroff method, 7) McCormack method, 8) Warming - Cutler - Lomax method, 9) Abarbanel–Gottlieb–Turkel method, 10) exact solutions.

Fig. 2.
figure 2

Influence of computational grids in the upstream method.

Fig. 3.
figure 3

Influence of computational grids in the McCormack method.

Now let’s look at third-order schemes. In Fig. 4 shows how changing the grids affects the results of the Warming-Cutler-Lomax method. Because this method gives a closer result.

Figure 4 can be seen when increasing the grids, the results are very close to the experiment, but the result is highly oscillatory.

Fig. 4.
figure 4

Influence of computational grids in the Warming - Cutler - Lomax method.

In Fig. 5 shows how mesh changes affect the results of the Abarbanel–Gottlieb–Turkel method.

Fig. 5.
figure 5

Influence of computational grids in the Abarbanel–Gottlieb–Turkel method.

When using Abarbanel–Gottlieb–Turkel methods, the position of the fracture is determined more accurately. The calculation results differ from those obtained by the first to third order method.

4 Conclusion

In this article, the basic finite-difference solution methods for simple model equations have been studied. At the same time, the task was not set to describe all the known methods for solving these equations. However, the presented methods are a reasonable prerequisite for the analysis of methods for solving more complex problems [7, 8, 14,15,16,17,18,19,20]. From the information presented in the article, it can be seen that many different numerical methods can be used to solve the same problem. The difference in the quality of solutions obtained by these methods is often small, so it is quite difficult to choose the optimal method. However, it is possible to choose the best method using the experience gained during programming by various numerical methods and the subsequent solution of model equations on a computer.

In conclusion, it should be noted that the use of the scheme should be treated with caution. Because different schemes give different results for the same task. For separated flows, the McCormack, Warming-Cutler-Lomax and Abarbanel-Gottlieb-Turkel schemes give approximately the same results. The Warming-Cutler-Lomax and Abarbanel-Gotlieb-Turkel scheme gives more accurate results, but the Warming-Cutler-Lomax and Abarbanel-Gotlieb-Turkel scheme requires more time. Usually, for most problems, methods of the second order of accuracy can be obtained with sufficient accuracy.