
Hydrocarbon Toolkit in ActionThe following describes the hydrocarbon toolkit, its properties, and some simple calculations that can be made using the toolkitCopyright 2000 Peter Meulbroek
The following assumes some degree of awareness of Mathematica. While this is probably not the case with the average geochemist, the
Mathematica Book is approximately 1400 pages of joy, and can be used to learn simple things. In order to use the toolkit, you need to be aware of a couple of concepts: DisclaimerBy using this toolkit, you are implicitly agreeing to the following statement:
1. Use of the toolkit is automatically granted to individuals. SetupThe easiest way to use the hydrocarbon toolkit is to implement the following line in your code:
This loads three packages: General BackgroundThe toolkit is organized into 3 sections. This section talks about the history of the toolkit, the organization of the toolkit The toolkit was first envisioned in 1992, when Professor Larry Cathles of Cornell University wanted to predict the volume of oil that methane could dissolve as a function of pressure and temperature. Seemed like such a simple question. He set his fresh graduate student Peter Meulbroek, to spend a little time understanding how to predict this stuff. A little time became a lot of time, Peter became an expert in the application of Equations of State to LiquidVapor equilibrium in hydrocarbon fluids, (unusual for a geologist, especially in a University without a Petroleum Engineering Dept.), and the problem was solved with the answer "A lot".
The kit is organized to produce 2 types of numbers: Volume CalculationsVolume calculations are a bit tricky. Due to the requirements of the flash calculations, the toolkit distinguishes between "Liquid Volume" and "Vapor Volume". However, It is not clear a priori if a single phase mixture is best described as a liquid or as a vapor. The absolute correct way to figure it out is to look either 1) where the bubble/dew point is (if the mixture is subcritical) or 2) look at the total gibbs free energy of the fluid in either phase. First, consider the compressibility of liquid water
 SurfaceGraphics  Next, consider the vapor volume. Note that either volume is not the 'true' volume when the mixture is twophase (at the saturation line through (p,t) space)
 SurfaceGraphics  Note that we have rotated the figure for better viewing.
 Graphics3D  We can also use another model to generate the same information
 SurfaceGraphics  Densities are just the molecular weight divided by the specific volume
 SurfaceGraphics  Note that water is VERY incompressible at STP compared to oils, and so density is pressure insensitive near atmospheric... We can also do mixtures. Consider a mixture of C1 C9. We will look at its VAPOR volume.
{methane, ethane, propane, nbutane, npentane, nhexane, nheptane, noctane, nnonane, ndecane}
{0.2727617891635065`, 0.20206690331807078`, 0.14969484377475792`, 0.11089666781044388`, 0.08215427212686459`, 0.06086138169842545`, 0.045087220498058425`, 0.03340143446485591`, 0.02474439124847157`, 0.01833109589654498`}
 Graphics 
 SurfaceGraphics  What's this discontinuity in density? The cubic equation only has one root for part of the (p,t) conditions listed above. The 'true' vapor root is shown in the baselevel section, while the 'platform' area returns the single root answer. In order to get the 'true' value, we have to get ahead of ourselves, and find the distribution between phases for the mixture.
Flash returns {{x,y}, V} where x is the normed liquid composition, y is the normed vapor composition, and V is the fraction of the mixture (by mole) in the vapor phase
This next complex statement does the following:
 SurfaceGraphics  Note that the 'true' density of the multiphase mixture is quite a bit lower than the estimated density using a single phase answer. PT Flash CalculationsPT flash calculations are straightforward (as previewed in the last section). Consider a Mixture of Methane and 2,2dimethylPentane. The distribution between liquid and vapor phases can be determined using the "Flash" function. The flash function takes the following options:
Flash[p, t, z, idx, EOS], where p is pressure in bars, t is temperature in ºK, z is the mole fraction array of the mixture, idx is the index of the
species, and EOS selects the equation of state that the flash function uses. EOS must be one of
{Mathias, PredictiveRKS, AasbergPetersen, or VanderWaals}. Note that the length of z and length of idx must be the same. The function returns a list of three elements:
{LiquidComposition, VaporComposition, and vapor fraction}. The compositions are normed vectors of mole fractions, and the vapor fraction is the fraction of the mix (by mole) in the vapor phase. The following function calls flash using the Mathias EOS, over a temperature range of 150ºK to 550 ºK, and a pressure range from 1 to 181 bars
This plots the vapor fraction of the mix
 DensityGraphics  The phase envelope looks as expected, but it does show a convergence problem around the critical point (the pertuberence at the upper right of the figure). This error is not unexpected, as critical points represent the toughest convergence. This is "an area of active research". The same function, but with the AasbergPetersen EOS
This plots the vapor fraction of the mix
 DensityGraphics Converted by Mathematica May 6, 2000 