1 Introduction

The two-layer shallow water equations are a widely used model to describe the behavior of two immiscible fluid layers of different density, where the horizontal scales are large relative to the depth scale. Typical applications range from water bodies of different salinity and temperature [7] to mixtures of oil and water [22], as well as underwater landslides [30, 41].

The system is derived from depth-averaging of the inviscid Navier–Stokes equations and can be considered as a combination of the standard shallow water equation (SWE) for each fluid layer with an additional nonconservative term that accounts for the coupling between fluid layers and interaction with the bottom topography.

The design of numerical schemes for this system encounters several difficulties, many of them connected to the inclusion of the nonconservative products. These additional coupling terms affect the wave propagation and can even change the nature of system. In contrast to standard shallow water flows, the system is only conditionally hyperbolic as the baroclinic mode allows for complex eigenvalues. This loss of hyperbolicity occurs for large velocity differences between the layers and has been linked to the onset of Kelvin–Helmholtz instability [1]. The computation of the eigenvalues themselves is also not straightforward as even the one-dimensional system yields a \(4 \times 4\) flux Jacobian and its eigenvalues are either approximated, e.g. [15, 39], or computed by Ferrari’s formula [35, 44]. Another important aspect that arises in the numerical treatment of balance laws is the preservation of steady-state solutions. A varying or even discontinuous bottom topography generates additional source contributions that necessitate a careful discretization of source terms and fluxes to ensure a discrete balance. Failure to preserve these steady states can lead to accumulation of balancing errors over time and the formation of unphysical waves [9], on the order of the grid spacing. Since most shallow water applications revolve around the computation of small perturbations around a steady-state solution, such as gravity waves, tidal flow or tsunami formation, preserving this balance is essential. A numerical scheme that preserves these steady states is denoted as well-balanced.

Designing a well-balanced numerical approximation for shallow water models requires a precise discrete interplay between the pressure term in the conservative flux and the nonconservative term. This is particularly true in the context of high-order numerical methods see, e.g., [21, 45, 57, 58]. Herein we present a particular path-conservative discretization of the nonconservative terms that endows the numerical approximation with the well-balancedness property on curvilinear meshes. This well-balanced discretization also relies on a nonconservative discretization of the pressure flux term that naturally arises from an entropy conservative discretization of the governing equations [25, 57]. Thus, we close the discussion on well-balanced methods for now and focus, instead, on provably stable high-order methods for shallow water models.

In recent developments regarding numerical schemes for the two-layer SWE most activities focused on the development of finite volume methods [1, 7, 10, 30, 36, 54] with only few advances in the application of high-order discontinuous Galerkin methods [17, 29]. Due its ability to create high-order approximations and its optimal dissipation and dispersion properties [2] discontinuous Galerkin methods can provide excellent approximations for this conditionally hyperbolic system of balance laws. In order to utilize these compelling properties, we select DGSEM as our numerical method in this paper. While the high-order nature of these methods allows for accurate approximations, the inherent low amount of numerical dissipation also makes them prone to robustness issues [24].

A contemporary approach to create robust DG approximations in the nonlinear case is the use of entropy stability [55], where the solution is bounded by a strongly convex mathematical entropy function. For the two-layer SWE such an entropy function naturally occurs as the total energy within the layers. In [24, 60] a methodology to construct entropy stable DG methods based on the summation-by-parts (SBP) property and a flux-differencing formulation was proposed. This methodology has been extended, for example, to the broader context of fluctuation formulations for nonconservative systems in [48], multiphase models [11], and compressible Euler with gravity [56].

Following this approach we construct an entropy stable nodal DGSEM using the SBP properties to mimic a continuous entropy analysis in the semi-discrete case. We present a combination of entropy conservative numerical surface fluxes and nonconservative terms that satisfy an entropy conservation condition for the two-layer shallow water system. The specific combination yields a compatible discretization of the pressure and nonconservative terms. In this way, we obtain a method that is provably well-balanced for discontinuous bottom topographies on curvilinear meshes. The resulting split-form DGSEM is equivalent to the path-conservative numerical framework originally described by Renac [48]. Beyond the two-layer SWE, it is possible to show that existing nonconservative, entropy stable high-order nodal DG discretizations for the ideal GLM-MHD and standard SWE [3, 49, 57] are also path-conservative. This fact is not explicitly demonstrated as it is outside the focus of the current work; however, this link offers exciting avenues for future development. For instance, the provably entropy stable subcell shock capturing method developed by Rueda–Ramírez and co-authors [49, 50] becomes available for such path-conservative schemes.

This work derives, analyzes and tests a high-order, entropy stable, split-form (DGSEM) for the two-layer SWE on curvilinear domains. To construct this numerical method we first describe the theory and challenges of the two-layer SWE in Sect. 2, followed by a continuous entropy analysis of the system in Sect. 3, which we will mimic in the semi-discrete setting. We then derive a split-form DGSEM on curvilinear elements in Sect. 4 that will provide a baseline scheme for the further derivation of entropy conservative and entropy stable approximations. In Sect. 5, we first derive entropy conservative numerical fluxes that are then used in the split-form DGSEM to create an entropy conservative approximation. We then contract the DGSEM with the entropy variables and rely on the SBP property and metric identities to demonstrate entropy conservation and well-balancedness. From this entropy conservative formulation we then extend to one that is entropy stable by adding appropriate dissipation in Sect. 6. The theoretical findings are then demonstrated and verified in Sect. 7 with a number of test cases that provide numerical results for convergence, well-balancedness and entropy conservation and stability.

2 Two-Layer Equations

We consider the two-layer SWE, which are a nonlinear system of balance laws derived from depth-averaging the inviscid Navier–Stokes-equations. The two-dimensional system is given by

$$\begin{aligned} \begin{bmatrix} h_1 \\ h_1u_1 \\ h_1v_1 \\ h_2 \\ h_2u_2 \\ h_2v_2 \end{bmatrix}_t + \begin{bmatrix} h_1u_1 \\ h_1u_1^2 + \frac{gh_1^2}{2}\\ h_1u_1v_1\\ h_2u_2 \\ h_2u_2^2 + \frac{gh_2^2}{2}\\ h_2u_2v_2 \end{bmatrix}_x + \begin{bmatrix} h_1v_1 \\ h_1u_1v_1 \\ h_1v_1^2 + \frac{gh_1^2}{2}\\ h_2v_2 \\ h_2u_2v_2\\ h_2v_2^2 + \frac{gh_2^2}{2}\\ \end{bmatrix}_y = -\begin{bmatrix} 0 \\ gh_1(b+h_2)_x\\ gh_1(b+h_2)_y\\ 0 \\ gh_2(b+\frac{\rho _1}{\rho _2}h_1)_x\\ gh_2(b+\frac{\rho _1}{\rho _2}h_1)_y\\ \end{bmatrix}, \end{aligned}$$
(1)

where the subscripts denote the upper “1” and lower “2” fluid layer. For each layer \(h_i\) denotes the respective layer height, \(u_i\) and \(v_i\) the averaged layer velocity in x- and y-direction and \(\rho _i\) the different constant fluid densities, where we assume that \(\rho _1<\rho _2\). Furthermore, \(b\equiv b(x,y)\) denotes the variable bottom topography and g the gravitational acceleration. The conservative part of the system corresponds to the standard SWE for each layer and only differs by additional nonconservative coupling terms on the right hand side that are given by \(gh_1\left( h_2\right) _x\) in the upper layer and \(gh_2(\frac{\rho _1}{\rho _2}h_1)_x\) in the lower layer.

To simplify the analysis we introduce a general compact notation for this system of balance laws

$$\begin{aligned} \textbf{u}_t + \vec {\nabla }_x \cdot \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }}(\textbf{u}) + \varvec{\phi }(\textbf{u})\circ \left( \vec {\nabla }_x\cdot \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}(\textbf{u})\right) = 0, \end{aligned}$$
(2)

where \(\textbf{u}= (h_1, h_1u_1, h_1v_1, h_2, h_2u_2, h_2v_2)^T\) denotes the state vector of conserved quantities and the nonconservative term composed of a nonconservative product and a source term is reformulated in terms of the Hadamard product with the state vector \(\varvec{\phi }(\textbf{u}) = (0, gh_1, gh_1, 0, gh_2, gh_2)^T\). To obtain a compact notation for the fluxes and nonconservative terms we introduce the block vectors, see [3, 60]

$$\begin{aligned} \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }} = \begin{bmatrix} \textbf{f}_1 \\ \textbf{f}_2\end{bmatrix}, \quad \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }} = \begin{bmatrix} \textbf{r}_1 \\ \textbf{r}_2\end{bmatrix}, \end{aligned}$$
(3)

that contain the respective components in x- and y-directions

$$\begin{aligned} \textbf{f}_1 = \begin{bmatrix} h_1u_1 \\ h_1u_1^2 + \frac{gh_1^2}{2}\\ h_1u_1v_1 \\ h_2u_2 \\ h_2u_2^2 + \frac{gh_2^2}{2}\\ h_2u_2v_2 \end{bmatrix}\hspace{-0.1cm},\,\, \textbf{f}_2 = \begin{bmatrix} h_1v_1 \\ h_1u_1v_1 \\ h_1v_1^2 + \frac{gh_1^2}{2}\\ h_2v_2 \\ h_2u_2v_2\\ h_2v_2^2 + \frac{gh_2^2}{2}\\ \end{bmatrix}\hspace{-0.1cm},\,\, \textbf{r}_1 = \begin{bmatrix} 0 \\ b+h_2\\ 0\\ 0 \\ b+\frac{\rho _1}{\rho _2}h_1\\ 0\\ \end{bmatrix}\hspace{-0.1cm},\,\, \textbf{r}_2 = \begin{bmatrix} 0 \\ 0\\ b+h_2\\ 0 \\ 0\\ b+\frac{\rho _1}{\rho _2}h_1\\ \end{bmatrix}. \end{aligned}$$
(4)

The nonconservative term in (2) introduces some difficulties in the design of robust numerical methods. Additionally, in the continuous analysis, the nonconservative term renders the system only conditionally hyperbolic. This escape from the hyperbolic regime has been linked to the onset of Kevin–Helmholtz instabilities [4], where high velocity difference in the shear layer leads to heavy mixing. A mechanism that cannot be replicated in the immiscible setting.

Another difficulty arises in the computation of the eigenvalues of the flux Jacobian. Even the one dimensional system yields a fourth order characteristic polynomial and an explicit computation of eigenvalues relies on Ferrari’s formula, see [35, 44] for details. Instead we follow the approach from Nycander and Döös [39] and assume that the baroclinic and barotropic modes do not interact for \(u_1\approx u_2\) and \(\rho _1\ll \rho _2\). This assumption leads to the eigenvalue approximation

$$\begin{aligned} \begin{aligned} \lambda ^{\pm }_{ext}&= U_m \pm \sqrt{g(h_1+h_2)},\\ \lambda ^{\pm }_{int}&= U_c \pm \sqrt{g'\frac{h_1h_2}{h_1+h_2} \left( 1 - \frac{\left( u_1-u_2\right) ^2}{g'\left( h_1+h_2\right) }\right) }, \end{aligned} \end{aligned}$$
(5)

where \(\lambda _{ext}\) and \(\lambda _{int}\) denote the wave speeds of the barotropic and baroclinic mode, respectively written in terms of the velocities \(U_m = \frac{h_1u_1+h_2u_2}{h_1+h_2}\), \(U_c = \frac{h_1u_2+h_2u_1}{h_1+h_2}\) and the reduced gravity \(\smash {g' = g(1 - \frac{\rho _1}{\rho _2})}\). For simplicity the one-dimensional case is considered as the extension to two dimensions is straightforward. From the approximation (5) we see that internal eigenvalues may become complex and the hyperbolic regime of the system is estimated by

$$\begin{aligned} \frac{\left( u_1-u_2\right) ^2}{g'\left( h_1+h_2\right) } \le 1. \end{aligned}$$
(6)

In accordance with [19] we can get the following bound on the maximum wave speeds

$$\begin{aligned} |\lambda | \le \left| \frac{h_1u_1+h_2u_2}{h_1+h_2}\right| \pm \sqrt{g(h_1+h_2)}. \end{aligned}$$
(7)

A particularly important property of numerical schemes for the two-layer SWE is the preservation of steady-state solutions that remain constant in time. The most important example of such a steady-state is the lake-at-rest condition

$$\begin{aligned} u_1,u_2,v_1,v_2 \equiv 0, \quad h_2+b \equiv \text {constant}, \quad h_1 \equiv \text {constant}. \end{aligned}$$
(8)

As a wide range of applications are computed from small perturbations around the lake-at-rest condition, discrete preservation of (8) is essential. A scheme that is able to preserve (8) is denoted as well-balanced.

3 Entropy Analysis

Stability estimates for numerical approximations are typically provided in terms of \(L^2\)-stability, where the discrete solution remains bounded within the \(L^2\text {-norm}\), see [34, 40]. While \(L^2\)-stability holds for linear problems, it fails to provide stability for general nonlinear systems [24, 38]. An alternative for nonlinear systems is the use of entropy stability [55], where the solution is bounded by a strongly convex mathematical entropy function. The two-layer shallow water system (1) is equipped with such a convex entropy function \(S=S(\textbf{u})\), corresponding to the total energy within the layers

$$\begin{aligned} \begin{aligned} S(\textbf{u})&= \dfrac{1}{2}\left( \rho _1 \left( h_1u_1^2+h_1v_1^2+gh_1^2\right) + \rho _2 \left( h_2u_2^2+h_2v_2^2+gh_2^2\right) \right) \\&\quad +\, \rho _2gh_2b + \rho _1gh_1(b+h_2), \end{aligned} \end{aligned}$$
(9)

together with the corresponding entropy flux

$$\begin{aligned} \begin{aligned} \vec {f}{}^{\,S}&= \rho _1\left( \frac{1}{2}h_1u_1\left( u_1^2 + v_1^2\right) + gh_1u_1\left( h_1 + b\right) \right) \\&\quad +\,\rho _2\left( \frac{1}{2}h_2u_2\left( u_2^2 + v_2^2\right) + gh_2u_2\left( h_2 + b\right) \right) +g\rho _1h_1h_2(u_1 + u_2). \end{aligned} \end{aligned}$$
(10)

Differentiation of the entropy function with respect to the conservative variables yields the entropy variables

$$\begin{aligned} \begin{aligned} {\textbf {w}} = S_u = \left[ \begin{matrix}\rho _{1}\left( g \left( h_{1} + h_{2} + b \right) - \frac{1}{2} \left( u_{1}^{2} + v_{1}^{2}\right) \right) \\ \rho _{1} u_{1}\\ \rho _{1} v_{1}\\ \rho _{2}\left( g\left( h_{1} \frac{\rho _{1}}{\rho _2} + h_{2} + b \right) - \frac{1}{2} \left( u_{2}^{2} + v_{2}^{2}\right) \right) \\ \rho _{2} u_{2}\\ \rho _{2} v_{2}\end{matrix}\right] , \end{aligned} \end{aligned}$$
(11)

which are used to obtain a relation between the physical and entropy fluxes as well as the nonconservative terms

$$\begin{aligned} \vec {\nabla }_x\cdot \vec {f}{}^{\,S} = \textbf{w}^T\left( \vec {\nabla }_x\cdot \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }} + \varvec{\phi }\circ \left( \vec {\nabla }_x\cdot \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) \right) . \end{aligned}$$
(12)

Furthermore, the entropy flux potential is defined as

$$\begin{aligned} \vec {\psi }\left( \textbf{u}\right) = \textbf{w}^T\,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }} - \vec {f}{}^{\,S}. \end{aligned}$$
(13)

From these compatibility relations, contracting smooth solutions of (2) with the entropy variables \(\textbf{w}\) yields a scalar conservation law for the entropy function

$$\begin{aligned} S_t + \vec {\nabla }_x\cdot \vec {f}{}^{\,S} = 0. \end{aligned}$$
(14)

We integrate the equation over the domain \(\varOmega \) and apply Gauss’ law to rewrite the entropy flux as a surface integral and obtain the entropy conservation law (14) in integral form

$$\begin{aligned} \int \limits _{\varOmega }S_t {\text {dV}} + \int \limits _{\partial \varOmega }\vec {f}{}^{\,S}\cdot \vec {n} \,{\text {dS}} = 0. \end{aligned}$$
(15)

In the case of discontinuities entropy must be dissipated at shocks and solutions must instead satisfy the entropy inequality

$$\begin{aligned} \int \limits _{\varOmega }S_t {\text {dV}} + \int \limits _{\partial \varOmega }\vec {f}{}^{\,S} \cdot \vec {n} \,{\text {dS}} \le 0. \end{aligned}$$
(16)

To prove entropy conservation of the numerical scheme, we will mimic the continuous case. Note, that the contraction of physical fluxes into entropy space depends on the chain rule, which in general does not hold discretely [46]. In order to obtain entropy fluxes in the discrete setting, we therefore employ an alternative strategy based on entropy conservative numerical finite volume fluxes, that will be described in Sect. 5.

4 Split-Form DGSEM on Curvinlinear Elements

In this section we derive the split-form DGSEM for the nonconservative system (2), that will provide a baseline scheme from which we then develop our entropy conservative and stable approximations. To generalize the formulation to curvilinear elements we first introduce a mapping between physical and reference space. We then formulate the DGSEM for the nonconservative system and replace the volume integrals with a flux-differencing formulation to obtain the split-form DGSEM [25].

4.1 Mapping the Equations

We first subdivide the physical domain \(\varOmega \) into K non-overlapping unstructured quadrilateral elements. Each element is mapped from physical space onto a unit square element \(E=[-1,1]^2\) in computational space using transfinite interpolation with linear blending [32]. The mapping is given as

$$\begin{aligned} \vec {x} = \mathcal {X}(\vec {\xi }) \equiv X\hat{x} + Y\hat{y} \end{aligned}$$
(17)

with the coordinates in physical space \(\vec {x} = (x, y)^T = (x_1, x_2)\) and computational space \(\vec {\xi } = (\xi , \eta )^T = (\xi ^1, \xi ^2)\), respectively. From the mapping we directly calculate the covariant basis vectors

$$\begin{aligned} \begin{aligned} \vec {a}_1&= \frac{\partial \mathcal {X}}{\partial \xi } = X_{\xi }\hat{x} + Y_{\eta }\hat{y}\\ \vec {a}_2&= \frac{\partial \mathcal {X}}{\partial \eta } = X_{\eta }\hat{x} + Y_{\xi }\hat{x}\\ \vec {a}_3&= \hat{z} \end{aligned} \end{aligned}$$
(18)

that are tangential to the coordinate lines in computational space. The covariant basis vectors are then used to compute the Jacobian of the mapping

$$\begin{aligned} J = \vec {a}_1 \cdot (\vec {a}_2 \times \vec {a}_3) = X_{\xi }Y_{\eta } - Y_{\xi }X_{\eta } \end{aligned}$$
(19)

as well as the contravariant basis vectors normal to the coordinate lines

$$\begin{aligned} \begin{aligned} J\vec {a}_1&= \vec {a}_2 \times \vec {a}_3 = Y_{\eta }\hat{x} - X_{\eta }\hat{y}, \\ J\vec {a}_2&= \vec {a}_3 \times \vec {a}_1 = -Y_{\xi }\hat{x} + X_{\xi }\hat{y}. \end{aligned} \end{aligned}$$
(20)

To map the system of equations into computational space, we first define a block matrix with the metric terms (20) together with a \(6\times 6\) identity matrix \(\underline{ I}\) to simplify the notation

$$\begin{aligned} \mathfrak {M} = \begin{bmatrix} Ja_1^1\underline{ I} &{} Ja_1^2\underline{ I} \\ Ja_2^1\underline{ I} &{} Ja_2^2\underline{ I} \end{bmatrix}. \end{aligned}$$
(21)

We transform the divergence operator into computational space

$$\begin{aligned} \vec {\nabla }_x \cdot \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }} = \frac{1}{J} \vec {\nabla }_{\xi } \cdot \,{\mathop {\tilde{\textbf{f}}}\limits ^{\leftrightarrow }}, \quad \varvec{\phi } \circ \left( \vec {\nabla }_{x} \cdot \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) = \frac{1}{J} \varvec{\phi } \circ \left( \vec {\nabla }_{\xi } \cdot \,{\mathop {\tilde{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) \end{aligned}$$
(22)

using the contravariant block vectors for the flux and nonconservative terms

$$\begin{aligned} \,{\mathop {\tilde{\textbf{f}}}\limits ^{\leftrightarrow }} = \mathfrak {M}^T \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }}, \quad \,{\mathop {\tilde{\textbf{r}}}\limits ^{\leftrightarrow }} = \mathfrak {M}^T \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}. \end{aligned}$$
(23)

Applying transformation (22) to (2) then yields the transformed balance law in computational space

$$\begin{aligned} J\textbf{u}_t + \vec {\nabla }_{\xi } \cdot \,{\mathop {\tilde{\textbf{f}}}\limits ^{\leftrightarrow }} + \varvec{\phi } \circ \left( \vec {\nabla }_{\xi } \cdot \,{\mathop {\tilde{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) = 0. \end{aligned}$$
(24)

In order to obtain a free-stream preserving numerical method, the divergence of a constant flux must vanish such that the metric identities

$$\begin{aligned} \frac{\partial }{\partial \xi }J\vec {a}{}^{\,1} + \frac{\partial }{\partial \eta } J\vec {a}{}^{\,2} = 0 \end{aligned}$$
(25)

are satisfied discretely. That the metric identities hold in the discrete setting is a prerequisite for the preservation of steady-state solutions and the entropy conservation proof presented later in this work. In two space dimensions this is guaranteed for isoparametric boundaries, where the same polynomial order (or lower) from the DGSEM approximation is used to construct the mapping [31].

4.2 Nodal Discontinuous Galerkin Spectral Element Method

The numerical scheme developed in this work is based on a standard nodal collocation DGSEM formulation as described in the literature, see [28, 32]. In the following we formulate our DGSEM and extend it for nonconservative terms analogous to the numerical schemes developed in [20, 48].

We begin with the derivation of a weak formulation of (24), where we multiply the transformed equation with test functions \(\mathbf \varphi \) and integrate over the domain \(\varOmega \). For nonconservative systems the definition of weak solutions is rather difficult as the theory of distributions does not apply and classical conservative approaches may recover incorrect shock speeds. Instead we follow the derivation provided by Franquet and Perrier [20], where a weak formulation is obtained from integration-by-parts for the conservative fluxes, while the nonconservative term is defined as a Borel measure according to theory of Dal Maso et al.  [13]. For smooth solutions this measure corresponds to classical integration, while at discontinuities it must be evaluated as a line integral depending on a family of paths \(\upsilon \). The resulting weak formulation is then given by

$$\begin{aligned} \begin{aligned}&\left\langle J\textbf{u}_t,\varvec{\varphi }\right\rangle +\int \limits _{\partial E} \varvec{\varphi }^T \left( \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }} \cdot \vec {n}\right) \hat{s} \,\text {d}S - \left\langle \,{\mathop {\tilde{\textbf{f}}}\limits ^{\leftrightarrow }},\vec {\nabla }_{\xi }\varvec{\varphi }\right\rangle \\&\quad +\,\int \limits _{\partial E} \varvec{\varphi }^T \left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }\cdot \vec {n} \hat{s} \,\text {d}S + \left\langle \varvec{\phi }\circ \left( \vec {\nabla }_{\xi }\cdot \,{\mathop {\tilde{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ,\varvec{\varphi }\right\rangle = 0, \end{aligned} \end{aligned}$$
(26)

where \(\hat{s}\) denotes the differential surface element given by

$$\begin{aligned} \begin{aligned} \xi = \pm 1: \hat{s}(\eta ) = \left| J\vec {a}{}^{\,1}(\pm 1,\eta )\right| , \quad \eta = \pm 1: \hat{s}(\xi ) = \left| J\vec {a}{}^{\,2}(\xi ,\pm 1)\right| , \end{aligned} \end{aligned}$$
(27)

and \(\vec {n}\) is the outwards pointing unit normal vector in the physical space

$$\begin{aligned} \vec {n} = \frac{J\vec {a}{}^{\,i}}{\hat{s}}, \quad i=1,2. \end{aligned}$$
(28)

We introduce a notation where at each interface we denote the state of the primary element as \(``-\)” and the state of the secondary (neighboring) element as \(``+\)”. Accordingly, the physical normal vector \(\vec {n}\) is defined to point from \(``-\)” to \(``+\)”, which the following relation for the normal fluxes of neighboring elements at an interface

$$\begin{aligned} \vec {n} = \vec {n}^{\,-} = -\,\vec {n}^{\,+}. \end{aligned}$$
(29)

Furthermore, we introduced the inner product notation on the reference element, given for state and block vectors

$$\begin{aligned} \left\langle \textbf{u},\textbf{v}\right\rangle = \int \limits _{E} \textbf{u}^T \textbf{v}\text {d}\xi \text {d}\eta , \qquad \left\langle \,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }},\,{\mathop {{\textbf{g}}}\limits ^{\leftrightarrow }}\right\rangle = \int \limits _{E}\sum _{i=1}^2 \textbf{f}_i^{\,T} \textbf{g}_i \text {d}\xi \text {d}\eta \end{aligned}$$
(30)

respectively.

To account for the definition of the nonconservative term, we further introduced the surface numerical nonconservative term \(\varvec{\varphi }^T \left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }\) that satisfies the consistency condition

$$\begin{aligned} \left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }(\textbf{u},\textbf{u}) = 0 \end{aligned}$$
(31)

and the path-conservative property [42] so that at each element interface we obtain

$$\begin{aligned}{} & {} \left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }(\textbf{u}^-,\textbf{u}^+)\cdot \vec {n}{}^{\,-}+ \left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }(\textbf{u}^+,\textbf{u}^-)\cdot \vec {n}{}^{\,+}\nonumber \\{} & {} \quad = \int \limits _0^1 {A}^{NC}(\upsilon (s;\textbf{u}^-,\textbf{u}^+))\partial _s \upsilon (s;\textbf{u}^-,\textbf{u}^+){\text {ds}}, \end{aligned}$$
(32)

where \({A}^{NC}\) denotes the flux Jacobian of the nonconservative subsystem and \(\upsilon \) is a path connecting neighboring states \(\textbf{u}^-\) and \(\textbf{u}^+\) across a discontinuity, for complete details see [42]. The numerical nonconservative term in (26) is therefore equivalent to a fluctuation form [42], where for each element \(\left( \varvec{\phi }\circ \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }}\,\right) ^{\diamond }\cdot \vec {n}\) recovers the contributing fluctuations at the interface.

Next, we approximate the solution with a local tensor-product basis of polynomial degree N

$$\begin{aligned} u \approx U = \sum \limits _{i,j=0}^N U_{ij} \ell _i(\xi ) \ell _j(\eta ), \end{aligned}$$
(33)

where the basis is spanned by one-dimensional nodal Lagrange basis functions

$$\begin{aligned} \ell _j(\xi ) = \prod \limits _{i=0,i \ne j}^N \frac{\xi - \xi _i}{\xi _j - \xi _i}, \quad i,j=0,\ldots ,N, \end{aligned}$$
(34)

on the interval \(\xi \in [-\,1,1]\) with \(N+1\) interpolation nodes \(\{\xi _i\}_{i=0}^N\), located at the Legendre-Gauss-Lobatto (LGL) points. In the following, interpolated quantities at the LGL nodes are denoted with capital letters and the interpolation of a function by \(G = \mathbb {I}^N(g)\). We then use the basis functions to define the discrete derivative operator

$$\begin{aligned} \mathcal {D}_{ij}:=\left. \frac{\partial \ell _j}{\partial \xi }\right| _{\xi =\xi _i}, \quad i,j=0,\ldots ,N, \end{aligned}$$
(35)

apply a LGL quadrature rule to approximate the integrals present in the weak formulation (26) and collocate the interpolation and quadrature nodes. This yields the diagonal mass matrix

$$\begin{aligned} \mathcal {M} = \text {diag}(\omega _{\hspace{0.5pt}0},\ldots ,\omega _{N}), \end{aligned}$$
(36)

with the LGL quadrature weights \(\{\omega _i\}_{i=0}^N\). Using the Kronecker delta property of the Lagrange basis functions (34) we then introduce the discrete inner product notation

$$\begin{aligned} \left\langle f,g\right\rangle _N = \sum _{i,j=0}^N f_{ij} g_{ij} \omega _{i}\omega _{j} \equiv \sum _{i,j=0}^N f_{ij} g_{ij} \omega _{ij}. \end{aligned}$$
(37)

This specific choice of interpolation and differentiation operators possesses the diagonal norm SBP property for all polynomial orders N [23]

$$\begin{aligned} (\mathcal {M}\mathcal {D}) + (\mathcal {M}\mathcal {D})^T = \mathcal {Q} + \mathcal {Q}^T = \mathcal {B}, \end{aligned}$$
(38)

where we introduced the SBP matrix \(\mathcal {Q}\) and the boundary matrix \(\mathcal {B}\)

$$\begin{aligned} \mathcal {Q}=\mathcal {M}\mathcal {D}, \qquad \mathcal {B} = \text {diag}(-1,0,\ldots ,0,1). \end{aligned}$$
(39)

This property will be necessary to prove entropy stability, as it allows us to mimic integration-by-parts and enables the extended Gauss Law in the discrete case [33].

We introduce polynomial approximations for the solution variables, fluxes, test functions and the nonconservative terms as well as LGL quadrature to obtain a discrete version of (26)

$$\begin{aligned} \begin{aligned}&\left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N} + \int \limits _{\partial E,N} \varvec{\varphi }^T \textbf{F}_n \hat{s} \,\,{\text {dS}} - \left\langle \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }},\vec {\nabla }_{\xi }\varvec{\varphi }\right\rangle _{\!N}\\&\quad +\, \int \limits _{\partial E,N} \varvec{\varphi }^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }\cdot \vec {n} \hat{s} \,\text {d}S + \left\langle \varvec{\varPhi }\circ \left( \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})\right) ,\varvec{\varphi }\right\rangle _{\!N} = 0, \end{aligned} \end{aligned}$$
(40)

where capital letters denote the discrete approximation and the surface fluxes \(\smash {\,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}\cdot \vec {n}}\) and numerical nonconservative terms \({(\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond }\cdot \vec {n}}\) are replaced by the surface normal fluxes \(\smash {\textbf{F}_n}\) and surface numerical nonconservative terms \(\smash {(\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond }_n}\). Since the physical fluxes are not uniquely defined at the discontinuous interfaces, we replace the surface normal flux \(\textbf{F}_n\) by a surface numerical flux \(\textbf{F}_n^*\), to resolve the discontinuity such that we obtain the discrete weak formulation

$$\begin{aligned} \begin{aligned}&\left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N} + \int \limits _{\partial E,N} \varvec{\varphi }^T \textbf{F}^*_n \hat{s} \,\,{\text {dS}} - \left\langle \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }},\vec {\nabla }_{\xi }\varvec{\varphi }\right\rangle _{\!N}\\&\quad +\, \int \limits _{\partial E,N} \varvec{\varphi }^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S + \left\langle \varvec{\varPhi }\circ \left( \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})\right) ,\varvec{\varphi }\right\rangle _{\!N} = 0. \end{aligned} \end{aligned}$$
(41)

We then mimic integration-by-parts with the the SBP property (38) and apply the discrete extended Gauss Law from [33] on the flux terms to obtain the strong form DGSEM approximation of (24)

$$\begin{aligned} \begin{aligned}&\left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N} + \int \limits _{\partial E,N} \varvec{\varphi }^T \{ \textbf{F}_n^* - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}),\varvec{\varphi }\right\rangle _{\!N}\\&\quad + \, \int \limits _{\partial E,N} \varvec{\varphi }^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S + \left\langle \varvec{\varPhi }\circ \left( \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})\right) ,\varvec{\varphi }\right\rangle _{\!N} = 0. \end{aligned} \end{aligned}$$
(42)

The method (42) serves as a baseline from which we will continue to construct an entropy stable approximation using a special combination of differencing operator, numerical flux, and numerical nonconservative term.

4.3 Flux-Differencing Formulation

To obtain an entropy stable discretization, we make use of another property that diagonal norm SBP operators have and rewrite the flux divergence term in the volume into a flux differencing formulation [5, 25]

$$\begin{aligned} \begin{aligned}&\vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}) \approx \vec {\mathbb {D}} \cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#} = 2\sum _{m=0}^{N} \mathcal {D}_{im} \left( \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U}_{ij}, \textbf{U}_{mj}) \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,1}\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \\&\quad +\,2\sum _{m=0}^{N} \mathcal {D}_{jm} \left( \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U}_{ij}, \textbf{U}_{im}) \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,2}\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) , \end{aligned} \end{aligned}$$
(43)

with the consistent and symmetric two-point flux \(\textbf{F}^{\#}\) and arithmetic mean values given by

$$\begin{aligned} \left\{ \hspace{-2pt}\left\{ \cdot \right\} \hspace{-2pt}\right\} _{(i,m)j} = \frac{1}{2} \left( \left( \cdot \right) _{ij} + (\cdot )_{mj}\right) , \quad \left\{ \hspace{-2pt}\left\{ \cdot \right\} \hspace{-2pt}\right\} _{i\left( j,m\right) } = \frac{1}{2} \left( \left( \cdot \right) _{ij} + \left( \cdot \right) _{im}\right) . \end{aligned}$$
(44)

This formulation was originally found by Fisher et al.  [18], who showed that a diagonal norm SBP operator can be rewritten into a finite volume type flux-differencing formulation on a staggered grid. From a particular choice of the two-point volume flux, the formulation (43) recovers different alternative split-forms of the original partial differential equation that can improve robustness of the scheme [25]. The formulation in (43) also extends two-point finite-volume fluxes to high-order [25] and recovers an entropy conservative volume discretization if an entropy conservative two-point flux is used [5, 24]. Recently, this approach has been applied successfully to create entropy stable DG methods for the shallow water equation [26, 57, 61], magnetohydrodynamics equations [3, 51] and the compressible Navier–Stokes equations [8, 60].

In [48, 56] it was shown that the flux-differencing formulation can also be extended to nonconservative systems such that we can apply the same discretization technique on the conservative and nonconservative parts of the equation. This ensures that both terms are evaluated in the same way, which will be necessary to obtain entropy conservation and discrete preservation of steady-state solutions. Therefore, we introduce the following flux-differencing formulation for the nonconservative volume term

$$\begin{aligned} \begin{aligned}&\varvec{\varPhi }\circ \left( \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})\right) \approx \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}= \sum _{m=0}^{N} 2\mathcal {D}_{im}\left( (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}(\textbf{U}_{ij},\textbf{U}_{mj}) \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,1}\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \\&\quad +\, \sum _{m=0}^{N} 2\mathcal {D}_{jm}\left( (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}(\textbf{U}_{ij},\textbf{U}_{im}) \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,2}\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) , \end{aligned} \end{aligned}$$
(45)

where \((\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}\) denotes a two-point volume numerical nonconservative term with a given structure

$$\begin{aligned} \begin{aligned} (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}(\textbf{U}^{-},\textbf{U}^{+})&=\varvec{\varPhi }^{\#}(\textbf{U}^{-},\textbf{U}^{+})\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U}^{-},\textbf{U}^{+}) +\varvec{\varPhi }^{\#}(\textbf{U}^{+},\textbf{U}^{-})\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U}^{+},\textbf{U}^{-})\\&\quad -\, \left( \varvec{\varPhi }^{\#}(\textbf{U}^{-},\textbf{U}^{+}) + \varvec{\varPhi }^{\#}(\textbf{U}^{+},\textbf{U}^{-}) \right) \circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}(\textbf{U}^{-}), \end{aligned} \end{aligned}$$
(46)

where \(\varvec{\varPhi }^{\#}\) and \(\,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^{\#}\) are vector-valued functions. It was shown in [56, Lemma 2] that under the consistency conditions

$$\begin{aligned} \begin{aligned} 2\varvec{\varPhi }^{\#}(\textbf{U},\textbf{U})&= \varvec{\varPhi }(\textbf{U}) \\ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U},\textbf{U})&= \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}(\textbf{U}) \end{aligned} \end{aligned}$$
(47)

the volume numerical nonconservative term (46) provides a consistent volume discretization of the nonconservative term. For more details about the flux-differencing formulation for nonconservative terms we refer to [48, 56].

Inserting the flux-differencing formulations (43) and (45) into the discrete strong formulation (42) then yields the split-form DGSEM

$$\begin{aligned} \begin{aligned}&\left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N} + \int \limits _{\partial E,N} \varvec{\varphi }^T \{ \textbf{F}_n^* - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#},\varvec{\varphi }\right\rangle _{\!N}\\&\quad +\, \int \limits _{\partial E,N} \varvec{\varphi }^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#},\varvec{\varphi }\right\rangle _{\!N} = 0. \end{aligned} \end{aligned}$$
(48)

With method (48) we are now equipped to derive the necessary components \(\textbf{F}^{\,\#}\), \(\textbf{F}^{\,*}\) and \((\varvec{\varPhi } \circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#}\), \((\varvec{\varPhi } \circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond }\) to first create an entropy conservative and well-balanced scheme, and from that, a scheme that is entropy stable.

5 Entropy Conservative DGSEM

To show that the scheme is entropy conservative we use the approach described in [3, 57, 60] and mimic the continuous entropy analysis of Sect. 3 in the discrete setting. First, we contract the split-form DGSEM (48) into entropy space by setting the test function to the interpolated entropy variables \(\textbf{W}\)

$$\begin{aligned} \begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\textbf{W}\right\rangle _{\!N} +&\int \limits _{\partial E,N} \textbf{W}^T \{ \textbf{F}_n^* - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#},\textbf{W}\right\rangle _{\!N} \\+&\int \limits _{\partial E,N} \textbf{W}^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#},\textbf{W}\right\rangle _{\!N} = 0. \end{aligned} \end{aligned}$$
(49)

5.1 Time Derivative

As we are interested in the semi-discrete analysis, we assume that the chain rule with respect to differentiation in time holds and examine the time derivative term in (49) to obtain

$$\begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\textbf{W}\right\rangle _{\!N} = \sum \limits _{i,j=0}^{N} J_{ij}\omega _{ij}\textbf{W}_{ij}^T\frac{{\text {d}}\textbf{U}_{ij}}{{\text {dt}}}= \sum \limits _{i,j=0}^{N} J_{ij}\omega _{ij}\frac{{\text {d}}S_{ij}}{{\text {dt}}} = \left\langle \mathbb {I}^N(J)S_t,1\right\rangle _{\!N}. \end{aligned}$$
(50)

From (50) we see that the rate of entropy change for a single element depends solely on the remaining surface and volume contributions. To obtain the total entropy, we sum over the all K elements in the domain \(\varOmega \)

$$\begin{aligned} \frac{\text {d}\bar{\text {S}}}{{\text {dt}}} = \sum _{k=1}^K \left\langle \mathbb {I}^N(J)^kS_t^k,1\right\rangle _{\!N}. \end{aligned}$$
(51)

To demonstrate discrete entropy conservation, we will show that the entropy conservation law (14) is satisfied in a discrete sense by the split-form approximation (48). Assuming a closed system, the second law of thermodynamics states that the entropy flux at the boundaries vanishes and the total entropy must be conserved

$$\begin{aligned} \frac{\text {d}\bar{\text {S}}}{{\text {dt}}} = 0. \end{aligned}$$
(52)

5.2 Discrete Entropy Flux

The contraction of the physical flux nonconservative terms to the entropy flux in (12) is challenging as it depends on the chain rule, which in general does not hold in the discrete setting [46]. Therefore, we apply an alternative strategy to find a combination of numerical fluxes and numerical nonconservative terms that recover the entropy flux on a discrete level. To reduce the degrees of freedom in this derivation we assume a fixed discretization of the numerical nonconservative term

$$\begin{aligned} (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond } = \frac{1}{2}\varvec{\varPhi }^-\circ \llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket = \frac{1}{2}\varvec{\varPhi }^-\circ \left( \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^+ - \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^-\right) , \end{aligned}$$
(53)

which can be derived from the path-conservative property, using a linear path and satisfies the consistency conditions (47). The task now reduces to finding an accompanying entropy conservative (EC) numerical flux \(\,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }}{}^{\,EC}\).

To derive such EC fluxes we require discrete entropy conservation in a finite volume context similar to [14, 59]. These finite volume type numerical fluxes are then directly applicable to the split-form DGSEM (43) as the volume contribution relates to a subcell finite volume scheme and elements are coupled via numerical fluxes on the surface [18, 25]. We consider a single interface between neighboring finite volume cells with distinct cell averages denoted by \(``-\)” and \(``+\)” and cell size \(\varDelta x\). We introduce a notation to define jumps and arithmetic averages of cell values across the interface

$$\begin{aligned} \llbracket \cdot \rrbracket = (\cdot )^+ -(\cdot )^-, \quad \left\{ \hspace{-2pt}\left\{ \cdot \right\} \hspace{-2pt}\right\} = \frac{1}{2}\left( (\cdot )^+ + (\cdot )^-\right) . \end{aligned}$$
(54)

The respective finite volume formulation of system (2) with the numerical nonconservative term (53) is given by

$$\begin{aligned} \varDelta x \frac{\partial }{\partial t}\textbf{u}^- = \textbf{f}^- - \textbf{f}^* - \varvec{\phi }^-\circ \llbracket \textbf{r}\rrbracket \qquad \varDelta x \frac{\partial }{\partial t}\textbf{u}^+ = \textbf{f}^* - \textbf{f}^+ - \varvec{\phi }^+\circ \llbracket \textbf{r}\rrbracket , \end{aligned}$$
(55)

at each side of the interface. To obtain an entropy conservation statement we follow the continuous analysis and contract (55) with the entropy variables. As before, we assume time continuity such that the chain rule in time holds to obtain the rate of entropy change in each cell

$$\begin{aligned} \varDelta x \frac{\partial }{\partial t}{} {\textbf {S}}^-= & {} ({\textbf {w}}^-)^T \left( {\textbf {f}}^- - {\textbf {f}}^* - \frac{\varvec{\phi }^-\circ \llbracket {\textbf {r}}\rrbracket }{2}\right) , \nonumber \\{} \varDelta x \frac{\partial }{\partial t}{} {\textbf {S}}^+= & {} ({\textbf {w}}^+)^T\left( {\textbf {f}}^* - {\textbf {f}}^+ - \frac{\varvec{\phi }^+\circ \llbracket {\textbf {r}}\rrbracket }{2}\right) . \end{aligned}$$
(56)

We then sum over both cells to find the total discrete entropy change over the interface

$$\begin{aligned} \varDelta x \frac{\partial }{\partial t}\left( \textbf{S}^-+\textbf{S}^+\right) = \llbracket \textbf{w}\rrbracket ^T\textbf{f}^* - \llbracket \textbf{w}^T\textbf{f}\rrbracket - \left\{ \hspace{-2pt}\left\{ \textbf{w}\circ \varvec{\phi }\right\} \hspace{-2pt}\right\} ^T\llbracket \textbf{r}\rrbracket . \end{aligned}$$
(57)

From (57) we see that a discrete version of the integral entropy conservation law (15) holds provided the right hand side recovers the jump of the entropy flux over the interface

$$\begin{aligned} \llbracket \textbf{w}\rrbracket ^T\textbf{f}^* - \llbracket \textbf{w}^T\textbf{f}\rrbracket - \left\{ \hspace{-2pt}\left\{ \textbf{w}\circ \varvec{\phi }\right\} \hspace{-2pt}\right\} ^T\llbracket \textbf{r}\rrbracket \overset{!}{=}\ - \llbracket \vec {f}{}^{\,S} \rrbracket . \end{aligned}$$
(58)

Manipulating (58) and subsequently substituting the definition of the entropy potential (13) we find an entropy conservation condition for the numerical flux

$$\begin{aligned} \llbracket \textbf{w}\rrbracket ^T\,{\mathop {{\textbf{f}}}\limits ^{\leftrightarrow }}{}^{\,EC} = \llbracket \vec {\psi } \rrbracket - \left\{ \hspace{-2pt}\left\{ \textbf{w}\circ \varvec{\phi }\right\} \hspace{-2pt}\right\} ^T\llbracket \,{\mathop {{\textbf{r}}}\limits ^{\leftrightarrow }} \rrbracket . \end{aligned}$$
(59)

Accordingly, a numerical flux that satisfies this condition in combination with the numerical nonconservative term (53) recovers the integral entropy conservation law (15) and is therefore defined as an EC numerical flux.

With this in mind we create an EC split-form DGSEM by selecting a proper combination of EC fluxes and nonconservative terms for both volume and surface contributions. In general the split-form offers flexibility in choosing different discretizations on the volume and the surface. However, we note that the numerical nonconservative term (53) can also be applied in the volume as it corresponds to the structure given in (46) when setting

$$\begin{aligned} \varvec{\varPhi }^{\#}(\textbf{U}^{-},\textbf{U}^{+}) = \frac{1}{2}\varvec{\varPhi }^-, \quad \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^{\#}(\textbf{U}^{-},\textbf{U}^{+}) = \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}{}^+ \end{aligned}$$
(60)

and satisfies the consistency conditions (47). This circumvents the need for different surface and volume fluxes, such that our method is given by

$$\begin{aligned} \begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\textbf{W}\right\rangle _{\!N} +&\int \limits _{\partial E,N} \textbf{W}^T \{ \textbf{F}_n^{EC} - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC},\textbf{W}\right\rangle _{\!N} \\+&\int \limits _{\partial E,N} \textbf{W}^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond },\textbf{W}\right\rangle _{\!N} = 0. \end{aligned} \end{aligned}$$
(61)

We then set the following EC numerical fluxes

$$\begin{aligned} \begin{aligned} \textbf{F}_1^{EC}:= \begin{pmatrix} \left\{ \hspace{-2pt}\left\{ h_1u_1\right\} \hspace{-2pt}\right\} _{(i,m),j} \\ \left\{ \hspace{-2pt}\left\{ h_1u_1\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ u_1\right\} \hspace{-2pt}\right\} _{(i,m),j} + g\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} ^2_{(i,m),j} - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} _{(i,m),j}\\ \left\{ \hspace{-2pt}\left\{ h_1u_1\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ v_1\right\} \hspace{-2pt}\right\} _{(i,m),j}\\ \left\{ \hspace{-2pt}\left\{ h_2u_2\right\} \hspace{-2pt}\right\} _{(i,m),j} \\ \left\{ \hspace{-2pt}\left\{ h_2u_2\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ u_2\right\} \hspace{-2pt}\right\} _{(i,m),j} + g\left\{ \hspace{-2pt}\left\{ h_2\right\} \hspace{-2pt}\right\} ^2_{(i,m),j} - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_2^2\right\} \hspace{-2pt}\right\} _{(i,m),j}\\ \left\{ \hspace{-2pt}\left\{ h_2u_2\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ v_2\right\} \hspace{-2pt}\right\} _{(i,m),j} \end{pmatrix}, \\ \textbf{F}_2^{EC}:= \begin{pmatrix} \left\{ \hspace{-2pt}\left\{ h_1v_1\right\} \hspace{-2pt}\right\} _{(i,m),j} \\ \left\{ \hspace{-2pt}\left\{ h_1v_1\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ u_1\right\} \hspace{-2pt}\right\} _{(i,m),j} \\ \left\{ \hspace{-2pt}\left\{ h_1v_1\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ v_1\right\} \hspace{-2pt}\right\} _{(i,m),j} + g\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} ^2_{(i,m),j} - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} _{(i,m),j}\\ \left\{ \hspace{-2pt}\left\{ h_2v_2\right\} \hspace{-2pt}\right\} _{(i,m),j} \\ \left\{ \hspace{-2pt}\left\{ h_2v_2\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ u_2\right\} \hspace{-2pt}\right\} _{(i,m),j}\\ \left\{ \hspace{-2pt}\left\{ h_2v_2\right\} \hspace{-2pt}\right\} _{(i,m),j}\left\{ \hspace{-2pt}\left\{ v_2\right\} \hspace{-2pt}\right\} _{(i,m),j} + g\left\{ \hspace{-2pt}\left\{ h_2\right\} \hspace{-2pt}\right\} ^2_{(i,m),j} - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_2^2\right\} \hspace{-2pt}\right\} _{(i,m),j} \end{pmatrix}, \end{aligned} \end{aligned}$$
(62)

which fulfill the entropy conservation condition (59)

$$\begin{aligned} \llbracket \textbf{W}\rrbracket ^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC} = \llbracket \vec {\varPsi } \rrbracket -\left\{ \hspace{-2pt}\left\{ \textbf{W}\circ \varvec{\varPhi }\right\} \hspace{-2pt}\right\} ^T\llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket , \end{aligned}$$

as shown in Appendix A for \(\textbf{F}_1^{EC}\). This EC flux (62) corresponds to the EC volume flux found by Wintermeyer et al.  [57] for the standard SWE within each layer. The reason behind this is that the conservative part of the two-layer model (1) corresponds to the standard shallow water system in each layer and only the nonconservative terms differ. That is, the EC split-form DGSEM (61) is directly applicable to the standard SWE if one selects the EC flux from [57] and the numerical nonconservative term (53). For the standard SWE there are different combinations of entropy conserving fluxes and nonconservative terms that satisfy an entropy conservation condition see, e.g., [19, 45, 57]. To obtain a scheme that remains well-balanced on curvilinear meshes, in [57] it was deemed necessary to choose a different form of EC fluxes in the volume and on the surface. However, we will show in Sect. 5.5 that this is not necessary and well-balancedness even in the curvilinear case can be achieved using the same path-conservative discretization of the nonconservative term (53) and the EC flux (62) for both volume and surface contributions, which results in a simpler method.

As shown in Gassner et al. [25, Lemma 1], depending on the product of averages in the numerical volume flux the split-form DGSEM (48) recovers different discrete split-forms of the governing equations. Using this flexible relationship, the specific averaging of the pressure term in (62) produces a split-form that recovers the product rule \(\frac{1}{2}h^2_x = h h_x\) in the discrete setting. This analogous discretization of the pressure and nonconservative term is the key to demonstrable well-balancedness in the formulation (61). Well-balancedness follows directly for the lake-at-rest steady state, where \(h_1\) and \(h_2+b\) are constants, as the combination of the pressure and nonconservative terms yield the contributions \(h_1(h_1+h_2+b)_x\) and \(h_2(rh_1+h_2+b)_x\) in the upper and lower layer, respectively. These terms individually vanish provided the metric identities (25) are satisfied. We delay the complete discussion and proof of the well-balancedness property until Sect. 5.5.

First, we examine the volume and surface contributions separately to demonstrate discrete entropy conservation for approximation (61). We start with the volume parts and show that for the given choice of two-point volume flux (62) and numerical nonconservative term (53) they become the entropy flux evaluated at the boundary, when contracted into entropy space. Using the same combination of EC flux and numerical nonconservative term the total surface contribution then cancels in entropy space, which shows entropy conservation. Furthermore, we demonstrate that by using an analogous discretization for the pressure and nonconservative terms yields a method that is well-balanced.

5.3 Volume Contribution

Lemma 1

(Entropy contribution of the curvilinear volume terms) The curvilinear volume contributions of the split-form DGSEM (48) with the EC volume flux (62) contracted into entropy space become the entropy flux evaluated at the interface.

$$\begin{aligned} \begin{aligned} \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC},\textbf{W}\right\rangle _{\!N} + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond },\textbf{W}\right\rangle _{\!N} = \int \limits _{\partial E,N} \left( \vec {F}{}^{\,S}\cdot \vec {n}\right) \hat{s} \,{\text {dS}} \end{aligned} \end{aligned}$$
(63)

Proof

See Appendix B. \(\square \)

Remark 1

The proof requires the SBP property (38), the entropy conservation condition (59), and that the metric identities (25) are satisfied discretely.

The result from Lemma 1 shows that the volume contributions from the flux and nonconservative terms cancel in entropy space and become the entropy flux evaluated at the boundary. Therefore, the volume parts do not contribute to the total discrete entropy and the entropy balance is entirely dependent on the surface contributions.

5.4 Surface Contribution

On the surface we select the same EC numerical flux as in the volume. From Lemma 1 we know that the volume contributions move onto the surface such that the change in discrete entropy depends solely on the surface terms. So, we assemble the surface contributions for a single element

$$\begin{aligned} \begin{aligned} \varGamma _k&=\int \limits _{\partial E_k,N} \textbf{W}^T \{ \textbf{F}_n^{EC} - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \int \limits _{\partial E_k,N}\left( \vec {F}{}^{\,S}\cdot \vec {n}\right) \hat{s}\,{\text {dS}} \\&\quad +\, \int \limits _{\partial E,N} \textbf{W}^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond }_n \hat{s} \,\text {d}S, \quad k = 1,\ldots ,K. \end{aligned} \end{aligned}$$
(64)

To obtain the total discrete entropy as described by (51) we sum over all elements \(k=1,\ldots ,K\). Due to the discontinuous approximation, summing over the elements creates jumps in the fluxes, nonconservative terms and entropy variables, whereas the numerical surface fluxes are defined uniquely at each interface.

After summing over the elements, we examine the terms in the surface integrals (64) separately. Starting with the physical flux term we obtain jumps in the flux and entropy variables and use that the numerical flux is unique at the interface to have

$$\begin{aligned} \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \textbf{W}^T \{ \textbf{F}_n^{EC} - \textbf{F}_n\} \hat{s} \,{\text {dS}} = \sum _{\text {faces}} \int \limits _{N} \left\{ \llbracket \textbf{W}\rrbracket ^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC} - \llbracket \textbf{W}^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }} \rrbracket \right\} \cdot \vec {n}\hat{s} \,{\text {dS}} . \end{aligned}$$
(65)

In a similar way summing over the second integral generates a jump in the entropy flux

$$\begin{aligned} \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \left( \vec {F}{}^{\,S}\cdot \vec {n}\right) \hat{s} \,{\text {dS}} = \sum _{\text {faces}} \int \limits _{N} \llbracket \vec {F}{}^{\,S} \rrbracket \cdot \vec {n} \hat{s} \,{\text {dS}} . \end{aligned}$$
(66)

The third integral in (64) contains the the numerical nonconservative term (53), which is non-unique at the interface. In the following we examine the total surface contribution of the nonconservative parts after summing over the interfaces.

Lemma 2

(Surface contribution of the numerical nonconservative term) Setting the numerical nonconservative term to (53)

$$\begin{aligned} \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) ^{\diamond } = \frac{1}{2}\varvec{\varPhi }^-\circ \llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket \end{aligned}$$

yields the total surface contribution of the nonconservative terms

$$\begin{aligned} \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \textbf{W}^T \left( \varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}\right) _n^{\diamond } \hat{s} \,{\text {dS}} = \sum _{\text {faces}} \int \limits _{N} \left\{ \hspace{-2pt}\left\{ \textbf{W}\circ \varvec{\varPhi }\right\} \hspace{-2pt}\right\} ^T\llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket \cdot \vec {n}\hat{s} \,{\text {dS}} . \end{aligned}$$
(67)

Proof

The total surface contribution from the nonconservative terms in (64) is given by

$$\begin{aligned} \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \textbf{W}^T (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})_n^{\diamond } \hat{s} \,{\text {dS}} . \end{aligned}$$
(68)

Introducing the definition for the numerical nonconservative term (53) into (64) and examining the nonconservative contribution, where “–” denotes the primary and “+” the secondary state, yields

$$\begin{aligned} \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \textbf{W}^T (\varvec{\varPhi }\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }})_n^{\diamond } \hat{s} \,{\text {dS}} = \sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} \textbf{W}^T \left( \frac{1}{2}\varvec{\varPhi }^-\circ \llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket \right) \cdot \vec {n} \hat{s} \,{\text {dS}} . \end{aligned}$$
(69)

To obtain the total interface contribution, we must take contributions from neighboring cells into account. Since the nonconservative term is not symmetric, we need to consider the different normal directions of neighboring cells as defined in (29). Summing over all elements, we then obtain the total contribution from the interfaces

$$\begin{aligned} \begin{aligned}&\sum \limits _{k=1}^{K}\int \limits _{\partial E_k,N} {\textbf {W}}^T (\varvec{\varPhi }\circ \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }})_n^{\diamond }\hat{s}\,{\text{ dS }} \\ {}&\quad =\sum \limits _{\text{ faces }}\int \limits _{N}\frac{1}{2} \left( \left( {\textbf {W}}^-\right) ^T \left( \varvec{\varPhi }^-\circ \llbracket \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }} \rrbracket \right) + \left( {\textbf {W}}^+\right) ^T \left( \varvec{\varPhi }^+\circ \llbracket \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }} \rrbracket \right) \right) \cdot \vec {n}\hat{s} \,{\text{ dS }} \\ {}&\quad = \sum \limits _{\text{ faces }}\int \limits _{N} \left\{ \hspace{-2pt}\left\{ {\textbf {W}}\circ \varvec{\varPhi }\right\} \hspace{-2pt}\right\} ^T \llbracket \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }} \rrbracket \cdot \vec {n}\hat{s}\,{\text{ dS }} , \end{aligned} \end{aligned}$$
(70)

where we used that due to anti-symmetry the different sign in the jump operator between \(``+\)” and \(``-\)” cancels with the sign flip from opposite normal directions. \(\square \)

Lemma 3

(Total entropy contribution of the surface terms) When summing over all elements, the total entropy contributions of the advective and nonconservative terms in (64) cancel on the surface

$$\begin{aligned} \sum _{k=1}^K\int \limits _{\partial E_k,N} \left( \textbf{W}^T \{ \textbf{F}_n^{EC} - \textbf{F}_n\} + \left( \vec {F}{}^{\,S}\cdot \vec {n}\right) + \textbf{W}^T (\varvec{\varPhi }\circ \textbf{R})_n^{\diamond } \right) \hat{s} \,{\text {dS}} = 0. \end{aligned}$$
(71)

Proof

First we write the fluxes in terms of jumps according to (65), (66) and apply the result of Lemma 2 for the nonconservative contributions to obtain

$$\begin{aligned} \sum _{\text {faces}} \int \limits _{N} \left\{ \llbracket \textbf{W}\rrbracket ^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC} - \llbracket \textbf{W}^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }} \rrbracket + \llbracket \vec {F}{}^{\,S} \rrbracket + \left\{ \hspace{-2pt}\left\{ \textbf{W}\circ \varvec{\varPhi }\right\} \hspace{-2pt}\right\} ^T\llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket \right\} \cdot \vec {n}\hat{s} \,{\text {dS}} . \end{aligned}$$
(72)

Now we substitute the definition of the entropy flux potential (13)

$$\begin{aligned} \sum _{\text {faces}} \int \limits _{N} \left\{ \llbracket \textbf{W}\rrbracket ^T \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC} - \llbracket \vec {\varPsi } \rrbracket + \left\{ \hspace{-2pt}\left\{ \textbf{W}\circ \varvec{\varPhi }\right\} \hspace{-2pt}\right\} ^T\llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket \right\} \cdot \vec {n}\hat{s}\,{\text {dS}} , \end{aligned}$$
(73)

and substitute the entropy conservation condition (59) to cancel the remaining terms and therefore show that the total entropy contribution on the surface is zero. \(\square \)

Now that the surface and volume contributions are examined, we have everything assembled and combine the previous results to show that approximation (48) is EC.

Theorem 1

(Entropy conservation of the curvilinear split-form DGSEM for the two-layer shallow water equations) The curvilinear split-form DGSEM for the two-layer shallow water equations

$$\begin{aligned} \begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N}&+ \int \limits _{\partial E,N} \varvec{\varphi }^T \{ \textbf{F}_n^* - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{\#},\varvec{\varphi }\right\rangle _{\!N}\\&+\, \int \limits _{\partial E,N} \varvec{\varphi }^T (\varvec{\varPhi }\circ \textbf{R})_n^{\diamond } \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\#},\varvec{\varphi }\right\rangle _{\!N} = 0 \end{aligned} \end{aligned}$$
(74)

with the EC flux (62) and the numerical nonconservative term (53)

$$\begin{aligned} \textbf{F}^{\#} = \textbf{F}^* = \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC}, \quad (\varvec{\varPhi }\circ \textbf{R})^{\#} = (\varvec{\varPhi }\circ \textbf{R})^{\diamond } = \frac{1}{2}\varvec{\varPhi }^- \circ \llbracket \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }} \rrbracket , \end{aligned}$$
(75)

is entropy conservative.

Proof

From Lemma 1, we have that the entropy contributions cancel in the volume and generate the entropy flux on the surface. Then we apply the result from Lemma 3 to show that the entropy contribution cancels on the surface and therefore entropy is conserved. \(\square \)

5.5 Well-Balancedness

In the following we show that in addition to entropy conservation, the discretization (74) is well-balanced as it satisfies the lake-at-rest condition (8).

Corollary 1

(Well-balancedness of the curvilinear split-form DGSEM for the two-layer shallow water equations) The EC curvilinear split-form DGSEM for the two-layer shallow water equations

$$\begin{aligned} \begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N}&+ \int \limits _{\partial E,N} \varvec{\varphi }^T \{ \textbf{F}_n^{EC} - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC},\varvec{\varphi }\right\rangle _{\!N}\\&+ \int \limits _{\partial E,N} \varvec{\varphi }^T (\varvec{\varPhi }\circ \textbf{R})_n^{\diamond } \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond },\varvec{\varphi }\right\rangle _{\!N} = 0 \end{aligned} \end{aligned}$$
(76)

preserves the lake-at-rest initial condition (8)

$$\begin{aligned} u_1,u_2,v_1,v_2 = 0, \quad b+h_2 = const, \quad h_1 = const. \end{aligned}$$

Proof

To show that the scheme is well-balanced, we take the same approach as demonstrating entropy conservation. That is we examine the volume and surface parts separately, to see that both contributions vanish for the lake-at-rest condition (8).

In the continuity equations in (4), it is clear that well-balancedness is directly satisfied as all products vanish due to the initial condition \(u_1,u_2,v_1,v_2=0\). Therefore, only the momentum equations need to be considered to show well-balancedness. For simplicity the proof is only demonstrated for the \(h_1u_1\)-equation as the other components are analogous.

Inserting the lake-at-rest conditions (8) into the EC approximation (74) and using that \(\smash {\left\{ \hspace{-2pt}\left\{ h\right\} \hspace{-2pt}\right\} ^2 - \frac{1}{2}\left\{ \hspace{-2pt}\left\{ h^2\right\} \hspace{-2pt}\right\} = \frac{h^+h^-}{2}}\), the volume flux contribution simplifies to

$$\begin{aligned} { \begin{aligned}&\left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC},\varvec{\varphi }_{h_1u_1}\right\rangle _{\!N}\\&= \sum \limits _{i,j=0}^N \omega _{ij} \left[ 2\sum _{m=0}^{N} \mathcal {D}_{im} \left( \left( g\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} _{(i,m)j}^2 - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} _{(i,m)j}\right) \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^1\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \right. \\&\quad +\, \left. 2\sum _{m=0}^{N} \mathcal {D}_{jm} \left( \left( g\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} _{i(j,m)}^2 - \frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} _{i(j,m)}\right) \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^2\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) \right] \\&= g\sum \limits _{i,j=0}^N \omega _{ij} \left( h_1\right) _{ij}\left[ \sum _{m=0}^{N} \mathcal {D}_{im} \left( \left( h_1\right) _{mj} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^1\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \right. \\&\quad +\, \left. \sum _{m=0}^{N} \mathcal {D}_{jm} \left( \left( h_1\right) _{im} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^2\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) \right] . \end{aligned} } \end{aligned}$$
(77)

The nonconservative volume contribution is then rewritten into a similar form. Therefore, we first use that the metric identities (25) are satisfied such that any terms containing only local contributions \(\smash {\varvec{\varPhi }_{ij}\circ \,{\mathop {{\textbf{R}}}\limits ^{\leftrightarrow }}_{ij} }\) vanish to obtain

$$\begin{aligned} \begin{aligned} \varvec{\varPhi }\circ \left( \vec {\nabla }_{\xi }\cdot \mathbb {I}^N(\,{\mathop {\tilde{{\textbf {R}}}}\limits ^{\leftrightarrow }})\right) \approx \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{{\textbf {R}}}}\limits ^{\leftrightarrow }})^{\diamond }&= \sum _{m=0}^{N} \mathcal {D}_{im} \left( \varvec{\varPhi }_{ij}\circ \left( \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }}_{mj} \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,1}\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \right) \\ {}&\quad +\,\sum _{m=0}^{N} \mathcal {D}_{jm} \left( \varvec{\varPhi }_{ij}\circ \left( \,{\mathop {{{\textbf {R}}}}\limits ^{\leftrightarrow }}_{im} \cdot \left\{ \hspace{-2pt}\left\{ J\vec {a}^{\,2}\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) \right) . \end{aligned} \end{aligned}$$
(78)

By expanding the nonconservative term, the contribution to the \(h_1u_1\)-equation is then given by

$$\begin{aligned} \begin{aligned} \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond },\varvec{\varphi }_{h_1u_1}\right\rangle _{\!N}&= g\sum \limits _{i,j=0}^N \omega _{ij} \left( h_1\right) _{ij} \left[ \sum _{m=0}^{N} \mathcal {D}_{im} \left( \left( b+h_2\right) _{mj} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^1\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \right. \\&\quad +\, \left. \sum _{m=0}^{N} \mathcal {D}_{jm} \left( \left( b+h_2\right) _{im} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^2\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) \right] . \end{aligned} \end{aligned}$$
(79)

Next we assemble the total volume contribution from (77) and (79). We first use that \(b+h_1+h_2=\text {constant}\), according to (8). Then, from the consistency of the derivative matrix and assuming that the metric identities (25) hold discretely, the volume parts vanish for the lake-at-rest condition

$$\begin{aligned} \begin{aligned} \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{{\textbf {F}}}}\limits ^{\leftrightarrow }}{}^{EC} ,\varvec{\varphi }_{h_1u_1}\right\rangle _{\!N} + {}&{} \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{{\textbf {R}}}}\limits ^{\leftrightarrow }})^{\diamond },\varvec{\varphi }_{h_1u_1}\right\rangle _{\!N}\\{}&{} = {} \sum \limits _{i,j=0}^N \omega _{ij} g\left( h_1\right) _{ij} \left[ \sum _{m=0}^{N} \mathcal {D}_{im} \left( \left( b+h_1+h_2\right) _{mj} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^1\right\} \hspace{-2pt}\right\} _{(i,m)j} \right) \right. \\ {}&{} \quad + \left. \sum _{m=0}^{N} \mathcal {D}_{jm} \left( \left( b+h_1+h_2\right) _{im} \left\{ \hspace{-2pt}\left\{ J\vec {a}_1^2\right\} \hspace{-2pt}\right\} _{i(j,m)} \right) \right] \\ {}&{} = {} \frac{g}{2}\left( b+h_1+h_2\right) \sum \limits _{i,j=0}^N \omega _{ij} \left( h_1\right) _{ij}\left[ \sum _{m=0}^{N} \mathcal {D}_{im} \left( \left( J\vec {a}_1^1\right) _{ij} +\left( J\vec {a}_1^1\right) _{mj} \right) \right. \\{}&{} {} \quad + \left. \sum _{m=0}^{N} \mathcal {D}_{jm} \left( \left( J\vec {a}_1^1\right) _{ij} +\left( J\vec {a}_1^1\right) _{im} \right) \right] \\ {}&{} = \frac{g}{2}\left( b+h_1+h_2\right) \sum \limits _{i,j=0}^N \omega _{ij} \left( h_1\right) _{ij}\left[ \sum _{m=0}^{N} \mathcal {D}_{im} \left( J\vec {a}_1^1\right) _{mj} + \sum _{m=0}^{N} \mathcal {D}_{jm} \left( J\vec {a}_1^1\right) _{im} \right] \\ {}&{} = 0. \end{aligned} \end{aligned}$$
(80)

The remaining surface contributions are given by

$$\begin{aligned} \int \limits _{\partial E,N} \varvec{\varphi }_{h_1u_1}^T \{ \textbf{F}_n^* - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \int \limits _{\partial E,N} \varvec{\varphi }_{h_1u_1}^T (\varvec{\varPhi }\circ \textbf{R})_n^{\diamond } \hat{s} \,{\text {dS}} . \end{aligned}$$
(81)

Expanding the terms in the \(h_1u_1\)-equation, again all products with velocity components vanish, and (81) simplifies to

$$\begin{aligned} \begin{aligned}&\int \limits _{\partial E,N} \left( g\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} ^2 -\frac{1}{2}g\left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} - \frac{1}{2}g\left( h_1^-\right) ^2 + \frac{1}{2}gh_1^-\llbracket b+h_2 \rrbracket \right) n_1\hat{s} \,{\text {dS}} \\&\quad = \frac{g}{2}\int \limits _{\partial E,N} \left( 2\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} ^2 - \left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} - \left( h_1^-\right) ^2 + h_1^-\llbracket b+h_2 \rrbracket \right) n_1\hat{s} \,{\text {dS}} . \end{aligned} \end{aligned}$$
(82)

The first three terms are rewritten as

$$\begin{aligned} 2\left\{ \hspace{-2pt}\left\{ h_1\right\} \hspace{-2pt}\right\} ^2 - \left\{ \hspace{-2pt}\left\{ h_1^2\right\} \hspace{-2pt}\right\} - \left( h_1^-\right) ^2 = h_1^-h_1^+ - (h_1^-)^2 = h_1^-\llbracket h_1 \rrbracket . \end{aligned}$$
(83)

Inserting this into (82) and using that \(\llbracket b+h_1+h_2 \rrbracket =0\) according to the lake-at-rest condition yields

$$\begin{aligned} \begin{aligned}&\frac{g}{2}\int \limits _{\partial E,N} \left( {h_1^-}\llbracket h_1 \rrbracket + {h_1^-}\llbracket b+h_2 \rrbracket \right) n_1\hat{s}\,{\text {dS}} \\&\quad = \frac{g}{2}\int \limits _{\partial E,N} \left( {h_1^-}\llbracket b+h_1+h_2 \rrbracket \right) n_1\hat{s}\,{\text {dS}} \\&\quad = 0, \end{aligned} \end{aligned}$$
(84)

which shows that the \(h_1u_1\)-equation satisfies (8) as both the volume and the surface contributions vanish. As the remaining momentum equations are analogous, this shows that the EC split-form DGSEM approximation (74) is well-balanced for the two-layer SWE.

\(\square \)

6 Entropy Stable DGSEM

The high-order approximation introduced in Theorem 1 satisfies the entropy conservation statement (14) in a semi-discrete setting. In the presence of discontinuities entropy conservation is not sufficient and instead the entropy inequality (16) must be satisfied to account for entropy dissipation at shocks. Following the idea of Tadmor  [55], we add numerical dissipation to the EC scheme from Theorem 1 to construct a discretization that is entropy stable (ES). We use the approach from [19] and create an ES flux by adding a local Lax–Friedrichs type dissipation to the EC flux

$$\begin{aligned} \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{ES} = \,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC} - \frac{1}{2}|\lambda _{max}|\bar{\textbf{H}}\llbracket \textbf{w}\rrbracket , \end{aligned}$$
(85)

where \(\lambda _{max}\) denotes an approximation of the maximum eigenvalue from (7) and \(\bar{\textbf{H}} = \textbf{w}_{\textbf{u}}\) is the symmetric positive definite entropy Jacobian matrix, evaluated at the arithmetic average value of the solution state at element interfaces. That the dissipation is dependent on the jump in entropy variables guarantees that entropy is dissipated at shocks and conserved for smooth solutions.

Theorem 2

(Entropy stability of the curvilinear split-form DGSEM for the two-layer shallow water equations) The curvilinear split-form DGSEM for the two-layer shallow water equations

$$\begin{aligned} \begin{aligned} \left\langle \mathbb {I}^N(J)\textbf{U}_t,\varvec{\varphi }\right\rangle _{\!N}&+ \int \limits _{\partial E,N} \varvec{\varphi }^T \{ \textbf{F}_n^{ES} - \textbf{F}_n\} \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot \,{\mathop {\tilde{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC},\varvec{\varphi }\right\rangle _{\!N}\\&+\,\int \limits _{\partial E,N} \varvec{\varphi }^T (\varvec{\varPhi }\circ \textbf{R})_n^{\diamond } \hat{s} \,{\text {dS}} + \left\langle \vec {\mathbb {D}}\cdot (\varvec{\varPhi }\circ \,{\mathop {\tilde{\textbf{R}}}\limits ^{\leftrightarrow }})^{\diamond },\varvec{\varphi }\right\rangle _{\!N} = 0 \end{aligned} \end{aligned}$$
(86)

is ES and well-balanced, when the ES flux (85) is used at element interfaces, together with the EC flux (75) on the volume and the numerical nonconservative term (53).

Proof

Entropy stability follows, provided (86) is more dissipative than the EC discretization (74). From Lemma 3 it is clear that the surface contributions of (86) vanish together with the EC flux part of (85) when contracted into entropy space. Therefore, the change in total entropy obtained from summing over all elements depends only on the remaining dissipation term

$$\begin{aligned} \frac{\text{ d }\bar{\text{ S }}}{{{\text{ dt }}}} =- \sum \limits _{\text{ faces }}\int \limits _{N} \left( \frac{1}{2}\llbracket {\textbf {W}}\rrbracket ^T|\lambda _{max}|\bar{{\textbf {H}}}\llbracket {\textbf {W}}\rrbracket \right) \cdot \vec {n}\hat{s}\,{\text{ dS }} \le 0. \end{aligned}$$
(87)

Using that \(\bar{\textbf{H}}\) is the Hessian of a convex function and therefore positive definite, the total entropy decreases in time and the discretization is therefore ES. For the lake-at-rest initial condition (8), the entropy variables (11) remain constant and the ES flux simplifies to the EC flux. The proof for well-balancedness then follows directly from Corollary 1. \(\square \)

7 Results

To demonstrate the theoretical findings and performance of the split-form DGSEM, we present and discuss results from several numerical experiments. First, we investigate convergence properties and show spectral convergence on a curvilinear mesh. Then we provide numerical evidence of the well-balanced property for discontinuous bottom topography and add a perturbation to this test case to demonstrate entropy stability. We then close the discussion with a more complex test, showcasing a partial dam break of a parabolic dam.

Numerical results are obtained using the open-source framework Trixi.jl [47, 53]. A reproducibility repository is available on Zenodo [16] and GitHubFootnote 1 for the results presented herein. All computations use a low storage five-stage fourth-order Runge–Kutta scheme of Carpenter and Kennedy [6] for time integration, with either fixed or CFL-based time stepping [12].

7.1 Convergence Results

We apply the method of manufactured solutions to demonstrate spectral convergence of the numerical approximation against an exact reference solution. To construct the exact solution, layer heights and bathymetry are defined by trigonometric functions and constants are used for the velocities

$$\begin{aligned} \begin{aligned} u_1&= 0.9, \quad u_2 = 1, \quad v_1 = 1, \quad v_2 = 0.9\\ b\hspace{3.5pt}&= 1 + 0.1 \cos (\pi x) \sin (\pi y)\\ h_1&= 2 + 0.1 \sin (2\pi x + t) \cos (2\pi y + t)\\ h_2&= 4 + 0.1 \cos (2\pi x + t) \sin (2\pi y + t) - h_1 - b. \end{aligned} \end{aligned}$$
(88)

The additional source terms for the manufactured solution are then computed using analytical derivatives with the gravitational constant set to \(g=10\) and the density ratio \(\frac{\rho _1}{\rho _2}=0.9\).

$$\begin{aligned} { src = \begin{pmatrix} h_1 \\ h_1u_1 \\ h_1v_1 \\ h_2 \\ h_2u_2 \\ h_2v_2 \end{pmatrix}_t + \begin{pmatrix} h_1u_1 \\ h_1u_1^2 + 0.5gh_1^2 \\ h_1u_1v_1 \\ h_2u_2 \\ h_2u_2^2 + 0.5gh_2^2 \\ h_2u_2v_2 \end{pmatrix}_x + \begin{pmatrix} h_1v_1 \\ h_1u_1v_1 \\ h_1v_1^2 + 0.5gh_1^2 \\ h_2v_2 \\ h_2u_2v_2 \\ h_2v_2^2 + 0.5gh_1^2 \end{pmatrix}_y + \begin{pmatrix} 0 \\ h_1g\left( b+h_2\right) _x \\ h_1g\left( b+h_2\right) _y \\ 0 \\ h_2g\left( b+\frac{\rho _1}{\rho _2}h_1\right) _x \\ h_2g\left( b+\frac{\rho _1}{\rho _2}h_1\right) _y \end{pmatrix}, }\nonumber \\ \end{aligned}$$
(89)
Fig. 1
figure 1

Curvilinear mesh adapted from [57] with polynomial degree \(N=6\) representation of interfaces used to test spectral convergence and well-balancedness

The resulting problem is solved in the domain \(\varOmega = \smash {[0,\sqrt{2}]^2}\) on the curvilinear mesh shown in Fig. 1 using polynomial degree \(N=6\) representation at element edges. Solutions are computed at the final time \(t_{end}=1\) for polynomial degrees up to \(N=30\) and a fixed timestep \(\varDelta t = 1/12{,}000\).

Spectral convergence for both the ES and EC approximations is shown in Fig. 2, which shows a semi-log plot for the error in \(L_2\) over the polynomial degree N. We see suboptimal convergence for the EC scheme for various polynomial degrees N. The characteristic pattern of suboptimal convergence at odd polynomial degree, reported in [23, 25] cannot be observed for curved elements, but does occur under the initial conditions (88) and resolution parameters on a mesh with straight element edges. The convergence behavior of the remaining quantities was similar and is not shown.

Fig. 2
figure 2

Spectral convergence of ES and EC approximations in space shown in a semi-log plot for the \(L_2\)-error in \(h_1u_1\) over the polynomial degree N. Results are obtained with a fixed timestep of \(\varDelta t = 1/12{,}000\) at the final time \(t_{end}=1\)

7.2 Well-Balanced

The next test is adapted from [57] and demonstrates that the approximation preserves the lake-at-rest condition (8) for the two-layer SWE with discontinuous bottom topography, according to Corollary 1. Again we use the curvilinear mesh from Fig. 1 and set the following lake-at-rest conditions with a discontinuous bottom topography at element \(3\times 2\) (see Fig. 3)

$$\begin{aligned} \begin{aligned}&H_1 = 0.6, \quad H_2 = 0.5, \quad u_1,u_2,v_1,v_2 = 0, \quad \frac{\rho _1}{\rho _2} = 0.9\\&b = {\left\{ \begin{array}{ll} 0.25 + 0.1\sin \left( 2\pi x\right) + 0.1\cos \left( 2\pi y\right) , &{} \text {for element }3\,\times \,2\\ 0, &{} \text {else}. \end{array}\right. } \end{aligned} \end{aligned}$$
(90)

We set periodic boundary conditions and compute the solution with a polynomial degree \(N=8\) and a CFL-based timestep up to the final time \(t_{end}=100\). In Fig. 3 we show the bottom topography and present the error in the absolute water height \(H_1=h_1+h_2+b\) relative to the lake-at-rest initial condition (90). Even after considerate time of \(t=100\), errors in \(H_1\) and \(H_2\) remain around machine precision and the steady-state is preserved. Similar results with errors near unit roundoff were also obtained with the ES flux. We collect these results in Table 1, where we present the maximum norm of the lake-at-rest error for the EC and ES fluxes.

Fig. 3
figure 3

a Discontinuous bottom topography in element \(3\times 2\) and b lake-at-rest error at time \(t_{end}=100\) for the EC flux with \(N=8\) and \(\text {CFL}=0.7\)

Table 1 Maximum norm of the lake-at-rest error in \(H_1\) and \(H_2\) for EC and ES fluxes at time \(t_{end}=100\) with polynomial degree \(N=8\) and \(\textit{CFL}=0.7\)

7.3 Well-Balanced Perturbation

Next, we introduce a small discontinuous perturbation to the lake-at-rest configuration described in Sect. 7.2, and examine the resulting change in entropy for both the EC and ES schemes. We adopt the previous setup, but modify the initial conditions (90) to include a discontinuous perturbation in \(h_1\) within a single element

$$\begin{aligned} H_1 = {\left\{ \begin{array}{ll} 0.65 &{} \text {for element }2\times 3 \\ 0.6 &{} \text {else.} \end{array}\right. } \end{aligned}$$
(91)

To demonstrate entropy conservation for the approximation (74) and entropy stability for (86), we evaluate the total discrete entropy change over all elements K in the domain \(\varOmega \) as

$$\begin{aligned} \dot{S}_{\varOmega }:= \frac{1}{V}\int \limits _{\varOmega }\dot{S}\,dV \approx \frac{1}{V}\sum _{k=1}^K\sum \limits _{i,j=0}^N J^k_{ij}\omega _{ij}\dot{S}^k_{ij}. \end{aligned}$$
(92)

Minimum, mean and maximum values of the entropy change for \(\smash {\,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{EC}}\) and \(\smash {\,{\mathop {{\textbf{F}}}\limits ^{\leftrightarrow }}{}^{ES}}\) within the time interval \(T=[0,0.1]\) are presented in Table 2. For the EC flux we see that entropy is conserved discretely with a total discrete entropy change around machine precision. For the ES flux on the other hand, we observe a noticeable change as entropy is dissipated at discontinuities. The solutions shows a strict decrease in entropy throughout the time interval T and therefore satisfies the entropy inequality (16).

Table 2 Mean, minimum and maximum values of total discrete entropy change for the EC and ES fluxes in the domain \(\varOmega \) within \(T=[0,1]\)

Furthermore, in Table 3, we present the conservation error in total mass evaluated as

$$\begin{aligned} {\varDelta {h}_{\varOmega }}:= \bigg |\frac{1}{V}\int \limits _{\varOmega }{h(t_{end})-h(t_0)}\,dV \bigg |\approx \bigg |\frac{1}{V}\sum _{k=1}^K\sum \limits _{i,j=0}^N J_{ij}^k\omega _{ij}\left( {h(t_{end})}_{ij}^k-{h(t_0)}_{ij}^k\right) \bigg | \end{aligned}$$
(93)

in both layers to demonstrate the conservation properties of the DGSEM. For both layers we observe conservation of the total mass, with conservation errors near machine precision.

Table 3 Change in total mass of \(h_1\) and \(h_2\) in the domain \(\varOmega \) for EC and ES fluxes at time \(t_{end}=0.1\)

7.4 Parabolic Dam Break

As a final test case, we apply the EC and ES schemes to a more complex problem with non-periodic BCs and demonstrate the solution behavior. We consider a partial dam break problem with initial conditions similar to [37, 43], but with a modified geometry featuring a parabolic dam to create a curvilinear boundary. The solution domain is given by \(\varOmega =[0,10]^2\), and includes a parabolic dam described by the centerline \(x=\frac{1}{25}y^2 - 0.4y + 6\), thickness \(d=0.2\) and a gap size of 1. We solve the problem on a curvilinear quadrilateral mesh containing 2239 elements and set the boundary conditions as slip-wall for the dam and Dirichlet for the outer boundaries. The curvilinear quadrilateral mesh was constructed using HOHQMesh.jl.Footnote 2 Initial conditions are chosen such that both layers are at rest, with a discontinuity across the dam.

$$\begin{aligned} \begin{aligned}&h_1, h_2 = {\left\{ \begin{array}{ll} 1.0 &{} \text {if} \quad x \le \frac{1}{25}y^2 - 0.4y + 6\\ 0.75 &{} \text {else} \end{array}\right. }\\&\frac{\rho _1}{\rho _2} = 0.25, \quad g = 1, \quad u_1,u_2,v_1,v_2 = 0. \end{aligned} \end{aligned}$$
(94)

In Fig. 4 a sequence of computational results for the ES scheme obtained with polynomial degree \(N=3\) is shown over time. After the initial dam break we observe a shock and rarefaction wave in both layers and the formation of vortices at the corners of the dam opening. Furthermore, in Fig. 5 we compare the result with the EC scheme without dissipation along the horizontal line \(y=5\). We see that both schemes do well in resolving the shock and rarefaction waves. However, the dissipation-free EC discretization shows significant spurious oscillations, due to lack of entropy dissipation at shocks. The ES scheme, on the other hand, introduces dissipation near the shocks and eliminates notable spurious oscillations. However, the additional dissipation is only designed to satisfy an entropy inequality and additional shock capturing is necessary to obtain a scheme that is oscillation free, while remaining ES, e.g., [27, 50].

Fig. 4
figure 4

Visualization of the dam break test case at different times for polynomial degree \(N=3\) and \(\varDelta t=4\cdot 10^{-4}\)

Fig. 5
figure 5

Layer heights along \(y=5\) for the EC and ES flux at \(t=0.25\) with polynomial degree \(N=3\) and \(\varDelta t=4\cdot 10^{-4}\)

8 Conclusion

We presented a high-order collocated nodal discontinuous Galerkin spectral element method (DGSEM) for the two-layer shallow water equations on curvilinear quadrilateral meshes. We first constructed the DGSEM in a specific way such that it is endowed with the summation-by-parts (SBP) property and introduced a path-conservative approximation of the nonconservative terms. Using the SBP property we then replaced the volume contributions with a flux-differencing formulation and demonstrated that the resulting approximation is entropy conservative (EC) for a specific combination of the EC flux and numerical nonconservative terms.

Applying an equivalent discretization for the pressure and nonconservative terms, we further showed that the method is well-balanced for discontinuous bottom topography. This interplay of the discrete conservative and nonconservative contributions in the volume and on the surface was crucial to guarantee well-balancedness together with entropy conservation on curvilinear domains. We found that the construction of a well-balanced approximation was possible with an identical form for these volume and surface terms in contrast to a result from Wintermeyer et al. [57]. From the dissipation free EC formulation we then constructed an entropy stable scheme by adding additional numerical dissipation at interfaces using a local Lax–Friedrichs type dissipation.

Finally, we provide numerical results for a number of academic test cases to demonstrate convergence, well-balancedness and entropy stability of the scheme. We then conclude with the application on a more complex parabolic dam break test and demonstrate the solution behavior. The numerical tests verify the analysis and show that the scheme is well-balanced and EC up to machine precision.

In future work, we aim to complement the scheme with wetting and drying techniques and add shock capturing methods to create a scheme that is oscillation-free. Furthermore, we aim to extend the present formulation to obtain an entropy stable and well-balanced discretization of the Savage–Hutter model [52] for submarine avalanches.