1 Introduction

In numerical methods for incompressible flows, the assumption that both density and viscosity are constant is often mentioned just in passing, if even mentioned at all. It is, however, a rather “fragile” assumption that can be violated, for example, in non-Newtonian, two-phase or non-isothermal flows [1]. In fact, this violation can have severe implications in both theory and numerical practice. A variable viscosity, for instance, demands a complete reformulation of projection methods decoupling velocity and pressure in time [2,3,4]. A non-constant density, on the other hand, requires redefining even the projection operator used in such methods [5]. In particular, for flows with more than one fluid phase, density and viscosity fields are not only variable, but discontinuous—which certainly brings additional challenges to the discretisation. Nowadays, there are various numerical techniques with different levels of sophistication to handle such issues. Sharp two-phase flow simulations can be achieved, for instance, with enriched [6], extended [7] or unfitted [8] finite element methods. For the temporal discretisation, there are also different methods to cope with the variable density, especially in split-step schemes [5, 9,10,11,12,13].

Split-step, time-splitting or fractional-step methods are interchangeable terms to designate time-stepping schemes decoupling the computation of velocity and pressure. Their idea is to transform an incompressible flow system into a series of Poisson and convection-diffusion subproblems that are simpler to solve. Especially for multi-phase flows, which feature conservation laws of different nature, split-step methods are more popular [5, 9,10,11,12,13,14,15,16,17,18,19,20] than monolithic schemes [21,22,23]. Among the most common time-splitting schemes are so-called projection or pressure correction methods, in which incompressibility is enforced by projecting the velocity onto a weakly divergence-free space. Such methods, however, have some well-known shortcomings. The earliest non-incremental variant, for example, induces completely non-physical pressure boundary conditions [24]. This can be partially remedied by so-called rotational variants [2, 4, 11], which in turn induce an inf-sup compatibility restriction [25, 26] on the finite element spaces (equal-order discretisations of pressure and velocity become unstable). In fact, these issues are not exclusive to multi-phase flows, arising even in the Stokes problem.

For single-phase flows, Henshaw and Petersson [27], Johnston and Liu [28] and Liu [29] proposed an alternative family of split-step schemes overcoming the limitations of classical projection methods. In their version, explicit incompressibility is replaced by a consistent pressure Poisson equation (PPE) obtained directly from the balance of momentum. Their schemes do not only reduce the computational cost, but also break the finite element compatibility restrictions without inducing any spurious pressure boundary layers. The price to pay is a slightly more complicated right-hand side, which can however be handled with hardly any additional implementation effort. Nonetheless, constant viscosity and constant density are two strong assumptions in the classical derivations [28, 29]. While we have recently extended consistent splitting methods to the case of variable viscosity [30], handling more than one phase requires also allowing for density variations, which has a stronger impact on the formulation. This is thus the main topic of the present work.

Our main goal is to devise a fully consistent pressure Poisson framework for incompressible flows with variable density, with a focus on two-phase flows. We can derive an elliptic equation for the pressure by first dividing the Navier–Stokes momentum equation by the flow density, adding a consistency term and then taking the divergence of the result. Similarly, pressure boundary conditions can be obtained from the momentum equation and its boundary data. This gives us an equation to compute the pressure from the velocity and density fields, and at the same time guarantees, on the continuous level, a divergence-free velocity—without requiring projections or corrections. This, combined with semi-implicit temporal discretisations, converts the rather complex mass-momentum system into a series of much simpler subproblems: a Poisson equation with variable coefficient, a scalar advection problem and a vector-valued convection-diffusion equation that may be decomposed into scalar components. Furthermore, when considering a finite element spatial discretisation, our schemes allow the same polynomial degree to be used for all quantities, simplifying implementation.

The rest of this article is organised in the following way. After the basic problem setup and notation are briefly described in Sect. 2, Sect. 3 presents a PPE-based reformulation that implies incompressibility without explicitly enforcing the divergence-free constraint on the velocity. When the goal is to use standard finite element elements for the spatial discretisation, we need a \(C^0\)-compatible variational formulation, which is the topic of Sect. 4. Discretisation and stabilisation aspects are addressed in Sects. 5 and 6. Finally, several numerical examples are given in Sect. 7 to test our approach in problems with increasing complexity. Let us first remark that, differently from most works on two-phase flow simulation, ours does not intend to address the challenges related to interface conditions, jumps, forces, etc. We focus instead on the time-splitting aspect of the problem, that is, on showing how one can construct simple, minimally invasive, finite-element-suitable schemes to decouple all system unknowns in time, without sacrificing boundary accuracy or inducing inf-sup compatibility restrictions. For this reason, we focus on gravity-driven flow regimes in which surface forces can be neglected. How one handles interface-related matters, however, is immaterial to the present discussion, as different techniques can be incorporated straightforwardly.

2 Problem setup and notation

Let us consider a spatial domain \(\Omega \subset \mathbb {R}^d\), \(d=2\) or 3, with a Lipschitz boundary \(\Gamma := \partial \Omega \) decomposed into three non-overlapping regions \(\Gamma _D\), \(\Gamma _N\) and \(\Gamma _S\). On the first two we prescribe velocities and normal tractions, respectively, while the latter describes a free slip boundary. Imposing slip or free-slip conditions is important in multi-phase flows to allow “wetting”, since a standard no-slip condition would preclude fluid-fluid interfaces from moving along walls. Under these conditions, the standard setting for the incompressible Navier–Stokes system with non-constant density reads

$$\begin{aligned}&\partial _t\rho + \varvec{u}\cdot \nabla \rho = 0 \ \ \text {in} \ \ \Omega \times (0,T]\, , \end{aligned}$$
(1)
$$\begin{aligned}&\rho \left[ \partial _t\varvec{u} + (\nabla \varvec{u})\varvec{u} - \varvec{g}\right] - \nabla \cdot {\mathbb {S}} + \nabla p = \varvec{0} \ \ \text {in} \ \ \Omega \times (0,T]\, , \end{aligned}$$
(2)
$$\begin{aligned}&\nabla \cdot \varvec{u} = 0 \ \ \text {in} \ \ \Omega \times (0,T]\, , \end{aligned}$$
(3)

equipped with initial and boundary conditions

$$\begin{aligned}&\rho = \rho _0 \ \ \text {at} \ \ t=0\, , \end{aligned}$$
(4)
$$\begin{aligned}&\varvec{u} = \varvec{u}_0 \ \ \text {at} \ \ t=0, \end{aligned}$$
(5)
$$\begin{aligned}&\rho = \varrho \ \ \text {on} \ \ \Gamma _{\text {in}}(t), \ t\in (0,T]\, , \end{aligned}$$
(6)
$$\begin{aligned}&\varvec{u} = {\mathbf {v}} \ \ \text {on} \ \ \Gamma _D\times (0,T]\, , \end{aligned}$$
(7)
$$\begin{aligned}&{\mathbb {S}}\varvec{n} - p\varvec{n} = \varvec{t} \ \ \text {on} \ \ \Gamma _N\times (0,T]\, , \end{aligned}$$
(8)
$$\begin{aligned}&\varvec{u}\cdot \varvec{n} = 0 \ \ \text {on} \ \ \Gamma _S\times (0,T]\, , \end{aligned}$$
(9)
$$\begin{aligned}&\varvec{n}\times ({\mathbb {S}}\varvec{n}) = \varvec{0} \ \ \text {on} \ \ \Gamma _S\times (0,T]\, , \end{aligned}$$
(10)

where \(\varvec{n}\) is the outward unit normal vector on \(\partial \Omega \), \((\rho _0,\varvec{u}_0,\varrho , {\mathbf {v}},\varvec{t})\) are appropriate data, \(\varvec{g}\) denotes a gravitational field, \((\varvec{u},p,\rho )\) are the flow velocity, pressure and density, respectively, and \({\mathbb {S}}\) is the viscous stress tensor, which for Newtonian fluids takes the form

$$\begin{aligned} {\mathbb {S}} = 2\mu \nabla ^{\mathrm {s}}\varvec{u}, \quad \nabla ^{\mathrm {s}}\varvec{u} := \frac{1}{2}\left[ \nabla \varvec{u} + (\nabla \varvec{u})^{\top }\right] , \end{aligned}$$
(11)

with \(\mu := \rho \nu \) and \(\nu \) denoting the dynamic and kinematic viscosities, respectively. The free-slip condition can be replaced by a slip condition if we appropriately modify the right-hand side in (10), see for instance Refs. [31, 32]. Also note that (10) can be written in terms of tangent vectors [33]. Since the mass equation (1) is hyperbolic, boundary conditions for \(\rho \) are only prescribed on \(\Gamma _{\text {in}}\), which is the part of \(\partial \Omega \) where \(\varvec{u}\cdot \varvec{n} < 0\).

3 A consistent pressure Poisson reformulation

Regardless of the spatial discretisation method used, efficiently solving (1)–(10) in a fully coupled way is a challenging task. However, because of the saddle-point structure of the velocity-pressure subsystem, decoupling the unknowns is not straightforward here. Such structure also induces an inf-sup or Ladyzhenskaya–Babuška–Brezzi (LBB) compatibility restriction when discretising p and \(\varvec{u}\) with finite elements [25, 26]. To overcome both limitations, our idea is to replace the incompressibility constraint (3) by a consistent pressure Poisson problem:

$$\begin{aligned}&-\nabla \cdot \left[ \rho ^{-1}\nabla p + (\nabla \varvec{u})\varvec{u} - \varvec{g} - \rho ^{-1}\nabla \cdot {\mathbb {S}} + \chi \nu \nabla (\nabla \cdot \varvec{u})\right] \nonumber \\&\quad + \beta \nabla \cdot \varvec{u} = 0 \, \ \ \text {in} \ \Omega \times [0,T]\, , \end{aligned}$$
(12)
$$\begin{aligned}&p = \zeta \ \ \text {on} \ \Gamma _N\times [0,T]\, , \end{aligned}$$
(13)
$$\begin{aligned}&\frac{\partial p}{\partial n} = \lambda \ \ \text {on} \ \Gamma _{D,S}\times [0,T]\, , \end{aligned}$$
(14)

in which \(\Gamma _{D,S}:= \Gamma _D\cup \Gamma _S\), \(\frac{\partial (\cdot )}{\partial n} := \varvec{n}\cdot \nabla (\cdot )\), \(\beta \) is a non-negative parameter to be defined later (see Sect. 5.2), and

$$\begin{aligned} \zeta&:= {\mathbb {S}}:(\varvec{n}\otimes \varvec{n}) - 2\mu \nabla \cdot \varvec{u} - \varvec{t}\cdot \varvec{n}\nonumber \\&= 2\mu \nabla ^{\mathrm {s}}\varvec{u}:(\varvec{n}\otimes \varvec{n} - {\mathbb {I}}) - \varvec{t}\cdot \varvec{n}\, , \end{aligned}$$
(15)
$$\begin{aligned} \lambda&:= \left[ \rho \varvec{g} - \rho \partial _t{\mathbf {v}} - (\rho \nabla \varvec{u})\varvec{u} + \nabla \cdot {\mathbb {S}} - \chi \mu \nabla (\nabla \cdot \varvec{u})\right] \cdot \varvec{n}\, , \end{aligned}$$
(16)

with \({\mathbf {v}}\cdot \varvec{n} = 0\) on \(\Gamma _S\) and \({\mathbb {I}}\) denoting the \(d\times d\) identity tensor. Parameter \(\chi \) in Eqs. (12) and (16) is a positive constant which we will later show that should be set as \(\chi = 2\).

It is still not evident why (12)–(16) would be a suitable replacement for the usual condition \(\nabla \cdot \varvec{u} = 0\), but for now let us take a closer look at the equations. Equation (12) can be obtained by adding \(\chi \mu \nabla (\nabla \cdot \varvec{u})\) to the left-hand side of Eq. (2), dividing both sides by \(\rho \), taking minus the divergence of the result and finally adding \(\beta \nabla \cdot \varvec{u}\) to the left-hand side. Both added terms are consistent with the original system, whose solution \(\varvec{u}\) is divergence-free. The absence of \(\partial _t\varvec{u}\) in Eq. (12) is also consistent, as

$$\begin{aligned} \nabla \cdot (\partial _t\varvec{u}) = \partial _t(\nabla \cdot \varvec{u}) = 0\,. \end{aligned}$$

Moreover, the Neumann boundary condition (14,16) for the pressure is, up to an additional \(\chi \mu \nabla (\nabla \cdot \varvec{u})\), simply the momentum equation projected onto the normal direction \(\varvec{n}\) and restricted to \(\Gamma _{D,S}\). The Dirichlet boundary condition (13,15) for the pressure can be obtained by dotting the traction boundary condition (8) with \(\varvec{n}\) and subtracting \(2\mu \nabla \cdot \varvec{u}\) from the left-hand side, which is again consistent. The reason for the added terms will become clear soon, as we show the equivalence between the standard Navier–Stokes system and the PPE-modified one.

The first side of the equivalence, i.e., that (12)–(16) can be derived from the momentum-incompressibility system, has just been outlined. Slightly more involved will be proving the other side of the equivalence: does the pressure Poisson problem, combined with the momentum equation, imply incompressibility? To show that, we divide Eq. (2) by \(\rho \), apply the divergence and add the result to the PPE (12). This leaves us with

$$\begin{aligned} \beta \nabla \cdot \varvec{u} - \nabla \cdot \left[ \chi \nu \nabla (\nabla \cdot \varvec{u}) - \partial _t\varvec{u}\right] = 0\, , \end{aligned}$$

or, by introducing \(\varphi := \nabla \cdot \varvec{u}\), with the convection-diffusion-reaction equation

$$\begin{aligned} \partial _t\varphi - \nabla \cdot (\chi \nu \nabla \varphi ) + \beta \varphi = 0\, . \end{aligned}$$
(17)

What is missing now are boundary and initial conditions for this equation. Neumann data can be obtained by dotting (2) with \(\varvec{n}\), restricting the result to \(\Gamma _{D,S}\) and then subtracting (14), which gives \(\chi \mu \varvec{n}\cdot \nabla (\nabla \cdot \varvec{u}) = 0\), that is,

$$\begin{aligned} \frac{\partial \varphi }{\partial n}= 0 \ \ \text {on} \ \ \Gamma _{D,S}\, , \end{aligned}$$
(18)

since \(\chi \mu \ne 0\). Similarly, to get Dirichlet data for \(\varphi \) we multiply the traction boundary condition (8) by \(\varvec{n}\) and add the result to (13), yielding \(2\mu \nabla \cdot \varvec{u} = 0\), or simply

$$\begin{aligned} \varphi = 0 \ \ \text {on} \ \ \Gamma _N\, . \end{aligned}$$
(19)

Thus, with zero Dirichlet and Neumann boundary conditions, and provided that

$$\begin{aligned} \varphi _0 := \nabla \cdot \varvec{u}_0 = 0\, , \end{aligned}$$
(20)

the partial differential equation (17) has \(\varphi \equiv 0\) as its unique solution, that is, \(\nabla \cdot \varvec{u} = 0\) in \(\Omega \times [0,T]\), as we wanted to show.

In summary, combining the momentum equation (2) with the pressure Poisson problem (12)–(16) implies incompressibility without the need to enforce \(\nabla \cdot \varvec{u} = 0\) explicitly or to project \(\varvec{u}\) onto a divergence-free space. The main advantage of this PPE-based reformulation is that we now have an invertible operator for the pressure, as opposed to the original saddle-point structure. From the spatial discretisation standpoint, this eliminates the LBB compatibility restriction and allows equal-order finite element spaces [30]. For the temporal discretisation, the PPE gives us an invertible equation to compute p from \((\rho ,\varvec{u})\) without resorting to the artificial boundary conditions typical of projection methods.

The pressure Poisson equation, as presented in (12), has third-order derivatives on the velocity. Fortunately, we can eliminate them by using certain identities. Notice that

$$\begin{aligned}&\nabla \cdot \left[ \rho ^{-1}\nabla \cdot {\mathbb {S}} - \chi \nu \nabla (\nabla \cdot \varvec{u})\right] \\&\quad = \nabla \cdot \left[ \nu (\Delta \varvec{u} + \nabla (\nabla \cdot \varvec{u})) + 2\rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu - \chi \nu \nabla (\nabla \cdot \varvec{u})\right] . \end{aligned}$$

The vector Laplacian \(\Delta \varvec{u}\) obeys the identity \(\Delta \varvec{u} \equiv \nabla (\nabla \cdot \varvec{u}) - \nabla \times (\nabla \times \varvec{u})\), so that

$$\begin{aligned}&\nabla \cdot \left[ \rho ^{-1}\nabla \cdot {\mathbb {S}} - \chi \nu \nabla (\nabla \cdot \varvec{u})\right] \\&\quad = \nabla \cdot \left[ \frac{2}{\rho }\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu - \nu \nabla \times (\nabla \times \varvec{u}) +(2-\chi )\nu \nabla (\nabla \cdot \varvec{u})\right] . \end{aligned}$$

Now, by choosing \(\chi = 2\), we can get rid of the third-order derivatives:

$$\begin{aligned}&\nabla \cdot \left[ \rho ^{-1}\nabla \cdot {\mathbb {S}} - 2\nu \nabla (\nabla \cdot \varvec{u})\right] \nonumber \\&\quad = \nabla \cdot \left[ \frac{2}{\rho }\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu - \nu \nabla \times (\nabla \times \varvec{u})\right] \end{aligned}$$
(21)
$$\begin{aligned}&\quad = \nabla \cdot \left( \frac{2}{\rho }\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu \right) - \nabla \nu \cdot (\nabla \times \nabla \times \varvec{u}) - \nu \nabla \cdot (\nabla \times \nabla \times \varvec{u})\nonumber \\&\quad = \nabla \cdot \left( \frac{2}{\rho }\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu \right) - \nabla \nu \cdot (\nabla \times \nabla \times \varvec{u})\, , \end{aligned}$$
(22)

since \(\nabla \cdot (\nabla \times \varvec{v}) = 0\) for any vector \(\varvec{v}\). We are then left with only first- and second-order derivatives in (22). Now, the purpose of the \(\chi \nu \nabla (\nabla \cdot \varvec{u})\) term artificially (but consistently) added in Eq. (12) becomes clear, and it is in fact twofold: it adds diffusion to the divergence equation (17) and allows us to eliminate the third-order derivatives in the PPE by simply setting \(\chi = 2\). Although both consistency and incompressibility hold for any \(\chi > 0\), this is not intended here as a tunable parameter. We could in principle choose \(\chi \ne 2\), but this would only leave us with unnecessary higher-order derivatives. Since \(\chi \) features only in the PPE, it adds no diffusion to the momentum equation, but only to Eq. (17), whose unique solution is \(\nabla \cdot \varvec{u} = \varphi \equiv 0\) for any positive \(\chi \).

4 Weak pressure Poisson formulation

The second-order velocity derivatives in (22) cannot be handled by standard Lagrangian finite elements, so we need a weak formulation containing only first-order derivatives. This is not straightforward, and in fact Li et al. [13] used finite differences to evaluate the higher-order derivatives at the nodal points, then interpolated those values in a continuous source term—which is hardly practical in unstructured meshes. To allow a more general approach suitable for \(C^0\) finite elements in arbitrary meshes, we will next show how to reduce the order of differentiation, starting from (21) and using some vector calculus relations.

We first multiply the PPE (12) by a continuous test function q with zero value on \(\Gamma _N\). Then, we integrate by parts all terms but \(\beta \nabla \cdot \varvec{u}\), and enforce the Neumann boundary condition (14) to get

$$\begin{aligned}&\int _{\Omega }\rho ^{-1}\nabla p\cdot \nabla q \, \mathrm {d}\Omega \\&\quad = -\int _{\Gamma _D}q\partial _t(\varvec{n}\cdot {\mathbf {v}})\, \mathrm {d}\Gamma -\int _{\Omega }q\beta \nabla \cdot \varvec{u}\, \mathrm {d}\Omega \\&\qquad + \int _{\Omega }\nabla q\cdot \Big [\varvec{g} - (\nabla \varvec{u})\varvec{u} + 2\rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu \\&\qquad - \nu \nabla \times (\nabla \times \varvec{u}) \Big ] \mathrm {d}\Omega \, , \end{aligned}$$

where we can further use integration by parts to write

$$\begin{aligned}&\int _{\Omega }\nabla q\cdot \left[ \nu \nabla \times (\nabla \times \varvec{u})\right] \mathrm {d}\Omega \nonumber \\&\quad = \int _{\Omega }\nabla \times (\nu \nabla q)\cdot \left( \nabla \times \varvec{u}\right) \mathrm {d}\Omega \nonumber \\&\qquad + \int _{\Gamma }(\nabla q\times \varvec{n})\cdot \left( \nu \nabla \times \varvec{u}\right) \mathrm {d}\Omega \, , \end{aligned}$$
(23)

but

$$\begin{aligned} \nabla \times (\nu \nabla q) = \nabla \nu \times \nabla q + \nu \underbrace{\nabla \times (\nabla q)}_{\equiv \ \varvec{0}} = \nabla \nu \times \nabla q \end{aligned}$$
(24)

and

$$\begin{aligned}&- (\nabla \nu \times \nabla q)\cdot (\nabla \times \varvec{u}) \equiv - \nabla q\cdot \left[ (\nabla \times \varvec{u})\times \nabla \nu \right] \nonumber \\&\quad \equiv \nabla q\cdot \left\{ \left[ (\nabla \varvec{u})^{\top } - \nabla \varvec{u} \right] \nabla \nu \right\} . \end{aligned}$$
(25)

Moreover,

$$\begin{aligned} 2\rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}\nabla \mu&= 2\rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}(\rho \nabla \nu + \nu \nabla \rho )\nonumber \\&= 2\nu \rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}\nabla \rho + \left[ (\nabla \varvec{u})^{\top } + \nabla \varvec{u} \right] \nabla \nu \, . \end{aligned}$$
(26)

Therefore, collecting the results from (23)–(26), we arrive at a weak formulation: find p satisfying the Dirichlet condition \(p=\zeta \) on \(\Gamma _N\) (13), such that

$$\begin{aligned}&\int _{\Omega }\rho ^{-1}\nabla p\cdot \nabla q \, \mathrm {d}\Omega \nonumber \\&\quad = \int _{\Gamma }(\varvec{n}\times \nabla q)\cdot (\nu \nabla \times \varvec{u})\, \mathrm {d}\Gamma -\int _{\Gamma _D}q\partial _t(\varvec{n}\cdot {\mathbf {v}})\, \mathrm {d}\Gamma \nonumber \\&\qquad -\int _{\Omega }q\beta \nabla \cdot \varvec{u}\, \mathrm {d}\Omega + \int _{\Omega }\nabla q \nonumber \\&\qquad \cdot \left[ \varvec{g} - (\nabla \varvec{u})\varvec{u} + 2\nu \rho ^{-1}\nabla ^{\mathrm {s}}\varvec{u}\nabla \rho + 2(\nabla \varvec{u})^{\top }\nabla \nu \right] \mathrm {d}\Omega \nonumber \\ \end{aligned}$$
(27)

for all test functions q being zero on \(\Gamma _N\). Now that we are left with only first-order derivatives, \(C^0\) finite elements can be used to discretise all unknowns and test functions.

5 Discretisation

This section will address discretisation aspects in both space and time. Although we focus on finite elements for the spatial discretisation, the fractional-step schemes presented here are also valid for other frameworks such as finite differences and finite volumes.

5.1 Temporal discretisation

As usual in split-step methods, we employ backward differentiation formulas (BDFs) to approximate the temporal derivatives, combined with matching extrapolation rules for linearisation. The idea is to have iteration-free schemes completely decoupling velocity, pressure and density. For concision, we shall limit the presentation to first- and second-order temporal discretisations, but the schemes can be straightforwardly extended to higher-order versions with possibly adaptive stepping (see Ref. [30] for details).

Let \(\Delta t > 0\) be a finite time-step size and \(\upsilon _n\) denote a certain quantity \(\upsilon \) at time \(t = t_n\). For the first-order case, the backward finite difference BDF1 and corresponding extrapolation read:

$$\begin{aligned} \partial _t \upsilon |_{t=t_{n}} \approx \frac{1}{\Delta t}(\upsilon _{n} - \upsilon _{n-1}), \ \ \upsilon _n \approx {\hat{\upsilon }}_{n} = \upsilon _{n-1}\, , \end{aligned}$$
(28)

whereas to go one order higher we use BDF2:

$$\begin{aligned}&\partial _t \upsilon |_{t=t_{n}} \approx \frac{1}{\Delta t}\left( \frac{3}{2}\upsilon _{n} - 2\upsilon _{n-1} + \frac{1}{2}\upsilon _{n-2}\right) ,\nonumber \\&\upsilon _n \approx {\hat{\upsilon }}_{n} = 2\upsilon _{n-1} - \upsilon _{n-2} \, . \end{aligned}$$
(29)

For the mass equation, this results in

$$\begin{aligned} \rho _{n+1} +\Delta t\varvec{u}_n\cdot \nabla \rho _{n+1} = \rho _{n} \end{aligned}$$
(30)

for BDF1, or

$$\begin{aligned} \frac{3}{2}\rho _{n+1} + \Delta t(2\varvec{u}_n-\varvec{u}_{n-1})\cdot \nabla \rho _{n+1} = 2\rho _{n} - \frac{1}{2} \rho _{n-1} \end{aligned}$$
(31)

for BDF2. Either way, we are left with a linear partial differential equation that still needs to be discretised in space.

5.2 Spatial discretisation

It is well-known that the Galerkin finite element method, in its standard form, is not ideal for problems with low or zero diffusion, such as (30) or (31). Therefore, when solving the mass transport, it is common practice to employ residual-based [32, 34] or entropy [11] stabilisation techniques. However, we can leverage the absence of second-order derivatives to use a least-squares (instead of Galerkin) finite element formulation, as done by Pyo and Shen [10]. For an equation of the form

$$\begin{aligned} {\mathcal {L}}(u) := \alpha u + \varvec{v}\cdot \nabla u = f\, , \end{aligned}$$
(32)

it consists of seeking \(u\in X\) fulfilling inflow conditions, such that

$$\begin{aligned} \int _{\Omega }{\mathcal {L}}(u){\mathcal {L}}(v)\, \mathrm {d}\Omega = \int _{\Omega }f{\mathcal {L}}(v) \, \mathrm {d}\Omega \quad \text {for all} \ v\in X , \end{aligned}$$
(33)

with X being an appropriate finite element space. The least-squares finite element method is suitable for hyperbolic problems without requiring stabilisation terms or tunable factors. The other two equations in our system—momentum and pressure Poisson—on the other hand, can be tackled by a standard Galerkin finite element discretisation. Yet, some stabilisation may be required for high-Reynolds flows, as addressed in Sect. 6.4.

For concision, we shall state the weak momentum equation considering \(\Gamma _S = \emptyset \); details on the implementation of (free-)slip conditions can be found for instance in Refs. [31, 35]. The following sets are considered:

$$\begin{aligned}&W_{{\mathbf {v}}}^k := \left\{ \varvec{w}\in \left[ S_h^k(\Omega _h)\right] ^d \, : \, \varvec{w} = {\mathbf {v}}_h \ \ \text {on} \ \Gamma _D \right\} ,\\&Q_{\zeta }^l := \left\{ q\in S_h^l(\Omega _h) \, : \, q = \zeta _h \ \ \text {on} \ \Gamma _N \right\} ,\\&R_{\varrho }^m := \left\{ r\in S_h^m(\Omega _h) \, : \, r = \varrho _h \ \ \text {on} \ \Gamma _{\text {in}} \right\} , \end{aligned}$$

where subscript h denotes the finite element interpolation of a certain quantity or geometry, and \(S_h^k(\Omega _h)\) denotes the standard space of continuous, piecewise polynomial shape functions of degree k in the triangulation of \(\Omega _h\). Notice that, in general, we will formally have \(R_{\varrho }^m(t)\), since the inflow boundary depends instantly and locally on \(\varvec{n}\cdot \varvec{u}(t)\).

Another discretisation-related matter to be discussed is the choice of the weighting parameter \(\beta \) in the pressure Poisson equation (27). On the continuous level, all we need is \(\beta \ge 0\) to guarantee incompressibility, otherwise a negative \(\beta \) could spoil the unique solvability of (17) with non-zero eigenmodes of \(\varphi = \nabla \cdot \varvec{u}\). On the discrete level, however, \(\beta \) should be chosen appropriately if optimal convergence is desired. First, notice that the term \(\beta \nabla \cdot \varvec{u}\) penalises large violations of discrete incompressibility, so that \(\beta \) works as a penalty-like parameter. While Li [36] proposed an expression based solely on the spatial resolution, Pacheco et al. [37] showed that in fact \(\beta \) can be taken as the inverse of the well-known PSPG parameter:

$$\begin{aligned} \beta = \frac{1}{\tau _{\text {PSPG}}} = \sqrt{\left( \frac{\alpha _1\nu }{h^2}\right) ^2 + \left( \frac{\alpha _2|\varvec{u}|}{h}\right) ^2 + \left( \frac{\alpha _3}{\Delta t}\right) ^2 }\, , \end{aligned}$$
(34)

in which h denotes the element size and \((\alpha _1,\alpha _2,\alpha _3)\) are tunable parameters. For stationary problems we take \(\alpha _3 = 0\), whereas \(\alpha _1 = \alpha _2 = 0\) when using LBB-compatible spaces (e.g. Taylor–Hood elements). To reduce the number of user-defined parameters, we set

$$\begin{aligned} \beta = \alpha \sqrt{\delta _{kl}\left[ \left( \frac{4\nu }{h^2}\right) ^2 + \left( \frac{2|\varvec{u}|}{h}\right) ^2\right] + \left( \frac{2}{\Delta t}\right) ^2 }\, , \end{aligned}$$
(35)

where \(\alpha \) is a single tunable parameter, k and l are the orders of the velocity and pressure discretisations, respectively, and \(\delta _{kl}\) refers to the Kronecker delta.

5.3 The Dirichlet boundary condition for the pressure

We now briefly discuss a technical issue involving the pressure Dirichlet boundary condition (13). For problems with \(\Gamma _N\ne \emptyset \), we have

$$\begin{aligned} p = \zeta := 2\mu \nabla ^{\text {s}}\varvec{u}:(\varvec{n}\otimes \varvec{n} - {\mathbb {I}}) - \varvec{t}\cdot \varvec{n} \ \ \text {on} \ \ \Gamma _N\, , \end{aligned}$$

where \(\varvec{t}\) is some given normal traction. Since on the discrete level the stress tensor \({\mathbb {S}} = 2\mu \nabla ^{\text {s}}\varvec{u}\) will be discontinuous, so will \(\zeta \) across elements. This is an issue when using continuous finite elements for the pressure, but there are various ways to circumvent that. The most common approach is to project \(\zeta \) (in the \(L^2(\Gamma _N)\) sense) onto a continuous space [4, 29, 30]. Another possibility is to notice that, although \(\varvec{n}\) can be discontinuous on non-planar surfaces, outflow boundaries are normally generated by truncating a larger physical domain, so that each outlet portion of the computational domain is planar. That being the case, the tangential projector \((\varvec{n}\otimes \varvec{n}-{\mathbb {I}})\) will be constant—or piecewise constant, if there are multiple outlets—so that we could simply perform an \(L^2(\Omega )\) projection of \({\mathbb {S}}\) onto a continuous finite element space. An \(L^2(\Omega )\) projection is simpler than an \(L^2(\Gamma _N)\) projection, but also more expensive. Yet, we can pre-compute and store the LDL decomposition of the mass matrix used in the projection, or even lump it [30]. As we will soon see, projecting the stress tensor may also be useful in other parts of the solver. It is also possible to compute nodal values by simply averaging \(\zeta \) on the boundary patch surrounding each node, although we have not tested this option. Regardless of the approach used, we shall henceforth consider that a continuous value \({\tilde{\zeta }}\) is used.

6 Fractional-step schemes

The main strength of split-step methods is decoupling pressure from velocity. With PPE-based schemes, the idea is to march in time by first computing the current velocity from previous pressures, then using the updated velocity (and density) to compute the current pressure, and so on for the next steps. To do that, the pressure term in the momentum equation is treated explicitly. On the other hand, when updating the pressure we can treat all terms implicitly in the PPE, since both the current velocity and the current density will already be known at that point.

6.1 Initialisation

In general, the incompressible Navier–Stokes system is not equipped with initial conditions for the pressure. This can be an issue depending on the temporal discretisation considered, as discussed for instance by Rang [38]. In the pressure Poisson framework, on the other hand, we naturally compute this initial value by seeking \(p_0\in Q^l_{{\tilde{\zeta }}_0}\) such that

$$\begin{aligned}&\int _{\Omega }\frac{1}{\rho _0}\nabla p_0\cdot \nabla q \, \mathrm {d}\Omega \nonumber \\&\quad = \int _{\Gamma }(\varvec{n}\times \nabla q)\cdot (\nu _0\nabla \times \varvec{u}_0)\, \mathrm {d}\Gamma \nonumber \\&\qquad -\int _{\Gamma _D}q\partial _t(\varvec{n}\cdot \varvec{u}_0)\, \mathrm {d}\Gamma -\int _{\Omega }q\beta _0\nabla \cdot \varvec{u}_0\, \mathrm {d}\Omega + \int _{\Omega }\nabla q\nonumber \\&\qquad \cdot \left[ \varvec{g}_0 - (\nabla \varvec{u}_0)\varvec{u}_0 + \frac{2\nu _0}{\rho _0}\nabla ^{\mathrm {s}}\varvec{u}_0\nabla \rho _0+ 2(\nabla \varvec{u}_0)^{\top }\nabla \nu _0 \right] \mathrm {d}\Omega \nonumber \\ \end{aligned}$$
(36)

for all \(q\in Q^l_{0}\). This is why it is crucial, in deriving the PPE, to divide the momentum equation by \(\rho \) before taking the divergence. If we were to apply \(\nabla \cdot \) directly to the momentum equation, the transient term would result in

$$\begin{aligned} \nabla \cdot (\rho \partial _t\varvec{u}) = \rho \partial _t(\nabla \cdot \varvec{u}) + \partial _t\varvec{u}\cdot \nabla \rho = \partial _t\varvec{u}\cdot \nabla \rho \not \equiv 0\, , \end{aligned}$$

instead of \(\nabla \cdot (\partial _t\varvec{u}) = \partial _t(\nabla \cdot \varvec{u}) \equiv 0\). Consequently, the integral on \(\Gamma _D\) in Eq. (36) would be replaced by a volume integral depending on the acceleration \(\partial _t\varvec{u}\). In that case, initialising the time-marching would not be straightforward, since the initial acceleration is not given for flow equations. That would require using a forward discretisation of \(\partial _t\varvec{u}\), resulting in an implicit step. Our formulation, on the other hand, requires only the time derivative of the normal data \({\mathbf {v}}\cdot \varvec{n}\) on \(\Gamma _{D}\), which may sound similar to the situation just described, yet is fundamentally different. Since \({\mathbf {v}}\) is given, its time derivative is either known exactly (e.g. when artificially ramping up inflow data), or can be approximated by a forward finite difference—which does not lead to an implicit coupling, since \({\mathbf {v}}\cdot \varvec{n}\) is known a priori at all times. This discussion is applicable also to the initial-boundary value problem in strong form, hence it holds regardless of the spatial discretisation. Thus, using only given quantities, we are able to compute \(p_0\) and start marching in time.

6.2 First-order stepping

As mentioned in Sect. 5.1, our first-order stepping combines BDF1 with linear extrapolation (\(\varvec{u}_{n+1} \approx \hat{\varvec{u}}_{n+1} = \varvec{u}_n\) and \(p_{n+1} \approx {\hat{p}}_{n+1} = p_n\)). Given \((\rho _n,\varvec{u}_n,p_n)\), we march in time by executing the following steps:

  1. 1.

    Convective step

    Find \(\rho _{n+1}\in R_{{\varrho }_{n+1}}^m\) such that

    $$\begin{aligned} \int _{\Omega }\left( r + \Delta t\varvec{u}_{n}\cdot \nabla r\right) \left( \rho _{n+1} + \Delta t\varvec{u}_{n}\cdot \nabla \rho _{n+1} - \rho _n\right) \mathrm {d}\Omega = 0 \end{aligned}$$
    (37)

    for all \(r \in R_0^m\).

  2. 2.

    Viscosity update

    Compute \(\nu _{n+1}\) based on the updated phase distribution described by \(\rho _{n+1}\).

  3. 3.

    Velocity update

    Find \(\varvec{u}_{n+1}\in W^k_{{\mathbf {v}}_{n+1}}\) such that

    $$\begin{aligned}&\int _{\Omega } \rho _{n+1}\bigg \lbrace \varvec{w}\cdot \left[ (\nabla \varvec{u}_{n+1})\varvec{u}_{n}\right] + \frac{1}{\Delta t}\varvec{w}\cdot \varvec{u}_{n+1}\nonumber \\&\qquad + 2\nu _{n+1}\nabla ^{\text {s}}\varvec{u}_{n+1}:\nabla ^{\text {s}}\varvec{w}\bigg \rbrace \mathrm {d}\Omega \nonumber \\&\quad =\int _{\Omega } p_{n}\nabla \cdot \varvec{w} \, \mathrm {d}\Omega + \int _{\Omega } \rho _{n+1}\varvec{w}\cdot \left( \frac{1}{\Delta t}\varvec{u}_{n} + \varvec{g}_{n+1} \right) \mathrm {d}\Omega \nonumber \\&\qquad + \int _{\Gamma _N} \varvec{w}\cdot \varvec{t}_{n+1}\, \mathrm {d}\Gamma \end{aligned}$$
    (38)

    for all \(\varvec{w}\in W^k_{{\mathbf {0}}}\).

  4. 4.

    Pressure Poisson step

    Find \(p_{n+1}\in Q^l_{{\tilde{\zeta }}_{n+1}}\) such that

    $$\begin{aligned}&\int _{\Omega }\frac{1}{\rho _{n+1}}\nabla p_{n+1}\cdot \nabla q \, \mathrm {d}\Omega \nonumber \\&\quad = \int _{\Gamma }(\varvec{n}\times \nabla q)\cdot (\nu _{n+1}\nabla \times \varvec{u}_{n+1})\, \mathrm {d}\Gamma \nonumber \\&\qquad -\int _{\Gamma _D}q\partial _t(\varvec{n}\cdot {\mathbf {v}}_{n+1})\, \mathrm {d}\Gamma -\int _{\Omega }q\beta _{n+1}\nabla \cdot \varvec{u}_{n+1}\, \mathrm {d}\Omega \nonumber \\&\qquad + \int _{\Omega }\nabla q\cdot \bigg [\varvec{g}_{n+1} - (\nabla \varvec{u}_{n+1})\varvec{u}_{n+1} \nonumber \\&\qquad + \frac{2\nu _{n+1}}{\rho _{n+1}}\nabla ^{\mathrm {s}}\varvec{u}_{n+1}\nabla \rho _{n+1}+ 2(\nabla \varvec{u}_{n+1})^{\top }\nabla \nu _{n+1}\bigg ] \mathrm {d}\Omega \nonumber \\ \end{aligned}$$
    (39)

    for all \(q \in Q^l_{0}\).

6.3 Second-order stepping

Our second-order scheme combines BDF2 with linear extrapolation (\(\varvec{u}_{n+1} \approx \hat{\varvec{u}}_{n+1} = 2\varvec{u}_{n} - \varvec{u}_{n-1}\) and \(p_{n+1} \approx {\hat{p}}_{n+1} = 2p_{n} - p_{n-1}\)). Therefore, initialisation requires, for example, using a first-order step to compute \((\rho _1,\varvec{u}_1,p_1)\). Then, we can march in time by executing the following steps:

  1. 1.

    Convective step

    Find \(\rho _{n+1}\in R_{\varrho _{n+1}}^m\) such that

    $$\begin{aligned}&\int _{\Omega }\left( 3r + 2\Delta t\hat{\varvec{u}}_{n+1}\cdot \nabla r\right) \left( 3\rho _{n+1} + 2\Delta t\hat{\varvec{u}}_{n+1}\right. \nonumber \\&\quad \cdot \nabla \rho _{n+1} - 4\rho _n + \rho _{n-1} \big ) \mathrm {d}\Omega = 0 \end{aligned}$$
    (40)

    for all \(r \in R_0^m\).

  2. 2.

    Viscosity update

    Compute \(\nu _{n+1}\) based on the updated phase distribution described by \(\rho _{n+1}\).

  3. 3.

    Velocity update

    Find \(\varvec{u}_{n+1}\in W^k_{{\mathbf {v}}_{n+1}}\) such that

    $$\begin{aligned}&\int _{\Omega } \rho _{n+1}\bigg \lbrace \varvec{w}\cdot \left[ (\nabla \varvec{u}_{n+1})\hat{\varvec{u}}_{n+1}\right] + \frac{3}{2\Delta t}\varvec{w}\cdot \varvec{u}_{n+1}\nonumber \\&\qquad + 2\nu _{n+1}\nabla ^{\text {s}}\varvec{u}_{n+1}:\nabla \varvec{w}\bigg \rbrace \mathrm {d}\Omega \nonumber \\&\quad =\int _{\Omega } {\hat{p}}_{n+1}\nabla \cdot \varvec{w} \, \mathrm {d}\Omega + \int _{\Omega } \rho _{n+1}\varvec{w}\nonumber \\&\qquad \cdot \left( \frac{2}{\Delta t}\varvec{u}_{n} - \frac{1}{2\Delta t}\varvec{u}_{n-1} + \varvec{g}_{n+1} \right) \mathrm {d}\Omega + \int _{\Gamma _N} \varvec{w}\cdot \varvec{t}_{n+1}\, \mathrm {d}\Gamma \nonumber \\ \end{aligned}$$
    (41)

    for all \(\varvec{w}\in W^k_{{\mathbf {0}}}\).

  4. 4.

    Pressure Poisson step

    Find \(p_{n+1}\in Q^l_{{\tilde{\zeta }}_{n+1}}\) such that Eq. (39) holds for all \(q \in Q^l_{0}\).

In both schemes, the pressure Poisson step is fully implicit, that is, the current pressure is computed directly from the current velocity and density fields. Similarly, there is no need to extrapolate the density when updating the velocity, since we already know \(\rho _{n+1}\) when computing \(\varvec{u}_{n+1}\). If the order of the steps is inverted, with \(\varvec{u}\) updated before \(\rho \), we need to replace \(\rho _{n+1}\) by \({\hat{\rho }}_{n+1}\) in the velocity step, but on the other hand \(\hat{\varvec{u}}_{n+1}\) could be replaced by \(\varvec{u}_{n+1}\) in the convective step.

6.4 Convection-dominated flows

At high Reynolds numbers, the Galerkin finite element approximation of the momentum balance suffers from convective instabilities, unless a very fine mesh is used. A simple remedy for that is the streamline upwind/Petrov–Galerkin (SUPG) stabilisation. On the other hand, dominant convection also means that we can treat the viscous term explicitly (or semi-implicitly) without incurring a parabolic time-step restriction [28]. In the weak form of the momentum equation, the viscous term reads

$$\begin{aligned} \int _{\Omega } 2\mu \nabla ^{\text {s}}\varvec{u}:\nabla ^{\text {s}}\varvec{w} \, \mathrm {d}\Omega&= \int _{\Omega } \mu \nabla \varvec{u}:\nabla \varvec{w} \, \mathrm {d}\Omega \\&\quad + \int _{\Omega } \mu \nabla \varvec{u}:(\nabla \varvec{w})^{\top } \, \mathrm {d}\Omega \, . \end{aligned}$$

The last term has a coupling effect over the velocity components, so that treating it explicitly decouples the velocity update step into d scalar convection-diffusion equations (see Ref. [30] for details). This reduces computational costs and allows us to apply SUPG individually to each of the scalar equations [39]. Let us, for concision, write the ith component of \(\varvec{u}\) at \(t=t_{n+1}\) as \(u^i\), and \({\hat{\upsilon }}_{n+1}\) as \({\hat{\upsilon }}\) for any extrapolated quantity \(\upsilon \). In that case, our semi-discretised balance of momentum in the \(x_i\) direction reads

$$\begin{aligned}&\alpha _0\rho u^i + \rho \hat{\varvec{u}}\cdot \nabla u^i - \nabla \cdot (\rho \nu \nabla u^i)\nonumber \\&\quad = \nabla \cdot \left( \rho \nu \frac{\partial \hat{\varvec{u}}}{\partial x_i} \right) + \overbrace{\rho g^i - \frac{\partial {\hat{p}}}{\partial x_i} - \sum _{j=1}^m \alpha _j\rho u^i_{n+j-1}}^{:= f_i}\, , \end{aligned}$$
(42)

with \(\alpha _j\) denoting the coefficients of the finite difference discretisation (\(\alpha _0 = -\alpha _1 = 1/\Delta t\) for BDF1 or \(\alpha _2 = -\alpha _1/4 = \alpha _0/3 = 0.5/\Delta t\) for BDF2). For the SUPG method, we add to the left-hand side of the weak momentum equation the nonlinear form

$$\begin{aligned}&\sum _{e=1}^{N_e}\int _{\Omega _e} \left\{ \tau _{\text {SUPG}}\rho \hat{\varvec{u}}\cdot \nabla w\right\} \left\{ \alpha _0\rho u^i + \rho \hat{\varvec{u}} \cdot \nabla u^i - \nabla \right. \cdot \nonumber \\&\quad \left. \left[ \rho \nu \left( \nabla u^i + \frac{\partial \hat{\varvec{u}}}{\partial x_i}\right) \right] - f_i\right\} \mathrm {d}\Omega \,, \end{aligned}$$
(43)

where \(\tau _{\text {SUPG}}\) is a mesh-dependent parameter and w is a scalar test function. Notice that this stabilisation is in general consistent, as the added term is proportional to the residual of Eq. (42). However, this is not the case when using linear elements, which are unable to approximate the second-order derivatives in the viscous term. Although this is in principle not an issue for stability, the missing terms may lead to inaccuracy on flow regions where diffusion dominates. Therefore, for first-order elements we propose replacing (43) by

$$\begin{aligned}&\sum _{e=1}^{N_e}\int _{\Omega _e} \left( \tau _{\text {SUPG}}\rho \hat{\varvec{u}}\cdot \nabla w\right) \nonumber \\&\quad \left( \alpha _0\rho u^i + \rho \hat{\varvec{u}}\cdot \nabla u^i - \sum _{j=1}^d\frac{\partial {\hat{S}}_{ij}}{\partial x_j} - f_i\right) \mathrm {d}\Omega \, , \end{aligned}$$
(44)

where \({\hat{S}}_{ij}\) denotes the components of the \(L^2(\Omega )\) projection of the viscous stress tensor \({\mathbb {S}}\) onto a continuous finite element space. In other words, we find \({\hat{S}}_{ij} \in X_h\) such that

$$\begin{aligned} \int _{\Omega } {\hat{S}}_{ij}\sigma \, \mathrm {d}\Omega = \int _{\Omega } \left( \frac{\partial {\hat{u}}^i}{\partial x_j} + \frac{\partial {\hat{u}}^j}{\partial x_i}\right) \rho \nu \sigma \, \mathrm {d}\Omega \end{aligned}$$

for all \(\sigma \in X_h\), in which \(X_h\) can be taken, for instance, as the pressure finite element space (without boundary conditions). Projecting the viscous stress tensor onto a continuous finite element space is also usual in certain stabilisation [40, 41] and projection methods [3]. Since \({\mathbb {S}}\) is symmetric, the “cost” of this projection are \(d(d+1)/2\) scalar mass-matrix systems, but there are two simple ways to basically eliminate the overhead. One is to store the LDL decomposition of the mass matrix during initialisation and re-use it for all time steps; alternatively, the mass matrix can be lumped, which is our approach herein. As for the stabilisation parameter, we use

$$\begin{aligned} \tau _{\text {SUPG}} = \left( \frac{2\rho |\hat{\varvec{u}}|}{h} + \rho \alpha _0 + \frac{4\rho \nu }{h^2}\right) ^{-1}, \end{aligned}$$

which is simply one among several possibilities [42].

7 Numerical examples

In this section, we assess the accuracy of our fractional-step framework through test cases with increasing complexity. One of the main advantages of our approach with respect to projection methods is allowing equal-order interpolation of all unknowns. Regarding the velocity-pressure pairing, we consider linear-linear (\(\varvec{P}_1P_1\)) and Taylor–Hood (\(\varvec{P}_2P_1\)) triangular elements; for numerical examples with other element classes, including three-dimensional ones, refer to our recent work on split-step schemes for non-Newtonian flows [30]. In all examples, a first-order discretisation (\(P_1\)) is used for the density.

7.1 Manufactured solution

We start with a simple problem having an analytical solution and a pure Dirichlet boundary. In the square domain \(\Omega = (0,1)^2\), we consider the flow described by

$$\begin{aligned} p&=(2-2x)f(t), \ \ \varvec{u} = \begin{pmatrix} u(y)f(t)\\ 0 \end{pmatrix}, \\ \rho&= f(t)\mathrm {e}^{x/u(y)}, \ \ \varvec{g}= \begin{pmatrix} -u(y)f^2(t)\\ 0 \end{pmatrix}, \end{aligned}$$

in which \(f(t)=(1+t)^{-1}\) and \(u(y) = 1+y-y^2\). The accuracy of the first-order (\(\varvec{P}_1P_1P_1\), BDF1) and second-order (\(\varvec{P}_2P_1P_1\), BDF2) schemes is assessed through the spatial error at \(t=T=1\). Divergence penalty is not used in this example, i.e., we set \(\beta = 0\) in the PPE. The velocity error is measured in the relative \({\mathbf {H}}^1(\Omega )\) semi-norm, whereas for pressure and density we use the relative \(L^2(\Omega )\) norm. Starting with a coarse orthogonal mesh of four triangles, seven levels of uniform spatial refinement are applied, with the time-step size also halved at each level via \(\Delta t = h/2\). The results of the convergence study are shown in Figure 1. As expected, the first-order elements yield linear convergence, whereas the Taylor–Hood elements converge quadratically when combined with BDF2. Notice, however, that the exact solution for this problem is smooth, so that optimal convergence is attainable with standard discretisations. In flows with more than one phase, on the other hand, the spatial convergence will in general not be optimal unless velocity kinks and possible pressure discontinuities are appropriately resolved [7].

Fig. 1
figure 1

Uniform refinement study considering triangular elements and a problem with smooth exact solution

Fig. 2
figure 2

Rayleigh–Taylor instability: density field at \(t/\tau =\) 0, 1.40, 2.10, 2.45, 2.80, 3.15 and 3.50

7.2 Rayleigh–Taylor instability

One of the most popular benchmarks for variable-density flow solvers is the Rayleigh–Taylor instability with regularised interface [5, 43]. The standard setup considers two fluids initially at rest in \(\Omega = (0,a/2)\times (-2a,2a)\) and subject to \(\varvec{g} = (0,-g)^{\top }\). Fluid 2 sits initially on top of fluid 1 and is denser (\(\rho _2 > \rho _1\)) but equally viscous (\(\mu _1 = \mu _2\)). The initial transition is regularised via

$$\begin{aligned} \rho |_{t=0} = \frac{\rho _2+\rho _1}{2} + \frac{\rho _2 - \rho _1}{2}\tanh \left( \frac{y- \iota (x)}{a/100}\right) , \end{aligned}$$

where \(\iota (x) = -0.1a\cos (2\pi x/a)\) describes the interface line at \(t=0\). We nondimensionalise the problem through the following reference quantities: \(\nu _1\) for viscosity, \(\rho _1\) for density, a for length and \(\sqrt{ag}\) for velocity, which gives us \(\tau = \sqrt{a/g}\) as temporal scale. Then, the problem is fully parametrised through the Reynolds and Atwood numbers:

$$\begin{aligned} \text {Re} = \frac{a\sqrt{ag}}{\nu _1} \ \ \text {and} \ \ \text {At} = \left| \frac{\rho _2 - \rho _1}{\rho _2 + \rho _1}\right| \, , \end{aligned}$$
Fig. 3
figure 3

Rayleigh–Taylor instability: vertical position H of the rising bubble, measured from the mid-height of the domain. The comparison with previously reported numerical results [5, 43] reveals very good agreement

Fig. 4
figure 4

Dam break: height H of the water column on the left wall, showing good agreement with other numerical [22] and experimental [44] results

which are set as 1000 and 0.5, respectively. For the simulation, we use the first-order scheme with \(\alpha = 0.01\), \(\Delta t = \tau /1000\) and a uniform mesh with \(6.4 \times 10^5\) elements. No SUPG stabilisation is used, which is possible due to the relatively fine mesh. The top and bottom walls are no-slip boundaries, while symmetry is enforced on the sides.

Figure 2 shows the density field for different time instants, agreeing well with the results reported by Guermond and Salgado [11] (mind that they use a different time scale \({\widetilde{\tau }} = \tau \sqrt{\text {At}}\)). For a quantitative comparison, Figure 3 shows how the height H of the rising bubble evolves in time. Our results agree well with the simulations reported by Tryggvason [43] and Guermond and Quartapelle [5].

Fig. 5
figure 5

Dam break: velocity norm and density field at \(t\sqrt{g/a} \approx 0.5\), 1.5, 2.5 and 3.2

7.3 Dam break

We now move to a more challenging setup involving air and water. The dam break experiment by Martin and Moyce [44] is a popular benchmark for two-phase [22, 45] and free-surface [46] flow simulations. This is a high-Reynolds, gravity-driven flow and, as such, suits our application scope very well. The setup considered by Landet et al. [22] consists of a tank \(\Omega = (0,5a)\times (0,3a)\) containing a rectangular water column \((0,a)\times (0,2a)\) surrounded by air, initially at rest, with free-slip walls and \(a = 57.15\) mm. We set \(\rho _{\text {air}} = 3\rho _{\text {water}}/2500 = 1.2\) kg/m\(^3\) and \(\nu _{\text {air}} = 15\nu _{\text {water}} = 1.5\times 10^{-5}\) m\(^2\)/s as material properties, and \(\varvec{g} = (0,-9.81)^{\top }\) m/s\(^2\) for gravity.

Fig. 6
figure 6

Three-phase channel flow: setup and grid

Due to the large density difference between air and water, for this example we replace the explicit mass convection (1) by the level-set equation

$$\begin{aligned} \partial _t\phi + \varvec{u}\cdot \nabla \phi = 0\,, \end{aligned}$$

with \(\phi \) being a signed distance function: \(\phi > 0\) corresponds to air, \(\phi <0\) to water, and \(\phi = 0\) to the interface. We can therefore write

$$\begin{aligned} \rho = \frac{\rho _{\text {water}} + \rho _{\text {air}}}{2} + \frac{\rho _{\text {air}} - \rho _{\text {water}}}{2}\text {sign} \, \phi \, , \end{aligned}$$

and analogously for the kinematic viscosity. Since both \(\nabla \rho \) and \(\nabla \nu \) appear in the PPE (27), it is useful to regularise the discontinuity. A common approach is to replace the sign function by a hyperbolic tangent [47], which is also done for this example:

$$\begin{aligned} \rho = \frac{\rho _{\text {water}} + \rho _{\text {air}}}{2} + \frac{\rho _{\text {air}} - \rho _{\text {water}}}{2}\tanh k\phi \, , \quad k = 10^3\, . \end{aligned}$$

An excellent discussion on different variants of the level-set method is provided by Olsson and Kreiss [48]. Most importantly, our formulation remains consistent regardless of how the density is treated, as the PPE is derived solely from the momentum equation.

To handle the dominant convection, especially in the aerodynamic flow, we also use SUPG stabilisation. The discretisation is again first-order, with \(3\times 10^{5}\) triangular elements and \(\Delta t = 10^{-4}\) s. The main benchmark quantity here is the temporal evolution of the water column’s height, H. We compare our solution to the measurements by Martin and Moyce [44] and the numerical results by Touré et al. [45], who used a modified level-set method with corrected mass conservation. As shown in Figure 4, all three results are in very good agreement.

To illustrate the complex flow emerging from this simple example, we show in Figure 5 the Euclidian norm of the velocity field for different instants in time. The downward motion of the water column “propels” the air upwards and, as the air goes past the column’s corner, a vortex is created as in a backward-facing step flow. As the water column keeps going down, two adjacent air vortices can be seen. We also observe smaller vortices around the water surge front as it shoots upwards after meeting the right wall. In the same figure, the density plot reveals quite a sharp interface, in spite of the regularisation.

Fig. 7
figure 7

Three-phase channel flow: solutions obtained with (\(\alpha > 0\)) and without (\(\alpha = 0\)) divergence penalty. The density field, on the right, shows no remarkable differences between all the schemes. On the left, the (prescribed) inflow and (computed) outflow profiles, normalised by \({\bar{u}} := |0.5kH^2/\mu _1|\), showcase the improved mass conservation for \(\alpha = 0.002\) in the first-order scheme

7.4 Three-phase channel flow

As our last test case, we investigate a three-phase flow in the straight channel \(\Omega = (0,L)\times (0,H)\). The three fluids are initially at rest, stacked up as illustrated in Figure 6 (a). They all have the same kinematic viscosity \(\nu \), but different dynamic viscosities since \(\rho _3=1.5\rho _2=3\rho _1 = 1.5\). For a constant pressure gradient \(\frac{\partial p}{\partial x} = k\), we can calculate the analytical solution for the stationary Poiseuille-like profile:

$$\begin{aligned} u(y) = {\left\{ \begin{array}{ll} \frac{kH^2}{2\mu _3}\left[ \left( \frac{y}{H}\right) ^2 - \frac{\gamma }{4}\left( \frac{y}{H}\right) \right] , &{} \text {for} \ 0 \le y \le \frac{H}{4}\\ \quad \frac{(1 - \gamma )kH^2}{32\mu _3} +\frac{kH^2}{2\mu _2} &{} \\ \cdot \left[ \left( \frac{y}{H}\right) ^2 - \frac{\gamma }{4}\left( \frac{y}{H}\right) + \frac{(\gamma -1)}{16}\right] , &{} \text {for} \ \frac{H}{4} \le y \le \frac{H}{2}\\ \quad \frac{(1 - \gamma )kH^2}{32\mu _3} +\frac{(3 - \gamma )kH^2}{32\mu _2} +\frac{kH^2}{2\mu _1} &{} \\ \cdot \left[ \left( \frac{y}{H}\right) ^2 - \frac{\gamma }{4}\left( \frac{y}{H}\right) + \frac{(\gamma -2)}{8}\right] , &{}\hbox {for } \frac{H}{2} \le y \le H \end{array}\right. } \end{aligned}$$

in which

$$\begin{aligned} \gamma = \frac{\mu _1\mu _2 + 3\mu _1\mu _3 + 12\mu _2\mu _3}{\mu _1\mu _2 + \mu _1\mu _3 + 2\mu _2\mu _3}. \end{aligned}$$

For concision, we omit the derivation, but it can be done in the standard way: solving the stationary momentum equation and enforcing continuity of velocities and viscous stresses at the interfaces.

The main idea with this example is to illustrate how the penalty-like term \(\beta \nabla \cdot \varvec{u}\) (cf. Eq. (12)) can improve mass conservation on the discrete level. For this, we consider a test case with prescribed inflow, but an open outflow. When reaching a stationary solution, we would ideally like to see the same profile on the open outlet \((x=L)\) as the one prescribed on the inlet \((x=0)\). So, we enforce the inflow profile \(\varvec{u} = (u(y)f(t),0)^{\top }\), with

$$\begin{aligned} f(t)&= \frac{1}{2}\left[ 1-\text {sign}\left( \left| 2t-t^{\star }\right| -t^{\star }\right) \right] \sin ^2\left( \frac{\pi t}{2t^{\star }}\right) \\&\quad + \frac{1}{2}\left[ 1+\text {sign}(t-t^{\star })\right] \end{aligned}$$

ramping up smoothly from zero (for \(t\le 0\)) to unit value (for \(t\ge t^{\star }\)). For the density, the inlet boundary condition is constant in time, obeying the initial phase distribution.

Since prescribing zero (or constant) normal traction \(\varvec{t}\) does not allow reproducing a developed flow, we swap the traction boundary condition (8) by a pseudo-traction condition on the outflow boundary:

$$\begin{aligned} (\mu \nabla \varvec{u})\varvec{n} - p\varvec{n} = \tilde{\varvec{t}}\, , \end{aligned}$$

with \(\tilde{\varvec{t}}\) being some normal pseudo-traction data, usually taken as zero in flows with one single outlet. To naturally impose the pseudo-traction, we switch from a stress-divergence formulation of the momentum equation to a generalised Laplacian approach [49]. In that case, the Dirichlet value (15) for the pressure has to be slightly adapted:

$$\begin{aligned} p = \mu \nabla \varvec{u}^\mathrm {s}:(\varvec{n}\otimes \varvec{n} - {\mathbb {I}}) - \tilde{\varvec{t}}\cdot \varvec{n} \ \ \text {on} \ \ \Gamma _N\, . \end{aligned}$$

Details on outflow boundary conditions and the generalised Laplacian formulation can be found in Refs. [30, 49]. Then, by setting \(\tilde{\varvec{t}} = \varvec{0}\), \(\varvec{g} = \varvec{0}\), \(T= 2.5t^{\star }=1\), \(L = H = 1\), \(\nu = 1\) and \(k=-1\), we have the complete problem setup.

For the temporal discretisation, this time we use BDF2 with \(\Delta t = 0.02\). If the interfaces were to lie completely on grid lines, the velocity kinks would be resolved by the spatial discretisation; to avoid that and be more realistic, we use the non-orthogonal mesh shown in Figure 6 (b). The first two test cases employ \(\varvec{P}_2P_1P_1\) and \(\varvec{P}_1P_1P_1\) elements, respectively, without any divergence penalty (\(\alpha =0\), cf. Eq. (35)), whereas the third one has \(\alpha =0.002\) and also first-order elements.

Fig. 8
figure 8

Three-phase channel flow: how the divergence error and the density under- and overshoot are affected by the divergence penalty parameter \(\alpha \), using \(\varvec{P}_1P_1P_1\) elements

Figure 7 depicts the density field and the velocity profiles at \(t=1\), when the developed steady-state solution is already established. The density distribution is similar in all cases, exhibiting interface oscillations due to the relatively coarse mesh for a multi-phase flow. In spite of that, the velocity profile shows no apparent oscillations. The plots reveal how even a small \(\alpha \) can virtually eliminate the mass loss otherwise seen for the \(\varvec{P}_1P_1P_1\) elements, whereas the second-order discretisation shows no relevant loss even without any penalty. We must remark, however, that finding a good value for \(\alpha \) requires some tuning: setting \(\alpha \) too large can lead to instability, by giving excessive weight to the velocity divergence in comparison to the pressure-stabilising term \(-\nabla \cdot (\rho ^{-1}\nabla p)\). Figure 8 shows how \(\alpha \) affects the divergence error and the density over- and undershoot at \(t=T\). The density results show hardly any difference, as previously indicated in Figure 7. The divergence error, on the other hand, reduces by \(34\%\) when we change \(\alpha \) from 0 to \(1.4\times 10^{-3}\). While sensitivity analysis is out of the present scope, a detailed study on how this parameter influences the accuracy of different quantities is found in our previous work for single-phase flows [37].

8 Concluding remarks

In this work, we have devised, implemented and thoroughly tested a consistent split-step framework for flows with non-constant density and viscosity. Most splitting schemes for multi-phase flows are based on pressure correction methods enforcing incompressibility via solenoidal projections. Those methods are very efficient but have well-known shortcomings, such as numerical boundary layers and/or spatial stability restrictions when using finite elements. Our method, on the other hand, is based on a consistent pressure-Poisson reformulation of the Navier–Stokes system, thereby avoiding those issues without incurring computational overhead. Moreover, the method is minimally invasive: it decomposes the variable-density Navier–Stokes system into simpler convection, diffusion and convection-diffusion problems, and the pressure Poisson step is consistent regardless of the technique—if any—applied to handle discontinuities. No spurious pressure boundary layers or finite element compatibility restrictions are induced.

As a matter of fact, consistent PPE-based schemes have recently been used in designing accurate, competitive solvers for challenging applications such as non-Newtonian flows, fluid–structure interaction and free-surface flows [30, 36, 50,51,52]. Of course, a consistent pressure Poisson equation has a more complex right-hand side than a Leray projection does, but our analytical efforts in Sects. 3 and 4 ensure that this complexity does not translate into an implementation overhead. Indeed, in the end we get a weak formulation with the exact same left-hand side as in classical projection methods [5], and a right-hand side allowing standard finite element spaces—mixed or equal-order. Although we have focused on finite element methods, our PPE-based system can be tackled within basically any other framework. It is also straightforward to consider generalised Newtonian fluids, since our equations already account for variable viscosity.

What our formulation does not improve on, with respect to projection methods, is the pressure operator. In both cases we have \(-\nabla \cdot (\rho ^{-1}\nabla p)\), which is not optimal in the presence of pressure discontinuities, as seen e.g. in surface tension models. In particular, piecewise constant finite element spaces are not allowed for the pressure, which is a recurring limitation in split-step methods. To overcome that, we are currently working on an ultra-weak reformulation of the problem, with promising results so far [53].