1 Introduction

Most flows in technical applications are defined by the geometrical properties of the enclosing or the contained objects, which are often of complex shape. To simulate flows in such settings, commonly grids are constructed, where cell boundaries or grid lines are aligned with the boundaries of the objects. This simplifies the implementation of boundary conditions, as these conditions can be enforced at specific cell boundaries or grid lines. However, the construction of such grids often is a considerable effort on its own.

Alternatively, simple Euclidean grids can be used and the object boundaries can be approximated by force-like terms. Different approaches are in use. With the immersed boundary (IB) methods the boundary is given by a set of point forces, as in a pioneering work by Peskin [47] for the simulation of heart valves. An IB Method for compressible flow is presented for example by Palma et al. [20].

The point forces are distributed to the closest grid points by utilizing discrete delta functions. The cut-cell approach is often used for finite volume schemes, where the cells are divided along the object boundary as introduced by Berger et al. [9], see also [49, 56]. While in principle simple, extra care is needed to avoid very small or distorted cells. Often immersed boundaries are used for fluid-structure interaction, a recent review is provided by [37]. An interesting approach was recently presented in [35], in which ghost points and interpolation is combined with summation-by-parts finite differences. The latter guarantees well-defined fluxes, which is helpful for stability.

This article focuses on Brinkman penalization, for which not only the boundary but the whole interior of the object is forced. This can be viewed as a sponge-like or porous medium, which becomes impenetrable for a vanishing porosity. Often the porosity associated force terms do not jump at the interface, instead, they are smoothed over a few grid points to avoid numerical problems. It is also advantageous for moving objects, where otherwise the discrete inclusion of grid points yields high-frequency fluctuations in the numerical solution.

In the most simple case, the porous object is modeled by the Darcy term, an extra friction term punishing a flow velocity relative to the object’s movement. Its original application is to describe flows through porous media in technical or geological applications, as for example done by Masson and co-workers [24]. As a penalization method it is used by Boiron et al. [11] for compressible flows and by Farge et al. [52] for incompressible flows. Angot et al. present [4] convergence theorems to the true solution for incompressible flows. Despite its simplicity, it often yields good results. For example, a highly resolved incompressible flapping flight simulation, as a flow around moving objects, is presented by Engels et al. [21]. Due to the finite strength of the Darcy term, the non-slip condition is effectively replaced by an exponential decay of the flow velocity in the object. The smearing of the interface increases this effect. This can be mitigated by a locally refined grid of a multi-resolution approach, which is, combined with an artificial compressibility method, presented by Engels et al. [23]. The effect of the smoothing of the mask function on the convergence of the solution is investigated for incompressible flows by Hester et al. [28]. It is found that the slow convergence observed in earlier work is due to a displacement of the effective boundary, which can be improved by an optimally chosen smoothing.

Liu and Vasilyev [40] treat compressible flows by a Brinkman penalization method popularizing the approach in the compressible regime. They include both, the linear friction relative to the object (Darcy’s law), and the effective volume fraction remaining for the fluid \(\phi \), which is often called porosity. In this publication, it will be referred to as volume fraction to distinguish it from porosity as a complex physical setting. The difference to the here proposed scheme will be discussed below in Sect. 2. Komatsu et al. [38] calculate acoustic radiation of flows passing different objects by a variant of the method of Liu and Vasilyev [40], which is modified to be invariant under Galilean transformation.

The shallow water equations are mathematically very similar to compressible flows. In the work of Kevlahan et al. [34], a Brinkman penalization method is derived for these equations from a variational principle, paying particular attention to the volume fraction. It is pointed out that the transport of momentum and mass should be consistent, and that the speed of sound should not be modified by the volume fraction, to avoid stiffening of the equations.

Following the discussion of Kevlahan et al. [34], the effect of the volume fraction is investigated in this report. Similar to the shallow water equations presented there, compressible Navier-Stokes equations are derived, where consistency in the treatment of the volume fraction is emphasized. In this publication, it is shown that the volume fraction is helpful in the context of Brinkman penalization in many aspects, namely in avoiding stiffness, in creating slip boundaries, and good adiabatic boundaries, and for conservation properties. Interestingly the derived equations were presented before by Liu and Vasilyev [40], as the fundamental equations for flow through porous material by Darcy, but where turned down following arguments in Nield and Bejan [44] and Beck [7], suggesting structural problems. However, here no such structural problems appear, instead, it is found that the volume fraction and Darcy term can be chosen largely independently, resulting in a substantial extension of possible boundary conditions for the Brinkman penalization method.

Recently Kemm et al. [33] described a similar method derived from a two-phase flow based on the Baer-Nunziato model [6], reducing it to one fluid phase and prescribing the front movement. It is referred to as a diffuse interface approach and not as Brinkman penalization. These equations agree with the here obtained equations when the Darcy friction terms are neglected. Source terms similar to the Darcy friction are discussed for the Baer-Nunziato model by Kapila et al. [32]. While here the focus here the is on static boundaries, Kemm et al. [33] successfully investigates moving boundaries and discusses in a rigorous manner the non-penetration condition. Their numerical implementation builds on the ADER predictor-corrector discontinuous Galerkin approach by Dumbser et al. [13, 17, 18], where the fluxes are calculated by an approximate Riemann solver. The Riemannn problem for the Baer-Nunziato model is discussed in depth by Andrianov et al. [2, 3] and Han et al. [27]. A Riemann solver for the Baer-Nunziato model are discussed for example by Torro et al. [55] (HLLC-type) or Pelanti et al. [46] (Roe type).

The perspective of a two-fluid model allows an elegant description of fluid-structure interaction by an Euerian description of the elastic solid as described by Favrie et al. [25, 43] and including reactive matter as describe by Michael et al. [42]. Acoustic waves in geological settings for non-simple geometries are discussed by Taveli et al. [53]. Similarly, free surfaces of fluids are described by Dumbser [16] and by Gaburro et al. [26].

The basic principle of the here presented method is closely related to the one of Kemm et al. [33]. It is motivated by the Brinkman penalization method and not by the Baer-Nunziato model, thereby bringing these different modeling approaches together. The simple geometry treatment allows to use (conservative) finite differences, which are fully explicit and straightforward to implement. To permit the application of finite difference to a wide range of problems a filtering strategy must be adapted, which allows a locally varying filter strength and is conservative for a variable reduced volume \(\phi \). The resulting method is efficient and is tested on acoustic, strongly compressible, and near incompressible flows.

The paper is organized as follows. In Sect. 2 the basic equations are derived following the ideas described in [34] and the conservation properties are discussed. The application of a filter demands a modification, which is described in Sect. 3. Numerical examples underpinning the claims are presented in Sect. 4. First, the good acoustic properties are discussed in Sect. 4.1 including the stiffness of the method and the containment for large pressure gradients. On the other hand, in Sect. 4.2 the flow configuration of potential flow with slip around a cylinder and a supersonic flow along a wedge is shown. The conservation properties are tested for a strongly unsteady blast wave in containment. Finally, a vortex street as an example for a simulation with a refined grid is presented. The results are summarized in Sect. 5. The Appendix A provides technical details of the finite difference method and the filter.

2 The Penalized Equations

Here, the modification of flow equations to represent immersed objects will be derived in analogy to one-dimensional gas dynamics.

2.1 Derivation of the Analytical Equations

The modified equations are to include the effects of reduced effective volume fraction \(\phi = V_\mathrm {fluid}/V_\mathrm {total}\), since the volume of the material occupied by porous media is unavailable for the fluid. It is expected that the equations mainly scale with the volume fraction since mass, momentum, and energy scale likewise. The Darcy term, describing linear friction proportional to the relative velocity between flow and object, is added in a second step. As stated by Kevlahan et al. [34] for the shallow water equations, it is important that mass and momentum (and for the Navier-Stokes equations, energy) are transported with the same speed. We also want to keep the speed of sound c unaltered by the penalization, since this suggests that the same CFL condition CFL = \( (|u| + c) \varDelta t/\varDelta x \) stays valid [34]. The validity of this assumption is discussed below in Sect. 4.1.3.

Instead of deriving the equations from first principles by the theory of variations as in [34], we observe that for one dimension the Euler equations of varying cross-section are structurally similar to the equations derived in [34]. The speed of sound is independent of the cross-section \(\phi \), and the transport of mass and momentum are modified in the same way. Further, the essential modification by \(\phi \) in [34] is a non-conservative pressure gradient \(\phi \partial _x p\), as it appears in one-dimensional gasdynamics, see Eq. (5). This can be motivated by the fact that no specific distribution of the porous material was prescribed. By this, it can be reorganized microscopically as a tube of reduced cross-section, see Fig. 1. This was recognized before, see [3] and references therein.

Fig. 1
figure 1

The effective volume for the fluid can be interpreted in a quasi-one-dimensional flow as a reduced cross-section by reorganizing the material of a flow tube, yielding a configuration known from the theory of stream lines. This gives an extra pressure source term in the momentum equation

This leads to an extra factor \(\phi \) in every flux term and an additional source term \(p\partial _x \phi \) for the momentum equation, which is detailed in text-books of gasdynamics, e.g. [1]. A similar modification of the pressure gradient can be identified in the shallow water equation for an uneven bottom height [34] and the Navier-Stokes equation in cylindrical coordinates, where the role of the reduced cross-section is the circumference proportional to the radius r|.Footnote 1 It is also found for porous material [44] and in the Baer-Nunziato model for multi-phase flow [3], see below. In all these applications a reduction of a cross-section-like property yields a source term in the momentum equation of this type.

The equations for mass, momentum, and energy in one dimension without friction are therefore just the equations for one-dimensional gas dynamics in varying cross-section \(\phi \)

$$\begin{aligned} {\phi \partial _t \rho } + \partial _x( \phi \rho u)&= 0 \end{aligned}$$
(1)
$$\begin{aligned} {\phi \partial _t (\rho u)} + \partial _x( \phi \rho u u) + \partial _x \phi p&= p\, \partial _x \phi \end{aligned}$$
(2)
$$\begin{aligned} {\phi \partial _t (\rho e_t ) + \partial _x( \phi \rho u e_t ) + \partial _x( \phi u {p} ) }&= 0. \end{aligned}$$
(3)

We introduced the mass density \(\rho \), the velocity u, the pressure p and the total energy \(e_\mathrm {t} = u^2/2 + e_\mathrm {in}\), where we in the following assume the internal energy of an ideal gas \( e_\mathrm {in} = \frac{p}{\rho }\frac{1}{\gamma -1} \), with the adiabatic index \(\gamma \). In principle, the varying cross-section \(\phi \) can have arbitrary (positive) values. In the following it is identified with the reduced volume by porosity, so that it is in the range \(\phi =[0,1]\). In the vanishing limit \(\phi \rightarrow 0 \) no volume is left for the fluid. The volume fraction appears linearly in all terms on the left-hand side, whereas the term on the right-hand side is a source term without a derivative of any of the dynamical variables. From this, it follows that the equations are hyperbolic with unchanged characteristic velocities: the acoustic waves with \(\uplambda _\pm = u\pm c \) with the speed of sound \(c=\sqrt{\gamma p /\rho }\) and the entropy wave \(\uplambda _s = u\). Further, all flux terms are modified in the same manner, so that the consistency demand of [34] is automatically fulfilled. If \(\phi \) is constant (and non-zero), the equations reduce to the standard one-dimensional Euler equations.

Due to the source term \(p\, \partial _x \phi \), the momentum is not conserved, whereas the total mass and energy are conserved. This is physically sound, since a change in cross-section creates reflections, whereas mass and energy are unaltered.

The Eqs. (1)–(3) can be generalized straightforwardly to multiple dimensions and augmented with dissipative terms. Summing convention is assumed for all Greek indices \(\alpha , \beta =1,2,3\) marking spatial directions. The two pressure terms in the momentum equation have been combined \(\partial _{x_\alpha } (\phi p ) - p\partial _{x_\alpha } \phi = \phi \partial _{x_\alpha } p \), resulting in the equations

$$\begin{aligned} \partial _t (\phi \rho ) + \partial _{x_\alpha }( \phi \rho u_\alpha )&= 0 \end{aligned}$$
(4)
$$\begin{aligned} \partial _t (\phi \rho u_\alpha ) + \partial _{x_\beta }( \phi \rho u_\beta u_\alpha ) + \phi \partial _{x_\alpha } p&= \phi \chi (u_\alpha ^\mathrm {t} - u_\alpha ) + \partial _{x_\beta } (\phi \tau _{\alpha \beta }) \end{aligned}$$
(5)
$$\begin{aligned} \partial _t (\phi \rho e_t ) + \partial _{x_\alpha }( \phi \rho u_\alpha e_t + \phi u_\alpha {p} )&= \partial _{x_\alpha } ( \phi u_\beta \tau _{\alpha \beta } ) + \partial _{x_\alpha } (\phi \uplambda \partial _{x_\alpha } T). \end{aligned}$$
(6)

Further, the Darcy friction term is included in the momentum equation with a spatially dependent force strength \(\chi = 1/\eta \) and the target value \( u_\alpha ^\mathrm {t} \), which is the speed of the immersed object, which is always zero in this report. We also assume that the objects are static, i.e. \(\phi \) and \(\chi \) are time independent, in the following. The dissipative term contain the temperature \( T = p/\rho R W \) with the universal gas constant R and the molecular weight W. The viscous friction is given by \(\tau _{\alpha \beta } = \mu \left( \partial _{x_\beta } u_\alpha + \partial _{x_\alpha } u_\beta \right) + (\mu _d -2/3 \mu ) \delta _{\alpha ,\beta } \partial _{x_\gamma } u_\gamma \) with \(\mu \) and \(\mu _d\) the shear and volumetric friction and \(\delta _{\alpha ,\beta }\) the Kronecker delta. Similar to the Darcy term, a penalization can be added to the energy equation to enforce e.g. isothermal boundary conditions, [11]. These dissipative fluxes are scaled by \(\phi \) since these fluxes take place in the fluid part only. It also keeps the symmetry of the dissipation terms, i.e. guarantees negative semi-definite operators.

Comparison with former schemes Liu and Vasilyev [40] discuss different equations for the Brinkman penalization, of which some agree with here proposed equations, while the equations used in the numerical implementation [40, eqn. (18–20)] do not. For example their mass equation is

$$\begin{aligned} \partial _t \rho = - \left[ 1+ \left( \frac{1}{\phi }-1\right) \chi \right] \partial _\alpha m_\alpha \end{aligned}$$
(7)

with \(\chi \) the mask function and \(m_\alpha = \rho u_\alpha \). In contrast, the mass equation in the initial discussion [40, (eqn 2)] and the momentum equation [40, (eqn 5)], attributed to Wooding [60], agrees with our equations.Footnote 2 For the latter, the mass equation (4) needs to be split off the momentum equation (5)

$$\begin{aligned} \rho \partial _t ( u_\alpha ) + \rho u_\beta \partial _{x_\beta }(u_\alpha ) + \partial _{x_\alpha } p&= \chi (u_\alpha ^\mathrm {t} - u_\alpha ) + \frac{1}{\phi }\partial _{x_\beta } (\phi \tau _{\alpha \beta }) \end{aligned}$$
(8)

by which the volume fraction cancels in all terms beside the shear friction term. This is structurally also found by Kevlahan et al. [34]. However, the (steady state) momentum equation given by Wooding [60, (eqn. 6)] in the cited reference is

$$\begin{aligned} \frac{1}{\rho }\nabla p - {\mathbf {g}} + \frac{1}{k} \nu {\mathbf {q}} = - \phi ^{-2} {\mathbf {q}}\cdot \nabla {\mathbf {q}} \end{aligned}$$
(9)

with \({\mathbf {q}}= \phi {\mathbf {u}}\) (aligned to our notation), with \({\mathbf {g}}\) the gravity vector and k the Darcy friction factor. The combination of the pressure term and the non-linear transport term disagrees with (8) and not all terms have the same order in \(\phi \).

Liu and Vasilyev abandon Wooding’s equation, similar to the here proposed, due to an argument of Beck [7], who, however, uses a Darcy equation (his Eq. 1), where a constant \(\phi \) does not cancel. Beck finds an insufficient number of boundary conditions for his buoyancy flow, however, no problems are apparent for the here used Eqs. (45). The momentum equation of Nield and Bejan [44, (page 8)] agrees with the here found equation. They argue to drop the non-linear transport, by citing Beck, and by practical considerations for a real porous material, which does not seem imperative for our artificial application of porous model. Instead, it is shown in the simulations that equations used here, with all terms linear in \(\phi \), allow to choose the volume fraction \(\phi \) and the Darcy term largely independently, making it possible to model different boundary conditions. The way \(\phi \) enters the equations in this article agrees with the equations of Kemm et al. [33], derived from the two-phase flow of Baer-Nunziato model. A similar approach for acoustic waves is given by Tavelli et al. [53].

Moving Objects Moving objects imply a time dependency of the cross-section \(\phi =\phi (t)\), which results in additional terms in the governing equations. These are derived here for the sake of completeness and fully agree with Kemm et al. [33].

A time-dependent reduced volume can be interpreted as a flux term, see Fig. 2. For example for the mass equation, the balance equation of an infinitesimal volume is

$$\begin{aligned} \int _\varOmega (\partial _t \rho ) \mathrm {d}V + (\phi \rho u )_{x_2} - (\phi \rho u )_{x_1} + ( \rho v)_{y=\phi } - ( \rho v)_{y=0} = 0 . \end{aligned}$$
(10)

Here, we assume that the horizontal fluid velocity is constant for one x-position, so that the flux along the boundaries at \(x_1\) and \(x_2 \) is a factor \(\phi \). The vertical velocity at the lower boundary is assumed to be zero \(v(0)= 0 \) and \( v(\phi ) = \partial _t \phi \) at the upper boundary. For an infinitesimal \(\varDelta x \) the volume integral can be replaced by a multiplication with the volume \( \int _\varOmega dV = \phi \varDelta x\). By this (10) results in \( \phi \varDelta x \partial _t \rho + (\phi u \rho )_{x_2} - (\phi u \rho )_{x_1} + \varDelta x \rho \partial _t \phi = 0 \), or for \(\varDelta x \rightarrow 0 \) and with the help of the product rule

$$\begin{aligned} \partial _t \phi \rho + \partial _x (\phi u \rho ) = 0 \end{aligned}$$
(11)

In the same manner, the transport terms for momentum and energy produce the term necessary to include \(\phi \) in the time derivative. Reconsidering all terms of (46) in this manner, one finds that only one further term is created by a time dependent \(\phi \) which arises from the pressure work term in the energy equation. The same reasoning as above shows that the pressure work term \(\partial _x( \phi u {p} )\) becomes\(\partial _x( \phi u {p} ) + p \partial _t\phi .\)

Fig. 2
figure 2

A time-dependent effective volume introduces addition flux terms, as \({\dot{\phi }}\) can be identified with a velocity at the boundary, see text

The Eqs. (46) become

$$\begin{aligned} \partial _t (\phi \rho ) + \partial _{x_\alpha }( \phi \rho u_{\alpha })&= 0 \end{aligned}$$
(12)
$$\begin{aligned} \partial _t (\phi \rho u_\alpha ) + \partial _{x_\beta }( \phi \rho u_\beta u_\alpha ) + \phi \partial _{x_\alpha } p&= \phi \chi (u_\alpha ^\mathrm {t} - u_\alpha ) + \partial _{x_\beta } (\phi \tau _{\alpha \beta }) \end{aligned}$$
(13)
$$\begin{aligned} \partial _t (\phi \rho e_t ) + \partial _{x_\alpha }[ \phi \rho u_\alpha ( e_t + u {p} ) ] + p \partial _t \phi&= \partial _{x_\alpha } ( \phi u_\beta \tau _{\alpha \beta } ) + \partial _{x_\alpha } (\phi \uplambda \partial _{x_\alpha } T) \end{aligned}$$
(14)

A similar derivation for moving walls for the flow of blood is presented in [5], where the density becomes a constant due to the incompressibility assumption. The equations agree with Kemm et al. [33] if the Darcy and viscous terms are omitted.

To elucidate the relevance of these extra terms, we use the product rule for time derivative terms, and splitting of the kinetic energy \( u_\alpha u_\alpha /2= e_t - e_\mathrm {in} \) from the total energy equation to arrive at (in 1D)

$$\begin{aligned} \phi \partial _t ( \rho ) + \partial _x( \phi \rho u)&= - \rho {\dot{\phi }} \end{aligned}$$
(15)
$$\begin{aligned} \phi \partial _t ( \rho u) + \partial _x( \phi \rho u u) + \phi \partial _x p&= -\rho u {\dot{\phi }} \end{aligned}$$
(16)
$$\begin{aligned} \phi \partial _t ( \rho e_\mathrm {in} ) + \partial _x( \phi \rho u e_\mathrm {in} ) + \partial _x( \phi u {p} ) - \phi u \partial _x p&= - ( p+ \rho e_\mathrm {in} ) {\dot{\phi }} . \end{aligned}$$
(17)

For the total energy of an ideal gas \(e_t = (p/\rho )\cdot 1/(\gamma -1 ) \) the last equation becomes

$$\begin{aligned} \phi \partial _t ( p ) + \gamma \partial _x( \phi u p ) - (\gamma -1 ) \phi u \partial _x p&= - ( \gamma p ) {\dot{\phi }} \end{aligned}$$
(18)

Without the spatial part a change in \(\phi \) produces a change in the density given by \( d \phi /\phi + d \rho /\rho = 0 \) and \(\phi dp + \gamma p d \phi = 0 \) from which the adiabatic relation \(d p/p - \gamma d \rho /\rho = 0 \) follows. This shows that a temporal changing \(\phi \) is just an adiabatic pressure source, as expected for a homogeneous compression. Splitting off the mass equation from momentum shows that the change in momentum is fully due to the change of density. A detailed discussion of the dynamic \(\phi \) is found in [33].

Implementation Strategy To describe embedded objects, the friction term \(\chi \) can be chosen to be large or \(\phi \) can be made small, where of course a combination is possible. The strategy will be to reduce the volume fraction by several orders of magnitude (typically down to \(10^{-6}-10^{-8}\)) so that the remaining volume is practically zero and by this all convective and viscous fluxes. Second, the Darcy friction is chosen as big as the time step permits for an explicit time marching. Stronger values the Darcy friction could be handled by an implicit or semi-implicit method as, for example, used in [11]. However, a very large choice corresponds to simply setting the target values inside the objects. This reduces the smoothness of the solution having a detrimental effect on the discrete solution. This effect is discussed in more detail for example in [22, 57]. The reduced volume fraction implies a good approximation of the non-penetration condition, producing thereby a slip boundary condition, while the Darcy friction ensures the non-slip part. Close to a boundary, large shear forces result from this, restricting the time step. However, since the Darcy term needs to balance forces similar to the shear forces in the fluid itself, this leads to a very similar stiffness and no additional time step restriction results.

2.2 Conservation Properties

The conservation of mass and energy in the full domain is obvious from (4) and (6), while the momentum (5) is not conserved. However, in the case of immersed objects, it is not the conservation in the full domain \(\varOmega = \varOmega _\mathrm {f} \cup \varOmega _\mathrm {s} \) that is physically relevant, but the conservation in the fluid \(\varOmega _\mathrm {f}\) domain without the objects \( \varOmega _\mathrm {s} \). If we first consider a penalization by a sharply varying \(\phi \) such that

$$\begin{aligned} \phi = \left\{ \begin{array}{cl} \epsilon &{} \varOmega _\mathrm {s}, \text {inside the objects} \\ 1 &{} \varOmega _\mathrm {f}, \text {otherwise} \end{array}\right. \end{aligned}$$
(19)

and remark that the conserved quantities are weighted by \(\phi \), we find e.g. for the mass

$$\begin{aligned} M = \int _\varOmega \phi (\mathrm {x}) \rho (\mathrm {x}) dV&= \int _{\varOmega _\mathrm {f} } \phi (\mathrm {x}) \rho (\mathrm {x}) dV + \int _{\varOmega _\mathrm {s} } \phi (\mathrm {x}) \rho (\mathrm {x}) dV\nonumber \\&=1 \int _{\varOmega _\mathrm {f} } \rho (\mathrm {x}) dV + \epsilon \int _{\varOmega _\mathrm {s} } \rho (\mathrm {x}) dV . \end{aligned}$$
(20)

By this, the total mass is decomposed in mass in the fluid and in the solid region \( M = M_\mathrm {f} + \epsilon M_\mathrm {s} \). The last term is suppressed by a small volume fraction of \(\epsilon \). If the value of the density in the porous region is bounded, its fraction of the total mass is suppressed by \(\epsilon \rightarrow 0 \), the mass in the fluid domain is approximated by the total mass, and therefore approximately conserved. In many practical cases, the maximal values of \(\rho \) in the objects can be estimated from physical reasoning. This can be stagnation values in external flows or a doubling of pressure and density for acoustic reflections. We find very good conservation in tests, with the only ambiguity being the finite thickness of the transition of \(\phi \) from one to \(\epsilon \), which is needed for numerical stability. This smearing of the boundary induces some arbitrariness of the exact location of the object and of the separation of the two integrals in (20). However, mass leaving the fluid domain is not lost, but ’inside’ the boundary region so that this property can be viewed as a not perfectly rigid boundary. The same reasoning can be made for the energy. The momentum is not conserved, as mentioned before, as objects act as momentum sources by deflection flow or reflecting acoustics.

By this, the volume fraction approach implies an (approximate) adiabatic boundary condition, if no temperature is forced. Since the energy content of the gas in the solid region is suppressed by \(\phi \), its total energy content and the fluxes are suppressed by the same factor. By this, only negligible energy enters or leaves the object, assuming again finite values of the energy density in the object.

2.3 Discrete Equations

Immersed boundaries allow using simple Cartesian grids. This permits to use finite difference methods, which are easy to implement and to parallelize. Finite differences allow for small discretization errors by simply using appropriate finite difference stencils. Various finite difference formulations are available. The here used method is a skew-symmetric method, due to the combination of strict conservation and the absence of numerical damping. The first is essential for the faithful treatment of shocks, while the latter is advantageous for the simulation of acoustics and fine turbulence. For skew-symmetric schemes, the momentum transport term is formulated to yield a skew-symmetric matrix after discretization. This has the elementary property that quadratic forms become zero \(q^T A q = 0\) if the matrix A is skew-symmetric \(A=-A^T\). This implies that the discrete momentum transport term does not change the kinetic energy, in agreement with the analytical theory. A violation of this fact is a major source of instabilities since numerical damping or numerical excitation are equally likely.

It is found that the derivation of the skew-symmetric scheme of Reiss et al. [51] can directly be adopted to include \(\phi \). Details can be found in the Appendix A, here we restrict the discussion to a brief description. However, this special discretization is not mandatory and it is expected that other discretizations work as well.

We use \(\sqrt{\rho } , \sqrt{\rho } u_\alpha \) and p as calculation variables. This unusual choice origins from a symmetric splitting of the kinetic energy \( \rho u_\alpha u_\alpha /2= ( \sqrt{\rho } u_\alpha )( \sqrt{\rho } u_\alpha )/2 \). This suggests using \(\sqrt{\rho } \) as a variable to form the velocity \( u_\alpha = (\sqrt{\rho } u_\alpha )/\sqrt{\rho } \), without evaluating the square root of a field. The final equations (for a time constant volume fraction \(\phi \)) are

$$\begin{aligned} \partial _t ( \sqrt{\rho } ) + \partial _{x_\alpha }( \phi \rho u_\alpha )/(2\phi \sqrt{\rho } )&= 0 \end{aligned}$$
(21)
$$\begin{aligned} \phi \sqrt{\rho } \partial _t ( \sqrt{\rho } u_\alpha ) + \frac{1}{2} \left[ \phi \rho u_\beta \partial _{x_\beta } u_\alpha + \partial _{x_\beta }( \phi \rho u_\beta u_\alpha )\right) ] + \phi \partial _{x_\alpha } p&\nonumber \\ =\phi \chi (u_\alpha ^\mathrm {t} - u_\alpha ) + \partial _{x_\beta } (\phi \tau _{\alpha \beta })&\end{aligned}$$
(22)
$$\begin{aligned} \frac{\phi }{\gamma -1 } \partial _t ( p ) + \frac{\gamma }{\gamma -1 }\partial _{x_\alpha }( \phi p u_\alpha ) - \phi u_\alpha \partial _{x_\alpha } p&\nonumber \\ =\partial _{x_\alpha } ( \phi u_\beta \tau _{\alpha \beta } ) + \partial _{x_\alpha } \phi \uplambda \partial _{x_\alpha } T - u_\alpha \left[ \phi \chi (u_\alpha ^\mathrm {t} - u_\alpha ) + \partial _{x_\beta } (\phi \tau _{\alpha \beta }) \right]&. \end{aligned}$$
(23)

The equations are discretized simply by replacing all derivatives with finite differences with symmetric stencils and evaluating all products or divisions pointwise. The time-stepping is the standard fourth-order Runge-Kutta scheme. This is followed by filtering for cases where otherwise highly oscillatory solutions occur, namely when complex geometries focus waves and most importantly for shocks where dissipation is demanded by physics. A specially designed filter is needed in general, which is discussed in Sect. 3.

The whole method is fully explicit and simple to implement. A source code producing all the numerical examples is provided as supplementary information on the journal homepage.Footnote 3

It seems attractive to include \(\phi \) in redefining \(\rho \) and p, but big rounding errors were found in this case for a small \(\phi \), so we refrain from doing so. Note that we divide by \(\phi \) for time-stepping, so that it cannot be set to zero in the numerical implementation. The transport term in the momentum equation is explicitly skew-symmetric, which is preserved if the spatial discretization simply replaces the derivatives with central finite difference matrices. The kinetic energy is changed only by compression work, and not by numerical friction. The total energy as the sum of the kinetic and internal energy is conserved.

The skew-symmetric form suggests an unconditionally stable scheme. For this, a time-stepping that conserves quadratic invariants is needed as presented by Brouwer et al. [12]. To be rigorously norm-stable, the variable \(\sqrt{p}\) instead of the pressure p has to be used, however, this form works very well in our experience. All methods which conserve quadratic invariants are implicit methods. This extra effort does not seem to be justified for many time dynamic simulations, where all scales of interest need to be resolved since stability does not guarantee the correctness of the fast dynamic. Explicit high order time-stepping yields very good conservation properties, so that it can be used in most practical cases as shown for different examples in [12]. The conservation can cheaply be validated during simulation permitting to switch to a different time integrator. A reduction of the time step might often be sufficient as thereby the conversation is strongly improved [12]. Explicit time integrators with improved energy convergence are discussed for incompressible flows by Capuano et al. [14], which might be adopted for our method.

3 Filtering

The non-linearity of the Navier-Stokes equations constantly produces higher wavenumbers, which tend to exceed the grid resolution after some time if not removed by friction terms. This is especially important in shocks, but also at boundaries. The high gradient of the immersed objects can create high-frequency structures up to a grid-to-grid oscillation. To remove these oscillations, artificial dissipation is often applied. Various methods to introduce dissipation exist, an overview is given by Pirozzoli [48]. In the simplest case it is introduced by upwind discretizations or similar by calculating fluxes by a Riemann solver, which creates in effect an upwind stencil for the Riemann invariants [39].

Often hybrid methods are used, which switch based on a flux limiter from a high order, low dissipative to low order dissipative scheme. Alternatively, artificial viscosity by an adaption of the viscous parameters near discontinuities was proposed by Cook et al. [15]. Artificial viscosity and the flux limiting are at least for simple examples structurally similar, see [39, Chap. 16]. Adaptive filtering was introduced with the same purpose by Yee et al. [61], where a filter operation with local filter strength allows to concentrate dissipation near discontinuities. With a similar effect, varying filter order can be applied as used by Visbal et al. [58] and more recently by Patel et al. [45]. A quantitative comparison of the different methods is provided by Johnsen et al. [31]. These non-linear dissipation methods rely usually on a detector of shocks or non-smoothness, which is used to determine the flux limiter, the artificial viscosity, or the filter strength. Different shock detectors are compared in [48].

In the following, a filter is used in the numerical examples. This should not only remove oscillatory components but also allow a locally varying filter strength and especially respect the conservation with the varying volume fraction. Conservative filtering is often achieved by filtering the conserved quantities, however, this is not appropriate here. Consider the mass in one dimension, \(M = \sum _{i } (\rho \phi )_i \varDelta x\), where i runs over all grid points. Filtering \((\rho \phi )_i\) would keep the total mass constant, however, it would tend to increase \(\rho \) where \(\phi \) is becoming small, i.e. inside the boundary of immersed objects. This counteracts the intention to smooth the physical quantities.

Conservative filters similar to [36] are now formulated analogously to dissipative flux terms, which fulfill the desired properties, as argued in the following. The starting point is to define fluxes between two adjacent grid points, similar to finite volume for some variable q (depicted in 1D)

$$\begin{aligned} \overline{ (\phi _i q_i )} = (\phi _i q_i) + (F_{i-1/2} - F_{i+1/2} ) , \end{aligned}$$
(24)

with \(F_{i-1/2} = -(\sigma \phi )_{i-1/2} ( q_i - q_{i-1} )/4 \) and \(F_{i+1/2} = F_{(i+1)-1/2} \). The flux form guarantees the conservation of \(\phi q\) in the filtering, while the flux is non-zero only if q varies and the local flux factor \(\sigma _i\), \((\sigma \phi )_{i-1/2} =(\sigma _{i-1}\phi _{i-1}+ \sigma _{i}\phi _{i})/2 \) is non-zero. The filter strength \(\sigma _i\) can be locally varying and is thereby chosen to filter oscillations within objects or in under-resolved parts of the flow, e.g. close to shocks.

To generalize the dissipation-like filtering (24), it can be written in matrix notation as

$$\begin{aligned} \overline{ (q\phi ) } = (q\phi ) + {\bar{D}} (M (\sigma \phi ) ) D q \, , \end{aligned}$$
(25)

where the expression (24) is recovered with \( ({\bar{D}} u )_i = (u_{i} - u_{i-1})/2 \) and \( ( D u )_i = (u_{i+1} - u_{i})/2 \) and the averaging operation \( (M u )_i = (u_{i-1} + u_{i})/2 \). For the derivation periodic grids are assumed from which the non-periodic case is constructed at the end. This method is second-order if \(\sigma \) and \(\phi \) are constant, and first order otherwise. This form reveals the principle structure whereby the damping and the conservation properties can be checked easily, as now detailed. With \({\bar{D}} = - D^T \), and a positive semi-definite matrix \((M(\phi \sigma ))\) (in our case a diagonal matrix with non-negative elements), we find that the operator \(\bar{D} (M(\phi \sigma )) D\) is negative semi-definite, since

$$\begin{aligned} q^T {\bar{D}} (M(\phi \sigma )) D q = - (D q)^T (M(\phi \sigma ) (D q) \le 0 . \end{aligned}$$
(26)

Obviously \(\overline{ (q\phi ) } = (q\phi )\) holds, if q is constant, since the derivative vanishes for any constant function \( D \mathbf{1 } =0 \), with the vector of constant entries \((\mathbf{1})_i = 1 \), used to depict the sum. The conservation is checked by

$$\begin{aligned} \mathbf{1}^T \overline{ (q\phi ) } = \mathbf{1}^T(q\phi ) + \mathbf{1}^T {\bar{D}} (M (\sigma \phi ) ) D q = \mathbf{1}^T(q\phi ) \end{aligned}$$
(27)

due to the telescoping property \( \mathbf{1}^T {\bar{D}} =0 \) for periodic grids.

To generalize to higher order, appropriate \({\bar{D}} \) (thereby \(D=-{\bar{D}}^T\)) and M, fulfilling the mentioned properties, can be chosen. We demand that the resulting filter yields the filter stencil of a higher-order filter when \(\phi \) and \(\sigma \) are constant. In [10] \({\bar{D}}\) was kept proportional to a one-sided first derivative to keep the flux form, and D was calculated to create the desired filter stencil. Here, we instead chose to keep \({\bar{D}} = - D^T \) so that the negative semi-definiteness is guaranteed. We remark that the stencil \((1, -2, 1 )/4 \) for D and \({\bar{D}} = -D^T\) yields the filter \( (-1, 4, -6, 4, -1)/16 \) for constant \(\phi \sigma \), which is the standard fourth order filter, reducing to second-order for non-constant \(\phi \) or \(\sigma \). It has the nice property that a purely linear function is reproduced by filtering, even for non-constant \(\sigma \) or \(\phi \). Similarly, using this filter stencil for D we find the filter stencil of eighth order \((-1, 8, -28, 56, -70, 56, -28, 8, -1)/256\) for constant \(\sigma \) and \(\phi \). In both cases, no averaging by M is done, i.e. \(M =1 \). The averaging in the first/second-order method is needed to avoid a directional diffusion if the stencil D is non-symmetric. In more dimensions, the contributions of the different spatial directions are simply added where different \(\sigma _\alpha \) for all spatial directions \(\alpha \) are possible. An algorithmic description and the later used adaptive filter strength for shocks are discussed in the Appendix C.

The non-periodic case can be handled with the same D and M as above by choosing \(\sigma =0\) close to the boundary for a sufficient number of grid points, which results in a non-periodicity stencil of the resulting filter. For the first/second-order filter, the choice of \(\sigma =0\) for the two points next to the boundary in the direction perpendicularFootnote 4 to the boundary does not change the boundary values. Setting only the outermost points of \(\sigma \) zero would result in modified outermost points, but without a modification of the flux by the filter [30]. This can be chosen depending on the desired boundary condition.

4 Numerical Examples

4.1 Acoustic Configurations

4.1.1 Acoustic Reflection in 1D

A solid boundary reflects acoustic pulses. Here, we investigate how such a reflection is created by the volume fraction alone. The one-dimensional domain with a length of \(L=2\)m is described with \(N=1024\) points. The domain is large enough to ignore the domain boundaries for this example. The wall starts at \(x_0=1\,\mathrm {m} + \delta _0\) where only the volume fraction is reduced from 1 to \(\epsilon = 10^{-8}\) with a hyperbolic tangent

$$\begin{aligned} f(x) = 1- (1-\epsilon ) (1+ \tanh ( (x-x_0)/\delta ))/2 \end{aligned}$$
(28)

with a thickness of \(\delta = \varDelta x\) as the grid spacing. The shift \(\delta _0 = 0.3 \varDelta x\) is chosen to align the maximum of the reflected and the mirror pulse by visual inspection. This implies that the effective location of the wall is not at \(\phi \approx 1/2 \) but shifted for the fraction of a grid spacing. No Darcy term or filter is used in this example to reveal the effect of the volume fraction. Standard fourth-order central difference and the classical Runge-Kutta-4 time stepping is applied, as detailed in the Appendix A.

The initial data is an adiabatic, Gaussian pulse in pressure and density,

$$\begin{aligned} \rho = \rho _0 \left( 1+ \beta \exp \left( - (X-x_0)^2 /\sigma _\mathrm {pulse}^2\right) \right) \qquad p = p_0 (\rho /\rho _0)^\gamma \end{aligned}$$
(29)

with relative height of \(\beta = 10^{-3}\), relative to \(\rho _0=1\)kg/m\(^3\), \(p_0= 10^{5}\)Pa and \(\sigma _\mathrm {pulse} = 8 \varDelta x\), which is chosen so that no artefacts of the numerical dispersion error are visible by inspection. For \(\sigma _\mathrm {pulse} = 6 \varDelta x\), the pulse is followed by clearly visible ringing.

Fig. 3
figure 3

a space-time diagram of an acoustic pulse (p). immersed boundary depicted by a dotted line, time of snapshot by broken line. b Snapshot of pressure scaled by initial pulse strength, volume fraction dotted. c Reflected pulse in comparison with mirror pulse. Relative difference in the inset. d Spectrum of pulse shows good agreement over a large part of the wavenumbers

The results are presented in Fig. 3. The space-time diagram shows that the right-going pulse is reflected at \(x=1\)m. The speed of sound is clearly the same within the object, as well as outside. The snapshot of p at \(t\approx 1.32\) ms is shown in the second plot. The left-going and the reflected pulse have the same amplitude, as expected, while the pulse in the object is strongly increased and shows some ringing. Its increase is due to the doubling of the pressure at the reflection point. Some additional increase is created by the restriction to very small \(\phi \), which is not further analyzed here. To quantify the quality of the reflection, the reflected pulse is compared with a mirror pulse, and a very good agreement is found. The inset shows the difference relative to the initial pulse amplitude \(\sim 2 \cdot 10^{-3}\).

Finally, the spectrum is shown to reveal the frequency dependency of the difference between the reflected pulse and the reference mirror pulse. A window \([x_m - 5.5 \sigma _\mathrm {pulse} ,x_m +5.5 \sigma _\mathrm {pulse} ] \) is created around location the maximum of reflected pulse \(x_m\). The pressure values outside this sharp window are set to zero, and a Fourier transform is calculated for the remaining values. By this, the spectrum of the reflected pulse and the reference pulse is calculated. In Fig. 3 the absolute value of these two is compared. The numerically interesting range is very well represented. Since the absolute value agrees very well, the error visible in Fig. 3c is dominantly a phase error.

All results are largely independent of \(\epsilon \), if sufficiently small. It can be increased by orders of magnitude without changing the result or decreased further without compromising the numerical stability. The only visible effect is that the ringing of the pulse inside the object and the kink at the boundary becomes stronger with a smaller \(\epsilon \).

The observed displacement \(\delta _0\) is much smaller in comparison with the in-depth discussion of [28]. However, a substantially different situation was considered there: an incompressible boundary layer enforced by a pure Darcy term.

4.1.2 Containment

One motivating aspect of this investigation is to improve the penalization for configurations with high-pressure gradients. If the Darcy term is the only term to combat a high-pressure difference, it must be chosen accordingly large, leading to a strong numerical stiffness or even instabilities. In the method proposed here, the pressure gradient is counteracted by a change in volume fraction, which is largely able to handle the pressure gradient even without a Darcy term. In Fig. 4, a set-up is shown where two walls at \( x=1\) and \(x=2\) keep a high pressure reservoir of 4\(p_0\) against \(p_0 = 10^5\).

Fig. 4
figure 4

A one dimensional domain with two walls at \(x=1\) and \(x=2\) holding a fourfold pressure compared with the outside. The start and end of the walls is marked by the thin broken lines. The volume fraction allows to contain the gas: while the flow accelerates to the speed of sound (chocked flow), the mass flow \(\rho u \phi \) is suppressed by the volume fraction \(\phi =10^{-8}\). A Darcy term can reduce the flow further. The inset shows the logarithm of the mass flow, where small residual acoustic noise is visible

Without a Darcy term, a chocked flow is found. The flow accelerates to sonic conditions of Ma \(= u/c \approx 1 \), with the sound velocity \(c=\sqrt{\gamma p /\rho } \), creating a supersonic expansion terminated by a shock. Chocking conditions are not fully reached in the wall (Ma \(\approx 0.75\)), which is due to the filter acting similar to a viscosity. The second/fourth-order filter described in Sect. 3 is applied in the whole region. However, since the volume fraction \(\phi = 10^{-8}\) scales the mass flux, it results in a mass flux of the order of \(\approx 10^{-5}\). This is largely independent of wall thickness. The steady-state is not fully reached in the simulation, instead, small acoustic noise is still visible in the mass flux in the inset of Fig. 4. A Darcy friction term allows reducing the mass flux further. The findings show the ability of the method to handle large pressure differences.

4.1.3 Stiffness of the Method

Based on the CFL number criterion, it was argued that leaving the speed of sound unaltered implies avoiding additional stiffness [34]. However, since the pressure amplitude is rapidly increased and the velocity is reduced when a sound pulse reaches the wall location, some additional stiffness is expected. The magnitude of the source term in the momentum equation (2) suggests the possibility of a massive increase. Yet, a very moderate decrease of the admissible CFL number, depending on the width of the boundary function, was found in the simulation.

Fig. 5
figure 5

The increase in stiffness is given by the increase of the maximal eigenvalue modulus as a function of the boundary smoothing thickness \(\delta \). It is normalized by the maximal eigenvalue of the problem with constant \(\phi \). For wide boundary functions (\(\delta \gg \varDelta x\)) the stiffness agrees with the unmodified system (\(\phi \equiv 1\)), while for small values of \(\delta \) a steep increase is visible

To investigate the stiffness, the eigenvalues with maximal magnitude were determined for the described acoustic setup of Sect. 4.1.1, see Fig. 5. For a wide wall function \(\delta \gg \varDelta x\) we reproduce the stiffness of the right-hand side without the volume fraction \(\phi \equiv 1\). For small \(\delta \), a sharp increase of the stiffness was found. For the setting of the simulation \(\delta = \varDelta x \) an increase of roughly \(70\% \) was found, consistent with the possible CFL numbers in the simulation. For a slightly stronger smeared boundary \(\delta = 1.5 \varDelta x \), an increase of 25% of the stiffness was found. As expected, the eigenmodes with the largest eigenvalues are always strongly localized at the boundary location. One conclusion from this is that in order to increase the quality of the boundary, instead of decreasing \(\delta \), a finer grid resolution can be less restrictive on the time step. Altogether, the increase is moderate and can often be much smaller than a pure Darcy term, especially for high-pressure gradients.

4.1.4 Acoustic Reflection in 2D

Fig. 6
figure 6

a Snapshot of the pressure, the boundary depicted by a thin red line. b Mirror pulse solution. c A cut along \(y=1\), to allow a comparison, difference in the inset. d The tangential velocity along \(x=1.25\) agrees excellently with the reference showing a faithful construction of slip boundaries

The acoustic case is extended to two dimensions. A square domain \(x\times y =(1/4,\dots ,5/4)\times (1/4,\dots ,5/4)\) is embedded in a domain of size \(2~\mathrm {m}\times 2~\mathrm {m}\), discretized with \(1024\times 1024 \) points. An adiabatic pulse centered at \((1~\mathrm {m},1~\mathrm {m})\), again with \(\sigma _\mathrm {pulse} = 8 \varDelta x\) and an amplitude of \(10^{-3} \rho _0\), \(\rho _0=1\), is used as initial condition. A reference can again be created by the three mirror pulses, located at (1.5 m, 1 m), (1 m,1.5 m), (1.5 m, 1.5 m) with the same amplitude as pulse inside the box. The pulse is reflected by the jump in \(\phi \), modeling the wall. Again, acoustic waves are created within the object, where for a locally constant \(\phi =10^{-8}\) in effect the same Euler equations are valid. The mass, momentum, and energy content of the wall region are small by the factor of \(10^{-8}\) as discussed before. Again, we find excellent agreement, see Fig. 6. Not only is the acoustic wave, which impinges perpendicular to the wall, well reproduced, furthermore the wave slipping along the wall at \(x= 1.25\) is correctly reproduced. Such a slip boundary cannot be presented if a Darcy term is used to describe objects since this necessarily creates non-slip boundaries.

4.2 Flow Configurations

4.2.1 Potential Cylinder Flow

To investigate the quality of the slip boundary condition, the friction-free flow around a cylinder is calculated, for which exists a simple analytical solution. A flow velocity at infinity of \(u_0= 10\) m/s is used, so that (for reference values as above) a low Mach number of Ma \(\approx 0.02\) allows to consider the flow as near incompressible. As boundary conditions, the known potential flow \(u_\mathrm {pot}= \partial _x \varPhi _\mathrm {pot} \) and \(v_\mathrm {pot}= \partial _y \varPhi _\mathrm {pot} \), with the potential in polar coordinates relative to the cylinder center \(\varPhi _\mathrm {pot} = u_0 \left( 1 + \frac{r_0^2}{r^2} \right) \cos (\vartheta ) \), is set. The pressure is calculated from the Bernoulli theorem, the density by the adiabatic condition.

Fig. 7
figure 7

A flow around a slip cylinder compared with a potential flow solution. Left: The numerical streamlines (broken, white) are almost perfectly on top of the analytical reference, depicted in black, the velocity magnitude is color-coded. Right: The x component of the velocity at the line (\(x=5\), broken red line in left plot) in comparison with the analytical value, shows very good agreement. The difference shows kink close to the outer sponge (\(y\approx 4.4\)), where the analytical solution is enforced and a zigzag mode

The 2D domain of size \((10~\mathrm {m}\times 10~\mathrm {m})\) is discretized by \(514\times 514\) points and contains a cylinder of radius \(R_0=1~\mathrm {m}\). The wall of the cylinder is again smoothed by the same hyperbolic tangent as above with \(\delta = 1.5\varDelta x\).

The initial condition is the velocity constant \((u_0,0) \) (impulsively started cylinder). At the boundary, we force the analytical solution by a sponge layer of thickness \(10\varDelta x\), and use a forcing strength for the Darcy and the sponge term of \(\eta = 2 \varDelta t\).

Further, a filter of first/second-order as described above is used only inside the cylinder, again with the same mask function retreated by \(4\varDelta x \) inside the object. A Darcy term is used with a mask created by the same function as the volume fraction (28), where the reference point \({\bar{x}}_0\) is moved relative to the wall position by \(7\varDelta x\) so that its action is practically zero at the boundary. The purpose of both is to avoid dynamics inside the object, which otherwise destabilizes the simulation.

We find excellent agreement with the analytical solution, see Fig. 7. The numerical streamlines are on top of the analytical ones and the pattern of the velocity magnitude matches the expectations. The x component of the velocity along \(x=5\) also shows a very good quantitative agreement. A kink at the position where the sponge enforcing the boundaries ends, and a small zigzag mode relative to the analytical solution, is visible.

The differences might be explained by a slightly different blockage, due to the non-sharp boundary location. This interpretation is supported by the fact that the error becomes smaller with higher grid resolution, by which this effect becomes effectively smaller. It is concluded that slip conditions are created which are fully sufficient for practical calculations.

4.2.2 Wedge in Supersonic Flow

Fig. 8
figure 8

The modulus of the density gradient (pseudo-schlieren). Left: The slip boundary condition reproduces the shock location predicted by the (inviscid) gas dynamical theory. The triple points close to the upper and lower boundary arise from the periodic boundary conditions. Inset: The reduced volume \(\phi \) (o) and the normalized Darcy friction (+) around \(x=1\) and along \(y=1\) shows the smoothing of the boundary and the shift of the Darcy friction away from the boundary. Right: The non-slip boundary condition produces a lift-off and a slightly curved shock due to the flow displacement by the boundary layer, visible by the vortices at the wedge

A wedge in supersonic flow is now investigated. The case follows [11] closely. Normalized quantities are used in this section. A two-dimensional domain of \(2\times 2\) with a wedge of half angel \(\theta = 20^\circ \) and tip at \(S= (0.5,1)\) is investigated. The main difference to the cited reference is a periodic boundary condition in y for simplicity. Due to the hyperbolicity of supersonic flows, large parts of the flow can be directly compared. The in- and outflow is forced by a sponge term to Ma \(= 2\), the reference values are \((\rho _0, u_0, v_0 , p_0 )= (1 , \mathrm {Ma} \sqrt{\gamma }, 0 ,1 ) \), \(\gamma =1.4\).

To handle the shocks, an adaptive filter as described above is used, where \(\sigma \) is determined by a shock detector as described by Bogey et al. [10] and modified as in [51] by a soft switch function. A threshold of \(r_\mathrm {th}= 10^{-3}\) and a steepness of \(\uplambda _F= 1/10\) was used, see Appendix C for more details.

Two different set-ups are compared. A non-slip boundary condition which compares to [11] and a slip condition which can be directly compared with analytical predictions from gas dynamics, where inviscid flow and thereby non-slip conditions are assumed. In both cases, a resolution of \(1536^2\) grid points as in [11] is used.

Unsurprisingly, the slip boundary condition, made possible by the new method, agrees much better with the gas dynamical prediction, see Fig. 8. The absence of numerical damping allows for fine details, but also yields high frequency noise, which is removed by filtering in post-processing. The error for the non-slip condition depends on the resolution since the minimal boundary layer thickness (created by numerical dissipation) depends on it. For a slip boundary, the agreement is largely independent of the resolution. This has also practical consequences, especially in a first design phase, where a low resolution is often interesting when the boundary layer is not expected to be crucial for the design. Here, a lower resolution permits a shorter design process, so that the volume fraction approach might be of help.

4.2.3 Wedge Shock Wave Interaction

Here, a shock-wedge interaction is discussed. The case follows a case presented by Kemm at al. [33] and Dumbser et al. [19]. A a wedge of height \(h=1\) and length \(l=1\) is placed with its tip at (2,3) in a domain of size \((8\times 6)\). A shock wave is located at \(x=1\) at time \(t=0\), with a Mach number Ma\(=1.3 \) enters a gas at rest (\(u_0=0\)) with \(\rho _0 =1.4\) and \(p_0=1\) with a adiabatic index of \(\gamma =1.4\).

Fig. 9
figure 9

The modulus of the density gradient (pseudo-schlieren) for the time \(t=1.5\) and \(t=2.0\)

The domain is resolved with \(1000\times 750\) points to be comparable with the additional degrees of freedom of discontinuous Galerkin elements of [32]. The reduced volume is again created from a signed-distance function and the smoothing by (28) with \(\delta = \varDelta x \) with a value of \(\epsilon = 10^{-8}\) in the object.

The shock filter with \(r_\mathrm {th}=10^{-4}\) and \(\uplambda _F=4\) is applied at every time step. Additionally, a global filter strength \(\sigma _\mathrm {static} = 0.05\) is used to avoid noise in the simulation, see Appendix C for details. The first/second-order stencil is used.

The overall agreement is good. However, the shocks are not as sharp as in the reference simulation. This could be improved by a different shock detector (similar to a flux limiter) or by optimized filter coefficients. Artificial viscosity [15] might be an option. This investigation is not in the scope of this publication.

4.2.4 Pressure Pulse in Tube

This example is motivated by a detonation wave in a tube entering a plenum of a turbine and aims at assessing the conservation quality. Such unsteady flows arise when coupling detonative and unsteady combustion with turbines to construct new types of gas turbines, see e.g. [8]. Here, high-pressure gradients appear, which challenges purely a Darcy-friction-based volume penalization, since it has to balance the high-pressure forces. Unlike a turbine, the domain is closed in the example, to allow a direct evaluation of conservation properties.

The two-dimensional domain is 2 m long and 1 m wide, with a tube of diameter 0.2 m in the left part and a chamber in the right part. All walls have a thickness of 0.05 m. Three NACA6412 profiles of cord length 0.3 m tilted by \(-(3/16)\pi \) are placed in the domain, mimicking a stator cascade, but mainly serving as non-trivial test objects with strong curvature and kinks.

Fig. 10
figure 10

Left: An unsteady jet flow entering into a closed chamber with obstacles is rich in physical phenomena and produces strong unsteady pressure forces on the boundaries. The Mach number is shown in the upper half and the volume fraction weighted mass density in the lower part. Right: The conservation of the total mass depends on the definition of the integration domain, see text

As start condition, an elevated temperature of 700 K and pressure of \(4\cdot 10^{5}\) is created in a patch between \(x = \) [0.05 m 0.8 m] and \(y=\) [0.2 m 0.8 m] smoothed by a hyperbolic tangent with a width of \(\delta = 0.02\) m. By this, the tube is filled nearly homogeneously to the point of \(x=0.8\) m. The increase of pressure and temperature inside the wall has negligible impact due to its small effective volume. Otherwise, we set \(p_0 = 10^{5}\) Pa, and \(\rho _0 = 1\) kg/m\(^3\) and zero velocity everywhere. A CFL Number of 0.3 is used, since otherwise non-smoothness in the flow (away from the walls) is created, yielding a timestep of \(\varDelta t \approx 2.67 \cdot 10^{-7}\).

As before, a Darcy term with strength \(1/(2 \varDelta t)\) is used inside the wall with an offset of \(7 \varDelta x\) to create slip walls. A first/second-order filter is used which is applied everywhere in the object and at shock position in the flow. For this, the shock detector described for the wedge flow is used again, with \(r_\mathrm {th}=10^{-5}\).

A supersonic jet ejects from the tube and decays before fully established, due to the small volume of the tube. By this, high-pressure loads and a large unsteadiness are created on the profiles and the walls. A snapshot of the Mach-number and the density is shown for the times \(t=2.67\) ms inf Fig. 10. The total mass conservation is shown. If the density is integrated (summed-up over all grid points), near-perfect conservation is found, as expected from the conservative mass equation (4). Since we implement it in the form (21), a small error is introduced with an explicit time integration scheme (not strictly conserving quadratic invariants), which yields a relative error below \(10^{-7}\) over the full simulation with 20,000 steps. To integrate the fluid domain, one has to choose the exact location of the wall, due to the ambiguity introduced by the smoothing of \(\phi \). Here, this is done by choosing a threshold in \(\phi \), thus defining a sharp mask. The larger the threshold is chosen, the more of the boundary region is omitted and the lower the conservation quality becomes, see Fig. 10. However, the conservation error fluctuates around the correct value, since the mass is not lost but just pressed into the wall smoothing region. Thus, this behavior might be better viewed as a slightly elastic wall than as a mass conservation defect. In practice, the integration of the full domain might be appropriate since the mass deep inside the object becomes as vanishingly small as \(\phi \) does. Altogether, we can confirm good conservation.

4.2.5 Vortex Shedding

This case aims at a non-slip boundary and transformed grids. Transformed grids allow focusing on location with high gradients in the flow and thereby reduce the total number of points and likewise the numerical effort. Since the volume fraction is part of the continuous equations with a simple physical interpretation, it is straightforward to generalize the scheme to transformed grids.

Fig. 11
figure 11

Left: A snapshot of the vorticity of the flow at time \(t=1.44\). Vorticity reference point as a red cross. The grid is shown as white lines, where only every fourth line is plotted. Right: The vorticity at the reference point as a function of time shows a Strouhal number of Sr = 0.173

A flow with Reynolds number Re \(=(u_0 D)/\nu = 150\) around a cylinder with diameter \(D=1\) is simulated in a domain of size (\(20\times 15\)), using normalized quantities in this section. The in-flow velocity is \(u_0=30\) with a speed of sound \(c_0=374\) yielding a Mach-number of Ma = 0.08 so that it can be safely regarded as incompressible.

The transformed grid with \(N_\xi \times N_\eta = (256 \times 166) \) is given by

$$\begin{aligned} x&= ({\tilde{x}} - {\tilde{x}}_1)/({\tilde{x}}_{N_\xi } - {\tilde{x}}_1)\cdot L_\xi \end{aligned}$$
(30)
$$\begin{aligned} y&= ({\tilde{y}} - {\tilde{y}}_1)/({\tilde{y}}_{N_\eta } - {\tilde{y}}_1)\cdot L_\eta \end{aligned}$$
(31)

where

$$\begin{aligned} {\tilde{x}}&= \xi - \alpha (\tanh ( (\xi - (x_0+\alpha + x_\delta ) )/\psi ) +1 ) \end{aligned}$$
(32)
$$\begin{aligned} {\tilde{y}}&= \eta - \alpha (\tanh ( (\eta - (y_0+\alpha ) )/\psi ) ) -\alpha . \end{aligned}$$
(33)

Here, \(\xi = (L_\xi +2\alpha )(0,\dots ,N_\xi -1 )/( N_\xi -1)\) and \(\eta = (L_\eta +2\alpha )(0,\dots ,N_\eta -1)/(N_\eta -1) \). The parameters are \(\alpha = 7.2\) and \(\psi =8\) and \(x_\delta = -0.55\) From this, the coordinates are created by normalizing to the desired domain size. The resulting grid is shown in Fig. 11, where every fourth grid line is plotted. A CFL number of 1/2 was used.

The grid transformation is introduced by rewriting divergence and gradient operators with the help of local bases, as discussed in the Appendix A. In the end, all divergence operators are replaced by the so-called conservative form and the gradient operators by the so-called non-conservative form, yielding a discretely consistent (and conservative) scheme, if all derivatives are replaced by finite difference approximations with a (skew-)symmetric stencil. Using summation by part operators results in well-defined fluxes at the boundaries result, see [51] for details.Footnote 5 The grid is orthogonal; a non-orthogonal grid can also be handled by this approach, it was however not explicitly tested.

The initial flow is the potential flow discussed in Sect. 4.2.1 with an additional Gaussian velocity defect at \((x_0=0,y_0=1/2)\), with a width of \(\sigma _\mathrm {disturb} = 1/2\) and an amplitude \(-20\) to trigger the vortex shedding: \(u_0= u_\mathrm {pot} + (-20)\exp \left( -((X-x_0)^2 + (Y-y_0)^2)/\sigma _\mathrm {disturb}^2 \right) \). The inflow and outflow are created by sponge terms enforcing the potential flow around a cylinder, where a quadratic sponge of thickness \(10 L_\xi /N_\xi \) is used. The sponge is visible by creating extra vorticity close to the outflow in Fig. 11. A non-reflecting boundary condition with reference conditions as the initial condition is used at the top and bottom.

The described filter of second/fourth-order is used inside the cylinder, with a small amplitude of 1/100 in the whole domain to avoid grid to grid oscillations, presumably created by the boundary conditions. The friction-like effect of the filter is by this small by the order 1/20 compared with the physical friction and should, thus, have little influence on the Reynolds number.

The expected vortex shedding is found after a short transition time with a Strouhal number of \( Sr = 0.173\), which is in agreement with the literature. It is found to be robust towards simulation details like resolution. The smoothing of \(\phi \) of \(\delta = (L_\xi /N_\xi )/2\) was used, which is close to one grid spacing at the cylinder wall due to the grid refinement. A sharper smoothing for the Darcy term was used with \(\delta _\mathrm {Darcy}= \delta /2\), to ensure a quick decay of the tangential velocity, however, small sensitivity was found in these parameters. This is important since the good slip conditions possible by the volume fraction \(\phi \) might be taken as an indicator of possible problems with the non-slip conditions. No signs for this are, however, found in the presented investigations.

Altogether, we find satisfactory results for this low Mach number, viscosity-driven case.

5 Conclusion and Outlook

A method to describe immersed objects was presented. It is easy to implement and has a clear physical interpretation. Furthermore, it has good conservation properties. It naturally allows implementing slip boundaries and adiabatic boundary conditions. The non-penetration condition can be implemented with only a minor increase in the stiffness of the equation and near-perfect pressure-tight boundaries are possible, even for high-pressure gradients.

The derivation follows considerations of Kevlahan et al. [34] for shallow water equation and builds on a physical consistent treatment of the porosity, understood as a reduced volume fraction available for the fluid. By this, it becomes equivalent to the available cross-section.

While the main method works well, the filter, needed especially for the treatment of shocks needs manual adjustment and does not produce as sharp shocks as shock limiter methods [33]. This will be addressed in future works by optimizing the filter for the specific discretization of the Euler equations.

The method does not pose any extra difficulties in a parallel environment. For more complex geometries large simulations in 3D are in preparation. To avoid the increased stiffness for very sharp boundary functions, a better resolution close to the boundary is favorable, if such a high localization of the wall is demanded by the problem. Alternatively, to the shown local grid transformations, a local grid refinement as in [23] can be used, which is also under investigation. The possible non-slip conditions and the very good reflectivity make this equation a good candidate especially for aero-acoustic problems, which are currently further investigated.