Collaborating with whitson to Improve ResFrac’s Fluid Modeling

Recently, we’ve been fortunate to work with whitson (https://whitson.com/) on work for a mutual client. Founded by Prof. Curtis Whitson at the Norwegian University of Science and Technology, they specialize in building models of petroleum fluids. This blog post summarizes our work with them. They also wrote a blog post on this topic, which can be read here

A fluid model is a practical engineering description of how an oil and gas change in density and viscosity as a function of composition, pressure, and/or temperature. A fluid model also captures the phase behavior – how the fluid mixture transitions from being liquid to gas, or vice-versa, as a function of composition, pressure, and temperature. Fluid models sit at the core of reservoir engineering. Among other things, they form the basis of reserves estimates, reservoir simulation models of multiphase flow, and engineering of enhanced oil recovery. Personally, I am particularly interested in this topic because I used to teach a course on petroleum fluids when I was at UT Austin, and then later when I was a part-time adjunct at Stanford.

There are three main types of petroleum fluid models: the black oil model, the modified black oil model, and the compositional model. The black oil model is the simplest and fastest, but it cannot be applied to volatile oils (oils with initial producing gas-oil ratio above  about 2000 scf/STB) or retrograde condensates (gas reservoirs where liquid drops out in response to pressure depletion). The modified black oil model is similar to the black oil model, but includes the effect of oil volatilization into the gas phase, and so can be applied to any type of reservoir – including volatile oils and retrograde condensates. The compositional model is the most computationally intensive, but also the most realistic. Compositional models use equations of state such as Peng-Robinson, and use sophisticated lumping and tuning techniques to account for the huge diversity of hydrocarbon molecules found in a petroleum fluid. They are particularly useful for applications such as EOR.

Prior to our working with whitson, I was already familiar with Prof. Whitson’s work because he is a global leader in the field. Back when I was teaching my petroleum fluids course at UT, I asked Prof. Gary Pope (who’s opinion I value greatly) which books he’d recommend on this subject. He recommended two books: Phase Behavior by Whitson and Brule, and Phase Behavior of Petroleum Reservoir Fluids, by Pedersen and Christensen. In addition, I was already using the excellent introductory textbook Properties of Petroleum Fluids, by McCain. These three books, in addition to the highly technical book Thermodynamic Models: Fundamentals and Computational Aspects by Michelsen and Mollerup, make up the set of my favorite books on petroleum fluids (though there are other good ones!).

The company whitson builds fluid models for operators. When a company takes a fluid sample and sends it to the lab for compositional analysis, this is just the beginning of what is needed to build a practically useful fluid model. Petroleum mixtures may contain thousands of different hydrocarbon and non-hydrocarbon components, and these interact in complex ways to determine fluid behavior. Thus, specialists are needed to build these models.

In the ResFrac user-interface, we have a ‘wizard’ that can build a black oil or compositional fluid model using correlations, based on a few high-level inputs, such as GOR and reservoir temperature. This is better than nothing, but it is much better to go through the rigorous process of building the fluid model correctly, from analysis of specially designed laboratory experiments on fluid samples.

We in ResFrac engaged with whitson because we had a common client: an operator who had asked them to build a fluid model, and the operator wanted to use the fluid model in ResFrac. At that time, ResFrac did not support the particular form of the modified black oil model that they wanted to use. I spoke with whitson’s GM Americas Mathias Carlsen, and quickly assessed that these guys really knew what they were talking about, and that I ought to implement their preferred approach into ResFrac. In addition, based on their recommendations, I added additional functionality to improve how ResFrac handles undersaturated fluid properties in the black oil model. It took me a month or two to implement everything and get it tested and debugged, but the outcome was a happy client, with a really high quality fluid model, which is now incorporated into their ResFrac model. They are using the ResFrac model in studies to help optimize frac design and maximize economic performance. It is a model of a rich retrograde condensate reservoir, which is a particularly complex type of fluid because depletion occurs near the ‘critical-point’ where distinctions between oil and gas are blurred, and where simulators sometimes struggle to converge.

To use whitson’s fluid model, we added functionality to ResFrac’s handling of the black oil model. For full details of fluid modeling in ResFrac, you can refer to Section 14 of the ResFrac Technical Writeup (https://arxiv.org/abs/1804.02092). Below is a rather technical description of how these models work and what changes we made.

The concept of the black oil model is that we approximate the entire hydrocarbon mixture as being composed of an ‘oil’ component and a ‘gas’ component. Confusingly, the oil and gas components are distinct from the oil and gas phases. The oil phase is literally the liquid oil that you’d encounter in the reservoir. But when that oil in the reservoir is brought to the surface (where there is lower temperature and pressure), some of the oil vaporizes into natural gas. The stuff that’s oil at the surface is considered oil ‘component,’ and the stuff that’s gas at the surface is considered gas ‘component.’ In the reservoir, the liquid oil ‘phase’ contains stuff that will become both liquid and gas at the surface, and so is considered to contain both oil and gas ‘components.’ In the classical black oil model, all of the gas in the reservoir is considered to become gas at the surface. Alternatively, the ‘modified’ black oil model accounts for the possibility that some of the ‘gas’ in the reservoir drops out to become liquid ‘oil’ at the surface.

Black oil models are embodied by a ‘black oil table.’ The black oil table specifies fluid properties such as ‘oil formation volume factor,’ and ‘solution gas-oil ratio’ as a function of pressure. An important detail: the table is only defining the properties that exist if the fluid is as ‘saturated’ conditions, meaning that both oil and gas phases are present. At sufficiently high pressure, the mixture will always revert to being either single phase gas or single phase oil. In that case, the fluid properties divert from following exactly what is in the table. The screenshot below shows an example of a black oil table.

ResFrac example of a black oil table

Below is a plot of the data in that black oil table, generated by the plotting tool in the ResFrac UI. It shows oil formation volume factor (orange), solution gas-oil ratio (purple), and gas formation volume factor (yellowish orange, log-scale). In the ResFrac UI, I’ve specified that the bubble point pressure is 2500 psi, which means that if pressure is above 2500 psi, then the mixture is single-phase oil. The properties plotted below only follow the black oil table at 2500 psi and lower. Above 2500 psi, the values are calculated using correlations (or a separate table, as discussed below). The ‘solution gas-oil ratio’ is the amount of gas dissolved in the oil. It is constant above the bubble point because once the mixture is all oil, there is no supply of additional gas to dissolve into the oil as pressure increases. The original oil in place, the strength of the solution-gas drive, and potential for loss of oil rel perm as gas comes out of solution – all of these critical reservoir engineering processes are driven by the phase behavior encapsulated by the black oil table.

ResFrac example of a black oil plot

Black oil tables apparently define properties versus pressure. But actually, I like to think of them as defining properties versus composition. Using the solution gas-oil ratio and (if using modified black oil) the vaporized oil ratio, you can calculate that every row in the table corresponds to a particular mass fraction of oil and gas ‘component.’ Keeping this in mind, you can gain a deeper understanding of what the table truly represents – it defines saturation pressure and phase density (at saturated conditions) as a function of composition.

We need the black oil table to go up to pressures above the initial saturation pressure. During production, multiphase flow occurs that creates mixing, and may lead to new mixture compositions that have higher saturation pressure than the initial saturation pressure. The simulator needs to have properties defined in the table to handle these conditions. When a user inputs a black oil table, ResFrac internally extrapolates it upward to a very high pressure or the critical pressure so that the simulator will always be ready to handle any situation. For more details, refer to SPE-109596 (2007) by Singh, Fevang, and Whitson.

The black oil table also provides viscosity as a function of pressure for the oil and gas phases. Below is a figure showing viscosity as a function of pressure. As in the above figure, the bubble point pressure is 2500 psi. The viscosity of the gas is plotted as flat above the bubble point pressure because there isn’t any gas, so these values are ‘dummy’ values that aren’t used.

ResFrac example plot of black oil viscosity

When the pressure is above the bubble point (or dew point), the mixture is single-phase, and the properties deviate from the values in the table. How should this be handled?

Prior to our interactions with whitson, ResFrac used some basic relations to calculate unsaturated properties. whitson wanted to use a more sophisticated approach. For each row in the black oil table (which gives the properties at ‘saturated’ conditions), whitson provided a separate table of ‘undersaturated properties’ that specifies how properties change as pressure is increased above the saturation pressure. In the plots above, these are the parts of the curves at pressure greater than 2500 psi. This ‘table-of-tables’ approach is more accurate than using a correlation.

The table-of-tables approach is particularly useful if dealing with a volatile oil/retrograde condensate using the modified black oil model. In these types of fluids, the mixture may approach a critical point where the oil and gas properties gradually converge. Near the critical point, oil/gas saturations change sharply. At pressures above the critical pressure, the single phase gas/oil mixtures can switch from being labeled ‘oil’ to ‘gas.’ When the label switches, the properties should not change. However, internally, the method of calculating properties within the simulator changes. If the table-of-tables isn’t constructed precisely, the transition can cause discontinuity and failure of the simulator. As a side note, when the single-phase definition changes, there are also interesting challenges around handling of oil/gas rel perm curves. This topic is discussed in recent papers by Purswani, Johns, Karpyn, and Blunt (2020) in SPE 200410 and Neshat and Pope (2017) in SPE-182592.

To implement the table-of-tables approach in ResFrac, I had to do some careful thinking about interpolation. The table-of-tables gives unsaturated properties at increments of saturation pressure. What if the saturation pressure is between those increments? For example, let’s say that pressure is 2800 psi. First, based on composition, the code has to determine the saturation pressure (using the values in the black oil table). Let’s say, for example, that the saturation pressure is 2400 psi. Then, the table-of-tables has an unsaturated table at 2000 psi and 2500 psi. The properties at 2800 psi, for a saturation pressure of 2400 psi, has to be a weighted average of the values from the tables corresponding to saturation pressures 2000 psi and 2500 psi. This has to be done very carefully to ensure that the results are always continuous – that there is never a jump in properties if saturation pressure or pressure change by a small amount. This interpolation has to be continuous even as the saturation pressure reaches the highest possible value in the table – the critical pressure. Properties such as density are derived from the values in the black oil table(s), and these properties also have to be continuous. And, we have to handle special cases like retrograde condensates that demonstrate two saturation pressures – an upper dew point and a lower dew point (ie, there is a two-phase mixture within a certain pressure range and single-phase gas at pressures above and below the pressure range). It took a bit of tinkering, but eventually I got it implemented and running smoothly.

Mathias from whitson also suggested changes to the correlations that we use to calculate undersaturated properties (the properties at pressures above the saturation pressure when the mixture is single-phase). We use these correlations when a table-of-tables is not available. The changes are outlined in Section 14.2 of the ResFrac technical writeup, and largely rely on correlations provided in the Whitson and Brule textbook. Previously, ResFrac had assumed constant undersaturated oil compressibility. Now, a correlation is used to allow it to vary as a function of pressure. The undersaturated gas formation volume factor is calculated with a more realistic Z-factor correlation; and the undersaturated gas and oil viscosity correlations have been improved.

I hope this post has been informative! Obviously, the topic is pretty technical, and can’t be adequately covered in a brief blog post. If you are interested in learning more, I recommend the textbooks listed above.

After our interaction, we worked with whitson to help explain the file format we use in ResFrac. They wrote code to output their fluid models directly from their software into ResFrac format. We are now implementing a button to streamline the process of importing that fluid model from within our user-interface. It is always enjoyable to do good technical work with colleagues!

Learn why both independents and supermajors alike trust ResFrac

Search