1 Introduction

Subsurface flow often involves multiple fluid phases, and the phenomena of subsurfaces often allow for the mixing of immiscible and partially miscible fluids. A typical well-known application is the subsurface gas and oil reservoir, which contains gas phase, water phase and oil phase, together with the solid phase (soil or rock) [9]. There have been many efforts to study multiphase fluids, especially in reservoir engineering [13, 20, 25,26,27, 30]. It is highly important to model and numerically simulate these interfaces between phases to understand physical phenomena, such as gas bubbles, liquid droplets, and capillary pressure.

At least three methodologies have been proposed to model the interfaces between phases. Based on the molecular scale, the first approach is to model it by applying the molecular Monte Carlo simulation or the molecular dynamics simulation with a given intermolecular potential function (e.g., Lennard–Jones potential) [3, 10]. Although this method can describe the interfaces in detail, the central processing unit intensive property limits its application to a small part of simple substance. The second approach is known as the sharp interface modeling. The interface is modeled by a zero-thickness two-dimensional entity [23]. Assuming that the interface tension is given, this approach can be successfully applied to predict the shape and dynamics of the interface. However, it can not provide information within the interface itself. The third methodology is the diffuse interface theory, also called the phase field method see [22]. This method regards the molar or mass density as constants in the regions occupied by either single phase, but changes continuously within the interface. It provides an easier treatment of topological changes of the interface, since the free interface can be automatically tracked without imposing any mathematical conditions on the moving interface. Moreover, the phase field model is usually obtained by an energy-based variational formulation, thus it leads to well-posed nonlinear systems that satisfies the energy dissipation law. This approach has become a well-known effective modeling and simulated tool to resolve the motion of free interfaces between multiple material components, and also has been successfully applied to problems in many fields of science and engineering, see [1, 12, 14, 15, 24, 28, 29] and the references cited therein.

The diffuse interface model with Peng–Robinson equation of state [21] has been widely studied and applied for describing the real states of hydrocarbon fluids in the petroleum industry, and the structure of its energy functional is highly nonlinear and more complicated than many conventional phase field models. Therefore, designing accurate, efficient and stable numerical solution schemes for this model is a very useful but challenging task. Some efforts have been devoted to developing numerical schemes with energy stability. Qiao and Sun [22] adopted the well-known convex splitting approach [8], where the convex part of the nonlinear system is treated implicitly and the concave part explicitly in the time marching. This scheme is proved to be unconditionally energy stable. However, the computational costs are usually high since it produces stiff nonlinear systems to be solved at each time step. Kou and Sun [16] proved the maximum principle of the molar density and proposed a modified Newton’s method to solve the nonlinear model. About some recent developments in numerical algorithms for the diffuse interface model with Peng–Robinson equation of state, we refer to [17, 18].

The main purpose of this paper is to design efficient and effective linear energy stable numerical schemes to solve the diffuse interface model with Peng–Robinson equation of state. Instead of using the linear stabilization or the convex splitting approach, we will take the “Invariant Energy Quadratization” (IEQ) approach, which is a novel method and have been successfully applied to many phase field models for gradient flows [31,32,33,34,35,36,37]. The IEQ approach generalizes the Lagrange Multiplier approach (which is for double well potential only) proposed in [11], and extends its applicability greatly to a unified framework for general dissipative stiff systems with high nonlinearity. The essential idea of the IEQ approach is to transform the free energy into a quadratic form of a set of new variables via the change of variables. Then, we obtain a new but equivalent system, which still retains a similar energy dissipation law in terms of the new variables. The major advantage of this method is that all nonlinear terms in the new system then can be discretized by semi-explicit schemes in time to produce a linear system at each time step, while certain analogs of the energy dissipation law in the discrete sense are also preserved. Moreover, the operator of the obtained linear system is symmetric positive definite, and thus it can be numerically solved by many efficient linear solvers such as preconditioned CG method.

The rest of this paper is organized as follows. The diffuse interface model of the fluid system with Peng–Robinson equation of state is first briefly reviewed in Sect. 1.1. Our study especially focuses on the case of single-component two-phase fluids in this paper. In Sect. 2, we derive a gradient flow problem (a system of evolution equations) associated with the diffuse interface model, based on the the penalty formulation and the IEQ approach. In Sect. 3, we propose two numerical schemes with respective first order and second order temporal accuracy for solving the model, and both of them only require solution of linear systems in space at each time step. We also prove the symmetric positive definiteness of the resulted linear systems and the unconditional energy stabilities of these schemes. In Sect. 4 various numerical experiments in 2D and 3D spaces are carried out to illustrate accuracy and stability of the proposed schemes and to investigate physical reliability of the diffuse interface model by comparisons with laboratory data. Finally, some concluding remarks are given in Sect. 5.

1.1 Mathematical Model of the Fluid System by the Diffuse Interface and Peng–Robinson Equation of State

We now give a brief introduction on the diffuse interface model of fluid system with Peng–Robinson equation of state, consisting of fixed species inside a domain with a spatially uniform-distributed temperature. The total Helmholtz free energy achieves a global minimum at the equilibrium state due to the second law of thermodynamics. Let M denote the number of components in the fluid mixture, \(\varOmega \) be the open, bounded, and connected domain occupied by the M-component two-phase fluid, and T (measured in Kelvin) be the temperature of the fluid mixture. Let \(n_i({{\mathbf {x}}})>0\) represent the molar concentration of the component i and denote by \(\displaystyle {\mathbf {n}} = (n_1,n_2,\ldots ,n_M)^T\) the molar concentrations of all components and by \(\displaystyle n = n_1+n_2+\cdots +n_M\) the total molar density of the fluid. The diffusive interface model states that the total Helmholtz energy density of an inhomogeneous fluid has two contributions, one from the thermodynamic theory of homogeneous fluid and the other one from inhomogeneity of the fluid, in the following form [9]

$$\begin{aligned} F({\mathbf {n}};T)= & {} F_0({\mathbf {n}};T)+ F_\nabla ({\mathbf {n}};T)\nonumber \\= & {} \int _\varOmega f_0({\mathbf {n}};T)\,d{\mathbf {x}} + \int _\varOmega f_\nabla ({\mathbf {n}};T)\,d{\mathbf {x}}. \end{aligned}$$
(1)

Here \(f_0({\mathbf {n}};T)\) and \(f_\nabla ({\mathbf {n}};T)\) are respectively the contribution of Helmholtz free energy densities from the homogeneous fluid theory and the concentration gradient. Since the molar concentration \({\mathbf {n}}\) at equilibrium minimizes the Helmholtz free energy (1) for a closed and conserved fluid system with a spatially uniform-distributed temperature T, the mathematical statement of the problem is formulated as follows: find \({\mathbf {n}}^*\in H\) satisfying

$$\begin{aligned} F({\mathbf {n}}^*) = \min \limits _{\mathbf {{n}}\in H} F(\mathbf {{n}}), \end{aligned}$$
(2)

subject to the constraint

$$\begin{aligned} \int _{\varOmega }\mathbf {{n}}\,d{\mathbf {x}} = {\mathbf {N}}, \end{aligned}$$
(3)

where H is a space of functions with certain regularity. Under the condition (3), \(\displaystyle {\mathbf {N}}=(N_1,N_2,\cdots ,N_M)^T\) denotes a pre-given constant vector, with \(N_i\) representing the fixed amount of material mass for the component i in the system.

The Peng–Robinson equation of state is one of the most popular model for computing the fluid equilibrium properties of petroleum fluids in reservoir engineering and oil industries, where the homogeneous Helmholtz free energy density \(f_0({\mathbf {n}})\) is given by [15, 16, 18]

$$\begin{aligned} f_0({\mathbf {n}})=f_{01}({\mathbf {n}}) + f_{02}({\mathbf {n}}) \end{aligned}$$

with

$$\begin{aligned} f_{01}({\mathbf {n}})= & {} RT\sum \limits _{i=1}^M n_i(\ln n_i-1)-nRT\ln (1-bn),\\ f_{02}({\mathbf {n}})= & {} \frac{a(T)n}{2\sqrt{2}b}\ln \left( \frac{1+(1-\sqrt{2})bn}{1+(1+\sqrt{2})bn}\right) , \end{aligned}$$

where R is the universal gas constant and the (temperature-dependent) energy parameter \(a=a(T)\) and the co-volume parameter b are related to the mixing rules of the pure fluids. The gradient contribution or the inhomogeneous term \(f_\nabla ({\mathbf {n}})\) can be computed by the following simple quadratic relation

$$\begin{aligned} f_\nabla ({\mathbf {n}})=\frac{1}{2}\sum \limits _{i,j=1}^M c_{ij}\nabla n_i\cdot \nabla n_j, \end{aligned}$$

where the influence parameter \(c_{ij}\) is a function of the molar concentrations and the temperature. We refer to the “Appendix” for details.

2 The Modified Total Free Energy and the Gradient Flow Problem

In this paper, we will focus our study on the case of single-component (\(M=1\)) two-phase fluid system, which can be simplified to the following problem

$$\begin{aligned} \min _{n} F(n) = \int _{\varOmega }(f_0(n)+f_\nabla ({n}))\,d{\mathbf {x}}, \end{aligned}$$
(4)

subject to

$$\begin{aligned} \int _{\varOmega } n\,d{\mathbf {x}} = N, \end{aligned}$$
(5)

where \(\displaystyle f_\nabla ({n})= \frac{c}{2}\nabla n\cdot \nabla n\) and \(\displaystyle f_0(n)=f_{01}(n) + f_{02}(n)\) with

$$\begin{aligned} \displaystyle f_{01}(n)= RTn(\ln n-1)-nRT\ln (1-bn) \end{aligned}$$

and

$$\begin{aligned} \displaystyle f_{02}(n) =\frac{a(T)n}{2\sqrt{2}b}\ln \left( \frac{1+(1-\sqrt{2})bn}{1+(1+\sqrt{2})bn}\right) . \end{aligned}$$

Theoretically the possible value of n in the problem (4), (5) falls into the open interval (0, 1 / b). It is obvious that \(f_{02}(n)\) is a continuous function at the interval \(\displaystyle (-(\sqrt{2}-1)/b,\infty )\) and thus is naturally bounded from below in [0, 1 / b]. As for the function \(f_{01}(n)\), it is singular at end points of its physically reasonable region \(\displaystyle (0,1/b)\), \(n=0\) and \(\displaystyle n=1/b\). Following the works in [2, 7, 35], we will regularize \(f_{01}(n)\) by replacing it with a \(C^2\) continuous, convex, piecewise function defined in \((-\infty ,\infty )\). For any \(\epsilon >0\), let us define the regularized \(f_{01}(n)\) by

$$\begin{aligned} {\hat{f}}_{01}(n)= \left\{ \begin{array}{ll} RTn(\ln \frac{\epsilon }{b}-1)-RTn\ln {(1-bn)}+RT(\frac{bn^2}{2\epsilon }- \frac{\epsilon }{2b}),&{} \quad \hbox {if } n<\frac{\epsilon }{b},\\ RTn(\ln {n}-1)-RTn\ln {(1-bn)},&{} \quad \hbox {if } n\in [\frac{\epsilon }{b},\frac{1-\epsilon }{b}],\\ RTn(\ln {n}-1)-RTn\ln {\epsilon }\\ \quad +RT\left[ \frac{b\epsilon +b}{2\epsilon ^2}(n-\frac{1-\epsilon }{b}+ \frac{\epsilon (1-\epsilon )}{b(1+\epsilon )})^2-\frac{(1-\epsilon )^2}{2b(1+\epsilon )}\right] , &{} \quad \hbox {if } n>\frac{1-\epsilon }{b}. \end{array}\right. \end{aligned}$$
(6)

When \(\epsilon \rightarrow 0\), \({\hat{f}}_{01}(n)\rightarrow f_{01}(n)\). It can be proven that the error bound between \(f_{01}(n)\) and \({{\hat{f}}}_{01}(n)\) in (0, 1 / b) is controlled by \(\epsilon \) up to a constant. In order to avoid any numerical singularity caused by \(f_{01}(n)\) during the solution process, we use the regularized function \(\hat{f_0}(n)={\hat{f}}_{01}(n) + f_{02}(n)\) to replace \(f_0(n)\) in the problem (4), (5).

We define the total material mass for the component in the system as \(\displaystyle U(n)=\int _{\varOmega }n \,d{\mathbf {x}}\), which should be fixed according to the constraint (5). Then, by adopting the the penalty formulation [4,5,6], we can transform the constrained minimization problem (4) and (5) to the following unconstrained minimization problem

$$\begin{aligned} \min _n E(n)=\int _{\varOmega }\left( \frac{c}{2}|\nabla n|^2 + \hat{f_0}(n)\right) \,d{\mathbf {x}} + \frac{Q}{2}(U(n)-N)^2, \end{aligned}$$
(7)

where \(Q>0\) is a large constant penalty parameter. It is clear that \(\hat{f_0}(n)\) is bounded from below in [0, 1 / b] although it is not always positive in the whole domain. To use the IEQ method proposed in [31,32,33,34,35,36,37], we rewrite the free energy functional in (7) to the following form:

$$\begin{aligned} E(n)=\int _{\varOmega }\left( \frac{c}{2}|\nabla n|^2 + \left( \sqrt{\hat{f_0}(n)+B}\right) ^2 - B\right) d{\mathbf {x}} + \frac{Q}{2}(U(n)-N)^2, \end{aligned}$$
(8)

where B is a positive constant to ensure \(\hat{f_0}(n)+B>0\). Since we simply add a zero term \(B-B\) therein, thus, we emphasize that the free energy is invariant. Next we define two auxiliary variables to be the square roots of \(\hat{f_0}(n)+B\) and \(\displaystyle (U(n)-N)^2\) respectively as

$$\begin{aligned} W&= \sqrt{\hat{f_0}(n)+B}, \end{aligned}$$
(9)
$$\begin{aligned} V&=\, U(n)-N. \end{aligned}$$
(10)

Then the free energy functional (8) can be expressed as the following new but equivalent functional

$$\begin{aligned} E(n,W,V)=\int _{\varOmega }\left( \frac{c}{2}|\nabla n|^2 + W^2 - B\right) \,d{\mathbf {x}} + \frac{Q}{2}V^2. \end{aligned}$$
(11)

The governing dynamical equation (or the gradient flow) for \(n({\mathbf {x}},t)\) based on the variational approach is given by

$$\begin{aligned} n_t=&-\frac{\delta E(n)}{\delta n} = c\varDelta n - WH(n) - QV, \end{aligned}$$
(12)

where \(H(n)=\displaystyle \frac{\hat{f_0}'(n)}{\sqrt{\hat{f_0}(n)+B}}\). Thus we obtain a system of evolution equations of the variables nWV as follows

$$\begin{aligned} n_t&=\,c\varDelta n - WH(n) -QV, \end{aligned}$$
(13)
$$\begin{aligned} W_t&=\,\frac{1}{2}H(n)n_t, \end{aligned}$$
(14)
$$\begin{aligned} V_t&=\int _{\varOmega }n_t \,d{\mathbf {x}}. \end{aligned}$$
(15)

According to the theory of gradient flow, the steady state solutions of the above partial differential equation system (13)–(15) will give us (local) minimizers of (11) and thus of (7). We finally close the system (13)–(15) by adding the periodic boundary (or the no-flux) condition and the following compatible initial conditions:

$$\begin{aligned} {\left\{ \begin{array}{ll} n(t=0) =n_0,\\ W(t=0) =\sqrt{\hat{f_0}(n_0)+B},\\ V(t=0) =0. \end{array}\right. } \end{aligned}$$
(16)

Denote by \(\displaystyle (h({\mathbf {x}}),g({\mathbf {x}}))=\int _\varOmega h({\mathbf {x}})g({\mathbf {x}})d{\mathbf {x}}\) the \(\displaystyle L^2\) inner product of two arbitrary functions \(h({\mathbf {x}})\) and \(g({\mathbf {x}})\), and by \(\left\| g\right\| =\sqrt{(g,g)}\) the \(\displaystyle L^2\) norm of any function \(g({\mathbf {x}})\). Taking the \(\displaystyle L^2\) inner product of (13) with \(n_t\), of (14) with W, and taking the simple multiplication of (15) with QV, we have

$$\begin{aligned} (n_t,n_t)&=\,c(\varDelta n,n_t) - (WH(n),n_t) - (QV,n_t), \end{aligned}$$
(17)
$$\begin{aligned} (W_t,W)&=\,\frac{1}{2}(H(n)n_t,W), \end{aligned}$$
(18)
$$\begin{aligned} QV V_t&=\,Q(V,V_t). \end{aligned}$$
(19)

Summing (17)–(19) up, we then get the energy dissipation law of the modified system (13)–(15) as follows

$$\begin{aligned} \frac{d}{dt}E(n,W,V)=-\left\| n_t\right\| ^2\le 0. \end{aligned}$$
(20)

3 Numerical Schemes for Time Stepping

In this section we will focus on designing numerical schemes for time discretization of the PDE system (13)–(15), that lead to solutions of linear systems with self-adjoint positive definite spatial operators at each time step, and satisfy discrete analogues of the energy dissipation law (20). Let \(\delta t>0\) denote the time step size and set \(\displaystyle t^k=k\delta t\) for \(0\le k\le K\) with the final time \(T=K\delta t\).

3.1 First Order Scheme

Assuming that \(n^k\), \(W^k\) and \(V^k\) are already calculated, we then solve \(\displaystyle n^{k+1}\), \(\displaystyle W^{k+1}\) and \(\displaystyle V^{k+1}\) from the following temporally semi-discretized system

$$\begin{aligned} \frac{n^{k+1}-n^k}{\delta t}= & {} c\varDelta n^{k+1} - W^{k+1}H(n^k) - QV^{k+1}, \end{aligned}$$
(21)
$$\begin{aligned} \frac{W^{k+1}-W^k}{\delta t}= & {} \frac{1}{2}H(n^k)\frac{n^{k+1}-n^k}{\delta t}, \end{aligned}$$
(22)
$$\begin{aligned} \frac{V^{k+1}-V^k}{\delta t}= & {} \int _{\varOmega }\frac{n^{k+1}-n^k}{\delta t}\,d{\mathbf {x}} \end{aligned}$$
(23)

with the periodic boundary condition. We note that (22) and (23) can be rewritten as

$$\begin{aligned} W^{k+1}&= W^k-\frac{1}{2}H(n^k)n^k+\frac{1}{2}H(n^k)n^{k+1} = A_1 + A_2(n^{k+1}), \end{aligned}$$
(24)
$$\begin{aligned} V^{k+1}&=V^k-\int _{\varOmega }n^k\,d{\mathbf {x}}+\int _{\varOmega }n^{k+1}\,d{\mathbf {x}}= A_3+A_4(n^{k+1}), \end{aligned}$$
(25)

where

$$\begin{aligned} A_1=&W^k-\frac{1}{2}H(n^k)n^k, \quad A_2(n)=\frac{1}{2}H(n^k)n,\\ A_3=&V^k-\int _{\varOmega }n^k\,d{\mathbf {x}},~~~\quad A_4(n)= \int _{\varOmega }n\,d{\mathbf {x}}. \end{aligned}$$

Thus, (21) can be rearranged as the reduced linear system

$$\begin{aligned} \frac{n^{k+1}}{\delta t} - c\varDelta n^{k+1} + H(n^k)A_2(n^{k+1})+QA_4(n^{k+1})=\frac{n^k}{\delta t}-H(n^k)A_1-QA_3. \end{aligned}$$
(26)

The linear system (26) can be expressed as \({\mathbb {A}}n^{k+1}=b\), and we need solve for \(n^{k+1}\) from it.

Theorem 1

The linear spatial operator \({\mathbb {A}}\) is symmetric positive definite.

Proof

It is not hard to verify that

$$\begin{aligned} ({\mathbb {A}}n,\varphi )&= \frac{1}{\delta t}(n,\varphi ) - c(\varDelta n,\varphi ) + H(n^k)(A_2(n),\varphi ) + Q(A_4(n),\varphi )\\&=\frac{1}{\delta t}(\varphi ,n) - c(n,\varDelta \varphi ) + H(n^k)(n,A_2(\varphi )) + QA_4(n)A_4(\varphi )\\&=(n,{\mathbb {A}}\varphi ), \end{aligned}$$

and

$$\begin{aligned} ({\mathbb {A}}n,n) =\,&\frac{1}{\delta t}(n,n) - c(\varDelta n,n) + H(n^k)(A_2(n),n) + Q(A_4(n),n)\ge \frac{1}{\delta t}||n||^2. \end{aligned}$$

Therefore, the operator \({\mathbb {A}}\) is symmetric positive definite. \(\square \)

Let us define \(\displaystyle \left\| n\right\| _{\mathbb {A}}=\sqrt{({\mathbb {A}}n,n)}\) for any \(\displaystyle n\in L^2_{per}(\varOmega )\) and the subset \(\displaystyle {\mathbf {X}}=\{n\in L^2_{per}(\varOmega ):\left\| n\right\| _{\mathbb {A}}<\infty \}\), where \(\displaystyle L^2_{per}(\varOmega )\) denotes the subspace of all functions \(\displaystyle n\in L^2(\varOmega )\) with the periodic boundary condition. It is easy to show that \(\left\| n\right\| _{\mathbb {A}}\) is a norm for \(L^2_{per}(\varOmega )\) and \({\mathbf {X}}\) is a Hilbert subspace associated with the norm \(\left\| n\right\| _{\mathbb {A}}\). Then the well-posedness of the linear system \({\mathbb {A}}n=b\) in the weak sense comes from the Lax–Milgram theorem, i.e., the linear system (26) admits a unique weak solution in \({\mathbf {X}}\).

Theorem 2

The first order linear system (21)–(23) is unconditionally energy stable, that is, it satisfies the following discrete energy dissipation law

$$\begin{aligned} E_{1st}^{k+1}\le & {} E_{1st}^{k} - \frac{\left\| n^{k+1}-n^k\right\| ^2}{\delta t}, \end{aligned}$$
(27)

where

$$\begin{aligned}E_{1st}^{k}=\frac{c}{2}\left\| \nabla n^k\right\| ^2+\left\| W^k\right\| ^2+\frac{Q}{2}(V^k)^2.\end{aligned}$$

Proof

By taking the \(L^2\) inner product of (21) with \(n^{k+1}-n^k\), we have

$$\begin{aligned} \frac{1}{\delta t}\left\| n^{k+1}-n^k\right\| ^2= & {} c\left( \varDelta n^{k+1},n^{k+1}-n^k\right) -\left( H(n^k)W^{k+1},n^{k+1}-n^k\right) \nonumber \\&\quad -\,Q\left( V^{k+1},n^{k+1}-n^k\right) . \end{aligned}$$
(28)

By taking the \(L^2\) inner product of (22) with \(W^{k+1}\) and applying the following identities

$$\begin{aligned} 2(a-b,a)=|a|^2-|b|^2+|a-b|^2, \end{aligned}$$

we obtain

$$\begin{aligned} \left\| W^{k+1}\right\| ^2-\left\| W^k\right\| ^2+\left\| W^{k+1} -W^k\right\| ^2=\left( H(n^k)W^{k+1},n^{k+1}-n^k\right) . \end{aligned}$$
(29)

By taking the simple multiplication of (23) with \(QV^{k+1}\) and applying (29), we have

$$\begin{aligned} \frac{Q}{2}\left( (V^{k+1})^2-(V^k)^2+(V^{k+1}-V^k)^2\right) =Q\left( V^{k+1},n^{k+1}-n^k\right) . \end{aligned}$$
(30)

Combining (28)–(30) gives us

$$\begin{aligned}&\frac{c}{2}\Big (\left\| \nabla n^{k+1}\right\| ^2-\left\| \nabla n^{k}\right\| ^2+\left\| \nabla n^{k+1}-\nabla n^k\right\| ^2\Big )\\&\quad +\,\Big (\left\| W^{k+1}\right\| ^2 -\left\| W^k\right\| ^2+\left\| W^{k+1}-W^k\right\| ^2\Big )\\&\quad +\,\frac{Q}{2}\left( (V^{k+1})^2-(V^k)^2+(V^{k+1}-V^k)^2\right) =-\frac{1}{\delta t}\left\| n^{k+1}-n^k\right\| ^2, \end{aligned}$$

and thus

$$\begin{aligned}&\frac{c}{2}\Big (\left\| \nabla n^{k+1}\right\| ^2+\left\| \nabla n^{k+1} -\nabla n^k\right\| ^2\Big )+\Big (\left\| W^{k+1}\right\| ^2+\left\| W^{k+1} -W^k\right\| ^2\Big )\nonumber \\&\quad +\,\frac{Q}{2}\left( (V^{k+1})^2+(V^{k+1}-V^k)^2\right) \nonumber \\&\qquad =\frac{c}{2}\left\| \nabla n^{k}\right\| ^2+\left\| W^k\right\| ^2+\frac{Q}{2}(V^k)^2-\frac{1}{\delta t}\left\| n^{k+1}-n^k\right\| ^2. \end{aligned}$$
(31)

Then, we dropping some positive terms from above Eq. (31), we have the discrete energy laws (27). \(\square \)

3.2 Second Order Scheme

Based on the Adam–Bashforth backward differentiation formulas (BDF2). Assuming that we have solved \(n^{k-1}\), \(W^{k-1}\), \(V^{k-1}\) and \(n^k\), \(W^k\), \(V^k\), then we compute \(n^{k+1}\), \(W^{k+1}\) and \(V^{k+1}\) as follows

$$\begin{aligned} \frac{3n^{k+1}-4n^k+n^{k-1}}{2\delta t}= & {} c\varDelta n^{k+1} - H(n^*)W^{k+1} - QV^{k+1}, \end{aligned}$$
(32)
$$\begin{aligned} \frac{3W^{k+1}-4W^k+W^{k-1}}{2\delta t}= & {} \frac{1}{2}H(n^*)\frac{3n^{k+1}-4n^k+n^{k-1}}{2\delta t}, \end{aligned}$$
(33)
$$\begin{aligned} \frac{3V^{k+1}-4V^k+V^{k-1}}{2\delta t}= & {} \int _{\varOmega }\frac{3n^{k+1}-4n^k+n^{k-1}}{2\delta t}\,d{\mathbf {x}}, \end{aligned}$$
(34)

where \(\displaystyle n^*=2n^k-n^{k-1}\). For (33), (34), we have

$$\begin{aligned} W^{k+1}&=\frac{4W^k-W^{k-1}}{3}-\frac{1}{2}H(n^*)\frac{4n^k-n^{k-1}}{3} +\frac{1}{2}H(n^*)n^{k+1},\\ V^{k+1}&=\frac{4V^k-V^{k-1}}{3}-\int _{\varOmega }\frac{4n^k-n^{k-1}}{3}\,d{\mathbf {x}}+ \int _{\varOmega }n^{k+1}\,d{\mathbf {x}}. \end{aligned}$$

Set

$$\begin{aligned}&B_1=W^+-\frac{1}{2}H(n^*)n^{+},\quad \quad B_2(n)=\frac{1}{2}H(n^*)n,\\&B_3=V^+-\int _{\varOmega }n^{+}\,d{\mathbf {x}},\qquad \quad B_4(n)=\int _{\varOmega }n\,d{\mathbf {x}}, \end{aligned}$$

where \( S^{+}=\frac{4S^k-S^{k-1}}{3}\). Thus, we obtain

$$\begin{aligned} W^{k+1}=B_1+B_2(n^{k+1}),\qquad V^{k+1}=B_3+B_4(n^{k+1}). \end{aligned}$$

In turn, we have the following reduced linear system

$$\begin{aligned}&\frac{3}{2\delta t}n^{k+1}-c\varDelta n^{k+1}+H\left( n^*\right) B_2\left( n^{k+1}\right) +QB_4\left( n^{k+1}\right) \nonumber \\&\quad =\frac{1}{2\delta t}\left( 4n^k-n^{k-1}\right) -H\left( n^*\right) B_1-QB_3. \end{aligned}$$
(35)

The above linear system can be written as \(\displaystyle \mathbb {{\hat{A}}}n^{k+1}={\hat{b}}\), and we need solve for \(\displaystyle n^{k+1}\) from it.

Theorem 3

The linear spatial operator \(\mathbb {{\hat{A}}}\) is symmetric positive definite.

Proof

We can verify that

$$\begin{aligned} (\mathbb {{\hat{A}}}n,\varphi )&= \frac{3}{2\delta t}(n,\varphi ) - c(\varDelta n,\varphi ) + H(n^*)(B_2(n),\varphi ) + Q(B_4(n),\varphi )\\&=\frac{3}{2\delta t}(\varphi ,n) - c(n,\varDelta \varphi ) + H(n^*)(n,B_2(\varphi )) + QB_4(n)B_4(\varphi )\\&=(n,\mathbb {{\hat{A}}}\varphi ), \end{aligned}$$

and

$$\begin{aligned} (\mathbb {{\hat{A}}}n,n) =\,&\frac{3}{2\delta t}(n,n) - c(\varDelta n,n) + H(n^*)(B_2(n),n) + Q(B_4(n),n)\ge \frac{3}{2\delta t}\left\| n\right\| ^2. \end{aligned}$$

Therefore, the operator \(\mathbb {{\hat{A}}}\) is symmetric positive definite. \(\square \)

Let us define \(\displaystyle \left\| n\right\| _\mathbb {{\hat{A}}}=\sqrt{(\mathbb {{\hat{A}}}n,n)}\) for any \(\displaystyle n\in L^2_{per}(\varOmega )\) and the subset \(\displaystyle {\hat{\mathbf {X}}}=\{n\in L^2_{per}(\varOmega ):\left\| n\right\| _\mathbb {{\hat{A}}}<\infty \}\). Similarly as before, we can show that the linear system (35) admits a unique weak solution in \({\hat{\mathbf {X}}}\).

Theorem 4

The second order linear system (32)–(34) is unconditionally energy stable, that is, it satisfies the following discrete energy dissipation law

$$\begin{aligned} E_{2}^{k+1,k}\le & {} E_{2}^{k,k-1} - \delta t \left\| \frac{3n^{k+1}-4n^k+n^{k-1}}{2\delta t}\right\| ^2, \end{aligned}$$
(36)

where

$$\begin{aligned} E_{2}^{k+1,k}= & {} \frac{c}{4}\Big (\left\| \nabla n^{k+1}\right\| ^2+\left\| 2\nabla n^{k+1}-\nabla n^k\right\| ^2\Big )\\&+\,\frac{1}{2}\Big (\left\| W^{k+1}\right\| ^2+\left\| 2W^{k+1}-W^k\right\| ^2\Big ) +\frac{Q}{4}\left( (V^{k+1})^2+(2V^{k+1}-V^k)^2\right) . \end{aligned}$$

Proof

By taking the \(\displaystyle L^2\) inner product of (32) with \(\displaystyle 3n^{k+1}-4n^k+n^{k-1}\), we have

$$\begin{aligned} \nonumber \frac{1}{2\delta t}\left\| 3n^{k+1}-4n^k+n^{k-1}\right\| ^2&=c\left( \varDelta n^{k+1},3n^{k+1}-4n^k+n^{k-1}\right) \nonumber \\&\quad -\left( H(n^*)W^{k+1},3n^{k+1}-4n^k+n^{k-1}\right) \nonumber \\&\quad -Q\left( V^{k+1},3n^{k+1}-4n^k+n^{k-1}\right) . \end{aligned}$$
(37)

By taking the \(L^2\) inner product of (33) with \(W^{k+1}\), we get

$$\begin{aligned} \left( 3W^{k+1}-4W^k+W^{k-1},W^{k+1}\right) = \frac{1}{2}H(n^*)\left( 3n^{k+1}-4n^k+n^{k-1},W^{k+1}\right) , \end{aligned}$$

and then by applying the following identity

$$\begin{aligned} 2(3a-4b+c,a)=|a|^2-|b|^2+|2a-b|^2-|2b-c|^2+|a-2b+c|^2, \end{aligned}$$

we derive

$$\begin{aligned}&\left\| W^{k+1}\right\| ^2-\left\| W^k\right\| ^2 +\left\| 2W^{k+1}-W^k\right\| ^2-\left\| 2W^k-W^{k-1}\right\| ^2\nonumber \\&\quad +\,\left\| W^{k+1}-2W^k+W^{k-1}\right\| ^2 =\left( H(n^*)W^{k+1},3n^{k+1}-4n^k+n^{k-1}\right) . \end{aligned}$$
(38)

By taking the simple multiplication of (34) with \(QV^{k+1}\) and applying (38), we have

$$\begin{aligned}&\frac{Q}{2}\left( (V^{k+1})^2-(V^k)^2+(2V^{k+1}-V^k)^2-(2V^k-V^{k-1})^2\right. \nonumber \\&\left. \qquad +\,(V^{k+1}-2V^k+V^{k-1})^2\right) =Q\left( V^{k+1},3n^{k+1}-4n^k+n^{k-1}\right) . \end{aligned}$$
(39)

Combination of (37), (38) and (39) gives us

$$\begin{aligned}&\frac{c}{2}\Big (\left\| \nabla n^{k+1}\right\| ^2-\left\| \nabla n^{k}\right\| ^2+\left\| 2\nabla n^{k+1}-\nabla n^k\right\| ^2-\left\| 2\nabla n^{k}-\nabla n^{k-1}\right\| ^2\\&\qquad +\,\left\| \nabla n^{k+1}-2\nabla n^k+\nabla n^{k-1}\right\| ^2\Big )+\Big (\left\| W^{k+1}\right\| ^2 -\left\| W^k\right\| ^2+\left\| 2W^{k+1}-W^k\right\| ^2\\&\qquad -\,\left\| 2W^k-W^{k-1}\right\| ^2+\left\| W^{k+1}-2W^k+W^{k-1}\right\| ^2\Big )\\&\qquad +\,\frac{Q}{2}\left( (V^{k+1})^2-(V^k)^2+(2V^{k+1}-V^k)^2\right. \\&\left. \qquad -\,(2V^k-V^{k-1})^2+(V^{k+1}-2V^k+V^{k-1})^2\right) \\&\quad \qquad =-\frac{1}{2\delta t}\left\| 3n^{k+1}-4n^k+n^{k-1}\right\| ^2, \end{aligned}$$

i.e.,

$$\begin{aligned}&\frac{c}{2}\left( \left\| \nabla n^{k+1}\right\| ^2+\left\| 2\nabla n^{k+1}-\nabla n^k\right\| ^2+\left\| \nabla n^{k+1}-2\nabla n^k+\nabla n^{k-1}\right\| ^2\right) \nonumber \\&\qquad +\,\left\| W^{k+1}\right\| ^2+\left\| 2W^{k+1}-W^k\right\| ^2+\left\| W^{k+1}-2W^k+W^{k-1}\right\| ^2\nonumber \\&\qquad +\,\frac{Q}{2}\left( (V^{k+1})^2+(2V^{k+1}-V^k)^2+(V^{k+1}-2V^k+V^{k-1})^2\right) \nonumber \\&\qquad =\frac{c}{2}\left( \left\| \nabla n^{k}\right\| ^2+\left\| 2\nabla n^{k}-\nabla n^{k-1}\right\| ^2\right) +\left\| W^k\right\| ^2+\left\| 2W^k-W^{k-1}\right\| ^2\nonumber \\&\qquad +\,\frac{Q}{2}\left( (V^k)^2+(2V^k-V^{k-1})^2\right) -\frac{1}{2\delta t}\left\| 3n^{k+1}-4n^k+n^{k-1}\right\| ^2. \end{aligned}$$
(40)

Then, we dropping some positive terms from above Eq. (40) to obtain the discrete energy law (36). \(\square \)

Remark 1

Heuristically, the discrete energy law (36) is a second order approximation of \(\frac{d}{dt}E(n,W,V)\) in (20) for any variable Z, we have

$$\begin{aligned}&\frac{\left\| Z^{k+1}\right\| ^2+\left\| 2Z^{k+1}-Z^{k}\right\| ^2}{2\delta t}-\frac{\left\| Z^{k}\right\| ^2+\left\| 2Z^{k}-Z^{k-1}\right\| ^2}{2\delta t}\\&\qquad \cong \frac{\left\| Z^{k+2}\right\| ^2-\left\| Z^{k}\right\| ^2}{2\delta t} + o(\delta t^2)\cong \frac{d}{dt}\left\| Z(t^{k+1})\right\| ^2+ o(\delta t^2). \end{aligned}$$

4 Numerical Experiments

In all numerical examples, we consider the specie of isobutane (\(nC_4\)) in the domain \(\varOmega = (0, L)^d\) with \(L = 2.0\mathrm{E}{-}08\,\mathrm{m}\) and d denotes the dimension of the space. The critical properties and the normal boiling point of the specie are listed in Table 1 (see the “Appendix” for explanation of these parameters). The two linear schemes, the first order one (denoted by IEQ-1) and the second order one (denoted by IEQ-BDF2), will be thoroughly tested for solving the problem (13)–(15).

Table 1 Critical properties of isobutane (\(nC_4\))

4.1 Temporal Accuracy Test

We first present numerical experiments in the 2D space to demonstrate the temporal accuracy of the two numerical schemes. For the initial configuration, we adopt the case of single droplet—the liquid density of isobutane under a saturated pressure condition at the temperature 350K is imposed in the square subregion of \(\big (\frac{3L}{8},\frac{3L}{4}\big )^2\), and a saturated gas of isobutane under the same temperature is full of the rest of the domain. That is, about \(86\%\) is saturated gas, while the rest \(14\%\) of the total volume is saturated liquid.

Table 2 The \(L^{re}_2\) relative errors and temporal convergence of the approximate solutions for the molar density distribution at \(t=0.5\) produced by the IEQ-1 and IEQ-BDF2 schemes with the penalty parameter \(Q = 1.0\mathrm{E}{+}20\) on the uniform \(1024\times 1024 \) mesh

We perform the refinement test of the time step size (\(\delta t = 2.0\mathrm{E}{-}2, 1.0\mathrm{E}{-}2, \ldots , 1.5625\mathrm{E}{-}4\)) for both the IEQ-1 and IEQ-BDF2 schemes, and choose the approximate solution obtained by applying the schemes with the small time step size \(\delta t = 1.0\mathrm{E}{-}6\) as the benchmark solution for computing errors. The penalty parameter is set to be \(Q = 1.0\mathrm{E}{+}20\). The spatial discretization is carried out using the central finite difference on the uniform \(1024\times 1024\) mesh of the domain \(\varOmega \) to remove the effect caused by the errors of spatial discretization. Define the \(L^{re}_2\) relative error of the approximate solution for the molar density n by

$$\begin{aligned} L^{re}_2=\frac{||n_{*}-n_{h}||}{||n_{*}||} \end{aligned}$$

where \(n_{*}\) denotes the benchmark solution and \(n_{h}\) the numerical solution. Table 2 lists the \(L^{re}_2\) relative errors and convergence rates of the numerical solutions at \(t=0.5\) with different time step sizes. It is easy to see that both the IEQ-1 and IEQ-BDF2 schemes work very stably for all time step sizes and show almost perfect first order and second order accurate respectively. In addition, the second order scheme IEQ-BDF2 gives much better accuracy than the first order scheme IEQ-1 does along the time step size refinement.

4.2 Dynamical Evolution of the Molar Density Distribution and the Gas–Liquid Interface

We next will numerically investigate the time evolution of the molar density distribution and the gas–liquid interface under the gradient flow in 2D and 3D spaces. There is a large gradient contribution to the total Helmholtz free energy due to the jump in molar density between the liquid and gas regions.

Fig. 1
figure 1

The simulated dynamical evolution of the molar density distribution for the case of single droplet in the 2D space. The snapshots are taken at the times \(t = 0, 1, 3, 5, 10, 20\), respectively

Fig. 2
figure 2

The simulated surface tension contribution of Helmholtz free energy density for the case of single droplet in the 2D space at the times \(t = 0, 1, 3, 5, 10, 20\), respectively

Fig. 3
figure 3

Plots of evolution of the total energy and the mass for the case of single droplet in the 2D space, simulated by the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\)

Fig. 4
figure 4

The simulated dynamical evolution of the molar density distribution for the case of four droplets in the 2D space. The snapshots are taken at the times \(t = 0, 5, 10, 20, 40, 50\), respectively

4.2.1 2D Examples

We first perform some experiments in the 2D space. We use the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\) and a uniform mesh of \(512\times 512\) and set the penalty parameter Q = 1.0E+20. Figure 1 presents the simulated molar density distribution for the single-droplet case at different times (\(t = 0, 1, 3, 5, 10, 20\), respectively) during the evolution. We can see that the shape of the droplet for the liquid is initially square, but its four corners are slowly rounded as the time increases, and finally becomes a perfect circle. At the time \(t = 20\) the steady state seems to be reached. As suggested in [22], the surface tension contribution of Helmholtz free energy density, \(f_{\text {ST}}\), is defined by

$$\begin{aligned} f_{\text {ST}}= 2f_\nabla (n)=c\nabla n\cdot \nabla n, \end{aligned}$$
(41)

which can be used to better characterize the gas–liquid interface. The plots of the simulated surface tension contribution of Helmholtz free energy density at the same times are thus shown in Fig. 2, and we can clearly see the configuration of the interface and its changes along with the time. The corresponding plots of evolution of the total energy (8) and the mass are given in Fig. 3. We observe that the energy decreases monotonically and the mass is accurately maintained with respect to the time. The energy decay is very fast initially then slows down as the solution approaches its steady state.

Fig. 5
figure 5

The simulated surface tension contribution of Helmholtz free energy density for the case of four droplets in the 2D space at the times \(t = 0, 5, 10, 20, 40, 50\), respectively

Fig. 6
figure 6

Plots of evolution of the total energy and the mass for the case of four droplets in the 2D space, simulated by the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\)

Fig. 7
figure 7

The simulated dynamical evolution of the molar density distribution for the case of single droplet in the 3D space. The snapshots are taken at the times \(t = 0, 1, 3, 5, 10, 20\), respectively. In each time panel, the top one represents the approximate solution across the three central planes of the 3D cubic domain and the bottom one the isosurface

Fig. 8
figure 8

Plots of evolution of the total energy and the mass for the case of single droplet in the 3D space, simulated by the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\)

Next, we simulate the dynamical evolution of the molar density distribution for the case of having four droplets in the initial configuration—the liquid density of isobutane under a saturated pressure condition at the temperature 350 K in the subregion of four squares \(\left\{ \big (\frac{L}{4},\frac{L}{2}\big ), \big (\frac{5L}{8},\frac{7L}{8}\big )\right\} ^2\), and a saturated gas of isobutane under the same temperature is full of the rest of the domain. We still use the IEQ-BDF2 scheme with the same settings as in the previous single droplet case. Figure 4 presents the simulated molar density distribution of Helmholtz free energy density for the case of four droplets at different times (\(t = 0, 5,10, 20, 40, 50,\) respectively) during the evolution, and Fig. 5 the surface tension contribution of Helmholtz free energy density at the same times. The steady state seems reached at the time \(t=50\), which is longer than that needed for the single droplet case. We observe that the shapes of the four droplets are square initially, then four corners of all droplets are slowly rounded to become four circles as the time increases, and next the four circular droplets start to merge together and finally form one bigger circle. Figure 6 plots the evolution of the total energy and the mass, and again it is observed that the energy decreases monotonically and the mass is accurately maintained along the time. In the case we also find that there is a quite large energy decay at the very early time and another small energy decay around the time interval [20, 30] during the whole evolution process.

We remark that extra experiments with a smaller time step size \(\delta t = 0.001\) and a larger penalty parameter \(Q = 1.0\mathrm{E}{+}21\) for the above examples are also carried out to make sure the convergence of the numerical solutions, and very similar simulation results are obtained for both the single droplet and four droplets cases.

4.2.2 3D Examples

Now we carry out some experiments to simulate the dynamics of the molar density distribution in the 3D space. We use the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\) and a uniform mesh of \(128\times 128\times 128\) and set the penalty parameter \(Q = 1.0\mathrm{E}{+}30\). We first test using a single droplet as the initial condition—the liquid density of isobutane under a saturated pressure condition at the temperature 350 K in the cube subregion of \((\frac{3L}{8},\frac{3L}{4})^3\), and under the same temperature the rest of the cube is filled with a saturated gas of isobutane. Figure 7 presents the simulated molar density distribution for the single droplet case in the 3D space at different times (\(\mathrm{t} = 0, 1, 3, 5, 10, 20\), respectively) during the evolution. We observe that the 3D dynamical behaviors are very consistent with that of the single droplet case in the 2D space, and the droplet finally forms a perfect sphere around the time \(t = 20\), which is the steady state. Figure 8 plots the evolution of the total energy and the mass along the time, and we again observe that the energy monotonically decays and the mass are well preserved with respect to time.

For the next example in the 3D space, the initial configuration is taken to be eight droplets—the liquid density of isobutane at 350 K in the subregion of eight cubes \(\left\{ \big (\frac{L}{4},\frac{L}{2}\big ), \big (\frac{5L}{8},\frac{7L}{8}\big )\right\} ^3\), and at the same temperature the rest of the domain is filled with a saturated gas of isobutane under a saturated pressure condition. Figure 9 presents the simulated molar density distribution for the eight droplet case in the 3D space at different times (\(t = 0, 5, 10, 20, 40, 50\), respectively) during the evolution. The eight cubic droplets first evolve into eight separate spheres, then start to merge and finally form one bigger sphere around the time \(t = 50\). This dynamic process is very similar to that for the four droplets case in the 2D space. In Fig. 10, we present the evolution of the total energy and the mass with respect to the time, and observe again that the energy monotonically decays and the mass always keeps constant.

Fig. 9
figure 9

The simulated dynamical evolution of the molar density distribution for the case of eight droplets in the 3D space. The snapshots are taken at the times \(t = 0, 5, 10, 20, 40, 50\), respectively. In each time panel, the top one represents the approximate solution across the three central planes of the 3D cubic domain and the bottom one the isosurface

Fig. 10
figure 10

Plots of evolution of the total energy and the mass for the case of eight droplets in the 3D space, simulated by the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\)

4.3 Computation of the Interface Tension and Verification Against the Young–Laplace Equation

As the quantity of interest in many applications, the surface tension \(\sigma \) is defined as the work for creating a unit area of interface with a unit of \(\mathrm{J/m}^2\) or the net contractive force per unit length of interface with a unit of N/m from the thermodynamical or mechanical point of view. In this model, the surface/interface tension \(\sigma \) is defined by

$$\begin{aligned} \sigma = \frac{{\partial {F}}}{\partial A}=\frac{F(n)-F_0(n_{initial})}{A}\cong \frac{\int _\varOmega f_{ST}d{{\mathbf {x}}}}{A}, \end{aligned}$$

where A is the area of the interface.

Let us assume that the mass of the liquid droplet does not change along with time and the steady state droplet has a perfect circular/spherical shape. For the single droplet case in the 2D space, the radius of the circular droplet is \(r=4.231\times 10^{-9}\,\mathrm{m}\). The surface tension of isobutane in the equilibrium state at the temperature ranging from 250 to 333.82 K are calculated by using the IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\) on the uniform mesh of \(512\times 512\) and the penalty parameter \(Q = 1.0\mathrm{E}{+}20\). For example, \(F(n)-F_0(n_{initial})\cong 2.229\times 10^{-10}\,\mathrm{J}\) at the temperature \(T=333.82\)K, and the corresponding interface tension is \(\sigma =8.384\times 10^{-3}\,\mathrm{J/m}^2\) by our simulation. The complete results are presented in left panel of Fig. 11 together with the laboratory measured values provided in [19]. From the engineering point of view, it is clear that the differences between the numerical results and the experimental data is small.

Based on the values of the surface tension, we can test another physically concerned quality, the capillary pressure \(P_c\), which defined by the well-known Young–Laplace equation

$$\begin{aligned} P_c = P_{liquid} - P_{gas} \approx \frac{\sigma }{r}, \end{aligned}$$
(42)

where the thermodynamic pressure for the liquid \(P_{liquid}\) or the gas \(P_{gas}\) is defined by

$$\begin{aligned} P= \frac{nRT}{1-bn}-\frac{n^2a(T)}{1+2bn-b^2n^2}. \end{aligned}$$
(43)

According to the Eq. (42), there are two different ways to numerically calculate the capillary pressure, one is to adopt the difference between the liquid drop pressure and the pressure of the gas phase and the other is to apply the numerical results obtained for the interface tension \(\sigma \). For example, at the temperature 333.28 K, \(P_{liquid}=2.634\times 10^6\)Pa and \(P_{gas}=0.701\times 10^6\) Pa, thus the difference is \(P_c=1.933\times 10^6\) Pa. On the other hand, the capillary pressure obtained from the approximated interface tension is \(P_c=\frac{\sigma }{r}=1.981\times 10^6\) Pa. It is clear that the Young–Laplace prediction is well matched with the capillary pressure obtained by our numerical schemes with about an error of \(2\%\). The right panel of Figure 11 plots the capillary pressure from 250 to 333.82 K, which are calculated by above two ways. The matching errors are all about or smaller than \(2\%\) at tested temperatures (similar to the results obtained by the convex splitting schemes [16]). In this case, the diffuse interface model with Peng–Robinson equation of state and the proposed numerical schemes are physically reliable to be used to simulate the two-phase fluid of the substance isobutane (nC4).

Fig. 11
figure 11

Comparison between the numerical predictions and the laboratory data in the 2D space. Left: interface tension; Right: capillary pressure

We next use the results from the single droplet case in the 3D space to compare with the laboratory data. The IEQ-BDF2 scheme with \(\delta t = 5.0\mathrm{E}{-}3\) on the uniform mesh of \(128\times 128\times 128\) and the penalty parameter \(Q = 1.0\mathrm{E}{+}30\) is used for all simulations, and the results are given in Fig. 12. The simulated interface tensions at all tested temperatures still match the laboratory data from the engineering point of view. For the capillary pressure, the results calculated from the Young–Laplace equation are close to those obtained from the approximate interface tensions when the temperature is in the high end of the [250, 333.28], but the difference becomes larger and larger along with the decreasing of the temperature. This issue on the capillary pressure may be worthy of further investigation from the modeling side on the causes.

Fig. 12
figure 12

Comparison between the numerical predictions and the laboratory data in the 3D space. Left: interface tension; Right: capillary pressure

5 Conclusions

In this paper, we design a first order and a second order schemes for temporal discretization of the diffusive interface model with Peng–Robinson equation of state based on the IEQ approach; in particular, the single-component two-phase fluid system is specially considered. These schemes are based on the recently developed “Invariant Energy Quadratization” approach and the penalty formulation, and are accurate (up to the second order), unconditionally energy stable, and easy to implement in practice. Moreover, the resulted semilinear system in space at each time step is proven to be symmetric positive definite so that one can implement the Krylov subspace approaches to solve such system effectively and efficiently. Numerical experiments in 2D and 3D spaces are also performed to demonstrate the accuracy and stability of the proposed schemes and to investigate reliability of the target model by comparisons with laboratory data. We also would like to point out that since the IEQ system is not strictly equal to the original system in the discrete sense, in particular, the dissipative energy, it would not be an easy work to prove error estimates for the proposed numerical schemes as done for the convex-splitting method. This is an interesting open problem worthy of further investigation. Another of our future work is to generalize the method to the diffusive interface model for multi-component and multi-phase fluid system.