The effect of saturation history on three‐phase relative permeability: An experimental study

We investigate the effect of different saturation histories relevant to various oil displacement processes (including secondary and tertiary gas injections) on three‐phase gas/oil/brine relative permeabilities of water‐wet sandstone. It is found that three‐phase water (wetting phase) relative permeability is primarily a function of water saturation and shows no dependency upon saturation history. Three‐phase gas (nonwetting phase) relative permeability is also a function of gas saturation as well as the direction of gas saturation change. Three‐phase relative permeability to oil (intermediate‐wetting phase) appears to depend on all phase saturations, and saturation history have no significant impact on it. Three‐phase oil relative permeability shows weak sensitivity to initial oil saturation prior to gas injection. The functional forms of oil relative permeability with saturation, particularly at low oil saturations, are also examined. It is observed that, at high oil saturations where networks of oil‐filled elements govern oil flow, oil relative permeability exhibits a quartic form with oil saturation (kro∝So4) whereas, at low oil saturations where flow is believed to be controlled by layer drainage, it shows a quadratic form (kro∝So2) . The quadratic form of three‐phase oil relative permeability is consistent with the theoretical interpretation of layer drainage at the pore scale.


Introduction
The concurrent flow of three fluid phases, e.g., oil, gas, and brine, occurs frequently in petroleum reservoirs and during nonaqueous phase liquid (NAPL) migration in aquifers thereby warranting detailed studies of the process. Three-phase flow in porous media involves phenomena that are poorly understood. Among all factors affecting the flow process, relative permeability is one of the most important and least understood properties. This multiphase flow property is a manifestation of complicated pore-level displacement physics as well as fluid-fluid and solid-fluid interactions and characteristics. It can be either measured in the laboratory using representative rock-fluid systems or estimated using empirical correlations or physically based pore-scale models. The latter two, however, require high-quality experimental data for development and validation. Although the significance of three-phase relative permeability has long been recognized [Leverett and Lewis, 1941], a detailed review of experimental studies on three-phase relative permeability (A. H. Alizadeh and M. Piri, Three-phase flow in porous media: A review of experimental studies of relative permeabilities, submitted to Reviews of Geophysics, 2013) reveals that there is a limited number of well-characterized studies on this subject over the past decades. This is mainly because laboratory measurements of threephase relative permeability are almost prohibitively difficult, costly, and time-consuming. However, despite the difficulties involved, the recent surge in interest for better understanding of fundamentals of threephase flow as well as advances in experimental science and technology have led to renewed efforts in laboratory determination of three-phase relative permeability.
For a given rock-fluid system and under fixed experimental conditions, relative permeabilities are not unique functions of phase saturations, but may depend upon, for instance, saturation history. In two-phase flow, the study of the effect of saturation history on relative permeability is much less complicated since there is only one independent phase saturation. Thus, there are two directions of saturation change in twophase flow. The problem of saturation history in three-phase flow is more convoluted since there are two independent phase saturations, increasing the number of process paths significantly. When three phases are present, similar to two-phase flow, the saturation of each phase can increase or decrease. In addition to these two directions, the saturation of a phase can remain unchanged. Therefore, there are more than two saturation histories in three-phase flow.
The effect of saturation history on three-phase relative permeability has been the subject of several studies. Saraf et al. [1982] measured two-and three-phase relative permeabilities in water-wet fired Berea sandstone using both the steady-and unsteady-state methods under similar saturation histories. Three-phase unsteady-state gas relative permeability was found to be a function of gas saturation and gas saturation history. Three-phase gas relative permeabilities of the steady-state experiments, however, were less sensitive to gas saturation history. Three-phase relative permeability to water was only a function of water saturation and almost independent of saturation history. In the case of relative permeability to oil, the three-phase data were not strongly dependent on the direction of saturation change of liquid phases, but influenced by the gas saturation history. It was observed that, for a given oil saturation, three-phase oil relative permeability was higher for decreasing than for increasing gas saturation. This implies that gas trapping may facilitate oil flow. Oil recovery was also better when the core was flooded by gas and then water, instead of the opposite sequence. Maini et al. [1989] performed a series of steady-state relative permeability experiments on a water-wet sandpack at elevated temperature. It was observed that, despite considerable scatter, threephase water relative permeability depended only on water saturation. Gas relative permeability was also a function of only gas saturation in each saturation history. Three-phase relative permeability to oil showed some hysteresis and was found to vary with the other phase saturations. Oak [1990] measured two-and three-phase relative permeabilities in water-wet fired Berea sandstone cores for a large number of saturation histories. It was reported that three-phase relative permeability to water was mainly a function of water saturation and almost the same as two-phase water relative permeabilities (only slightly lower) at a given water saturation. Three-phase gas relative permeabilities depended mainly on gas saturation as well as the direction of gas saturation change. Three-phase relative permeability to oil varied with all saturations. The variation depended upon saturation history. It was reported that the reduction of residual oil saturation by waterflooding in the presence of trapped gas was greater than that in the simultaneous injection of water and gas. This suggests that low residual oil saturations may be achieved only in certain saturation paths and that the water and gas injection sequence can be important in oil recovery. Although all the studies mentioned above were conducted under the water-wet condition, there have also been some investigations [Oak, 1991a[Oak, , 1991b[Oak, , 1992Skauge and Larsen, 1994] for nonwater-wet conditions. While it may be inferred that, in water-wet media, relative permeability of the most wetting phase is independent of saturation history but relative permeabilities of the intermediate-wetting and the most nonwetting phases are affected by saturation history, there are some inconsistencies in the literature [Baker, 1995;DiCarlo et al., 2000], emphasizing the need for more research on the effect of saturation history on three-phase relative permeability and on the possible reasons for the observed discrepancies.
While factors, such as saturation history, may occur in both two-and three-phase flow, there are some phenomena, e.g., spreading and layer drainage, that only take place when all three phases are present. For instance, in a water-wet pore (or throat) element where water wets the solid surfaces and occupies the crevices, gas may reside in the center of the pore allowing oil to form spreading layers between water and gas as the intermediate-wetting phase. These layers are typically a few microns in thickness and, similar to wetting layers, maintain phase continuity and have a nonnegligible hydraulic conductivity. Formation of spreading oil layers sandwiched between water and gas in water-wet and mixed-wet pores is an important feature of three-phase flow through porous media. Flow of oil through these spreading layers, even though slowly, can lead to very low oil saturations, thereby improving recovery. While spreading and layer flow are not new concepts in fluid flow in porous media and a large number of studies Chatzis et al., 1988;Vizika, 1993;Blunt et al., 1995;Vizika and Lombard, 1996;Kalaydjian et al., 1997;Zhou and Blunt, 1997] have focused on their influences on residual oil saturation and recovery efficiency, only a few studies have been dedicated to examination of layer flow on three-phase relative permeabilities at low oil saturations-another motivation inspiring this study. Vizika and Lombard [1996] conducted secondary gravity assisted inert gas injection experiments using spreading and nonspreading fluid systems. For the water-wet condition, oil relative permeabilities were nearly the same at high oil saturations for both the spreading and nonspreading systems but showed differences at low oil saturations where layer flow manifested its role. While oil relative permeability was greater for the spreading fluid system and decreased gradually down to 10 24 at low oil saturations, it was smaller for the nonspreading system and fell abruptly to zero at higher oil saturation. Sahni et al. [1998] performed a series of secondary and tertiary gas gravity drainage experiments on a water-wet uniform sandpack and a water-wet Berea sandstone core under various initial saturation conditions. For sand, oil relative permeability was primarily a function of oil saturation and independent of Water Resources Research 10.1002/2013WR014914 ALIZADEH AND PIRI V C 2014. American Geophysical Union. All Rights Reserved. initial conditions; however, the functionality was different depending upon the spreading coefficient. In general, k ro / S a o where a varied with the spreading coefficient as well as the range of oil saturation. At high oil saturations, i.e., oil saturations higher than waterflood residual oil, a was about 4 for both spreading and nonspreading fluid systems whereas, at oil saturations lower than waterflood residual oil, a was around 2 only for spreading oils. Similar results were also reported by DiCarlo et al. [2000] for water-wet and mixedwet sandpacks. DiCarlo et al. [2000] remarked that the observed functional forms were not universal and depended on the porous medium. Pore network modeling and simple theoretical analysis [Fenwick and Blunt, 1998a;Piri andBlunt, 2005a, 2005b] reconfirm the proportionality of oil relative permeability with oil saturation squared at low oil saturations in spreading systems reported experimentally.
In this study, we investigate the effect of different saturation histories (relevant to various oil displacement processes including secondary and tertiary gas injections) on three-phase gas/oil/brine relative permeabilities of water-wet consolidated Bentheimer sandstone and on the stability of spreading oil layers and residual oil saturation. The functional forms of oil (intermediate-wetting phase) relative permeability with oil saturation, particularly at low saturations, are also examined. The experiments are conducted under steadystate conditions using a three-phase flow and computed tomography experimental apparatus specifically designed for three-phase flow studies under full fluid recirculation. The rock-fluid system consists of waterwet Bentheimer sandstone and brine/Soltrol 170/nitrogen. Fluid and fluid-fluid properties including viscosities, densities, and interfacial tensions are measured using equilibrated phases at experimental conditions (5.52 MPa and ambient temperature).
It is observed that three-phase water relative permeability is a function of only its own saturation and saturation history has a minor impact on it. Three-phase gas relative permeability also depends on its own saturation as well as saturation history. These two findings are consistent with the literature for water as the most wetting phase and gas as the most nonwetting phase in water-wet media. Three-phase relative permeability to oil varies with all saturations and is independent of saturation history. In addition, it shows weak sensitivity to initial oil saturation prior to gas injection. Independency of oil relative permeability to saturation history and its weak sensitivity to variations in initial oil saturation in a water-wet medium are contrary to the general findings in the literature. We investigate the possible reasons for these discrepancies. We also observe that, at high oil saturations where networks of oil-filled elements govern flow of oil, oil relative permeability exhibits a quartic form with oil saturation whereas, at low oil saturations where flow is believed to be controlled by layer drainage, oil relative permeability shows a quadratic form. The quadratic form of three-phase oil relative permeability has been observed experimentally in unconsolidated porous media and is consistent with the theoretical interpretation of layer drainage at the pore scale. Although we also observe a similar functional form in our consolidated porous medium, we believe that the trend may vary from one medium to another and may also depend on fluid systems.
In the following sections, details of the rock-fluid system, spreading coefficient measurements, experimental apparatus, and experimental procedure are first described. We then present saturation histories and twophase and three-phase relative permeability results and discuss the trends observed. A set of final remarks concludes the paper.

Rock and Fluid Properties
Two core plugs, 15.24 cm in length and 3.81 cm in diameter, were cut from a block of Bentheimer sandstone using tap water as a coolant, dried in an oven at 110 C for 3 days, and then cooled in a desiccator for 2 days. The plugs (Samples 1 and 2) were subsequently X-ray imaged to investigate their homogeneity. The threedimensional images of the samples demonstrated that they were homogeneous. Brine permeabilities of Samples 1 and 2 were 2.62 and 2.66 darcies, respectively, and their average porosities determined using X-ray imaging were 24.1 and 24.7%. The porosity values were consistent with those obtained independently through helium porosimetery on samples cut from the same block. Figure 1 shows the distribution of porosity along the length of the core samples. As observed, the porosity is uniform across each core sample, an indication of homogeneity. The details of porosity determination using X-ray imaging will be described later in this paper.
The aqueous phase was formulated using distilled water, 2 wt % CaCl 2 , 12 wt % NaI, and 0.01 wt % NaN 3 . Sodium azide was added to brine to avoid bacterial growth. A low-salinity brine containing 1.5 wt % CaCl 2 was used as a buffer between the working aqueous phase and cleaning solvents, when necessary. Soltrol 170 (a mineral oil) was purified by passing it through a dual-packed column of silica gel and alumina to remove polar contaminants, which might alter the water wetness of the rock, and then iodooctane (5 vol %) was added to the purified Soltrol to obtain the working oil phase. Viscosities of the equilibrated aqueous and oil phases were 1.144 and 2.526 mPa s, respectively, at the experimental conditions. These values were measured during the experiments using in-line viscometers. In the course of coreflooding experiments, two-and three-phase saturations were measured in situ using a medical CT scanner. Accordingly, sodium iodide and iodooctane were added as X-ray dopants to the aqueous and oil phases, respectively, in order to better distinguish the phases. All chemicals were reagent grade and used as received. Commercial nitrogen was used as the gas phase and withdrawn from a pressurized cylinder. The nitrogen viscosity was 0.0187 mPa s at the experimental conditions. This value was taken from the literature [Oak, 1989]. The fluid and fluid-fluid properties are listed in Table 1. In the rock-fluid system selected, the aqueous, oil, and gas phases were the most wetting, the intermediatewetting, and the most nonwetting phases, respectively. The aqueous and oil phases are hereafter referred to as water and oil, unless stated otherwise.

Spreading Coefficient Measurement
In this study, interfacial tension between pairs of phases was measured at equilibrium, i.e., in the presence of the third phase, using a new experimental apparatus. The apparatus was designed and constructed to perform pendant drop/rising bubble measurements under high-pressure and temperature conditions. It was also compatible with high-salinity brine as all wetted parts were made of Hastelloy TM C-276. The measurement cell accommodated two parallel high-pressure sapphire windows at its two bases to allow imaging of drops/bubbles during the measurements. Drop/bubble images were taken using a microscope with fully apochromatically corrected lenses attached to a high-resolution digital camera with a standard resolution of 2048 3 1536 (3 megapixels). The images were analyzed with the axisymmetric drop shape analysis (ADSA) technique. Pre-equilibration between all phases was provided using a stand-alone equilibration module consisting of a Hastelloy cell and a dual-cylinder Quizix TM pump. Densities of the equilibrated phases were also measured at experimental conditions using an Anton Paar DMA HPM TM density meter. More details of the experimental setup and measurement procedure can be found elsewhere [Saraji et al., 2013].
Prior to interfacial tension measurements, fluids were pre-equilibrated in the equilibration cell for 12 h. The equilibrated fluids were sampled from three ports located at the top, middle, and bottom of the equilibration cell, and then their densities were determined. The density values were 62.84, 802.13, and 1138.12 kg/m 3 for the equilibrated gas, oil, and brine phases, respectively. Subsequently, the measurement cell was pressurized and filled with one of the equilibrated fluids, and the other fluid was slowly introduced into the cell by means of a needle. The size of Figure 1. Slice-averaged porosity distribution along the length of the Bentheimer core samples used in this study determined using X-ray imaging. the needle (2.41 or 2.75 mm in outside diameter) for each fluid pair was selected so that the capillary and gravity forces of the drop were similar (i.e., Bond number 1). Figure 2 illustrates drop images taken for each fluid pair. Equilibrium interfacial tensions of the nitrogen-brine, nitrogen-oil, and oil-brine pairs were 61.714, 20.957, and 40.766 mN/m, respectively. Each of these values is an average of at least 10 measurements. Based on the measured interfacial tensions, it was found that the equilibrium spreading coefficient given by the following equation [Adamson, 1990]: C eq so 5c eq gw 2ðc eq go 1c eq ow Þ was close to zero for the fluid system used, implying that the oil phase would spread forming thick layers between the aqueous and the gas phases. In equation (1), c eq is the interfacial tension between two of the phases in the presence of the third phase, i.e., at equilibrium, and w, o, and g stand for water, oil, and gas, respectively. The spreading behavior of oil was also confirmed visually. When oil droplets were placed on brine in an open container in the presence of air, they immediately formed a thick layer between air and brine. These therefore provided us with evidence to believe that oil would form spreading layers sandwiched between gas and water at the pore scale during our three-phase experiments.

Description of Experimental Apparatus
The apparatus was designed for three-phase flow studies with full fluid recirculation, and since it is modular, it can be used for determining multiphase flow properties, such as relative permeability and capillary pressure, and also for examining a variety of different improved and enhanced oil recovery schemes [Piri, 2012]. The coreflooding setup is a closed-loop system composed of dual-cylinder Quizix TM pumps, Rosemount TMpressure transducers, Cambridge TM fluid viscometers, a Hassler-type core holder, a 3500 cm 3 three-phase separator, compensation accumulators, mechanical convection ovens, and a dual-orientation medical X-ray CT scanner. Figure 3 shows a detailed schematic diagram of the setup. All parts of the apparatus exposed to fluids were made of Hastelloy TM and other corrosion-resistant materials. Temperature and pressure of the setup can be elevated to 140 C and 68.95 MPa. Those elements of the apparatus that are not placed in the ovens are heated using heating tapes and wrapped with efficient insulation material to minimize heat loss.
As many as three fluids, e.g., water, oil, and gas, can be simultaneously injected into core samples at constant flow rates (or pressures) using three of the pumps. A dual-cylinder 5000 Quizix pump is used for water injection, and two dual-cylinder 6000 Quizix pumps are used for injection of oil and gas. The injection pumps withdraw their respective fluids for reinjection into the core sample from appropriate locations designated on the separator.
The fluids produced from the core sample are received by a dual-cylinder 6000 Quizix pump, as opposed to a customary back pressure regulator, in paired constant-pressure receive mode. This approach allows imposing a constant-pressure boundary condition at the outlet of the core and maintaining stable back pressures even at high flow rates over a large range of fluid viscosities. Accurate regulation of the back pressure leads to more stable pore-scale displacements and superior thermodynamic equilibrium between fluid phases in the core sample, which in turn result in more reliable measurements of flow properties for a given saturation history in miscible, partially miscible, and immiscible experiments. When the receiving cylinder of the back pressure regulation pump is filled with effluents, the second cylinder of the pump automatically takes over the receiving process at the same preset pressure. Control parameters of the pump must be  . Schematic diagram of the three-phase coreflooding setup used in this study [Piri, 2012]. adjusted such that the transition takes place very smoothly without introducing any pressure pulses into the core sample. This means that the second cylinder has to discharge its contents and pressurize to the preset value prior to the transition. After the transition, the first cylinder discharges its fluids (a mixture of water, oil, and gas) into the bottom of the separator and prepares as described. The fluid mixture is released into the separator through a piece of tubing drawn into the middle phase, oil. In order to avoid any disturbance in the fluids of the separator due to the release of the mixture, especially at high flow rates, the tubing is enclosed by a concentric pipe with several holes for hydraulic connectivity between released and residing fluids. Retracting the injection fluids from and delivering the effluent fluids to the separator provides full fluid recirculation. This capability not only creates much more stable equilibrium between the phases throughout experiments, but also reduces the need for additional fluids. Prior to the start of an experiment, all fluids are also recirculated through the apparatus, albeit bypassing the core holder, for a sufficiently long period of time in order to achieve equilibrium between the phases and minimize interphase mass transfer in the core during the experiments.
Injection of fluids into the separator by the back pressure regulation pump and intermittent withdrawal of fluids by the injection pumps can in principle lead to considerable variations in pressure of the separator, particularly at high flow rates, even though the volume of the separator is relatively large (3500 cm 3 ). This in turn might affect the equilibrium between the phases in the separator, especially in miscible or partially miscible flow experiments, and introduce uncertainties into saturation measurements. Furthermore, large variations in the pressure of the separator increases the amount of compression or decompression that the injection and back pressure regulation pumps have to perform to provide pulse-free flow at both inlet and outlet boundaries of the core. To reduce such effects, pressure of the separator is controlled by a compensation module that includes a dual-cylinder 6000 Quizix pump, operated in paired constant-pressure bidirectional mode, and two parallel-connected 2000 cm 3 accumulators (4000 cm 3 total volume). The accumulators are filled only with equilibrated water (the densest fluid in the separator) and gas. Gas is used in the accumulators as a damper because its compressibility mitigates any abrupt pressure shocks imposed by the separator pressure regulation pump. When the pressure of the separator rises above a given set point (usually the same or close to the back pressure), the separator pressure regulation pump immediately withdraws some water from the bottom of the separator to retrieve the set point pressure. Similarly, if the pressure of the separator falls below the set point, the pump immediately injects some water into the separator through the same port. The large volume of the separator also assists in the prevention of significant fluctuations in its pressure during this process. In the course of the pressure maintenance operation, the separator pressure regulation pump can automatically store water in or receive water from the auxiliary accumulators, when necessary.
The core holder is Hassler type and accommodates cylindrical core samples. It was constructed from low iron Aluminum to be transparent to X-ray beams and has two pressure ports along its main body, 2.54 cm away from the inlet and outlet faces of the core, to measure pressure drops free of capillary end effects. The core holder has a rubber sleeve to surround the porous medium through application of confining pressure. Overburden pressure is provided by mineral oil using a dual-cylinder 5000 Quizix pump and maintained relative to back pressure, thereby simulating the depth of hydrocarbon-bearing reservoirs. While the inlet spiral distribution end plug of the core holder has four flow lines, three for separate injection of three phases and one for upstream pressure determination, the outlet spiral end plug has two lines, one for the fluid mixture leaving the porous medium and one for downstream pressure determination. Prior to introduction of fluids into the core sample, their viscosities can be measured using in-line Cambridge viscometers installed after their respective injection pumps and before the core holder. The in-line viscometers provide true viscosity values of the phases at prevailing pressure-temperature and interphase equilibrium conditions. Pressure drops across the middle part of the core sample are measured by Rosemount differential pressure transducers. For better precision over a broad range of pressure drop, three differential transducers with various ranges are connected in parallel, and during a flow test, one is selected on the basis of the pressure drop value. In addition to the differential pressure, upstream and downstream pressures of the core are monitored by gauge pressure transducers. Prior to each set of experiments, all pump transducers are calibrated using a reference transducer. Pressure data are continuously recorded by a data logger.
Three-phase saturation measurements are made in situ using X-ray CT scanning. The scanner is a Phillips TM fourth generation medical CT scanner with 4800 stable solid-state detectors. It was retrofitted for petrophysical applications and also modified to rotate from its original, vertical orientation to the horizontal orientation, permitting experiments through vertically and horizontally placed rock samples. This modification was intended to reduce gravity segregation effects during flow experiments. When scanning vertically, the core holder is moved from the bottom into the scanner's gantry using a highly accurate vertical positioning system. For an experiment on a vertically placed core sample, the vertical positioning system is initially synchronized with the horizontal table of the scanner, and the synchronization is maintained throughout the experiment until the core holder is dismounted.

Experimental Procedure
A series of constant-flow rate steady-state two-and three-phase relative permeability experiments were performed on two vertically oriented water-wet Bentheimer core samples using a brine/Soltrol 170/nitrogen fluid system at ambient temperature and 5.52 MPa back pressure. A net overburden pressure of 1.72 MPa was applied during all displacements, and phase saturations were measured in situ using computed tomography. Details of in situ saturation and porosity measurements using X-ray imaging are given in Appendices A and B, respectively. Fluid lines connecting the differential pressure transducers to the core holder were filled with brine. Therefore, oil and gas potential gradients were corrected for relative permeability calculations. Below, we present the experimental procedure.

Direction of Fluid Injection
When gas is used as one of the fluid phases, laboratory experiments should preferably be conducted on a vertically placed sample to prevent gravity override, which may take place between the gas and other liquid phases in a core sample mounted horizontally. During gravity-stable gas flooding aimed at maximum oil recovery, gas is injected from the top of the vertically oriented core at a flow rate less than a critical rate [Willhite, 1986] in order to maintain a stable gas-liquid displacement front. However, the situation in a steady-state relative permeability experiment where two or three phases are concurrently injected into the core and fluid saturation distributions are assumed to be uniform along the length of the medium can be challenging. That is, in a vertically oriented porous medium, while one may consider injecting all fluids, e.g., water, oil, and gas, from the top because gas has the lowest density, there is a likelihood of water accumulation at the bottom of the core as water has the highest density.
The spatial distribution of fluids within the pore space is a consequence of the interplay of capillary, buoyancy, and viscous forces. When injecting gas from the bottom, both buoyancy and viscous forces act in the same direction, upward, leading to a greater chance of gravity segregation and, hence, nonuniform fluid distributions. However, if capillary forces dominate the displacement regime relative to the other two forces, the nonuniformity in the distribution of fluids may considerably diminish. This situation is satisfied when capillary number (the ratio of viscous to capillary forces) [Hilfer and Øren, 1996]: and Bond number (the ratio of buoyancy to capillary forces) [Morrow and Songkran, 1981]: are sufficiently low (e.g., 10 26 ), that is viscous and buoyancy forces have a negligible impact on fluid configurations and fluid flow is capillary controlled. In these equations, K is intrinsic (absolute) permeability of the porous medium, c is interfacial/surface tension, / is porosity, and Dp/L is the imposed pressure (potential) gradient across the medium of length L. Dq and g also denote density difference and acceleration due to gravity, respectively.
The importance of the above discussion is appreciated when several different saturation histories (for instance, decreasing water saturation/decreasing oil saturation/increasing gas saturation and the opposite direction) are examined in a series of three-phase relative permeability experiments. Under these circumstances, a change in the direction of fluid injection may not always technically be possible, particularly because experiments have to be conducted consecutively. In this study, all fluid phases were injected from the bottom of the samples. In the experiments performed, the magnitude of Bond number was always low for all the three pairs of fluids, in the order of 10 26 , indicating that gravity effects were insignificant. This was confirmed by uniform saturation distributions along the cores in all experiments. Furthermore, all displacements were under the capillary-controlled displacement regime; i.e., the capillary number for each pair of fluids was about 10 26 . An example of fluid saturation distributions is given in Figure 4. As it is observed, the saturation distributions of all three fluid phases are uniform along the length of the core.

Control of Saturation Histories
Steady-state two-and three-phase relative permeability experiments can be performed in either constant flow rate or constant pressure drop modes. In both cases, all phases are flowed together through the sample at a set of fixed fractional flows until steady state is reached, before moving to the next set. For a given set of fractional flows, the flow rate of each phase is initially set in the constant-flow rate approach whereas in the constant-pressure drop approach, the total flow rate of pumps is continuously adjusted in order to maintain a desired differential pressure across the sample, while maintaining the specified fractional flows. In both approaches, selection of the next set of fractional flows must be made with special care to follow the saturation history being investigated and to avoid any unwanted irreversible switch between drainage and imbibition displacement processes. A review of three-phase relative permeability studies (A. H. Alizadeh and M. Piri, Three-phase flow in porous media: A review of experimental studies of relative permeabilities, submitted to Reviews of Geophysics, 2013) reveals that most experimental measurements are made in constant-flow rate mode, which is the approach used in the present study also. Accordingly, we here describe how to control saturation histories for constant-flow rate tests even though the basics may be extended to constant-pressure drop tests as well. Similar to Oak et al. [1990], we adopt Saraf et al.'s [1982] nomenclature (i.e., D 5 decreasing, I 5 increasing, and C 5 constant) to label saturation histories. For instance, DCI indicates a saturation history wherein water saturation decreases, oil saturation is constant, and gas saturation increases. The term ''constant'' (denoted by ''C'') is used for a phase that is immobile prior to a process but may be mobilized and displaced during the process because of pore-level displacement mechanisms.
In cases where only two phases are injected, the control of saturation histories is straightforward because any changes (decrease or increase) in the flow rate of one of the phases corresponds to a change in its saturation in the same direction and a change in the saturation of the other injected phase in the opposite direction. In cases where all three phases are simultaneously injected, however, there is no such a correlative relationship between the direction of flow rate change and saturation. In other words, the flow rate and saturation of a phase may vary in opposite directions, depending on how other flow rates are changed. When three mobile phases are present, only two saturations can vary in the same direction and the third one has to obviously change in the opposite direction due to material balance constraints. This simple fact can inspire an approach in which two phases that their saturations change in the same direction are grouped together and treated as a single phase. In this way, the three-phase flow problem is simplified to a ''two-phase'' one, meaning that saturation histories of two-and three-phase relative permeability experiments can be controlled in a similar manner. In a steady-state oil-displacing-water two-phase test, for example, where oil saturation increases and water saturation decreases, the saturation history is driven by decreasing the water flow rate and/or increasing the oil flow rate at each step so that the ratio of oil to water flow rate follows a monotonically ascending path throughout the test. The same approach can be applied for three-phase flow. In a DDI test, for example, where water and oil saturation decrease and gas saturation increases, the saturation history is controlled by increasing the gas flow rate and/or decreasing both oil and water flow rates simultaneously, while maintaining the water to oil fractional flow ratio.
As described, the controlling approach of saturation histories includes decreases and increases in injection flow rates. The changes, however, should be conducted in a manner that obviates nonuniform saturation distributions discussed earlier. This situation is fulfilled when capillary and Bond numbers are held low; i.e., fluid flow is capillary controlled. During an experiment, densities and interfacial/surface tensions, thus the Bond number, are usually constant, and therefore the capillary number, through the total pressure drop, undertakes the principal role. As a result, any changes in flow rates must be in compliance with the appropriate pressure drop across the core. To accomplish this, the following procedure is suggested. Although we explain this procedure here through a steady-state two-phase oil-displacing-water test followed by a steady-state three-phase primary DDI test, it can be used for other two-and three-phase saturation histories also. We use the prefix ''primary'' in order to specify the initial condition of the DDI saturation history being examined as opposed to secondary DDI in which the two-phase oil-displacing-water test is performed after a primary oil-displacing-water and a water-displacing-oil test.
After saturating the core with water and before introducing oil, the differential pressure corresponding to a desired capillary number (e.g., 10 26 ) is calculated from equation (2) for two-phase oil-water flow. We denote this initial total pressure drop as Dp i total . The water flow rate during single phase flow is then adjusted so that the differential pressure along the length of the core becomes less than (for instance half) two-phase Dp i total . Subsequently, oil is injected into the core at a maximum water injection rate and a minimum oil injection rate. After reaching steady state, the new value of pressure drop is monitored. If the new pressure drop is less than Dp i total , the oil flow rate is doubled, otherwise the water flow rate is halved. This algorithm is repeated during the experiment by doubling the oil rate or halving the water rate at each steady state, depending on the pressure drop. This means that the ratio of oil to water flow rate is doubled for every step compared to its preceding step and follows a monotonically ascending path. When the oil flow rate is doubled, the pressure drop increases but remains below twice of its previous value. Also, when the water flow rate is halved, the pressure drop decreases but remains above half of its previous value. Thus, the differential pressure across the core is constantly confined within half Dp i total and twice Dp i total throughout the experiment, thereby satisfying the desired capillary number. Now consider a case where gas injection is intended to start before termination of the above-mentioned oil-water flow, in the direction of decreasing water and oil saturations and increasing gas saturation, i.e., primary DDI. To do so, the steady-state oil-water test is performed until the water/oil injection ratio reaches a desired value. Similar to two-phase flow, the differential pressure equivalent to a given capillary number (e.g., 10 26 ) is estimated from equation (2) for three-phase water-oil-gas flow. It should be noted that there are three pairs of interfacial/surface tensions in three-phase flow, and that each leads to a different pressure drop. However, if the pressure drop produced by the smallest tension is selected to be applied across the core, pore-scale displacements between fluids of each of the two other pairs are also governed by capillary forces. Prior to introducing gas and starting the DDI test, the pressure drop across the core resulted from the steady flow of oil and water at the specific ratio is reduced below three-phase Dp i total by lowering the water and oil flow rates simultaneously, while maintaining their injection ratio. Thereafter, gas is injected into the core at a maximum total flow rate of water and oil and a minimum flow rate of gas. The saturation history is controlled similar to two-phase flow using the algorithm described earlier. Note that when the difference between the current and the next flow rates obtained by doubling or halving the current flow rate is large, the change in the flow rate must be made gradually (in small increments) in order to avoid an abrupt, even though temporary, increase or decrease in inlet pressure, which may cause undesired changes in pore-scale fluid configurations. The water to oil fractional flow ratio indicated above can be varied from one DDI experiment to another DDI experiment in order to investigate the effect of various initial saturation conditions on three-phase relative permeabilities.

Criteria for a Steady-State Condition
During steady-state relative permeability experiments, the system must be allowed to reach steady state at each set of fixed fractional flows before moving to the next set. Steady state may be identified from constant fluid saturations and stable pressure drop along the sample. In this study, steady sate was assumed to have been attained when pressure fluctuations were less than 1% over 30 min and saturation variations were less than 1% in 2 h. However, when layer drainage was dominant (at the end of gas injection), changes in oil saturation were very slow and longer time intervals (1-2 days) were required to reach steady state.

Cleaning the Core Sample
After completion of each series of tests, the core samples were cleaned for subsequent experiments. In three-phase flow where water, oil, and gas are present, flushing the medium directly with solvents may not be sufficiently efficient because the gas phase does not usually dissolve at low pressures. Here, the gas phase, N 2 , was displaced with CO 2 , which is highly soluble in water (brine), and then CO 2 was in turn displaced/dissolved with several pore volumes of low-salinity brine (containing 1.5 wt % CaCl 2 ) at moderate pore pressures. Once only brine and oil remained in the pore space, the cores were flushed with 20 pore volumes of isopropanol and then oven dried. The low-salinity brine was employed to avoid salt precipitation upon contact between the high-salinity brine used in the experiments and isopropanol.

Results and Discussion
To investigate the effect of saturation history, steady-state two-and three-phase relative permeabilities were measured for various saturation paths. Below, we first present the results of two-phase relative permeability tests for all the three pairs of fluids, i.e., water-oil, oil-gas, and water-gas. For three-phase flow experiments, we first examine various saturation histories studied and present the details of the fractional flows used to establish them. We then discuss the trends observed in the relative permeabilities and residual saturations of each saturation history.

Two-Phase Experiments
Bidirectional two-phase relative permeabilities (primary drainage and imbibition) were determined for the three pairs of water-oil, oil-gas, and water-gas flows. Figure 5 shows two-phase relative permeabilities of each pair in both directions plotted as functions of wetting-phase saturation. For water-oil flow, remaining (irreducible) water saturation at the end of primary drainage was about 10%, and residual oil saturation at the end of imbibition was about 38%. Remaining oil saturation in oil-gas drainage was around 21%, and residual gas saturation in oil-gas imbibition was around 41%. Also, remaining water and residual gas saturations were about 23% and 38%, respectively, for water-gas flow. The residual nonwetting phase, in each case, resides in the center of large pores and throats as trapped clusters and disconnected blobs [Piri and Blunt, 2005b]. These trapped ganglia might be displaced if the flow regime was changed from capillary to viscous dominated (higher capillary numbers, i.e., N ca > 10 26 ). The remaining wetting phase saturations of the above-mentioned fluid pairs are different mainly because of the differences in the viscosities of the invading nonwetting phases. Higher invading phase viscosity leads to higher drainage capillary pressure for a given flow rate and hence lower wetting phase saturation. Furthermore, the trapped nonwetting phase saturation of the oil-gas system is slightly higher than that of water-oil. This may be attributed to lower advancing gas-oil contact angle than advancing oil-water contact angle. Since all the experiments were performed under the capillary-dominated displacement regime, viscous pressure drops may have played negligible role in trapping of nonwetting fluid during imbibition. This is consistent with the trends reported by Oak [1990] for Berea with a nitrogen/brine/dodecane fluid system and with the contact angles used by Piri and Blunt [2005b] to predict those trends.
In water-oil flow, the drainage and imbibition water relative permeabilities coincided with each other and followed similar paths. The imbibition oil relative permeability in oil-gas flow, however, was slightly higher, for a given saturation, than the drainage oil relative permeability. In water-gas flow, the imbibition water relative permeability was also slightly greater than the drainage water relative permeability. Similar observations were reported by Oak et al. [1990] and Akbarabadi and Piri [2013]. This may be attributed to the slight reconfiguration of fluids at the pore scale. Nonetheless, one can still consider that two-phase relative permeability to the wetting phase is nearly independent of saturation history. This is because the wetting phase (water in the water-oil system, oil in the oil-gas system, and water in the water-gas system) occupies small pores, corners, and crevices of the water-wet porous medium, and flow of the nonwetting phase may only slightly suppress its hydraulic conductivity. As opposed to the wetting phase, two-phase relative permeability of the nonwetting phase is affected by the direction of saturation change in all the three pairs of two-phase flows. Trapping hysteresis during the imbibition process, due to pore-body filling and snap-off pore-scale mechanisms [Piri and Blunt, 2005a], is responsible for the observed difference between the drainage and imbibition nonwetting phase relative permeabilities.
There is some evidence in the literature that two-phase relative permeabilities of the three fluid pairs may interchangeably be used, provided that wetting characteristics of phases are considered. For instance, if two-phase relative permeabilities of water-gas flow are not available, water (wetting phase) relative permeability of water-oil flow (or oil (wetting phase) relative permeability of oil-gas flow) may be substituted for the unavailable water relative permeability of water-gas flow. Similarly, oil (nonwetting phase) relative permeability of water-oil flow (or gas relative permeability of oil-gas flow) may be used for the gas relative permeability of water-gas flow. Figure 6 demonstrates all two-phase drainage and imbibition relative permeability data plotted as functions of wetting-phase saturation. As observed, despite some scatter, all wetting-phase relative permeabilities follow a similar trend, and nonwetting phase relative permeabilities display two distinct paths depending on drainage or imbibition. This finding reinforces the general idea described above. In Figure 6, the solid curves are simple curve fits to the data points and only show approximate trends.

Three-Phase Experiments 3.2.1. Saturation Paths
For three-phase experiments, the core samples were initially fully saturated with the aqueous phase, and then a desired initial two-phase condition was established by a series of drainage and imbibition water-oil displacements. After establishing a wateroil initial condition, gas injection was started in the direction of decreasing water and oil saturations and increasing gas saturation. In some experiments, gas injection was, at the end, followed by increasing water saturation and/or oil saturation in order to study the effect of the direction of saturation change on three-phase water, oil, and gas relative permeabilities. Figure 7 exhibits all three-phase saturation trajectories (Experiments A to G) in ternary saturation diagrams investigated in this work. Below, we describe three-phase experiments in the order by which they were sequenced with the two-phase water-oil processes used to establish initial conditions, i.e., (1) secondary gas injections started after water-oil primary drainage (Experiments A through D), (2) tertiary gas injections started after water-oil imbibition (Experiments E and F), and (3) gas injection started after water-oil secondary drainage (Experiment G).
In Experiment A, an initial two-phase condition of 45% oil saturation (S oi ), prior to gas injection, was established by steady-state water-oil partial primary drainage. Steady-state gas injection was thereafter conducted in the direction of decreasing water and oil saturations and increasing gas injection (primary DDI). The gas injection was continued to water and oil saturations of about 22% and 21%, respectively, and then the experiment was followed in an opposite direction of increasing water and oil saturations and decreasing gas saturation (IID). Water and oil saturations at the end of the IID were 36.7% and 27.7%, respectively. Experiment B was similar to Experiment A with this difference that, after establishment of the initial twophase condition of S oi 5 45%, gas injection was initiated at a higher capillary number of about 10 24 , as opposed to 10 26 prevailed in other experiments. This was intended to investigate the effect of viscous flow on three-phase relative permeability and the spatial distribution of fluid phases. Remaining water and oil saturations, at the end of gas injection, were 13.6% and 15.8%, respectively. Similar to Experiments A and B, Experiment C was a primary DDI, but with a different initial condition of S oi 5 65%. At the end of this experiment, water and oil saturations decreased down to 13.1% and 14.5%, respectively. For Experiment D, wateroil primary drainage was completed to the end to reach irreducible water saturation of about 10%. Water was immobile during gas injection, and oil saturation reduced to about 11% at the end of the experiment. Experiment D was conducted three times (labeled as D-1, D-2, and D-3), with two of them (D-1 and D-2) on Sample 1, in order to show the reproducibility of the results, and with one (D-3) on Sample 2, to demonstrate the similarity of the two core samples used. Experiments A through D are categorized as secondary gas injection starting at various water-oil initial conditions.
In addition to the secondary gas injection experiments described above, two tertiary gas injection experiments were conducted at different initial conditions. In Experiment E, the initial two-phase condition was     established by a complete primary drainage process to irreducible water saturation and then a steady-state partial waterflood (imbibition) to S oi 5 70%. Subsequent gas injection reduced water and oil saturations to 12.5% and 17.3%, respectively. For Experiment F, a complete waterflood was performed after primary drainage to irreducible water saturation resulting in waterflood oil saturation of about 39%. Water saturation and waterflood residual oil saturation reached 14% and 13.5%, respectively, after gas injection. The substantial reduction of waterflood residual oil saturation during gas injection was believed to have been caused by reconnection of trapped oil ganglia, formation of spreading oil layers, and oil drainage through connected layers. After completion of gas injection, the experiment was continued with a steady-state oilflood in the direction of increasing oil saturation and decreasing gas saturation. In this process, water saturation did not change and trapped residual gas saturation was about 32%.  It is quite often the case that some parts of a watered out oil reservoir are subject to an oil bank formed due to gas injection. To study three-phase relative permeabilities under these circumstances, Experiment G was performed. In this experiment, the initial two-phase condition was achieved by water-oil primary drainage to irreducible water saturation, followed by a waterflood to residual oil saturation, and then water-oil secondary drainage to S oi 5 65%. Following gas injection (secondary DDI) reduced water saturation to about 13% and oil saturation to about 15%.

Water/Oil/Gas Relative Permeabilities
In this section, we present and discuss the three-phase relative permeabilities of Experiments A through G. Figures 8-10 show three-phase water, oil, and gas relative permeabilities of each respective experiment. Tabulated data are also given in Appendix C.
While using multi core samples reduces the time between experiments due to the core cleaning process, it should first be investigated that the core samples are similar from the standpoint of multiphase flow functions. Accordingly, Experiments D-1 and D-3 were conducted on Samples 1 and 2, respectively, and as seen in Figure 11, the two core samples behave very similarly and could therefore be used interchangeably during the study. To show the reproducibility of the measured data, Experiments D-1 and D-2 were performed on Sample 1. Figure 12 indicates that the data generated are highly reproducible, revealing the stability of the experimental setup and procedure developed.
Three-phase water (wetting phase) relative permeabilities plotted as a Figure 13. Three-phase water relative permeabilities of all saturation histories (square: decreasing water saturation, circle: increasing water saturation). The solid curve is a curve fit representing two-phase water relative permeability data. function of water saturation for both the water-saturationdecreasing and water-saturationincreasing directions are given in Figure 13. The solid curve, obtained by a simple curve fit, represents two-phase water relative permeability data. It is evident that water relative permeability is a function of only its own saturation and saturation history has a minor impact on it. This is expected as water is the most wetting phase and occupies the smallest elements in the pore space. In other words, saturation history has a limited impact on the distribution of pore sizes occupied by water. Figure 14 exhibits three-phase gas relative permeabilities versus gas saturation for both increasing and decreasing directions. The solid curves, also obtained by simple curve fits, represent the respective two-phase gas relative permeabilities of each direction. Despite some scatter, gas relative permeability depends on its own saturation as well as saturation history. The above-mentioned findings are consistent with the literature for water as the most wetting phase and gas as the most nonwetting phase in a water-wet medium.
From Figure 15, it is observed that three-phase oil relative permeability reflects relatively weak sensitivity to variations in initial oil saturation. This is ascribed to the narrow pore size distribution of Bentheimer sandstone (see Figure 16) limiting the range of pore sizes that oil may occupy due to various saturation histories. In addition, oil relative permeability shows nearly no dependency on saturation history, which is again attributed to the narrow pore size distribution. As expected for the intermediate-wetting phase, oil relative permeability appears to be a function of all saturations. Figure 15. Three-phase oil relative permeabilities of all saturation histories (square: decreasing oil saturation, circle: increasing oil saturation). The solid curve is a curve fit representing oil relative permeabilities of two-phase water-oil primary drainage. The twophase water-oil imbibition data fall on the three-phase oil relative permeabilities. Figure 16. Pore size distribution of Bentheimer sandstone. A high-resolution microcomputed tomography scanner was used to generate a 3 micron resolution image with a field of view of 3 3 3 3 3 mm 3 . The sample was cut from the same block as Samples 1 and 2 were. The solid curve in Figure 15 represents oil relative permeabilities of two-phase water-oil primary drainage. The two-phase wateroil imbibition data fall on the three-phase oil relative permeabilities.
As mentioned earlier, it is believed that the oil phase used in this study spread to form thick layers between water and gas. The stability of the oil layers was expected to vary from one saturation path to another. Comparing final oil saturations of Experiments C and D-1 at the end of gas injection indicates that the increase in the initial oil saturation, prior to gas injection, resulted in lower remaining oil saturations. During primary oil drainage, oil displaces residing water from the pore space, leaving water in small pores as well as in the corners of invaded pores (Figure 17a). Displacement of oil by gas leads to formation of spreading oil layers sandwiched between gas in the center and water in the corner (Figure 17b). It is theoretically believed that the stability of these oil layers is affected by interfacial tensions, the spreading coefficient, wettability (i.e., oil-water, gas-water, and gas-oil contact angles), and oil-water and gasoil capillary pressures [Hui and Blunt, 2000;Piri and Blunt, 2004;van Dijke and Sorbie, 2006; A. Zolfaghari Shahrak and M. Piri, Pore-scale network modeling of two-and three-phase flow based on thermodynamically consistent threshold capillary pressures, manuscript in preparation, 2013]. During gas injection and for a given rock-fluid system, oil layers are stable over a wider range of gas-oil capillary pressure if the process is performed with a higher initial oil-water capillary pressure (i.e., higher initial oil saturation). More stable oil layers allow gas injection to reach lower remaining oil saturations. At high gas-oil capillary pressures (late stages of gas injection), oil layers will collapse forming fluid configurations such as Figure 17c. This explanation should also be valid for other saturation histories including tertiary gas injection. However, remaining oil saturations to gas of experiments E and F demonstrate an opposite trend. That is, although gas injection in Experiment E was initiated at higher initial oil saturation (i.e., a higher initial oil-water capillary pressure), remaining oil saturation was unexpectedly greater than that of Experiment F. This may be attributed to a possible increase in oil-water capillary pressure due to gas invasion into waterflood residual oil in Experiment F. As it was mentioned earlier, gas injection leads to reconnection and thereby recovery of a significant fraction of trapped oil (i.e., from 39 to 13.5%). At the pore scale, this may be achieved by the double displacement mechanism [Øren et al., 1992;Pinczewski, 1994, 1995;Fenwick and Blunt, 1998b;van Dijke and Sorbie, 2002;Piri Figure 17. Corner fluid configurations in pores with angular cross sections for (a) primary oil drainage, (b) gas injection, and (c) at the end of gas injection [Øren et al., 1992;Pinczewski, 1994, 1995;Hui and Blunt, 2000;Piri andBlunt, 2005a, 2005b]. and Blunt, 2005aBlunt, , 2005b in which connected gas displaces trapped oil that in turn displaces connected water. This displacement mechanism characteristically leads to the increase in oil-water capillary pressure [Piri andBlunt, 2005a, 2005b], which in turn further stabilizes the spreading oil layers that form upon contact between gas and trapped oil. As a consequence of the above-mentioned displacement physics, water is pushed into even smaller pores and oil into intermediate-sized pores, while gas occupies the largest pores.
Oil will eventually reside only in spreading layers. Figure 18 shows all three-phase oil (intermediate-wetting phase) relative permeability data plotted versus oil saturation. It is observed that, at high oil saturations where networks of oil-filled elements govern flow of oil, oil relative permeability exhibits a quartic form with oil saturation ðk ro / S 4 o Þ whereas, at low oil saturations where flow is believed to be controlled by layer drainage, oil relative permeability shows a quadratic form ðk ro / S 2 o Þ. The quadratic form of three-phase oil relative permeability has been observed experimentally in other porous media [Sahni et al., 1998;DiCarlo et al., 2000] and is consistent with the theoretical interpretation of layer drainage at the pore scale, i.e., A o / S o ; g o / A 2 o , and k ro / g o , therefore k ro / S 2 o , where A o ; g o , and k ro are cross-sectional area, hydraulic conductivity, and relative permeability of oil layers in the pore corners (Figure 17b) [Fenwick and Blunt, 1998a;Piri andBlunt, 2005a, 2005b]. However, the observed trends may vary from one medium to another and may also depend on fluid systems. Similar to those reported by Oak et al. [1990] and Oak [1990], in all the gas injection experiments started at initial water saturations higher than the irreducible water saturation, it was observed that gas displaced water and oil at the same time (see Figure 7). Even though that the experiments were performed under capillarydominated displacement regime and that gas-oil surface tension was significantly lower than gas-brine value, gas displaced significant amount of water while gas-to-oil displacements were taking place. One might expect that gas would displace oil to reach low oil saturations and only then gas-to-water displacements would become competitive to gas-to-oil displacements and may therefore take place. Our experimental findings, however, show that this is not the case when initial water saturation is appreciably higher than irreducible value. We believe this might be the results of the double displacement mechanism that may take place, as observed in micro models [Øren et al., 1992;Pinczewski, 1994, 1995], even if the intermediatewetting phase is not trapped. It is the competition amongst the above-mentioned double displacement and direct gas-to-oil and gas-to-water displacements that dictates the saturation path forward.

Dynamic Effects
As described earlier, injection sequences in Experiments A and B were identical, but Experiment B, contrary to the other experiments, was conducted at a capillary number of about 10 24 . The high capillary number caused the flow regime to shift from capillary dominated to viscous dominated. Nevertheless, the impact was most significant on three-phase gas relative permeability (see Figure 19) while oil and water relative permeabilities remained fairly unchanged. An example of nonuniform fluid saturation distributions in Experiment B is given in Figure 20. As seen, the distributions, particularly the gas one, are not uniform along the length of the core owing to the phase segregation, violating the assumption of saturation uniformity in the steadystate relative permeability measurement method mentioned earlier.

Summary and Conclusions
In this study, steady-state two-and three-phase relative permeabilities were measured for a rock-fluid system, consisting of water-wet consolidated Bentheimer sandstone cores and brine/Soltrol 170/nitrogen, under various saturation histories. Fluid and fluid-fluid properties including viscosities, densities, and interfacial tensions were measured using equilibrated phases at the experimental conditions. Based on the measured interfacial tensions, it was found that the equilibrium spreading coefficient for the fluid system used was close to zero, implying that the oil phase was spreading, forming layers between the aqueous and the gas phases. We investigated the effect of saturation history on three-phase relative permeability as well as on the stability of spreading oil layers and residual oil saturation. Based on the displacement experiments performed, the following remarks are made: 1. Three-phase relative permeability to water (wetting phase) depended only on its own saturation and saturation history had a minor impact on it. This was expected as water was the most wetting phase and occupied the smallest elements in the pore space.
2. Saturation history strongly affected three-phase gas (nonwetting phase) relative permeability; however, gas relative permeability was observed to be only a function of gas saturation in each direction of gas saturation change. This finding was also consistent with the literature for gas as the most nonwetting phase in a water-wet medium.
3. Three-phase oil (intermediate-wetting phase) relative permeability varied with all saturations and was independent of saturation history. In addition, it showed weak sensitivity to initial oil saturation prior to gas injection. Independency of oil relative permeability to saturation history and its weak sensitivity to variations in initial oil saturation in a water-wet medium were contrary to the general findings in the literature and ascribed to the narrow pore size distribution of Bentheimer sandstone.
4. Waterflood residual oil saturation substantially reduced during gas injection. This was believed to have taken place due to reconnection of trapped oil ganglia, formation of spreading oil layers, and oil drainage through the connected layers.  layer flow was believed to be dominant, oil relative permeability varied quadratically with saturation ðk ro / S 2 o Þ. Although the quadratic form of three-phase oil relative permeability is consistent with the theoretical interpretation of layer drainage at the pore scale, it was believed that the trend might vary from one medium to another and might also depend on fluid systems.

Appendix A: In Situ Saturation Measurement
To calculate three-phase saturations, the scanner was first calibrated at two different energy levels. The cores were scanned at both energy levels during the experiments, and saturations were determined by obtaining a simultaneous solution for the following system of equations [Sahni et al., 1998]: where CT t 1 and CT t 2 are the CT numbers of the core containing all phases at energy levels 1 and 2, respectively. The terms CT cw ; CT co , and CT cg (reference scans) are the CT numbers of the core fully saturated with water, oil, and gas, respectively. The saturations (S i ) were obtained by scanning the middle part of the samples (10.16 cm-between the two middle pressure ports) at two different energy levels. The lower energy was at 80 kV and 125 mA and the higher energy was at 130 kV and 100 mA. Each slice had a thickness of 2 mm, and the distance between two consecutive slices was 4 mm. CT images affected by the metal pressure ports were excluded from saturation calculations. Fluid saturations were determined at 21 locations equidistant along the core axis and then averaged to report one value for each phase.
To obtain the reference scans, the following procedure was used. This procedure was employed because the working brine phase had high salinity. All the reference scans were conducted at pressure and temperature identical to the prevailing conditions of the experiments. The core, initially dry, was placed in the core holder under overburden pressure and vacuumed for a while to remove bulk air. A fixed net overburden pressure (1.72 MPa) was applied during all steps. The core was then saturated with the gas phase and scanned at energy levels 1 and 2 to obtain the gas reference CT numbers (CT cg1 and CT cg2 ). After discharging the gas phase, the core was flooded with CO 2 gas to remove nitrogen and, afterward, vacuum saturated with deaerated low-salinity brine (containing 1.5 wt % CaCl 2 ). The back pressure was then increased to dissolve any free CO 2 , and several pore volumes of brine were passed through the core. The low-salinity brine was used as a buffer to avoid possible salt precipitation when displacing high-salinity brine with a solvent such as isopropyl alcohol. After saturating the core, the low-salinity brine was displaced with 20 pore volumes of isopropyl alcohol, which in turn was displaced with 20 pore volumes of the oil phase. Once the core was fully saturated with oil, it was scanned at both energy levels for the oil reference CT numbers (CT co1 and CT co2 ). In order to fully saturate the sample with the working aqueous phase, the oil-saturated core was flooded with 20 pore volumes of each of isopropyl alcohol, the low-salinity brine, and lastly the working brine phase. Thereafter, the brine reference scans (CT cw1 and CT cw2 ) were obtained. The brine-saturated core was subsequently subjected to two-and three-phase relative permeability experiments.

Appendix B: Porosity Measurement
In addition to the common application of in situ saturation measurements, an X-ray CT scanner can be used to determine the porosity distribution within a porous medium. This feature is helpful to find out any naturally occurring heterogeneities as well as possible changes due to fluid flow in the pore space.
To this end, the sample and the core holder need to be scanned only at one energy level when they are fully saturated with fluid 1 and when they are fully saturated with fluid 2. For simplicity, fluids 1 and 2 were selected here to be water and air. To measure porosity, the core holder was scanned when it was filled with air and when it was filled with water. Similarly, the core sample placed in the core holder was scanned when it was dry and when it was fully saturated with water. Porosity was then calculated from: where CT cw and CT cg are the CT numbers of the core sample fully saturated with water and air, and CT w and CT g are the CT numbers of water and air (in the core holder without the core), respectively. It should be emphasized that in all the four scans, the overburden pressure was identical as any changes in volume of the overburden liquid, could affect the CT numbers.

Appendix C: Saturation and Relative Permeability Data
In this section, we include all the numerical values of saturation and relative permeability data generated under this study. Tables C1-C3 list two-phase data whereas Tables C4-C10 tabulate three-phase results.