Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

Conservation laws are often of advection-diffusion-reaction type, describing the interplay between different processes such as, e.g., drift, diffusion and generation/recombination. They occur in disciplines like combustion theory, plasma physics, transport in porous media etc. A model equation for these conservation laws is the advection-diffusion-reaction equation. In [4] we introduced the complete flux scheme for this equation. For steady problems, the complete flux approximation is based on the solution of a local BVP for the entire equation, including the source term. Consequently, the numerical flux consists of a homogeneous component, depending on the advection-diffusion operator, and an inhomogeneous component, depending on the source term. In many applications, the homogeneous component is known as the exponential scheme, however, we refer to it as the homogeneous flux scheme. The inclusion of the inhomogeneous flux is especially of importance for dominant advection, since it it guarantees that the flux approximation remains second order accurate, even for infinite Péclet number [1].

For time-dependent problems we include the time-derivative in the inhomogeneous flux. We will demonstrate that also this term is very important for advection-dominant problems, since it effectively removes the artificial diffusion introduced by the homogeneous flux scheme, at least up to second order, albeit at the cost of a small dispersion error. In order to analyse this, we consider the model equation

$$\begin{aligned} \frac{\partial {\varphi }}{\partial {t}} + \frac{\partial { }}{\partial {x}} \Big ( u \varphi - \varepsilon \frac{\partial {\varphi }}{\partial {x}} \Big ) = s, \end{aligned}$$
(1)

where \(u\) is the advection velocity, \(\varepsilon \ge \varepsilon _\mathrm{min} > 0\) the diffusion coefficient and \(s\) the source term. Associated with (1) we introduce the the flux \(f\), defined by

$$\begin{aligned} f = u \varphi - \varepsilon \frac{\partial {\varphi }}{\partial {x}} . \end{aligned}$$
(2)

To analyse the dissipation and dispersion errors of the HF and CF scheme, we derive the modified equation for both schemes, which is roughly speaking the partial differential equation that is exactly solved by the numerical solution. The modified equation of the HF scheme contains an artificial diffusion term, which suppresses spurious oscillations, however, it makes the scheme very dissipative for dominant advection. This artificial diffusion term is eliminated by the time derivative term in the inhomogeneous flux, making the scheme nondissipative, which is a very benificial property especially for long time integration. Instead, the modified equation contains a leading order dispersion term, responsible for possible spurious oscillations.

We have organised our paper as follows. The derivation of the HF and CF schemes is briefly outlined in Sect. 2. In Sect. 3 we derive the modified equation for both schemes and interpret these in terms of dissipation and dispersion. The performance of both schemes is demonstrated in Sect. 4, and finally in Sect. 5, we present a discussion and conclusions.

2 Numerical Approximation of the Flux

In this section we outline the complete flux scheme for Eq.  (1), which is a special case of the scheme introduced in [4].

Equation (1) can be written as \(\partial \varphi / \partial t + \partial f / \partial x = s \) with the flux \(f\) defined in (2). Assume this equation is defined on the domain \(\varOmega = [0,1]\). In the finite volume method we cover \(\varOmega \) with a finite number of control volumes (cells) \(\varOmega _{j}\) of size \(h\). We adopt the vertex-centred approach, i.e., we introduce the grid points \(x_{j} = j h\, (j = 0,1,2,\ldots ,N)\) with \(N h = 1\), where the variable \(\varphi \) has to be approximated, and choose \(\varOmega _{j} = [ x_{j-1/2},x_{j+1/2} ]\) with \(x_{j\pm 1/2} = \tfrac{1}{2} \big ( x_{j} + x_{j \pm 1} \big )\). Integrating the equation over \(\varOmega _{j}\) and applying the midpoint rule for the integrals of \(s\) and \(\partial \varphi / \partial t\), we obtain the semi-discrete equation

$$\begin{aligned} h\, \dot{\varphi }_{j}(t) + F_{j+1/2}(t) - F_{j-1/2}(t) = h\, s_{j}(t), \end{aligned}$$
(3)

where \(\dot{\varphi }_{j}(t) \approx \partial \varphi / \partial t( x_{j},t )\) and \(F_{j+1/2}(t)\) is the numerical approximation of the flux at the interface \(x = x_{j+1/2}\). In the following we will suppress the dependence of all variables on \(t\).

We determine the numerical flux \(F_{j+1/2}\) from the following quasi-stationary boundary value problem

$$\begin{aligned} \frac{\partial {f}}{\partial {x}}&= \frac{\partial { }}{\partial {x}} \Big ( u \varphi - \varepsilon \frac{\partial {\varphi }}{\partial {x}} \Big ) = s - \frac{\partial {\varphi }}{\partial {t}} , \quad x_{j} < x < x_{j+1},\end{aligned}$$
(4a)
$$\begin{aligned} \varphi ( x_{j} )&= \varphi _{j}, \quad \varphi ( x_{j+1} ) = \varphi _{j+1}, \end{aligned}$$
(4b)

where we have put the time derivative in the right hand side of Eq. (4a). As a consequence, the numerical flux will depend on the time derivative, and this will turn out to be of importance for dominant advection. In the derivation that follows we assume \(u\) and \(\varepsilon \) constant. Moreover, we introduce the following variables

$$\begin{aligned} a = \frac{u}{\varepsilon }, \quad P = a h, \quad \sigma (x) = \frac{ x-x_{j} }{h}. \end{aligned}$$
(5)

\(P\) is the well-known (grid) Péclet number and \(\sigma (x)\) is the normalized coordinate on \([ x_{j},x_{j+1} ]\) (\( 0 \le \sigma (x) \le 1\)). Integrating equation (4a) from \(x_{j+1/2}\) to \(x \in [ x_{j},x_{j+1} ]\), we obtain the integral balance

$$\begin{aligned} f(x) - f(x_{j+1/2}) = \int _{x_{j+1/2}}^{x} \hat{s}(\xi )\, \mathrm {d} \xi , \quad \hat{s} = s - \frac{\partial {\varphi }}{\partial {t}} . \end{aligned}$$
(6)

Next, substituting the integrating factor formulation

$$\begin{aligned} f(x) = -\varepsilon \, \mathrm {e} ^{a x} \frac{\partial { }}{\partial {x}} \big ( \mathrm {e} ^{-a x} \varphi \big ) \end{aligned}$$
(7)

in (6) and integrating the resulting equation form \(x_{j}\) to \(x_{j+1}\), we get

$$\begin{aligned} \begin{array}{l} \varepsilon \big ( \mathrm {e} ^{-a x_{j+1}} \varphi _{j+1} - \mathrm {e} ^{-a x_{j}} \varphi _{j} \big ) + \frac{1}{a} \big ( \mathrm {e} ^{-a x_{j}} - \mathrm {e} ^{-a x_{j+1}} \big ) f( x_{j+1/2} )\\ \qquad = \int _{x_{j}}^{x_{j+1}} \int _{x_{j+1/2}}^{x} \mathrm {e} ^{-a x} \hat{s}(\xi )\, \mathrm {d} \xi \mathrm {d} x. \end{array} \end{aligned}$$
(8)

Finally, changing the order of integration in the double integral in the right hand side of (8), we find the following expressions for the flux

$$\begin{aligned} f(x_{j+1/2})&= f^{ \mathrm {h} }( x_{j+1/2} ) + f^{ \mathrm {i} }( x_{j+1/2} ), \end{aligned}$$
(9a)
$$\begin{aligned} f^{ \mathrm {h} }(x_{j+1/2})&= \frac{\varepsilon }{h} \big ( B(-P) \varphi _{j} - B(P) \varphi _{j+1} \big ), \end{aligned}$$
(9b)
$$\begin{aligned} f^{ \mathrm {i} }( x_{j+1/2} )&= h \int _{0}^{1} G( \sigma ;P ) \hat{s}( x(\sigma ) )\, \mathrm {d} \sigma , \end{aligned}$$
(9c)

where \(B(z) = z/ \big ( \mathrm {e} ^{z} - 1 \big )\) and where \(G(\sigma ;P)\) is the so-called Green’s function for the flux, given by

$$\begin{aligned} G( \sigma ;P ) = {\left\{ \begin{array}{ll} \quad \dfrac{ 1 - \mathrm {e} ^{-P \sigma } }{ 1 - \mathrm {e} ^{-P} } \quad \quad \text {for} \quad 0 \le \sigma \le \tfrac{1}{2},\\ - \dfrac{ 1 - \mathrm {e} ^{P (1-\sigma )} }{ 1 - \mathrm {e} ^{P} } \quad \text {for} \quad \tfrac{1}{2} < \sigma \le 1; \end{array}\right. } \end{aligned}$$
(10)

see Fig. 1. From (9) it is evident that the flux is the sum of the homogeneous component \(f^{ \mathrm {h} }\), depending on the advection-diffusion operator, and the inhomogeneous component \(f^{ \mathrm {i} }\), depending the modified source \(\hat{s}\).

Fig. 1
figure 1

Green’s function \(G(\sigma ;P)\) for the flux for \(P > 0\) (left) and \(P < 0\) (right).

Obviously, the numerical flux is the sum of a homogeneous component, \(F^{ \mathrm {h} }_{j+1/2}\), and an inhomogeneous component, \(F^{ \mathrm {i} }_{j+1/2}\). For the homogeneous component we simply take (9b), i.e., \(F_{j+1/2}^{ \mathrm {h} } = f^{ \mathrm {h} }( x_{j+1/2} )\). For the inhomogeneous component we need to evaluate the integral in (9c). Note that for dominant diffusion \((| P | \ll 1)\) the integral (average) of \(G(\sigma ;P)\) is small, whereas for dominant advection \(( | P | \gg 1 )\) \(G(\sigma ;P)\) has a clear bias towards the upwind side of the interval. For this reason we replace \(\hat{s}(x(\sigma ))\) in (9c) by its upwind value and evalute the resulting integral. This way we obtain

$$\begin{aligned} F_{j+1/2} = F_{j+1/2}^{ \mathrm {h} } + h\, \big ( \tfrac{1}{2} - W(P) \big ) \big ( s_{ \mathrm {u} ,j+1/2} - \dot{\varphi }_{ \mathrm {u} ,j+1/2} \big ), \end{aligned}$$
(11)

where \(W(z) = \big ( \mathrm {e} ^{z}-1-z \big )/\big ( z \big ( \mathrm {e} ^{z}-1 \big ) \big )\) and where \(s_{ \mathrm {u} ,j+1/2}\) denotes the upwind value of \(s\) relative to the interface \(x_{j+1/2}\), i.e., \(s_{ \mathrm {u} ,j+1/2} = s_{j}\) if \(u \ge 0\) and \(s_{ \mathrm {u} ,j+1/2} = s_{j+1}\) if \(u < 0\), and likewise for \(\dot{\varphi }\).

We refer to the flux approximation in (11) as the complete flux (CF) scheme, as opposed to the homogeneous flux (HF) scheme, where we omit the source term and time derivative. Finally, substituting this expression in (3) we obtain the semi-discretisation

$$\begin{aligned} \begin{array}{l} \big ( \tfrac{1}{2} + W(|P|) \big ) \dot{\varphi }_{j} + \big ( \tfrac{1}{2} - W(|P|) \big ) \dot{\varphi }_{j( \mathrm {u} )} + \frac{1}{h} \Big ( F_{j+1/2}^{ \mathrm {h} } - F_{j-1/2}^{ \mathrm {h} } \Big ) = \\ \qquad \big ( \tfrac{1}{2} + W(|P|) \big ) s_{j} + \big ( \tfrac{1}{2} - W(|P|) \big ) s_{j( \mathrm {u} )}, \end{array} \end{aligned}$$
(12)

where \(j( \mathrm {u} )\) is the index of the grid point upwind of \(j\), i.e., \(j( \mathrm {u} ) = j-1\) if \(u \ge 0\) and \(j( \mathrm {u} ) = j+1\) is \(u < 0\). If we set \(W( |P| ) = \tfrac{1}{2} \) in (12), we get the HF semidisretisation.

3 Numerical Dissipation and Dispersion

In this section we investigate the semi-discrete system (12) in terms of dissipation and dispersion. We consider both the HF and CF scheme. In [3] we presented a detailed analysis based on the evolution of a planar wave solution, here we adopt a different approach, viz., we derive the modified equation for both schemes.

Roughly speaking, the modified equation of a finite difference scheme is defined as the partial differential equation that is actually solved by the numerical solution, apart from rounding errors [5]. Assume \(\psi \) to be a sufficiently smooth function coinciding with the numerical solution on the space-time grid. Expanding all differences in Taylor series, we obtain the original differential equation with an extra local discretisation error in the right hand side, which is an infinite sequence of derivatives. If we subsequently eliminate all time derivatives except the first order, we obtain the so-called modified equation. We will slightly adapt this procedure to our purpose.

We introduce the following difference operators for a generic grid function \(\nu _{j}\)

$$\begin{aligned} \begin{array}{l} \delta _{x}^{-} \nu _{j} = \frac{1}{h} \big ( \nu _{j} - \nu _{j-1} \big ), \quad \delta _{x} \nu _{j} = \frac{1}{2 h} \big ( \nu _{j+1} - \nu _{j-1} \big ),\\ \delta _{xx} \nu _{j} = \frac{1}{h^{2}} \big ( \nu _{j+1} - 2 \nu _{j} + \nu _{j-1} \big ). \end{array} \end{aligned}$$
(13)

In the following we assume that \(s = 0\) and \(u > 0\). We first consider the HF scheme, which can be written as

$$\begin{aligned} \dot{\varphi }_{j} + \frac{\varepsilon }{h^{2}} \big ( B^{-} \big ( \varphi _{j} - \varphi _{j-1} \big ) - B^{+} \big ( \varphi _{j+1} - \varphi _{j} \big ) \big ) = 0, \end{aligned}$$
(14)

where \(B^{\pm } = B( \pm P )\). Rearranging terms, we see that the scheme is equivalent to

$$\begin{aligned} \dot{\varphi }_{j} + u \delta _{x} \varphi _{j} - \varepsilon _\mathrm{art} \delta _{xx} \varphi _{j} = 0, \quad \varepsilon _\mathrm{art} = D\big ( \tfrac{1}{2} P ) \varepsilon , \end{aligned}$$
(15)

with \(D(z) = z \coth (z)\), see Fig. 2. The artificial diffusion coefficient \(\varepsilon _\mathrm{art}\) is the sum of \(\varepsilon \) and the numerical diffusion coefficient \(\varepsilon _\mathrm{num} = P \big ( \tfrac{1}{2} - W(P) \big ) \varepsilon \). To derive the modified equation of the semi-discretisation (15), we substitute a (sufficiently smooth) function \(\psi \), satisfying \(\psi ( x_{j},t ) = \varphi _{j}(t)\) for all grid points \(x_{j}\), and expand all spatial differences in Taylor series. Moreover, we discard all \(\fancyscript{O}\big ( h^{2} \big )\)-terms. This way we obtain the modified equation

$$\begin{aligned} \frac{\partial {\psi }}{\partial {t}} + u \frac{\partial {\psi }}{\partial {x}} = \varepsilon _\mathrm{art} \frac{\partial ^{2} {\psi }}{\partial {x}^{2}} . \end{aligned}$$
(16)

So the HF scheme suffers from numerical diffusion, where the artificial diffusion coefficient \(\varepsilon _\mathrm{art}\) increases from \(\varepsilon \) for \(P = 0\) to \( \tfrac{1}{2} u h\) for \(P \rightarrow \infty \) (upwind limit). Unlike standard central differences, the scheme does not display spurious oscillations since \(0 < u h / \varepsilon _\mathrm{art} < 2\).

Fig. 2
figure 2

The functions \(D\big ( \tfrac{1}{2} z \big )\) (left) and \(E(z)\) (right)

Next, we consider the CF scheme, which reads

$$\begin{aligned} \big ( \tfrac{1}{2} - W^{+} \big ) \dot{\varphi }_{j-1} + \big ( \tfrac{1}{2} + W^{+} \big ) \dot{\varphi }_{j} + \frac{\varepsilon }{h^{2}} \big ( B^{-} \big ( \varphi _{j} - \varphi _{j-1} \big ) - B^{+} \big ( \varphi _{j+1} - \varphi _{j} \big ) \big ) = 0, \end{aligned}$$
(17)

where \(W^{+} = W(P)\). Again, rearranging terms we obtain

$$\begin{aligned} \big ( \mathrm {id} - \alpha \delta _{x}^{-} \big ) \dot{\varphi }_{j} + u \delta _{x} \varphi _{j} - \varepsilon _\mathrm{art} \delta _{xx} \varphi _{j} = 0, \quad \alpha = h \big ( \tfrac{1}{2} - W^{+} \big ), \end{aligned}$$
(18)

where \(\mathrm {id}\) is the identity operator. Note that for \(\alpha \ne 0\) this scheme defines an implicit ODE-system, which is a result of the quasi-stationary assumption made in (4). To derive the modified equation we first make the ODE-system explicit by applying the inverse operator \(\big ( \mathrm {id} - \alpha \delta _{x}^{-} \big )^{-1}\) to (18), for which the following relation holds

$$\begin{aligned} \big ( \mathrm {id} - \alpha \delta _{x}^{-} \big )^{-1} = \mathrm {id} + \alpha \delta _{x}^{-} + \fancyscript{O}\big ( h^{2} \big ). \end{aligned}$$
(19)

Applying the inverse to (18), the advection term gives rise to the antidiffusion term

$$ -\alpha u \delta _{x}^{-} \delta _{x} \varphi _{j} = P \big ( W(P) - \tfrac{1}{2} \big ) \varepsilon \delta _{xx} \varphi _{j} + \fancyscript{O}\big ( h^{2} \big ), $$

which exactly cancels the numerical diffusion introduced by the HF scheme up to \(\fancyscript{O}\big ( h^{2} \big )\), and the diffusion term gives rise to the dispersive term \(\alpha \varepsilon _\mathrm{art} \delta _{x}^{-} \delta _{xx} \varphi _{j}\). Thus the CF scheme is equivalent to

$$\begin{aligned} \dot{\varphi }_{j} + u \delta _{x} \varphi _{j} = \varepsilon \delta _{xx} \varphi _{j} + \nu \delta _{x}^{-} \delta _{xx} \varphi _{j} + \fancyscript{O}\big ( h^{2} \big ), \quad \nu = E(P) u h^{2}, \end{aligned}$$
(20)

where \(E(z) = D\big ( \tfrac{1}{2} z \big ) \big ( \tfrac{1}{2} - W(z) \big )/z\); see Fig. 2. \(\nu \) is the numerical dispersion coefficient. Since \(\delta _{x}^{-} \delta _{xx} \varphi _{j}\) is a first order approximation of \(\partial ^{3} \varphi / \partial x^{3}( x_{j} )\) we conclude that the CF scheme is a second order accurate approximation of the modified equation

$$\begin{aligned} \frac{\partial {\psi }}{\partial {t}} + u \frac{\partial {\psi }}{\partial {x}} = \varepsilon \frac{\partial ^{2} {\psi }}{\partial {x}^{2}} + \nu \frac{ \partial ^{3} \psi }{ \partial x^{3} }. \end{aligned}$$
(21)

The third order term \(\nu \partial ^{3} \varphi / \partial x^{3}\) is reponsible for dispersion, i.e., waves of different frequencies propagate at different speed.

It is instructive to consider the advection-reaction equation as special case, i.e., \(\varepsilon = 0\). In this case \(P \rightarrow \infty \) and \(\nu = \tfrac{1}{4} u h^{2}\). Substituting the planar wave \(\psi (x,t) = \mathrm {e} ^{ \mathrm {i} (\kappa x - \omega t)}\) in (21), with \(\kappa \) the wave number and \(\omega \) the frequency, we obtain the dispersion relation \(\omega (\kappa ) = u \kappa + \nu \kappa ^{3}\) from which we infer that the numerical phase velocity \(c_\mathrm{p}(\kappa ) = \omega (\kappa )/\kappa = u\big ( 1 + \tfrac{1}{4}(\kappa h)^{2} \big )\). Since \(\nu > 0\), the numerical solution propagates (a little) too fast.

To compute the full numerical solution, we have to apply a time integrator to (12). Since the CF scheme is nondissipative, the trapezoidal rule is an obvious choice. Combined with the CF scheme for the advection equation, the trapezoidal rule reduces to the box scheme, which is second order and nondissipative indeed. However, the dispersion error of the combined scheme differs from the dispersion error of the CF scheme alone, this is due to the trapzoidal rule [2, pp. 379–381].

4 Numerical Example

In this section we apply the HF and CF scheme to a model problem. In [3] we investigated the order of convergence of the schemes, and we will not repeat this here. The main conclusions, however, are the following. For dominant diffusion both the HF and CF scheme exhibit second order convergence. On the other hand, for dominant advection, the HF scheme reduces to the first order upwind scheme, whereas the CF scheme remains second order convergent. Thus, inclusion of the source term and time derivative is important for dominant advection!

Numerical dissipation and dispersion can be conveniently demonstrated for the advection equation, therefore we choose \(\varepsilon = 0\) and \(s = 0\). Furthermore, we choose the initial and boundary conditions such that the exact solution is given by the wave packet

$$\begin{aligned} \varphi (x,t) = \mathrm {e} ^{-\lambda \xi ^{2}} \sin ( \kappa \xi ), \quad \xi = x - x_{0} - u t. \end{aligned}$$
(22)

Numerical approximations of (22) together with its (Gaussian) envelope are shown in Fig. 3. Clearly, the HF scheme is very dissipative. At \(t = 5 \times 10^{-2}\), the amplitude has decreased to approximately \(0.2\) times its initial value while at \(t = 0.5\) the solution has completely vanished. On the other hand, the CF numerical solution has not dissipated and is clearly much better than the HF solution. In fact for this choice of \(h\) and time step \( \Delta t \), the Courant number \(c = u \Delta t / h = 1\), and the exact solution is recovered. Other choices of \( \Delta t \) give rise to numerical dispersion, which should be attributed to the time integrator, however.

Fig. 3
figure 3

HF and CF numerical solutions for the advection equation at \(t = 0.05\) (left) and at \(t = 0.5\) (right). Parameter values are \(u = 1\), \(\lambda = 10^{2}\), \(\kappa = 50 \pi \), \(x_{0} = 0.2\) and \(h = \Delta t = 2.5 \times 10^{-3}\)

5 Concluding Remarks and Discussion

We have presented the HF and CF scheme for an advection-diffusion-reaction model problem. The CF scheme is based on a quasi-stationary boundary value problem, including the time derivative in the source term. Consequently, the numerical flux consists of a homogeneous component, depending on the advection-diffusion operator, and an inhomogeneous component, containing the source and time derivative. We have derived the modified equation for both schemes and demonstrated that the HF scheme is prone to numerical diffusion, which is completely removed in the CF scheme. Instead, the CF scheme suffers from a dispersion error. We have shown that the CF scheme is much more accurate than the HF scheme when applied to the advection equation.

Both schemes are applicable to complex applications like plasma systems. In [1] we have shown that the CF scheme is much more accurate than the HF scheme for the numerical simulation of a glow discharge. The conservation laws are in this case nonlinear and coupled, which is no objection since the original HF and CF schemes developed in [4] only assume coefficients that are functions of space and time.