1 Introduction

Residual distribution (RD) schemes are discretization methods based on cell vertex solutions and cell residuals. The main motivation for RD schemes is to mimic the multi-dimensional physics of wave propagation for hyperbolic equations using a compact-stencil, which is difficult to be captured with finite volume (FV) schemes. Although hyperbolic or advection-dominated problems have a preferential flow direction, elliptic and parabolic problems have an isotropic nature of flow physics which is readily captured by a standard Finite Element Galerkin approach. Owing to the different physics of advection and diffusion, it is perhaps best to discretize them in a non-unified (separate) manner. Unfortunately, the non-unified discretization of advection–diffusion problems using RD schemes and Galerkin approach have not been fully resolved. Previous work investigating this issue, encountered an order of accuracy loss when the advection and diffusion terms are discretized separately. It was observed that if a second-order advection scheme combined with a second order diffusion scheme for advection–diffusion problems, the overall scheme reduces to first-order [14]. This is especially true for cases when both advection and diffusion terms are equally important. One approach to overcome this issue considers a hybrid scheme between an RD approach and a Petrov–Galerkin scheme by means of a scaling parameter which is a function of the cell Peclet number [16]. Another approach is to treat the advection and diffusion terms in a unified manner and handled within a single scheme [14] which is known as the unified approach. Thus by having a single residual where in the limit of advection term dominates, the scheme becomes upwind while when diffusion dominates, the scheme is isotropic. In general the scheme is a blend between an RD approach of upwind and isotropic types. In order to evaluate the single residual, the gradients are reconstructed at each node [3, 15]. Alternatively, in order to keep the scheme compact, the works of [11,12,13] suggested solving a system of equations where the gradients of each node are part of the unknowns along with the nodal solution. The work of [11] did explore a non-unified approach, however it still required to solve a system of equations for the scalar advection–diffusion.

In this paper, we revisit the issue of the loss in order-of-accuracy when the advection and diffusion residuals are evaluated in a non-unified manner. We shall begin the analysis using a finite element approach to demonstrate the generality of RD methods over unstructured triangular grids. Most studies on advection–diffusion RD methods focused on modifying the diffusion scheme while keeping the advection methods unchanged [3, 12, 13]. The work of [18] however, looked into modifying the advection scheme using a Finite-Element-type method coupled with artificial diffusion along the streamline on quadrilateral grids. Our work will also be toward modifying the advection method but we insist on a compact approach on triangular grids and without the need to solve additional equations. We shall propose an alternative advection method while keeping the Galerkin approach for diffusion to preserve the second-order accuracy for the scalar advection–diffusion problems in a non-unified manner. The proposed approach will be based on a newly developed multi-dimensional Flux-Difference RD method [9]. This approach is explicit, truly compact and is computationally comparable to the classic RD schemes such as SUPG or Lax–Wendroff for steady-state advection problems. However, we shall demonstrate the superiority of the new method when solving linear and nonlinear advection–diffusion problems compared to the classic RD methods. Unlike in [9], this new Flux-Difference RD method will be presented in a finite element representation and there will be a discussion on error estimates of the method over arbitrary triangular grids. A brief discussion on extending the Flux-Difference method to high order accuracy will also be included.

The paper is organized as the following. Section 2 presents the classic scalar RD discretization for advection and diffusion terms while Sect. 3 presents the Flux-Difference RD method for advection–diffusion. The numerical results will be demonstrated in Sect. 4 while Sect. 5 concludes this research paper. In the “Appendix”, a general mathematical analysis demonstrates that the new RD method is linearity preserving (LP) on arbitrary grids for the advection–diffusion equation.

Fig. 1
figure 1

A general triangle, T (inward normals not drawn to scale)

2 Residual Distribution Approach for Advection–Diffusion

RD schemes are numerical methods that involves two steps. The first is the residual calculation, followed by the distribution of the residuals to nodes where the residual drives the changes of the solution. Consider, as an example, the two dimensional scalar advection–diffusion equation.

$$\begin{aligned} u_t+\mathbf {\nabla }\cdot \mathbf {F}=\mathbf {\nabla }\cdot \mathbf {G} , \end{aligned}$$
(1)

where,

$$\begin{aligned} \mathbf {F}= u \mathbf {\lambda } = (au)\hat{i}+(bu)\hat{j} \end{aligned}$$

and

$$\begin{aligned} \mathbf {G}=(\nu u_x)\hat{i}+(\nu u_y)\hat{j}. \end{aligned}$$

Also, \(\mathbf {\lambda } = a\hat{i}+b\hat{j}\) is the characteristic vector where a and b are the advection speeds in x and y direction respectively and \(\nu \) is the positive diffusion coefficient. We then proceed by dividing the computational domain into a set of triangles \(\left\{ T \right\} \), and store the solution values at nodes which belong to the set of nodes \(\left\{ J \right\} \). It is also assumed that the 2D spatial domain is triangulated with the type of triangle given in Fig. 1 with inward scaled normals.

It is desired that we discretize the inviscid terms and viscous terms separately to mimic the physics of the problem. This will enable a multidimensional upwind solution update from inviscid residual and an isotropic distribution of viscous residual to update the solution nodes.

Fig. 2
figure 2

Two different types of triangular cells. a Type I, b Type II

2.1 Advection Discretization

Thus, we define the inviscid residual \(\phi _{inv}^{T}\) using Gauss’s theorem for a triangular element T in Fig. 2 as,

$$\begin{aligned} \phi _\text {inv}^{T} = -\iint u_t dA = -\iint \mathbf {\nabla }\cdot \mathbf {F} dA = \oint \mathbf {F}\cdot \hat{n} dl. \end{aligned}$$
(2)

In a discrete form, we assume a continuous piecewise linear variation of solution and using the trapezoidal rule for quadrature, \(\phi _{inv}^T\) can be expressed as,

$$\begin{aligned} \phi _\text {inv}^{T} \approx \frac{1}{2}\sum _{j=1}^{3} \mathbf {F}_j\cdot \mathbf {n}_j = \sum _{j=1}^{3} k_ju_j \end{aligned}$$
(3)

where \(u_j\) is the solution at node j and \(k_j\) is the upwind parameter defined as,

$$\begin{aligned} k_j = \frac{1}{2}\mathbf {\lambda } \cdot \mathbf {n}_j. \end{aligned}$$
(4)

Note that,

$$\begin{aligned} \sum _{j = 1}^{3}k_j = 0 \end{aligned}$$
(5)

The sign of \(k_j\) indicates the flow direction. For example, if \(k_j> 0\) then the edge opposite node j is an inflow edge and \(k_j < 0\) indicates outflow. The definition of \(k_j\) leads to two distinct types of triangles called single-target and two-target triangles. The single-target or Type I triangle is defined as one of the inflow parameter positive and the other two are negative. While the two-target or Type II triangle is when two edges have positive inflow parameters and the other is negative as shown in Fig. 2.

After evaluating the advection residual using the vertex values, the first step is complete. The next step is to distribute fractions of the residual or signals to the vertices of the triangle. For consistency, the scalar distribution coefficients \(\beta _i^T\) sums up to unity. Assembling the contributions from all the triangles surrounding node i, the conservative update can be written as follows.

$$\begin{aligned} S_{i}\dfrac{du_{i}}{dt} = \sum _{T, i\in T} \phi _{i, \text {inv}}^{T} = \sum _{T, i\in T} \beta _i^T \phi _\text {inv}^T \end{aligned}$$
(6)

Refer to the work of [1, 6, 7, 17, 19, 21] for further details on constructing different RD schemes based on the design of the scalar distribution coefficients (Fig. 3).

Fig. 3
figure 3

Median-dual area, \(S_i\) of node i

2.2 Viscous Discretization

The viscous residual, \(\phi _{vis}\) for a triangular element T is defined as,

$$\begin{aligned} \phi _\text {vis}^{T} = \iint \mathbf {\nabla }\cdot \mathbf {G}\,dx\,dy = \oint \nu \mathbf {\nabla }u\cdot d\mathbf {n} \end{aligned}$$
(7)

For linear variation of solution, the gradient \(\mathbf {\nabla } u\) is constant. Hence, \(\phi _\text {vis} = 0\) for a triangular element. To overcome this issue, the gradients at the nodes need to be calculated to determine the viscous residual of a triangular element. However, this will increase the stencil size.

Another approach is to consider the Finite Element(FE) Galerkin approach which is compact. This approach is a nodal approach and it solves the weak form of Eq. 7 which is,

$$\begin{aligned} \phi _{i, \text {vis}}^{T} = \iint t_i \cdot ({\nabla }\cdot \mathbf {G}) \,dx\,dy \end{aligned}$$
(8)

where \(t_i\) is the Galerkin test function. Integrating Eq. 8 by parts, we recover the following.

$$\begin{aligned} \phi _{i, \text {vis}}^{T} = \oint t_i \nu \mathbf {\nabla } u\cdot d\mathbf {n} - \iint \nu \mathbf {\nabla } u \cdot \mathbf {\nabla } t_i \,dx\,dy \end{aligned}$$
(9)

The contour integral in Eq. 9 vanishes for Dirichlet and Neumann boundary conditions. For linear variation of the solution with u in a triangular element,

$$\begin{aligned} \mathbf {\nabla } u = \frac{1}{2A_T}\sum _{j=1}^{3} u_j\mathbf {n}_j \end{aligned}$$
(10)

and using a linear basis function for the test function, \(t_i\), the following relation also holds.

$$\begin{aligned} \mathbf {\nabla } t_i = \frac{\mathbf {n}_i}{2A_T} \end{aligned}$$
(11)

\(A_T\) is area of the triangular element, T. Thus, the integration for a cell averaged \(\nu \) and the viscous residual contribution to node i is,

$$\begin{aligned} \phi _{i, \text {vis}}^{T} = -\frac{\nu }{4A_T}\sum _{j=1}^{3} u_j\mathbf {n}_j \cdot \mathbf {n}_i \end{aligned}$$
(12)

By treating the advection and diffusion residual separately, the conserved, semi-discrete form of the governing equation for node i is of the form below.

$$\begin{aligned} S_{i}\dfrac{du_{i}}{dt} - \sum _{T, i\in T} \left( \phi _{i, \text {inv}}^{T} + \phi _{i, \text {vis}}^{T}\right) = 0 \end{aligned}$$
(13)

\(S_i\) is the median-dual cell area surrounding node i.

2.3 Connection Between Classic Residual Distribution and Petrov–Galerkin Finite Element Methods

To find the equivalence between Petrov–Galerkin schemes and Residual Distribution (RD) schemes, begin with 2D linear advection as an example which is,

$$\begin{aligned} \frac{\partial u}{\partial t} + \mathbf {\lambda }\cdot \mathbf {\nabla }u =0. \end{aligned}$$
(14)

The Petrov–Galerkin discretization of the spatial component of the linear advection equation can be expressed as,

$$\begin{aligned} \sum _{T}\iint t_i^T (\mathbf {\lambda }\cdot \mathbf {\nabla }u^h) dA = 0 \end{aligned}$$
(15)

where T is the triangular element, \(u^h\) is the discretized solution and \(t_i\) is the test function associated with node i. For linear triangular elements, the solution varies linearly thus the quantity \(\mathbf {\lambda }\cdot \mathbf {\nabla }u\) is constant over a triangular element for constant characteristic. With the residual over an element is \(\phi ^T\), Eq. 15 can be written as:

$$\begin{aligned} \sum _{T}\frac{\phi ^T}{A_T}\iint t_i^T dA = 0 \end{aligned}$$
(16)

where \(A_T\) is the area of the triangular element T. Now, recall the signal distribution to node i from triangular element T is,

$$\begin{aligned} \phi _i^T = \beta _i\phi ^T \end{aligned}$$
(17)

Comparing Eqs. 16 and 17, for a triangular element T, we have the following relation:

$$\begin{aligned} \beta _i = \frac{1}{A_T}\iint t_i^T dA \end{aligned}$$
(18)

with the constraint of \(\sum _{T} t_i^T = 1\), that is the summation of the test function around node i from all the triangular elements surrounding node i should be unity. However, this condition is not sufficient to uniquely determine a test function based on distribution coefficients of different RD schemes [5]. However, certain RD schemes have a Petrov–Galerkin interpretation if the test function is a function of a single parameter [5]. For example, similar to SUPG test function where the test function is the sum of the basis function and a constant term that is,

$$\begin{aligned} t_i = N_i + \alpha _i^T\gamma ^T \end{aligned}$$
(19)

where \(N_i\) is the nodal basis function at node i, \(\alpha _i^T\) is the upwind bias coefficient and \(\gamma ^T = 1\) for triangle T and zero for other triangular elements. Thus, from Eq. 18, we obtain the following relation for a tringular element T (\(\gamma ^T = 1\)),

$$\begin{aligned} \beta _i = \frac{1}{A_T}\iint N_i + \alpha _i^T\gamma ^T dA = \frac{1}{3} + \alpha _i^T. \end{aligned}$$
(20)

Thus, the relation between test function based on Eqs. 19 and 20 is

$$\begin{aligned} t_i = N_i + \beta _i - \frac{1}{3}. \end{aligned}$$
(21)

For a purely central scheme (\(\beta _i=\frac{1}{3}\)), we recover the Galerkin approach. From [21], the distribution coefficient for Lax–Wendroff scheme is,

$$\begin{aligned} \beta _i^\mathrm{Lax-Wendroff} = \frac{1}{3} + \frac{{\varDelta }t k_i}{2A_T}, \end{aligned}$$
(22)

Thus, from Eq. 21 the weighting function is,

$$\begin{aligned} t_i^\mathrm{Lax-Wendroff} = N_i + \frac{{\varDelta }t k_i}{2A_T}. \end{aligned}$$
(23)

While the well known SUPG weighting function is,

$$\begin{aligned} t_i^\text {SUPG} = N_i + \frac{hk_i}{2|\mathbf {\lambda }|A_T}. \end{aligned}$$
(24)

where \(k_i\) is the upwind parameter and \(|\mathbf {\lambda }|\) is the magnitude of the characteristic velocity. Comparing Eqs. 23 and 24, the weighting function for Lax–Wendroff is a SUPG type weighting function where an upwind bias is added to the basis function to form the weighting function.

For classic RD scheme such as LDA, the distribution coefficient, \(\beta _i^\text {LDA}\) is

$$\begin{aligned} \beta _i^\text {LDA} = \frac{k_i^+}{\sum _p k_p^+} \end{aligned}$$
(25)

where \(k_i^+ = \text {max}(0,k_i)\), the test function is

$$\begin{aligned} t_i^\text {LDA} = N_i + \frac{k_i^+}{\sum _p k_p^+} - \frac{1}{3}. \end{aligned}$$
(26)

However, not all residual distribution methods have a test function [5, 21]. For example, the signal for N-scheme can be written as:

$$\begin{aligned} \beta _i^\text {N-scheme} = -\frac{1}{\phi ^T_i}\frac{k_i^+}{\sum _{j}k_j^+}\sum _{j}k_j^-(u_i-u_j). \end{aligned}$$
(27)

When the cell residual (\(\phi ^T_i\)) vanishes at steady state, the distribution coefficient as well as the test function for N-scheme is unbounded. Thus, the N-scheme does not have a Petrov–Galerkin interpretation.

Fig. 4
figure 4

Isotropic and artificial signal distribution(\(\beta =0\)) to node i. a Isotropic signals, b artificial signals

3 Alternative Residual Distribution Approach for Advection–Diffusion : Flux-Difference

Following the work in [9], a new family of RD signal distribution scheme which is based on a Flux-Difference approach is presented. The new approach evaluates the residual for a triangular element based on nodal flux values. The signal distribution can be divided into two components. The first component is an isotropic distribution in which the total element residual is distributed to each node within the element. However, the isotropic signal distribution is unstable for pure transport with discontinuous flows. The second component of the signals distribution is the artificial distribution which ensures stability, and for a specific values of \((\alpha ,\gamma )\) the artificial part will generate entropy with the correct sign (entropy-stability).

The new RD signal distribution scheme for node i of a triangular element T can be written as the following,

$$\begin{aligned} \phi _i = \phi _i^{\text {iso}} + \phi _i^{\text {art}}. \end{aligned}$$
(28)

The isotropic signals \(\phi _i^{\text {iso}}\) as seen in Fig. 4 is obtained via the trapezoidal integration of the total residual within an element distributed equally to each node. Each node would have signals of the form,

$$\begin{aligned} \phi _i^{\text {iso}} = \frac{1}{2}((f_i,g_i) - (f^*,g^*))\cdot \mathbf {n}_i \end{aligned}$$
(29)

where \(\mathbf {f^*} = (f^*,g^*)\) denotes an arbitrary flux within element T and cancels out during the overall cell (or element) integration. However, \(\mathbf {f^*}\) would affect the nodal values. For simplicity, we shall assume \(\mathbf {f^*}\) is the arithmetic average of flux of the three vertices although we could derive other conditions such imposing entropy-conservation as done in [9]. \(\phi _i^{\text {art}}\) is the artificial component as seen in Fig. 4 which is

$$\begin{aligned} \phi _i^{\text {art}} = -\alpha (u_j - u_i) - \beta (u_k - u_j) - \gamma (u_i - u_k). \end{aligned}$$
(30)

\((\alpha ,\beta ,\gamma )\) are the element parameters that represent this family of RD method. In other words, nodes (ijk) would have the same \((\alpha ,\beta ,\gamma )\) for each element. For completeness, the following would represent the signals distributed to nodes j and k respectively.

$$\begin{aligned} \phi _j&=\frac{1}{2}({f}_j-{f}^*,{g}_j-{g}^*)\cdot \mathbf {n}_j \underbrace{-{\alpha }(u_k-u_j)-{\beta }(u_i-u_k)-{\gamma }(u_j-u_i)}_{\phi ^\text {art}_j} \end{aligned}$$
(31)
$$\begin{aligned} \phi _k&=\frac{1}{2}({f}_k-{f}^*,{g}_k-{g}^*)\cdot \mathbf {n}_k \underbrace{-{\alpha }(u_i-u_k)-{\beta }(u_j-u_i)-{\gamma }(u_k-u_j)}_{\phi ^\text {art}_k} \end{aligned}$$
(32)

Note that the summation of all the artificial signals would cancel out within each local element. The only remaining terms are the summation of the isotropic signals which recovers the total element residual for any values of \(\mathbf {f}^*\), hence conservation is obtained by default. Both isotropic and artificial signals however, would affect each node respectively. This can be clearly observed from a median-dual cell area perspective.

There is a much to be explored from these \((\alpha ,\beta ,\gamma )\) parameters, either in terms imposing a multi-dimensional upwinding or insisting other discrete physical constraint such as entropy-stability[9]. However, we shall only use the most simple combination of the parameters to demonstrate its effectiveness in solving advection–diffusion problem. From [9], \(\beta \) is a free parameter and is set to zero for simplicity. With these choices, note that the Flux-Difference RD approach is central-type method with artificial terms to stabilize it. In the “Appendix”, a mathematical proof will demonstrated that this new method is linearity preserving for the steady-state advection–diffusion equation and thus preserves second-order accuracy in a compact non-unified approach. The newly proposed Flux-Difference RD approach has subtle differences from classic RD methods that is revealed via a Truncation Error (TE) analysis on structured grids. The TE analysis from [14] revealed a drop of order-of-accuracy for classic RD methods in advection–diffusion. A similar TE analysis in [9] however, revealed that the Flux-Difference RD approach is second-order accurate along both streamline and normal coordinates unlike classic RD methods which are second order in the normal direction but first order along the streamline. In steady-state conditions, there are no flow variations along the streamline direction hence the error behavior of the classic RD methods are sufficient to maintain second order accuracy in steady advection cases. For unsteady advection (or advection–diffusion) a scheme needs to be second order in both normal and streamline directions to prevent a drop in order-of-accuracy[8].

Observe that (\(\alpha , \gamma \)) are coefficients which are dependent on a length-scale factor of which can be used to achieve high-order accuracy as shown in [8, 9]. Choosing \(\alpha =\gamma \) will yield second order accuracy as shown in Eq. (48) in [8], which will be defined as the ’Flux-Difference 1’ method. Using \((\alpha , \gamma )=O(h^q)\) with \(q=1\) will yield another second order method defined as ’Flux-Difference 2’ approach as shown in Eq. (47) in [9]. We will demonstrate that these alternative signal distribution approaches can preserve second-order accuracy on the scalar advection–diffusion problems. There is also the limited version of this Flux-Difference signals approach to overcome Godunov’s theorem but will not be included herein. Interested readers can find the limited version in [9].

3.1 Connection between Flux-Difference Residual Distribution with Petrov–Galerkin

Similar to the work in [3], to find the connection of the new Flux-Difference approach to a Petrov–Galerkin interpretation, the signal of Flux-Difference approach can be rewritten as,

$$\begin{aligned} \phi _i^\text {Flux-Diff} = \beta _i^\text {Flux-Diff}\phi ^T_i \end{aligned}$$
(33)

where

$$\begin{aligned} \beta _i^\text {Flux-Diff}=\frac{\frac{1}{2} (\mathbf {f}_i-\mathbf {f}^*)\cdot \mathbf {n}_i}{\phi ^T_i} = \frac{(2 u_i - u_j - u_k)k_i }{\phi ^T_i}. \end{aligned}$$
(34)

As seen in N-scheme where the total residual \(\phi ^T_i\) appears in the denominator, the same is observed for the new Flux-Difference approach as seen in Eq. 34. Thus, when the cell residual (\(\phi ^T_i\)) vanishes at steady state, the distribution coefficient as well as the weighting function is unbounded [5, 21].

Fig. 5
figure 5

Types of grids used in the study. a RR, b isotropic, c equilateral, d randomized

Fig. 6
figure 6

Distribution of skewness for the randomized grids

Fig. 7
figure 7

Exact solution linear advection–diffusion

Fig. 8
figure 8

Variation of order of accuracy (OoA) with accuracy parameter, q on RR grid

Despite the current Flux-Difference approach (entropy stable) does not have a Petrov–Galerkin interpretation, the general Flux-Difference framework in Eq. 31 can recover classic RD methods [9] by having the artificial terms (\(\alpha ,\beta ,\gamma \)) to have specific form. For example, to recover the Lax–Wendroff scheme, the following form is required for the artificial terms,

$$\begin{aligned} \gamma= & {} -\alpha \end{aligned}$$
(35)
$$\begin{aligned} \alpha= & {} \frac{\frac{{\varDelta }t}{2A}\left( \phi _i^T\right) ^2+\frac{1}{3}\left( 2\sum k_iu_i^2-3u_a\phi _T+\sum k_iu_ju_k\right) }{\left( u_i-u_j\right) ^2+\left( u_j-u_k\right) ^2+\left( u_k-u_i\right) ^2} \end{aligned}$$
(36)
$$\begin{aligned} \beta= & {} \frac{\frac{{\varDelta }t}{2A}\phi _i^T\left( \sum k_i\left( u_j-u_k\right) \right) -\frac{1}{3}\left( 2\sum k_iu_i\left( u_j-u_k\right) -\sum k_i\left( u_j^2-u_k^2\right) \right) }{\left( u_i-u_j\right) ^2+\left( u_j-u_k\right) ^2+\left( u_k-u_i\right) ^2} \end{aligned}$$
(37)
Fig. 9
figure 9

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D linear advection–diffusion case on RR grid

Fig. 10
figure 10

Convergence comparison between classic approach and the Flux-Difference approach for RR grid on linear advection–diffusion

Fig. 11
figure 11

Variation of order of accuracy (OoA) with accuracy parameter q on isotropic grid

To recover LDA, for one-target cell, the artificial terms are [9]

$$\begin{aligned} \begin{aligned} \alpha ^\text {OneTarget}&= \frac{\phi _i^T(4u_i+u_j+u_k)-3\left( k_iu_i^2+k_ju_j^2+k_ku_k^2\right) }{3\left( [u]_{ij}^2+[u]_{jk}^2+[u]_{ki}^2\right) }\\ \beta ^\text {OneTarget}&= \left( \frac{k_j-k_k}{6}\right) \left( \frac{6[u]_{jk}^2}{[u]_{ij}^2+[u]_{jk}^2+[u]_{ki}^2}-1\right) \end{aligned} \end{aligned}$$
(38)

while for two-target, the terms are [9]

$$\begin{aligned} \alpha ^\text {LDA}&= -\frac{k_j+k_k}{6}+\frac{3\left( \phi _i^T\right) ^2+2(k_j+k_k)[k]_{jk}[u]_{jk}\left( [u]_{ij}+[u]_{ik}\right) }{6(k_j+k_k)\left( [u]_{ij}^2+[u]_{jk}^2+[u]_{ki}^2\right) } \nonumber \\ \beta ^\text {LDA}&= -\frac{k_j-k_k}{6}+\frac{\phi _i^T\left( k_i[u]_{jk}+k_j[u]_{ki}+k_k[u]_{ij}\right) }{(k_j+k_k)\left( [u]_{ij}^2+[u]_{jk}^2+[u]_{ki}^2\right) } \nonumber \\&\quad +\frac{\left( k_j+k_k\right) [k]_{jk}[u]_{jk}^2}{(k_j+k_k)\left( [u]_{ij}^2+[u]_{jk}^2+[u]_{ki}^2\right) } \end{aligned}$$
(39)

Thus, in general the new Flux-Difference approach does not have a unique finite element interpretation. However, with certain choices for \(\mathbf {f}^*\) and (\(\alpha ,\beta ,\gamma \)), classic RD methods such as LDA, Lax–Wendroff and SUPG can be recovered with has a finite element interpretation.

Fig. 12
figure 12

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D linear advection–diffusion case on isotropic grid

4 Results and Discussion

In this section, numerical simulations were performed to determine the accuracy of the Flux-Difference Approach to solve the advection–diffusion problems (linear and non-linear) using a non-unified approach. The new approach is compared with a benchmark case using classic approach where for advection component of the residual is evaluated with a standard Low-Dissipation-A (LDA) scheme. For all the numerical schemes, the viscous component of the residual is evaluated using the standard Finite Element Galerkin approach. For all of the numerical test cases, the boundary condition was set to the exact solution and since we are only interested in steady state solutions, an Explicit Forward Euler first-order time integration was employed with a \(\text {CFL} = 0.8\). Note that the test cases were mostly selected to have both the advection and diffusion physics to be equally important since this would present the most challenging aspect when dealing with advection–diffusion problems.

Fig. 13
figure 13

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D linear advection–diffusion case on equilateral grids

In addition, all of the numerical test cases were performed on four different types of triangular grids which are,

  • Right-running (RR)

  • Isotropic

  • Equilateral/anisotropic

  • Randomized

The grid topology is shown in Fig. 5. In addition, in Fig. 6 shows the quality of the randomized grids used in this study.

4.1 Linear Advection–Diffusion

For steady two-dimensional linear advection–diffusion, the exact solution is of the form:

$$\begin{aligned} u = -\text {cos}(\pi \eta )\text {exp}\left( 0.5\xi \left( 1 - \sqrt{1 + 4 \pi ^2\nu ^2}\right) /\nu \right) \end{aligned}$$
(40)

where \(\xi = ax + by\), \(\eta = bx - ay\), \(\nu = 0.1\) and \((a,b) = (7,4)\) in a square domain of \([0,1] \times [0,1]\) as used in [15] (Fig. 7).

4.1.1 Right-Running Grid

For the Flux-Difference 2 approach, an initial numerical test was performed to determine the order of accuracy (OoA) on coarse grids using 1681, 3721 and 6561 elements while varying the accuracy parameter q [9]. From Fig. 8, the order of accuracy increases up to value of \(\approx 2.1\) and decreases to a steady value of \(\approx 1.8\). For \(q=1\), analytically, the order of accuracy is expected to be second-order while an initial numerical test on relatively coarse grids, the order of accuracy is approximately 1.8. It is expected that as finer grids are used, the order of accuracy will be closer to second-order. Thus for the numerical test on finer grids for RR grid, a value of \(q=1\) for the accuracy parameter will be employed for the order of accuracy test.

Fig. 14
figure 14

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D linear advection–diffusion case on randomized grids

For a more detailed numerical order of accuracy test, 10,201, 40,401 and 90,601 elements were used. As seen in Fig. 9, three numerical schemes were investigated which are the classic approach (LDA) and Flux-Difference Approach (1 and 2) presented just before Sect. 3.1. As previously shown in [14], the classic approach is only first-order accurate using the non-unified approach. While the Flux-Difference approach 1 and 2 is close to second-order (1.92 and 1.89 respectively) accurate.

Comparing the convergence between the three numerical schemes, Fig. 10 shows that the schemes are comparable in the convergence. Thus, the added accuracy is obtained for Flux-Difference Approach (1 and 2) without an increase in computation.

Fig. 15
figure 15

Convergence plot for Flux-Difference 1 on various grid types on linear advection–diffusion

Fig. 16
figure 16

Convergence plot for Flux-Difference 2 on various grid types on linear advection–diffusion

Fig. 17
figure 17

Exact solution viscous Burgers’

4.1.2 Isotropic Grids

Similar for RR grid, an initial numerical test for Flux-Difference Approach 2 was performed to determine the order of accuracy on coarse grids using 1681, 3721 and 6561 elements while varying the accuracy parameter q for the Flux-Difference 2 method. From Fig. 11, similar behavior is observed in the RR grid where the order of accuracy increases up to second-order at \(q\approx 1.5\) and decreases to a steady value of approximately 1.8. For \(q=1\), analytically, the order of accuracy is expected to be second-order while an initial numerical test on relatively coarse grids, the order of accuracy is approximately 1.7. It is expected that as finer grids are used, it will be second-order accurate. Again, for the numerical test on finer grids for isotropic grids, a value of \(q=1\) will be employed for the order of accuracy test.

For a more detailed numerical order of accuracy test, 10,201, 40,401 and 90,601 elements were used in the numerical experiment. As seen in Fig. 12, the classic approach is first-order while the Flux-Difference Approach 2 is also close to second-order (1.89). For the coarsest grid for this test, magnitude of error for Flux-Difference Approach 2 is slightly higher than the classic approach. On the other hand, the Flux Difference Approach 1 preserves second-order accuracy with a smaller error magnitude compared to Flux Difference 2.

4.1.3 Equilateral Grids

A numerical order of accuracy test with 8989, 35,175 and 78,862 elements were used. As seen in Fig. 13, the classic approach is first-order while the Flux-Difference approach 2 is also close to second-order (1.94). Thus, the general numerical analysis from RR and isotropic grids also applies for equilateral grids as well using an accuracy parameter of \(q=1\). For the coarsest grid for this test, magnitude of error for Flux-Difference Approach 2 is slightly higher than the classic approach. Nevertheless, the Flux-Difference Approach 1 results has the lowest magnitude of errors and preserves second-order accuracy.

Fig. 18
figure 18

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D viscous Burgers’ case on equilateral grids

Fig. 19
figure 19

Slice at \(y=0\) for Viscous Burgers’ problem on equilateral grids using 8989 elements. a Comparison of different approaches, b region enclosed in the circle

Fig. 20
figure 20

Convergence comparison between classic approach, Flux-Difference 1 and Flux-Difference 2 approaches on equilateral grids for viscous Burgers’

4.1.4 Randomized Grids

A numerical order of accuracy test with 8989, 35,175 and 78,862 elements were used . From Fig. 14, the classic approach is first-order accurate while the Flux-Difference Approach 1 and 2 is close to second-order (1.99 and 1.96 respectively). More importantly, Flux Difference Approach 1 has the lowest magnitude of errors. In general, the numerical analysis from RR and isotropic grids also applies for randomized grids using an accuracy parameter of \(q=1\) for the Flux-Difference Approach 2. The convergence history on various grid types are shown in Figs. 15,16.

4.2 Non-linear Advection–Diffusion (Viscous Burgers’)

For Viscous Burgers, the following equation will be solved:

$$\begin{aligned} u_t + u u_x + u_y = \nu u_{xx} \end{aligned}$$
(41)

The exact solution used is a shock problem and is of the form:

$$\begin{aligned} u = -4\tanh \left( \frac{y+2x}{\nu }\right) \end{aligned}$$
(42)

where \(\nu = 0.05\) in a square domain of \([-\,0.5,0.5] \times [-\,0.5,0.5]\) as seen in [10] (Fig. 17). This problem can be categorized as a discontinuous flow when the flow approaches the pure advection limit (i.e \(\nu \rightarrow 0\)). With the choice of \(\nu = 0.05\), the magnitude of viscosity ensures that the advection and diffusion components are equally important . As a result, the problem now can be considered relatively smooth and very much like a reverse-expansion case for which the order-of-accuracy study is appropriate.

Note that, a numerical test was performed for different values of \(\nu \). It was observed that second-order accuracy was preserved using general Flux-Difference approach for a range of \(0.01 \le \nu \le 5.0\). However, the results are omitted here for brevity. In addition, it was observed for \(\nu < 10^{-3}\), the numerical results contain oscillations due to the advection part becomes more dominant hence the flow is approaching a discontinuous regime thus order-of-accuracy study is not valid.

From the numerical tests of linear advection–diffusion, the accuracy parameter, \(q = 1\) was used for the Flux-Difference 2 approach for the nonlinear advection–diffusion.

For the sake of conciseness, we shall only work with the equilateral and randomized grids for the viscous Burgers’ equation.

4.2.1 Equilateral Grids

For the order of accuracy numerical test, the number of elements used were 8989, 35,175 and 78,862 respectively. As seen in Fig. 18, the classic approach is first-order while the Flux-Difference Approach 1 and 2 are second-order accurate (1.99 and 2.01 respectively). The cross sectional results are also demonstrated on Fig. 19 for the equilateral grids, which clearly show that the classic approach is less accurate compared to the Flux-Difference methods. The convergence history is shown in Fig. 20.

Fig. 21
figure 21

Numerical \(L_2\) error verses the grid distance in logarithmic scale for 2D viscous Burgers’ case on randomized grids

4.2.2 Randomized Grids

For the order of accuracy numerical test, the number of elements used are 8989, 35,175 and 78,862 respectively. As seen in Fig. 21, the classic approach is first-order accurate while the Flux-Difference Approach 1 and 2 are close to second-order accurate (1.71 and 1.92 respectively). The cross-sectional results on the randomized grids have a similar trend with the equilateral grids hence omitted for brevity. The convergence history on various grids are shown in Figs. 22, 23.

Fig. 22
figure 22

Convergence plot for Flux-Difference 1 on various grid types for viscous Burgers’

Fig. 23
figure 23

Convergence plot for Flux-Difference 2 on various grid types for viscous Burgers’

5 Conclusion

The proposed Flux-Difference RD method combined with the continuous Galerkin approach proved to preserve second-order accuracy on scalar advection–diffusion problems on regular and irregular grids without having to include additional equations. The Flux-Difference approach uses all the neighboring elements within the first layer of a particular node, which enables the cancellation of the low-order error terms during the median-dual area integration process [9]. A general error analysis demonstrated that the Flux-Difference RD method is LP on arbitrary triangular grids for the linear advection–diffusion equation and the numerical results confirmed this even on nonlinear advection–diffusion test cases. The Flux-Difference RD method was also demonstrated to be second-order accurate for unsteady advection problems in [9] using an explicit time integration method without any special treatment. It must be emphasized that the Flux-Difference RD approach presented in this paper is at a preliminary stage and perhaps more can be done to improve its accuracy. A more accurate approach can be constructed which may include a multi-dimensional upwind mechanism. The Flux-Difference RD approach can also be extended to systems of equations without the loss of generality and the work is currently underway. Since the Flux-Difference RD method is general enough, we can extend the approach to high order methods based on the subtriangle approach [2, 20] to maintain compactness and the work is currently in progress.