1 Introduction

The flow of one or more fluids in porous rocks at the field scale is modelled using Darcy’s law. Multiphase flow is represented by two functions of saturation: relative permeability and capillary pressure. Relative permeability is a dimensionless quantity, which indicates the average connectivity of a rock for a given phase when it partially saturates that rock (Muskat 1937). The capillary pressure, on the other hand, is the difference in pressure between two fluid phases at equilibrium (Leverett 1941). Although this definition of capillary pressure is precise at the pore scale at fluid–fluid interfaces, it becomes less accurate for large scales where the capillary pressure may be undefined once a phase loses its connectivity across a given domain. The capillary pressure will still be defined though at the pore scale at the interface of some disconnected fluid regions. For such cases, the corresponding relative permeability value for the disconnected phase is precisely zero, and only one phase is flowing inside that domain.

1.1 Importance of Upscaling

There are many experimental procedures used routinely in the industry to measure multiphase flow functions (Braun and Blackwell 1981; Johnson et al. 1959; Richardson et al. 1952; Osoba et al. 1951; Jones and Roszelle 1978); however, rock samples used are typically a few cm across, while the flow functions need to be input into reservoir simulation models with grid-block sizes of 10–100s m to predict flow at the km scale. In such cases, implementing an upscaling approach is required to capture the effects of sub-scale heterogeneities and the right balance of fluid forces into Darcy-scale simulations. Therefore, the main purpose of any upscaling process in porous media is to address two main factors as we increase the scale of investigation, the change in fluid forces and heterogeneity. The main fluid forces are viscous, capillary and gravitational forces. The relative importance of these forces varies depending on many parameters and strict separation between them may not be possible (Stephen et al. 2001; Hilden and Berg 2016). Nevertheless, it is usually observed that at relatively small scales capillary forces dominate the displacement process, while viscous and gravitational forces may become more important at larger scales (Odsæter et al. 2015; Kumar and Jerauld 1996; Jonoud and Jackson 2008a).

Numerous upscaling methods are available in the literature for two-phase flow (Guzman et al. 1999; Jacks et al. 1973; Kyte and Berry 1975; Stone 1991; Pickup and Sorbie 1996; Lohne et al. 2006; Virnovsky et al. 2004; King 1989; King et al. 1993; Coll et al. 2001; Wallstrom et al. 2002; Durlofsky 1997) among which flow-based methods are considered the most reliable. Under this category, two fundamental approaches are employed: steady-state and dynamic pseudos. These methods are similar in concept to how multiphase flow properties are determined experimentally, but here numerical experiments are conducted. They also share the same strengths and weaknesses with their experimental counterparts (Honarpour and Mahmood 1988). Dynamic pseudo-functions are derived by performing a flow simulation in some region of a larger domain using a fine mesh and finding the average properties that reproduce the behaviour using a coarser simulation grid. In general, all dynamic pseudo-functions, produced at large scales, where viscous forces become important, depend on boundary conditions and the underlying gridding properties. They are only correct for the specific grid and flow conditions used to derive them (Barker and Thibeau 1997; Barker and Dupouy 1999).

1.2 Steady-state Upscaling

The main idea in steady-state upscaling is to estimate the distribution of fluid saturation and then apply a sequence of single-phase simulations for each phase individually to determine the effective multiphase flow functions. The process is repeated at different average saturations. Under specific conditions of flow, the method becomes computationally very efficient since it removes the need to run dynamic simulations for the fine-grid model. This is achieved through the assumption that only one force dominates the displacement process, while the other forces can be neglected. The term capillary limit is commonly used to describe capillary-dominated displacements, and viscous limit for viscous-dominated displacements. Gravitational forces are commonly neglected, since the method is applied to much smaller scales than those at which they become important. In general, the steady-state method gives more robust, stable and physically correct effective functions that do not depend on the details of the gridding and are less sensitive to the boundary conditions. The method could be in some cases computationally cheaper than dynamic pseudo-functions depending on flow conditions (Jonoud and Jackson 2008b, a). It becomes, however, very costly when the main fluid forces are considered in determining fluid distributions (Odsæter et al. 2015; Kumar and Jerauld 1996; Virnovsky et al. 2004; Stephen and Pickup 1999; Saad et al. 1995).

It is assumed under capillary-controlled displacements that viscous forces are negligible at the scale under investigation. This assumption only holds for regions that are away from saturation fronts, or for displacements with a large-scale capillary number that approaches zero.

Most implementations of capillary-controlled steady-state upscaling in the literature do not account for large-scale trapping since they do not permit complete disconnection of phases at the Darcy scale at a finite capillary pressure (Pickup and Stephen 1998; Ekrann and Aasen 2000). A few studies, however, have looked into this problem more carefully. Yortsos et al. (1991, 1993) considered large-scale percolation but for drainage only. They did include the effect of large-scale saturation trapping, demonstrating its importance for two-dimensional, 2D, uncorrelated media. Kueper and McWhorter (1992) introduced a macroscopic invasion percolation theory to upscale capillary pressure functions. They accounted for trapped cells using a percolation algorithm, but did not consider the impact on average saturation as a consequence of trapping inside these cells. In addition, the study did not compute average relative permeabilities and only considered 2D domains.

In this study, we focus on steady-state upscaling for capillary-controlled displacements, where we allow complete disconnection of phases at the Darcy scale, accounting for large-scale trapping of fluids. For this, large-scale invasion percolation is used as outlined by Kueper and McWhorter (1992) and Yortsos et al. (1991, 1993), but extended to waterflooding, exploring the effects of wettability, while unambiguously accounting for large-scale fluid trapping inside trapped cells. This is illustrated using random permeability fields in 2D and 3D domains, correlated with local capillary pressure–saturation relationships using Leverett J-function scaling, assuming that heterogeneity in capillary pressure is connected primarily to heterogeneity in permeability and porosity. We also use characteristic J-function and local relative permeability curves that are typical for water-wet, oil-wet and mixed-wet systems.

We refer in this paper to the wetting phase as water and the non-wetting phase as oil, although the process is applicable to any pairs of immiscible fluids, including \(\text {CO}_2\)-brine systems where large-scale trapping is extremely important for storage security (Saadatpoor et al. 2010; Juanes et al. 2006).

2 Darcy-scale Saturation-Dependent Functions

Before going into the detail of large-scale trapping mechanisms, we define unambiguously large-scale saturation-dependent functions used in Darcy-scale simulations. Figure 1 shows typical capillary pressures and relative permeabilities for drainage and waterflooding. The main point here is that we do not allow the capillary pressure to diverge to infinity at end-point saturations: irreducible water \(S_{\mathrm{wir}}\) and residual oil saturations \(S_{\mathrm{orw}}\). Instead, the functions are bounded by a maximum and a minimum value, \(p^{\mathrm{max}}_{\mathrm{c}}\) and \(p^{\mathrm{min}}_{\mathrm{c}}\). To identify these points, the corresponding relative permeability functions are used, for when they are zero at the end-point saturations, the limits on the capillary pressure functions are well-defined. In this case, the phases are completely disconnected at the pore level, forming isolated clusters that are completely immobile.

In other cases, \(p^{\mathrm{max}}_{\mathrm{c}}\) and \(p^{\mathrm{min}}_{\mathrm{c}}\) may correspond to relative permeability values that are not zero but extremely small to the point that they can be considered immobile. Upon a closer look at the pore level, such a phase might be connected in thin layers (Valvatne and Blunt 2004). At larger scales, this layer flow might be neglected considering the timescale of the process (Blunt 2017). Here, a threshold value \(k^{\mathrm{c}}_{\mathrm{rf}}\) is imposed, below which layer flow is ignored. Having said this, there are no clear guidelines on how to find this cut-off value; it is case dependent. This will be investigated more thoroughly in future studies. In this study, we use a well-defined limits on capillary pressure functions, corresponding to zero relative permeabilities at end-point saturations.

If instead we only allowed the relative permeability to be zero at an infinite capillary pressure, then we would never disconnect phases in a steady-state simulation, since—for any finite imposed capillary pressure—the flow of both phases would be finite. We would then be unable to capture large-scale trapping; the residual saturation, regardless of heterogeneity, would be the residual saturation in the input relative permeability.

Fig. 1
figure 1

A schematic of saturation-dependent functions defined at large scales. a Typical capillary pressures for drainage (green) and waterflooding (blue). b Typical relative permeabilities for drainage (green) and waterflooding (blue). Capillary pressures are bounded by \(p^{\mathrm{max}}_{\mathrm{c}}\) and \(p^{\mathrm{min}}_{\mathrm{c}}\), corresponding to \(k_{\mathrm{rf}}=0\), or \(k_{\mathrm{rf}} \le k^{\mathrm{c}}_{\mathrm{rf}}\), for \(f=\{\mathrm{o},\mathrm{w}\}\)

3 Theory of Large-scale Trapping of Fluids

There are two main trapping mechanisms that must be accounted for when calculating average fluid volumes and connectivities. These occur at the large scale and are distinct from the local trapping at the pore scale that is accounted for by end-point saturations in the local capillary pressures and relative permeabilities, mentioned above. The first mechanism is the trapping of water by oil during drainage. As oil invades the system at a given position of capillary equilibrium, referred to as \(p^{\mathrm{level}}_{\mathrm{c}}\), some regions of the domain may trap some movable water as movable water as movable oil fills completely neighbouring regions in which the relative permeability to water \(k_{\mathrm{rw}}\) drops to zero. The trapped water volumes in these regions cannot be estimated from the local capillary pressure–saturation relationship \(p_\mathrm{c}(S_\mathrm{w})\) at a given \(p^{\mathrm{level}}_{\mathrm{c}}\), as in conventional approaches, but rather a special treatment is required. Figure 2 demonstrates this trapping mechanism graphically in 2D systems, where the relevant cells are labelled from 1 to 5. Corresponding drainage capillary pressures are also shown in Fig. 2b. As fluids are brought to equilibrium at discrete, but elevated levels, water is trapped, locally, once \(p^{\mathrm{level}}_{\mathrm{c}}\) reaches \(p^{\mathrm{max}}_{\mathrm{c}}\) in a given cell. From the local capillary pressures in Fig. 2b, this local trapping of water takes place in the following order: cells 1,2,3 and 4. Large-scale trapping only happens when \(p^{\mathrm{level}}_{\mathrm{c}}\) reaches \(p^{\mathrm{max}}_{\mathrm{c}}\) of cell 4, at which the movable water in cell 5 becomes disconnected from the rest of the water in the system. As \(p^{\mathrm{level}}_{\mathrm{c}}\) increases above \(p^{\mathrm{max}}_{\mathrm{c}}\) of cell 4, \(S_\mathrm{w}\) in cell 5 will remain fixed at \(S^{\mathrm{trap}}_{\mathrm{w}}\), as indicated in Fig. 2b, and will not follow the local capillary pressure defined for that cell.

Fig. 2
figure 2

An illustration of capillary trapping during drainage at the Darcy scale in 2D systems. a The arrangement of cells in the 2D system, showing their labels. Green indicates cells with local-scale trapping of water, while red indicates cells with large-scale trapping. b Corresponding local capillary pressure functions demonstrating the trapped water saturation \(S^{\mathrm{trap}}_{\mathrm{w}}\) in cell 5

The second trapping mechanism is illustrated in Fig. 3. Here, oil is trapped by only-water-movable regions. The process occurs during waterflooding, in mixed-wet and oil-wet systems. As \(p^{\mathrm{level}}_{\mathrm{c}}\) decreases, the water saturation increases until, in some regions, the relative permeability to oil \(k_{\mathrm{ro}}\) drops to zero, trapping movable oil in surrounded regions. This is shown in Fig. 3b where as \(p^{\mathrm{level}}_{\mathrm{c}}\) drops below \(p^{\mathrm{min}}_{\mathrm{c}}\) of cell 4, oil is trapped in cell 5 and stays fixed at \(S^{\mathrm{trap}}_{\mathrm{w}}\) as \(p^{\mathrm{level}}_{\mathrm{c}}\) continues to decline. The water saturation does not change in cell 5, since there cannot be any displacement of the trapped oil. In Fig. 3a, the arrangement of cells is shown in the 2D system, where blue indicates cells with local trapping of oil, while red indicates cells with large-scale trapping.

Fig. 3
figure 3

An illustration of capillary trapping during waterflooding at the Darcy scale in 2D systems. a The arrangement of cells in the 2D system, showing their labels. Blue indicates cells with local-scale trapping of oil, while red indicates cells with large-scale trapping. b Corresponding local capillary pressure functions demonstrating the trapped water saturation \(S^{\mathrm{trap}}_{\mathrm{w}}\) in cell 5

4 Steady-State Upscaling: Revised Procedure

In this section, we give a detailed description of the revised two-phase capillary-controlled steady-sate upscaling method. In the capillary limit, it is assumed that fluids are distributed inside a region of interest in such a way that minimizes capillary pressure gradients. In the complete absence of other forces, capillary equilibrium is achieved when the gradient of capillary pressure approaches zero, resulting in a stationary distribution of fluids that is unique for the given set of initial and boundary conditions. At the Darcy scale, capillary equilibrium can be achieved by running a dynamic simulation for a given set of initial and boundary conditions until reaching a stationary fluid distribution. This is, however, a computationally very expensive procedure. A much more efficient and simpler way is to estimate the fluid distribution without running a dynamic simulation.

The key idea is to use the local capillary pressure–saturation relationships that are already known at the grid-block scale and use them to estimate directly the saturation distributions. The main problem with this approach, which can be avoided by using dynamic simulations, is that fluid volumes required to achieve a certain capillary equilibrium state at a given local region might not be reached since there is no connected path for that fluid to flow to that region. In other words, a phase must make a connected path from inlet boundaries to the region of interest. From local relative permeability–saturation relationships, it is possible to identify these regions that do not allow a given phase to flow through them. This concept is illustrated graphically in Fig. 4, in which the water saturation distribution is estimated at three positions of \(p^{\mathrm{level}}_{\mathrm{c}}\). The presented capillary pressures are typical for a waterflooding process in a mixed-wet system. When \(p^{\mathrm{level}}_{\mathrm{c}}=6\) kPa, cell j does not allow water to move across it as the relative permeability to water is zero; only oil is mobile. At \(p^{\mathrm{level}}_{\mathrm{c}} = 0\) kPa, both phases are mobile through all cells, whereas when \(p^{\mathrm{level}}_{\mathrm{c}}=-6\) kPa, cell j becomes disconnected to oil as only water is allowed to move across it. In this last case, the relative permeability to oil is zero.

Fig. 4
figure 4

Computations of \(S_\mathrm{w}\) from waterflood \(p_\mathrm{c}(S_\mathrm{w})\) at three values of \(p^{\mathrm{level}}_{\mathrm{c}}\) in a system with three local capillary pressures labelled i, j and k. When \(p^{\mathrm{level}}_{\mathrm{c}}=6\) kPa, cell j does not allow water to move across it as the relative permeability to water is zero; only oil is mobile. At \(p^{\mathrm{level}}_{\mathrm{c}} = 0\) kPa, both phases are mobile through all cells, whereas when \(p^{\mathrm{level}}_{\mathrm{c}}=-6\) kPa, cell j becomes disconnected to oil as only water is allowed to move across it. In this last case, the relative permeability to oil is zero

The revised upscaling process then starts by assigning a capillary pressure level, \(p^{\mathrm{level}}_{\mathrm{c}}\), at which capillary equilibrium is imposed for the connected phases in the domain. From local capillary pressure curves, the saturation distribution is estimated. The corresponding relative permeability values are also computed from local relative permeability curves, \(k_{\mathrm{rp}}(S_\mathrm{w})\) for \(p=\{\mathrm{o},\mathrm{w}\}\), and used to indicate whether a cell, or a node, can percolate a given phase across it or not. Once local non-percolating cells are identified, a solver that fills cells and determines whether a phase forms a connected cluster that spans the whole domain, is called; we refer to them as invaded cells. Such a condition confirms the presence of a global connectivity of the system. The solver is also used to identify cells that can percolate a given phase but could not be reached as a result of being locked in by neighbouring non-percolating cells. These are termed trapped cells, and they do not contribute to the overall connectivity of the system. In addition, special treatment is required to account for the trapping of fluids inside these trapped cells, as described previously in Sect. 3. Algorithms developed to tackle such problems are described next.

5 Filling Cells at a Given Capillary Pressure

In this section, we describe the algorithm used to determine invaded cells in a system. We simply describe how to invade cells for a given, specified capillary pressure. In the following section (Sect. 6), we describe how we account for trapping of fluids as the imposed capillary pressure is varied during a displacement. We here start by defining two main index functions, the phase mobility and the phase connectivity indices as detailed below, where subsequent calculations depend on both of them. We introduce a simple and efficient algorithm that works for structured and unstructured simulation grids.

5.1 Phase Mobility Index \(\varvec{\gamma _{\mathrm{p}}}\)

The mobility index, \(\varvec{\gamma _{\mathrm{p}}}\), for a given phase, p, is an array defined as:

$$\begin{aligned} \varvec{\gamma _{\mathrm{p}}} = [\gamma _{\mathrm{p}_1}, \gamma _{\mathrm{p}_2}, \dots ,\gamma _{\mathrm{p}_n}]^{\varvec{T}}, \end{aligned}$$
(1)

where p refers to either oil, denoted as o, or water, denoted as w. The array has n elements equivalent to the number of cells in a simulation grid. The elements of \(\varvec{\gamma _{\mathrm{p}}}\) are defined as follows:

$$\begin{aligned} \gamma _{\mathrm{w}_i}= \left\{ \begin{array}{l l} 0, &{} \quad {p^{\mathrm{max}}_{\mathrm{c}_i} \le p^{\mathrm{level}}_{\mathrm{c}} }, \\ 1, &{} \quad \text {otherwise,} \end{array} \right. \ \end{aligned}$$
(2)

and,

$$\begin{aligned} \gamma _{\mathrm{o}_i}= \left\{ \begin{array}{l l} 0, &{} \quad {p^{\mathrm{min}}_{\mathrm{c}_i} \ge p^{\mathrm{level}}_{\mathrm{c}} }, \\ 1, &{} \quad \text {otherwise.} \end{array} \right. \ \end{aligned}$$
(3)

Equations 2 and 3 state that a cell i takes a value of 0 if a phase is immobile, otherwise the cell takes a value of 1. If the oil phase, for instance, is immobile for a given cell i, then \(\gamma _{\mathrm{o}_i}=0\) for that cell, otherwise \(\gamma _{\mathrm{o}_i}=1\). The index \(\varvec{\gamma _{\mathrm{p}}}\), therefore, is used to identify cells that have the ability to transmit a given phase and hence is termed the phase mobility index.

The process here represents a single step in a classic invasion percolation algorithm where \(\varvec{\gamma _{\mathrm{p}}}\) indicates whether a phase can potentially flow across a given cell at a specified \(p^{\mathrm{level}}_{\mathrm{c}}\) or not (Kueper and McWhorter 1992; Yortsos et al. 1991, 1993; Hunt et al. 2014). The next step then is to use this mobility index to determine whether a given phase forms a connected path across a system or not. This is described below.

5.2 Phase Connectivity Index \(\varvec{\psi _{\mathrm{p}}}\)

The phase connectivity index, \(\varvec{\psi _{\mathrm{p}}}\), for a given phase, p, is a vector defined as:

$$\begin{aligned} \varvec{\psi _{\mathrm{p}}} = [\psi _{\mathrm{p}_1}, \psi _{\mathrm{p}_2}, \dots ,\psi _{\mathrm{p}_n}]^{\varvec{T}}, \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(4)

where the subscript p refers to either oil, denoted as o, or water, denoted as w. The vector has n elements equivalent to the number of cells in the simulation model. The elements of \(\varvec{\psi _{\mathrm{p}}}\) are either 0 or 1, where 1 indicates that a cell is invaded, otherwise it is not. The index function \(\varvec{\psi _{\mathrm{p}}}\), therefore, is used to indicate cells that are connected to the main cluster of a phase. The evolution of \(\varvec{\psi _{\mathrm{p}}}\) with time is governed by

$$\begin{aligned} \varvec{\psi ^{{k}{+1}}_{\mathrm{p}}} = \varvec{A_{\mathrm{p}}} \, \varvec{\psi ^{{k}}_{\mathrm{p}}}, \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(5)

where the superscript k refers to the timestep number and \(\varvec{A_{\mathrm{p}}}\) is a symmetric n-by-n matrix, given by

$$\begin{aligned} \varvec{A_{\mathrm{p}}} = \varvec{\varGamma _{\mathrm{p}}} \left( \varvec{B} + \varvec{I} \right) \varvec{\varGamma _{\mathrm{p}}}, \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(6)

where \(\varvec{\varGamma _{\mathrm{p}}}\) is an n-by-n diagonal matrix having the vector \(\varvec{\gamma _{\mathrm{p}}}\) in its diagonal, \(\varvec{B}\) is the adjacency matrix and \(\varvec{I}\) is the identity matrix. The adjacency matrix \(\varvec{B}\) is a square matrix in which the number of rows and columns is equal to the number of cells in a simulation model. The elements of this matrix are either 0 or 1, where 1 indicates that there is a connection, or a link, between a pair of cells (West 2001). More formally, the matrix can be constructed for any simulation model as follows:

$$\begin{aligned} B_{ij}= \left\{ \begin{array}{l l} 1, &{} \quad \text {if cell { i} is connected to cell { j}}, \\ 0, &{} \quad \text {otherwise,} \end{array} \right. \ \end{aligned}$$
(7)

where \(B_{ij}\) refers to the element in row i and column j of the matrix \(\varvec{B}\).

The matrix \(\varvec{\varGamma _{\mathrm{p}}}\) has the following structure:

$$\begin{aligned} \varvec{\varGamma _{\mathrm{p}}} = \left( \begin{array}{ccccc} \gamma _{\mathrm{p}_1}\\ &{} \gamma _{\mathrm{p}_2} &{} &{} \\ &{} &{} \ddots \\ &{} &{} &{}\gamma _{\mathrm{p}_n} \end{array} \right) , \qquad p \in \{\mathrm{o},\mathrm{w}\}. \end{aligned}$$
(8)

Equation 5 is a first-order difference equation that describes the evolution of invaded cells through a model. The process usually starts from one of the boundaries by providing an initial state of invaded cells, \(\varvec{\psi ^{\textit{0}}_{\mathrm{p}}}\), where, as previously mentioned, the integer 1 indicates that a cell is invaded, while 0 indicates it is not. The invaded cells are then updated using Eq. 5. Because of the way the matrix \(\varvec{A_{\mathrm{p}}}\) is defined in Eq. 6, at each iteration, \(\varvec{\psi ^{\textit{k}\text {+1}}_{\mathrm{p}}}\) stores positive integer numbers which might be larger than one, indicating the number of possible visits to a given cell. For the purpose of our algorithm, all nonzero elements are reset to 1 at the end of each update. Iterations are then performed until the number of invaded cells does not change over time, at which the loop is terminated. This stationary distribution of invaded cells is referred to as \(\varvec{\psi ^{\infty }_{\mathrm{p}}}\) and is used in all subsequent calculations. In practice, the state of the cells at the far boundary from where the process has started are checked. If at least one of the cells has been invaded, \(\psi ^{\infty }_{\mathrm{p}_\mathrm{i}} = 1\), then a given phase is said to have established a global connectivity across the system at the specified \(p^{\mathrm{level}}_{\mathrm{c}}\). Calculations can then be performed to determine average relative permeabilities, where only invaded cells are taken into consideration. The overall algorithm for this filling process is shown in Fig. 5.

Fig. 5
figure 5

A flowchart showing the algorithm for filling cells at a fixed \(p^{\mathrm{level}}_{\mathrm{c}}\) for both oil and water

From the elements of \(\varvec{\gamma _{\mathrm{p}}}\) and \(\varvec{\psi ^{\infty }_{\mathrm{p}}}\), we calculate two important average quantities of the system. The first one is \(\xi _{\mathrm{p}}\), which describes the fraction of open cells, or cells that are accessible to a given phase. This parameter is particularly important in basic percolation theory, from which a critical fraction \(\xi _{\mathrm{c}}\) is identified and used to indicate precisely when a global connectivity develops; it is universal for randomly disordered and infinitely large systems (Hunt et al. 2014; Grimmett 1999). \(\xi _{\mathrm{p}}\) can be calculated as

$$\begin{aligned} \xi _{\mathrm{p}} = \dfrac{1}{N} \sum \limits _{i=1}^{n}\gamma _{\mathrm{p}_i}, \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(9)

where N is the total number of cells and \(\gamma _{\mathrm{p}_i}\) is the phase mobility index defined previously in Eqs. 1, 2 and 3.

The second quantity is \(\eta _{\mathrm{p}}\), which is defined as the fraction of invaded cells; it is given by

$$\begin{aligned} \eta _{\mathrm{p}} = \dfrac{1}{N} \sum \limits _{i=1}^{n} \psi ^{\infty }_{\mathrm{p}_i}, \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(10)

where \(\psi ^{\infty }_{\mathrm{p}_i}\) is the elements of the stationary distribution of invaded cells defined previously in Sect 5.2. These parameters will be used in Sect. 8 to validate the percolation solver for 2D and 3D systems.

6 Large-scale Invasion Percolation with Trapping

We now describe our large-scale invasion percolation algorithm that accounts for large-scale saturation trapping. In the previous section, we showed how to fill cells—finding invaded cells—at a given \(p^{\mathrm{level}}_{\mathrm{c}}\), but here we allow \(p^{\mathrm{level}}_{\mathrm{c}}\) to vary between different equilibrium positions. We also show how we determine the saturation distribution at each \(p^{\mathrm{level}}_{\mathrm{c}}\), while accounting for fluid trapping.

A flowchart that illustrates this is shown in Fig. 6. We start first by determining the \(\varvec{p^{\mathrm{level}}_{\mathrm{c}}}\) distribution in which the events of trapping are represented by its elements, \(p^{\mathrm{level}}_{\mathrm{c}_j}\). This distribution can be estimated either from \(\varvec{p^{\mathrm{max}}_{\mathrm{c}}}\) for drainage, or from \(\varvec{p^{\mathrm{min}}_{\mathrm{c}}}\) for waterflooding, corresponding for maximum and minimum capillary pressure distributions, respectively. This will be explained more in Sect. 9 when we show our examples.

Before iterating on \(p^{\mathrm{level}}_{\mathrm{c}_j}\), \(\varvec{p^{\mathrm{level}}_{\mathrm{c}}}\) is sorted either in descending or in ascending order, depending on the displacement process being modelled. In waterflooding, for instance, the distribution is sorted in descending order, resembling the process for steady-state experiments, in which capillary pressure is brought to equilibrium in discrete levels from a higher to a lower equilibrium state. On the other hand, the distribution for drainage is sorted in ascending order as capillary equilibrium rises incrementally. Then, we initialize an array, \(\varvec{p^{\mathrm{trap}}_{\mathrm{c}}}\), to store the capillary pressure levels, or events, at which trapping happens in each cell. The length of this array is equivalent to the number of cells N in the model. \(\varvec{p^{\mathrm{trap}}_{\mathrm{c}}}\) is initialized to zero, indicating that all cells are initially not trapped.

We then start the iterations at a given \(p^{\mathrm{level}}_{\mathrm{c}_j}\), from which the mobility indices, \(\varvec{\gamma _{\mathrm{w}}}\) and \(\varvec{\gamma _{\mathrm{o}}}\), are computed as in Eqs. 2 and 3. After that, the solver described in Fig. 5 is called to determine the stationary distribution of invaded cells, \(\varvec{\psi ^{\infty }_{\mathrm{p}}}\). At the current position of \(p^{\mathrm{level}}_{\mathrm{c}_j}\), trapped cells m are identified as those that allow a phase to move across them \((\gamma _{\mathrm{p}_\mathrm{m}}=1)\), but have not been invaded at the current event \((\psi ^{\infty }_{\mathrm{p}_\mathrm{m}}=0)\), giving that they have not been trapped from previous events \((p^{\mathrm{trap}}_{\mathrm{c}_\mathrm{m}}=0)\). This is a crucial step in the process since we need to find the new trapped cells at the large scale and at the current \(p^{\mathrm{level}}_{\mathrm{c}_j}\). These conditions represent the trapping mechanisms as detailed in Sect. 3. We also exclude cells with \((\gamma _{\mathrm{p}_\mathrm{m}}=0)\) as they represent cells with local trapping.

The trapped cells m are assigned then to the current \(p^{\mathrm{level}}_{\mathrm{c}_j}\) where this value will stay constant. This condition is stated in Fig. 6 in set-builder notation. The average water saturation \(\tilde{S}_{\mathrm{w}}\) can then be calculated at the end of each iteration, as follows

$$\begin{aligned} \tilde{S}_{\mathrm{w}} = \dfrac{\sum \limits _{i=1}^{n} \phi _i V_{\mathrm{b}_i} S_{\mathrm{w}_i} }{\sum \limits _{i=1}^{n} \phi _i V_{\mathrm{b}_i} }, \end{aligned}$$
(11)

where \(\phi _i\) is the porosity, \(V_{\mathrm{b}_i}\) is the bulk volume in m\(^3\), and \(S_{\mathrm{w}_i}\) is the water saturation of cell i determined inversely from local \(p_{\mathrm{c}_i}(S_{\mathrm{w}})\), where \(p^{\mathrm{level}}_{\mathrm{c}_j}\) is used for non-trapped cells \((p^{\mathrm{trap}}_{\mathrm{c}_i}=0)\), and nonzero elements of \(\varvec{p^{\mathrm{trap}}_{\mathrm{c}}}\) are used for trapped cells.

Fig. 6
figure 6

A flowchart illustrating the algorithm for macroscopic invasion percolation where \(p^{\mathrm{level}}_{\mathrm{c}}\) is varied. This also shows the computations of average fluid saturation at each \(p^{\mathrm{level}}_{\mathrm{c}}\) accounting for fluid trapping for both oil and water

7 Average Relative Permeability Algorithm

The computation of average relative permeability is described by a flowchart in Fig. 7. At a given capillary equilibrium state, \(\xi _{\mathrm{p}}\) is computed and checked. When \(\xi _{\mathrm{p}} \ne 1\), this indicates that some cells with local trapping are present which might produce some large-scale trapping regions. In this case, a percolation solver is called to confirm global connectivity of a phase. Once confirmed, a flow solver is called to calculate \(\tilde{k}^{\mathrm{d}}_{\mathrm{rp}}\) using Eq. 12. The key step here is to remove the trapped cells at both the local and the large scales from the main matrix, since they do not contribute to the flow, and their inclusion could make the matrix ill-conditioned or even singular.

Fig. 7
figure 7

A flowchart demonstrating the computations of average relative permeabilities for oil and water, considering the impact of invasion percolation with trapping

The average relative permeabilities are computed from:

$$\begin{aligned} \tilde{k}^{\mathrm{d}}_{\mathrm{rp}} = \dfrac{\mu _{\mathrm{p}}}{ \mu _{\mathrm{s}}} \dfrac{\tilde{Q}^{\mathrm{d}}_{\mathrm{p}}}{ \tilde{Q}^{\mathrm{d}}_{\mathrm{s}}} , \qquad p \in \{\mathrm{o},\mathrm{w}\}, \quad d \in \{x,y,z\}, \end{aligned}$$
(12)

where \(\tilde{k}^{\mathrm{d}}_{\mathrm{rp}}\) is defined as the average relative permeability for a phase p in the direction d parallel to one of the coordinate axes of the three-dimensional system, \(\mu _{\mathrm{p}}\) is the phase viscosity in Pa.s and \(\mu _{\mathrm{s}}\) is the fluid viscosity used in single-phase calculations. The parameter \(\tilde{Q}^{\mathrm{d}}\) is the average volumetric flux within a volume of interest in a direction d in m\(^3\)/s. The subscripts p and s are used to indicate whether the volumetric flux is obtained from two-phase or single-phase flow calculations, respectively. Both functions, \(\tilde{Q}^{\mathrm{d}}_{\mathrm{p},\mathrm{s}}\), can be computed from numerical simulations as follows:

$$\begin{aligned} \tilde{Q}^{\mathrm{d}}_{\mathrm{p},\mathrm{s}} = \dfrac{1 }{m^\mathrm{d }} \sum \limits _{\jmath =1}^{m^\mathrm{d}} \sum \limits _{\ell \in \varOmega _\jmath }^{} Q_{\{\mathrm{p},\mathrm{s}\}_\ell } , \qquad p \in \{\mathrm{o},\mathrm{w}\}, \quad d \in \{x,y,z\}, \end{aligned}$$
(13)

where \(m^\mathrm{d}\) is the total number of cross-sectional areas in the averaged volume perpendicular to a flow in direction d, \(Q_{\mathrm{p}_\ell }\) is a volumetric flux across a link \(\ell \) between two neighbouring nodes in m\(^3\)/s and \(\varOmega _\jmath \) here indicates the set of links, or connections, intersecting the \(\jmath \)-th cross-sectional area. The way to use Eq. 13 to compute average flow rates is, therefore, to first calculate total flow rates across each cross-sectional area and then to average them out. If we allow, for instance, a flow along the x-axis in a 3D system with a cubic grid, we first sum the fluxes from the cells intersecting a single plane in the y–z direction. We record this value and repeat the process in all other parallel planes. The number of planes in this case is equivalent to \(m^\mathrm{d}\). We then average these fluxes as shown in Eq. 13.

Similarly for \(\tilde{Q}^{\mathrm{d}}_{\mathrm{s}}\), average volumetric flux for single-phase flow, the calculations are performed as with \(\tilde{Q}^{\mathrm{d}}_{\mathrm{p}}\) in Eq. 13. The only difference is in the definition of the volumetric flux \(Q_{\mathrm{p},\mathrm{s}}\) across any pair of nodes i and j. This is given by the multiphase Darcy equation:

$$\begin{aligned} Q_{\{\mathrm{p},\mathrm{s}\}_{ij}}= \dfrac{k_{ij} A_{ij}}{L_{ij}} \, \lambda _{\{\mathrm{p},\mathrm{s}\}_{ij}} \left( P_{\{\mathrm{p},\mathrm{s}\}_{i}} - P_{\{\mathrm{p},\mathrm{s}\}_{j}}\right) , \qquad p \in \{\mathrm{o},\mathrm{w}\}, \end{aligned}$$
(14)

where \(k_{ij}\) is the absolute permeability of the link in m\(^2\), which is calculated as the harmonic mean of the absolute permeability of the nodes i and j: \(\left( \frac{2k_i k_j}{k_i+k_j}\right) \), \(A_{ij}\) is the cross-sectional area between the two nodes in m\(^2\), \(L_{ij}\) is the length between them in m, and \(\lambda _{\mathrm{p}_{ij}}\) is the phase mobility defined as, for two-phase flow \(\lambda _{\mathrm{p}_{ij}} = \frac{ k_{\mathrm{r}_{\mathrm{p}}} (S_{\mathrm{w}_{ij}}) }{\mu _{\mathrm{p}}}\), while for single-phase flow it is given by \(\lambda _{\mathrm{s}_{i}} = \mu ^{-1}_{\mathrm{s}}\). The phase mobility in two-phase flow is calculated from individual nodes as \(\lambda _{\mathrm{p}_{ij}} = \frac{1}{2} \left( \lambda _{\mathrm{p}_{i}} + \lambda _{\mathrm{p}_{j} }\right) \), given that the saturation distribution is already known as previously described in Sect. 4. In Eq. 14, \(P_{\{\mathrm{p},\mathrm{s}\}}\) is the phase pressure in Pa for two-phase \(P_\mathrm{p}\) or single-phase \(P_\mathrm{s}\) flow calculations. They are determined by solving a system of equations constructed by applying material-balance principles, from which we obtain: \(\sum _{j} Q_{\{\mathrm{p},\mathrm{s}\}_{ij}}=0\).

For the calculation of average relative permeabilities, it is important to apply the same set of boundary conditions for pressure when solving for \(P_\mathrm{p}\) and \(P_\mathrm{s}\). In our solution, a pressure boundary condition is applied uniformly across inlet and outlet boundaries in one flow direction while other boundaries are kept closed. We find the average relative permeabilities for the whole computational domain. It should be also noted that \(\mu _{\mathrm{s}}\) can be arbitrary chosen with no impact on the average permeabilities, as long as Eq. 12 is strictly followed; this is also true for the magnitude of pressure drop applied at the boundaries of the system.

8 Validation

We here validate our percolation solver described previously in Sects. 5 and 6, by using a 2D model with a square grid and a 3D model with cubic grid blocks. The process simulated here is mainly for validation purposes and does not represent either conventional drainage or waterflooding. The main idea is to compute, using our solver, the site percolation thresholds and compare them to estimates from the literature of percolation theory. This only involves identifying trapped cells without accounting for trapped fluids inside them.

We use \(1000 \times 1000\) grid cells for the 2D model, while \(200 \times 200 \times 200\) grid cells are used for the 3D case. Figure 8 demonstrates the results, in which the fraction of invaded cells for an invading phase, \(\eta _{\mathrm{w}}\) is plotted against the fraction of open cells for the invading phase, \(\xi _{\mathrm{w}}\). The percolation threshold \(\xi _{\mathrm{c}}\) is estimated at 0.59 and 0.31 in 2D and 3D systems, respectively. These values are determined here precisely from the steady-state distribution of invaded cells \(\varvec{\psi ^{\infty }_{\mathrm{w}}}\) at the far boundary, as detailed in Sect. 5. From percolation theory for site percolation, \(\xi _{\mathrm{c}} = 0.5927\) in a 2D square lattice (Jacobsen 2015; Newman and Ziff 2000; Lee 2007), and \(\xi _{\mathrm{c}} = 0.3116\) in a 3D simple cubic lattice (Xu et al. 2014; Škvor and Nezbeda 2009; Deng and Blöte 2005), which closely matches results obtained from our simulations. Higher accuracy can be achieved by increasing the number of grid cells and applying a very small step size in \(\xi _{\mathrm{w}}\).

Results, as shown in Fig. 8, indicate a strong correlation between the percolation threshold, \(\xi _{\mathrm{c}}\), and the dimensionality of the model. This is usually expressed in terms of the coordination number; the number of nearest neighbouring grid cells, being 4 in the 2D and 6 in the 3D models used here. As the coordination number increases, the percolation threshold decreases, making lattice representation for macroscopic percolations a very critical issue for 2D and 3D models, since they can be represented with different combinations of coordination numbers. For this, it is not obvious which coordination number should be used for a valid representation of a heterogeneous system. Nevertheless, it has been shown that these sensitivities to coordination number become less important in spatially correlated media, where cells with similar properties are clustered together (Ioannidis et al. 1993, 1996). Hence, it is less likely to have an accessible cell neighbouring a trapped cell. This, however, depends on the correlation length of the system under investigation (Ioannidis et al. 1996).

Fig. 8
figure 8

Fraction of invaded cells, \(\eta _{\mathrm{w}}\) against fraction of open cells, \(\xi _{\mathrm{w}}\) for 2D and 3D systems. For the 2D case, \(1000 \times 1000\) grid cells have been used to produce the results, while using \(200 \times 200 \times 200\) grid cells for the 3D case. The percolation threshold, \(\xi _{\mathrm{c}}\), is estimated from this plot at 0.59 and 0.31 for site percolation on the 2D square lattice and the 3D simple cubic lattice, respectively. \(\xi _{\mathrm{c}}\) is indicated in the plot by the sudden jump in \(\eta _{\mathrm{w}}\), which is very clear in 2D while being less obvious in 3D

Figure 9 shows spatial distributions of \(\varvec{\gamma _{\mathrm{w}}}\) and \(\varvec{\psi ^{\infty }_{\mathrm{w}}}\) for the 2D system at different values of \(\xi _{\mathrm{w}}\). The process starts from the left face in the horizontal direction, while boundaries on the vertical direction are closed. Blue here represents cells in which an invading phase resides (invaded cells), while other cells are trapped. These trapped regions contain two types of cell: (1) cells with local trapping of the invading phase (green), and (2) cells that are accessible by the invading phase but are trapped at the large scale as being locked in by the green cells (grey).

Figure 9a shows the stationary distribution at \(\eta _{\mathrm{w}}=2.64\%\) and \(\xi _{\mathrm{w}}=57.52\%\), where no global connectivity is observed. In Fig. 9b, simulations are shown for just below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=19.05\%\) and \(\xi _{\mathrm{w}}=59.32\%\). Figure 9c indicates invasion percolation just above \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=41.53\%\) and \(\xi _{\mathrm{w}}=59.42\%\). Lastly, Fig. 9d shows stationary distributions at \(\eta _{\mathrm{w}}=50.15\%\) and \(\xi _{\mathrm{w}}=60.51\%\), above \(\xi _{\mathrm{c}}\).

Fig. 9
figure 9

Site percolation on a square lattice consisting of \(1000 \times 1000\) grid cells. The process starts from the left face in the horizontal direction, while boundaries on the vertical direction are closed. Blue represents invaded cells while other cells are trapped. The trapped regions contain two types of cells: (1) green cells indicating that they do not percolate the invading phase across them (local trapping of the invading phase) and (2) grey cells representing cells with large-scale trapping; they are accessible by the invading phase but are surrounded by green cells. a The stationary distribution of invaded cells (blue) at a given capillary equilibrium state below the percolation threshold where there is no global connectivity (\(\eta _{\mathrm{w}}=2.64\%, \xi _{\mathrm{w}}=57.52\%\)). b The fluid distribution just below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=19.05\%\) and \(\xi _{\mathrm{w}}=59.32\%\). c Invasion percolation just above \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=41.53\%\) and \(\xi _{\mathrm{w}}=59.42\%\). d The distribution for at \(\eta _{\mathrm{w}}=50.15\%\) and \(\xi _{\mathrm{w}}=60.51\%\)

Similarly for the simple cubic model, Fig. 10 depicts large-scale invasion percolation in a 3D system. The invading phase is allowed to enter the system from one end while the opposite end is left open. The other boundaries are closed. Invaded cells are coloured based on their distance from the inlet boundary. Other cells are not displayed. Figure 10a shows the stationary distribution of invaded cells below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=1.68\%, \xi _{\mathrm{w}}=30.70\%\), whereas Fig. 10b displays simulation just below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=2.50\%\) and \(\xi _{\mathrm{w}}=30.89\%\). In Fig. 10c, invasion percolation just above \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=4.48\%\) and \(\xi _{\mathrm{w}}=31.13\%\) is demonstrated. Figure 10d shows stationary distributions at \(\eta _{\mathrm{w}}=6.74\%\) and \(\xi _{\mathrm{w}}=31.36\%\), well above \(\xi _{\mathrm{c}}\).

Fig. 10
figure 10

Invasion percolation on a simple cubic lattice with \(200 \times 200 \times 200\) grid cells. Two opposite boundary faces are open, while the other faces are closed. Coloured cells represent the stationary distribution of invaded cells at a given capillary equilibrium state. The change in colours indicates distance from inlet (blue being close to the inlet boundary). a The stationary distribution of invaded cells below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=1.68\%, \xi _{\mathrm{w}}=30.70\%\). b The distribution just below \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=2.50\%\) and \(\xi _{\mathrm{w}}=30.89\%\). c Invasion percolation just above \(\xi _{\mathrm{c}}\) at \(\eta _{\mathrm{w}}=4.48\%\) and \(\xi _{\mathrm{w}}=31.13\%\). d The distributions for \(\eta _{\mathrm{w}}=6.74\%\) and \(\xi _{\mathrm{w}}=31.36\%\)

9 Illustrative Examples

We present here an example solution using our large-scale invasion percolation algorithm coupled with a Darcy-scale solver. We do not consider hysteresis in the capillary pressure and relative permeability: locally trapped saturations are not allowed to change with initial saturation. This will be a topic for future work. For our simulations, we use two models: a 2D with \(1000 \times 1000\) grid cells, and another a 3D model with \(200 \times 200 \times 200\) grid cells.

We use synthetic data representing four different wettability states: strongly water-wet (SWW), weakly water-wet (WWW), mixed-wet (MW) and oil-wet (OW). For each wetting state, absolute permeability is randomly distributed from an uncorrelated log-normal distribution with a known mean and standard deviation. The mean is kept fixed in all simulations at \(\mu _{\ln k}= -29.9336\), equivalent to \(\mu _k=1\times 10^{-13}\) m\(^2\), while the standard deviation varies over two sets of values \(\sigma _{\ln k}=\{1,2\}\). Porosity is kept constant at \(\phi =0.25\).

Table 1 Parameters used to generate relative permeability and capillary pressure data in the Illustrative Examples section
Table 2 Base parameters used in the J-function calculations
Fig. 11
figure 11

Upscaled relative permeabilities in 2D for capillary-controlled displacements including the impact of percolation for different wettability states and permeability distributions with \(\sigma _{\ln k}=\{1,2\}\). a \(k_r\) data in strongly water-wet; b weakly water-wet; c mixed-wet; and d oil-wet systems. The original fine-grid \(k_r\) curves are also included for comparison purposes. The curves are plotted using average values from five simulations, while the bars represent their standard deviations

Fig. 12
figure 12

Upscaled relative permeabilities in 3D for capillary-controlled displacements including the impact of percolation for different wettability states and permeability distributions with \(\sigma _{\ln k}=\{1,2\}\). a \(k_r\) curves in strongly water-wet; b weakly water-wet; c mixed-wet; and d oil-wet systems. Original \(k_r\) curves are also included for comparison purposes. The curves are plotted using average values from five simulations, while the bars represent their standard deviations

For the modelling of multiphase flow functions, the following mathematical expressions are used:

$$\begin{aligned} p^{\mathrm{dr}}_{\mathrm{c}}(S_\mathrm{w})&= \left\{ \begin{array}{l l} \left( p^{\mathrm{max}}_{\mathrm{c}} - p_\mathrm{e}\right) \left( 1-\frac{S_\mathrm{w}-S_{\mathrm{wir}}}{1-S_{\mathrm{wir}}}\right) ^{n^{\mathrm{dr}}_{\mathrm{c}}} +p_\mathrm{e}, &{} \quad S_\mathrm{w} \in \left[ S_{\mathrm{wir}},1 \right] \\ \varnothing , &{} \quad S_\mathrm{w} \notin \left[ S_{\mathrm{wir}},1\right] \end{array} \right. \ \end{aligned}$$
(15)
$$\begin{aligned} p_{\mathrm{c}}(S_\mathrm{w})&= \left\{ \begin{array}{l l} p^{\mathrm{max}}_{\mathrm{c}} \left( 1-\frac{S_\mathrm{w}-S_{\mathrm{wir}}}{S^{*}-S_{\mathrm{wir}} }\right) ^{n^{+}_{\mathrm{c}}}, &{} \qquad \qquad S_\mathrm{w} \in \left[ S_{\mathrm{wir}},S^{*} \right] \\ p^{\mathrm{min}}_{\mathrm{c}} \left( \frac{S_\mathrm{w}-S^{*}}{1-S^{*}-S_{\mathrm{orw}}}\right) ^{n^{-}_{\mathrm{c}}}, &{} \qquad \qquad S_\mathrm{w} \in \left[ S^{*},1-S_{\mathrm{orw}} \right] \end{array} \right. \ \end{aligned}$$
(16)
$$\begin{aligned} k_{\mathrm{rw}}(S_\mathrm{w})&= \left\{ \begin{array}{l l} k^{\mathrm{max}}_{\mathrm{rw}} \left( \frac{S_\mathrm{w}-S_{\mathrm{wir}}}{1-S_{\mathrm{wir}}-S_{\mathrm{orw}}}\right) ^{n_{\mathrm{w}}}, &{} \qquad \qquad S_\mathrm{w} \in \left[ S_{\mathrm{wir}},1-S_{\mathrm{orw}} \right] \\ \varnothing , &{} \qquad \qquad S_\mathrm{w} \notin \left[ S_{\mathrm{wir}},1-S_{\mathrm{orw}} \right] \end{array} \right. \ \end{aligned}$$
(17)
$$\begin{aligned} k_{\mathrm{ro}}(S_\mathrm{w})&= \left\{ \begin{array}{l l} k^{\mathrm{max}}_{\mathrm{ro}} \left( 1-\frac{S_\mathrm{w}-S_{\mathrm{wir}}}{1-S_{\mathrm{wir}}-S_{\mathrm{orw}}}\right) ^{n_\mathrm{o}}, &{} \quad \quad \, \, S_\mathrm{w} \in \left[ S_{\mathrm{wir}},1-S_{\mathrm{orw}} \right] \\ \varnothing , &{} \quad \quad \, \, S_\mathrm{w} \notin \left[ S_{\mathrm{wir}},1-S_{\mathrm{orw}} \right] \end{array} \right. \ \end{aligned}$$
(18)

where Eqs. 15 and 16 are used for capillary pressures for drainage \(p^{\mathrm{dr}}_{\mathrm{c}}(S_\mathrm{w})\) and waterflooding \(p_\mathrm{c}(S_\mathrm{w})\), respectively, while Eqs. 17 and 18 are used for water \(k_{\mathrm{rw}}(S_\mathrm{w})\) and oil \(k_{\mathrm{ro}}(S_\mathrm{w})\) relative permeabilities, respectively; \(p^{\mathrm{max}}_{\mathrm{c}}\) is the maximum capillary pressure in Pa, \(p^{\mathrm{min}}_{\mathrm{c}}\) is the minimum capillary pressure in Pa, \(p_\mathrm{e}\) is the entry pressure in Pa, \(S^{*}\) is the water saturation specified at zero capillary pressure, \(n^{\mathrm{dr}}_{\mathrm{c}}\) is the exponent used in the drainage capillary pressure, \(n^{+}_{\mathrm{c}}\) and \(n^{-}_{\mathrm{c}}\) are the exponents used in the positive and negative regions of the capillary pressure for waterflooding, respectively, \(n_{\mathrm{w}}\) and \(n_{\mathrm{o}}\) are the exponents used in the relative permeability functions for water and oil, respectively, \(k^{\mathrm{max}}_{\mathrm{rw}}\) is the maximum relative permeability to water, and \(k^{\mathrm{max}}_{\mathrm{ro}}\) is the maximum relative permeability to oil. J-function scaling Leverett (1941) is used to correlate capillary pressures with rock properties, resulting in the following expression:

$$\begin{aligned} p_{\mathrm{c}_i}(S_\mathrm{w})= \frac{ \sqrt{k_{\mathrm{b}} / \phi _{\mathrm{b}}} }{\sqrt{k_i / \phi _i} } \; p_{\mathrm{c}_{\mathrm{b}}}(S_\mathrm{w}) \end{aligned}$$
(19)

where \(p_{\mathrm{c}_i}\) is the capillary pressure at cell i in Pa, \(p_{\mathrm{c}_{\mathrm{b}}}\) is a base capillary pressure measured in the laboratory in Pa, \(k_i\) and \(\phi _i\) are absolute permeability and porosity in cell i in m\(^2\) and fraction, respectively, and \(k_{\mathrm{b}}\) and \(\phi _{\mathrm{b}}\) are base permeability and porosity, respectively.

Fig. 13
figure 13

Upscaled capillary pressures in 2D for capillary-controlled displacements for different wettability states and permeability distributions with \(\sigma _{\ln k}=\{1,2\}\). a \(p_\mathrm{c}\) curves in strongly water-wet; b weakly water-wet; c mixed-wet; and d oil-wet media. Original \(p_\mathrm{c}\) curves are also included for comparison purposes. The curves are plotted using average values from five simulations, while the bars represent their standard deviations

Fig. 14
figure 14

Upscaled capillary pressures in 3D for capillary-controlled displacements for different wettability states and permeability distributions with \(\sigma _{\ln k}=\{1,2\}\). a \(p_\mathrm{c}\) curves in strongly water-wet; b weakly water-wet; c mixed-wet; and d oil-wet media. Original \(p_\mathrm{c}\) curves are also included for comparison purposes. The curves are plotted using average values from five simulations, while the bars represent their standard deviations

All model parameters for multiphase flow calculations are listed in Table 1, while Table 2 lists the base parameters used in the J-function calculations, for both drainage and waterflooding. The parameters \(k_{\mathrm{b}}\) and \(\phi _{\mathrm{b}}\) are used as a reference for the J-function calculations. In a normal practice, these values are obtained from the same rock where the capillary pressure measurements \(p_{\mathrm{c}_{\mathrm{b}}}\) were taken from. The main purpose of the J-function scaling is to extrapolate capillary pressure information for systems with known basic properties, e.g. \(k_i\) and \(\phi _i\), for which capillary pressure data are originally unknown. For each wettability state, Eq. 19 is applied to generate a capillary pressure curve in each and every cell in our simulation model.

We now perform simulations to determine average quantities as previously described. For each wetting state, five simulations are performed for each \(\sigma _{\ln k}\). The computations of average relative permeabilities are performed at 16 capillary equilibrium states. The percolation simulations, on the other hand, are performed at a much more refined \(\varvec{p^{\mathrm{level}}_{\mathrm{c}}}\) distribution, estimated from \(\varvec{p^{\mathrm{max}}_{\mathrm{c}}}\) and \(\varvec{p^{\mathrm{min}}_{\mathrm{c}}}\), to identify accurately trapping, from which average water saturations are determined. The elements of \(\varvec{p^{\mathrm{max}}_{\mathrm{c}}}\) and \(\varvec{p^{\mathrm{min}}_{\mathrm{c}}}\) distributions can be calculated from Eq. 19 as follows:

$$\begin{aligned}&\displaystyle p^{\mathrm{max}}_{\mathrm{c}_i}&= \frac{ \sqrt{k_{\mathrm{b}} / \phi _{\mathrm{b}}} }{\sqrt{k_i / \phi _i} } \; p^{\mathrm{max}}_{\mathrm{c}} \end{aligned}$$
(20)
$$\begin{aligned}&\displaystyle p^{\mathrm{min}}_{\mathrm{c}_i}&= \frac{ \sqrt{k_{\mathrm{b}} / \phi _{\mathrm{b}}} }{\sqrt{k_i / \phi _i} } \; p^{\mathrm{min}}_{\mathrm{c}} \end{aligned}$$
(21)

where \(p^{\mathrm{max}}_{\mathrm{c}_i}\) and \(p^{\mathrm{min}}_{\mathrm{c}_i}\) are the maximum and minimum capillary pressures at cell i, \(p^{\mathrm{max}}_{\mathrm{c}}\) and \(p^{\mathrm{min}}_{\mathrm{c}}\) are given for all wetting conditions in Table 1. Other parameters are defined previously in Eq. 19. Repeated elements are removed from the distributions and sorted. The \(\varvec{p^{\mathrm{level}}_{\mathrm{c}}}\) distribution is then estimated by computing percentiles at every half a percentage point.

Figures 11 and 12 show the upscaled relative permeabilities for \(\sigma _{\ln k} = \{1,2\}\), for 2D and 3D, respectively. Each curve represents the overall average of the five simulations, while the bars indicate their standard deviations. We can observe, in general, that as \(\sigma _{\ln k}\) increases, the deviations of both \(\tilde{k}_{\mathrm{rw}}\) and \(\tilde{k}_{\mathrm{ro}}\) from the fine-grid functions become more apparent. It is also shown that the trapping of fluids also increases with \(\sigma _{\ln k}\), though the trapping in 2D is larger than in 3D. We also see in Fig. 11 that the maximum value of \(\tilde{k}_{\mathrm{rw}}\) and \(\tilde{k}_{\mathrm{ro}}\) decreases with more trapping, indicating that the additional trapped fluids preferentially fill some regions of the domain that have some contribution to the overall permeability; this is only true for 2D. In 3D, however, this is not observed (Fig. 12), suggesting that the additional trapped fluids occupy regions that do not contribute to the overall permeability of the sample.

The averaged water relative permeabilities are only finite once the water percolates across the system, which occurs at a finite occupancy. We see an increase in the minimum water saturation at which water flows across the domain. At the end of primary drainage, water is trapped at the large scale in isolated clusters distributed across the whole domain. As water is injected into the system, these clusters reconnect increasing the averaged water relative permeabilities more rapidly.

It is demonstrated that \(\tilde{k}_{\mathrm{ro}}\) generally increases over a wide range of \(\tilde{S}_{\mathrm{w}}\) as \(\sigma _{\ln k}\) increases, especially for SWW, WWW and MW media. This indicates that water preferentially resides in the lower permeability rock at a given \(\tilde{S}_{\mathrm{w}}\). Similarly for \(\tilde{k}_{\mathrm{rw}}\) in MW and OW systems, where it generally increases for the late values of \(\tilde{S}_{\mathrm{w}}\) as \(\sigma _{\ln k}\) increases, suggesting that the remaining oil now tends to occupy the lower permeability portions of the system.

Average capillary pressures are shown in Figs. 13 and 14 for 2D and 3D models, respectively. In general, little sensitivity is observed on the trends of the curves for all the wetting states and permeability distributions, except near the end-point saturations. What is observed is the trapping of fluids as shown in the figures and listed in Tables 3 and 4, for 2D and 3D systems, respectively. These values reported in the table are derived from the distributions generated from the five simulation runs. The symbols \(\tilde{S}_{\mathrm{wir}}\) and \(\tilde{S}_{\mathrm{orw}}\) are used to refer to the upscaled irreducible water and residual oil saturations, respectively, while \(\left| \varDelta S_{\mathrm{wir}}\right| \) and \(\left| \varDelta S_{\mathrm{orw}}\right| \) show the absolute difference between the upscaled quantities and the fine-grid inputs. As can be seen that more fluids are trapped at the Darcy scale as \(\sigma _{\ln k}\) increases.

We observe also that the trapping of water \(\tilde{S}_{\mathrm{wir}}\) does not vary between the different wetting states, but with \(\sigma _{\ln k}\) and the dimensionality of the system. This is because the capillary pressure function defined for drainage being the same for all the wetting states. On average, about 10% of the water is trapped at the large scale in 2D for \(\sigma _{\ln k}=1\), and 18% for \(\sigma _{\ln k}=2\), while about half of that is seen in 3D.

For the large-scale trapping of oil, we observe different behaviours than water between the wetting conditions, influenced by the capillary pressure functions for waterflooding. Here, the highest trapping happens in oil-wet media at 12% and 5% in 2D and 3D, respectively, at \(\sigma _{\ln k}=2\). This trapping is in addition to the pore-scale trapping, given by \(S_{\mathrm{orw}}\) in Table 1.

Table 3 Upscaled end-point saturations for the 2D model (1 million grid cells)
Table 4 Upscaled end-point saturations for the 3D model (8 million grid cells)

10 Conclusions

A modified upscaling procedure for steady-state capillary-controlled immiscible displacements is proposed, which accounts for the large-scale connectivity in Darcy-scale simulations. The key idea is that at a given capillary equilibrium state, some regions in the system may form disconnected clusters preventing global connectivity. To tackle such displacements, a revised steady-state upscaling algorithm is introduced accounting for the trapping of fluids in a large-scale invasion percolation displacement. The process is explained through illustrative examples, in which four different wettability states are studied—strongly water-wet, weakly water-wet, mixed-wet and oil-wet. It is observed that, at Darcy scale, the capillary trapping for water increases in heterogeneous media and is influenced mainly by the capillary pressure function defined for drainage. For the large-scale trapping of oil, we observe different behaviours between the wetting conditions, controlled by the capillary pressure functions for waterflooding, in which the highest trapping is observed in oil-wet systems.

The analysis of this paper could be extended in future studies to explore the impact of viscous forces, using realistic geology, and including the effects of hysteresis in the multiphase flow functions.