1 Introduction

With the expansion of the phenomena studied in Physical Science in both breadth and depth, the application of partial differential equations is more extensive [1,2,3,4]. From the point of view of mathematics itself, the solution of partial differential equations promotes the development of mathematics in function theory, variational method, series expansion, ordinary differential equation, algebra, differential geometry and so on. From this point of view, partial differential equations gradually become the center of mathematics [5,6,7,8]. Burgers equation and Euler equation of Laval nozzle are suitable to be used as examples to study the mathematical characteristics of partial differential. Burgers equation is a nonlinear partial differential equation which simulates the propagation and reflection of shock wave, Burgers equation is a basic partial differential equation in various fields of Applied Mathematics, such as fluid mechanics, nonlinear acoustics, and gas dynamics, It was proposed by H.Bateman when he studied fluid motion. It is an ideal simplified model for solving complex hydrodynamics problems. Laval nozzle is an important part of thrust chamber, Its structure can change the velocity of air flow with the change of nozzle cross-section area, and make the flow from subsonic to sonic, and then to supersonic [9, 10].

In this paper, the mathematical properties of one-dimensional Burgers equation and one-dimensional Laval nozzle Euler equation are studied, and the numerical solutions are numerically solved, and the stability of the numerical solutions is analyzed. It is well known that there are numerical errors in solving the numerical solutions of partial differential equations. If there is an error in a certain stage of the solution, the solution is stable when the error is reduced from step n to step n + 1 [11, 12]. On the other hand, we point out that if the increment in the forward direction exceeds a certain value, the explicit method is numerically unstable. MacCormack scheme is used to solve the one-dimensional Burgers equation and MacCormack scheme with artificial viscosity is used to solve the one-dimensional Laval nozzle Euler equation. In addition, the numerical and analytical solutions of Euler equation for one-dimensional Laval nozzle are compared.

2 Some Knowledge of Theoretical Stability Analysis

The two equations studied in this paper belong to hyperbolic partial differential equations. First of all, let’s simply investigate the stability characteristics of this simple equation, and provide a preliminary understanding for the following two equations. Consider the first-order wave equation [13],

$$ \frac{\partial f}{\partial t}+c \frac{\partial f}{\partial x}=0 $$
(1)

where c is constant. For the space term, we use the second-order central difference scheme; for the time term, we use the first-order forward difference scheme. Therefore, the (1) can be discretized as follows,

$$ \frac{f^{n+1}_{i} - {f^{n}_{i}}}{\varDelta t} + c \frac{f^{n}_{i+1}-f^{n}_{i-1}}{2 \varDelta x} =0 $$
(2)

where Δx represents grid spacing, Δt represents time-marching step, \({f^{n}_{i}}\) represents the value f at the grid point i in the time-step n.

According to Fourier analysis, in principle, the vibration of any time function can be decomposed into the superposition of many simple harmonic functions with different frequencies. Therefore, we may as well assume that the above formula has the following form of error.

$$ \varepsilon(x,t)=e^{\omega t + i\alpha x} $$
(3)

where ω represents circular frequency of simple harmonic vibration, α represents wave number, according to Euler formula, the following equation holds,

$$ e^{i \alpha x}=\cos(\alpha x)+i\sin(\alpha x) $$
(4)

According to the definition of the stability of the numerical solution, if the error decreases in the process of advancing from time step n to time step n + 1, the numerical solution is considered to be stable; otherwise, the numerical solution is considered to be unstable.

According to the definition of error, the error term also satisfies the difference equation, here, replace the \({f^{n}_{i}}\) with \({\varepsilon ^{n}_{i}}\), we get

$$ \left|\frac{\varepsilon^{n+1}_{i}}{{\varepsilon^{n}_{i}}}\right|=|\cos(\alpha\varDelta x)-ic\sin(\alpha\varDelta x)| $$
(5)

If the numerical solution is stable, the error ratio satisfies the following relation,

$$ \left|\frac{\varepsilon^{n+1}_{i}}{{\varepsilon^{n}_{i}}}\right|\leq 1 $$
(6)

Further, let \(C=c\frac {\varDelta t}{\varDelta x}\), we can obtain

$$ \cos^{2}(\alpha\varDelta x)+C^{2}\sin^{2}(\alpha\varDelta x)\leq 1 $$
(7)

Namely,

$$ (C^{2}-1)\sin^{2}(\alpha\varDelta x)\leq 0 $$
(8)

Then, we can get

$$ C=c\frac{\varDelta t}{\varDelta x}\leq 1 $$
(9)

So, we can get the time step from the (9),

$$ \varDelta t \leq \frac{\varDelta x}{|c|} $$
(10)

The (9) is usually called CFL condition, and C is called courant number, which is an important stability criterion of hyperbolic equation. The calculation of the following two examples is based on this criterion as the judgment condition of numerical stability.

Consider the second-order wave equation

$$ \frac{\partial^{2} f}{\partial t^{2}}=c^{2} \frac{\partial^{2} f}{\partial x^{2}} $$
(11)

There is some relation between the characteristic lines of (11) and CFL condition, which helps to explain the physical meaning of CFL condition. These characteristic lines of (11) are given by

$$ \left\{\begin{array}{ll} x = ct (right-running)\\ x = -ct(left-running) \end{array}\right.\ $$
(12)

These two characteristic lines are drawn in Figs. 1 and 2, let point b be the intersection point of the right-running characteristic line passing through grid point I-1 and the left-running characteristic line passing through grid point i + 1. This intersection point has special significance because it corresponds to the upper limit of CFL condition, that is, the Courant number C = 1. For the sake of clarity, we use ΔtC= 1 to denote Δt determined by the (9) when C = 1, then we can get the result from (9),

$$ \varDelta t_{C=1} = \frac{\varDelta x }{c} $$
(13)

In Figs. 1 and 2, if the distance ΔtC= 1 is moved upward from grid point i, it just falls on point b. This is because for the characteristic line given by (12),

$$ \varDelta t = \pm \frac{\varDelta x }{c} $$
(14)
Fig. 1
figure 1

Illustration of a stable case

Fig. 2
figure 2

Illustration of a unstable case

Now consider the case of C < 1, i.e. Fig. 1. According to the (9), ΔtC< 1 <Δ tC= 1. Let d be directly above the grid point i and the distance is ΔtC< 1. Since the numerical solution of point d is calculated by difference equation using the information at grid points i − 1 and i + 1, the dependent region of numerical solution at point d is the triangle adc in Fig. 1. The region of dependence of the analytic solution at point d is determined by the characteristic line passing through the point d, that is, the shadow area in Fig. 1, it can be seen that the dependence region of the numerical solution at point d contains the dependent region of the analytical solution.

By contraries, consider the case of C > 1, i.e. Fig. 2. According to the (9), ΔtC> 1 >Δ tC= 1. Let d be directly above the grid point i and the distance is ΔtC> 1. Since the numerical solution of point d is calculated by difference equation using the information at grid points i − 1 and i + 1, the dependent region of numerical solution at point d is the triangle adc in Fig. 2. The dependent region of analytical solution at point d is determined by the characteristic line passing through point d, that is, the shadow area in Fig. 2. It can be seen that the dependent regions of numerical solutions do not include all the dependent regions of analytical solutions. Therefore, C > 1 will lead to the instability of the numerical solution.

Therefore, for the CFL condition, we can make the following physical explanation: in order to ensure the stability of numerical solution, the dependent region of numerical solution must include the dependent region of analytical solution.

3 Solution of the One-Dimensional Burgers’ Equation

Burgers equation is an important nonlinear partial differential equation in computational fluid dynamics. This equation exists in both convection and diffusion States, and keeps the basic characteristics of Navier-Stokes equation. It is a simplified model for solving complex hydrodynamics problems [14,15,16].

Consider the following one-dimensional Burgers’ equation

$$ \frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}=\varepsilon \frac{\partial^{2}u}{\partial t^{2}}, -1 \leq x \leq 1, 0 \leq t \leq T $$
(15)

where u represents the velocity of the fluid and ε = 1/Re > 0 represents the viscosity of the medium, Re is Reynolds number.

The initial condition is as follows,

$$ u(x,0)= g(x) = -0.5x, -1 \leq x \leq 1 $$
(16)

The boundary conditions are as follows,

$$ u(-1,t)=\theta(t) = 0.5, u(1,t) =\omega(t) = -0.5 $$
(17)

The region Ω = {(x,t)|− 1 ≤ x ≤ 1,0 ≤ tT} is divided into the following equidistant section (Fig. 3)

Fig. 3
figure 3

Time and space regional map

The MacCormack scheme is used to solve (15). The specific steps are as follows,

  1. 1)

    Predictor step

    In the (15), using forward difference instead of spatial derivative,

    $$ \left( \frac{\partial u}{\partial t}\right)^{k}_{i}=-\frac{1}{2}\frac{\left( u^{k}_{i+1}\right)^{2}-\left( {u^{k}_{i}}\right)^{2}}{\varDelta x}+\varepsilon\frac{u^{k}_{i+1}-2{u^{k}_{i}}+u^{k}_{i-1}}{(\varDelta x)^{2}} $$
    (18)

    Then, we can get the predicted value,

    $$ u^{k+1}_{i}={u^{k}_{i}}+(\frac{\partial u}{\partial t})^{k}_{i}\cdot \varDelta t $$
    (19)
  2. 2)

    Corrector step

    $$ \left( \frac{\partial u}{\partial t}\right)^{k+1}_{t}= -\frac{1}{2}\frac{\left( u^{k+1}_{i+1}\right)^{2}-\left( u^{k+1}_{i}\right)^{2}}{\varDelta x}+\varepsilon\frac{u^{k+1}_{i+1}-2u^{k+1}_{i}+u^{k+1}_{i-1}}{(\varDelta x)^{2}} $$
    (20)

The average value is

$$ \left( \frac{\partial u}{\partial t}\right)_{av}=\frac{1}{2}\left[\left( \frac{\partial u}{\partial t}\right)^{k}_{i}+\left( \frac{\partial u}{\partial t}\right)^{k+1}_{i}\right] $$
(21)

where av denotes average. In combination with the (15)–(18), we can obtain,

$$ u^{k}_{i+1}={u^{k}_{i}}+\left( \frac{\partial u}{\partial t}\right)_{av}\cdot \varDelta t $$
(22)

Let ε = 0.01, and divide the interval into 100 equal parts, that is, \(\varDelta x=\frac {2}{100}=0.02\), and the numerical error is

$$ \varepsilon(x,t)=e^{\omega t + i \alpha x} $$
(23)

Furthermore, according to the preliminary knowledge of stability analysis in the second part of this paper, combined with the (15)-(19), a stable numerical solution can be obtained by computer numerical simulation. The amplification factor of the error is as follows,

$$ \left|\frac{\varepsilon^{n+1}_{i}}{{\varepsilon^{n}_{i}}}\right|=|e^{a\cdot \varDelta t}|\leq 1 $$
(24)

According to the CFL condition, if the numerical solution satisfies the stability condition, the Courant number should satisfy (9).

So the numerical solution is stable. Through the computer numerical simulation, we get the curve of u to x in different time, as shown in Fig. 4.

Fig. 4
figure 4

The numerical solution of u at t = 1.2

It can be seen from Fig. 4 that the curve of u verse x is smooth at different times under the conditions of Δt = 0.01 and C ≤ 1, which also shows that the numerical solution of the (15) is stable.

On the other hand, if let Δt = 0.2, we get

$$ C\geq 1 $$
(25)

Then, the computer program will diverge and the convergence result will not be obtained.

4 Solution of Euler Equation for Subsonic-supersonic Isentropic Laval Nozzle Flow

The governing equations are usually divided into conservative form and non conservative form. Theoretically, these two forms can correctly express the mass equation, momentum equation, energy equation and other basic physical laws[17, 18]. Then, in computational fluid dynamics, for some specific flows (such as shock capture problems), we can get better results by choosing conservative governing equations. For subsonic-supersonic isentropic Laval nozzle flow, the following governing equations are given.

$$ \left\{\begin{array}{ll} \partial (U_{1}) / \partial t = - \partial (F_{1}) / \partial x \\ \partial (U_{2}) / \partial t = - \partial (F_{2}) / \partial x + J_{2} \\ \partial (U_{3}) / \partial t = - \partial (F_{3}) / \partial x \end{array}\right.\ $$
(26)

where U represents the solution vector, F represents the flux vector, and J represents the source term, here, we have

$$ \left\{\begin{array}{ll} U_{1} = \rho A \\ U_{2} = \rho A V \\ U_{3} = \rho (\frac{T}{\gamma - 1} + \frac{\gamma}{2} V^{2}) A \\ J_{2} = \rho (\frac{T}{\gamma - 1} + \frac{\gamma}{2} V^{2}) A V + p A V \\ F_{1} = \rho A V \\ F_{1} = \rho A V^{2} + \frac{1}{\gamma} p A \\ p = \rho T \end{array}\right.\ $$
(27)

where A represents the cross-sectional area of the Laval nozzle, ρ is the density of the fluid, V is the velocity of the fluid, p is the static pressure, T is the temperature, and γ is the specific heat of the fluid (γ = 1.4), all of the above variables are dimensionless.

Suppose the equation satisfies the following boundary conditions,

  1. 1)

    At the inlet boundary ,

    $$ \left\{\begin{array}{ll} \rho=1.11\\ V=0.69 \\ \partial p / \partial x = 0 \end{array}\right.\ $$
    (28)
  2. 2)

    At the outlet boundary ,

    $$ \left\{\begin{array}{ll} \partial \rho / \partial x = 0\\ \partial V / \partial x = 0 \\ p = 1.23 \end{array}\right.\ $$
    (29)

The distribution of the area of the Laval nozzle,

$$ A(x)=0.75+x^{2}, 0 \leq x \leq 1, $$
(30)

The MacCormack scheme is similar to that in example 1 to solve the (24). Due to the nature of Lavel nozzle and given conditions, shock wave will appear in some part of the pipeline, and the variable of flow field will also have sudden change. Therefore, in order to capture the shock wave, artificial viscosity should be added to MacCormack scheme [19]. The specific steps are as follows,

  1. 1)

    A small amount of artificial viscosity can be added to the each of the time-marching solution,

    $$ {S^{t}_{i}}=C_{x} \cdot \frac{|p^{t}_{i+1}-2{p^{t}_{i}}+p^{t}_{i-1}|}{|p^{t}_{i+1}+2{p^{t}_{i}}+p^{t}_{i-1}|}(U^{t}_{i+1}-2{U^{t}_{i}}+U^{t}_{i-1}) $$
    (31)

    where \({p^{t}_{i}}\) represents the value of static pressure at the grid point i in the time \(t, {U^{t}_{i}}\) represents the value of variables at the grid point i in the time t.

On the predictor step, the steps of MacCormack scheme with artificial viscosity are as follows.

$$ \left\{\begin{array}{ll} (U_{1})^{t+ \varDelta t}_{i} = (U_{1})^{t}_{i} + (\partial { U_{1}} / \partial t)\varDelta t + (S_{1})^{t}_{i} \\ (U_{2})^{t+ \varDelta t}_{i} = (U_{2})^{t}_{i} + (\partial { U_{2}} / \partial t)\varDelta t + (S_{2})^{t}_{i} \\ (U_{3})^{t+ \varDelta t}_{i} = (U_{3})^{t}_{i} + (\partial { U_{3}} / \partial t)\varDelta t + (S_{3})^{t}_{i} \end{array}\right.\ $$
(32)
  1. 2)

    Similarly, on the predictor step, the steps of MacCormack scheme with artificial viscosity are as follows.

    $$ \left\{\begin{array}{ll} (U_{1})^{t+ \varDelta t}_{i} = (U_{1})^{t}_{i} + (\partial { U_{1}} / \partial t)_{av} \varDelta t + (S_{1})^{t}_{i} \\ (U_{2})^{t+ \varDelta t}_{i} = (U_{2})^{t}_{i} + (\partial { U_{2}} / \partial t)_{av} \varDelta t + (S_{2})^{t}_{i} \\ (U_{3})^{t+ \varDelta t}_{i} = (U_{3})^{t}_{i} + (\partial { U_{3}} / \partial t)_{av} \varDelta t + (S_{3})^{t}_{i} \end{array}\right.\ $$
    (33)

According to the preparation knowledge of the stability analysis of the second part of this paper, we have

$$ C=\frac{\varDelta t}{\varDelta x}\cdot (u+a) $$
(34)

By the CFL condition and the computer numerical simulation, we get

$$ C\leq 1 $$
(35)

So we know that the numerical solution is stable. Further we obtained the time step

$$ \varDelta t=C \cdot \frac{\varDelta x}{u+a}\leq \frac{\varDelta x}{u+a} $$
(36)

The Temperature distribution of numerical solution is shown in Fig. 5.

Fig. 5
figure 5

Temperature distribution of numerical solution

It can be seen from Fig. 5 that at x = 0.3, there are shock waves in the flow field, so the sudden change effect of temperature occurs here. Near the shock wave, the numerical solution has different degrees of small oscillation, and on both sides of the shock wave, the numerical solution is completely smooth and continuous. This shows that the MacCormack scheme with artificial viscosity can successfully capture the shock wave in the flow field under the condition of CFL, and the stable numerical solution of the (24) is obtained.

On the other hand, if the given Δt is too large to cause C ≥ 1, the computer program will be divergent and can not obtain convergence results.

In addition, the shock wave satisfies the conservation of momentum and energy. According to these conditions, we can calculate the analytical solution of Euler equation for shock wave one-dimensional Laval nozzle flow at each grid point. The specific form of the exact analytical solution [20] is shown in Fig. 6.

Fig. 6
figure 6

Temperature distribution of exact analytical solution

It can be seen from Fig. 6 that the curve of the analytical solution is completely smooth and there is no numerical oscillation at the shock position. If the numerical oscillation of the numerical solution in Fig. 5 is ignored, the result is almost identical with the analytical solution in Fig. 6, which further verifies the correctness and stability of the numerical solution in this paper.

5 Conclusion

Under the condition of stability, the explicit MacCormack scheme and the artificial viscous MacCormack scheme are used to solve the two equations respectively, and the numerical solutions of this paper are shown graphically. Through the analysis of the figure, we can find that the numerical value is stable. In addition, the analytical solution of the second kind of equation is given and compared with the numerical solution. It can be seen that the numerical solution and the analytical solution in this paper are in good agreement, which further verifies the conclusion that the numerical solution of the equation is stable and the numerical simulation method in this paper is correct.