1 Introduction

The shallow water or Saint Venant equations were derived as a simplified version of Navier–Stokes equations to describe fluid flows in an open channel. These equations have been employed to represent river flows, inundation or any other flows where the height of the fluid is considerably smaller than the longitudinal length scale of the fluid flow. Aside from the conventional and well-developed discretization schemes of finite difference (FD), finite volume (FV) and finite element (FE) methods, the residual distribution (RD) or fluctuation splitting method has also received considerable attention by researchers in shallow water equations (SWE) over the last three decades due to its special features such as multidimensional upwinding [17], compact stencil and insensitivity against grid irregularities [7]. Since there are very limited applications of SWE in steady cases, most numerical schemes of SWE were developed with time-dependent features even in their early stages. This could present a challenge because most RD methods cannot preserve second-order accuracy for unsteady calculations without employing special treatments to the time discretization such as using mass matrix or implicit techniques [1]. These techniques are computationally expensive relative to explicit methods. It is known that SWE has a mathematical entropy which coincides with the total energy of the fluid flow [32, 33], and to the authors’ best knowledge, there is yet any RD scheme which is designed to discretely control entropy (or total energy) for the discretized SWE.

Most entropy-stable schemes were developed for the finite volume or finite difference methods beginning with the work of Tadmor [34], followed by a huge list of authors [5, 6, 14, 16, 18, 25] and so forth. Recently, however, Ismail and Chizari [24] and later Abgrall [2] attempted the construction of different entropy conservative and dissipative/stable RD schemes with positive results on linear and nonlinear scalar equations. The properties of numerical entropy control as adopted by some studies [15, 24] have not been analysed in SWE using RD schemes.

In this paper, an explicit time discretization entropy-stable RD scheme will be developed for the homogeneous shallow water equations based on the work of [24]. The work will focus on first- and second-order accurate solutions and on the interior computational domain. A comparison of results between the entropy-stable RD method and its finite volume counterpart together with other RD methods will also be presented.

Section 1 reviews the concepts of numerical entropy control, which includes entropy conservation and entropy stability. We present the entropy function of the two-dimensional homogeneous shallow water equations in Sect. 2. The method development of an entropy-stable RD method is presented in Sect. 3, in which the implementation of entropy conservation, entropy stability, positivity and second-order approaches is thoroughly discussed. Section 4 demonstrates our results with in-depth discussions. The conclusion and future directions of this research are highlighted in Sect. 5.

1.1 Entropy Conservation and Entropy Stability

Following [25], for any hyperbolic system of conservation laws satisfying

$$\begin{aligned} {\varvec{u}}_t + \overrightarrow{\nabla }\cdot \overrightarrow{{\varvec{f}}} = 0, \end{aligned}$$
(1)

or in integral form

$$\begin{aligned} \oint ({\varvec{u}}\mathrm{d}A-\overrightarrow{{\varvec{f}}}\cdot \overrightarrow{{\varvec{N}}}\mathrm{d}t)=0, \end{aligned}$$
(2)

there is an additional entropy U constraint satisfying

$$\begin{aligned} U_t + \overrightarrow{\nabla }\cdot \overrightarrow{F} \le 0, \end{aligned}$$
(3)

where U is the mathematical entropy and is a convex function with the integral form

$$\begin{aligned} \oint ({U}\mathrm{d}A-\overrightarrow{F}\cdot \overrightarrow{N}\mathrm{d}t)\le 0. \end{aligned}$$
(4)

The inequality is to cater for a discontinuous flow where entropy is produced. Note that the entropy is conserved for smooth flows thus equality is achieved. The entropy production in a domain \(\varOmega \) with boundary \(\partial \varOmega \) can be written as

$$\begin{aligned} {\dot{U}} = \iint _{\varOmega }(U_t+\overrightarrow{\nabla }\cdot \overrightarrow{F})dAdt = \oint _{\partial \varOmega }(UdA-\overrightarrow{F}\cdot \overrightarrow{N}\mathrm{d}t), \end{aligned}$$
(5)

for which equality of the previous equation implies entropy conservation and that a negative outcome of the equation denotes that entropy is decreasing (or entropy-stable).

In a discrete form of the governing equations, the conservation laws of Eq. (2) must be satisfied and that zero entropy production must be observed for smooth flows. A discrete approach satisfying this proposition is deemed as an entropy-conserved method. On the other hand, a discrete method solving Eq. (2) is defined as entropy-stable if it always produces a decreasing entropy production. Entropy stability, however, only guarantees that the discrete approach produces the correct sign of entropy production but not necessarily the correct amount unless the flow is entropy conservative. Too much of entropy generation would cause a smearing of the discontinuous profile, while too little entropy production would give rise to oscillatory behaviour around the discontinuity. To the authors’ best knowledge, there is yet a solid analytical relation between entropy production and shock quality although some form of approximation model has been done for the inviscid approach in [25]. Thus, we will focus mainly in achieving entropy stability in this paper.

2 2D Inviscid Shallow Water Equations

Recall that the following represents the 2D SWE.

$$\begin{aligned} \frac{\partial {\varvec{u}}}{\partial t} + \frac{\partial {\varvec{f}}}{\partial x} + \frac{\partial {\varvec{g}}}{\partial y}=0, \end{aligned}$$
(6)

where

$$\begin{aligned} {\varvec{u}}=(h,hu,hv)^T , {\varvec{f}}=(hu, hu^2+gh^2/2, huv)^T , {\varvec{g}}=(hv, huv, hv^2+gh^2/2)^T \end{aligned}$$

2.1 Entropy Function and Variables for the 2D Shallow Water Equations

Define a convex entropy function (sometimes also referred to as the “total energy”) \(U=\frac{hu^2+hv^2+gh^2}{2}\) satisfying the following inequality

$$\begin{aligned} \frac{\partial U}{\partial t} + \frac{\partial F}{\partial x} + \frac{\partial G}{\partial y}\le {0}, \end{aligned}$$
(7)

and that satisfies the entropy theorem [21]

$$\begin{aligned} \frac{\partial U}{\partial {\varvec{u}}}\frac{\partial ({\varvec{f}}, {\varvec{g}})}{\partial {\varvec{u}}}&= \frac{\partial (F,G)}{\partial {\varvec{u}}}, \end{aligned}$$
(8)

where \(({\varvec{f}}, {\varvec{g}})\) and (FG) represent vector notations instead of inner products and the fluxes are given by

$$\begin{aligned} F=(hu^3/2+gh^2u+huv^2/2), G=(hv^3/2+gh^2v+hu^2v/2). \end{aligned}$$

The entropy variables are given by

$$\begin{aligned} {\varvec{v}}&=(-(u^2+v^2)/2+gh,u,v)^T, \end{aligned}$$
(9)

and it can be shown via direct computation that

$$\begin{aligned} \begin{array}{l} \displaystyle {\varvec{v}}\cdot {\varvec{f}}= F +\frac{gh^2u}{2} \\ \displaystyle {\varvec{v}}\cdot {\varvec{g}}= G +\frac{gh^2v}{2}. \end{array} \end{aligned}$$
(10)

A similar identity can be found also for the system of Euler equations [25] and for general systems of hyperbolic equations [34].

Fig. 1
figure 1

The first-order finite volume cell vertex diagram

3 Entropy-Stable Methods for the Shallow Water Equations

3.1 2D Finite Volume (FV) Method

To highlight the philosophical difference between entropy-stable RD methods and their FV counterpart, the cell vertex FV method is revisited since this scheme updates nodal variables, which is comparable to RD schemes. The total integration of Eq. (6) is performed over the shaded arbitrary Voronoi/containment cell as shown in Fig. 1a. However, a median-dual cell type is used for this study to account for highly skewed cells where the details are included in Appendix A. Voronoi cells are used to illustrate the lack of multidimensional property of FV method in a clearer fashion. The integral is given by

$$\begin{aligned} \frac{\partial {\varvec{u}}}{\partial t}&= -\frac{1}{A_p}\oint \overrightarrow{{\varvec{f}}}_e \cdot {\hat{n}}_e \text {d}l_e =-\frac{1}{A_p}\sum _{e} ({\varvec{f}}_e, {\varvec{g}}_e) \cdot \overrightarrow{n}_e \end{aligned}$$
(11)
$$\begin{aligned}&= -\frac{1}{A_p} \sum _{e}({\varvec{f}}_e n_{e,x} + {\varvec{g}}_e n_{e,y}), \end{aligned}$$
(12)

where \(A_p\) is the Voronoi cell area of point p and the subscript e refers to quantities at the edges of the Voronoi cells. \({\varvec{f}}_e\) and \({\varvec{g}}_e\) represent the flux components across the edges and \(\overrightarrow{n}_e\) denotes the outward normal of the edges. The \({\hat{n}}_e\) is scaled by the edge length(\(l_e\)) . The fluxes across the edges of Voronoi cells are computed by solving the 1D Riemann problem along the normal direction of the edges. For brevity, the details of the entropy-stable FV computation are recorded in Appendix B.

For the first-order FV method, the edge fluxes are computed by using only the variable values stored in two neighbouring points. For instance, in Fig. 1b, the final net flux across edge i is a function of only two points on the opposite sides of the edge, which are points 0 and 1. Hence, \(\overrightarrow{{\varvec{f}}}_{i} = \overrightarrow{{\varvec{f}}}({\varvec{u}}_0, {\varvec{u}}_1)\) and thus this scheme is not multidimensional.

The second-order cell vertex FV employs the least squares method to reconstruct the variables of each point as polynomials. In the computation of point 0 in Fig. 2, the polynomials of points 1 to 6 have to be determined as well. This requires the computational stencil to be extended to another layer of cells (in dash lines) for the second-order approach. For instance, the polynomials for point 2 have to involve the nodal variables from point 0, 1, 8, 9, 10, and 3. Hence, the second or higher-order FV method is no longer compact since every increment of the order of accuracy has to be accompanied with the inclusion of another layer of cells.

Fig. 2
figure 2

The second-order finite volume cell vertex stencil

3.2 2D Entropy-Conserved RD Method

For any RD method in general, the total integration of Eq. (6) is over the median-dual area node. The difference between RD and FV methods lies in computing the local elements that surrounds the median-dual area node. From the previous section, we have shown that FV approach uses a “1D-type” approach in terms of normal to the edge. However, the RD method computes the integral of the advection term using all three edges of the triangular element (or cell), utilizing the whole cell in this computation and defines it as a residual (\(\phi \)) to achieve a multidimensional feature. The equation is given by

$$\begin{aligned} \frac{\partial {\varvec{u}}}{\partial t} = -\frac{1}{A_p} \displaystyle \underbrace{\iint \overrightarrow{\nabla } \cdot \overrightarrow{{\varvec{f}}} \mathrm{d}A}_{\varvec{\phi }_p}= \frac{1}{A_p} \sum _{C}\varvec{\phi }_p^C, \end{aligned}$$
(13)

where \(A_p\) is the median-dual area of point p and the superscript C refers to quantities of the neighbouring triangular cells (or elements) of the centre node depicted in cells \(I-VI\) as shown in Fig. 3a. In contrast to the cell vertex FV method which focuses on determining the net flux across the edge boundary between two points, RD methods determine the residual (or signals) in a computational cell, which is a function of the variables from all three nodes of the cells. For instance, focusing on cell I in Fig. 3b, portion of the total residual from cell I, \(\varvec{\phi }_T^I = f({\varvec{u}}_0, {\varvec{u}}_1,{\varvec{u}}_2)\) is distributed towards node 0 as \(\varvec{\phi }_0^I\).

Fig. 3
figure 3

The general residual distribution scheme diagram

The residual over a certain element (or cell) T for a system of equations can be computed as

$$\begin{aligned} \varvec{\phi }_{T}&= \displaystyle -\iint _{T}(\frac{\partial {\varvec{f}}}{\partial x} +\frac{\partial {\varvec{g}}}{\partial y} )dx dy = \displaystyle -\oint _{\partial T} ({\varvec{f}}dy-{\varvec{g}}dx)\nonumber \\&\approx \displaystyle \frac{1}{2}({\varvec{f}}_0+{\varvec{f}}_{{1}})(y_1-y_0)+\frac{1}{2}({\varvec{f}}_1+{\varvec{f}}_2)(y_2-y_1)+\frac{1}{2}({\varvec{f}}_2+{\varvec{f}}_0)(y_0-y_2)\nonumber \\&\quad -\frac{1}{2}({\varvec{g}}_0+{\varvec{g}}_1)(x_1-x_0)-\frac{1}{2}({\varvec{g}}_1+{\varvec{g}}_2)(x_2-x_1)-\frac{1}{2}({\varvec{g}}_2+{\varvec{g}}_0)(x_0-x_2)\nonumber \\&=\displaystyle \frac{1}{2}\sum _p({\varvec{f}}_p,{\varvec{g}}_p)\cdot \overrightarrow{n}_p-\displaystyle \underbrace{\frac{1}{2}\sum _p({\varvec{f}}^*,{\varvec{g}}^*)\cdot \overrightarrow{n}_p}_{0}\nonumber \\&=\displaystyle \frac{1}{2}\sum _p({\varvec{f}}_p-{\varvec{f}}^*,{\varvec{g}}_p-{\varvec{g}}^*)\cdot \overrightarrow{n}_p, \end{aligned}$$
(14)

where p denotes the points (0, 1, 2) and \(\overrightarrow{n}_p\) is the respective inward normal on the element edge across of point p as shown in Fig. 3b. The line integral is approximated with the trapezium rule in Eq. (14). For a closed system, the entropy is only generated through the fluxes. The key to correctly model the primary fluxes \(\overrightarrow{{\varvec{f}}}=({\varvec{f}},{\varvec{g}})\) is by the introducing degrees of freedom \(\varvec{f^*}\) and \(\varvec{g^*}\) such that they would accurately alter the entropy fluxes \(\overrightarrow{F}\). The element residual (\(\varvec{\phi }_T\)) can be distributed to each element node in various ways as discussed by Abgrall [1]. Herein, we propose the distribution based on an isotropic approach coupled with an artificial signals distribution [24].

Assume that each node has the following isotropic signals

$$\begin{aligned} \varvec{\phi }_p=\frac{1}{2}( ({\varvec{f}}_p, {\varvec{g}}_p)- ({\varvec{f}}^*, {\varvec{g}}^*) )\cdot {\overrightarrow{n}_p} = \varvec{\phi }_p^\text {iso}, \end{aligned}$$
(15)

with \(({\varvec{f}}^*, {\varvec{g}}^*)\) are arbitrary to denote degrees of freedom which are influencing the signals \(\varvec{\phi }_p\) within an element. In a scalar advection case for instance, if \(({\varvec{f}}^*,{\varvec{g}}^*)\) are chosen to be the fluxes based on the velocities of the upwind node, the two-target N scheme will be recovered. Herein, the \(({\varvec{f}}^*,{\varvec{g}}^*)\) will be calculated over a triangular element using three nodal values to achieve entropy conservation within that element. It can be viewed from a more general perspective that the \(({\varvec{f}}^*,{\varvec{g}}^*)\) is evaluated as a line integral of three edges around a local element, and thus still preserving the multidimensional sense of an RD method. Note that the line integral of \(({\varvec{f}}^*,{\varvec{g}}^*)\) over a local element is not trivial in the entropy (U)-space. In addition, the conservation of the primary variables within a local element is guaranteed by default since any choice of \(({\varvec{f}}^*,{\varvec{g}}^*)\) will work. However, there is only a certain choice of \(({\varvec{f}}^*,{\varvec{g}}^*)\) that will ensure conservation of entropy within the local element.

Following the work of [24] in the effort to enforce entropy conservation, the idea is to locally impose a semi-discrete update of \({\varvec{u}}\) in Eq. (13) which will update U simultaneously. Through the implementation of a mapping function \({\varvec{v}}\) as already described in Sect. 2.1, every nodal update on \({\varvec{u}}\) has a direct local entropy update of U at the nodes. To achieve entropy conservation, the entropy production within a local element must be

$$\begin{aligned} {\dot{U}}=\sum _p({F}_p,{G}_p)\cdot \overrightarrow{n}_p-\sum _p ({\varvec{v}}^T_p\varvec{\phi }_p)=0. \end{aligned}$$
(16)

Rearranging the previous equation and expanding the signals based on Eq. (15) will yield

$$\begin{aligned} \sum _p ({\varvec{v}}^T_p({\varvec{f}}_p,{\varvec{g}}_p)\cdot \overrightarrow{n}_p) - ({\varvec{f}}^*, {\varvec{g}}^*)\sum _p({\varvec{v}}^T_p\overrightarrow{n}_p)&= \sum _p({F}_p,{G}_p)\cdot \overrightarrow{n}_p. \end{aligned}$$
(17)

Note that

$$\begin{aligned} \sum _p ({\varvec{v}}^T_p({\varvec{f}}_p,{\varvec{g}}_p)\cdot \overrightarrow{n}_p) -\sum _p({F}_p,{G}_p)\cdot \overrightarrow{n}_p, \end{aligned}$$

can also be viewed as the multidimensional entropy-potential equation over an arbitrary element. In our context, Eq. (17) is an exact discrete entropy-conserved condition for \(({\varvec{f}}^*, {\varvec{g}}^*)\) on the whole element. Applying the identity in Eq. (10) will yield the entropy-conserved fluxes over a cell for the SWE in 2D,

$$\begin{aligned} ({\varvec{f}}^*, {\varvec{g}}^*)&=g\frac{\sum _p(h^2_p(u_p,v_p))\cdot \overrightarrow{n}_p}{\sum _p({\varvec{v}}^T_p\overrightarrow{n}_p)}. \end{aligned}$$
(18)

The previous equation can be approximated with \({\varvec{f}}^*\) as the integration of each element edges as shown in Fig. 4. In other words, the element’s entropy-conserved flux \(\varvec{f^*}\) could be interpreted as an arithmetic average of each edge entropy-conserved conditions \({\varvec{f}}^*_{ij},{\varvec{f}}^*_{jk}, {\varvec{f}}^*_{ki} \). The error of this approximation is \(O(h^2)\) as demonstrated in Appendix C, so technically it should be accurate enough for up to second-order accurate methods as done herein.

Fig. 4
figure 4

Arbitrary triangle with three node pairs to mark different edges

The previous equation can be written as a discrete divergence operator over the element such that

$$\begin{aligned} ({\varvec{f}}^*, {\varvec{g}}^*)&=g\frac{\nabla \cdot {h^2_p(u_p,v_p)}}{\nabla \cdot ({\varvec{v}}^T)}. \end{aligned}$$
(19)

Putting it all together, it can be shown that at the element level, the entropy-conserved averaged quantities for the SWE are given by the following.

$$\begin{aligned} h^*&=\frac{1}{3}(h_i + h_j+h_k) \end{aligned}$$
(20)
$$\begin{aligned} u^*&=\frac{1}{3}(u_i + u_j+u_k) \end{aligned}$$
(21)
$$\begin{aligned} v^*&=\frac{1}{3}(v_i + v_j+v_k). \end{aligned}$$
(22)

Thus, the element entropy-conserved fluxes within an element are

$$\begin{aligned} {\varvec{f}}^C = \left[ \begin{array}{l} h^*u^* \\ h^*u^{*2} + \frac{1}{2}gh^{*2}\\ h^*u^*v^*\end{array}\right] ,\qquad {\varvec{g}}^C = \left[ \begin{array}{l} h^*v^* \\ h^*u^*v^*\\ h^*v^{*2} + \frac{1}{2}gh^{*2}\end{array}\right] , \end{aligned}$$
(23)

where \(({\varvec{f}}^*, {\varvec{g}}^*)= ({\varvec{f}}^C, {\varvec{g}}^C)\) in Eq. (15). Unfortunately, this method is probably unstable and requires some form of entropy dissipation to make it work.

Fig. 5
figure 5

Isotropic and artificial signals going to point i

3.3 Entropy Stability for RD Method via Artificial Signals

Following the work [24], we propose artificial terms to offset the isotropic signals. The upwinded signals distribution on node i shown in Fig. 5 can be written as,

$$\begin{aligned} \begin{array}{rl} \varvec{\phi }_i= &{}\displaystyle \underbrace{\frac{1}{2}\left( \overrightarrow{{\varvec{f}}_i}-\overrightarrow{{\varvec{f}}^C}\right) \cdot \overrightarrow{n}_i}_{\varvec{\phi }_i^\text {iso}} \\ &{}\displaystyle \underbrace{ \phantom {\left( \mathbf {{\varvec{f}}_i}-\mathbf {{\varvec{f}}^C}\right) } -\varvec{{\hat{R}}{\hat{D}}}_\alpha \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ji} -\varvec{{\hat{R}}{\hat{D}}}_\beta \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{kj} -\varvec{{\hat{R}}{\hat{D}}}_\gamma \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ik} }_{\varvec{\phi }_i^\text {art}}, \end{array} \end{aligned}$$
(24)

where \(\hat{}\) represents averaged values within an element. This is yet another degree of freedom in which we can explore but for computational economy, we select these averaged values to be identical with the averaged values required for entropy conservation. Note that the artificial signals are also a form of line integral over a local element which retains the multidimensional approach. For the system of shallow water equations, its Jacobian can be decomposed into \({\varvec{A}}= {\varvec{R}}\varvec{\varLambda }{\varvec{R}}^{-1}\). The eigenvector matrix along the streamline is

$$\begin{aligned} {\varvec{R}}=\left[ \begin{array}{c@{\quad }c@{\quad }c} 1 &{} 0 &{} 1 \\ u-a\theta _x &{} -a\theta _y &{} u+a\theta _x \\ v-a\theta _y &{} a\theta _x &{} v+a\theta _y \end{array} \right] . \end{aligned}$$
(25)

The streamline direction \(\theta \) can be decomposed in terms of its normalized x- and y- directions, \(\theta _x=\frac{{\hat{u}}}{\sqrt{({\hat{u}}^2+{\hat{v}}^2)}}\), \(\theta _y=\frac{{\hat{v}}}{\sqrt{({\hat{u}}^2+{\hat{v}}^2)}}\). The velocity tangential to the streamline is given by \(q_{\theta }={u}\theta _x+{v}\theta _y\). The eigenvalues along the streamline are written as,

$$\begin{aligned} \varvec{\varLambda }=\left[ \begin{array}{c@{\quad }c@{\quad }c} q_\theta -a &{} 0 &{} 0 \\ 0 &{} q_\theta &{} 0 \\ 0 &{} 0 &{} q_\theta +a \end{array} \right] , \end{aligned}$$
(26)

which denote the acoustic and entropy waves, respectively. As done in [25], we propose upwinding in terms of the difference in entropy variables \({\varvec{v}}\) instead of the conserved variables \({\varvec{u}}\). Using Barth–Merriam identity [26] such that,

$$\begin{aligned} {\varvec{R}}^{-1}d{\varvec{u}}=\varvec{SR}^Td{\varvec{v}},\quad {\varvec{S}}=\left[ \begin{array}{c@{\quad }c@{\quad }c} \frac{1}{g} &{} 0 &{} 0 \\ 0 &{} \frac{1}{2g} &{} 0 \\ 0 &{} 0 &{} \frac{1}{g} \end{array} \right] . \end{aligned}$$
(27)

The \({\varvec{S}}\) is a normalization scaling matrix. Last but not least, \(\varvec{\alpha },\varvec{\beta }\) and \(\varvec{\gamma }\) are the diagonal coefficients which are identical for each node within an element. In other words, these coefficients are element-type of parameters but with different values for each characteristic wave. These coefficients are written as,

$$\begin{aligned} \varvec{\alpha }&=\left[ \begin{array}{c@{\quad }c@{\quad }c} \alpha _1 &{} 0 &{} 0 \\ 0 &{} \alpha _2 &{} 0\\ 0 &{} 0 &{} \alpha _3 \end{array} \right] ,&\varvec{\beta }&=\left[ \begin{array}{c@{\quad }c@{\quad }c} \beta _1 &{} 0 &{} 0 \\ 0 &{} \beta _2 &{} 0\\ 0 &{} 0 &{} \beta _3 \end{array} \right] ,&\varvec{\gamma }&=\left[ \begin{array}{c@{\quad }c@{\quad }c} \gamma _1 &{} 0 &{} 0 \\ 0 &{} \gamma _2 &{} 0\\ 0 &{} 0 &{} \gamma _3 \end{array} \right] . \end{aligned}$$
(28)

We define the diagonal matrices,

$$\begin{aligned} \varvec{{\hat{D}}}_\alpha =\varvec{\alpha |{\hat{\varLambda }}|{\hat{S}}}h,\quad \varvec{{\hat{D}}}_\beta =\varvec{\beta |{\hat{\varLambda }}|{\hat{S}}}h,\quad \varvec{{\hat{D}}}_\gamma =\varvec{\gamma |{\hat{\varLambda }}|{\hat{S}}}h, \end{aligned}$$
(29)

where h is the average length of the edges, to ensure proper units and length scales for the artificial terms.

Subsequently, the signals for the other two nodes in element T are written below.

$$\begin{aligned} \begin{array}{rl} \varvec{\phi }_j= &{}\displaystyle \underbrace{\frac{1}{2}\left( \overrightarrow{{\varvec{f}}_j}-\overrightarrow{{\varvec{f}}^C}\right) \cdot \overrightarrow{n}_j}_{\varvec{\phi }_j^\text {iso}} \\ &{}\displaystyle \underbrace{ \phantom {\left( \mathbf {{\varvec{f}}_j}-\mathbf {{\varvec{f}}^C}\right) } -\varvec{{\hat{R}}{\hat{D}}}_\alpha \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{kj} -\varvec{{\hat{R}}{\hat{D}}}_\beta \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ik} -\varvec{{\hat{R}}{\hat{D}}}_\gamma \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ji} }_{\varvec{\phi }_j^\text {art}} \end{array} \end{aligned}$$
(30)
$$\begin{aligned} \begin{array}{rl} \varvec{\phi }_k= &{}\displaystyle \underbrace{\frac{1}{2}\left( \overrightarrow{{\varvec{f}}_k}-\overrightarrow{{\varvec{f}}^C}\right) \cdot \overrightarrow{n}_k}_{\varvec{\phi }_k^\text {iso}} \\ &{}\displaystyle \underbrace{ \phantom {\left( \overrightarrow{{\varvec{f}}_k}-\overrightarrow{{\varvec{f}}^C}\right) } -\varvec{{\hat{R}}{\hat{D}}}_\alpha \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ik} -\varvec{{\hat{R}}{\hat{D}}}_\beta \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{ji} -\varvec{{\hat{R}}{\hat{D}}}_\gamma \varvec{{\hat{R}}}^T\left[ {\varvec{v}}\right] _{kj} }_{\varvec{\phi }_k^\text {art}}. \end{array} \end{aligned}$$
(31)

Note that the summation of all the signals due to the artificial terms within element T is zero, whereas the sum of the isotropic signals will yield the exact numerical integral of Eq. (15); hence, conservation within an element is obtained by default. However, both the isotropic signals and artificial terms would affect the nodes from a median-dual area perspective.

3.3.1 Conditions for Entropy Stability

Define

$$\begin{aligned} {\varvec{M}}_\alpha =\varvec{{\hat{R}}{\hat{D}}}_\alpha \varvec{{\hat{R}}}^T,\quad {\varvec{M}}_\beta =\varvec{{\hat{R}}{\hat{D}}}_\beta \varvec{{\hat{R}}}^T,\quad {\varvec{M}}_\gamma =\varvec{{\hat{R}}{\hat{D}}}_\gamma \varvec{{\hat{R}}}^T. \end{aligned}$$

Since \(\varvec{{\hat{D}}}_\alpha ,\varvec{{\hat{D}}}_\beta \) and \(\varvec{{\hat{D}}}_\gamma \) are diagonal, \({\varvec{M}}_\alpha ,{\varvec{M}}_\beta \) and \({\varvec{M}}_\gamma \) will be symmetric and positive definite. Using the method in Eq. (24), the entropy production would be,

$$\begin{aligned} \begin{array}{rl} {\dot{U}}=&{}\displaystyle \sum _p\overrightarrow{{\varvec{F}}_p}\cdot \overrightarrow{n}_p -\sum _p {\varvec{v}}^T_p\varvec{\phi }_p \\ =&{}\displaystyle \underbrace{\sum _p\overrightarrow{{\varvec{F}}_p}\cdot \overrightarrow{n}_p -\sum _p{\varvec{v}}^T_p\varvec{\phi }_p^\text {iso}}_{=0} -\sum _p{\varvec{v}}^T_p\varvec{\phi }_p^\text {art} =-\sum _p{\varvec{v}}^T_p\varvec{\phi }_p^\text {art}. \end{array} \end{aligned}$$
(32)

Therefore,

$$\begin{aligned} \begin{array}{rl} {\dot{U}}= &{}\displaystyle -\,{\varvec{v}}_i^T\left( {\varvec{M}}_\alpha \left( {\varvec{v}}_{i}-{\varvec{v}}_{j}\right) +{\varvec{M}}_\beta \left( {\varvec{v}}_{j}-{\varvec{v}}_{k}\right) +{\varvec{M}}_\gamma \left( {\varvec{v}}_{k}-{\varvec{v}}_{i}\right) \right) \\ &{}\displaystyle -\,{\varvec{v}}_j^T\left( {\varvec{M}}_\alpha \left( {\varvec{v}}_{j}-{\varvec{v}}_{k}\right) +{\varvec{M}}_\beta \left( {\varvec{v}}_{k}-{\varvec{v}}_{i}\right) +{\varvec{M}}_\gamma \left( {\varvec{v}}_{i}-{\varvec{v}}_{j}\right) \right) \\ &{}\displaystyle -\,{\varvec{v}}_k^T\left( {\varvec{M}}_\alpha \left( {\varvec{v}}_{k}-{\varvec{v}}_{i}\right) +{\varvec{M}}_\beta \left( {\varvec{v}}_{i}-{\varvec{v}}_{j}\right) +{\varvec{M}}_\gamma \left( {\varvec{v}}_{j}-{\varvec{v}}_{k}\right) \right) . \end{array} \end{aligned}$$
(33)

Although we started with a symmetric approach over the element, the \(\beta \) terms drop out since these terms are the differences which does not contain the node of interest and perhaps does not influence the entropy production. For example, node i will have \(\beta \) terms for differences in terms of nodes (jk). Hence,

$$\begin{aligned} \begin{array}{rl} {\dot{U}}=&{} \left( {\varvec{v}}_i-{\varvec{v}}_j\right) ^T\left( {\varvec{M}}_\alpha -{\varvec{M}}_\gamma \right) \left( {\varvec{v}}_i-{\varvec{v}}_j\right) \\ {} &{} +\left( {\varvec{v}}_j-{\varvec{v}}_k\right) ^T\left( {\varvec{M}}_\alpha -{\varvec{M}}_\gamma \right) \left( {\varvec{v}}_j-{\varvec{v}}_k\right) \\ {} &{} +\left( {\varvec{v}}_k-{\varvec{v}}_i\right) ^T\left( {\varvec{M}}_\alpha -{\varvec{M}}_\gamma \right) \left( {\varvec{v}}_k-{\varvec{v}}_i\right) , \end{array} \end{aligned}$$
(34)

where

$$\begin{aligned} {\varvec{M}}_\alpha -{\varvec{M}}_\gamma =\varvec{{\hat{R}}}\left( \varvec{{\hat{D}}}_\alpha -\varvec{{\hat{D}}}_\gamma \right) \varvec{{\hat{R}}}^T. \end{aligned}$$

And,

$$\begin{aligned} \varvec{{\hat{D}}}_\alpha -\varvec{{\hat{D}}}_\gamma =\left( \varvec{\alpha }-\varvec{\gamma }\right) \varvec{|{\hat{\varLambda }}|{\hat{S}}}. \end{aligned}$$

While \(\varvec{|{\hat{\varLambda }}|}\) and \(\varvec{{\hat{S}}}\) are always positive, in order to satisfy \({\dot{U}}\le 0\), the condition of \(\varvec{\alpha -\gamma }\ge 0\) should be met. Or in other words,

$$\begin{aligned} \alpha _d-\gamma _d\ge 0,\qquad \forall \beta _d \in {\mathbb {R}},\qquad d=1,2,3. \end{aligned}$$
(35)

In order to simplify the above condition for further analysis, we assume,

$$\begin{aligned} \alpha _d\ge 0,\qquad \gamma _d=-\alpha _d,\qquad d=1,2,3. \end{aligned}$$
(36)

Since \(\beta \) does not affect the entropy production, we shall set

$$\begin{aligned} \beta _d=0,\qquad d=1,2,3. \end{aligned}$$
(37)

3.4 Positivity Conditions for the Entropy-Stable RD Method

The positivity condition is based on the scalar work from [23], and herein it is expanded to a linearized system of equations. In order to produce a positive solution, we choose \(\varvec{\alpha }\) such that

$$\begin{aligned} \varvec{\alpha R\varvec{\varLambda }R^{-1}}>-\frac{1}{3}\min \left( \left( {\varvec{K}}\right) _p\right) ,\quad p=i,j,k. \end{aligned}$$
(38)

where

$$\begin{aligned} {\varvec{K}}_p=\frac{1}{2}\left( \varvec{R\varvec{\varLambda }R^{-1}}\right) \cdot \overrightarrow{n}_p. \end{aligned}$$
(39)

Clearly, \(\min \left( {\varvec{K}}_p\right) \) is always negative; hence, \(\varvec{\alpha } \) shall be always positive and can be explicitly determined as \(\varvec{\alpha }_\text {Kmin}\). This would be our first-order approach.

3.5 Second-Order Entropy-Stable RD Methods

From the truncation error analysis of a scalar equation [24], the isotropic and artificial signals have errors of \(O(h^3)\) and O(h), respectively. To create a second-order entropy-stable method requires a reduction in error for the artificial signals. Based on the argument from [24], we propose multiplying \(\varvec{\alpha }_\text {Kmin}\) with a grid size ratio matrix \({\varvec{D}}\)

$$\begin{aligned} {\varvec{D}}=\left[ \begin{array}{c@{\quad }c@{\quad }c} \left( \frac{h}{L_r}\right) ^q&{}0&{}0 \\ 0&{}\left( \frac{h}{L_r}\right) ^q&{}0 \\ 0&{}0&{}\left( \frac{h}{L_r}\right) ^q \end{array} \right] . \end{aligned}$$
(40)

Based on this \({\varvec{D}}\), all the waves from \(\varvec{\alpha }_\text {Kmin}\) are amplified based on a grid size (h) which is non-dimensionalized with the reference length (\(L_r\)). From the analysis of the scalar equations [24], if \(q=0\) then the solution would be close to first order. By setting \(q = 1.0\), it would present a second-order spatially accurate method for steady and unsteady scalar computations. The proof of achieving second-order accuracy for systems using \(q=1.0\) can be found in [31] and will be coined as our second-order approach.

3.6 Second-Order Limited Approach

To the authors’ best knowledge, there is yet a TVD method for RD approaches. Herein, a limited approach is proposed by blending the high-order signals \(\varvec{\phi }^\text {High}\) from Sect. 3.5 with low-order signals \(\varvec{\phi }^\text {Low}\) from Sect. 3.4. This is to ensure high-order accuracy in smooth flows yet monotone solutions around discontinuities. The final residual directed to a node i is

$$\begin{aligned} \varvec{\phi }_i = (1 - \varvec{\psi }({\varvec{u}})) \varvec{\phi }_i^\text {High} + \varvec{\psi }({\varvec{u}}) \varvec{\phi }_i^\text {Low}, \end{aligned}$$
(41)

where \(\varvec{\psi }({\varvec{u}})\) denotes a blending parameter. A heuristic definition of the blending parameter, \(\varvec{\psi }({\varvec{u}})\), by Deconinck [11] is given as

$$\begin{aligned} \varvec{\psi }({\varvec{u}}) = \frac{|\varvec{\phi }^E|}{\sum _{j\in E}|\varvec{\phi }_j^\text {Low}|}. \end{aligned}$$
(42)

It is noted that this limited scheme does not guarantee positivity requirements but is reported to have good results in some applications [3, 10, 30]. There could be a potential of finding a better limited approach in RD via the work of [13].

3.7 Time Integration

We can use any consistent ODE-type solvers to update node p such that

$$\begin{aligned} \left( \frac{\partial u}{\partial t}\right) _p = -\frac{\Delta t}{2A_p}\sum _{E} \varvec{\phi }_p^{E}, \end{aligned}$$
(43)

where \(\varvec{\phi }_p^{E}\) is the signals at node p coming from cell (element) E and \(A_p\) is the median-dual area of the point p as shown in Fig. 6. Note that the overall RD approach is still compact even for second-order methods.

Fig. 6
figure 6

Median-dual area of a point (\(A_p\) is the shaded area)

4 Results and Discussion

The numerical performance of the proposed schemes is assessed on two test cases on triangular grids with \(\text {CFL}=0.1\) on all regular grids. The CFL is increased to 10.0 on highly randomized grids (70% and above) due to the over-constraint \(\mathrm{d}t\) by small and highly skewed elements. The entropy-stable finite volume method is denoted as ESFV and entropy-stable residual distribution method as ESRD. Other RD schemes are also included such as CRD N scheme (N) [27], low diffusion A (LDA), Lax–Friedrichs (LxF) and Lax–Wendroff (LxW) schemes [35] where their signal distributions are presented in Appendix D.

4.1 Unsteady Vortex Advection

This test case is a smooth problem which enables the analysis on the order of accuracy (OoA) using exact solutions [12, 29]. We employ similar flow parameters in [29] where \(\varGamma = 15, \omega = 4\pi , g = 1\) in the domain \([0,1]^{2}\) with some differences where the vortex centre is set at (0.25, 0.25) travelling in the diagonal direction towards the top right corner of the domain with velocity, \(\overrightarrow{u}_{\infty } = [18,18]\) from \(t = 0\) to \(t = 1/36\). The test case is simulated on five different grids with 3249, 7225, 12,769, 28,561 and 40,401 nodes, respectively, with systematic grid randomization effect. The regular and randomized isotropic grids are illustrated in Fig. 7a, b, respectively.

Fig. 7
figure 7

Isotropic grids used for vortex advection problem

The cross-sectional water height, h, and u velocity, u, profiles are plotted in Figs. 8 and 9, respectively, whereas v velocity, v, is just orthogonal to u and thus omitted. The x-axis scale represents the distance from (0.5, 0.5) to (1.0, 1.0).

Fig. 8
figure 8

Water height profiles across the vortex at streamline direction for various schemes on [\(200\times 200\)] grid

Fig. 9
figure 9

u velocity profiles across the vortex at streamline direction for various schemes on [\(200\times 200\)] grid

Fig. 10
figure 10

L2 error of water height, h, versus the grid distance in logarithmic scale for vortex advection

LxW and ESRD second-order scheme are able to recover the peak/trough height and u and also maintain their second-order accuracy in Fig. 10 (where the summary is in Table 1) even on grids with \(80\%\) randomization. The OoA performances for u and v are similar to that of h and are omitted. The ESFV second-order scheme suffers deterioration from grid randomization. Firstly, there are more noticeable errors of both h and u at the beginning and also the downstream half of the vortex. Secondly, the L2 errors of the ESFV second-order scheme become erratic with undefined OoA.

Although the LDA is proven to be second-order accurate in space for steady cases [1], it is obvious here that the LDA is unable to preserve its second-order spatial accuracy for unsteady calculations using an explicit time integration technique. However, the LDA is the most accurate in preserving h and u among the first-order schemes, while the LxF is the most diffusive. In terms of h, the new ESRD first-order scheme is comparable to the N scheme but the ESFV first order is slightly more diffusive and the difference becomes even greater on highly randomized grids. Considering u, the result of ESRD first order is better, if not comparable, to that of LDA.

A plot of the entropy rate of decay against time is illustrated in Fig. 11 to assess the “total energy” preservation of the schemes for this smooth vortex transport case. The more diffusive first-order methods are entropy-stable \((\frac{\mathrm{d}U}{\mathrm{d}t}<0)\), and it is highlighted that the ESRD first-order scheme has the lowest rate of entropy dissipation for this problem. All of the second-order schemes, including ESRD second-order scheme, are able to preserve the entropy (or “total energy”) with \(\frac{\mathrm{d}U}{\mathrm{d}t}\sim 0\).

Fig. 11
figure 11

Rate of change of energy against time for vortex advection on regular grid

4.2 Steady Oblique Hydraulic Jump

The oblique hydraulic jump test case includes a discontinuity to assess monotone property of numerical schemes in SWEs [20, 28, 29]. The flow parameters include Froude number, \(Fr=2.74\), gravitational acceleration, \(g=9.812\), initial \(h=1.0\). The domain is \([4\times 2.5]\) with mesh size of 1 / 42, and the wedge is at an angle of 8.95°. The exact solution of h is shown in Fig. 12a. The grid used is shown in Fig. 12b.

Fig. 12
figure 12

Exact solutions and 70% randomized isotropic grid used

In Fig. 13, LDA scheme, which is second order for steady case [31], exhibits numerical oscillations near to the hydraulic jump profile, which confirms that the scheme is not monotone, while LxW and ESRD second-order schemes diverge. Among the first-order schemes, N scheme shows the sharpest jump, followed by ESFV first-order, ESRD first-order and lastly LxF scheme.

Fig. 13
figure 13

Water height profiles across \(y=0.85\) for various schemes on grid with 70% randomization for oblique hydraulic jump

Fig. 14
figure 14

Residual plots to achieve convergence for various schemes solving the steady oblique hydraulic jump

The limited ESRD scheme is monotone and produces less diffusion to the solution compared to ESRD first-order, which is qualitatively comparable to N scheme. Quantitatively speaking, it should be highlighted that the error level of limited ESRD scheme is the lowest among all other schemes, even lower than its rival N scheme as shown in Fig. 14 which denotes the convergence history of the steady oblique hydraulic jump case. Furthermore, the figure reveals that all the schemes have comparable computational cost efficiency and take similar number of iterations to produce converged solutions where the residuals or errors plots flatten.

Table 1 Summary of the order of accuracy analysis for vortex advection for (a) regular grid and (b) 80 % randomized grid

5 Conclusion

In this paper, an entropy-stable RD (ESRD) method was developed for the system of SWE. Similar to the philosophy of its FV counterpart, the ESRD method consists of an entropy-conserved (symmetric) and entropy-generated (asymmetric) portions which are represented by the isotropic and artificial signals, respectively. However, in the RD context both signals use a multidimensional approach over an element. For instance, the entropy-conserved fluxes \(({\varvec{f}}^C,{\varvec{g}}^C)\) are derived from taking the line integral around a local element using all of its nodal values. The ESFV method is more of a one-dimensional setting, using only two nodal values to compute the entropy-conserved fluxes on the interface shared by the two nodes. Nevertheless, a similar arithmetic mean is found to satisfy entropy conservation in SWE for the RD method except that it uses three node values compared to two nodal values for FV. The entropy-generated (numerical diffusion) parts are also multidimensional for the RD method unlike the FV scheme. Perhaps that explains the accuracy preservation of the ESRD method on highly irregular grids which is not possible with the ESFV approach, consistent with reports in the literature [8, 19]. On the other hand, the newly developed ESRD methods performed quite admirably relative to current RD methods in terms of cost and accuracy. In fact, the second-order ESRD methods preserve most of the spatial order accuracy even on unsteady problems unlike the LDA method. Extensions to high-order (more than second) accurate methods using the principles in [4] are currently underway. Since the current limited version does not guarantee the total elimination of spurious oscillations using the blending parameter from [11], we are also looking into entropy TVD approach such as [13] as part of the future work. The extension to a more complex 2D systems of equation such as Euler 2D equations has already been done and is undergoing its final revision stage [9].