1. Introduction
The flow of immiscible (multi-phase) fluids in porous media is important in many problems in geosciences and environmental engineering. Examples include water percolation through the vadose zone, the storage of supercritical carbon dioxide in deep saline aquifers, and the clean-up of groundwater contaminated by non-aqueous-phase liquids (e.g., petroleum and chlorinated solvents). To fully understand such systems, it is necessary to characterize fluid behavior at the pore scale, because macroscopic (bulk) fluid behavior depends on processes occurring at the pore scale [
1]. Pore-scale factors that might be important include grain and pore morphology, inter-pore connectivity, interfacial tension, and fluid–fluid–solid interactions (i.e., wettability). However, quantifying the importance of such factors is challenging: the subsurface environment cannot be observed directly, and it is difficult to create physical (laboratory) models that are both realistic and controllable.
Because of the challenges of running controlled physical experiments with realistic porous media, pore-scale multi-phase fluid flow is often studied via numerical models that aim to accurately capture the most important physics of real systems. There are several different methods available that model pore-scale processes and systems, including pore network models, the lattice Boltzmann method (LBM), Monte Carlo methods, particle dynamics methods, and grid-based computational methods that track interfaces [
2]. Many modern pore-scale models are able to sufficiently resolve multi-phase fluid interactions and adequately depict the behavior that is seen in laboratory experiments [
3].
Of the methods developed heretofore, the LBM has proven to be a robust and reliable tool to simulate fluid flow (including multi-phase flow) in porous media [
4,
5,
6,
7,
8,
9]. A defining feature of the LBM is that it accounts for pore-scale fluid dynamics that satisfy the incompressible Navier–Stokes equations, without explicitly solving the partial differential equation [
10]. Among the advantages of the LBM are that it is well suited to application in complex geometries such as porous media [
11] and that computations are local and explicit, making the method amenable to parallel implementations [
12,
13,
14,
15,
16,
17,
18,
19].
Different types of lattice Boltzmann methods have been developed for describing multi-phase fluid flow. These include the pseudopotential model (sometimes called the “Shan-Chen” method) [
20], free energy method [
21], mean field theory [
22], stabilized diffuse-interface model [
23], and color gradient method (sometimes called the “Rothman-Keller” method) [
24,
25]. Each of these variants has its own strengths, weaknesses, and applications [
14,
16]. Over the years, the color gradient method (CGM) has matured into a tool that has characterized various flows in porous media [
26].
The CGM was developed and implemented for immiscible fluids in porous media by Gunstensen et al. [
25], based on the lattice gas model [
24]. A feature of the CGM is its ability to keep the immiscible fluids sufficiently distinct and separate with the help of an interface thickness parameter. This minimizes the mixing of the fluids at the interface and reduces distortion [
27]. This method also conserves momentum at the local and global scale [
28], which makes it possible to implement different types of boundary conditions (free exit) that cannot be implemented with other LBM variants. However, the method’s main strength is the ability to independently tune fluid and flow parameters (e.g., interfacial tension, contact angle, fluid densities, and interface thickness) with individual color gradient constants or parameters [
29]. The CGM has been utilized to simulate various porous media fluid flow applications such as carbon dioxide transport in subsurface systems [
30], water transport in proton exchange membrane fuel cells [
31], temperature-driven fluid flow in heated microchannels [
32], drainage and imbibition in oil-water systems [
33], spontaneous imbibition in micromodels [
34], the behavior of droplets on surfaces [
35], the adsorption of fluids onto the surfaces of porous media [
36,
37], the flow of particle suspensions [
38], the separation of gas mixtures [
9], and the behavior of droplets during inkjet printing [
39], to name just a few. Due to the CGM’s popularity, some previous authors have compared its capabilities to those of other leading multi-phase LBM methods, establishing the CGM’s capacity to capture the physics of multi-phase fluid flow phenomena [
3,
40,
41,
42].
The execution and application of the CGM have been described and reviewed previously by other authors, often as part of broader reviews of multi-phase LBM methods (e.g., [
16,
26,
43]). However, certain important practical aspects of implementing the CGM (e.g., how to model the flow of fluids with widely differing densities or viscosities and how to implement “open” boundary conditions) have not yet been systematically reviewed in the previous literature. Also, improvements to the CGM continue to appear in the literature frequently, and some recent advancements to the CGM (e.g., how to best account for wettability and contact angles and how to extend the method from two spatial dimensions to three [
35,
42,
44,
45,
46]) have not been considered by previous reviews of the method. Finally, the previous review papers generally do not guide the reader in terms of algorithm development and the practical implementation of the CGM. Therefore, a need exists to systematically review the capabilities and limitations of the CGM, starting with fundamental aspects for readers who are not yet experts in the method, then progressing to more sophisticated and “modern” topics, all while emphasizing the practical aspects of implementing the algorithms reviewed.
Therefore, the overall objective of this series of papers is to critically review the capabilities and implementation of the CGM as a method of modeling pore-scale multi-phase flow in porous media. We aim to provide a review that is helpful both to new users of the LBM and to more experienced modelers with a higher level of expertise. For the current paper, the first in the series, the specific objectives are as follows:
Provide a brief introduction to the LBM and CGM that subsequently enables and facilitates consideration of more sophisticated topics;
Critically review different methods for modeling the flow of fluids of moderately different viscosities;
Critically compare two methods for calculating the color gradient;
Critically compare two methods for modeling external forces or accelerations acting upon the fluids of interest;
Summarize some of the challenges in applying the CGM with respect to the topics listed immediately above.
The rationale for focusing on these particular aspects of the CGM in the first paper of the series is that understanding these algorithms will allow the reader to run two of the most common “benchmark” tests for lattice Boltzmann modeling, namely bubble tests (droplet tests) and layered Poiseuille flow; examples of these tests will be provided at the end of this paper. Future papers in the series will build upon the topics covered here, considering phenomena or conditions such as fluids of widely differing viscosity and/or density, how to introduce the “wettability” of solid surface and specify a desired contact angle, how to simulate fluid flow in a domain with an open boundary condition (e.g., fluid flushing out of a porous medium), and how to extend the CGM from two spatial dimensions to three. By systematically reviewing these key aspects and features, this series of papers will extend our collective ability to apply the CGM to a variety of important fluid flow problems in geosciences and engineering.
2. Review of LBM Basics
The lattice Boltzmann method (LBM) for modeling fluid flow is based on a marriage of two sub-fields of physics: lattice gas cellular automata and Boltzmann’s kinetic theory of gases (i.e., statistical mechanics).
A lattice gas cellular automaton is a system in which fictitious “gas” particles reside on a grid (lattice) and move between nodes of the grid. Typically, each particle has the same mass and moves with the same speed as each other. When two particles arrive at the same node at the same time, the particles collide, and the particles’ velocities (momenta) may be altered by the collision. Frisch et al. [
47] demonstrated the remarkable result that if the lattice is formulated properly, and if the collisions are modeled in a manner that conserves particle mass and momentum, then the lattice gas cellular automaton is able to simulate the flow of realistic fluids. That is, the aggregate or macroscopic behavior of the particles on the lattice can be shown to satisfy the Navier–Stokes equations. This discovery by Frisch et al. [
47] enabled lattice gas cellular automata to be developed as tools for computational fluid dynamics.
An important advancement to the pioneering work of Frisch et al. [
47] was modifying the lattice gas model to account for the spatio-temporal evolution of
distributions of particles, or
probabilities of particle velocities, rather than the movements of individual particles [
48,
49,
50]. The evolution of the particle distributions can be described with the following equation, which, as pointed out by Wolfram [
51], is similar to a Boltzmann transport equation:
where
is the probability of a particle at location
having the velocity
at time
t,
is a small incremental time interval, and
is the collision operator that operates on
f. Because particle movement is constrained to the lattice, there is a finite set of velocity vectors
. Solving for the distribution function
f allows for the simulation of macroscopic fluid behavior without the “noise” that is encountered when working with individual particles.
In practice, the time variable
t is generally taken as a discrete integer-valued variable corresponding to the number of time steps taken; movement from one node on the lattice to an adjacent node requires one time step, and
is always taken as one time step. Therefore, many papers in the literature re-write Equation (
1) more compactly as the following:
In this form, the units on velocity are lattice units per time step (l.u./t.s.); the reader must understand that it is implied that is multiplied by one time step, so the addition is acceptable.
Figure 1 shows two possible lattice configurations that have been applied for modeling flow in two dimensions, along with the corresponding set of velocity vectors
. These two configurations are commonly referred to as D2Q7 and D2Q9. The “D2” notation refers to the fact that the lattices are two-dimensional, and “Q7” or “Q9” refers to the number of neighbors for each node in the lattice (including the node itself as one of its neighbors, which allows for the possibility that a particle can remain stationary rather than moving to an adjoining node).
In classical statistical mechanics,
is the probability density function for fluid particles at location
having velocity
at time
t. The Boltzmann equation for the movement of the fluid particles (in the absence of an external force field) is
where
represents the change in particle momentum due to collisions. It can be seen that Equation (
2) is a form of Equation (
3) in which the time derivative has been discretized and in which the particle velocities are constrained to the lattice. Therefore, Equation (
2) is sometimes termed the “lattice Boltzmann equation”.
A major advancement in the application of Equation (
2) was developing a convenient way of estimating the collision operator. In classical statistical mechanics, Bhatnagar et al. [
52] developed a method for estimating the collision operator in Equation (
3); specifically, the collision operator is estimated as “relaxation” of the function
f toward an equilibrium distribution
. The method of Bhatnagar et al. [
52] was applied to the lattice Boltzmann equation by Qian et al. [
53]. Qian et al. [
53] presented the following equations, which constitute the very popular Bhatnagar–Gross–Krook (or “BGK”) formulation of the lattice Boltzmann method:
where
is a relaxation time characterizing the particle collision,
is the fluid density (in the lattice domain),
is the macroscopic velocity vector of the fluid at location
and time
t, and
is a weighting parameter. Equation (
5) is the formulation of
that enables the macroscopic fluid behavior to adhere to the Navier–Stokes equations [
53]. For this formulation, the viscosity of the fluid (in the lattice domain, units l.u.
2/t.s.) is given by
The weighting parameters,
, depend on which lattice geometry is employed. For a D2Q9 lattice (shown in
Figure 1),
w is given by the following [
53,
54,
55]:
For the flow of a fluid in two dimensions, the solution of Equations (
4)–(
7) enables us to track the particle distribution function
f over time and space. However, Equation (
5) depends on the macroscopic fluid properties
and
. These can be determined by calculating the moments of
f, according to the following:
Equations (
4)–(
9) constitute the foundation for simulating two-dimensional fluid flow with the lattice Boltzmann method. In practice, the method is implemented through an alternating series of “streaming” steps and “collision” steps that together satisfy Equation (
4). More information about these steps is provided below in
Section 3, but some details of implementation are omitted here in the interest of space. The reader is referred to previous work by Sukop and Thorne [
6], Guo and Shu [
43], Huang et al. [
26], Krüger et al. [
56], or Mohamad [
57] for additional details of implementation.
It is worth noting that the LBM can also be used to simulate transport as well as fluid flow—for instance, mass transport via diffusion [
58] and/or heat transfer via conduction [
59]. Using the LBM to model transport rather than flow requires modification to the selection of the equilibrium distribution function
and the relaxation time
(e.g., [
58,
59]). However, in the present paper, we are concerned only with the multi-phase flow of immiscible fluids in porous media, and we do not consider diffusive mass transport or conductive heat transfer.
3. CGM Framework
The original CGM [
25] was developed as a combination of the immiscible cellular gas automaton [
24] and the LBM [
50]. The method considers two immiscible fluids, a “red” fluid and a “blue” fluid, and thus considers two particle distribution functions
, where the superscript
k indicates the red or the blue fluid. Particles of both fluids collide and stream in the lattice domain following the regular LBM operation described above (
Section 2), but with an added “perturbation” step that enables interfacial tension to be included in the model, and with a “recoloring” step to maintain the fluids as immiscible.
Over the past three decades, the overall model algorithm has remained essentially unchanged, but improvements to the equations have resulted in better accuracy and better representations of true multi-phase fluid physics. Some early developments include increased capability to model fluids of unequal viscosity and/or density [
60], improvement in the recoloring step [
27], and modification of the perturbation equation [
55]. These advances have enabled the model to be used for a wider range of fluid applications and have paved the way for developing three-dimensional models [
42,
61,
62]. This section provides the framework of a two-dimensional CGM that includes the aforementioned improvements of Grunau et al. [
60], Latva-Kokko and Rothman [
27], and Reis and Phillips [
55]. More recent updates pertinent to the contrast in fluid viscosity, calculation of the color gradient, and application of external forces are considered subsequently in
Section 4,
Section 5 and
Section 6. Also, the extension of the two-dimensional CGM to three dimensions will be discussed in a future paper in this series.
The essence of the CGM can be expressed as the following analog to Equation (
2) [
62]:
where the collision operator
now represents the aggregate of three steps: the single-phase collision
, the perturbation operation
, and a recoloring process. In practice, the order of the operations for implementing the CGM is as follows:
Calculate macroscopic variables , , and ;
Calculate equilibrium distributions for red and blue fluids, ;
Apply the single-phase collision operator, , for both fluids;
Calculate the “color gradient” between red and blue fluids, ;
Apply the perturbation operator, , to account for interfacial tension;
Perform a “re-coloring” step to maintain the immiscibility of fluids;
Stream the particle distributions .
These steps are discussed in more detail in the sub-sections following.
We note that there are variants in the CGM that do not exactly follow the sequence of steps listed above. For instance, one such variant [
63,
64,
65,
66] enables the whole algorithm to operate with any color distribution function. There can be advantages to such variants, including lower memory demands. However, in this review, we focus only on the more traditional CGM that relies on red and blue fluid populations, because of that method’s ubiquity and relative ease of implementation.
3.1. Calculation of Macroscopic Variables
The first step in the algorithm is the calculation of the macroscopic variables: the total density of the combined (composite) fluid
, the individual fluid densities
for the red and blue fluids, and the velocity
of the combined fluid. Analogous to Equations (
8) and (
9), these macroscopic variables can be calculated from the moments of the red and blue distribution functions:
3.2. Equilibrium Distribution Functions
The second step involves computing the equilibrium distribution functions
for the red and blue fluids, which are used subsequently (step 3) to calculate the single-phase collision operator [
67,
68]:
For a D2Q9 lattice,
in Equation (
14) is given by Equation (
7) and
is given by the following [
55,
67]:
In Equation (
15),
is a parameter that introduces a density contrast between the fluids while maintaining stable hydrodynamic pressures at the interface (cf. [
55,
60]). The selected values of
and
determine the density ratio between the two fluids, the speed of sound within each fluid (
), and the pressure within the system, as summarized in
Table 1. In
Table 1, the parameter
, which relates
to
, is lattice-dependent; values are provided by Leclaire et al. [
69]. For a D2Q9 lattice,
.
To simulate a stable density contrast,
must be selected within the range
for both fluids. In particular, for a D2Q9 lattice, if
, Equation (
14) reduces to Equation (
5) for fluid
k, and the speed of sound within fluid
k is
. For other values of
, the speed of sound in fluid
k will be different, as given in
Table 1. To model the flow of two fluids of equal density,
for both fluids may usually be set equal to
. An introduction of different values of
for the two fluids is able to achieve density ratios up to about 18.5 [
55]; systems with greater density ratios require a different approach, which will be reviewed in a subsequent paper in this series.
Note that to achieve a desired density ratio
, there is not one unique pair of
and
that must be selected; for instance, selecting
and
will yield a density ratio
, but selecting
and
will also yield
. In limited trials during which we tested different combinations of
and
, we found that setting both values of
close to
led to slightly better results than allowing one value of
to be far from that value. The selection of
and
according to the equations shown in
Table 1 ensures that the pressure in the two fluids is continuous at the fluid–fluid interface [
55,
67].
It has been demonstrated [
66] that when using the aforementioned
relations for fluids of unequal density, the tangential momentum of the two fluids is conserved along the fluid–fluid interface, but the tangential velocity along the fluid–fluid interface then becomes discontinuous. It is not yet clear if there is a practical implication of conserving momentum rather than velocity during simulations, nor if a different method for modeling unequal densities would be able to ensure the continuity of tangential velocities [
66].
3.3. Collision Operator
In the next step, the collision operator
is computed and applied. There are different ways to compute the collision operator
depending on the viscosity ratio of the two fluids. The simplest collision expression is the BGK formulation, which considers that collisions induce the “relaxation” of
toward the equilibrium population
, as discussed previously in
Section 2:
The challenge with applying Equation (
16) is that it depends on a relaxation time
that is related to the fluid viscosity (as shown in Equation (
6)), but the fluid viscosity might not be the same for the red and blue fluids. If the red and blue fluids have a viscosity ratio that is very close to one (say, within a factor of two), then they will have similar values of
, and Equation (
16) can be applied without difficulty. If the fluids have a viscosity contrast that is slightly less than ∼0.5 or slightly greater than ∼2, an “effective” viscosity can be computed by interpolation, as discussed subsequently in
Section 4. For even greater viscosity contrasts, more sophisticated approaches are required; for instance, the BGK approach can be replaced by a multiple-relaxation-time (MRT) approach, which will be discussed in a subsequent paper in this series.
3.4. Computing the Color Gradient
Next, the “color gradient” (sometimes also called “color flux” or “color field”),
, is calculated. The color gradient
is the vector perpendicular to the interface between the red and blue fluids, as shown in
Figure 2.
In the literature, different approaches have been presented for computing the color gradient. The original approach, as proposed and presented by Rothman and Keller [
24], Gunstensen et al. [
25], and Grunau et al. [
60], is the following:
Two notable modifications to this “original” approach are the “isotropic” color gradient of Leclaire et al. [
70] and the “modified” color gradient of Xu et al. [
71]. Subsequently in this paper (
Section 5), we will compare some results of simulations using the original color gradient to the results of simulations using the isotropic color gradient of Leclaire et al. [
70].
3.5. Perturbation
Gunstensen et al. [
25] explain that the color gradient method proceeds by performing a collision step (as summarized above), then by “add[ing] a surface-tension-inducing perturbation”, then by recoloring the fluids and streaming the particles. In other words, the perturbation step of the CGM is the method of incorporating interfacial tension between the immiscible fluids; the color gradient
is utilized in this perturbation operation. In the paper of Gunstensen et al. [
25], the perturbation step is represented by their Equation (
17). Subsequently, perturbation strategies were proposed by Grunau et al. [
60], Lishchuk et al. [
72], Latva-Kokko and Rothman [
27], and Reis and Phillips [
55]. Ideally, the perturbation process should recover the correct interfacial force, reduce artificial velocities at the fluid–fluid interface (spurious velocities), retain the correct interface shape, and minimize interface thickness [
62,
72]. The approaches of Lishchuk et al. [
72] and of Reis and Phillips [
55] both fulfill these criteria. Furthermore, both methods have been applied successfully in both two-dimensional and three-dimensional models [
42,
62,
72]. The approach of Lishchuk et al. [
72] has been shown to model contact angles more accurately under certain conditions [
45,
73,
74]. However, the approach of Reis and Phillips [
55]—which is essentially an improvement upon the approaches of Grunau et al. [
60] and Latva-Kokko and Rothman [
27]—has been more extensively used because of its ability to include density ratios greater than one and because it is computationally less expensive. Here, we summarize the method of Reis and Phillips [
55].
In this method, the perturbation step is accomplished through the application of the perturbation operator
that is applied to each
:
where the parameter
is a user-specified parameter (see
Table 1) that controls the interfacial tension value. Equation (
19) enables the conservation of mass and momentum, as explained by Reis and Phillips [
55] and by Liu et al. [
62]. In Equation (
19),
B is a vector of values that depends on the lattice employed; the proper selection of
B enables the recovery of the correct interfacial force term in the Navier–Stokes equations [
55,
62]. Specifically, for a D2Q9 lattice:
This method of introducing interfacial tension between the fluids has been shown to recover correct macroscopic equations for two-phase flows; detailed mathematical derivations are given by Reis and Phillips [
55] and Liu et al. [
62].
The interfacial tension between the two fluids,
, is related to the
parameters [
27,
60]. Either the user can specify the
parameters, and the interfacial tension
will result from the choice of the
, or the user can specify the desired interfacial tension
, and values of
can be calculated accordingly. The problem is that the relationship between
and interfacial tension has not been completely resolved; different papers give different derivations or approximations of the relationship. Also, the relation between
and
is known to depend on the fluid viscosities and the associated collision relaxation times
; if the fluids have unequal viscosities, then they also have unequal values of
, which complicates the relation between
and
.
To simplify the situation somewhat, we found that, if the two fluids have equal densities or if the density ratio is acceptably low (
), a single value of
A can often be used for both fluids, i.e.,
. In this case,
A can be computed from a desired value of
by following Equations (36) and (37) of Leclaire et al. [
70]. That is, if the color gradient
is computed according to Equation (
17), then
A and
are related by
in which
is an interpolated or effective relaxation time, which will be explained subsequently in
Section 4. If, instead of using Equation (
17) to calculate
, we instead use the isotropic color gradient of Leclaire et al. [
70] (which will be discussed in more detail subsequently), then
A must instead be computed by the following:
in which, again,
is an interpolated or effective relaxation time. Notably, because the interpolated relaxation time
varies both spatially and temporally (as will be seen subsequently in this paper), the parameter
A also varies spatially and temporally, so it must be computed at every lattice location at every time step.
If Equations (
21) and (
22) do not successfully produce the desired interfacial behavior, then alternatively, the interfacial tension
for selected values of
can be verified or estimated by conducting a bubble test (static droplet test) and measuring the simulated pressures and droplet radius [
62,
68,
75]. The perturbation term and its relationship to interfacial tension are also considered in more detail in Appendix A of Ginzburg and Steiner [
63].
3.6. Recoloring
After the perturbation step, the fluids are still mixed and require separation. This is achieved by a “recoloring” step. The original recoloring procedure [
25] suffered from numerical issues such as “lattice pinning” and fluctuations in velocity (also called “spurious currents” or “anomalous currents”) near the interface [
27,
76]. Subsequent recoloring algorithms proposed in the literature (e.g., [
27,
55,
61,
67]) were designed largely to address these numerical issues. The algorithm proposed by Latva-Kokko and Rothman [
27]—which is an improvement to that of D’Ortona et al. [
77]—has been found to perform well for a variety of tests and is presented here:
where
is a user-specified parameter that controls the thickness of the interface (
Table 1), and
is the total fluid density as defined in Equation (
12).
In Equations (
23) and (
24),
and
are the equilibrium distribution function for the combined fluid under stationary conditions, i.e., evaluated at
. For the calculation of
, we recommend using Equations (
7), (
14) and (
15) given above, which differ slightly from Equations (1) and (2) of Latva-Kokko and Rothman [
27]. Also,
represents the angle between the color gradient vector
and the lattice velocity vector
, as shown in
Figure 2 and given by the following equation:
The parameter
in Equations (
23) and (
24) is specified by the user and is set between 0 and 1. A
value close to one gives minimum interface thickness but increases spurious velocities and reduces the accuracy of the interfacial tension value [
62,
68,
78]. Conversely, if
is set too low, the spurious velocities at the interface reduce, but the interface thickness increases. Usually, a value of
between 0.70 and 0.99 is selected to maintain a thin interface without introducing significant spurious velocities (e.g., [
79,
80]), though Halliday et al. [
78] argue that
should not exceed
. Also, Leclaire et al. [
81] offer a method for using a variable, rather than constant, value of
to improve performance. Despite these subtleties, we generally found that a constant value of
works well as a “default” value, unless it is determined that a more sophisticated approach is required.
In the literature, alternatives to the recoloring procedure have also been proposed. A few of these have been reviewed briefly by Ginzburg [
66]. For instance, Kehrwald [
65] proposes an “anisotropic diffusion” algorithm as an alternative to recoloring, and demonstrates that the algorithm is able to reduce the spurious currents (anomalous currents) mentioned above. However, most implementations of the CGM still rely on the recoloring algorithm described above, perhaps because it is relatively simpler to implement.
3.7. Summary of Parameters Specified by Model User
To summarize, the parameters that must be specified by the model user are those listed in
Table 1.
We generally recommend as a default value for the interface thickness parameter .
For simulating fluids of equal density, we recommend . For density ratios other than one, setting both values of reasonably close to is recommended over setting one of the values far from .
For most applications, we recommend
, which can be calculated to produce a desired interfacial tension
as given by Equation (
21) or (
22). However,
A must be calculated at each lattice node at each time step because of the temporal and spatial variability of the effective relaxation time
.
Finally, the model user must specify either the relaxation time
or the kinematic viscosity
for each fluid, using Equation (
6) to calculate whichever of the two was not specified explicitly.
4. Accounting for Fluids of (Moderately) Unequal Viscosity
The ratio of viscosity between the two fluids can strongly influence the overall behavior of the system. A classic example is “viscous fingering” that results from a less viscous fluid displacing a more viscous fluid in a porous medium [
82,
83]. The LBM is sometimes used as a tool to investigate and understand such mechanisms (e.g., [
68,
84,
85,
86]).
Although the CGM provides a robust framework to model multi-phase flow when the viscosity ratio is reasonably close to 1 (perhaps in the range 0.5–2), modifications to the methods of
Section 3 are required if the viscosity ratio is far from 1. For instance, Rannou [
87] demonstrated that the “standard” CGM could properly simulate two-phase flow in a channel for viscosity ratios as high as 10, but that simulated velocity profiles deviated from the correct values at higher viscosity ratios. This is because two fluids with unequal viscosities also have unequal values of
, the relaxation time in the BGK collision operator, according to Equation (
6). Therefore, at the interface between the two fluids,
is not clearly defined, which can lead to incorrect calculations in the vicinity of the interface [
68,
88].
To address this problem, an effective value of
near the interface can be interpolated from the adjacent known
values before the first collision operator
is calculated. Methods available for interpolating
have been presented by Grunau et al. [
60], Tölke et al. [
61], and Liu et al. [
88], and are reviewed here.
In the method of Grunau et al. [
60], an “order parameter”
P (also sometimes called the “phase field” in the literature) can be calculated at any location
to indicate which of the two fluids, red or blue, dominantly occupies that location:
Values of
P range from
(region is occupied only by the blue fluid) to
(region is occupied only by the red fluid). The value of
at any location
near the interface is determined from
P and a user-specified interface parameter,
, which must be
:
Tölke et al. [
61] use the same order parameter
P as Grunau et al. [
60], but the calculation of
based on
P is different. Specifically, Tölke et al. [
61] use a simple linear interpolation to compute
in the vicinity of the fluid–fluid interface:
Finally, the interpolation scheme of Liu et al. [
88] is based on a method devised by Zu and He [
89] for use in the free-energy method. This interpolation scheme again uses the same order parameter
P, but now
is evaluated as a weighted harmonic mean of
and
:
Figure 3 demonstrates the effectiveness of these three popular interpolation schemes for the classic benchmark simulation of two-phase flow in a channel (layered Poiseuille flow). For
Figure 3, the testing domain is a
lattice domain with periodic boundary conditions and with a force applied to the fluid in the middle of the channel (methods for applying a force to the fluid will be described subsequently in
Section 6). Other details regarding the simulation parameters are provided by Liu et al. [
88]. In this figure, we simulated the flow of two fluids with a viscosity ratio of
, i.e., the fluid in the middle of the channel (from lattice units 50 to 150) has a higher viscosity than that of the fluid near the edges of the channel. The CGM is used according to
Section 3, and the LBM results are compared to a known analytical solution provided in Chapter 2 of Huang et al. [
26] (cf., [
32,
40,
87]). In
Figure 3, we generated the results in the top-left panel without viscosity interpolation, and we generated the results in the remaining panels using the viscosity interpolation methods of Grunau et al. [
60], Tölke et al. [
61], and Liu et al. [
88], as indicated on the figure. The improvement afforded by each viscosity interpolation is obvious.
All three interpolation schemes considerably reduce the error between the analytical and LBM velocities. Among these, the methods of Grunau et al. [
60] and Liu et al. [
88] perform similarly and accurately while the method of Tölke et al. [
61] can not match the analytical solution completely. The methods of both Grunau et al. [
60] and Liu et al. [
88] have been successfully implemented and are popularly used [
42,
55,
68,
85,
90]. The choice of which method to use is mostly up to the user’s preference, but we note that the method of Liu et al. [
88] requires fewer computations without any apparent degradation of performance. We therefore use the method of Liu et al. [
88] in any simulations discussed subsequently in this paper (
Section 5 and
Section 6).
In many applications, such as in simulations of drainage or imbibition, the fluid–fluid interface moves over time. Thus, the values of
change over space and time; so too then do the values of the interpolated viscosity
. This means that any other variables that depend on
—for instance,
A in Equations (
21) and (
22)—also change over space and time. The values of
P,
, and
A must therefore be recalculated at each lattice node at each time step.
As can be seen from
Figure 3, the use of viscosity interpolation can, under some conditions, allow the CGM to perform well when the two fluids are of unequal viscosities. However, if the ratio of the fluid viscosities becomes extreme (e.g., the viscosity ratio is greater than ∼10), viscosity interpolation might not be sufficient to ensure that simulations are stable and accurate. Furthermore, the results observed in
Figure 3 depend not only on the ratio of
but also on the specific values of
and
selected; choosing different values of
and
might alter the results even if the ratio
is held constant. BGK solutions are not necessarily fixed by non-dimensional numbers [
66,
91,
92]. For either or both of these reasons, it might be necessary in some situations to employ more sophisticated approaches, such as replacing the BGK collision algorithm with a multiple relaxation time (MRT) algorithm. The application of the MRT to the color gradient method will be considered and reviewed in a future paper in this series.
When specifying values near an interface, as discussed immediately above, Ginzburg [
66] distinguishes between an “implicit” interface approach (in which a blue fluid node is adjacent to a red fluid node, with an interface implied to exist halfway in between) and an “explicit” interface approach (in which a grid node is located at the interface, with blue fluid nodes on one side and red fluid nodes on the other side). For the case of an implicit interface, it is possible to select the CGM parameters in a way that the lattice Boltzmann method exactly reproduces the analytical solution for two-phase Poiseuille flow [
66]. For the case of an explicit interface, Ginzburg [
66] argues for using the harmonic mean value of viscosity,
, rather than relaxation time,
. This approach ensures the continuity of the tangential shear stress at the interface and the exact momentum solution inside each phase in two-phase Poiseuille flow, but needs to extrapolate it from the bulk to an explicit interface. Users may therefore wish to adopt the approach of Ginzburg [
66] rather than interpolating values of
. Nevertheless, for relatively simple problems, interpolating the value of
near the interface is an expedient way of accounting for moderate differences in fluid viscosities, as demonstrated by
Figure 3.
5. Comparison of Two Methods for Computing the Color Gradient
In
Section 3.4, we presented the original method of calculating the color gradient as proposed by Rothman and Keller [
24], Gunstensen et al. [
25], and Grunau et al. [
60]. This method of calculating the color gradient has been used successfully in many applications (e.g., [
29,
55]). However, Leclaire et al. [
70] noted that standard color gradient models (as described heretofore in this paper) are plagued by problems such as spurious fluid velocities near fluid interfaces and the inability to model fluids of widely varying densitities, and that these problems are due partly to the fact that the calculation of the color gradient (Equation (
17)) contains discretization errors that are directionally biased (anisotropic). Leclaire et al. [
70] therefore presented alternative ways of calculating the color gradient that remove the anisotropy of the discretization errors, which improves the accuracy and robustness of the model. We here refer to these as “isotropic” color gradient calculations, in contrast to the “original” color gradient calculation presented in Equation (
17).
For a D2Q9 lattice, as shown in
Figure 1, the following modification to Equation (
17) can be used [
70]:
in which the weights
are given by the following:
For other lattice schemes (e.g., D3Q15 and D3Q27), the reader is referred to Leclaire et al. [
70].
In
Figure 4, we compare the original gradient approach to the isotropic gradient approach by applying both approaches to the problem of a “bubble test” or “droplet test”. For this test, a red fluid droplet of radius
R is emplaced in a field of blue fluid, the system is allowed to equilibrate, and then the pressure drop is measured across the interface of the droplet. In two dimensions, the theoretical pressure drop across the interface is
, where
is the interfacial tension specified by the user. The measured value of
from the CGM simulation can be compared to the theoretical value of
as a way to validate the CGM method. In
Figure 4, the top row of panels shows the shape of the bubble after equilibration under different test conditions, and the bottom row of panels shows the agreement between measured and theoretical values of
for those test conditions. For all simulations, the overall domain size was 128 × 128 l.u.; the specified interfacial tension was
(in LBM units); the interface thickness parameter
; the viscosity
l.u.
2/t.s.; the simulations were allowed to equilibrate for 80,000 time steps before
was measured; and the radius of the red droplet was varied between 16 and 32 l.u. (the top row of panels shows the results for the cases in which
l.u.).
The left-most column in
Figure 4 shows the results when
,
, and the original gradient is used. It can be seen that the droplet retains a mostly circular shape (panel (A)) and that the measured values of
agree well with the theoretical relationship (panel (D)). A user might reasonably conclude that the original gradient calculation is acceptable for these test conditions. The center column of the figure shows the results when
and the original gradient is used. In this case, the measured values of
are still close to the theoretical values (panel (E)), but the shape of the droplet is noticeably non-circular (anisotropic; panel (B)). The error in the gradient calculation is observable in the anisotropic shape of the droplet. Therefore, the right-most column of
Figure 4 shows the results from the same conditions as the center column, but using the isotropic gradient calculation instead of the original gradient calculation. The measured values of
are slightly improved (panel (F)), and the droplet shape attains the desired circular shape (panel (C)). A comparison of panel (B) to panel (C) shows that the isotropic gradient is clearly preferable to the original gradient under these test conditions.
Moreover, there is a distinct difference in the generated spurious velocities in the original color gradient and the isotropic color gradient methods. For the test case shown in
Figure 4 when R = 32 l.u., the maximum spurious velocities are equal to
l.u./t.s. when using the original gradient calculation but are reduced to
l.u./t.s. when the isotropic color gradient is used. These results are in agreement not only with the observations of Leclaire et al. [
70] but also with those of Lafarge et al. [
93] and Mora et al. [
94]. The subject of spurious velocities in these simulations will be revisited in
Section 7.
Therefore, in general, we recommend the isotropic gradient calculation (Equations (
31) and (
32)) over the original gradient calculation (Equation (
17)). The simulation results are improved without any meaningful increase in the complexity or run time of the computer codes. However, when employing the isotropic color gradient, the user must be certain to use Equation (
22) rather than Equation (
21) when calculating the
A parameter to yield a desired value of
.
6. Application of a Force or Acceleration to the Fluids
A fluid flows in response to a pressure gradient or in response to a force acting on the fluid. Therefore, to simulate either single-phase or multi-phase flow, we must have methods for incorporating pressure gradients and/or external forces acting on the fluid(s). One way to do this is by specifying boundary conditions, e.g., specifying the fluid pressure or the fluid velocity on the boundaries of the domain [
95]. Another approach is by including forces into the LBM simulations; methods that incorporate forces are often referred to as “forcing schemes” [
56,
96].
Many forcing schemes have been presented in the literature; a thorough review has been provided by Bawazeer et al. [
96] for the flow of a single fluid. Here, we consider two of the most common forcing schemes and demonstrate how to apply them to a multi-phase flow simulation. In the first approach, originally proposed by Shan and Chen [
20], external forces acting on the fluid are accounted for by including an acceleration term in the equilibrium distribution function
. In the second approach, proposed by Luo [
97,
98], a source term is added to include the force or acceleration as part of the collision step of the CGM.
In the method of Shan and Chen [
20], the macroscopic velocity
in the computation of
is replaced by a new velocity
that includes the effects of an acceleration
acting on fluid
k. The acceleration
need not necessarily be the same on the red fluid and the blue fluid. Thus, Equation (
14) becomes
in which
and
represents the interpolated relaxation time at location
and time
t. The remainder of the color gradient algorithm remains unchanged. Thus, in practice, only the calculation of
needs to be changed to implement this forcing scheme.
The method of Luo [
97,
98] accounts for forces in a different manner than the method of Shan and Chen [
20]. Here, the macroscopic velocity
and the calculation of
remain unchanged, i.e., Equation (
14) is used as presented. To account for the acceleration
acting on the fluids, a source term
is calculated as:
in which
is given by Equation (
7). The source term
must be calculated for both fluids at each location
, each time
t, and for each of the nine directions. As with the method of Shan and Chen [
20], the method of Luo [
97,
98] allows for a different acceleration acting on the red and blue fluids. The source term is then incorporated into the collision step as follows:
in which
is given by Equation (
16) assuming that the BGK algorithm is used.
We compared the two forcing schemes described above via a layered Poiseuille flow validation test. In this test, red and blue fluids both flow between two parallel plates. A layer of red fluid is “sandwiched” in the middle of the channel between two layers of blue fluid. An acceleration
a is applied in the
direction to the red fluid only, which induces flow. The situation is depicted graphically in
Figure 5. This is a classic validation test for simulations of multi-phase flow because there is an analytical solution for the resulting velocity profile in the channel; see, for instance, Liu et al. [
88].
We performed the test using a domain of 10 nodes in the
x-direction and 120 nodes in the
y-direction. As shown in
Figure 5, the top and bottom walls are solid boundaries at which a no-slip boundary condition (half-way bounceback) is imposed. Periodic boundary conditions are applied on the left and right boundaries, which is why only 10 nodes are required in the
x-direction. We performed the test for both the Shan and Chen [
20] forcing scheme, which we now call the “feq-accel” method following Bawazeer et al. [
96], and the Luo [
97,
98] forcing scheme, which we now call the “source term” method. For both methods, we tested viscosity ratios (
) of 0.25 and 4.0; thus, a total of four simulations were performed. For all tests, the interfacial tension
, the applied acceleration on the red fluid was
l.u./(t.s.)
2, the interface thickness parameter
, the fluid densities
, and simulations were run for at least 80,000 time steps to ensure that steady state was reached.
The results of the simulations are shown in
Figure 6. The figure shows the velocity profiles of the fluids between the two parallel plates. At the top and bottom of the domain (i.e., at the two plates), the fluid velocity is 0 because of the no-slip boundary condition. The velocity reaches a maximum in the middle of the channel. There are two key findings as illustrated in
Figure 6: first, there is no noticeable difference between the the left two panels [
20] and the right two panels [
97,
98] of the figure, indicating that the two forcing schemes yield indistinguishable results for this test problem; second, both methods yield results that agree nearly perfectly with the analytical solution, indicating that either method is acceptable for the conditions tested.
The equivalence of the two forcing schemes in
Figure 6 is not surprising for the particular test problem considered. An examination of Equations (
10), (
14), (
16) and (
33)–(
36) shows that the two methods are mathematically equivalent for cases in which the last two terms of the
distribution functions can be ignored. This is the case for grid-aligned Poiseuille flow; see Ginzburg et al. [
91]. Also, the relationship and agreement between these two methods for the case of single-fluid flow have been elucidated by Huang et al. [
99].
Based on the agreement between the two methods, it is not the case that one method is generally “better” than the other for multi-phase flow simulations that use the BGK collision operator. Nevertheless, we find it useful to present and compare the two proposed approaches here, for a few reasons. First, some previous papers have indicated that using gravitational acceleration in multi-phase simulations is not preferred (e.g., [
19,
75]), which points toward the use of an “external” forcing scheme. Second, Silva [
100] demonstrated that if the applied force is spatially varying, including the acceleration term in the
expression leads to a discrepancy between the CGM and the incompressible Navier–Stokes equations with an external body force under steady-state conditions; this also argues in favor of the source term forcing scheme. Finally, we found that when deploying more advanced CGM techniques, such as multiple relaxation times instead of the BGK collision scheme, one or the other of these two proposed forcing schemes can sometimes be easier to implement or code in practice. It is therefore useful to the reader to be familiar with both approaches in case a particular problem favors one over the other from a practical standpoint.
7. Challenges of Simulating Multi-Phase Flow in CGM
A multi-phase simulation in the CGM must be free from artificial fluid effects, which can arise near fluid–fluid and fluid–solid boundaries. For example, a good multi-phase simulation involves distinct phases separated by a thin interface, maintains fluid continuity between the phases, provides minimal fictitious or spurious velocities, and provides minimal fluid distortion. Therefore, a main challenge in the CGM is accurately depicting fluid flow while eliminating any artificial fluid effects. There is no numerical multi-phase flow model that is 100% accurate and free from error. However, by understanding the principles and theoretical foundations of the CGM, such errors can be minimized, and the method can provide a reasonable depiction of fluid flow processes.
One common error in the CGM is the presence of spurious velocities, i.e., the presence of fictitious fluid velocities where the fluids are supposed to be stationary. Such spurious velocities can arise near the interface of a bubble or droplet, as in
Section 5. In that section, we discussed how the calculation of the color gradient can influence the droplet shape, as shown in
Figure 4. The calculation of the color gradient can also affect the magnitude of spurious velocities. The algorithms discussed heretofore in this paper have made efforts to reduce or eliminate those fictitious velocities, but they usually do not disappear completely [
68,
70,
94]. Specifically, for the case shown in
Figure 4, the maximum magnitude of these spurious velocities is around
l.u./t.s. when using the “original” color gradient and around
l.u./t.s. when using the isotropic color gradient; see
Figure 7. By using a higher-order gradient discretization, artificial velocities can be reduced, which also accompanies a reduction in the distortion in fluid shape (as seen in
Figure 4).
In a CGM simulation, the major challenges are minimizing the presence of spurious velocities, ensuring pressure continuity between phases, minimizing the interface thickness, and minimizing distortion in fluid shape (e.g., droplet shape). This paper focused on the BGK-CGM formulation, and errors were considered in the context of common CGM code-validation tests that can be implemented with the BGK collision algorithm—which means that we considered relatively “easy” test conditions. In cases where simulations must account for fluid wettability, a higher viscosity ratio, and/or a higher density ratio, errors are likely to become more prominent. In future papers in this series, we will review efforts that have been made to minimize errors in more sophisticated contexts [
87,
101,
102].
Another challenge in executing the LBM simulations—not limited to the color gradient method—is appropriately determining the relationship between “LBM variables” and “real-world variables”. This is achieved by using appropriate unit conversions for length, time, and mass. For instance, what real-world length scale is represented by one lattice unit, and what real-world time scale is represented by one time step? The concepts of scaling the LBM units have been considered previously by Pan et al. [
5], Krüger et al. [
56], and Baakeem et al. [
103], among others. A key point is that, in many instances, particularly if we want to model the flow of low-viscosity fluids, the LBM lattice unit and time step must correspond to very small values of real-world length and time—millimeters and milliseconds, or perhaps even smaller. Thus, a simulation that takes hours to run might only simulate, say, the fluid flow through a 10 cm × 10 cm square for a period of a few minutes. Therefore, modeling fluid flow through large domains (a scale of meters) over time scales of hours or days can be very computationally expensive. A way to address the challenge of computational expense is through the parallelization of the LBM algorithms, which has been considered elsewhere [
12,
15,
18,
19,
104].
8. Summary and Conclusions
Over the past 30 years, the lattice Boltzmann method (LBM) has become increasingly popular for modeling multi-phase fluid flow in porous media, and one popular variant of the LBM is the color gradient method. However, along with the rising popularity of the color gradient method has come a proliferation of different proposed algorithms and strategies for implementing various aspects of the method. Selecting the “best” algorithms and subroutines is daunting, especially for relatively new users of the method. Therefore, we aim to critically review the capabilities and implementation of the CGM, particularly for modeling pore-scale multi-phase flow in porous media, through a series of papers, of which this is the first.
In this paper, we provided a brief introduction to the LBM and CGM that enables and facilitates consideration of the subsequent topics. Following that introduction, we reviewed three specific aspects of color gradient modeling: different methods for modeling the flow of fluids of moderately different viscosities, different methods for calculating the color gradient, and different methods for modeling external forces or accelerations acting upon the flowing fluids. Specific findings from this paper include the following:
Understanding these aspects of the color gradient method is necessary and sufficient to allow the user to perform two common “benchmark” tests of lattice Boltzmann modeling, namely bubble tests and layered Poiseuille flow.
Future papers in the series will build upon these topics, considering phenomena or conditions such as fluids of widely differing viscosity and/or density, how to introduce the “wettability” of solid surfaces and specify a desired contact angle, how to simulate fluid flow in a domain with an open boundary condition (e.g., fluid flushing out of a porous medium), and how to extend the CGM from two spatial dimensions to three. By systematically reviewing these key aspects and features, this series of papers will extend our collective ability to apply the CGM to a variety of important problems in geosciences and engineering.