## 1. Introduction

[2] Capillary control on fluid/fluid displacement in porous media is important to model in many applications of interest, including studies of residual water or oil in hydrocarbon reservoirs and long-term storage of supercritical CO_{2} in geological formations. In the context of CO_{2} storage, capillary pressure is directly related to two of the main trapping mechanisms—*structural* and *residual* (or capillary) trapping [e.g., *Saadatpoor et al*., 2010; *MacMinn and Juanes*, 2009; *Juanes et al*., 2010].

[3] In the structural trapping mechanism, upward CO_{2} migration due to buoyancy is prevented by a low-permeable formation layer, cap rock, or nonconductive fault. However, the CO_{2} could still be mobile and move laterally, or alternatively, the CO_{2} pressure could build up over time and exceed the entry pressure required for continued upward migration into the overburden low-permeable rock [*Saadatpoor et al*., 2008, 2010]. Thus, the structural trapping mechanism is regarded as unreliable because it could lead to leakage in an activated fault, for example. Once leakage or continued upward migration occurs, the CO_{2} pressure could decrease again and the water phase may snap off the CO_{2} in the layer below.

[4] The second mechanism—residual trapping—refers to the amount of CO_{2} left behind as isolated and trapped droplets that form within the water phase due to capillary forces during movement of the trailing edge of the CO_{2} plume [*MacMinn and Juanes*, 2009; *Juanes et al*., 2010]. This movement is described by an imbibition process, and the volume fraction of capillary trapped CO_{2} fluid constitutes the residual saturation. This mechanism is advantageous for CO_{2} storage, because the trapped fluid compartments are distributed over a large area and consequently this increases the sequestration potential by the chemical trapping mechanisms and minimizes the risk for leakage.

[5] An evaluation of the sequestration potential by structural and residual trapping requires knowledge of the CO_{2} capillary entry pressures to investigate capillary seal integrity, as well as drainage and imbibition capillary pressure curves in the various formation layers to determine residual saturations. It is well known that these properties depend on the formation wettability, and hence it is important to investigate the wetting properties of CO_{2}/water/rock systems. Wettability is normally quantified at the pore scale as the contact angle *θ* that fluid drops form with the (flat) solid surface in the presence of another fluid and is measured through the wetting (often water) phase. Some grain surfaces may be intrinsically hydrophobic (*θ* > 90°), whereas neighboring ones are hydrophilic (*θ* < 90°). Wettability changes (e.g., from hydrophilic to hydrophobic) can be brought about by prolonged contact with nonaqueous phase or due to reactions on solid surface. In a study by *Kim et al*. [2012], a contact angle increase from around 0° to 80° was observed in CO_{2}/brine/silica systems due to reactions between CO_{2} and the silica surface. *Espinoza and Santamarina* [2010] measured contact angles between CO_{2} and water on water-wet quartz and calcite minerals and observed values in the range 20°–40°. They also found that CO_{2} could be wetting relative to water on hydrophobic surfaces, such as oil-wet quartz. *Bikkina* [2011] measured contact angles on quartz and calcite substrates and found values ranging between 30° and 90°.

[6] The above investigations suggest that pore-scale models for computing fluid distributions and capillary pressure curves for CO_{2} storage should account for nonzero contact angles. The common approach has been to perform calculations in pore networks of idealized geometry [e.g., *Blunt*, 2001]. Pore-network modeling can easily implement different contact angles since the pores and throats are straight, and wettability can differ pore by pore [*van Dijke et al*., 2002; *Piri and Blunt*, 2005]; however, it assumes simplified pore geometry and implements ad-hoc rules for interface transition from one pore (throat) element to the next. Therefore, while it is a fast method, it does not have the resolution we desire for fundamental understanding of pore-scale wettability and its influence on residual saturations and capillary pressure curves. More recently, advanced techniques have been developed to simulate multiphase displacements directly in three-dimensional (3-D) images of porous rocks. These include the pore-morphology-based methods [e.g., *Hilpert and Miller*, 2001; *Silin et al*., 2010], which are computationally efficient but calculate the shape of the fluid interfaces using a union of spheres approximation; the level set methods (LSM) [*Prodanović and Bryant*, 2006, 2009; *Prodanović et al*., 2010; *Rodriguez et al*., 2012], which calculate sharp fluid interfaces as surfaces of mean curvature at subgrid resolution; and the lattice Boltzmann methods (LBM) [e.g., *Pan et al*., 2004; *Schaap et al*., 2007; *Ramstad et al*., 2012]. In particular, LBM in the steady state limit approximates the solution to the Navier-Stokes equations directly in the imaged geometry. It is easily parallelizable making it a popular choice for porous media applications. Assuming ample resolution, two-phase LBM has been tested in straight-wall pores to resolve contact angles within two degrees of accuracy [*Huang et al*., 2007], with the accuracy somewhat diminished for the zero contact angle. The contact angle in the mentioned reference was computed by comparing the final fluid volume to the analytic solution, rather than measuring the angle directly thus the accuracy assessment in the pores of varied cross sections will be trickier. To date, we have not found papers on mixed wettability applications or accuracy evaluations in geometries with curved walls (i.e., neighboring surfaces of different wettability), though some are reportedly in preparation (C. Landry and M. Schaap, personal communication). LBM approximates Navier-Stokes equation and includes both viscosity and capillarity effects, whereas the level set methods described here model capillarity only (see section 'Method Description'). Standard two-phase LBM implementation [*Shan and Chen*, 1993] on D3Q19 lattice will require 38 floats per pore node, whereas LSM requires two, therefore, simulation in volumes of comparable sizes requires parallel LBM and serial LSM implementation, respectively. Further, LBM does not explicitly track interfaces: Boundary conditions (such as contact angle) are in effect applied to solid boundary nodes and somewhat misaligned with interfaces. Thus, we expect level set methods to perform better in complicated geometries, but that remains to be verified.

[7] The level set method [*Osher and Fedkiw*, 2003; *Sethian*, 1999] is an interface tracking method which describes the interfaces implicitly as the zero level set of a function *ϕ* which is one dimension higher than the interface. In this sense, it is similar to the phase-field method. Relationships between the level set method and the phase-field based interface tracking method for curvature-driven flow in the absence of a solid phase were discussed by *Sun and Beckermann* [2007]. The implicit description avoids the task of explicitly tracking each individual point of the interface, and inherent problem with tracking topological changes such as splitting or merging two interfaces. Therefore, the method is a good choice for modeling fluid distributions in porous media. The level set function *ϕ* assigns interior and exterior regions of the interface based on its sign. Interface evolution is governed by the level set equation

which can be equivalently written as

where *V _{n}* is the normal component of the velocity representing the forces in the problem of interest. Since the function

*ϕ*is constant along the zero level set, the normal to the interface is given as , and thus . While there are many possible functions

*ϕ*that can describe an interface, for numerical stability it is paramount that its gradients are neither large or small (we provide more technical details in section 'Method Description'). Level set methods are a mature field, and implementation of core routines for discretization and reinitalization are available in Fortran/C/C++ within Level Set Method Library LSMLIB (K. T. Chu and M. Prodanović, Level Set Method Library (LSMLIB), http://ktchu.serendipityresearch.org/software/lsmlib/index.html), as well as in MATLAB/Octave within Toolbox of Level Set Methods [

*Mitchell and Templeton*, 2005].

[8] *Prodanović and Bryant* [2006] extended the application range of the level set method to model critical displacements events during drainage and imbibition as well as complete capillary pressure curves in 3-D rock images including fractures [*Prodanović and Bryant*, 2009; *Prodanović et al*., 2010]. In this problem, *V _{n}* represents the balance between capillary and interfacial forces. They introduced a second level set function,

*ψ*, to describe the pore structure in which

*ψ*= 0 represents the solid surfaces. A “no-penetration” constraint [

*Prodanović and Bryant*, 2006;

*Sethian*, 1999] was enforced at the end of each time step to prevent the fluid interfaces from invading the solid matrix. As a consequence, the zero level sets of

*ϕ*is perfectly aligned with the solid surface in regions of the pore space occupied by the nonwetting fluid. The consistency with strongly wetting conditions and

*θ*= 0° was demonstrated [

*Prodanović and Bryant*, 2006]. This zero contact angle implementation for drainage and imbibition in porous materials is available in LSMPQS software (Level Set Method based Progressive Quasi-static (LSMPQS) algorithm software, http://users.ices.utexas.edu/∼masha/lsmpqs/index.html). The method enables access to all the details on topology of phases as well as interfaces. Topology changes of the interfaces (splitting during Haines jumps [

*Haines*, 1927] in drainage, merging known as Melrose criterion [

*Melrose*, 1965] during imbibition) are predicted by the method without manual intervention. These irreversible events contribute to significant hysteresis between capillary pressure versus saturation curves for drainage and imbibition.

[9] In this work, we develop a level set method for simulating capillary-controlled displacements with nonzero contact angles in pore geometries of arbitrary shape from 3-D rock images, and thereby extend the previous work by *Prodanović and Bryant* [2006, 2009] and *Prodanović et al*. [2010]. The presented evolution equation augments equation (2) with an extra term which imposes the contact angle in the solid phase. More precisely, a stepwise change is introduced in the level-set evolution velocity, and the steady state will give the correct contact angle boundary condition in the solid part of the computational domain, whereas the standard surface energy minimization is enforced in the void/pore space.

[10] Approaches that incorporate contact angles in level set methods for simulating dynamic contact lines, also including contact-angle hysteresis, have been proposed previously [*Spelt*, 2005; *Liu et al*., 2005; *Li et al*., 2010; *Choi and Son*, 2008; *Lee et al*., 2011]. However, most of these studies consider the flow of a droplet on flat solid surfaces, and the contact angle is formed by adding local reconstruction steps of *ϕ* around the contact lines in the reinitialization procedure [*Spelt*, 2005; *Liu et al*., 2005; *Li et al*., 2010]. *Lee et al*. [2011] utilized the solid-void signed distance function *ψ* to derive an evolution equation for the fluid level set *ϕ* in the solid phase to form the contact angle, whereas the standard level set advection equation was applied in the void space. While their solid-phase equation is similar to our contact-angle term, we combine the pore-space and solid-phase terms into a single evolution equation to be valid in the entire computational domain, which is more applicable to solid surfaces of arbitrary complexity. Finally, *Zhao et al*. [1998] introduced a variational approach for problems involving both the solid and void domains in which the interfacial tensions are different and related to the contact angle by Young's equation. An evolution equation that accounts for nonzero contact angles were derived based on constrained energy minimization of the system.

[11] The level set approach for modeling capillary-controlled displacements in porous media with contact angles is presented in section 'Method Description', followed by a description of the numerical implementation in section 'Numerical Implementation'. Computations of capillary pressure curves for drainage and imbibition at different contact angles are presented in section 'Simulation Examples' in several two-dimensional (2-D) and 3-D pore geometries. A discussion of computational issues is provided in section 'Discussion', followed by conclusions and a summary in section 'Summary and Conclusions'.