1 Introduction

In this paper, we consider numerically solving a hydrodynamic phase field model for binary fluid mixtures of two immiscible viscous fluids, derived using the generalized Onsager principle [37, 38, 46, 47]. The hydrodynamic model consists of the following coupled partial differential equations:

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho (\partial _t {\mathbf {v}}+ {\mathbf {v}}\cdot \nabla {\mathbf {v}}) = -\nabla p + \nabla \cdot (\sigma ^d + \sigma ^e ), \\ \nabla \cdot {\mathbf {v}}= 0,\\ \partial _t \phi + \nabla \cdot (\phi {\mathbf {v}}- \Gamma \nabla \mu ) = 0, \end{array}\right. } \end{aligned}$$
(1.1)

where we denote the mass averaged velocity as \({\mathbf {v}}\), the volume fraction of one fluid as \(\phi \), the hydrostatic pressure as p, \(\mu =\frac{\delta f}{\delta \phi }\) is the chemical potential, f is the free energy density function, \(\Gamma \) is the mobility coefficient that is a function of phase variable \(\phi \),

$$\begin{aligned} \sigma ^d = 2\eta {\mathbf {D}}, \end{aligned}$$
(1.2)

is the viscous stress tensor with viscosity \(\eta \), \({\mathbf {D}}= \frac{1}{2}(\nabla {\mathbf {v}}+\nabla {\mathbf {v}}^{T})\) is the rate of strain tensor, and

$$\begin{aligned} \sigma ^e_{\alpha \beta }= (f-\mu \phi )\delta _{\alpha \beta } - \frac{\partial f}{\partial (\partial _ \beta \phi )} \partial _\alpha \phi , \end{aligned}$$
(1.3)

is the Ericksen stress tensor.

This hydrodynamic phase field model satisfies an energy dissipation law:

$$\begin{aligned} \frac{d}{dt}\int _V\left[ \frac{\rho }{2}|\mathbf{v}|^2+f\right] d\mathbf{x}=-\int _{V}\left[ 2\eta \mathbf{D}:\mathbf{D}+\Gamma |\nabla \mu |^2\right] d\mathbf{x}, \end{aligned}$$
(1.4)

subject to the following boundary condition:

  • \(\mathbf{v}|_{\partial V}=\mathbf{0}, \mathbf{n}\cdot \nabla \phi |_{\partial V}=\mathbf{n}\cdot \nabla \mu = 0.\)

  • Or, the periodic boundary condition.

When developing numerical methods for such a model, one property that we would like to preserve is the energy dissipation property in the discrete approximation.

The numerical method that can preserve some structural properties of the model is called the geometric integrator or structure-preserving numerical method. There is no question that a structural preserving numerical scheme is a token of success in the numerical approximation. In numerical approximation of conservative, ordinary differential equations (ODEs), development of structure preserving schemes has achieved a remarkable success [14, 19], where various symplectic methods have been generalized for Hamiltonian partial differential equations (PDEs) to preserve the multi-symplectic conservation law [3, 44].

In recent years, there has been an increasing emphasis on constructing numerical methods for continuous dynamical systems to preserve certain invariant quantities of the continuous systems. A large number of works have been focused on the energy-preserving method to preserve the energy of the system. For example, Strauss and Vazquez developed such a method for the nonlinear Klein–Gordon equation [41], Delfour et al. [9] did it for the nonlinear Schrödinger equation, Huang [21] for the Korteweg-de Vries equation, Fei and Vazquez [13] for the sine-Gordon equation, and Hyman [22] for the Maxwell’s equations. In early 1990s, Li and Vu-Quoc [31] gave a survey of energy-preserving methods for PDEs and their applications, especially, to nonlinear stability. Later, Furihata [15] presented the discrete variational derivative methods for a large class of PDEs that inherit energy conservation or dissipation properties. Matsuo and Furihata [35] generalized the discrete variational derivative methods for complex valued nonlinear PDEs. Based on this method, they obtained a series of energy preserving schemes [16]. Recently, Dahlby and Owren [8] developed the concept of the discrete variational derivative and a general framework for deriving integral-preserving numerical methods for PDEs. In addition, Celledoni et al. [5] used the average vector field method to construct a systematic energy-preserving or energy dissipation method for a class of PDEs. Gong et al. [17] presented some new structure-preserving methods for multi-symplectic Hamiltonian PDEs. It is worth pointing out that the works along this line have been primarily concerned with a scalar PDE system.

In the meantime, Shen and Yang have developed a series of semi-discrete, linear energy stable numerical schemes for incompressible Navier–Stokes (NS) equation and multiphase fluid flows governed by the NS equation together with an Allen–Cahn equation [40]. In these schemes, the time derivatives are discretized using finite difference methods aided by a stablizer. This work has recently been extended to a host of complex fluid flows with one of the authors involved, including liquid crystal flows [4850]. In these numerical approximations of the hydrodynamic models, the spatial discretization is followed by a finite difference method. In some cases, linear and decoupled schemes are obtained [4850].

We note that the hydrodynamic models governing viscous fluid and complex fluids flows can be derived using the generalized Onsager principle, which warrants the variational structure and the total energy dissipation. So, if we can develop a systematic strategy to discretize the governing partial differential equations in the hydrodynamic models firstly in space to preserve the total energy dissipation structure and secondly in time to retain the energy dissipation property, we would end up with a fully discretized numerical scheme that respect the total energy dissipation. This strategy follows the idea alluded to early for Hamiltonian systems of scalar PDEs.

In this paper, we will articulate the systematic approach using the hydrodynamic phase field model for a binary viscous fluid mixture. It would be the first one applied to hydrodynamic models of incompressible complex fluids flows. The numerical scheme thus developed is known as the energy stable method (ESM). In the hydrodynamic phase field model, the fully discretized scheme obtained this way often yields a system of nonlinear algebraic equations. Iterative methods are then employed to arrive at a solution, in which FFT is employed to speed up the computation on linear differential operators in the equations.

When developing numerical methods for solving dissipative hydrodynamic system of equations, one major challenge is how to efficiently handle the high-order spatial derivatives coupled with nonlinear terms. When an explicit scheme is applied to solve such a system, the time step relies heavily on the stiffness of the reaction terms and numerical treatment of the high-order spatial derivatives. On the other hand, implicit schemes, like the Crank–Nicolson method, can be employed to remove the stability constraints on time steps. However, it usually requires solving a large coupled system of nonlinear equations for each time step, like we do for the fully discretized energy stable scheme.

Alternatively, integrating factor (IF) or exponential differencing time (ETD) methods can serve as an effective approach to deal with temporal stability constraints associated with high-order spatial derivatives and nonlinear reactive terms [7, 27, 28]. By treating the highest order spatial derivatives exactly in time integration, the IF or ETD methods can provide excellent temporal stability with desired accuracy for reaction-diffusion equations and Cahn-Hilliard equations with constant diffusivity or mobility coefficients [10, 11, 27, 29].

In the IF method, the dominant computational cost comes from storage and calculation of exponentials of matrices resulted from discretizing the spatial derivatives. To resolve this issue in high dimension in space, compact representation of the discretized matrices can be introduced in the context of the implicit integrating factor (IIF) method [36]. In the compact implicit integrating factor (cIIF) method in high dimension in space, the discretized matrix for each spatial direction has the same size as the classic IIF in one dimension. In addition, the cIIF method is robust when implemented and can be combined with other spatial and temporal discretization schemes at least for reaction-diffusion systems with a constant diffusivity. For example, it can handle general curvilinear coordinates and the bi-Laplacian operator with various boundary conditions as well as combining with adaptive mesh refinement in a straightforward way [25, 32]. One can also apply the cIIF method to stiff reaction and diffusion equations coupled with other specialized hyperbolic solvers (e.g. the WENO method [24, 33]) for convective terms to solve reaction-diffusion-convection equations efficiently [51]. For the system with nonlinear high order derivatives and/or with unstructured meshes, the exponential matrix-vector multiplication can be calculated using the Krylov subspace method to save storage space and to reduce the computational cost [6]. To better deal with high dimension in space, the array compact implicit integrating factor (AcIIF) method has been introduced [43] and sparse grid technique incorporated into the integrating factor method [42].

The IF method was designed and tested primarily for reaction-diffusion equations in previous studies. In this paper, we extend the IF method to solve the dissipative hydrodynamic equation system for incompressible fluid mixture flows (1.1) with more complex mathematical structures. We apply the IF strategy after we have discretized the system in space into a large differential and algebraic equation (DAE) system, which respects the total energy dissipation. In this approach, all the linear high-order spatial derivatives are explicitly handled. The discretized matrix arising from a compact representation with standard second order differences is circular and thus can be diagonalized so that the computational cost can be dramatically reduced through the use of discrete Fourier transform (DFT) [26, 45]. We will compare the IF method with ESM in two examples to show the efficiency of the IF and its numerical stability and energy dissipation property.

Compared with the semi-discrete linear ESM developed previously for a similar system [49], the fully discretized ESM developed here is more accurate in preserving the energy dissipation rate. As a trade-off, it is more costly when computed due to the unpredictability in nonlinear iterations. Whereas, IF method perhaps renders a comparable numerical efficiency.

The rest of paper is organized as follows. In Sect. 2, two different free energy functions are introduced and the associated total energy is defined with which the energy dissipation law is established. In Sect. 3, the system of equations is discretized in space preserving the discrete energy dissipation law in the semi-discretized form. Next, two different temporal discretized schemes with good stability properties are discussed in Sect. 4. In Sect. 5, two numerical examples are presented to illustrate the efficiency and accuracy of the proposed methods. Finally, we give a concluding remark.

2 Hydrodynamic Phase Field Model and Energy Dissipation

The free energy density of the binary viscous fluid system (1.1) is given by a functional of phase variable \(\phi \) and its gradient. For instance, to study drops of one fluid within the matrix of the other, the free energy is usually chosen as the following double-well potential:

$$\begin{aligned} f = \gamma \Big ( \frac{\varepsilon }{2} |\nabla \phi |^{2}+\frac{1}{\varepsilon } \phi ^2(1-\phi )^2 \Big ), \end{aligned}$$
(2.1)

where \(\gamma \) is a surface tension coefficient. If we study mixing dynamics of two miscible polymeric fluids, the extended Flory-Huggins free energy would be adopted:

$$\begin{aligned} f = \gamma _1 |\nabla \phi |^{2}+\gamma _2\left( \frac{\phi }{N_1}ln \phi +\frac{1-\phi }{N_2}ln (1-\phi )+\chi \phi (1-\phi )\right) , \end{aligned}$$
(2.2)

where \(N_1\) and \(N_2\) are the polymerization index of polymer 1 and 2, respectively, \(\chi \) is the mixing parameter, \(\gamma _1\) is the strength of the conformational entropy and \(\gamma _2\) is the strength of the bulk mixing energy. The two free energy densities can be written in a generic form:

$$\begin{aligned} f = c|\nabla \phi |^{2}+g(\phi ), \end{aligned}$$

where c is a parameter and g is a function of \(\phi \).

System (1.1) can be written equivalently to the following form due to \(\nabla \cdot \mathbf{v}=0\):

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho \Big (\partial _t {\mathbf {v}}+ \frac{1}{2}\big ({\mathbf {v}}\cdot \nabla {\mathbf {v}}+\nabla \cdot ({\mathbf {v}}{\mathbf {v}})\big )\Big ) = -\nabla p + \eta \Delta {\mathbf {v}}-\phi \nabla \mu , \\ \nabla \cdot {\mathbf {v}}= 0,\\ \partial _t \phi + \nabla \cdot (\phi {\mathbf {v}}- \Gamma \nabla \mu ) = 0, \end{array}\right. } \end{aligned}$$
(2.3)

where \(\mu = g'(\phi )-2c\Delta \phi \). For simplicity, we adopt the periodic boundary condition in this study. The effect of various boundary conditions on the numerical scheme warrants a completely new consideration and treatment.

We define the inner product \((\cdot ,\cdot )\) and norm \(\Vert \cdot \Vert \) for matrix functions as follows:

$$\begin{aligned} ({\mathbf {F}},{\mathbf {G}}) = \sum _{m}\sum _{n}\int _{V} {\mathbf {F}}_{m,n}{\mathbf {G}}_{m,n}d{\mathbf {x}},~~\Vert {\mathbf {F}}\Vert = ({\mathbf {F}},{\mathbf {F}})^{1/2}, \end{aligned}$$
(2.4)

where V is the domain that the binary fluid occupies, \(\mathbf{F}\) and \(\mathbf G\) are matrix functions or 2nd order tensor functions defined in V. With the periodic boundary conditions, we have the following integration-by-parts formulae:

$$\begin{aligned}&(f,\partial _{\alpha }g)+(\partial _{\alpha }f,g) = 0,~\alpha = x~\hbox {or}~y,\end{aligned}$$
(2.5)
$$\begin{aligned}&(f,\nabla \cdot {\mathbf {v}})+(\nabla f,{\mathbf {v}})=0, \end{aligned}$$
(2.6)

and

$$\begin{aligned} ({\mathbf {v}},\nabla \cdot \mathbf{F})+(\nabla {\mathbf {v}},\mathbf{F})=0. \end{aligned}$$
(2.7)

By a simple calculation, it is readily to show that

$$\begin{aligned} ({\mathbf {u}}, {\mathbf {v}}\cdot \mathbf{F} ) = ({\mathbf {u}}{\mathbf {v}}, \mathbf{F}), \end{aligned}$$
(2.8)

where \(\mathbf u\) is a vector-valued function defined in V.

Theorem 2.1

With periodic boundary conditions, system (2.3) satisfies the following energy identity

$$\begin{aligned} \frac{d E}{dt} + \eta \Vert \nabla {\mathbf {v}}\Vert ^{2}+(\Gamma \nabla \mu ,\nabla \mu ) = 0, \end{aligned}$$
(2.9)

where E is the total energy of system (2.3) defined by

$$\begin{aligned} E = \frac{\rho }{2}\Vert {\mathbf {v}}\Vert ^{2}+c\Vert \nabla \phi \Vert ^{2} +(g(\phi ),1). \end{aligned}$$
(2.10)

Proof

The proof is straightforward and is thus omitted. \(\square \)

Remark 2.1

The theorem also holds for the following boundary conditions in a rectangular domain \(V=[0, L_x]\times [0,L_y]\):

$$\begin{aligned} {\mathbf {v}}|_{0, L_y}=0,~~\mathbf{n}\cdot \nabla \phi |_{0, L_y}=0,~~\mathbf{n}\cdot \nabla \mu |_{0, L_y}=0, \end{aligned}$$
(2.11)

and the periodic boundary condition in the x direction. Throughout this paper, the results are proved with periodic boundary conditions; but they are valid equally well with the above physical boundary conditions.

3 Structure Preserving Spatial Discretization

In this section, we devise three spatial, semi-discrete, finite difference methods for the two-dimensional hydrodynamic system (2.3) with periodic boundary conditions in a rectangular domain \(V=[0, L_x]\times [0,L_y]\). These schemes preserve a semi-discrete energy dissipation law.

Let \(N_{x},N_{y}\) be two positive integers. The domain \(V=[0, L_x]\times [0,L_y]\) is uniformly partitioned with mesh size \(h_x = L_{x}/N_{x},~h_y = L_{y}/N_{y}\) and

$$\begin{aligned} V_{h} = \left\{ (x_{j},y_{k})|x_{j} = jh_x,~y_{k} = kh_y,~0\le j\le N_{x},0\le k\le N_{y}\right\} . \end{aligned}$$

To approximate the periodic boundary conditions, let \(x_{-1} = -h_x\), \(y_{-1} = -h_y\). A grid function \(f = \left\{ f_{j,k}|-1\le j \le N_{x}, -1\le k \le N_{y}\right\} \) is called periodic if

$$\begin{aligned} (x\hbox {-periodic})~f_{-1,k} = f_{N_{x}-1,k},~f_{0,k} = f_{N_{x},k};~(y\hbox {-periodic})~f_{j,-1} = f_{j,N_{y}-1},~f_{j,0} = f_{j,N_{y}}. \end{aligned}$$

For convenience, we define the following discrete difference operators,

$$\begin{aligned}&\delta _{x}^{+}f_{j,k} = \frac{f_{j+1,k}-f_{j,k}}{h_x},~~\delta _{x}^{-}f_{j,k} = \frac{f_{j,k}-f_{j-1,k}}{h_x},~~\delta _{{\overline{x}}}f_{j,k} = \frac{\delta _{x}^{+}+\delta _{x}^{-}}{2}f_{j,k},\\&\delta _{y}^{+}f_{j,k} = \frac{f_{j,k+1}-f_{j,k}}{h_y},~~\delta _{y}^{-}f_{j,k} = \frac{f_{j,k}-f_{j,k-1}}{h_y},~~\delta _{{\overline{y}}}f_{j,k} = \frac{\delta _{y}^{+}+\delta _{y}^{-}}{2}f_{j,k},\\&\nabla _{h}^{+} = \left( \begin{array}{c} \delta _{x}^{+} \\ \delta _{y}^{+} \\ \end{array}\right) ,~~\nabla _{h}^{-} = \left( \begin{array}{c} \delta _{x}^{-} \\ \delta _{y}^{-} \\ \end{array}\right) ,~~{\overline{\nabla }}_{h} = \frac{\nabla _{h}^{+}+\nabla _{h}^{-}}{2},~~\Delta _{h} = \delta _{x}^{+}\delta _{x}^{-}+\delta _{y}^{+}\delta _{y}^{-}. \end{aligned}$$

The discrete inner product and norm are defined respectively as follows

$$\begin{aligned} (\mathbf{F},\mathbf{G})_{h} = \sum _{m,n}\sum \limits _{j = 0}^{N_{x}-1}\sum \limits _{k = 0}^{N_{y}-1} (\mathbf{F}_{m,n})_{j,k}(\mathbf{G}_{m,n})_{j,k}h_x h_y ,~~\Vert \mathbf{F}\Vert _{h} = (\mathbf{F},\mathbf{F})_{h}^{1/2}. \end{aligned}$$

The following summation-by-parts formulas are analogous to the integration-by-parts formulas (2.5)–(2.7)

$$\begin{aligned}&(f,\delta _{\alpha }^{-}g)_{h}+(\delta _{\alpha }^{+}f,g)_{h} = 0, \end{aligned}$$
(3.1)
$$\begin{aligned}&(f,\delta _{{\overline{\alpha }}}g)_{h}+(\delta _{{\overline{\alpha }}}f,g)_{h} = 0,\end{aligned}$$
(3.2)
$$\begin{aligned}&(f,\nabla _{h}^{-}\cdot {\mathbf {v}})_{h}+(\nabla _{h}^{+} f,{\mathbf {v}})_{h}=0,\end{aligned}$$
(3.3)
$$\begin{aligned}&(f,\nabla _{h}^{+}\cdot {\mathbf {v}})_{h}+(\nabla _{h}^{-} f,{\mathbf {v}})_{h}=0,\end{aligned}$$
(3.4)
$$\begin{aligned}&(f,{\overline{\nabla }}_{h}\cdot {\mathbf {v}})_{h}+({\overline{\nabla }}_{h} f,{\mathbf {v}})_{h}=0,\end{aligned}$$
(3.5)
$$\begin{aligned}&({\mathbf {v}},\nabla _{h}^{+}\cdot \mathbf{F})_{h}+(\nabla _{h}^{-}{\mathbf {v}},\mathbf{F})_{h}=0,\end{aligned}$$
(3.6)
$$\begin{aligned}&({\mathbf {v}},\nabla _{h}^{-}\cdot \mathbf{F})_{h}+(\nabla _{h}^{+}{\mathbf {v}},\mathbf{F})_{h}=0,\end{aligned}$$
(3.7)
$$\begin{aligned}&({\mathbf {v}},{\overline{\nabla }}_{h}\cdot \mathbf{F})_{h}+({\overline{\nabla }}_{h}{\mathbf {v}},\mathbf{F})_{h}=0, \end{aligned}$$
(3.8)

where \(\alpha =x~\hbox {or}~y\). In addition, we have

$$\begin{aligned} ({\mathbf {u}}, {\mathbf {v}}\cdot \mathbf{F} )_{h} = ({\mathbf {u}}{\mathbf {v}}, \mathbf{F})_{h}. \end{aligned}$$
(3.9)

Next, we devise three semi-discrete schemes for system (2.3).

Scheme I:

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho \Big (\frac{d}{dt} {\mathbf {v}}_{j,k} + \frac{1}{2}\big ({\mathbf {v}}_{j,k} \cdot \nabla _{h}^{+} {\mathbf {v}}_{j,k} +\nabla _{h}^{-} \cdot ({\mathbf {v}}_{j,k}{\mathbf {v}}_{j,k})\big )\Big ) {=} -\nabla _{h}^{+} p_{j,k} + \eta \Delta _{h} {\mathbf {v}}_{j,k} -\phi _{j,k} \nabla _{h}^{+} \mu _{j,k}, \\ \nabla _{h}^{-} \cdot {\mathbf {v}}_{j,k} {=} 0,\\ \frac{d}{dt} \phi _{j,k} + \nabla _{h}^{-} \cdot (\phi _{j,k}{\mathbf {v}}_{j,k}) - \nabla _{h}^{-} \cdot ( \Gamma _{j,k} \nabla _{h}^{+} \mu _{j,k}) = 0. \end{array}\right. } \end{aligned}$$
(3.10)

Scheme II:

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho \Big (\frac{d}{dt} {\mathbf {v}}_{j,k} + \frac{1}{2}\big ({\mathbf {v}}_{j,k} \cdot \nabla _{h}^{-} {\mathbf {v}}_{j,k}+\nabla _{h}^{+} \cdot ({\mathbf {v}}_{j,k}{\mathbf {v}}_{j,k})\big )\Big ) = -\nabla _{h}^{-} p_{j,k} + \eta \Delta _{h} {\mathbf {v}}_{j,k} -\phi _{j,k} \nabla _{h}^{-} \mu _{j,k}, \\ \nabla _{h}^{+} \cdot {\mathbf {v}}_{j,k} {=} 0,\\ \frac{d}{dt} \phi _{j,k} + \nabla _{h}^{+} \cdot (\phi _{j,k}{\mathbf {v}}_{j,k}) - \nabla _{h}^{-} \cdot ( \Gamma _{j,k} \nabla _{h}^{+} \mu _{j,k}) = 0. \end{array}\right. } \end{aligned}$$
(3.11)

Scheme III:

$$\begin{aligned} {\left\{ \begin{array}{ll} \rho \Big (\frac{d}{dt} {\mathbf {v}}_{j,k} + \frac{1}{2}\big ({\mathbf {v}}_{j,k} \cdot {\overline{\nabla }}_{h} {\mathbf {v}}_{j,k}+{\overline{\nabla }}_{h} \cdot ({\mathbf {v}}_{j,k}{\mathbf {v}}_{j,k})\big )\Big ) {=} -{\overline{\nabla }}_{h} p_{j,k} + \eta \Delta _{h} {\mathbf {v}}_{j,k} -\phi _{j,k} {\overline{\nabla }}_{h} \mu _{j,k}, \\ {\overline{\nabla }}_{h} \cdot {\mathbf {v}}_{j,k} = 0,\\ \frac{d}{dt} \phi _{j,k} + {\overline{\nabla }}_{h} \cdot (\phi _{j,k}{\mathbf {v}}_{j,k}) - \nabla _{h}^{-}\cdot (\Gamma _{j,k} \nabla _{h}^{+} \mu _{j,k}) = 0. \end{array}\right. } \end{aligned}$$
(3.12)

For all the above schemes, \(\mu _{j,k} = g'(\phi _{j,k})-2c\Delta _{h} \phi _{j,k}\) and \(j = 0,1,\ldots ,N_{x}-1\), \(k = 0,1,\ldots ,N_{y}-1\).

Theorem 3.1

All schemes \(I-III\) preserve the same discrete energy identity

$$\begin{aligned} \frac{d E_{h}}{dt} + \eta \Vert \nabla _{h}^{+}{\mathbf {v}}\Vert _{h}^{2}+(\Gamma \nabla _{h}^{+}\mu ,\nabla _{h}^{+}\mu )_{h} = 0, \end{aligned}$$
(3.13)

where \(E_{h}\) is the discrete energy functional defined as

$$\begin{aligned} E_{h} = \frac{\rho }{2}\Vert {\mathbf {v}}\Vert _{h}^{2}+c\Vert \nabla _{h}^{+}\phi \Vert _{h}^{2} +(g(\phi ),1)_{h}. \end{aligned}$$

Proof

Here we take Scheme I as an example to show the discrete energy identity (3.13). The proof for the other two cases are analogous.

From (3.7) and (3.9), we have

$$\begin{aligned} \big ({\mathbf {v}},{\mathbf {v}}\cdot \nabla _{h}^{+} {\mathbf {v}}+\nabla _{h}^{-} \cdot ({\mathbf {v}}{\mathbf {v}})\big )_{h} = ({\mathbf {v}}{\mathbf {v}},\nabla _{h}^{+} {\mathbf {v}})_{h}+\big ({\mathbf {v}},\nabla _{h}^{-}\cdot ({\mathbf {v}}{\mathbf {v}})\big )_{h} = 0, \end{aligned}$$
(3.14)

and

$$\begin{aligned} ({\mathbf {v}},\Delta _{h}{\mathbf {v}})_{h} = ({\mathbf {v}},\nabla _{h}^{-}\cdot \nabla _{h}^{+}{\mathbf {v}})_{h} = -\Vert \nabla _{h}^{+}{\mathbf {v}}\Vert _{h}^{2}. \end{aligned}$$
(3.15)

By a straightforward calculation, we obtain

$$\begin{aligned} \frac{d E_{h}}{dt}= & {} \rho ({\mathbf {v}}_{t},{\mathbf {v}})_{h}+2c(\nabla _{h}^{+}\phi _{t},\nabla _{h}^{+}\phi )_{h} +(\phi _{t},g'(\phi ))_{h}\\= & {} \rho ({\mathbf {v}}_{t},{\mathbf {v}})_{h}-2c(\phi _{t},\Delta _{h}\phi )_{h} +(\phi _{t},g'(\phi ))_{h}\\= & {} \rho ({\mathbf {v}}_{t},{\mathbf {v}})_{h} +(\phi _{t},\mu )_{h}\\= & {} -(\nabla _{h}^{+} p,{\mathbf {v}})_{h}+\eta (\Delta _{h} {\mathbf {v}},{\mathbf {v}})_{h}-(\phi \nabla _{h}^{+}\mu ,{\mathbf {v}})_{h} +(\nabla _{h}^{-} \cdot (\Gamma \nabla _{h}^{+} \mu ),\mu )_{h}-(\nabla _{h}^{-} \cdot (\phi {\mathbf {v}}),\mu )_{h}\\= & {} (p,\nabla _{h}^{-}\cdot {\mathbf {v}})_{h}-\eta \Vert \nabla _{h}^{+}{\mathbf {v}}\Vert _{h}^{2}-(\nabla _{h}^{+}\mu ,\phi {\mathbf {v}})_{h} -(\Gamma \nabla _{h}^{+}\mu ,\nabla _{h}^{+}\mu )_{h}-(\nabla _{h}^{-} \cdot (\phi {\mathbf {v}}),\mu )_{h}\\= & {} -\eta \Vert \nabla _{h}^{+}{\mathbf {v}}\Vert _{h}^{2}-(\Gamma \nabla _{h}^{+}\mu ,\nabla _{h}^{+}\mu )_{h}, \end{aligned}$$

which directly leads to (3.13). \(\square \)

Remark 3.1

Theorem 3.1 implies that the discrete energy of all the schemes are dissipative in time. Note that both Scheme I and II are first order, while Scheme III is second order in space. In the following, we will focus on the second order scheme, so only Scheme III is considered in the next section.

4 Time-Discretization Methods

In this section, we introduce two temporal schemes with nice stability properties for Scheme III to arrive at fully discretized schemes. One is the Crank–Nicolson method, which preserves the energy dissipation law at the fully discrete level, and the other is the integrating factor (IF) method, which can not be proven to preserve energy dissipation theoretically for the time being. But, we show numerically it does. For the sake of simplicity, we set \(\rho = 1\) and \(\Gamma \) a constant in the following discussion.

4.1 Crank–Nicolson Method

For a positive integer \(N_{t}\), we define time-step \(\Delta t = T/N_{t},~t_{n} = n\Delta t,~0\le n\le N_{t}\). We denote

$$\begin{aligned} \delta _{t}^{+}f^{n} = \frac{f^{n+1}-f^{n}}{\Delta t},~~f^{n+1/2} = \frac{f^{n+1}+f^{n}}{2}. \end{aligned}$$

Applying the Crank–Nicolson method in time to system (3.12), we obtain

$$\begin{aligned} {\left\{ \begin{array}{ll} \delta _{t}^{+} {\mathbf {v}}_{j,k}^{n} + \frac{1}{2}\big ({\mathbf {v}}_{j,k}^{n+1/2} \cdot {\overline{\nabla }}_{h} {\mathbf {v}}_{j,k}^{n+1/2} +{\overline{\nabla }}_{h} \cdot ({\mathbf {v}}_{j,k}^{n+1/2}{\mathbf {v}}_{j,k}^{n+1/2})\big ) {=} -{\overline{\nabla }}_{h} p_{j,k}^{n+1/2} + \eta \Delta _{h} {\mathbf {v}}_{j,k}^{n+1/2}\\ \quad {-}\,\phi _{j,k}^{n+1/2} {\overline{\nabla }}_{h} \mu _{j,k}^{n,n+1}, \\ {\overline{\nabla }}_{h} \cdot {\mathbf {v}}_{j,k}^{n} = 0,\\ \delta _{t}^{+} \phi _{j,k}^{n} + {\overline{\nabla }}_{h} \cdot (\phi _{j,k}^{n+1/2}{\mathbf {v}}_{j,k}^{n+1/2}) -\Gamma \Delta _{h}\mu _{j,k}^{n,n+1} = 0, \end{array}\right. } \end{aligned}$$
(4.1)

where

$$\begin{aligned} \mu _{j,k}^{n,n+1} = {\left\{ \begin{array}{ll} \frac{g(\phi _{j,k}^{n+1})\,-\,\,g(\phi _{j,k}^{n})}{\phi _{j,k}^{n+1}\,-\,\,\phi _{j,k}^{n}}-2c\Delta _{h}\phi _{j,k}^{n+1/2}, &{}\hbox {if}~\phi _{j,k}^{n+1}\ne \phi _{j,k}^{n},\\ g'(\phi _{j,k}^{n})-2c\Delta _{h}\phi _{j,k}^{n+1/2},~&{}\hbox {if}~\phi _{j,k}^{n+1}= \phi _{j,k}^{n}. \end{array}\right. } \end{aligned}$$

When g is a polynomial of \(\phi \), \(\mu _{j,k}^{n,n+1}\) can be simplified. In particular, for the drop problem to be simulated in this study, we have

$$\begin{aligned} \mu _{j,k}^{n,n+1} = \frac{\gamma }{\varepsilon }\big (\phi _{j,k}^{n}(1-\phi _{j,k}^{n}) +\phi _{j,k}^{n+1}(1-\phi _{j,k}^{n+1})\big )(1-\phi _{j,k}^{n}-\phi _{j,k}^{n+1})-\gamma \varepsilon \Delta _{h}\phi _{j,k}^{n+1/2}. \end{aligned}$$

Theorem 4.1

The fully discretized scheme (4.1) preserves the discrete energy identity

$$\begin{aligned} \frac{E_{h}^{n+1}-E_{h}^{n}}{\Delta t} + \eta \Vert \nabla _{h}^{+}{\mathbf {v}}^{n+1/2}\Vert _{h}^{2}+\Gamma \Vert \nabla _{h}^{+}\mu ^{n,n+1}\Vert _{h}^{2} = 0, \end{aligned}$$
(4.2)

where

$$\begin{aligned} E_{h}^{n} = \frac{1}{2}\Vert {\mathbf {v}}^{n}\Vert _{h}^{2}+c\Vert \nabla _{h}^{+}\phi ^{n}\Vert _{h}^{2} +(g(\phi ^{n}),1)_{h}. \end{aligned}$$
(4.3)

Proof

Analogous to the proof of Theorem 3.1, we have

$$\begin{aligned} \big ({\mathbf {v}}^{n+1/2},{\mathbf {v}}^{n+1/2} \cdot {\overline{\nabla }}_{h} {\mathbf {v}}^{n+1/2}+{\overline{\nabla }}_{h} \cdot ({\mathbf {v}}^{n+1/2}{\mathbf {v}}^{n+1/2})\big )_{h} = 0, \end{aligned}$$
(4.4)

and

$$\begin{aligned} ({\mathbf {v}}^{n+1/2},\Delta _{h}{\mathbf {v}}^{n+1/2})_{h} = -\Vert \nabla _{h}^{+}{\mathbf {v}}^{n+1/2}\Vert _{h}^{2}. \end{aligned}$$
(4.5)

Using (3.5), (4.1), (4.4), (4.5) and the following identity

$$\begin{aligned} \delta _{t}^{+}({\mathbf {u}}^{n}\cdot {\mathbf {v}}^{n}) = \delta _{t}^{+}{\mathbf {u}}^{n}\cdot {\mathbf {v}}^{n+1/2}+{\mathbf {u}}^{n+1/2}\cdot \delta _{t}^{+}{\mathbf {v}}^{n}, \end{aligned}$$

we obtain

$$\begin{aligned}&\frac{E_{h}^{n+1}-E_{h}^{n}}{\Delta t}\\&\quad = (\delta _{t}^{+}{\mathbf {v}}^{n},{\mathbf {v}}^{n+1/2})_{h}+2c(\nabla _{h}^{+}\delta _{t}^{+}\phi ^{n},\nabla _{h}^{+}\phi ^{n+1/2})_{h} +\left( \delta _{t}^{+}\phi ^{n}, \frac{g(\phi ^{n+1})-g(\phi ^{n})}{\phi ^{n+1}-\phi ^{n}}\right) _{h}\\&\quad = (\delta _{t}^{+}{\mathbf {v}}^{n},{\mathbf {v}}^{n+1/2})_{h}-2c(\delta _{t}^{+}\phi ^{n},\Delta _{h}\phi ^{n+1/2})_{h}+\left( \delta _{t}^{+}\phi ^{n}, \frac{g(\phi ^{n+1})-g(\phi ^{n})}{\phi ^{n+1}-\phi ^{n}}\right) _{h}\\&\quad = (\delta _{t}^{+}{\mathbf {v}}^{n},{\mathbf {v}}^{n+1/2})_{h}+(\delta _{t}^{+}\phi ^{n},\mu ^{n,n+1})_{h}\\&\quad = -\,({\overline{\nabla }}_{h} p^{n+1/2},{\mathbf {v}}^{n+1/2})_{h}+\eta (\Delta _{h} {\mathbf {v}}^{n+1/2},{\mathbf {v}}^{n+1/2})_{h} -(\phi ^{n+1/2}{\overline{\nabla }}_{h}\mu ^{n,n+1},{\mathbf {v}}^{n+1/2})_{h}\\&\qquad +\,\Gamma ( \Delta _{h}\mu ^{n,n+1},\mu ^{n,n+1})_{h}-({\overline{\nabla }}_{h} \cdot (\phi ^{n+1/2}{\mathbf {v}}^{n+1/2}),\mu ^{n,n+1})_{h}\\&\quad = (p^{n+1/2},{\overline{\nabla }}_{h}\cdot {\mathbf {v}}^{n+1/2})_{h} -\eta \Vert \nabla _{h}^{+}{\mathbf {v}}^{n+1/2}\Vert _{h}^{2} -({\overline{\nabla }}_{h}\mu ^{n,n+1},\phi ^{n+1/2}{\mathbf {v}}^{n+1/2})_{h}\\&\qquad -\,\Gamma \Vert \nabla _{h}^{+}\mu ^{n,n+1}\Vert _{h}-({\overline{\nabla }}_{h} \cdot (\phi ^{n+1/2}{\mathbf {v}}^{n+1/2}),\mu ^{n,n+1})_{h}\\&\quad = -\eta \Vert \nabla _{h}^{+}{\mathbf {v}}^{n+1/2}\Vert _{h}^{2}-\Gamma \Vert \nabla _{h}^{+}\mu ^{n,n+1}\Vert _{h}. \end{aligned}$$

This completes the proof. \(\square \)

This fully discretized system is a nonlinear algebraic system. We will solve it using an iterative method. We will come back to the detail when we discuss the two numerical examples in the next section.

Remark 4.1

Comparing the fully discretized scheme developed here with the semi-discretized scheme developed in [49] after an analogous spatial discretization, the current scheme yields the energy dissipation rate exactly while the previous scheme gives an energy inequality with a modified energy. This discrepancy is due to the stabilizer added in the other scheme.

4.2 Compact Explicit Integrating Factor Method

To present the integrating factor method, here we use the drop problem as an example. The integrating factor method for solving other problems can be similarly derived. The semi-discrete system (3.12) in two-dimensional space can be written as

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{d}{dt} {v_{1_{j,k}}} = -\delta _{{\overline{x}}}p_{j,k}+\eta \Delta _{h} {v_{1_{j,k}}}-{g_{1_{j,k}}},\\ \frac{d}{dt} {v_{2_{j,k}}} = -\delta _{{\overline{y}}}p_{j,k}+\eta \Delta _{h} {v_{2_{j,k}}}-{g_{2_{j,k}}},\\ \delta _{{\overline{x}}}{v_{1_{j,k}}}+\delta _{{\overline{y}}}{v_{2_{j,k}}} = 0,\\ \frac{d}{dt} \phi _{j,k} = \frac{2\gamma \Gamma }{\varepsilon }\Delta _{h} \phi _{j,k}-\gamma \varepsilon \Gamma \Delta _{h}^{2} \phi _{j,k}-{g_{3_{j,k}}}, \end{array}\right. } \end{aligned}$$
(4.6)

where

$$\begin{aligned} {g_{1_{j,k}}}= & {} \frac{1}{2}\left[ {v_{1_{j,k}}}\delta _{{\overline{x}}}{v_{1_{j,k}}}+{v_{2_{j,k}}}\delta _{{\overline{y}}}{v_{1_{j,k}}} +\delta _{{\overline{x}}}v_{1_{j,k}}^{2}+\delta _{{\overline{y}}}({v_{1_{j,k}}}{v_{2_{j,k}}})\right] +\phi _{j,k}\delta _{{\overline{x}}}\mu _{j,k},\\ {g_{2_{j,k}}}= & {} \frac{1}{2}\left[ {v_{1_{j,k}}}\delta _{{\overline{x}}}{v_{2_{j,k}}}+{v_{2_{j,k}}}\delta _{{\overline{y}}}{v_{2_{j,k}}} +\delta _{{\overline{x}}}({v_{1_{j,k}}}{v_{2_{j,k}}})+\delta _{{\overline{y}}}v_{2_{j,k}}^{2}\right] +\phi _{j,k}\delta _{{\overline{y}}}\mu _{j,k},\\ {g_{3_{j,k}}}= & {} \frac{2\gamma \Gamma }{\varepsilon }\Delta _{h}\big (3\phi _{j,k}^{2}-2\phi _{j,k}^{3}\big ) +{\overline{\nabla }}_{h} \cdot (\phi _{j,k}{\mathbf {v}}_{j,k}),\\ \mu _{j,k}= & {} \frac{2\gamma }{\varepsilon }(\phi _{j,k}-3\phi _{j,k}^{2}+2\phi _{j,k}^{3})-\gamma \varepsilon \Delta _{h} \phi _{j,k},~{\mathbf {v}}= (v_{1},v_{2})^{T}. \end{aligned}$$

By combining the first three equations in (4.6), we obtain the following equivalent system

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{d}{dt} {v_{1_{j,k}}} = -\delta _{{\overline{x}}}p_{j,k}+\eta \Delta _{h} {v_{1_{j,k}}}-{g_{1_{j,k}}},\\ \frac{d}{dt} {v_{2_{j,k}}} = -\delta _{{\overline{y}}}p_{j,k}+\eta \Delta _{h} {v_{2_{j,k}}}-{g_{2_{j,k}}},\\ \delta _{{\overline{x}}}^{2}p_{j,k}+\delta _{{\overline{y}}}^{2}p_{j,k} = -\delta _{{\overline{x}}}{g_{1_{j,k}}}-\delta _{{\overline{y}}}{g_{2_{j,k}}},\\ \frac{d}{dt} \phi _{j,k} = \frac{2\gamma \Gamma }{\varepsilon }\Delta _{h} \phi _{j,k}-\gamma \varepsilon \Gamma \Delta _{h}^{2} \phi _{j,k}-{g_{3_{j,k}}}. \end{array}\right. } \end{aligned}$$
(4.7)

To derive the integrating factor method for system (4.7), we define a matrix of the following form

$$\begin{aligned} {\mathbf {A}}= \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} a_{0} &{} a_{1} &{} \cdots &{} a_{n-1} \\ a_{n-1} &{} a_{0} &{} \cdots &{} a_{n-2} \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ a_{1} &{} a_{2} &{} \cdots &{} a_{0} \\ \end{array}\right) . \end{aligned}$$

Such a matrix is called a circulant matrix [18]. Because the whole matrix \({\mathbf {A}}\) is determined by the entries in the first row only, the matrix can be denoted as

$$\begin{aligned} {\mathbf {A}}= C(a_{0},a_{1},\ldots ,a_{n-1}). \end{aligned}$$

Lemma 4.1

([18]). For a real circulant matrix \({\mathbf {A}}= C(a_{0},a_{1},\ldots ,a_{n-1})\), all eigenvalues of \({\mathbf {A}}\) are given by

$$\begin{aligned} f(\varepsilon _{k}),~~k = 0,1,\ldots ,n-1, \end{aligned}$$

where \(f(x) = a_{0}+a_{1}x+a_{2}x^{2}+\cdots +a_{n-1}x^{n-1}\) and \(\varepsilon _{k} = e^{i\frac{2k\pi }{n}}\).

In addition, \({\mathbf {A}}\) is diagonalizable:

$$\begin{aligned} {\mathbf {A}}= {\mathbf {F}}_{n}^{-1}\cdot \varvec{\Lambda } \cdot {\mathbf {F}}_{n}, \end{aligned}$$
(4.8)

where \({\mathbf {F}}_{n}\) is the discrete Fourier transform with elements \(({\mathbf {F}}_{n})_{j,l}=e^{-i\frac{2\pi }{n} jl}\), \({\mathbf {F}}_{n}^{-1}\) is the inverse discrete Fourier transform with elements \(({\mathbf {F}}_{n}^{-1})_{j,l}=\frac{1}{n}e^{i\frac{2\pi }{n} jl}\), and \(\varvec{\Lambda } = diag(f(\varepsilon _{0}),f(\varepsilon _{1}),\ldots ,f(\varepsilon _{n-1}))\).

Set

$$\begin{aligned}{\mathbf {A}}_{1}= & {} \frac{1}{2h_x}C(\underbrace{0,1,0,\ldots ,0,-1}_{N_{x}}),~~{\mathbf {A}}_{2} = \frac{1}{h_x^2}C(\underbrace{-2,1,0,\ldots ,0,1}_{N_{x}}),\\ {\mathbf {B}}_{1}= & {} \frac{1}{2h_y}C(\underbrace{0,1,0,\ldots ,0,-1}_{N_{y}}),~~{\mathbf {B}}_{2} = \frac{1}{h_y^2}C(\underbrace{-2,1,0,\ldots ,0,1}_{N_{y}}), \end{aligned}$$

and

$$\begin{aligned} {\mathbf {V}}= ({v}_{j,k})_{N_{x}\times N_{y}} = \left( \begin{array}{cccc} {v}_{0,0} &{} {v}_{0,1} &{} \cdots &{} {v}_{0,N_{y}-1} \\ {v}_{1,0} &{} {v}_{1,1} &{} \cdots &{} {v}_{1,N_{y}-1} \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ {v}_{N_{x}-1,0} &{} {v}_{N_{x}-1,1} &{} \cdots &{} {v}_{N_{x}-1,N_{y}-1} \\ \end{array} \right) ,~\hbox {etc}. \end{aligned}$$

Define two operators and as follows:

Note that these two operators possess the following properties:

Then, system (4.7) can be rewritten into the following compact form:

(4.9)
Table 1 Mesh refinement test of scheme (4.1) for u (or v)
Table 2 Mesh refinement test of scheme (4.1) for \(\phi \)
Table 3 Mesh refinement test of scheme (4.18) for u (or v)
Table 4 Mesh refinement test of scheme (4.18) for \(\phi \)

According to Lemma 4.1, we have

$$\begin{aligned}&{\mathbf {A}}_{1} = {\mathbf {F}}_{N_{x}}^{-1}\cdot {\mathbf {D}}_{x1} \cdot {\mathbf {F}}_{N_{x}},~~{\mathbf {A}}_{2} = {\mathbf {F}}_{N_{x}}^{-1}\cdot {\mathbf {D}}_{x2} \cdot {\mathbf {F}}_{N_{x}},\end{aligned}$$
(4.10)
$$\begin{aligned}&{\mathbf {B}}_{1} = {\mathbf {F}}_{N_{y}}^{-1}\cdot {\mathbf {D}}_{y1} \cdot {\mathbf {F}}_{N_{y}},~~{\mathbf {B}}_{2} = {\mathbf {F}}_{N_{y}}^{-1} \cdot {\mathbf {D}}_{y2} \cdot {\mathbf {F}}_{N_{y}}, \end{aligned}$$
(4.11)

where

$$\begin{aligned} {\mathbf {D}}_{x1}= & {} diag(d_{0}^{x1},d_{1}^{x1},\ldots ,d_{N_{x}-1}^{x1}),~d_{j}^{x1} =\frac{i}{h_{x}}\sin \frac{2j\pi }{N_{x}},\\ {\mathbf {D}}_{x2}= & {} diag(d_{0}^{x2},d_{1}^{x2},\ldots ,d_{N_{x}-1}^{x2}),~d_{j}^{x2} = -\frac{4}{h_{x}^{2}}\sin ^{2}\frac{j\pi }{N_{x}},\\ {\mathbf {D}}_{y1}= & {} diag(d_{0}^{y1},d_{1}^{y1},\ldots ,d_{N_{y}-1}^{y1}),~d_{k}^{y1} =\frac{i}{h_{y}}\sin \frac{2k\pi }{N_{y}},\\ {\mathbf {D}}_{y2}= & {} diag(d_{0}^{y2},d_{1}^{y2},\ldots ,d_{N_{y}-1}^{y2}),~d_{k}^{y2} = -\frac{4}{h_{y}^{2}}\sin ^{2}\frac{k\pi }{N_{y}}. \end{aligned}$$

Let etc. Then, system (4.9) can be transformed into

(4.12)

This is a differential-algebraic equation system. Noticing \(d_0^{x1} = d_{N_x/2}^{x1} = d_0^{y1} = d_{N_y/2}^{y1} = 0,\) we derive from the third equation of system (4.12)

$$\begin{aligned} {\widetilde{{\mathbf {P}}}}_{j,k}= & {} -\frac{d_{j}^{x1}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{1_{j,k}} -\frac{d_{k}^{y1}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{2_{j,k}},\nonumber \\&j\ne 0~\hbox {or}~j\ne N_{x}/2~\hbox {or}~k\ne 0~\hbox {or}~k\ne N_{y}/2. \end{aligned}$$
(4.13)
Fig. 1
figure 1

Coalescence of two drops simulated using ESM with \(N=128\), \(\tau = 0.01\)

Fig. 2
figure 2

Coalescence of two drops simulated using IFM with \(N=128\), \(\tau = 0.0001\)

Fig. 3
figure 3

The evolution of the velocity field obtained using ESM with \(N=128\), \(\tau = 0.01\). The maximum of \(|{\mathbf {v}}|\) at \(t = 2,5,20,200\) are 3.6699e−2, 9.3829e−3, 1.9715e−3, 1.5626e−5, respectively

Since \({\widetilde{{\mathbf {P}}}}_{0,0},~{\widetilde{{\mathbf {P}}}}_{0,N_y/2},~{\widetilde{{\mathbf {P}}}}_{N_x/2,0}\) and \({\widetilde{{\mathbf {P}}}}_{N_x/2,N_y/2}\) don’t work for the system (4.12), we can eliminate \({\widetilde{{\mathbf {P}}}}\) from system (4.12) by using (4.13) and obtain an ordinary differential equation system

(4.14)

where

$$\begin{aligned} {\mathbf {H}}_{1_{j,k}}= & {} {\left\{ \begin{array}{ll} -\frac{(d_{k}^{y1})^{2}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{1_{j,k}} +\frac{d_{j}^{x1}d_{k}^{y1}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{2_{j,k}},~~&{}j\ne 0,N_{x}/2;\\ -{\widetilde{{\mathbf {G}}}}_{1_{j,k}},~~&{}\hbox {other}; \end{array}\right. }\\ {\mathbf {H}}_{2_{j,k}}= & {} {\left\{ \begin{array}{ll} \frac{d_{j}^{x1}d_{k}^{y1}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{1_{j,k}} -\frac{(d_{j}^{x1})^{2}}{(d_{j}^{x1})^{2}+(d_{k}^{y1})^{2}}{\widetilde{{\mathbf {G}}}}_{2_{j,k}},~~&{}k\ne 0,N_{y}/2;\\ -{\widetilde{{\mathbf {G}}}}_{2_{j,k}},~~&{}\hbox {other}. \end{array}\right. } \end{aligned}$$
Fig. 4
figure 4

The evolution of the velocity field obtained using IFM with \(N=128\), \(\tau = 0.0001\). The maximum of \(|{\mathbf {v}}|\) at \(t = 2,5,20,200\) are 3.6620e−2, 9.8207e−3, 2.0297e−3, 1.5820e−5, respectively

Fig. 5
figure 5

Comparison between the result obtained using ESM with \(N=128\), \(\tau = 0.01\) and that obtained using IFM with \(N=128\), \(\tau = 0.0001\) in the drop coalescence example. a The evolution of energy. b The rate of energy dissipation. c The residual of energy identity. d The evolution of \(\nabla \cdot \mathbf {v}\)

Fig. 6
figure 6

Coalescence of two drops simulated using ESM with \(N=256\), \(\tau = 0.01\)

Fig. 7
figure 7

Coalescence of two drops simulated using IFM with \(N=256\), \(\tau = 0.0001\)

Fig. 8
figure 8

The evolution of flow field obtained using ESM with \(N=256\), \(\tau = 0.01\). The maximum of \(|{\mathbf {v}}|\) at \(t = 2,5,20,200\) are 5.2193e−2, 1.6161e−2, 1.7931e−3, 7.1346e−6, respectively

Set \({\mathbf {C}}= (c_{j,k})_{N_{x}\times N_{y}}\) with \(c_{j,k} = d_{j}^{x2}+d_{k}^{y2}\). Here, we define an operation “\((e^{*})\)” by taking element-by-element exponentials as follows:

$$\begin{aligned} (e^{*})^{{\mathbf {C}}} = (e^{c_{j,k}})_{N_{x}\times N_{y}}. \end{aligned}$$

Define another operator “\(\odot \)” for taking element-by-element multiplication between two matrices with the same size in the following:

$$\begin{aligned} ({\mathbf {M}}\odot {\mathbf {L}})_{j,k} = m_{j,k}l_{j,k}, \end{aligned}$$

where \({\mathbf {M}}= (m_{j,k})\) and \({\mathbf {L}}= (l_{j,k}).\) Then, (4.14) can be rewritten as follows

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{d}{dt} {\widetilde{{\mathbf {V}}}}_{1} = \eta {\mathbf {C}}\odot {\widetilde{{\mathbf {V}}}}_{1}+{\mathbf {H}}_{1},\\ \frac{d}{dt} {\widetilde{{\mathbf {V}}}}_{2} = \eta {\mathbf {C}}\odot {\widetilde{{\mathbf {V}}}}_{2}+{\mathbf {H}}_{2},\\ \frac{d}{dt} \widetilde{\varvec{\Phi }} = \left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) \odot \widetilde{\varvec{\Phi }}-{\widetilde{{\mathbf {G}}}}_{3}. \end{array}\right. } \end{aligned}$$
(4.15)

Solving it using the integrating factor technique, we arrive at

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{d\left( {\widetilde{{\mathbf {V}}}}_{1}\odot (e^{*})^{-\eta {\mathbf {C}}t}\right) }{dt} = {\mathbf {H}}_{1}\odot (e^{*})^{-\eta {\mathbf {C}}t},\\ \frac{d\left( {\widetilde{{\mathbf {V}}}}_{2}\odot (e^{*})^{-\eta {\mathbf {C}}t}\right) }{dt} = {\mathbf {H}}_{2}\odot (e^{*})^{-\eta {\mathbf {C}}t},\\ \frac{d\left( \widetilde{\varvec{\Phi }}\odot (e^{*})^{-\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) t}\right) }{dt} = -{\widetilde{{\mathbf {G}}}}_{3}\odot (e^{*})^{-\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) t}. \end{array}\right. } \end{aligned}$$
(4.16)

Integrating both sides of system (4.16) from \(t_{n}\) to \(t_{n+1}\), we obtain

$$\begin{aligned} {\left\{ \begin{array}{ll} {\widetilde{{\mathbf {V}}}}_{1}^{n+1} = {\widetilde{{\mathbf {V}}}}_{1}^{n}\odot (e^{*})^{\eta {\mathbf {C}}\Delta t} + \int _{t_{n}}^{t_{n+1}} {\mathbf {H}}_{1}\odot (e^{*})^{\eta {\mathbf {C}}(t_{n+1}-t)}dt,\\ {\widetilde{{\mathbf {V}}}}_{2}^{n+1} = {\widetilde{{\mathbf {V}}}}_{2}^{n}\odot (e^{*})^{\eta {\mathbf {C}}\Delta t} + \int _{t_{n}}^{t_{n+1}} {\mathbf {H}}_{2}\odot (e^{*})^{\eta {\mathbf {C}}(t_{n+1}-t)}dt,\\ \widetilde{\varvec{\Phi }}^{n+1} = \widetilde{\varvec{\Phi }}^{n}\odot (e^{*})^{\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) \Delta t} - \int _{t_{n}}^{t_{n+1}} {\widetilde{{\mathbf {G}}}}_{3}\odot (e^{*})^{\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) (t_{n+1}-t)}dt. \end{array}\right. }\nonumber \\ \end{aligned}$$
(4.17)

This is the exact solution of the ODE system in one step. To obtain an approximate form of the integrals, one can directly apply the Lagrange interpolation polynomial of degree r at \(t_{n},t_{n-1},\ldots ,t_{n-r}\) [39]. For instance, the second order scheme with \(r=1\) can be written as

$$\begin{aligned} {\left\{ \begin{array}{ll} {\widetilde{{\mathbf {V}}}}_{1}^{n+1} = ({\widetilde{{\mathbf {V}}}}_{1}^{n}+\frac{3}{2}\Delta t {\mathbf {H}}_{1}^{n})\odot (e^{*})^{\eta {\mathbf {C}}\Delta t} -\frac{1}{2}\Delta t {\mathbf {H}}_{1}^{n-1}\odot (e^{*})^{2\eta {\mathbf {C}}\Delta t},\\ {\widetilde{{\mathbf {V}}}}_{2}^{n+1} = ({\widetilde{{\mathbf {V}}}}_{2}^{n}+\frac{3}{2}\Delta t {\mathbf {H}}_{2}^{n})\odot (e^{*})^{\eta {\mathbf {C}}\Delta t} -\frac{1}{2}\Delta t {\mathbf {H}}_{2}^{n-1}\odot (e^{*})^{2\eta {\mathbf {C}}\Delta t},\\ \widetilde{\varvec{\Phi }}^{n+1} = (\widetilde{\varvec{\Phi }}^{n}-\frac{3}{2}\Delta t {\widetilde{{\mathbf {G}}}}_{3}^{n})\odot (e^{*})^{\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) \Delta t} + \frac{1}{2}\Delta t {\widetilde{{\mathbf {G}}}}_{3}^{n-1}\odot (e^{*})^{2\left( \frac{2\gamma \Gamma }{\varepsilon }{\mathbf {C}}-\gamma \varepsilon \Gamma {\mathbf {C}}\odot {\mathbf {C}}\right) \Delta t}. \end{array}\right. }\nonumber \\ \end{aligned}$$
(4.18)

Remark 4.2

Apparently, we can obtain the high order discretization in time using the IF method. However, we can’t prove it preserves the energy dissipation law theoretically for the time being due to the nonlinearity in the system. We will show numerically in the next section that the discrete energy does decay in time in all our simulations using the IF method.

5 Numerical Results and Discussion

In this section, we present some numerical results to illustrate the efficiency and accuracy of the proposed methods. We notice that the proposed scheme (4.1) given by Crank–Nicolson discretization in time leads to a nonlinear algebraic system, which can be solved using a simple fixed-point iterative method. For every iteration step, the discrete system can be transformed into a form similar to (4.12) that can be solved by the Fast Fourier Transform.

Fig. 9
figure 9

The evolution of flow field obtained using IFM with \(N=256\), \(\tau = 0.0001\). The maximum of \(|{\mathbf {v}}|\) at \(t = 2,5,20,200\) are 5.5253e−2, 1.4889e−2, 6.3219e−4, 7.1756e−6, respectively

Fig. 10
figure 10

Comparison between ESM with \(N=256\), \(\tau = 0.01\) and IFM with \(N=256\), \(\tau = 0.0001\) in the drop coalescence example. a The evolution of energy. b The rate of energy dissipation. c The residual of energy identity. d The evolution of \(\nabla \cdot \mathbf {v}\)

5.1 Mesh Refinement

In order to test the convergence rate, we first consider the system (2.3) in a rectangular domain \(V = [0,1]^{2}\) with the free energy defined in (2.1). We make the following functions exact solution of the system modified by some appropriate forcing functions

$$\begin{aligned} {\left\{ \begin{array}{ll} u(x,y,t) = \pi \sin ^{2}(\pi x)\sin (2\pi y)\sin (t),\\ v(x,y,t) = -\pi \sin (2\pi x)\sin ^{2}(\pi y)\sin (t),\\ \phi (x,y,t) = \cos (2\pi x)\cos (2\pi y)\cos (t),\\ p(x,y,t) = \cos (2\pi x)\sin (2\pi y)\sin (t). \end{array}\right. } \end{aligned}$$
(5.1)

The parameter values are chosen as \(\rho = \eta = \gamma = 1, \varepsilon = 0.01,\Gamma = 1.0e{-}7\). Here, we choose the number of the spatial grids as \(N_{x} = N_{y} = N\). In Tables 1, 2, 3 and 4, we compare the numerical solution with the exact solution at \(t=1\), and compute the \(L_{2}\) and \(L_{\infty }\) errors of velocity u and phase variable \(\phi \) by varying the grid size in space and time. From Tables 1, 2, 3 and 4, we observe that the two schemes are at least second-order accurate in both time and space for all variables, and the numerical solutions for the velocity u and phase variable \(\phi \) by the energy stable method (ESM) (4.1) are slightly more accurate than those by the integrating factor method (IFM) (4.18). We also notice that the computational cost for both methods are in fact comparable on smooth solutions since ESM normally iterates 2–3 times at each time step compared with 1 step in IFM.

5.2 Drop Dynamics

In this example, we consider model (2.3) with the free energy defined by (2.1) to study coalescence of two drops. The initial conditions are given by

$$\begin{aligned} u(x,y,0)= & {} v(x,y,0) = 0,(x,y)\in [0,1]^2,\\ \phi (x,y,0)= & {} {\left\{ \begin{array}{ll} 1,&{}r_{1}\le 0.2-\delta ~\hbox {or}~r_{2}\le 0.2-\delta ,\\ \tanh \big ((0.2+\delta -r_{1})/\delta \big ),&{}0.2-\delta<r_{1}< 0.2+\delta ,\\ \tanh \big ((0.2+\delta -r_{2})/\delta \big ),&{}0.2-\delta<r_{2}< 0.2+\delta ,\\ 0,&{}\hbox {other}, \end{array}\right. } ~~(x,y)\in [0,1]^2, \end{aligned}$$

where \(r_{1}=\sqrt{(x-0.3+\delta )^2+(y-0.5)^2}\), \(r_{2}=\sqrt{(x-0.7-\delta )^2+(y-0.5)^2}\) and \(\delta = 0.01\). The parameters are taken as \(\rho = \eta = \gamma = 1, \varepsilon = 0.01,\Gamma = 1.0e{-}7\).

To compare ESM with IFM, we denote the energy dissipation rate by

$$\begin{aligned} R_{D}^{n} = \eta \Vert \nabla _{h}^{+}{\mathbf {v}}^{n+1/2}\Vert _{h}^{2}+\Gamma \Vert \nabla _{h}^{+}\mu ^{n,n+1}\Vert _{h}^{2}, \end{aligned}$$

and the residual of the energy identity by

$$\begin{aligned} R_{E}^{n} = \bigg |\frac{E_{h}^{n+1}-E_{h}^{n}}{\Delta t} + R_{D}^{n}\bigg |. \end{aligned}$$

Figures 1 and 2 present the evolution of drops obtained using ESM (4.1) with \(N = 128,\tau =0.01\) and IFM (4.18) with \(N = 128,\tau =0.0001\), respectively. These figures show that the evolution of drops by IFM is essentially identical to that by ESM. The two equal-sized circular drops eventually merge into a single one. However, in this example, IFM needs to take a much smaller time step, which implies that it possesses a considerable time discretization error that can only be controlled using smaller step size. Figures 3 and 4 depict the velocity field at a few selected time slots with respect to the simulations in Figs. 1 and 2, respectively. Figures 5 shows the evolution of the energy, energy dissipation rate, residual of the energy identity and divergence of velocity field. As can be seen from Fig. 5a, the energy decays numerically in both cases. Figure 5b indicates that the energy dissipation rate predicted by the two methods is essential indistinguishable in the end. In Fig. 5c, the discrete energy identity is conserved very well using ESM, confirming Theorem 4.1. However, it is not approximated very well initially by IFM. As time goes by, the approximation improves significantly. Figure 5d confirms that both the ESM and IFM preserve divergence free very well. The results obtained using ESM with \(N = 256,\tau =0.01\) and the IFM with \(N = 256,\tau =0.0001\) are also given in Figs. 6, 7, 8, 9, 10. Through numerical experiments, we find that ESM is numerically better than the IFM in this case, owing to the discrete energy dissipation law (Fig. 10).

The comparison shows that IFM needs more resolution to resolve the drop detail compared to ESM. This is consistent with the observation we had in [20].

5.3 Phase Separation and Mixing Dynamics in Blends of Two Polymeric Liquids

Here, we use the phase field model system (2.3) with the free energy defined in (2.2) to study phase separation dynamics in blends involving two polymeric liquids. The initial conditions are given by

$$\begin{aligned} u(x,y,0)= & {} v(x,y,0) = 0,\\ \phi (x,y,0)= & {} 0.5+0.45\sin (4\pi x)\sin (4\pi y). \end{aligned}$$

The parameter values are chosen as \(\rho =\eta =1\), \(\gamma _{1} = 0.0001, \gamma _{2} = 1, N_{1} = 1, N_{2} = 2, \chi = 2,\Gamma = 1.0e\)-4.

The two phases are not well-separated initially in the given initial condition. Over time, they quickly separate and coarsen into one phase in droplets immersed in the other phase. We use the same number of spatial discretized points and same time step size. The simulations show a reasonable agreement between the results predicted by the two methods. Since IFM is an explicit method, it computes faster than ESM in this example ( see Figs. 11, 12, 13).

Fig. 11
figure 11

Phase separation and coarsening dynamics simulated using ESM with \(N=128\), \(\tau = 0.01\)

Fig. 12
figure 12

Phase separation and coarsening simulated using IFM with \(N=128\), \(\tau = 0.01\)

Fig. 13
figure 13

Comparison between ESM and IFM at \(N=128\), \(\tau = 0.01\). a The evolution of energy. b The rate of energy dissipation. c The residual of energy identity. d The evolution of \(\nabla \cdot \mathbf {v}\)

6 Conclusions

We develop systematically a strategy to discretize the governing system of hydrodynamic equations for the binary fluid mixture of two immiscible viscous fluids, first in space and then in time. In the spatial discretization, the energy dissipation property is retained. Then, we discretize the equations in time using two methods: one is the energy stable scheme (ESM) and the other is the integrating factor method (IFM). For the time discretization, only the energy stable method preserves the discrete energy dissipation property while the same property can not be established theoretically for IFM. The coupled nonlinear algebraic system resulted from the energy stable discretization is solved iteratively aided with FFT. The integrating factor method is introduced to reduce the computational cost by avoiding solving a large coupled nonlinear algebraic system for each time step. Two numerical examples are presented to illustrate the efficiency and accuracy of the two methods. The energy stable method needs less grid points to resolve the fine detail in both cases. Whereas the integrating factor method, as an explicit method, may need more spatial points and finer time steps to arrive at the same resolution of details. For smooth solutions, IFM delivers a faster solver than ESM as expected.

Although the proposed methods have been presented only in the context of two space dimensions with periodic boundary conditions, they can be readily extended to higher spatial dimensions with physical boundary conditions. In addition, the present methods based on the finite difference approach for spatial discretization can also be extended to other means of discretization such as the finite volume [12, 23, 30], finite element, or spectral method [4, 34]. Overall, the proposed schemes provide a systematic approach for solving a wide range of problems arising from physical applications, whose governing systems of equations possess a clearly identifiable variational structure together with the total energy dissipation property. Given their effectiveness in implementation and fine stability properties, the methods are adaptable to local adaptive mesh refinement [1, 2, 32], which will be explored in the future.