1 Introduction

The classical Cahn–Hilliard (CH) equation was derived by Cahn and Hilliard to model the dynamics of binary mixture [1]. One of the important applications of the CH equation is to model spinodal decomposition, which is a basic mechanism for the phase separation occurring in binary mixture. Moreover, the CH model can be used to simulate the binary fluid flows [2], vesicle membrane [3], diblock copolymer [4], etc. Two basic physical properties of the CH equation are the energy dissipation and mass conservation. Naturally, we want to keep these basic properties in discrete equations even if a larger time step is used when we numerically solve the CH equation.

The well-known convex splitting method proposed by Eyre [5] is a popular method to achieve unconditional energy stability, which can be theoretically proved to satisfy the energy dissipation for all time steps. Lee and Shin [6] developed an unconditionally stable fourth-order space-accurate method for the CH equation using the convex splitting method. Although the classical convex splitting scheme has the advantages of unique solvability and unconditional stability, it only has first-order time accuracy in general. Furihata and Matsuo [7] proposed a stable and linear scheme for the CH equation based on the finite difference approximation. Appadu et al. [8] studied the finite volume approximation for the 2D CH equation with convective effect. Zhao and Liu [9] investigated the existence of global attractor for viscous CH model. Comparing with the first-order methods, the second-order time-accurate methods become increasingly important and necessary in recent years. Li et al. [10] developed the temporally second-order compact finite difference method for the three-dimensional CH equation using the BDF2 scheme. Zhang and Qiao [11] proposed temporally second-order accurate, adaptive time-stepping method for the CH equation. Later, Luo et al. [12] developed a parameter-free time adaptive method for the CH equation. Li and Qiao [13] studied temporally second-order accurate Fourier spectral method for the two-dimensional CH models. Guillén-González and Tierra [14] proposed a typical Lagrange multiplier approach for the binary CH equation, which can easily achieve second-order accuracy for a system with double-well potential. Based on the typical Lagrange multiplier approach, some scholars recently developed invariant energy quadratization (IEQ) method [15] and scalar auxiliary variable (SAV) method [16] for gradient flows with complex nonlinear potentials. In a recent work of Li et al. [17], a second-order, unconditionally stable, linear scheme was developed based on the Crank–Nicolson (CN) scheme. The methods using the Runge–Kutta (RK) type scheme have also been studied by many researchers [18, 19]. Note that the above-mentioned numerical schemes are famous and practical for the binary CH equation.

In practical problems, the ternary CH system has many applications. Some typical examples are the ternary alloys [20], the ternary fluid flows [2124], phase evolution in complex domains [25], and the cell division [26]. Recently, the multi-component CH model has also been used in multi-component volume reconstruction [27]. Therefore, it is useful to develop accurate and practical numerical schemes for the ternary CH system. A practically unconditionally stable scheme was proposed by Lee et al. [28] which only has first-order accuracy in time. Recently, Yang and Kim [29] developed a linear and unconditionally stable scheme for the multi-component CH equations with second-order accuracy. In their work, a truncated potential functional was needed to satisfy the unconditional energy stability in the proof.

In this study, we extend the Lagrange multiplier approach to a ternary CH model and develop a second-order accurate, energy stable, and linear numerical scheme. Unlike the proof in the previous research [29], the present energy estimation can be easily obtained without any artificial truncated potential. Another primary advantage of the proposed scheme is that it can be easily applied to an arbitrary multi-component CH system. To the best of our knowledge, this is the first work focusing on the Lagrange multiplier approach for the present ternary CH model.

The rest of this research is organized as follows. We describe the ternary CH system in Sect. 2. In Sect. 3, we present the proposed numerical scheme and theoretically prove the mass conservation, energy stability, and unique solvability. In Sect. 4, we briefly introduce the numerical solution algorithm. We perform various computational experiments in Sect. 5. Conclusions are given in Sect. 6.

2 Governing Equations

Let us consider a ternary system in a domain \(\Omega \). Let \(c_{k} = c_{k}({\mathbf {x}},t)\) be the concentration of the \(k\)th phase field at space \({\mathbf {x}}\) and time \(t\). The summation of the concentrations satisfies the following equation:

$$\begin{aligned} c_{1} + c_{2} + c_{3} = 1. \end{aligned}$$
(1)

Let \({\mathbf {c}} = (c_{1}, c_{2}, c_{3})\), then \({\mathbf {c}} \in G_{s}\), where

$$\begin{aligned} G_{s} = \left \{ {\mathbf {c}} \in {\mathbb{R}}^{3}~\middle \vert~ \sum \limits ^{3}_{k=1} c_{k} = 1,~0 \le c_{k} \le 1~\mbox{for}~k = 1, 2, 3, \right \} . \end{aligned}$$
(2)

Let us define the total free energy functional of the ternary system:

$$\begin{aligned} \mathcal{E}({\mathbf {c}}) = \int _{\Omega } \left ( \sum \limits ^{3}_{k=1} F(c_{k}) + \frac{\epsilon ^{2}}{2} \sum \limits ^{3}_{k=1} |\nabla c_{k}|^{2} \right ) \mathrm{d}{\mathbf {x}}, \end{aligned}$$
(3)

where \(F(c_{k}) = 0.25c^{2}_{k}(c_{k}-1)^{2}\) and \(\epsilon \) is a constant. Note this kind of energy functional has been extensively used for various ternary physical systems [22, 28, 3032]. Although Eq. (3) does not contain the effect of surface tension, this energy functional can be easily extended to construct \(N\)-component (\(N > 3\)) phase-field systems. Instead, the effect of surface tension can be added into the momentum equation as external forces if we consider the multi-phase flow systems. Refer to [28, 29, 33, 34] for some successful applications. The governing equation of \(c_{k}\) is given by the ternary CH system [28]:

$$\begin{aligned} \frac{\partial c_{k}}{\partial t} =& M\Delta \mu _{k}, \end{aligned}$$
(4)
$$\begin{aligned} \mu _{k} =& F'(c_{k}) - \epsilon ^{2} \Delta c_{k} + \beta ({\mathbf {c}}), ~\mbox{for}~ k = 1, 2, 3, \end{aligned}$$
(5)

where \(M\) is the mobility and we set \(M = 1\) for convenience, \(\mu _{k}\) is the chemical potential, \(F'(c_{k}) = c_{k}^{3} - 1.5c_{k}^{2} + 0.5c_{k}\), \(\beta ({\mathbf {c}}) = -\frac{1}{3} \sum \limits ^{3}_{k=1} F'(c_{k})\). By taking the differentiations of \(\mathcal{E}({\mathbf {c}})\) and \(\int _{\Omega }c_{k} \mathrm{d}{\mathbf {x}}\) with respect to time \(t\), we have

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\mathcal{E}({\mathbf {c}}) =& \int _{\Omega }\sum \limits ^{3}_{k=1} \left ( \frac{\partial F({\mathbf {c}})}{\partial t} \frac{\partial c_{k}}{\partial t} + \epsilon ^{2} \nabla c_{k} \cdot \nabla \frac{\partial c_{k}}{\partial t} \right ) \mathrm{d}{\mathbf {x}} \\ =& \int _{\Omega }\sum \limits ^{3}_{k=1} \frac{\partial F({\mathbf {c}})}{\partial t} \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} + \int _{ \partial \Omega } \sum \limits ^{3}_{k=1} \epsilon ^{2} \nabla c_{k} \cdot {\mathbf {n}} \frac{\partial c_{k}}{\partial t} \mathrm{d}s - \int _{ \Omega } \sum \limits ^{3}_{k=1} \epsilon ^{2} \Delta c_{k} \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} \\ =& \int _{\Omega } \sum \limits ^{3}_{k=1} \left ( \frac{\partial F({\mathbf {c}})}{\partial c_{k}} - \epsilon ^{2} \Delta c_{k} \right ) \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} = \int _{ \Omega } \sum \limits ^{3}_{k=1} \left ( \mu _{k} - \beta ({\mathbf {c}}) \right ) \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} \\ =& \int _{\Omega } \sum \limits ^{3}_{k=1} \mu _{k} \Delta \mu _{k} \mathrm{d}{\mathbf {x}} - \beta ({\mathbf {c}})\int _{\Omega } \sum \limits ^{3}_{k=1} \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} = -\int _{\Omega } \sum \limits ^{3}_{k=1} | \nabla \mu _{k} |^{2} \mathrm{d}{\mathbf {x}} \le 0 \end{aligned}$$
(6)

and

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \int _{\Omega } c_{k} \mathrm{d}{\mathbf {x}} = \int _{\Omega } \frac{\partial c_{k}}{\partial t} \mathrm{d}{\mathbf {x}} = \int _{\Omega } \Delta \mu _{k} \mathrm{d}{\mathbf {x}} = 0, \end{aligned}$$
(7)

where the periodic or the following homogeneous Neumann boundary conditions are considered

$$\begin{aligned} \nabla c_{k}\cdot {\mathbf {n}}|_{\partial \Omega } = \nabla \mu _{k}\cdot { \mathbf {n}}|_{\partial \Omega } = 0. \end{aligned}$$

Equations (6) and (7) imply the decrease of the total energy and the total mass conservation of each component, respectively.

3 Proposed Numerical Scheme for a Ternary CH System

In a previous study [14], the authors introduced a Lagrange multiplier-type auxiliary variable \(q\). This new variable is used to replace the polynomial in a nonlinear term. For example, the nonlinear term of a binary CH model is \(F(\phi ) = 0.25(\phi ^{2}-1)^{2}\). Let \(q = \phi ^{2}-1\), then the nonlinear term is modified to be \(F(q) = 0.25q^{2}\). In the ternary CH model, a nonlinear term is \(F(c_{k}) = 0.25c^{2}_{k}(c_{k}-1)^{2}\) and we define a Lagrange multiplier-type variable \(q_{k}\) as \(q_{k} = c_{k}(c_{k}-1)\), thus the double-well potential can be represented by \(F(q_{k}) = 0.25q^{2}_{k}\). Equations (4)–(5) can be rewritten as

$$\begin{aligned} \frac{\partial c_{k}}{\partial t} =& \Delta \mu _{k}, \end{aligned}$$
(8)
$$\begin{aligned} \mu _{k} =& -\epsilon ^{2} \Delta c_{k} + q_{k} c_{k} - \frac{1}{2} q_{k} + \beta ({\mathbf {c}}) , \end{aligned}$$
(9)
$$\begin{aligned} \frac{\partial q_{k}}{\partial t} =& \left ( 2c_{k} - 1 \right ) \frac{\partial c_{k}}{\partial t},~\mbox{for}~k = 1, 2, 3, \end{aligned}$$
(10)

where \(\beta ({\mathbf {c}}) = -c_{1}c_{2}c_{3}\). The original energy, Eq. (3) is recast to be the following form

$$\begin{aligned} \mathcal{E}({\mathbf {c}},{\mathbf {q}}) = \int _{\Omega } \left ( 0.25\sum \limits ^{3}_{k=1} q^{2}_{k} + \frac{\epsilon ^{2}}{2} \sum \limits ^{3}_{k=1} |\nabla c_{k}|^{2} \right ) \mathrm{d}{\mathbf {x}}, \end{aligned}$$
(11)

where the periodic or the following homogeneous Neumann boundary conditions are considered

$$\begin{aligned} \nabla c_{k}\cdot {\mathbf {n}}|_{\partial \Omega } = \nabla \mu _{k}\cdot { \mathbf {n}}|_{\partial \Omega } = 0. \end{aligned}$$

We next describe the spatial discretization in two-dimensional domain \(\Omega = (a,b)\times (c,d)\). Let \(\Omega _{d} = \{(x_{i},y_{j}):~x_{i} = a + (i-0.5)h,~y_{j} = c + (j-0.5)h,~1\le i \le N_{x},~1\le j \le N_{y} \} \) be the discrete computational domain. Here, \(h = (b-a)/N_{x} = (d-c)/N_{y}\); and \(N_{x}\) and \(N_{y}\) are positive even integers. Let \(c_{k,ij}^{n}\), \(\mu _{k,ij}^{n}\), and \(q_{k,ij}^{n}\) be approximations of \(c_{k}(x_{i},y_{j},t^{n})\), \(\mu _{k}(x_{i},y_{j},t^{n})\), and \(q_{k}(x_{i},y_{j},t^{n})\), respectively. Here, \(t^{n} = n\Delta t\) where \(\Delta t\) is the uniform time step, \(1 \le n \le N_{t}\) and \(N_{t}\) is the total number of temporal evolutions. The final time is \(T = N_{t} \Delta t\). The linear, second-order accurate, fully discrete scheme based on a variant of BDF2 approximation is given to be

$$\begin{aligned} \frac{3c^{n+1}_{k,ij} - 4c^{n}_{k,ij} + c^{n-1}_{k,ij}}{2\Delta t} =& \Delta _{d} \mu ^{n+1}_{k,ij}, \end{aligned}$$
(12)
$$\begin{aligned} \mu ^{n+1}_{k,ij} =& -\epsilon ^{2} \Delta _{d} c^{n+1}_{k,ij} + q^{n+1}_{k,ij} \left ( 2c^{n}_{k,ij} - c^{n-1}_{k,ij} \right ) - \frac{1}{2}q^{n+1}_{k,ij} \\ & + 2\beta \left ( {\mathbf {c}}^{n}_{ij} \right ) - \beta \left ( {\mathbf {c}}^{n-1}_{ij} \right ), \end{aligned}$$
(13)
$$\begin{aligned} \frac{3q^{n+1}_{k,ij} - 4q^{n}_{k,ij} + q^{n-1}_{k,ij}}{2\Delta t} =& \left [ 2\left ( 2c^{n}_{k,ij} - c^{n-1}_{k,ij} \right ) - 1\right ] \frac{3c^{n+1}_{k,ij}-4c^{n}_{k,ij}+c^{n-1}_{k,ij}}{2\Delta t}, \\ &~\mbox{for}~k = 1, 2, 3, \end{aligned}$$
(14)

where superscripts \(n+1\), \(n\), and \(n-1\) represent different time levels. \(\Delta _{d}\) is a discrete Laplacian operator. For example, \(\Delta _{d} \mu _{k,ij} = (\mu _{k,i+1,j}+\mu _{k,i-1,j}+\mu _{k,i,j+1}+ \mu _{k,i,j-1}-4\mu _{k,ij})/h^{2}\). We define two discrete inner products:

$$\begin{aligned} \left ( \phi , \varphi \right )_{d} = h^{2} \sum \limits ^{N_{x}}_{i=1} \sum \limits ^{N_{y}}_{j=1} \phi _{ij} \varphi _{ij} \end{aligned}$$
(15)

and

$$\begin{aligned} \langle \nabla _{d} \phi , \nabla _{d} \varphi \rangle _{d} =& h^{2} \left ( \sum \limits ^{N_{x}-1}_{i=1} \sum \limits ^{N_{y}}_{j=1} D_{x} \phi _{i+\frac{1}{2},j}D_{x} \varphi _{i+\frac{1}{2},j} + \sum \limits ^{N_{x}}_{i=1} \sum \limits ^{N_{y}-1}_{j=1} D_{y} \phi _{i,j+ \frac{1}{2}}D_{y} \varphi _{i,j+\frac{1}{2}} \right ) \\ & +\frac{h^{2}}{2} \sum \limits ^{N_{y}}_{j=1}D_{x} \phi _{ \frac{1}{2},j}D_{x} \varphi _{\frac{1}{2},j} + \frac{h^{2}}{2} \sum \limits ^{N_{y}}_{j=1}D_{x} \phi _{N_{x}+\frac{1}{2},j}D_{x} \varphi _{N_{x}+ \frac{1}{2},j} \\ & + \frac{h^{2}}{2} \sum \limits ^{N_{x}}_{i=1} D_{y} \phi _{i, \frac{1}{2}}D_{y} \varphi _{i,\frac{1}{2}} + \frac{h^{2}}{2} \sum \limits ^{N_{x}}_{i=1} D_{y} \phi _{i,N_{y}+\frac{1}{2}}D_{y} \varphi _{i,N_{y}+\frac{1}{2}}, \end{aligned}$$
(16)

where the discrete differentiation operators \(D_{x} \phi _{i+\frac{1}{2},j}\) and \(D_{y} \phi _{i,j+\frac{1}{2}}\) are defined by

$$\begin{aligned} D_{x} \phi _{i+\frac{1}{2},j} = \frac{1}{h}\left ( \phi _{i+1,j} - \phi _{ij} \right ),~D_{y} \phi _{i,j+\frac{1}{2}} = \frac{1}{h} \left ( \phi _{i,j+1} - \phi _{ij} \right ). \end{aligned}$$
(17)

For simplicity of exposition, we omit the spatial indexes. The discrete norms are defined as \(\| \phi \|^{2}_{d} = \left ( \phi ,\phi \right )_{d}\) and \(\| \nabla _{d} \phi \|^{2}_{d} = \langle \nabla _{d} \phi , \nabla _{d} \phi \rangle _{d}\).

3.1 Mass Conservation

The mass conservation is a basic property for each component in a ternary CH system. To prove \(\left ( c^{n+1}_{k}, {\mathbf {1}}\right )_{d} = \left ( c^{n}_{k}, {\mathbf {1}} \right )_{d}\), we take the discrete inner product for Eq. (12) and obtain

$$\begin{aligned} \left ( \frac{3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}}{2\Delta t}, {\mathbf {1}} \right )_{d} =& \Delta t \left ( \Delta _{d} \mu ^{n+1}_{k}, {\mathbf {1}} \right )_{d} \\ =& -\Delta t \left \langle \nabla _{d} \mu ^{n+1}_{k}, \nabla _{d}{ \mathbf {1}}\right \rangle _{d} = 0. \end{aligned}$$
(18)

Here, the periodic boundary condition or homogeneous Neumann boundary condition is used for \(\mu ^{n+1}_{k}\). Therefore, we obtain \((3c^{n+1}_{k}, {\mathbf {1}})_{d} = (4c^{n}_{k},{\mathbf {1}})_{d} - (c^{n-1}_{k}, {\mathbf {1}})_{d}\). Then, we have \((c^{n+1}_{k}, {\mathbf {1}})_{d} = (c^{n}_{k},{\mathbf {1}})_{d}\) if \((c^{n}_{k}, {\mathbf {1}})_{d} = (c^{n-1}_{k},{\mathbf {1}})_{d}\). Note that the proposed scheme in Eqs. (12)–(14) needs the information at \((n-1)\) time level, the first-order time-accurate backward Euler method is used as ignition step. In the Appendix, we briefly describe the fist-order scheme. By using the ignition step, we can easily obtain \((c^{1}_{k}, {\mathbf {1}})_{d} = (c^{0}_{k},{\mathbf {1}})_{d}\). For \(n = 1\), by using \((3c^{2}_{k}, {\mathbf {1}})_{d} = (4c^{1}_{k},{\mathbf {1}})_{d} - (c^{0}_{k}, { \mathbf {1}})_{d}\). Then, we can find that \((c^{2}_{k}, {\mathbf {1}})_{d} = (c^{1}_{k},{\mathbf {1}})_{d}\). By taking the chain of the equalities: \((c^{n+1}_{k}, {\mathbf {1}})_{d} = (c^{n}_{k}, {\mathbf {1}})_{d} = \cdots = (c^{0}_{k}, {\mathbf {1}})_{d}\). Thus, we have proved the conservation of mass for each component \(k\), which also implies the mass conservation of whole ternary system.

3.2 Energy Stability

Next, we prove that the proposed numerical method satisfies the energy stability for the whole system. The discrete energy functional for \(k\)th component at \(n+1\) time level is defined to be

$$\begin{aligned} \mathcal{E}^{d}(c^{n+1}_{k}) = \frac{\epsilon ^{2}}{2} \| \nabla _{d} c^{n+1}_{k} \|^{2}_{d} + \frac{1}{4} \| q^{n+1}_{k} \|^{2}_{d}. \end{aligned}$$
(19)

Because the BDF2 approximation contains the information at previous time levels, the energy law with respect to Eq. (19) is hard to derive. To obtain a reasonable energy estimation, we define the pseudo discrete energy functional for \(k\)th component at \(n+1\) and \(n\) time levels to be

$$\begin{aligned} \bar{\mathcal{E}}^{d}(c^{n+1}_{k},c^{n}_{k}) =& \frac{\epsilon ^{2}}{4} \left ( \|\nabla _{d} c^{n+1}_{k} \|^{2}_{d} + \|\nabla _{d} (2c^{n+1}_{k} - c^{n}_{k}) \|^{2}_{d} \right ) \\ &+ \frac{1}{8} \left ( \|q^{n+1}_{k}\|^{2}_{d} + \|2q^{n+1}_{k} - q^{n}_{k} \|^{2}_{d} \right ). \end{aligned}$$
(20)

Moreover, “pseudo” also means Eq. (20) is a modified discrete version of original energy because the computed value \(q^{n+1}_{k}\) may violate its definition, i.e., \(q_{k} = c_{k}(c_{k}-1)\) if large time steps are used. By taking the inner products of Eqs. (12)–(14) with \(\mu ^{n+1}_{k}\), \((3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k})/ (2\Delta t) \), and \(0.5 q^{n+1}_{k}\), respectively, we have the following inequality:

$$\begin{aligned} &\frac{\epsilon ^{2}}{2\Delta t}\left \langle \nabla _{d} c^{n+1}_{k}, \nabla _{d} \left ( 3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}\right ) \right \rangle _{d} + \frac{1}{4\Delta t} \left ( 3q^{n+1}_{k} -4q^{n}_{k} + q^{n-1}_{k}, q^{n+1}_{k} \right )_{d} \\ &+ \left ( 2\beta ({\mathbf {c}}^{n}) - \beta ({\mathbf {c}}^{n-1}), \frac{3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}}{2\Delta t} \right )_{d} = - \| \nabla _{d} \mu ^{n+1}_{k} \|^{2}_{d} \le 0. \end{aligned}$$
(21)

Then, we rewrite the inequality (21) as

$$\begin{aligned} &\frac{\epsilon ^{2}}{4\Delta t}\left [ 2\left \langle \nabla _{d} c^{n+1}_{k}, \nabla _{d} \left ( 3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}\right ) \right \rangle _{d} \right ] + \frac{1}{8\Delta t} \left [ 2\left ( 3q^{n+1}_{k} -4q^{n}_{k} + q^{n-1}_{k}, q^{n+1}_{k} \right )_{d} \right ] \\ &+ \left ( 2\beta ({\mathbf {c}}^{n}) - \beta ({\mathbf {c}}^{n-1}), \frac{3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}}{2\Delta t} \right )_{d} = - \| \nabla _{d} \mu ^{n+1}_{k} \|^{2}_{d} \le 0. \end{aligned}$$
(22)

Using the following identity for \(c_{k}\): \(2(c_{k}^{n+1},3c_{k}^{n+1}-4c_{k}^{n}+c_{k}^{n-1})_{d} = \|c_{k}^{n+1} \|_{d}^{2} + \|2c_{k}^{n+1}-c_{k}^{n}\|_{d}^{2} + \|c_{k}^{n+1}-2c_{k}^{n} + c_{k}^{n-1}\|_{d}^{2} - \|c_{k}^{n}\|_{d}^{2} - \|2c_{k}^{n} - c_{k}^{n-1} \|_{d}^{2}\), this relationship for \(q_{k}\) is defined in a same way. The inequality (22) can be written to be

$$\begin{aligned} &\frac{\epsilon ^{2}}{4} \Big[ \|\nabla _{d} c^{n+1}_{k} \|^{2}_{d} + \|\nabla _{d}( 2c^{n+1}_{k} - c^{n}_{k})\|^{2}_{d} - \left ( \| \nabla _{d} c^{n}_{k} \|^{2}_{d} + \| \nabla _{d} ( 2c^{n}_{k} - c^{n-1}_{k}) \|^{2}_{d} \right ) \\ & + \| \nabla _{d}( c^{n+1}_{k}-2c^{n}_{k}+c^{n-1}_{k})\|^{2}_{d} \Big] + \frac{1}{8}\Big[ \|q^{n+1}_{k}\|^{2}_{d} + \|2q^{n+1}_{k} - q^{n}_{k} \|^{2}_{d} - \left ( \|q^{n}_{k}\|^{2}_{d} + \|2q^{n}_{k}-q^{n-1}_{k} \|^{2} \right ) \\ & + \| q^{n+1}_{k} - 2q^{n}_{k} + q^{n-1}_{k} \|^{2}_{d} \Big] + \Delta t\left ( 2\beta _{d}({\mathbf {c}}^{n}) - \beta _{d}({\mathbf {c}}^{n-1}), \frac{3c^{n+1}_{k} - 4c^{n}_{k} + c^{n-1}_{k}}{2\Delta t} \right )_{d} \\ & = -\Delta t\|\nabla _{d} \mu ^{n+1}_{k} \|^{2}_{d} \le 0. \end{aligned}$$
(23)

Note that \(\bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n+1}, {\mathbf {c}}^{n}\right ) = \sum \limits ^{3}_{k=1} \bar{\mathcal{E}}^{d}\left ( c^{n+1}_{k}, c^{n}_{k} \right )\), then we need to show \(\bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n+1}, {\mathbf {c}}^{n}\right ) \le \bar{\mathcal{E}}^{d} \bigl( {\mathbf {c}}^{n}, {\mathbf {c}}^{n-1} \bigr)\). Since

$$\begin{aligned} &\Delta t\left ( 2\beta ({\mathbf {c}}^{n}) - \beta ({\mathbf {c}}^{n-1}), \sum \limits ^{3}_{k=1} \frac{3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}}{\Delta t}\right )_{d} \\ &= \Delta t\left ( 2\beta ({\mathbf {c}}^{n}) - \beta ({\mathbf {c}}^{n-1}), \frac{3\sum \limits ^{3}_{k=1}c^{n+1}_{k}-4\sum \limits ^{3}_{k=1}c^{n}_{k}+\sum \limits ^{3}_{k=1}c^{n-1}_{k}}{\Delta t} \right )_{d} = 0, \end{aligned}$$
(24)

where the condition \(c_{1} + c_{2} + c_{3} = 1\) is used. Therefore, we have

$$\begin{aligned} &\bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n+1}, {\mathbf {c}}^{n}\right ) - \bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n}, {\mathbf {c}}^{n-1}\right ) \\ &= -\Delta t \sum \limits ^{3}_{k=1} \| \nabla _{d} \mu ^{n+1}_{k} \|^{2}_{d} - \frac{\epsilon ^{2}}{4}\sum \limits ^{3}_{k=1} \| \nabla _{d}( c^{n+1}_{k} -2c^{n}_{k} + c^{n-1}_{k}) \|^{2}_{d} \\ &~~ - \frac{1}{8}\sum \limits ^{3}_{k=1} \| q^{n+1}_{k} - 2q^{n}_{k} + q^{n-1}_{k}\|^{2}_{d} \le 0. \end{aligned}$$
(25)

Now, we have proved that \(\bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n+1}, {\mathbf {c}}^{n}\right ) \le \bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n}, {\mathbf {c}}^{n-1}\right )\). We claim that the discrete pseudo energy law, i.e., \((\bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n+1}, {\mathbf {c}}^{n}\right ) - \bar{\mathcal{E}}^{d}\left ( {\mathbf {c}}^{n}, {\mathbf {c}}^{n-1}\right ))/ \Delta t\) is a temporally second-order approximation of \(\frac{d}{dt}\mathcal{E}({\mathbf {c}},{\mathbf {q}})\) at \(t = t^{n+1}\) in the sense that

$$\begin{aligned} &\left ( \frac{\|\nabla _{d} c^{n+1}_{k}\|^{2}_{d} + \|\nabla _{d} (2c^{n+1}_{k}-c^{n}_{k})\|^{2}_{d}}{2\Delta t} \right ) - \left ( \frac{\|\nabla _{d} c^{n}_{k}\|^{2}_{d} + \|\nabla _{d} (2c^{n}_{k}-c^{n-1}_{k})\|^{2}_{d}}{2\Delta t} \right ) \\ &\cong \left ( \frac{\|\nabla _{d} c^{n+2}_{k} \|^{2}_{d} - \|\nabla _{d} c^{n}_{k} \|^{2}_{d}}{2\Delta t} \right ) + O(\Delta t^{2}) \\ &\cong \frac{d}{dt}\|\nabla _{d} c_{k}(\cdot ,t^{n+1}) \|_{d}^{2} + O( \Delta t^{2}),~~\mbox{for}~~k = 1,2,3. \\ &\left ( \frac{\| q^{n+1}_{k}\|^{2}_{d} + \| 2q^{n+1}_{k}-q^{n}_{k}\|^{2}_{d}}{2\Delta t} \right ) - \left ( \frac{\| q^{n}_{k}\|^{2}_{d} + \| 2q^{n}_{k}-q^{n-1}_{k}\|^{2}_{d}}{2\Delta t} \right ) \\ &\cong \left ( \frac{\| q^{n+2}_{k} \|^{2}_{d} - \| q^{n}_{k} \|^{2}_{d}}{2\Delta t} \right ) + O(\Delta t^{2}) \\ &\cong \frac{d}{dt}\|q_{k}(\cdot ,t^{n+1})\|_{d}^{2} + O(\Delta t^{2}), ~~\mbox{for}~k = 1,2,3. \end{aligned}$$

3.3 Unique Solvability

We prove the unique solvability of the proposed temporal scheme and the spatial variables are assumed to be continuous for the purpose of convenience. From Eq. (14), we have

$$\begin{aligned} q^{n+1}_{k} = \frac{1}{3}\left [ \left ( 4c^{n}_{k} - 2c^{n-1}_{k} - 1 \right ) \left (3c^{n+1}_{k}-4c^{n}_{k}+c^{n-1}_{k}\right ) + 4q^{n}_{k} - q^{n-1}_{k} \right ]. \end{aligned}$$

Then, we obtain the following linear scheme

$$\begin{aligned} &\frac{3}{2\Delta t}c^{n+1}_{k} = \Delta \mu ^{n+1}_{k} + \frac{1}{2\Delta t}\left ( 4c^{n}_{k} - c^{n-1}_{k} \right ), \end{aligned}$$
(26)
$$\begin{aligned} &\mu ^{n+1}_{k} = P(c^{n+1}_{k}) + g^{n}_{k}, \end{aligned}$$
(27)

where \(P(c^{n+1}_{k}) = -\epsilon ^{2} \Delta c^{n+1}_{k} + 0.5 \left (4c^{n}_{k}-2c^{n-1}_{k}-1 \right )^{2} c^{n+1}_{k}\) and \(g^{n}_{k}\) is expressed as follows

$$\begin{aligned} g^{n}_{k} =& \left ( \frac{4c^{n}_{k}-2c^{n-1}_{k}-1}{6} \right ) \Big[ \left ( 4c^{n}_{k}-2c^{n-1}_{k}-1\right ) \left ( -4c^{n}_{k} + c^{n-1}_{k} \right ) \\ &~~ + 4q^{n}_{k} - q^{n-1}_{k}\Big] + 2\beta \left ( {\mathbf {c}}^{n} \right ) - \beta \left ( {\mathbf {c}}^{n-1} \right ). \end{aligned}$$

Theorem 1

The linear system, Eqs. (26) and (27), admits a unique solution in \(H^{1}(\Omega )\), and the linear operator is symmetric positive definite.

Proof

From Eq. (26), by taking the \(L^{2}\) inner product with \({\mathbf {1}}\), we have

$$\begin{aligned} \int _{\Omega }c^{n+1}_{k} d{\mathbf {x}} = \int _{\Omega }c^{n}_{k} d{\mathbf {x}} = \cdots = \int _{\Omega }c^{0}_{k} d{\mathbf {x}}. \end{aligned}$$
(28)

Let \(V_{c} = \frac{1}{|\Omega |} \int _{\Omega }c^{0}_{k} d{\mathbf {x}}\), \(V_{\mu }= \frac{1}{|\Omega |} \int _{\Omega }\mu ^{n+1}_{k} d{\mathbf {x}}\), and we define

$$\begin{aligned} \tilde{c}^{n+1}_{k} = c^{n+1}_{k} - V_{c},~\tilde{\mu }^{n+1}_{k} = \mu ^{n+1}_{k} - V_{\mu }. \end{aligned}$$
(29)

From Eqs. (26) and (27), we can easily find that \((\tilde{c}^{n+1}_{k},\tilde{\mu }^{n+1}_{k})\) are the solutions of the following equations with unknowns \((c_{k}, \mu _{k})\),

$$\begin{aligned} \frac{3}{2\Delta t} c_{k} - \Delta \mu _{k} =& f_{1}, \end{aligned}$$
(30)
$$\begin{aligned} \mu _{k} + V_{\mu }- P(c_{k}) =& g_{1}, \end{aligned}$$
(31)

where \(f_{1} = (4c^{n}_{k} - c^{n-1}_{k})/(2\Delta t) - 3V_{c}/(2\Delta t)\) and \(g_{1} = g_{k} + V_{c}(4c^{n}_{k}-2c^{n-1}_{k}-1)^{2}/2\). Moreover, \(c_{k}\) and \(\mu _{k}\) are all mean zero. Define the inverse Laplace operator \(\alpha := \Delta ^{-1} \beta \) by \(\Delta \alpha = \beta \) and \(\int _{\Omega }\alpha d{\mathbf {x}} = 0\) with the periodic or homogeneous Neumann boundary condition, then we apply \(-\Delta ^{-1}\) to Eq. (30) and using Eq. (31), we have

$$\begin{aligned} -\frac{3}{2\Delta t} \Delta ^{-1} c_{k} + P(c_{k}) - V_{\mu }= -\Delta ^{-1}f_{1} - g_{1}. \end{aligned}$$
(32)

We can simplify Eq. (32) as \(\mathcal{A}(c_{k}) = b\). For any \(c_{k}\) in \(H^{1}(\Omega )\) and which satisfies \(\int _{\Omega }c_{k} d{\mathbf {x}} = 0\), we can easily verify that \(( \mathcal{A}(c_{k}), c_{k} ) = (c_{k}, \mathcal{A}(c_{k}) )\). Hence, \(\mathcal{A}(c_{k})\) is self-adjoint. We can also find that

$$\begin{aligned} (\mathcal{A}(c_{k}), c_{k}) =& -\frac{3}{2\Delta t}(\Delta ^{-1}c_{k}, c_{k}) + (P(c_{k}),c_{k}) \\ =& \frac{3}{2\Delta t}\| \nabla \Delta ^{-1}c_{k} \|^{2} + \epsilon ^{2} \| \nabla c_{k} \|^{2} + \frac{1}{2}\|(4c^{n}_{k} - 2c^{n-1}_{k} -1)c_{k} \|^{2}. \end{aligned}$$
(33)

Then, we can easily find that \((\mathcal{A}(c_{k}),c_{k})\) is bounded since we can find positive constants \(C_{1}\) and \(C_{2}\) such that \((\mathcal{A}(c_{k}),c_{k}) \le C_{1}(\|\nabla \Delta ^{-1}c_{k} \|^{2} + \| \nabla c_{k} \|^{2} + \|c_{k}\|^{2} ) \le C_{2} \| c_{k} \|^{2}_{H^{1}}\). Moreover, we can find another positive constant \(C_{3}\) such that

$$\begin{aligned} \frac{3}{2\Delta t}\|\nabla \Delta ^{-1}c_{k} \|^{2} + \epsilon ^{2} \| \nabla c_{k} \|^{2} + \frac{1}{2}\|(4c^{n}_{k}-2c^{n-1}_{k}-1)c_{k} \|^{2} \ge C_{3} \| c_{k} \|^{2} \ge 0. \end{aligned}$$
(34)

Thus, the bilinear form \((\mathcal{A}(c_{k}),c_{k})\) is coercive and positive definite. By using the Lax–Milgram theorem, we conclude that the linear system Eqs. (26) and (27) admits a unique solution. The proof of the unique solvability of the proposed temporal scheme for \(c_{k}\) is completed. Because the unique solvability for each component can be proved in a same way, then the unique solvability for the whole system is straightforward. □

4 Numerical Solution

To achieve an efficient computation, we rewrite Eq. (14) to be

$$\begin{aligned} q^{n+1}_{k,ij} = \frac{1}{3}\left [ \left ( 4c^{n}_{k,ij} - 2c^{n-1}_{k,ij} - 1\right ) \left (3c^{n+1}_{k,ij}-4c^{n}_{k,ij}+c^{n-1}_{k,ij} \right ) + 4q^{n}_{k,ij} - q^{n-1}_{k,ij} \right ]. \end{aligned}$$
(35)

Then we substitute all \(q^{n+1}_{k,ij}\) in Eq. (13) with Eq. (35). The following equations are obtained

$$\begin{aligned} &\frac{3c^{n+1}_{k,ij} - 4c^{n}_{k,ij} + c^{n-1}_{k,ij}}{2\Delta t} = \Delta _{d} \mu ^{n+1}_{k,ij}, \end{aligned}$$
(36)
$$\begin{aligned} &\mu ^{n+1}_{k,ij} = -\epsilon ^{2} \Delta _{d} c^{n+1}_{k,ij} + \frac{\left (4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1 \right )^{2}}{2} c^{n+1}_{k,ij} \\ &~~ + \left ( \frac{4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1}{6} \right ) \left [ \left ( 4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1\right ) \left ( -4c^{n}_{k,ij} + c^{n-1}_{k,ij} \right ) \right . \\ &~~ \left . + 4q^{n}_{k,ij} - q^{n-1}_{k,ij}\right ] + 2\beta \left ( {\mathbf {c}}^{n}_{ij} \right ) - \beta \left ( {\mathbf {c}}^{n-1}_{ij} \right ). \end{aligned}$$
(37)

The above linear system is solved by using a multigrid algorithm with Gauss–Seidel (GS) type relaxation. Please see [35, 36] for more details of the multigrid algorithm. Note that the proposed scheme needs the information at \(n\) and \(n-1\) time levels. With the computed \(c^{n+1}_{k,ij}\), we can directly update \(q^{n+1}_{k,ij}\) from Eq. (35). From Eqs. (35)–(37), we can find our proposed scheme is efficient because only one linear semi-implicit system needs to be solve in one time iteration.

5 Numerical Experiments

Without specific needs, all tests are performed in the domain \(\Omega = (0,1)\times (0,1)\) with the periodic boundary conditions.

5.1 Linear Stability Analysis

To validate the proposed scheme, we first consider the short-time evolution of a ternary CH system. By combining Eqs. (4) and (5), we have the following vector-values governing equation

$$\begin{aligned} \frac{\partial {\mathbf {c}}}{\partial t} = \Delta (\psi ({\mathbf {c}}) - \epsilon ^{2}\Delta {\mathbf {c}}), \end{aligned}$$
(38)

where \(\psi ({\mathbf {c}}) = F'({\mathbf {c}}) + \beta ({\mathbf {c}}){\mathbf {1}}\). Let the mean concentration be \({\mathbf {m}} = (m_{1},m_{2})\). In [37], the authors gave that the following solution of a ternary CH system:

$$\begin{aligned} {\mathbf {c}}(x,t) = {\mathbf {m}} + \sum \limits ^{\infty }_{k=1} \cos (k\pi x)( \alpha _{k}(t),\beta _{k}(t)), \end{aligned}$$
(39)

on the one-dimensional domain \(\Omega = (0,1)\). After linearizing \(\psi ({\mathbf {c}})\) about \({\mathbf {m}}\), we get

ψ(c)ψ(m)+(cm) ( c 1 ψ 1 ( m ) c 1 ψ 2 ( m ) c 2 ψ 1 ( m ) c 2 ψ 2 ( m ) ) .
(40)

By submitting Eq. (40) into Eq. (38) and assuming \(m_{1} = m_{2} = m\), we get

c t =Δc ( 2 m 2 3 m + 0.5 m 2 m 2 2 m 2 3 m + 0.5 ) ϵ 2 Δ 2 c.
(41)

By submitting \({\mathbf {c}}\) from Eq. (39) into Eq. (41), we have

( α k ( t ) β k ( t ) ) =G ( α k ( t ) β k ( t ) ) ,G= ( a b b a ) ,
(42)

where the subscript ′ is the time derivative and

$$\begin{aligned} a = -k^{2}\pi ^{2}(2m^{2}-3m+0.5) - \epsilon ^{2}k^{4}\pi ^{4},~~~b = k^{2}\pi ^{2}m^{2}. \end{aligned}$$

The eigenvalues of \({\mathbf {G}}\) are

$$\begin{aligned} \lambda _{1} =& k^{2}\pi ^{2}(-3m^{2} + 3m - 0.5) - \epsilon ^{2}k^{4} \pi ^{4}, \\ \lambda _{2} =& k^{2}\pi ^{2}(-m^{2} + 3m -0.5) - \epsilon ^{2}k^{4} \pi ^{2}. \end{aligned}$$

The analytical solutions of the ordinary differential equations (ODEs) in Eq. (42) are given as

$$\begin{aligned} \left (\alpha _{k}(t),\beta _{k}(t)\right ) =& \frac{\mbox{e}^{\lambda _{1} t} }{2}\left (-\alpha _{k}(0)+\beta _{k}(0), \alpha _{k}(0)-\beta _{k}(0)\right ) \\ &+ \frac{\mbox{e}^{\lambda _{2} t} }{2}\left (\alpha _{k}(0)+\beta _{k}(0), \alpha _{k}(0)+\beta _{k}(0)\right ). \end{aligned}$$
(43)

Let us consider the following initial conditions:

$$\begin{aligned} c_{1}(x,0) =& m + 0.01\cos (k\pi x), \end{aligned}$$
(44)
$$\begin{aligned} c_{2}(x,0) =& m + 0.02\cos (k\pi x), \end{aligned}$$
(45)
$$\begin{aligned} c_{3}(x,0) =& 1-c_{1}(x,y,0)-c_{2}(x,y,0), \end{aligned}$$
(46)

which indicate the initial values of \(\alpha _{k}\) and \(\beta _{k}\) are 0.01 and 0.02, respectively. The computational parameters: \(k = 2,~m = 0.24,~h = 1/256,~\Delta t = 0.001,~\epsilon = 0.01\). The computation stops until \(T = 0.01\). The numerical form of \(\alpha _{k}\) and \(\beta _{k}\) are given as:

$$\begin{aligned} \alpha ^{n}_{k} = \left ( \max \limits _{1\le i\le N_{x}} c^{n}_{1}(x_{i}) - \min \limits _{1\le i\le N_{x}} c^{n}_{1}(x_{i})\right )/2, \end{aligned}$$
(47)
$$\begin{aligned} \beta ^{n}_{k} = \left ( \max \limits _{1\le i\le N_{x}} c^{n}_{2}(x_{i}) - \min \limits _{1\le i\le N_{x}} c^{n}_{2}(x_{i})\right )/2. \end{aligned}$$
(48)

Figure 1 displays the time evolutions of computational and analytical values. We can confirm that the results are in good agreement with each other.

Fig. 1
figure 1

Time evolutions of the computational and analytical values of \(\alpha _{k}\) and \(\beta _{k}\)

5.2 Basic Properties of Ternary CH System

For a ternary CH system, the total energy decrease and the conservation of mass are two basic properties. We consider the phase evolutions with the following random initial conditions:

$$\begin{aligned} c_{1}(x,y,0) =& \frac{1}{3} + 0.1\mbox{rand()}, \end{aligned}$$
(49)
$$\begin{aligned} c_{2}(x,y,0) =& \frac{1}{3} + 0.1\mbox{rand()}, \end{aligned}$$
(50)
$$\begin{aligned} c_{3}(x,y,0) =& 1-c_{1}(x,y,0)-c_{2}(x,y,0), \end{aligned}$$
(51)

where \(\mbox{rand()}\) is the random number between −1 and 1. Here, \(h = 1/256,~\Delta t = 0.01h,~\epsilon = 0.0025\). The discrete mass \(M^{d}(c_{k})\) and energy \(\mathcal{E}^{d}(c_{k})\) are defined as follows:

$$\begin{aligned} &M^{d}(c_{k}) = h^{2} \sum \limits ^{N_{x}}_{i=1}\sum \limits ^{N_{y}}_{j=1} c_{k,ij}, \\ &\mathcal{E}^{d}(c_{k}) = h^{2} \sum \limits ^{N_{x}-1}_{i=1}\sum \limits ^{N_{y}-1}_{j=1}\left [ F(c_{k,ij}) + \frac{\epsilon ^{2}}{2} \left ( \frac{(c_{k,i+1,j}-c_{k,ij})^{2}}{h^{2}} + \frac{(c_{k,i,j+1}-c_{k,ij})^{2}}{h^{2}} \right )\right ]. \end{aligned}$$

Here, the discrete total energy is \(\mathcal{E}^{d}({\mathbf {c}}) = \sum \limits ^{3}_{k=1} \mathcal{E}^{d}(c_{k})\). The simulation is performed until \(T = 0.1563\). Figures 2(a)–(d) show the snapshots of phase evolutions at different computational moments. The evolutions of discrete mass and normalized discrete total energy \(\mathcal{E}^{d}({\mathbf {c}}^{n})/\mathcal{E}^{d}({\mathbf {c}}^{0})\) are illustrated in Fig. 3. As we can see, the total energy is non-increasing and mass of each component is conserved.

Fig. 2
figure 2

Snapshots of phase evolutions at different computational moments, where \(c_{1}\), \(c_{2}\), and \(c_{3}\) locate in black, gray, and white regions, respectively

Fig. 3
figure 3

Temporal evolutions of discrete mass and normalized discrete total energy

5.3 Energy Stability Test

To confirm the energy stability of the proposed scheme, we consider the following initial conditions:

$$\begin{aligned} c_{1}(x,y,0) =& 0.3 + 0.01\mbox{rand()}, \end{aligned}$$
(52)
$$\begin{aligned} c_{2}(x,y,0) =& 0.3 + 0.01\mbox{rand()}, \end{aligned}$$
(53)
$$\begin{aligned} c_{3}(x,y,0) =& 1-c_{1}(x,y,0)-c_{2}(x,y,0). \end{aligned}$$
(54)

The mesh size \(h = 1/128\) and \(\epsilon = 0.02\) are used. We consider a series of increasing time steps: \(\Delta t,~10\Delta t,~100\Delta t\), and \(1000\Delta t\), where \(\Delta t = 7.8125\)e-5. All tests are performed until \(T = 1.5625\). The time evolutions of discrete total energy are displayed in Fig. 4. We can find that the total energies are both non-increasing in time even if large time steps are used.

Fig. 4
figure 4

Temporal evolutions of discrete total energy with respect to different time steps

5.4 Convergence Test

For convergence tests, let the initial conditions be given as

$$\begin{aligned} c_{1}(x,y,0) =& \frac{1}{3} + 0.01\cos (3\pi x) + 0.04\cos (4\pi x), \end{aligned}$$
(55)
$$\begin{aligned} c_{2}(x,y,0) =& \frac{1}{3} + 0.02\cos (2\pi x) + 0.03\cos (4\pi x), \end{aligned}$$
(56)
$$\begin{aligned} c_{3}(x,y,0) =& 1-c_{1}(x,y,0) - c_{2}(x,y,0). \end{aligned}$$
(57)

The parameter \(\epsilon = 0.02\) is used. First, we fix the mesh size as \(h = 1/256\) and a numerical reference solution \(c_{k}^{ref}\) is chosen with very fine time step \(\Delta t^{ref} = 0.01h^{2}\). A set of increasing time step: \(\Delta t = 0.2h^{2},~0.4h^{2},~0.8h^{2}\), and \(1.6h^{2}\) is used to perform the computational simulations until \(T = 4.8828\)e-5. The error under a particular time step is defined as the \(l_{2}\)-norm of the difference between numerical result and reference solution at \(t = T\), i.e., \(\mbox{e}_{\Delta t} = \left \| c_{k,ij} - c_{k,ij}^{ref} \right \| _{2}\). Let the rate of convergence be defined as \(\log _{2}\left ( \left \| \mbox{e}_{\Delta t}\right \| _{2}/ \left \| \mbox{e}_{\frac{\Delta t}{2}}\right \| _{2} \right )\). Table 1 lists the errors and convergence rates. The results indicate that the proposed scheme can achieve second-order accuracy in time.

Table 1 Errors and convergence rates with different time steps. The computational reference is computed with a very fine time step \(\Delta t^{ref} = 0.01h^{2}\) at \(T = 4.8828\)e-5. Here, \(h = 1/256\) is fixed

Next, we fix the time step to be \(\Delta t = 1.5259\)e-7. The numerical reference solution \(c_{k}^{ref}\) is chosen with a finer space step \(h^{ref} = 1/512\). A set of coarsening mesh size: \(h = 1/256,~1/128,~1/64\), and \(1/32\) is used to perform the computational simulations until \(T = 4.8828\)e-5. The error under a particular time step is defined as the \(l_{2}\)-norm of the difference between numerical result and reference solution at \(t = T\), i.e.,

$$\begin{aligned} &\mbox{e}_{h} = \left \| c_{k,ij} - 0.25\left (c_{k,2^{p} i-2^{p-1},2^{p} j-2^{p-1}}^{ref} + c_{k,2^{p} i-2^{p-1}+1,2^{p} j-2^{p-1}+1}^{ref} \right . \right . \\ &\left . \left .+ c_{k,2^{p} i-2^{p-1}+1,2^{p} j-2^{p-1}}^{ref} + c_{k,2^{p} i-2^{p-1},2^{p} j-2^{p-1}+1}^{ref} \right ) \right \| _{2}, \end{aligned}$$

where \(p = 1,~2,~3\), and 4 with respect to \(h = 1/256,~1/128,~1/64\), and \(1/32\), respectively. Let \(\log _{2}\left ( \left \| \mbox{e}_{h}\right \| _{2}/ \left \| \mbox{e}_{ \frac{h}{2}}\right \| _{2} \right )\) be the convergence rate. Table 2 lists the errors and convergence rates. The results indicate that the proposed scheme can achieve second-order accuracy in space.

Table 2 Errors and convergence rates with different space steps. The computational reference is computed with a very fine space step \(h^{ref} = 1/512\) at \(T = 4.8828\)e-5. Here, \(\Delta t = 1.5259\)e-7 is fixed

5.5 Solving Ternary CH Equations in Phase-Field Fluid Systems

The ternary CH system can be extensively applied into the simulations of multi-phase fluid flows. In this work, we consider the following dimensionless modified Navier–Stokes–Cahn–Hilliard (NSCH) system:

$$\begin{aligned} &\rho ({\mathbf {c}})\left ( \frac{\partial {\mathbf {u}}}{\partial t} + {\mathbf {u}} \cdot \nabla {\mathbf {u}}\right ) = -\nabla p + \frac{1}{Re}\Delta {\mathbf {u}} + F_{s}({\mathbf {c}}) + \frac{\rho ({\mathbf {c}})}{Fr^{2}}{\mathbf {g}}, \end{aligned}$$
(58)
$$\begin{aligned} &\nabla \cdot {\mathbf {u}} = 0, \end{aligned}$$
(59)
$$\begin{aligned} &\frac{\partial {\mathbf {c}}}{\partial t} + \nabla \cdot ({\mathbf {c}} {\mathbf {u}}) = \frac{1}{Pe} \Delta { \mu }, \end{aligned}$$
(60)
$$\begin{aligned} &{ \mu } = F'({\mathbf {c}}) - \epsilon ^{2}\Delta {\mathbf {c}} + \beta ({\mathbf {c}}). \end{aligned}$$
(61)

For details of the definitions, refer to [30]. The proposed scheme is used to solve Eqs. (60) and (61), i.e.,

$$\begin{aligned} &\frac{3c^{n+1}_{k,ij} - 4c^{n}_{k,ij} + c^{n-1}_{k,ij}}{\Delta t} = \frac{1}{Pe}\Delta _{d} \mu ^{n+1}_{k,ij} - \nabla _{d} \cdot (c_{k} { \mathbf {u}})^{n+1}_{ij}, \end{aligned}$$
(62)
$$\begin{aligned} &\mu ^{n+1}_{k,ij} = -\epsilon ^{2} \Delta _{d} c^{n+1}_{k,ij} + \left [ \frac{\left (4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1 \right )^{2}}{2} c^{n+1}_{k,ij} \right ] \\ &+ \left ( \frac{4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1}{6} \right ) \left [ \left ( 4c^{n}_{k,ij}-2c^{n-1}_{k,ij}-1\right ) \left ( -4c^{n}_{k,ij} + c^{n-1}_{k,ij} \right ) \right . \\ &\left . + 4q^{n}_{k,ij} - q^{n-1}_{k,ij}\right ] + 2\beta \left ( { \mathbf {c}}^{n}_{ij} \right ) - \beta \left ( {\mathbf {c}}^{n-1}_{ij} \right ), \end{aligned}$$
(63)

where the values \({\mathbf {u}}^{n+1}\) and \(c_{k}^{n+1}\) in convection term are calculated using the extrapolation from previous values, i.e., \({\mathbf {u}}^{n+1} \approx 2{\mathbf {u}}^{n} - {\mathbf {u}}^{n-1}\) and \(c_{k}^{n+1} \approx 2c_{k}^{n} - c_{k}^{n-1}\). Then, the advection term is defined as follows [2]:

$$\begin{aligned} \nabla _{d} \cdot (c_{k} {\mathbf {u}})^{n+1}_{ij} =& \left [ (c_{k} u)_{x} + (c_{k} v)_{y} \right ]^{n+1}_{ij} \\ =& \frac{u^{n+1}_{i+\frac{1}{2},j}(c^{n+1}_{k,i+1,j} + c^{n+1}_{k,ij}) - u^{n+1}_{i-\frac{1}{2},j}(c^{n+1}_{k,ij}+c^{n+1}_{k,i-1,j})}{2h} \\ &+ \frac{v^{n+1}_{i,j+\frac{1}{2}}(c^{n+1}_{k,i,j+1} + c^{n+1}_{k,ij}) - v^{n+1}_{i,j-\frac{1}{2}}(c^{n+1}_{k,ij}+c^{n+1}_{k,i,j-1})}{2h}. \end{aligned}$$
(64)

The projection method [2] is used and the convection term in Eq. (58) is discretized by using the second-order ENO scheme [38].

5.6 Spreading of a Circular Liquid Lens

As a benchmark test of three-phase fluid flow, we investigate the spreading of a circular liquid lens (\(c_{2}\)) locating at the interface between two fluids \(c_{1}\) and \(c_{3}\) in the domain \(\Omega = (0,1)\times (0,1)\), the initial conditions are as follows:

$$\begin{aligned} c_{1}(x,y,0) =& \max \left [ 0.5+0.5\tanh \left ( \frac{y-0.5}{2\sqrt{2}\epsilon } \right ) - c_{2}(x,y,0), 0 \right ], \end{aligned}$$
(65)
$$\begin{aligned} c_{2}(x,y,0) =& 0.5 + 0.5\tanh \left ( \frac{0.15 - \sqrt{(x-0.5)^{2} + (y-0.5)^{2}}}{2\sqrt{2}\epsilon } \right ), \end{aligned}$$
(66)
$$\begin{aligned} u(x,y,0) =& 0,~~~v(x,y,0) = 0. \end{aligned}$$
(67)

We take the homogeneous Neumann boundary conditions for phase field variables and velocity field. In present simulation, we use \(h = 1/256,~\Delta t = 0.01h,~\epsilon = 0.006/\sqrt{2},~Pe = 10/ \epsilon ,~Re = 60,~We_{1} = We_{3} = 36\) and \(We_{2} = 60\). The effect of gravity is not considered. Theoretically, the circular liquid lens spreads and eventually reaches the equilibrium state under the control of three surface tension coefficients: \(\sigma _{12}\), \(\sigma _{13}\), and \(\sigma _{23}\), where the subscript \(pq\) indicates the surface tension coefficient on the interface between fluid \(p\) and fluid \(q\) (see Fig. 5(a)). Specifically, \(\sigma _{pq} = \gamma _{p} + \gamma _{q}\), where \(\gamma _{p} = 1/We_{p}\). Therefore, the values of \(\sigma _{12}\), \(\sigma _{23}\), and \(\sigma _{13}\) in this tests are

$$\begin{aligned} \sigma _{12} = \sigma _{23} \approx 0.0444,~~~\sigma _{13} \approx 0.0556. \end{aligned}$$

The equilibrium three-phase contact angle is determined by

$$\begin{aligned} \frac{\sin \theta _{1}}{\sigma _{23}} = \frac{\sin \theta _{2}}{\sigma _{13}} = \frac{\sin \theta _{3}}{\sigma _{12}}. \end{aligned}$$

For a liquid lens with area \(A\), the deformed distance \(d\) (the distance between two triple junctions), and the contact angle \(\theta _{k}\) of the \(k\)th fluid satisfy the following Young’s law:

$$\begin{aligned} d = \left ( \frac{2(\pi -\theta _{1})-\sin (2(\pi -\theta _{1}))}{8A\sin ^{2}(\pi - \theta _{1}) } + \frac{2(\pi -\theta _{3})-\sin (2(\pi -\theta _{3}))}{8A\sin ^{2}(\pi - \theta _{3})} \right )^{-\frac{1}{2}}. \end{aligned}$$

Then the theoretical deformed distance is \(d = 0.4596\). In this test, the computation stops until the numerical equilibrium state. Figure 5(b) illustrates the evolution of a liquid lens. The numerical deformed distance is measured to be \(d = 0.4593\), which means that the present method can accurately measure the steady shape of a liquid lens.

Fig. 5
figure 5

Spreading of a circular liquid lens. (a) Schematic illustration. (b) Temporal evolution of a liquid lens, where the arrows indicate the directions of evolution

5.7 Two-Phase Fluid Flow in a Complex Domain

The conventional ternary CH model can be modified to simulate the two-phase system in complex domains. Please refer to [25, 39] for some details. Here, the initial value of \(c_{3}\) defines the obstacles and we do not update \(c_{3}\) in the following computation. An augmented projection method [40] is used to treat the velocity field in an arbitrary domain. Hence, it is easy to implement without artificial works on the conditions of the complex domain. We only need to solve \(c_{1}\) in each time iteration. With this approach, the governing equations are recast to be

$$\begin{aligned} \frac{\partial c_{1}}{\partial t} =& M\Delta \mu _{1}, \end{aligned}$$
(68)
$$\begin{aligned} \mu _{1} =& F'(c_{1}) - \epsilon ^{2} \Delta c_{1} + \tilde{\beta }, \end{aligned}$$
(69)

where \(\tilde{\beta } = -c_{1}c^{0}_{3}(1-c_{1}-c^{0}_{3})\) is a modified multiplier satisfying the condition in Eq. (1) and \(c^{0}_{3}\) is the initially fixed value of obstacles. In this part, we consider the falling droplet in a complex domain with various circular obstacles (see the white gray regions in Fig. 6(a)). The following initial conditions on \(\Omega = (0,2)\times (0,4)\) are considered:

$$\begin{aligned} c_{1}(x,y,0) =& 0.5 + 0.5\tanh \left ( \frac{0.35 - \sqrt{(x-1)^{2} + (y-3.5)^{2}}}{2\sqrt{2}\epsilon } \right ), \end{aligned}$$
(70)
$$\begin{aligned} u(x,y,0) =& v(x,y,0) = 0. \end{aligned}$$
(71)

We take the homogeneous Neumann boundary conditions for \(c_{1}\) and no-slip boundary conditions for velocity field. The following parameters are used: \(h = 1/64,~\Delta t = 0.8h^{2},~\epsilon = 0.0101,~Pe = 1/ \epsilon ,~Re = 100,~We_{1} = 3\), and \(Fr = 1\). The density ratio is \(\rho _{1}:\rho _{2} = 3:1\). Figures 6(a)–(h) show the temporal evolution and we can find that the droplet falls and deforms under the effects of gravity, surface tension, and solid obstacles.

Fig. 6
figure 6

Temporal evolution of a falling droplet in a complex domain where the white gray regions are the obstacles, the droplet is in dark gray, and the ambient fluid is in white

Remarks 1

In this subsection, we followed the approach developed in [25] to simulate the two-phase flow in complex domains by using a modified ternary CH model. The initial value of the third component is fixed to represent the obstacles. In essence, the computation is for a two-phase system. Therefore, we only consider the surface tension on the interface of \(c_{1}\), i.e. only \(We_{1}\) is used. As for the contact angle between droplet and obstacles, the modified ternary model (Eqs. (68) and (69)) are similar with the model in [39] with contact angle \(\theta = 90^{\circ }\). In recent works [22, 41], authors proposed accurate moving contact angle method for fluid-solid interaction by combining the ternary CH model and geometry relation. However, their method did not follow the energy dissipation law. The present work focus on an efficient linear, second-order accurate, and energy stable method for the ternary CH model, the simulation in this subsection just is a potential application. Although the moving contact line problem is interesting, it is out of the scope of this work. The energy stable method for multi-component CH model with moving contact angle hysteresis will be considered as upcoming works.

6 Conclusions

We proposed a second-order accurate, energy stable, and linear numerical scheme for a ternary CH model. This numerical scheme was derived from the Lagrange multiplier method and adopted the BDF2 temporal discretization, which satisfied unconditionally stability and mass conservation for the whole system. The proposed scheme was simple to implement because all nonlinear terms were treated as source terms. Many computational experiments were performed to demonstrate that the proposed method is unconditionally stable and second-order accurate in space and time. In addition, the proposed method could be used as an efficient solver for the ternary CH equations in any phase-field fluid system. We note that our proposed scheme can be straightforwardly extended to an arbitrary \(N\)-component CH system in a same manner. In this study, we only focus on the extended Lagrange multiplier approach for the ternary CH systems. As future works, we will consider the linear, decoupled, and energy stable schemes for multi-component thermodynamically consistent phase-field fluid systems.