1 Introduction

Systems of nonlinear hyperbolic conservation laws cover a wide range of physical flow problems, e.g. modeled by the Euler or magneto-hydrodynamic (MHD) equations. Such flow phenomena are particularly interesting as they describe diverse physical processes like gas dynamics in chemical processes or plasma interactions in space, respectively [21, 23]. It is well-known that the solution of nonlinear hyperbolic systems can develop discontinuities, e.g. shocks, in finite time, regardless of the smoothness of the initial data [11]. Due to the complexity of nonlinear systems, we rely on numerical methods to approximate the solutions to such problems.

For low-order spatial approximations, like finite volume methods, discontinuous solutions are unproblematic because their inherent amount of numerical dissipation regularizes discontinuities naturally. However, for high-order numerical methods spurious oscillations near discontinuities, i.e. Gibbs phenomenon [13], arise. These unphysical overshoots might lead to unphysical solution states, e.g. negative density or pressure. Over the decades, many counter mechanisms have been developed to control overshoots and stabilize high-order approximations in shocked regions. Altogether, these methods can be subdivided into three main categories, which are slope limiters [3, 4, 12, 14, 15, 31], artificial dissipation techniques [7, 16,17,18, 28], and solution filters [2, 7, 27, 29].

In this work, we consider a shock capturing method that uses the global smoothness increasing accuracy conserving (SIAC) filter, a filter that has received much attention in the context of postprocessing data produced by discontinuous Galerkin approximations, see e.g. [27, 29, 35]. The SIAC filter increases smoothness by convolving the approximate solution with an appropriate smooth kernel function, e.g. B-Splines [19, 29] or Dirac-delta polynomial approximations, e.g. [34]. The accuracy conservation is more technical and is related to the fundamental building block of the discontinuous Galerkin solution space(s) and its solution ansatz [9]. The filter kernel is designed to reproduce certain polynomials orders by convolution, for example m. Consider a DG approximation that uses a polynomial solution space of N. If the filter is designed to recover a larger family of polynomial orders, i.e. \(m > N\), then the filter conserves the accuracy of the approximation. If the filter recovers a smaller family of polynomial orders, \(m < N\), then the accuracy of the overall approximation is bound by the filter accuracy. Typically, such SIAC filters were designed to obtain super-convergence in a post-processing step by a convolution of the numerical approximation against a specifically designed kernel function once at the final time [5, 9, 19, 26, 29, 33]. However, recent work has applied the SIAC filter as a shock capturing and/or regularization of general discontinuities strategy during the computation of the approximate solution for global spectral collocation methods [34, 37]. For such spectral methods, the SIAC filter is suitable to apply in shocked regions because said filter can recover full accuracy away from shocks, see e.g [19]. The filter for global spectral collocation methods is constructed with a Dirac-delta kernel sequence determined by two conditions that control the number of vanishing moments and the smoothness. With the discrete SIAC filter at hand, the shock regularization of a global approximation is then performed by a convolution of the solution with the high-order Dirac-delta kernels in every time step. In practice, the filtering procedure reduces to a simple matrix-vector multiplication and, thus, allows for an efficient and simple implementation.

The main contribution of this work is to extend the global filtering technique to element-wise approximations within a nodal discontinuous Galerkin (DG) method. We exploit the weak coupling of the discontinuous Galerkin spectral element method (DGSEM) at element interfaces to design a multi-element filter. Consequently, we convolve the polynomial approximations of one element and its nearest neighbor’s solutions with Dirac-delta kernels instead of the global representation of the solution. As we will point out in the derivation of this multi-element filter, it also recasts to locally applied matrix-vector formulations. We present the filtering matrices for one-dimensional and two-dimensional Cartesian DG discretizations. Moreover, we construct the multi-element SIAC filter such that the numerical scheme remains high-order accurate in smooth regions and that the shock capturing is applied adaptively throughout the domain. The latter we obtain by implementing a shock indicator, which is defined by the filtered solution itself. According to this indicator, we replace the DG approximation by the filtered one in oscillatory regions and, additionally, even introduce a smooth transition area, in which we use a convex combination of the filtered and unfiltered solutions.

The outline of this work is as follows: We begin in Sect. 2 with a construction of the DG method on two-dimensional Cartesian meshes. Next, in Sect. 3 we provide the SIAC filtering routines, where we first discuss the global filter, before we extend it to the multi-element variant as well as two spatial dimensions. Furthermore, we broach the issue of adaptive filtering and conservation properties in the same section. Finally, we provide several numerical benchmark tests in order to verify the applicability of the novel filter to shock problems for the two-dimensional Euler and ideal MHD equations in Sect. 4. Lastly, Sect. 5 gives concluding remarks and an outlook on possible further research projects.

2 Discontinuous Galerkin Spectral Element Method

Throughout this work we consider the solution of hyperbolic conservation laws in two spatial dimensions which take the general form

$$\begin{aligned} u_t + f(u)_x + g(u)_y = 0, \end{aligned}$$
(2.1)

in a square domain \(\varOmega = \left[ x_L,x_R\right] \times \left[ y_B,y_T\right] \subset \mathbb {R}^2\) with appropriate boundary conditions and an initial solution \(u(x,y,0) = u_0(x,y)\). Here u is a conserved variable and fg are the nonlinear fluxes. We take (2.1) as the prototype equation for the conserved solution variables such as density or momentum. This simplifies the discussion and derivations for the SIAC filtering in Sect. 3. The discussion extends naturally to a system of hyperbolic conservations laws such as the Euler equations.

We first provide an overview for the derivation of the nodal DGSEM on Cartesian meshes. Complete details can be found in the book by Kopriva [20]. We derive the DGSEM from the weak form of the conservation law (2.1). As such, we multiply by an arbitrary discontinuous \(L_2(\varOmega )\) test function \(\varphi \) and integrate over the domain

$$\begin{aligned} \int \limits _{\varOmega }\left( {u}_t+{f}_x+{g}_y\right) \varphi \,\mathrm {d}x\mathrm {d}y= {0}, \end{aligned}$$
(2.2)

where we suppress the u dependence of the nonlinear fluxes. We subdivide the domain \(\varOmega \) into \(N_Q\) non-overlapping quadratic elements

$$\begin{aligned} Q_n = \left[ x_{n,1},x_{n,2}\right] \times [y_{n,1},y_{n,2}],\quad n = 1,\ldots ,N_Q. \end{aligned}$$
(2.3)

For the present discussion we make the simplifying assumption that all elements have the same size, i.e. \(\varDelta x = x_{n,2}-x_{n,1}\)and \(\varDelta y = y_{n,2}-y_{n,1}\) for all \(n=1,\ldots ,N_Q\). This divides the integral over the whole domain into the sum of the integrals over the elements. So, each element contributes

$$\begin{aligned} \int \limits _{Q_n}\left( {u}_t+{f}_x+{g}_y\right) \varphi \,\mathrm {d}x\mathrm {d}y= {0},\quad n = 1,\ldots N_Q, \end{aligned}$$
(2.4)

to the total integral. Next, we create a transformation between the reference element \(Q_0=[-1,1]^2\) and each element, \(Q_n\). For rectangular meshes we create mappings \((X_n,Y_n):Q_0 \rightarrow Q_n\) such that \(\left( X_n(\xi ),Y_n(\eta )\right) = (x,y)\) are

$$\begin{aligned} X_n(\xi ) = x_{n,1} + \frac{\xi +1}{2}\varDelta x,\quad Y_n(\eta ) = y_{n,1} + \frac{\eta +1}{2}\varDelta y, \end{aligned}$$
(2.5)

for \(n=1,\ldots ,N_Q\). Under the transformation (2.5) the conservation law in physical coordinates (2.1) becomes a conservation law in reference coordinates [20]

$$\begin{aligned} J{u}_t + \tilde{{f}}_{\xi } + \tilde{{g}}_{\eta } = {0}, \end{aligned}$$
(2.6)

where

$$\begin{aligned} J=\frac{\varDelta x\varDelta y}{4},\quad \tilde{{f}} = \frac{\varDelta y}{2}{f},\quad \tilde{{g}} = \frac{\varDelta x}{2}{g}. \end{aligned}$$
(2.7)

We select the test function \(\varphi \) to be a piecewise polynomial of degree N in each spatial direction

$$\begin{aligned} \varphi ^{Q_n} = \sum _{i=0}^N\sum _{j=0}^N\varphi _{ij}^{Q_n}\psi _i(\xi )\psi _j(\eta ), \end{aligned}$$
(2.8)

on each spectral element \(Q_n\), but do not enforce continuity at the element boundaries. The interpolating Lagrange basis functions are defined by

$$\begin{aligned} \psi _i(\xi ) = \prod _{{\mathop {j \ne i}\limits ^{j = 0}}}^N \frac{\xi -\xi _j}{\xi _i-\xi _j} \quad \text {for}\quad i=0,\ldots ,N, \end{aligned}$$
(2.9)

with a similar definition in the \(\eta \) direction. The values of \(\varphi ^{Q_n}_{ij}\) on each element \(Q_n\) are arbitrary and linearly independent, therefore the formulation (2.4) is

$$\begin{aligned} \int \limits _{Q_0}\left( J{u}_t+\tilde{{f}}_{\xi }+\tilde{{g}}_{\eta }\right) \psi _i(\xi )\psi _j(\eta )\,\mathrm {d}\xi \mathrm {d}\eta = {0}, \end{aligned}$$
(2.10)

where \(i,j=0,\ldots ,N\).

For the DGSEM we approximate the conservative variable u and the contravariant fluxes \(\tilde{f}, \tilde{g}\) with polynomial interpolants of degree N in each spatial direction written in Lagrange form on each element \(Q_n\), e.g.,

$$\begin{aligned} \begin{aligned}&u(x,y,t)|_{Q_n} = u^{Q_n}(\xi ,\eta ,t) \approx \sum _{i=0}^N\sum _{j=0}^N u^{Q_n}_{ij}(t) \psi _i(\xi ) \psi _j(\eta ),\\&\tilde{f}(u(x,y,t))|_{Q_n} = \tilde{f}^{Q_n}(\xi ,\eta ,t) \approx \sum _{i=0}^N\sum _{j=0}^N \tilde{f}^{Q_n}_{ij}(t) \psi _i(\xi ) \psi _j(\eta ). \end{aligned} \end{aligned}$$
(2.11)

This implies that the global representation of the solution u is the union of these piecewise polynomials

$$\begin{aligned} u(x,y,t) \approx \bigcup _{n = 1}^{N_Q} u^{Q_n}(\xi ,\eta ,t). \end{aligned}$$
(2.12)

Next, we use integration-by-parts to move derivatives off the nonlinear fluxes and onto the test function, which generates surface and volume contributions. We resolve the discontinuities between elements at the surface by introducing Lax–Friedrichs numerical flux functions \(f^*\) and \(g^*\). We apply integration-by-parts a second time to move derivatives back onto the fluxes. For the nodal DGSEM any integrals present in the variational formulation are approximated with \(N+1\) Legendre–Gauss–Lobatto (LGL) quadrature nodes and weights, e.g.,

$$\begin{aligned} \begin{aligned} \int \limits _{Q_0} Ju^{Q_n}_t\psi _i(\xi )\psi _j(\eta )\,\mathrm {d}\xi \mathrm {d}\eta&\approx \!\!\!\sum _{n,m=0}^N\left( \sum _{p,q=0}^NJ\left( u^{Q_n}_t\right) _{pq}\psi _p(\xi _n)\psi _q(\eta _m)\right) \psi _i(\xi _n)\psi _j(\eta _m)\omega _n \omega _m\\&= J\left( u^{Q_n}_t\right) _{ij}\omega _i \omega _j, \end{aligned} \end{aligned}$$
(2.13)

for each element \(n=1,\ldots ,N_Q\) and where \(\left\{ \xi _i\right\} _{i=0}^N, \left\{ \eta _j\right\} _{j=0}^N\) are the LGL quadrature nodes and \(\left\{ \omega _i\right\} _{i=0}^N,\left\{ \omega _j\right\} _{j=0}^N\) are the LGL quadrature weights. Further, we collocate the interpolation and quadrature nodes which enables us to exploit that the Lagrange basis functions (2.9) are discretely orthogonal and satisfy the Kronecker delta property, i.e., \(\psi _j(\xi _i) = \delta _{ij}\) with \(\delta _{ij} = 1\) for \(i=j\) and \(\delta _{ij}=0\) for \(i\ne j\) to simplify (2.13). Due to the polynomial approximation (2.11) any derivatives fall on the Lagrange basis functions. These are approximated at high-order with the standard differentiation matrix [20]

$$\begin{aligned} D_{ij} = \psi _j'(\xi )\bigg |_{\xi =\xi _i},\quad i,j = 0,\ldots ,N. \end{aligned}$$
(2.14)

From these steps, we build the standard semi-discrete formulation of the strong-form DGSEM. We write the scheme in index notation as

$$\begin{aligned} \begin{aligned} J\left( u^{Q_n}_t\right) _{ij}&= -\left( \frac{\delta _{iN}}{\omega _N}\left[ \tilde{f}^{*}(1,\eta _j) - \tilde{f}^{Q_n}_{ij}\right] - \frac{\delta _{i0}}{\omega _0}\left[ \tilde{f}^{*}(-1,\eta _j) - \tilde{f}^{Q_n}_{ij}\right] +\sum _{m=0}^N D_{im}\tilde{f}^{Q_n}_{mj}\right. \\&\quad \left. \frac{\delta _{Nj}}{\omega _N}\left[ \tilde{g}^{*}(\xi _i,1) - \tilde{g}^{Q_n}_{ij}\right] - \frac{\delta _{0j}}{\omega _0}\left[ \tilde{g}^{*}(\xi _i,-1) - \tilde{g}^{Q_n}_{ij}\right] +\sum _{m=0}^N D_{jm}\tilde{g}^{Q_n}_{im}\right) , \end{aligned} \end{aligned}$$
(2.15)

where \(i,j=0,\ldots ,N\) and \(n=1,\ldots ,N_Q\).

The semi-discrete formulation (2.15) on each element is integrated in time with an explicit five stage, fourth order Runge–Kutta method of Carpenter and Kennedy [6]. We select a stable explicit time step with an appropriate CFL condition which is equation and resolution dependent.

3 SIAC Filter

In this section we present the SIAC filter for a single domain and then discuss its extension and implementation into a multi-element DGSEM framework.

3.1 Single Element Filter

In [37] a SIAC filter was developed for a single domain spectral method. To define the global method we begin by introducing the delta sequence

$$\begin{aligned} \delta ^{m,k}_\varepsilon (x) = {\left\{ \begin{array}{ll} \frac{1}{\varepsilon } P^{m,k}\left( \frac{x}{\varepsilon }\right) ~~ &{} \left| x\right| \le \varepsilon \\ 0 &{} \left| x\right| >\varepsilon \end{array}\right. }, \end{aligned}$$
(3.1)

that is built from the polynomial \(P^{m,k}(x)\), which is uniquely determined by the following conditions:

$$\begin{aligned} \int \limits _{-1}^1 P^{m,k}(\xi ) \,\mathrm {d}\xi&= 1 , \end{aligned}$$
(3.2)
$$\begin{aligned} \left( P^{m,k}\right) ^{(i)}(\pm 1)&= 0\quad \text {for}\quad i=0,\ldots ,k, \end{aligned}$$
(3.3)
$$\begin{aligned} \int \limits _{-1}^1 \xi ^i P^{m,k}(\xi ) \,\mathrm {d}\xi&= 0\quad \text {for}\quad i=1,\ldots ,m. \end{aligned}$$
(3.4)

In Fig. 1 we illustrate the polynomial approximation of the delta kernel (3.1) with \((m,k) = (3,8)\), \((m,k) = (5,8)\), and scaling parameter \(\varepsilon =1\).

Fig. 1
figure 1

Visualization of the Dirac-delta kernel for \(\varepsilon =1\)

According to the SIAC filtering strategy [29, 34, 37] we regularize the solution produced by the numerical scheme with the manipulation

$$\begin{aligned} \tilde{u}(x,t)= & {} \int \limits _{x-\varepsilon }^{x+\varepsilon } u(\tau ,t) \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau \approx \int \limits _{x-\varepsilon }^{x+\varepsilon } \left[ \sum _{i=0}^N u_i(t) \psi _i(\tau )\right] \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau \nonumber \\= & {} \sum _{i=0}^N u_i(t) \int \limits _{x-\varepsilon }^{x+\varepsilon } \psi _i(\tau ) \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau . \end{aligned}$$
(3.5)

For compact notation we introduce the filter matrix \(\varPhi \) and approximate its values with LGL quadrature by mapping the corresponding integration area \(\left[ x-\varepsilon ,x+\varepsilon \right] \) into the reference element \(E=\left[ -1,1\right] \)

$$\begin{aligned} \varPhi _{ij} = \int \limits _{x_i-\varepsilon }^{x_i+\varepsilon } \psi _j(\tau ) \delta ^{m,k}_{\varepsilon } (x_i-\tau ) \,\mathrm {d}\tau = \varepsilon \int \limits _{-1}^1 \psi _j(\varepsilon x+x_i) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x\approx \varepsilon \sum _{\nu =0}^{N^*} \omega _\nu \psi _j(\varepsilon x_\nu + x_i) \delta ^{m,k}_{\varepsilon } (\varepsilon x_\nu ), \nonumber \\ \end{aligned}$$
(3.6)

where \(\left\{ x_\nu \right\} _{\nu =0}^{N^*}\) and \(\left\{ \omega _\nu \right\} _{\nu =0}^{N^*}\) are the LGL quadrature points and weights for \(N^*= 2\left( \frac{m}{2}+k+1\right) \) to maintain the desired high-order accuracy of the approximation [34]. Moreover, we choose

$$\begin{aligned} \varepsilon =\cos \left( \frac{\pi (\frac{N-N_d}{2})}{N}\right) , \end{aligned}$$
(3.7)

with \(N_d\) determined empirically to ensure stable conserving results [34, 37]. The selection of the scaling parameter \(\varepsilon \) is related to the quadrature accuracy of the integral (3.6). As was shown in [34], an arbitrary choice of \(\varepsilon \) can lead to sub-optimal accuracy of the quadrature. However, depending on the number of LGL nodes used for the DG approximation the support of the kernel function (3.7) must be adjusted through the parameter \(N_d\). In practice, for a fixed number of LGL nodes \(N+1\), selecting different values of \(\varepsilon \) changes the accuracy of the filter as well as the solution quality because of possible excessive smearing effects, see [34, 37] for details.

We can express the filtering process in terms of a matrix vector multiplication, i.e.

$$\begin{aligned} \tilde{\mathbf {u}}(t) = {\varvec{\Phi }} \mathbf {u}(t). \end{aligned}$$
(3.8)

For the global SIAC filtering technique we must address how the filter matrix is applied at the physical boundaries of the domain. However, at the physical boundaries no \(\varepsilon \)-stencils are defined. Thus, oscillations caused by shocks as well as by re-interpolation (Runge phenomena) cannot be smoothed in these areas. In the original approach for the global collocation the affected parts of the discretization are set to the analytical solution [37]. Using a local version of the filter we can avoid identifying interior points by an analytical reference solution, as discussed in the next section.

We also note that, by construction, the filter conserves mass solely for polynomial data of degree up to m, which especially in a global collocation method is difficult to realize. Thus, small conservation errors might be introduced by applying the filter matrix (3.6).

3.2 Multi-element Filter

For the case with multiple Cartesian elements and DGSEM, we begin, again, with the one-dimensional case and then apply the tensor product decoupling of the DGSEM to move to higher spatial dimensions. In contrast to the previous section we now have DG solutions defined on multiple elements in a mesh (\(N_Q>1\)). However, we still want to apply the smoothing matrix \(\varPhi \) locally to the solution element-wise. It is, hence, necessary to determine how to couple the filtering across element interfaces to determine a multi-element SIAC technique.

To do so, we begin with (3.5), where, in one spatial dimension, we know that the solution u is a union of piecewise polynomials over all elements \(N_Q\)

$$\begin{aligned} \begin{aligned} \tilde{u}(x,t) = \int \limits _{x-\varepsilon }^{x+\varepsilon } u(\tau ,t) \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau&= \int \limits _{x-\varepsilon }^{x+\varepsilon } \left[ \sum _{\ell =1}^{N_Q} u^{Q_\ell }(\tau ,t)\right] \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau \\&= \sum _{\ell =1}^{N_Q} \int \limits _{x-\varepsilon }^{x+\varepsilon } u^{Q_\ell }(\tau ,t) \delta ^{m,k}_{\varepsilon } (x-\tau ) \,\mathrm {d}\tau . \end{aligned} \end{aligned}$$
(3.9)

Next, we focus on one physical node \(x_i := X_n(\xi _i)\) within one element \(Q_n\) and define the following sets

$$\begin{aligned}&Q^\varepsilon _{i,n} := \left[ x_i-\varepsilon ,x_i+\varepsilon \right] \cap Q_n, \end{aligned}$$
(3.10)
$$\begin{aligned}&Q^\varepsilon _{i,n-1} := \left[ x_i-\varepsilon ,x_i+\varepsilon \right] \cap Q_{n-1}, \end{aligned}$$
(3.11)
$$\begin{aligned}&Q^\varepsilon _{i,n+1} := \left[ x_i-\varepsilon ,x_i+\varepsilon \right] \cap Q_{n+1}. \end{aligned}$$
(3.12)

Since \(\varepsilon \) is sufficiently small, we assume that the \(\varepsilon \)-stencil is imbedded in these three sets and thus

$$\begin{aligned} \begin{aligned} \tilde{u}_i^{Q_n}(t)&= \sum _{\ell =1}^{N_Q} \int \limits _{x_i-\varepsilon }^{x_i+\varepsilon } u^{Q_\ell }(\tau ,t) \delta ^{m,k}_{\varepsilon } (x_i-\tau ) \,\mathrm {d}\tau \\&= \int \limits _{Q^\varepsilon _{i,n}} u^{Q_n}(\tau ,t) \delta ^{m,k}_{\varepsilon } (x_i-\tau ) \,\mathrm {d}\tau + \int \limits _{Q^\varepsilon _{i,n-1}} u^{Q_{n-1}}(\tau ,t) \delta ^{m,k}_{\varepsilon } (x_i-\tau ) \,\mathrm {d}\tau \\&\quad + \int \limits _{Q^\varepsilon _{i,n+1}} u^{Q_{n+1}}(\tau ,t) \delta ^{m,k}_{\varepsilon } (x_i-\tau ) \,\mathrm {d}\tau . \end{aligned} \end{aligned}$$
(3.13)

If we now define similar sets for the corresponding LGL node

$$\begin{aligned}&E^\varepsilon _i := \left[ \xi _i-\varepsilon ,\xi _i+\varepsilon \right] \cap \left[ -1,1\right] , \end{aligned}$$
(3.14)
$$\begin{aligned}&E^\varepsilon _{i,l} := \left[ \xi _i-\varepsilon ,\xi _i+\varepsilon \right] \cap \left[ \xi _i-\varepsilon ,-1\right] , \end{aligned}$$
(3.15)
$$\begin{aligned}&E^\varepsilon _{i,r} := \left[ \xi _i-\varepsilon ,\xi _i+\varepsilon \right] \cap \left[ 1,\xi _i+\varepsilon \right] , \end{aligned}$$
(3.16)

we can transform everything to reference space again and obtain

$$\begin{aligned} \begin{aligned} \tilde{u}_i^{Q_n}(t)&= \varepsilon \int \limits _{E^\varepsilon _i} \sum _{j=0}^N \psi _j(\varepsilon x+\xi _i) u_j^{Q_n}(t) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x\\&\quad + \varepsilon \int \limits _{E^\varepsilon _{i,l}} \sum _{j=0}^N \psi _j(\varepsilon x+\xi _i-2) u_j^{Q_{n-1}}(t) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x\\&\quad + \varepsilon \int \limits _{E^\varepsilon _{i,r}} \sum _{j=0}^N \psi _j(\varepsilon x+\xi _i+2) u_j^{Q_{n+1}}(t) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x. \end{aligned} \end{aligned}$$
(3.17)

Note, that we shift the arguments of the lagrange basis functions in the left and right elements by \(\pm 2\) to guarantee the correct evaluation points. We can write (3.17) in compact notation by applying a modified \((N\!+\! 1)\times 3(N\!+\! 1)\) smoothing matrix to the solution, i.e.

$$\begin{aligned} \tilde{\mathbf {u}}^{Q_n}(t) = \underbrace{\begin{pmatrix} {\varvec{\Phi }}^{n-1}&{\varvec{\Phi }}^n&{\varvec{\Phi }}^{n+1} \end{pmatrix}}_{={\varvec{\Phi }}^{Q_n}_{loc}} \begin{pmatrix} \mathbf {u}^{Q_{n-1}}(t) \\ \mathbf {u}^{Q_n}(t) \\ \mathbf {u}^{Q_{n+1}}(t) \end{pmatrix}, \end{aligned}$$
(3.18)

with the matrices

$$\begin{aligned}&\varPhi ^n_{i,j} = \varepsilon \int \limits _{E^\varepsilon _i} \psi _j(\varepsilon x+\xi _i) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x, \end{aligned}$$
(3.19)
$$\begin{aligned}&\varPhi ^{n-1}_{i,j} = \varepsilon \int \limits _{E^\varepsilon _{i,l}} \psi _j(\varepsilon x+\xi _i-2) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x, \end{aligned}$$
(3.20)
$$\begin{aligned}&\varPhi ^{n+1}_{i,j} = \varepsilon \int \limits _{E^\varepsilon _{i,r}} \psi _j(\varepsilon x+\xi _i+2) \delta ^{m,k}_{\varepsilon } (\varepsilon x) \,\mathrm {d}x. \end{aligned}$$
(3.21)

Again, we evaluate these integrals by a Legendre–Gauss–Lobatto quadrature with \(N^*= 2\left( \frac{m}{2}+k+1\right) \) points as in (3.6). Because the two dimensional, multi-element filter is created through a tensor product of the one-dimensional filters, we select the same \(\varepsilon \) (3.7) in each of the integrals (3.19)–(3.21).

Note, that since the neighboring elements only enter in the smoothing matrix at grid points near to the element boundaries, \({\varvec{\Phi }}^{n-1}\) and \({\varvec{\Phi }}^{n+1}\) are block matrices with mostly zero entries, especially when N is large. In particular, only the first several rows of \({\varvec{\Phi }}^{n-1}\) and the last several rows of \({\varvec{\Phi }}^{n+1}\) are non-zero. We see that the multi-element SIAC filtering process is not entirely local to element \(Q_n\); however, we only need solution information from its direct neighbors in the mesh.

An additional advantage in the design of this multi-element filtering technique is the treatment of element located at physical boundaries. We already noted that there is no \(\varepsilon \)-stencil defined in these boundary areas. Thus, we cannot apply the filter. However, from the multi-element technique we can introduce ghost elements, in which we can define a consistent solution depending on the physical boundary condition, e.g., to reflecting wall or Dirichlet values. This procedure removes Runge phenomena from the solution without the need to identify interior points by analytical values [37].

We can use the locally filtered solution as a shock detector to adaptively apply the multi-element filter only in elements where it is necessary. To do so, we define an indicator to measure the difference between the filtered and unfiltered solutions

$$\begin{aligned} \epsilon _n := \underset{i=0,\ldots ,N}{\max }\left| \mathbf {u}^{Q_n}_i - \tilde{\mathbf {u}}^{Q_n}_i \right| . \end{aligned}$$
(3.22)

Next, we normalize this indicator with respect to the polynomial order and the number of elements and check in each element \(n=1,\ldots ,N_Q\), if

$$\begin{aligned} \frac{\epsilon _n}{(N+1)N_Q} > \texttt {TOL}, \end{aligned}$$
(3.23)

for a given user defined tolerance TOL. If this condition is fulfilled, we replace the current element solution with the filtered solution. Otherwise the approximation is deemed to be sufficiently smooth and no filtering is applied. In order to extend this adaptation for systems of conservation laws we can use single variables to compute \(\epsilon _n\), e.g., the density or pressure for the Euler equations.

Remark 1

(Adaptive filtering) The filtered solution acts as a self-contained shock detector because of the constraints used to construct the SIAC filter (3.2)–(3.4). In particular, the filter is designed to recover polynomial orders up to m. Therefore, in smooth regions of the flow the approximate solution and the filtered solution will be nearly the same, i.e., the indicator error (3.23) will be small. However, near discontinuities the approximate solution will contain large, spurious overshoots whereas the overshoots of the filtered solution will be considerably reduced, making (3.23) large.

Moreover, for convenience, we define

$$\begin{aligned} \sigma _n = \log _{10} \left( \epsilon _n\right) , \end{aligned}$$
(3.24)

and introduce a transition area between two tolerance levels, \(\sigma _{\min }\le \sigma _n\le \sigma _{\max }\), to smoothly blend the filtered and unfiltered solutions. As such we define a parameter \(0\le \lambda \le 1\) and then define the updated solution on a given element \(Q_n\) to be a convex combination of the two solutions

$$\begin{aligned} \hat{\mathbf {u}}^{Q_n} = \lambda \tilde{\mathbf {u}}^{Q_n} + (1-\lambda ) \mathbf {u}^{Q_n}, \end{aligned}$$
(3.25)

with

$$\begin{aligned} \lambda = \frac{1}{2} \left[ 1+\sin \left( \pi \left( \sigma _n-\frac{1}{2} \frac{\sigma _{\max } + \sigma _{\min }}{\sigma _{\max } -\sigma _{\min }}\right) \right) \right] . \end{aligned}$$
(3.26)

A major concern for any shock capturing method is to maintain conservation, which ensures the correct shock speeds are maintained [25].

Remark 2

(Conservation) In its current incarnation the multi-element SIAC filter does not conserve the solution quantities, e.g., density, momentum and energy for the Euler equations. The unfiltered standard DGSEM conserves the solution variables up to machine precision, see e.g. [8]. However, the application of the local SIAC filter after each time step is no longer globally conservative because we re-distribute solution data, e.g. the mass, by the filtering process within each element. Whereas the conservation errors for the global filter are introduced by the necessary large interpolation order \(N\gg m\), we can easily assure \(N\le m\) for the local element-wise filtering. However, we run into a different problem because our global approximation is no longer a polynomial, but solely built from piecewise polynomial data. Thus, again, we introduce conservation errors in our approximation, which are usually small. We examine the size of these conservation errors in Sect. 4.1.1 and show for the considered test cases that the conservation loss does not affect the solutions.

3.3 Two-Dimensional Filter

Next, we extend the one-dimensional local SIAC filter to higher spatial dimensions. For the filtering process we apply the same local smoothing matrix \(\hat{{\varvec{\Phi }}}\) as in the one-dimensional case in each spatial direction to the unfiltered element solutions. Conveniently, this is possible due to the tensor product ansatz of the DGSEM and the definition of the Dirac delta kernel (3.1). Just as in the previous section we first derive a global multi-dimensional filter and then modify it for the local multi-element case.

We begin again from the filtering assumption of (3.5), and find for the piecewise polynomial solution u that

$$\begin{aligned} \begin{aligned} \tilde{u}(x,y,t)&= \int \limits _{x-\varepsilon }^{x+\varepsilon } \int \limits _{y-\varepsilon }^{y+\varepsilon } u(\tau ,\varsigma ,t) \delta ^{m,k}_{\varepsilon } (x-\tau ,y-\varsigma ) \,\mathrm {d}\tau \mathrm {d}\varsigma \\&= \sum _{\ell =1}^{N_Q} \int \limits _{x-\varepsilon }^{x+\varepsilon } \int \limits _{y-\varepsilon }^{y+\varepsilon } u^{Q_\ell }(\tau ,\varsigma ,t) \delta (x-\tau ,y-\varsigma ) \,\mathrm {d}\tau \mathrm {d}\varsigma . \end{aligned} \end{aligned}$$
(3.27)

where we define the multi-variable delta function to have the form

$$\begin{aligned} \delta (x,y) := \delta ^{m,k}_{\varepsilon } (x,y) = \delta ^{m,k}_{\varepsilon } (x)\delta ^{m,k}_{\varepsilon } (y) =: \delta (x)\delta (y). \end{aligned}$$
(3.28)

We focus on one LGL node, transform into the reference space and use the tensor product property to split the integrand and obtain

$$\begin{aligned} \begin{aligned} \tilde{u}_{ij}^{Q_n}(t)&= \sum _{\ell =1}^{N_Q} \int \limits _{x_i-\varepsilon }^{x_i+\varepsilon } \int \limits _{y_j-\varepsilon }^{y_j+\varepsilon } u^{Q_\ell }(\tau ,\varsigma ,t) \delta (x_i-\tau ,y_j-\varsigma ) \,\mathrm {d}\tau \mathrm {d}\varsigma \\&= \sum _{\ell =1}^{N_Q} \varepsilon ^2 \int \limits _{-1}^1 \int \limits _{-1}^1 u^{Q_\ell }(\varepsilon x+\xi _i,\varepsilon y + \eta _j,t) \delta (\varepsilon x, \varepsilon y) \,\mathrm {d}x\mathrm {d}y\\&= \sum _{\ell =1}^{N_Q} \varepsilon ^2 \int \limits _{-1}^1 \int \limits _{-1}^1 \sum _{k,l=0}^N \bar{\psi }_k(\varepsilon x+\xi _i) \bar{\psi }_l(\varepsilon y + \eta _j) u_{kl}^{Q_{\bar{\ell }}}(t) \delta (\varepsilon x) \delta (\varepsilon y) \,\mathrm {d}x\mathrm {d}y \\&= \sum _{\ell =1}^{N_Q} \sum _{k,l=0}^N \underbrace{\varepsilon \int \limits _{-1}^1 \bar{\psi }_k(\varepsilon x+\xi _i) \delta (\varepsilon x) \,\mathrm {d}x}_{=\varPhi _{ik}} ~ \underbrace{ \varepsilon \int \limits _{-1}^1 \bar{\psi }_l(\varepsilon y + \eta _j) \delta (\varepsilon y) \,\mathrm {d}y}_{=\varPhi _{jl}} ~ u_{kl}^{Q_{\bar{\ell }}}(t). \end{aligned} \end{aligned}$$
(3.29)

Here, the \(\bar{\ell }\) points to the correct solution entry, which includes neighboring elements and is dependent on the storing data structure. The shifting of the evaluation points for the Lagrange basis function is also hidden in the bar notation, i.e.

$$\begin{aligned} \bar{\psi }(x) := {\left\{ \begin{array}{ll} \psi (x), &{} \quad x\in \left[ -1,1\right] \\ \psi (x-2), &{} \quad x>1 \\ \psi (x+2), &{} \quad x<-1 \end{array}\right. } \end{aligned}$$
(3.30)

From this definition of the filtering matrices it is possible to write the filtering matrix in a compact notation

$$\begin{aligned} \tilde{\mathbf {u}}^n = {\varvec{\Phi }} \mathbf {u}_{env}^n {\varvec{\Phi }}^T, \end{aligned}$$
(3.31)

with

$$\begin{aligned} {\varvec{\Phi }} = \begin{pmatrix} {\varvec{\Phi }}^{n-1}&{\varvec{\Phi }}^n&{\varvec{\Phi }}^{n+1} \end{pmatrix} ~~~ \text { and } ~~~ \mathbf {u}_{env}^n = \begin{pmatrix} \mathbf {u}^{n+N_{Q,x}-1} &{} \mathbf {u}^{n+N_{Q,x}} &{} \mathbf {u}^{n+N_{Q,x}+1} \\ \mathbf {u}^{n-1} &{} \mathbf {u}^n &{} \mathbf {u}^{n+1} \\ \mathbf {u}^{n-N_{Q,x}-1} &{} \mathbf {u}^{n-N_{Q,x}} &{} \mathbf {u}^{n-N_{Q,x}+1} \end{pmatrix}, \end{aligned}$$
(3.32)

provided the elements are labeled from bottom-left to top-right and \(N_{Q,x}\) denotes the number of elements in the x-direction. In this case, we design the smoothing matrix \({\varvec{\Phi }} = \begin{pmatrix} {\varvec{\Phi }}^{n-1}&{\varvec{\Phi }}^n&{\varvec{\Phi }}^{n+1} \end{pmatrix}\) exactly as in one spatial dimension.

We want the resulting shock capturing DG scheme to be as local as possible and implement the 2D multi-element SIAC filter in a way to reflect this goal. First, we define

$$\begin{aligned} \begin{pmatrix} \hat{\mathbf {u}}^{n+N_{Q,x}} \\ \hat{\mathbf {u}}^n \\ \hat{\mathbf {u}}^{n-N_{Q,x}} \end{pmatrix} := \mathbf {u}_{env}^n {\varvec{\Phi }}^T = \begin{pmatrix} \varPhi ^{n-1} \mathbf {u}^{n+N_{Q,x}-1} + \varPhi ^n \mathbf {u}^{n+N_{Q,x}} + \varPhi ^{n+1} \mathbf {u}^{n+N_{Q,x}-1} \\ \varPhi ^{n-1} \mathbf {u}^{n-1} + \varPhi ^n \mathbf {u}^{n} + \varPhi ^{n+1} \mathbf {u}^{n+1} \\ \varPhi ^{n-1} \mathbf {u}^{n-N_{Q,x}-1} + \varPhi ^n \mathbf {u}^{n-N_{Q,x}} + \varPhi ^{n+1} \mathbf {u}^{n-N_{Q,x}-1} \end{pmatrix}, \end{aligned}$$
(3.33)

which is nothing more than the solution vector of the three considered adjacent cells filtered in the x-direction. To filter in the y-direction, we just apply the smoothing matrix \({\varvec{\Phi }}\) from the left hand side and obtain an overall filtered solution \(\tilde{\mathbf {u}}^n\) from (3.31). The main advantage of this procedure is that the filtering procedure is done dimension by dimension. So for all elements \(n=1,\ldots ,N_Q\) we first filter in the x-direction to find \(\hat{\mathbf {u}}^{n}\) with coupling only from the right and left neighbor cells. Next, we filter in the y-direction and compute the fully filtered solution \(\tilde{\mathbf {u}}^n\) from the information stored in the intermediate array \(\hat{\mathbf {u}}^{n}\) with coupling from the upper and lower neighbor elements. That is, we simply apply the one-dimensional filter twice for each grid point and, again, only need information from the direct neighbors. Additionally, we note, that this filtering procedure has no preferred direction such that the order of xy directions makes no difference.

4 Numerical Tests

We verify the performance of the novel multi-element SIAC filter applied to a variety of two-dimensional shock tests for the Euler as well as ideal MHD equations. For all simulations, we consider two-dimensional Cartesian meshes discretized by uniform quadrilateral elements of equal size \(\varDelta x = \varDelta y\). Further, we use the explicit five stage, fourth order Runge–Kutta method of Carpenter and Kennedy [6] with an stable explicit time step to advance the DG approximation in time. The (adaptive) filtering procedure (3.31) is performed for all element solutions after each time step. We begin with the numerical validation for the two-dimensional Euler equations in Sect. 4.1, where we also investigate the accuracy and conservation issues of the filter, before we apply it to more challenging shock tests for the ideal MHD equations in Sect. 4.2.

4.1 Euler Tests

The two-dimensional Euler equations are described by a system of conservation laws, i.e.

$$\begin{aligned} U_t + F_x + G_y = 0, \end{aligned}$$
(4.1)

with

$$\begin{aligned} U = \begin{pmatrix} \varrho \\ \varrho \mathbf {v} \\ \varrho e \end{pmatrix}, ~~~ F = \begin{pmatrix} \varrho v_1 \\ \varrho v_1^2 + p \\ \varrho v_1 v_2 \\ v_1 \left( \varrho e + p\right) \end{pmatrix}, ~~~ G = \begin{pmatrix} \varrho v_2 \\ \varrho v_1 v_2 \\ \varrho v_2^2 + p \\ v_2 \left( \varrho e + p\right) \end{pmatrix}. \end{aligned}$$
(4.2)

Here, \(\varrho \), \(\mathbf {v}=(v_1, v_2)^T\), and e denote the density, two-dimensional velocity field and inner specific energy, respectively. We close the system by the perfect gas equation, which relates the inner energy and pressure, i.e.

$$\begin{aligned} p = (\gamma -1)\left( \varrho e - \frac{1}{2}\varrho \Vert \mathbf {v}\Vert ^2\right) , \end{aligned}$$
(4.3)

where \(\gamma \) denotes the adiabatic coefficient.

In the following, we apply the DGSEM with the multi-element SIAC filter derived herein to the two-dimensional Euler equations (4.1) to first show the high-order convergence and investigate the conservations properties of the scheme. Thereupon, we consider several benchmark problems for the two-dimensional Euler equations in order to verify the shock capturing capabilities of the novel filtering strategy.

4.1.1 Convergence and Conservation Studies

A substantial property of DG schemes is the high-order accuracy of the approximation for smooth solutions. Thus, we first consider an academic test case with a known analytical solution for the two-dimensional Euler equations, that allows us to compute numerical errors measured in a discrete \(L_\infty \)-norm. With the help of these error values for different discretization levels, we are able to compute the experimental order of convergence (EOC), which for the DGSEM is expected to agree with the theoretical order of \(N\! +\! 1\) as the mesh is refined.

The problem we use for convergence tests is defined in the domain \(\varOmega = [-1,1]^2\) with the initial conditions

$$\begin{aligned} \varrho (x,y,0) = 1 + 0.3 \sin (2 \pi (x+y)), \quad v_1(x,y,0) = v_2(x,y,0) = p(x,y,0) = 1. \end{aligned}$$
(4.4)

We use periodic boundary conditions and set \(\gamma =5/3\). The analytical solution of the 2D Euler equations using these initial conditions is

$$\begin{aligned} U(x,y,t) = \left( \begin{array}{c} 1 + 0.3 \sin (2 \pi (x+y-2t)) \\ 1 + 0.3 \sin (2 \pi (x+y-2t)) \\ 1 + 0.3 \sin (2 \pi (x+y-2t)) \\ 0.5+0.15 \sin (2 \pi (x+y-2t))+ \frac{1}{\gamma -1} \end{array} \right) . \end{aligned}$$
(4.5)

We run the simulation until the final time \(T = 0.4\) and intentionally choose a high polynomial degree of \(N=7\). Consequently, we select a small explicit time step where \(\texttt {CFL} = 0.1\) to exclude errors from the time integration method. Further, we compute the errors of the approximation for different choices of \(N_Q\) and calculate the EOC by the maximum error \(\epsilon _\infty \) of the density. For the DGSEM approximation without filtering we obtain the convergence results illustrated in Table 1.

Table 1 Euler convergence test for \(N=7, \texttt {CFL} = 0.1\) and \(T = 0.4\) without filtering

The results in Table 1 confirm the expected theoretical order of convergence \(N+1\) for the DGSEM approximation without filtering. Moreover, we state the overall conservation error of the density computed by

$$\begin{aligned} \epsilon _\mathrm {cons} = \left| \int _\varOmega \varrho _{\text {ex}}(x,y,T) \,\mathrm {d}x\mathrm {d}y- \int _\varOmega \varrho _{\text {app}}(x,y,T)\,\mathrm {d}x\mathrm {d}y\right| , \end{aligned}$$
(4.6)

which regard to machine precision and, thus, agree with the desired conservative nature of the DGSEM [8].

As we are interested in the errors and convergence rates of the filtered solution as well, we turn off the adaptive filtering and investigate the convergence rates and conservation errors of the filtered solution as demonstrated in Table 2 for the SIAC filter using a Dirac-delta approximation with one vanishing moment.

Table 2 Euler convergence test for \(N = 7, \texttt {CFL} = 0.1\) and \(T = 0.4\) filtered with \((m,k) = (1,6), N_d = 0.8\)

Table 2 reveals that the order of convergence drops to one. Further, we lose conservation as pointed out in the previous section. We now repeat the convergence test with \(m = 3\) and \(m = 5\), see Tables 3 and 4.

Table 3 Euler convergence test for \(N = 7, \texttt {CFL} = 0.1\) and \(T = 0.4\) filtered with \((m,k) = (3,6), N_d = 2.5\)
Table 4 Euler convergence test for \(N = 7, \texttt {CFL} = 0.1\) and \(T = 0.4\) filtered with \((m,k) = (5,7), N_d = 4.5\)

As the convergence tests show, the experimental order of convergence depends on the number of vanishing moments in the Dirac-delta approximation, i.e. \(EOC \approx {\min }\left( m,N+1\right) \). While one vanishing moment leads to a smearing effect and significantly drops the accuracy in smooth areas, increasing the number of vanishing moments improves the accuracy again. We observe that the conservation error decreases with an increasing number of vanishing moments as well as with finer grid resolutions.

In conclusion, we expect the Dirac-delta filter to effectively distinguish between shocks and smooth areas when using enough vanishing moments. Because of the large drop of accuracy for less vanishing moments, smooth areas will be mistaken for shocks more often which results in significantly less accuracy in those areas. We alleviate these issues with the adaptive filtering technique, so that small conservation errors are exclusively introduced in shocked regions.

4.1.2 Explosion Problem

We now consider the first two-dimensional Euler test case that inherits shocks. The explosion problem is defined on the domain \(\varOmega = [-1,1]^2\), whereas its initial conditions consist of a region inside a circle with the radius \(r = 0.4\) centered at the origin and a region outside that circle, see e.g. [37]. The primitive variable initial conditions are then defined by two states, i.e.

$$\begin{aligned} \varrho _{\text {in}} (x,y,0) = 1.0, \quad \varrho _{\text {out}} (x,y,0) = 0.125, \quad \quad \quad p_{\text {in}} (x,y,0)= 1.0, \quad p_{\text {out}} (x,y,0)= 0.1. \end{aligned}$$
(4.7)

Here, the inner state applies for every \((x,y)\in \varOmega \) such that \((x^2+y^2) \le r^2\) and the outside state applies otherwise. Further, the velocity vector is set to zero in the entire domain and we set \(\gamma = 5/3\).

The following plots in Figs. 2 and 3 show the approximation of the density for this problem at the final time \(T=0.25\) with \(\texttt {CFL} = 0.1\) and a polynomial degree of \(N=7\) on \(N_Q = 80^2\) elements.

Fig. 2
figure 2

Density of the 2D explosion problem at \(T = 0.25\) for \(N=7, N_Q = 80^2, \texttt {CFL} = 0.1\) filtered adaptively with \((m,k)=(1,6)\), \(N_d=0.6, \sigma _{\min } = -7\) and \(\sigma _{\max } = -3\)

For the simulation result illustrated in Fig. 2, one vanishing moment (\(m=1\)) and six continuous derivatives at the endpoints (\(k=6\)) of the Dirac-delta approximation are chosen. The support width in (3.7) is calculated with \(N_d = 0.6\). Furthermore, the adaptive filtering with convex blending (3.25) is used with a minimum tolerance of \(10^{-7}\) and a maximum tolerance of \(10^{-3}\). Comparing the results to other configurations of the filter shows that the narrow domain width and the chosen tolerances effectively limit the smearing effect despite the small number of vanishing moments. The conservation error is \(\epsilon _\mathrm {cons} = 6.4 \times 10^{-4}\).

Fig. 3
figure 3

Density of the 2D explosion problem at \(T = 0.25\) for \(N=7, N_Q = 80^2, \texttt {CFL} = 0.1\) filtered adaptively with \((m,k)=(3,6)\), \(N_d=2.5, \sigma _{\min } = -8\) and \(\sigma _{\max } = -5\)

Fig. 4
figure 4

Density slices of the 2D explosion problem at \(x = y\), \(T = 0.25\) for \(N = 7\), \(N_Q = 80^2\), CFL = 0.1

In contrast, Fig. 3 uses three vanishing moments (\(m=3\)), which requires a larger support width defined by \(N_d = 2.5\) in (3.7). The corresponding conservation error is \(\epsilon _\mathrm {cons} = 2.0 \times 10^{-5}\).

Both results reveal that the shocks are effectively regularized, even though small overshoots are observable. For this problem, we find that one vanishing moment is enough to obtain acceptable results if the tolerance of the adaptive filtering operation is adjusted. However, the three moment adaptive SIAC filter produces more accurate shock profiles, as can be seen in the slicing picture Fig. 4 that compares three filtered solutions against a reference solution [37]. The reference solution is computed by the publicly available high performance application code FLASH (http://flash.uchicago.edu/site/flashcode/) with a second order MUSCL-Hancock finite volume method (see e.g. [36]) on \(2048 \times 2048\) elements. We observe that the filter with one vanishing moment is quite dissipative, whereas the filtered approximations with higher moments produce small overshoots at the shock and rarefraction. Nonetheless, all three configurations are stable, nearly oscillation-free and close to the analytical profile.

4.1.3 Four State Riemann Test

The next Euler shock test is described by the 2D-Riemann problem, see [22, 24]. We consider the domain \(\varOmega = [0,1]^2\) with outflow boundary conditions. The initial conditions are defined by four different states in four quadrants:

  • Top left:\(\varOmega _{t\ell } = [0,0.5)\times (0.5,1]\).

  • Bottom left:\(\varOmega _{b\ell } = [0,0.5)\times (0,0.5]\).

  • Top right:\(\varOmega _{tr} = (0.5,1]\times (0.5,1]\).

  • Bottom right:\(\varOmega _{b r} = (0.5,1]\times [0,0.5)\).

The four primitive variable states of the initial conditions are then assigned to these four quadrants:

$$\begin{aligned} (\varrho , v_1, v_2, p)(x,y,0) = {\left\{ \begin{array}{ll} (\varrho _{t\ell }, v_{1,t\ell }, v_{2,t\ell }, p_{t\ell }), &{}\quad \text {if } (x,y) \in \varOmega _{t\ell }, \\ (\varrho _{b\ell }, v_{1,b\ell }, v_{2,b\ell }, p_{b\ell }), &{}\quad \text {if } (x,y) \in \varOmega _{b\ell }, \\ (\varrho _{tr}, v_{1,tr}, v_{2,tr}, p_{tr}), &{} \quad \text {if } (x,y) \in \varOmega _{tr}, \\ (\varrho _{br}, v_{1,br}, v_{2,br}, p_{br}), &{} \quad \text {if } (x,y) \in \varOmega _{br}. \end{array}\right. } \end{aligned}$$

Depending on the particular choice of initial conditions, the simulation has to overcome at least one rarefaction wave, shock wave or contact wave. In [22], 19 particular configurations for initial values are given. Because configurations 17 and 19 deal with all of the mentioned waves, we apply the Dirac-delta filter to them. The results of the following configurations are obtained by using a polynomial degree of \(N = 7\) on a grid of \(60^2\) elements with \(\texttt {CFL} = 0.1\).

Configuration 17 The four initial conditions of configuration 17 are defined for the primitive variables as

$$\begin{aligned}&\varrho _{t\ell } = 2,&v_{1,t\ell } = 0,&v_{2,t\ell } = -0.3,&p_{t\ell } = 1 \\&\varrho _{b\ell } = 1.0625,&v_{1,b\ell } = 0,&v_{2,b\ell } = 0.2145,&p_{b\ell }=0.4 \\&\varrho _{tr} = 1,&v_{1,tr} = 0,&v_{2,tr} = -0.4,&p_{tr} = 1 \\&\varrho _{br} = 0.5197,&v_{1,br} = 0,&v_{2,br} = -1.1259,&p_{br} = 0.4. \end{aligned}$$

We run the approximation to \(T= 0.3\). The pseudo-color plot of the density in Fig. 5 is obtained by using the adaptive filter with a Dirac-delta approximation of \((m,k) = (5,7)\). The support width \(\varepsilon \) is calculated by \(N_d = 4.5\) in (3.7), where the tolerances are set to \(\sigma _\text {min} = -8\) and \(\sigma _\text {max} = -3\). As illustrated in the plot, the filter ensures a successful regularization of shocks while keeping a high resolution of the vortex.

Fig. 5
figure 5

Density (left) and pressure (right) of the four state Riemann test configuration 17 at \(T=0.3\) for \(N=7, N_Q = 60^2, \texttt {CFL}=0.1\) filtered adaptively with \((m,k)=(5,7), N_d=4.5, \sigma _\text {min} = -8\) and \(\sigma _\text {max} = -3\)

Configuration 19 The initial conditions for the primitive variables of configuration 19 are defined as

$$\begin{aligned}&\varrho _{t\ell } = 2,&v_{1,t\ell } = 0,&v_{2,t\ell } = -0.3,&p_{t\ell } = 1 \\&\varrho _{b\ell } = 1.0625,&v_{1,b\ell } = 0,&v_{2,b\ell } = 0.2145,&p_{b\ell }=0.4 \\&\varrho _{tr} = 1,&v_{1,tr} = 0,&v_{2,tr} = 0.3,&p_{tr} = 1 \\&\varrho _{br} = 0.5197,&v_{1,br} = 0,&v_{2,br} = -0.4259,&p_{br} = 0.4. \end{aligned}$$

Again, we filter adaptively after every time step with a Dirac-delta approximation defined by \(m = 5, k=7\) and a support width calculated using \(N_d = 4.5\). Figure 6 demonstrates the approximation for the density and the pressure at the final time \(T=0.3\), where the adaptive filtering again has minimum and maximum tolerances of \(\sigma _\text {min} = -8\) and \(\sigma _\text {max} = -3\). As before, the filter effectively regularizes shocked areas. Additionally, the adaptive filtering step ensures high resolution of the curly area in the center of the domain.

Fig. 6
figure 6

DGSEM approximation of density \(\varrho \), left, and pressure p, right, adaptively filtered after every time step at \(t = 0.3\) for \((m,k)=(5,7)\), \(N_d=4.5, \sigma _\text {min} = 10^{-8}\) and \(\sigma _\text {max} = 10^{-3}\)

4.1.4 Double Mach Reflection

As a final Euler test case, we consider the double Mach reflection problem, see e.g. [30]. This challenging problem is defined on the domain \(\varOmega = [0,3.25]\times [0,1]\) and involves both, strong shock interactions and different boundary conditions. An initial shock separates a left and right state defined by the primitive variables, i.e.

$$\begin{aligned}&\varrho _{L} (x,y,0)= 8,&\varrho _{R} (x,y,0)= 1.4, \\&v_{1,L} (x,y,0)= 8.25\cdot \frac{\pi }{6},&v_{1,R} (x,y,0)= 0, \\&v_{2,L} (x,y,0)= -8.25\cdot \frac{\pi }{6},&v_{2,R}(x,y,0) = 0 ,\\&p_{L} (x,y,0)= 116.5,&p_{R} (x,y,0)= 1. \end{aligned}$$

In particular, the shock is initially located at \(x = 1/6, y=0\) along a linear slope, which includes an angle of \(\alpha = \pi /3\) with the x-axis, defining the initial conditions

$$\begin{aligned} (\varrho , v_1, v_2, p) = {\left\{ \begin{array}{ll} (\varrho _L, v_{1,L}, v_{2,L}, p_L), &{}\quad \text {if } x <\frac{1}{6}+\frac{y}{\sqrt{3}}, \\ (\varrho _R, v_{1,R}, v_{2,R}, p_R), &{}\quad \text {if } x \ge \frac{1}{6}+\frac{y}{\sqrt{3}}. \end{array}\right. } \end{aligned}$$

Thus, the boundary conditions at the bottom for \(x < 1/6\) as well as at the left and upper domain boundaries are set to Dirichlet-values all through the simulation. Especially, the latter have to be implemented correctly by an analytical shock profile, since the shock moves forward and its position is determined by the following function

$$\begin{aligned} s(t) = \frac{1}{6} + \frac{1+20t}{\sqrt{3}}. \end{aligned}$$

Using this function, the values at the top boundary are set to

$$\begin{aligned} (\varrho , v_1, v_2, p) = {\left\{ \begin{array}{ll} (\varrho _L, v_{1,L}, v_{2,L}, p_L), &{}\quad \text {if } x <s(t), \\ (\varrho _R, v_{1,R}, v_{2,R}, p_R), &{}\quad \text {if } x \ge s(t) \end{array}\right. } \end{aligned}$$

Furthermore, the right boundary conditions are outflow and the bottom is considered a reflecting wall for \(x > 1/6\). Hence, in the filtering process the according ghost cell values are set constantly either to the analytical solution for Dirichlet or to the last interior value for outflow and reflection.

In our simulation of this problem, we use a high grid resolution of \(325 \times 100\) elements, a polynomial degree of \(N=7\) and a CFL number of \(\texttt {CFL} = 0.1\). We provide a density plot at the final time \(T=0.2\) in Fig. 7, where we applied the adaptive multi-element SIAC filter with \(m = 3, k = 6, N_d = 2.5\) and the according tolerances \(\sigma _\text {min} = -6, \sigma _\text {max} = -2\). Compared to the previous shock tests, the number of vanishing moments had to be reduced in order to get smoother results. With these particular configurations, the approximation shows the curved reflected shock as well as the formation of a turbulent vortex, which compare well to the simulation results in the literature, e.g. [32].

Fig. 7
figure 7

Density of the double Mach reflection at \(T = 0.2\) for \(N=7,\texttt {CFL}=0.1\) on \(325 \times 100\) elements filtered adaptively with \((m,k)=(3,6), N_d=2.5, \sigma _\text {min} = -7\) and \(\sigma _\text {max} = -2\)

4.2 Ideal MHD Tests

Next, we consider the ideal magneto-hydrodynamic (MHD) equations, which can be expressed in a compact form as a system of conservation laws

$$\begin{aligned} U_t + F_x + G_y = 0 \end{aligned}$$
(4.8)

with

$$\begin{aligned} U= & {} \begin{pmatrix} \varrho \\ \varrho \mathbf {v} \\ \varrho e \\ \mathbf {B} \end{pmatrix}, ~~~ F = \begin{pmatrix} \varrho v_1 \\ \varrho v_1^2 + p + \frac{1}{2}\Vert \mathbf {B}\Vert ^2 - B_1^2 \\ \varrho v_1v_2 - B_1B_2 \\ \varrho v_1v_3-B_1B_3 \\ v_1\left[ \varrho e + p + \frac{1}{2} \Vert \mathbf {B}\Vert ^2\right] - B_1(\mathbf {v}\cdot \mathbf {B}) \\ 0 \\ v_1B_2-v_2B_1 \\ v_1B_3-v_3B_1 \end{pmatrix} , \nonumber \\ G= & {} \begin{pmatrix} \varrho v_2 \\ \varrho v_1v_2 - B_1B_2 \\ \varrho v_2^2 + p + \frac{1}{2}\Vert \mathbf {B}\Vert ^2 - B_2^2 \\ \varrho v_2v_3 - B_2B_3 \\ v_2\left[ \varrho e + p + \frac{1}{2} \Vert \mathbf {B}\Vert ^2\right] - B_2(\mathbf {v}\cdot \mathbf {B}) \\ v_2B_1-v_1B_2 \\ 0 \\ v_2B_3-v_3B_2 \end{pmatrix} \end{aligned}$$
(4.9)

Here, \(\mathbf {v}=(v_1,v_2,v_3)^T\) denotes the velocity field and \(\mathbf {B}=(B_1,B_2,B_3)^T\) the magnetic field components. As for the Euler equations, the system is closed by the perfect gas equation, which for the ideal MHD equations reads

$$\begin{aligned} p = (\gamma -1)\left( \varrho e - \frac{1}{2}\varrho \Vert \mathbf {v}\Vert ^2 - \frac{1}{2}\Vert \mathbf {B}\Vert ^2\right) , \end{aligned}$$
(4.10)

where \(\gamma \) again denotes the adiabatic coefficient.

For the ideal MHD equations it is well known, that magnetic monopoles are not observed in nature, but due to round-off errors, numerically \(\nabla \cdot \mathbf {B} = 0\) is not necessarily guaranteed. Hence, to maintain the divergence-free condition of the magnetic field \(\nabla \cdot \mathbf {B} = 0\) we implement a hyperbolic divergence cleaning method based on generalized Lagrangian multiplier [10].

In the following we demonstrate the performance of the local SIAC Dirac-delta filter for two common benchmark problems of the two-dimensional MHD simulations including (strong) shocks.

4.2.1 Orszag–Tang Vortex

The first test case describes the evolution of a turbulent plasma cloud, the well-known Orszag–Tang vortex [1], which is initialized in the periodic domain \(\varOmega = \left[ 0,1\right] ^2\) as

$$\begin{aligned} \varrho =&~ \gamma \, \frac{5}{12\pi }, ~~~~~~~~~~~~\, v_1 = -\sin (2\pi y), ~~~~~~~~~~~~\, v_2 = \sin (2\pi x), \\ p =&~ \frac{5}{12\pi }, ~~~~~~~~~~~~~~ B_1 = -\frac{1}{\sqrt{4\pi }} \sin (2\pi y), ~~~~~\, B_2 = \frac{1}{\sqrt{4\pi }} \sin (4\pi x). \end{aligned}$$

The other variables are initially set to zero and \(\gamma =5/3\). Furthermore, we use \(\texttt {CFL} = 0.5\), polynomials of degree \(N\!=\! 5\) and \(40 \times 40\) elements for the following simulations of this test case.

We show the evolution of the density in the plots below (Fig. 8) smoothed by the multi-element SIAC filter with \(m = 3, k = 8\) and a fixed \(\varepsilon = 1.4\). As for the Euler tests, we apply the filtering adaptively as shown in (3.25) with the pressure as a shock indicator and \(\sigma _{\min }=\sigma _{\max }=-8\). Further, we show the distribution of the cell-wise constant convex parameter \(\lambda \) from (3.25) at the same stages in Fig. 9, which confirms the correct tracking of shocks as they evolve.

Fig. 8
figure 8

Time evolution of the Orszag–Tang vortex density on \(40 \times 40\) elements with \(N\!=\! 5\) and \(\texttt {CFL} = 0.5\) filtered adaptively with \(m = 3, k = 8, \varepsilon = 1.4\) and \(\sigma _{\min }=\sigma _{\max }=-8\)

Fig. 9
figure 9

Time evolution of the convex parameter \(\lambda \) on \(40 \times 40\) elements with \(N\!=\! 5\) and \(\texttt {CFL} = 0.5\) filtered adaptively with \(m = 3, k = 8, \varepsilon = 1.4\) and \(\sigma _{\min }=\sigma _{\max }=-8\)

In order to assess the performance of the two-dimensional Dirac-delta filter, we compare the simulation results to a reference solution obtained by the publicly available high performance application code FLASH (http://flash.uchicago.edu/site/flashcode/). Particularly, this highly resolved reference solution is computed by a second order MUSCL-Hancock finite volume method (see e.g. [36]) on \(1024 \times 1024\) elements. Further, we apply the filter once more to the Orszag–Tang vortex with different parameters, i.e. we choose \(m = 1, k = 6, \varepsilon = 1.6, \sigma _{\min }=-9\) and \(\sigma _{\max }=-6\). In Fig. 10 we provide two slices of the Orszag–Tang vortex at the final time \(T=0.5\), in which we cut through the density distribution at \(x=y\) (left) and \(y=0.3\) (right) to compare the profiles obtained by the multi-element SIAC filter against a reference solution.

Fig. 10
figure 10

Orszag–Tang-vortex density slices at \(x = y\) (left) and \(y = 0.3\) (right) for \(T = 0.5\), CFL = 0.5, \(N = 5\) and \(40 \times 40\) elements

We see that the oscillations are smoothed out by the multi-element SIAC filter and the approximation matches the reference solution quite well, but the filtering technique still produces little overshoots at shocks. However, taking into account the coarse resolution of \(40 \times 40\) elements, the filter generates reasonable approximations for this shock test, as it stabilizes the approximation and regularizes it against spurious oscillations.

4.2.2 Magnetic Rotor

The second test case describes a rotating dense circle in a static fluid, that generates strong circular shock waves [1]. In general this benchmark problem is defined in the same periodic domain \(\varOmega = \left[ 0,1\right] ^2\) by the radius \(r = \sqrt{(x-0.5)^2+(y-0.5)^2}\) and the slope \(s=\frac{r_1-r}{r_1-r_0}\). The initial primitive variables for the magnetic rotor are stated in Table 5, where the unlisted quantities are initially zero in the entire domain and \(\gamma =1.4\).

Table 5 Initial primitive states for the magnetic rotor test

In our simulations we define \(r_0=0.1, r_1=0.115\) and \(u_0=2\). We use \(\texttt {CFL} = 0.5\), a polynomial degree of \(N\!=\! 4\) and \(100\times 100\) elements. We show the density and pressure at \(T=0.15\) in Fig. 11. Due to the strong circular shocks combined with the high-order DG approximation this test case is extremely sensitive and unstable. Therefore, we apply the SIAC filtering matrix constructed by a Dirac-delta kernel with only one vanishing moment \(m = 1\) and \(k = 5\). Again, we smooth the approximation adaptively with the density as a shock indicator, \(\sigma _{\min }=-9, \sigma _{\max }=-6\) and a fixed \(\varepsilon = 1.4\).

Fig. 11
figure 11

Magnetic rotor density (left) and pressure (right) at \(T=0.15\) for \(\texttt {CFL}= 0.5, N\!=\! 4\) on \(100 \times 100\) elements filtered adaptively with \((m,k)=(1,5), \varepsilon = 1.4, \sigma _\text {min} = -9\) and \(\sigma _\text {max} = -6\)

In Fig. 11 we see, that the local SIAC filter performs well in terms of stabilizing the approximation and regularizing oscillatory regions, but is polluted by small mesh artifacts, which are particularly visible at the generated Alfvén waves in the pressure profile. Nonetheless, the novel filter produces reasonable approximations even for such a challenging test problem including strong circular shock waves.

5 Conclusion

We have presented a novel shock capturing technique for DG methods based on multi-element SIAC filtering. In particular, we have first introduced the DGSEM on two-dimensional Cartesian meshes, before we have derived the local filter matrix from the global SIAC filtering approach constructed by approximations of Dirac-delta kernels. Moreover, we have designed an adaptive filtering strategy and extended the overall method to higher spatial dimensions. Finally, we have verified the applicability of the filter to a variety of challenging shock problems for both, the two-dimensional Euler and the ideal MHD equations.

We have demonstrated that the multi-element SIAC filter indeed performs well in terms of regularizing oscillatory regions and stabilizing the approximation. However, the main issue of the constructed filter is the introduction of spurious, albeit small, conservation errors, which might be avoided by projections onto discontinuous basis functions across cell interfaces. This, together with the investigation of the entropic properties as well as the extension of the local SIAC filter to curvilinear elements are future research projects.