An Efficient Method To Predict Compressibility Factor of Natural Gas Streams
An Efficient Method To Predict Compressibility Factor of Natural Gas Streams
An Efficient Method To Predict Compressibility Factor of Natural Gas Streams
Abstract: The gas compressibility factor, also known as the deviation or Z-factor, is one of the most
important parameters in the petroleum and chemical industries involving natural gas, as it is directly
related to the density of a gas stream, hence its flow rate and isothermal compressibility. Obtaining
accurate values of the Z-factor for gas mixtures of hydrocarbons is challenging due to the fact that
natural gas is a multicomponent, non-ideal system. Traditionally, the process of estimating the
Z-factor involved simple empirical correlations, which often yielded weak results either due to
their limited accuracy or due to calculation convergence difficulties. The purpose of this study is
to apply a hybrid modeling technique that combines the kernel ridge regression method, in the
form of the recently developed Truncated Regularized Kernel Ridge Regression (TR-KRR) algorithm,
in conjunction with a simple linear-quadratic interpolation scheme to estimate the Z-factor. The model
is developed using a dataset consisting of 5616 data points taken directly from the Standing–Katz
chart and validated using the ten-fold cross-validation technique. Results demonstrate an average
absolute relative prediction error of 0.04%, whereas the maximum absolute and relative error at near
critical conditions are less than 0.01 and 2%, respectively. Most importantly, the obtained results
indicate smooth, physically sound predictions of gas compressibility. The developed model can be
utilized for the direct calculation of the Z-factor of any hydrocarbon mixture, even in the presence
of impurities, such as N2 , CO2 , and H2 S, at a pressure and temperature range that fully covers all
upstream operations and most of the downstream ones. The model accuracy combined with the
guaranteed continuity of the Z-factor derivatives with respect to pressure and temperature renders it
as the perfect tool to predict gas density in all petroleum engineering applications. Such applications
include, but are not limited to, hydrocarbon reserves estimation, oil and gas reservoir modeling, fluid
flow in the wellbore, the pipeline system, and the surface processing equipment.
Keywords: natural gas stream; compressibility factor; kernel ridge regression; truncated Newton method
1. Introduction
Fluid properties are directly involved in all flow and volumetric calculations in the upstream and
downstream zones of the petroleum industry. Density and its change over pressure, vaporization,
or condensation ratios, as well as kinetic properties such as viscosity all affect the obtained results [1–4].
For the case of natural gas, various calculations need to be run including the estimation of
hydrocarbon reserves in a reservoir, the study of the gas flow in the reservoir and the wellbore,
and its thermodynamic behavior through the pipelining system until its arrival at the sales point
and further transportation to the end user, whereas the latter could be a home user, a plant, or an
electric power generation unit. The accurate determination of gas density is of utmost importance,
directly related to the conversion of flow rates from line conditions to standard ones where rates are
commonly reported. Moreover, the rate of change of density with pressure under constant temperature,
known as isothermal compressibility, is related to the accumulation or withdrawal of mass in a control
volume such as a reservoir when that volume is depleted and pressure undergoes reduction.
Although natural gas is a complex multi-component mixture with methane being the major
compound and other compounds such as nitrogen, carbon dioxide, ethane, propane, and heavier
hydrocarbons at lower concentrations [5,6], for the special case of near surface conditions, it can be
treated as an ideal one. Therefore, its thermodynamic behavior is governed by the ideal gas Equation
of State (EoS) Vm = RT/p, where Vm denotes molar volume; hence, density ρ and compressibility c at
pressure p and at temperature T are given respectively by:
pM
ρ= (1)
RT
1 dV 1
c=− = (2)
V dp p
where M stands for the fluid’s molar mass. To handle conditions far from the atmospheric one,
the above definition needs to be extended by introducing the deviation factor Z, also known as the
compressibility factor, not to be confused with isothermal compressibility, such that Vm = ZRT/p.
In that case, the density and compressibility of the gas are given by:
pM
ρ= (3)
ZRT
and:
1 dV 1 1 dZ
c=− = − (4)
V dp p Z dp
respectively. From a thermodynamic perspective, the Z-factor basically describes the deviation between
real gas and ideal gas behavior. There are a number of accurate equations of state providing estimates
of the Z-factor; among them are the Soave–Redlich–Kwong (SRK) [7], the Peng–Robinson (PR) [8],
the Lee–Kesler EoS [9], and the Zudkevitch–Joffe–Redlich–Kwong (ZJRK) ones [10]. Research has been
published also for the calculation of the virial coefficients of the EoS [11]. Clearly, all EoS-based methods
to predict the Z-factor need an accurate description of the gas composition and characterization of all
its components. This last step can be very tedious, as it involves estimation of properties’ components
such as critical values, acentric factors, and binary interaction coefficients.
Another group of methods takes advantage of the corresponding states principle according to
which fluids at the same reduced pressure and temperature exhibit very close compressibility factor
values. Reduced conditions are defined by pr = p/pc and Tr = T/Tc , respectively, where pc and Tc
denote the mixture’s critical pressure and temperature, respectively. The most pronounced method to
compute the Z-factor by this approach is the use of the industry-standard Standing–Katz (S-K) chart [5],
which provides the Z-factor of natural gas as a function of its reduced properties. This chart is known
to perform surprisingly accurately for hydrocarbon mixtures, although it has been generated by using
experimental data from a very limited dataset. This chart, originally generated in the early 1940s,
is valid for Tr values in [1.05, 3.0] and pr values up to 15. Later, it was extended [12] up to pr equal to
30 only for a narrower range of reduced temperatures, i.e., Tr ∈ [1.4, 2.8]. When impurities are present,
the correction method of Wichert and Aziz [13] needs to be utilized. Various mixing rules are available
to estimate mixture’s Tc and pc when the composition and the critical properties of the gas components
Energies 2019, 12, 2577 3 of 20
are known. The methods of Kay [14], Stewart–Burkhardt–Voo (SBV) [15] and Sutton [16] are the most
widely used. When either the composition or the gas components’ critical properties are unknown,
the S-K chart is still applicable by utilizing the pseudo-critical properties p pc and Tpc , respectively.
The latter can be computed from correlations of the specific gravity [17], thus leading to the estimation
of the Z-factor by means of the pseudo-reduced values defined by p pr = p/p pc and Tpr = T/Tpc .
For the sake of simplicity, we will use pr and Tr to denote both reduced and pseudo-reduced pressure
and temperature in the following sections.
To facilitate the use of computers, the S-K chart has been fitted by various correlations, which can
be distinguished into two categories. Firstly, the iterative ones require repeated calculations to solve a
non-linear algebraic equation, the root of which is the Z-factor or a direct function of that. The methods
of Hall and Yarborough (H-Y) [18], as well as that of Dranchuk and Abu Kassem (DAK) [19] are the most
pronounced ones in this category. Secondly, explicit correlations are available for directly predicting
the Z-factor given the reduced or pseudo-reduced properties. The methods of Beggs and Brill [20],
Azizi et al. [21], Kumar [22] (also known as the Shell oil one), and Heidaryan [23] are some of them.
Alternative approaches have also been presented such as that of Kareem et al. [24], who aimed at
fitting the H-Y approximation of the S-K chart. To achieve that, they used a transformation to simplify
the complexity of the H-Y method, so as to fit it with an explicit formula. In order to improve the
prediction capabilities of the Standing–Katz chart, Elsharkawy [25] presented a new simple mixing
rule to calculate the pseudo-critical properties of the gas when the composition is known.
Recent studies have been focusing on the use of machine learning techniques to predict the
Z-factor. Among them, Moghadassi et al. [26] applied Artificial Neural Networks (ANN) [27] to
calculate the PVTproperties for pure gases, whereas Kamyab et al. [28] designed an ANN for the
prediction of the Z-factor of natural gas by using the Standing–Katz chart as their library. The authors
reported that their ANN method was more accurate than the iterative DAK [19], and it is applicable
for the whole pressure range of the extended Standing–Katz chart, i.e., up to pr = 30. Sanjari et al. [29]
developed an ANN to calculate the compressibility factor, this time trained against the experimental
Z-factor values rather than the ones obtained from the S-K chart, and they compared their values
with empirical methods and EoS. Furthermore, Fayazi et al. [30] and Kamari [31] developed Support
Vector Machines (SVMs) [32] by training them against experimental data that involved a variety of
gas compositions, ranging from sour to sweet natural gas. Their approaches were shown to be far
more accurate than EoS empirical correlations. Mohamadi et al. [33] conducted Z-factor calculations
as they were derived by adopting empirical correlations and EoS coupled with intelligent methods.
In particular, they reported on the improvement of van der Waals and Redlich–Kwong EoS by using
Genetic Algorithms (GA), as well as Fuzzy Inference Systems (FIS), Adaptive Neuro-Fuzzy Inference
Systems (ANFIS), and ANNs to predict the Z-factor.
From the discussion above, it becomes clear that the development of stable and accurate
calculation methods to compute the Z-factor by means of the S-K chart is still a hot topic in the
natural gas industry. Indeed, the S-K chart is a straightforward approach, and its H-Y computer
implementation has been considered as the industry standard for decades [8]. However, despite
recent improvements, none of the available methods can be freely used for any arbitrary pressure and
temperature conditions, mostly due to two major drawbacks of them. Firstly, most of the available
methods are applicable only to a limited pressure range, usually pr < 15, thus disregarding the
S-K chart extension up to pr = 30. This restriction does not allow for the description of the gas
thermodynamic behavior at high pressures such as those prevailing in HP/HT reservoirs or at
high pressure compressors. Additionally, some of the regression models and most of the machine
learning-based approaches when applied to the prediction of the Z-factor exhibit an oscillating behavior.
This is attributed to the fact that such models are data driven, and they have been trained by only
focusing on the accurate approximation of the Z-factor values at each of the available training data
points. As a result, no physical evidence, such as a known trend of the Z-factor and its derivative,
can be directly inherited by the model. In fact, the model is asked to “discover” underlying trends
Energies 2019, 12, 2577 4 of 20
by itself through training. As an example, consider the relationship of the Z-factor with pressure
at pressures above pr = 15 and up to pr = 30, which is perfectly linear. Data-driven models, when
simply trained against data points, are not guaranteed to exhibit that natural straight line behavior
and constant value of the Z-factor derivative. Instead, slight Z-factor deviations may lead to significant
“hiccups” in the predicted compressibility value, hence to instability in the solution of the natural gas
flow problem either in a reservoir or in a pipeline manifold. On the other hand, although the H-Y
correlation exhibits remarkable accuracy against the Standing–Katz chart, it may also exhibit various
convergence problems, leading to possible failure of the computation. As an example, consider the
calculation of the Z-factor at Tr = 1.05, pr = 3.1 by solving f (y) = 0, where y = apr/Z and a is a
function of Tr , using the recommended initial value of y = 0.001 [8]. Figure 1 illustrates the plot of
f (y), as well as the step values followed by a typical Newton–Raphson method. It can be readily seen
that the flat part of f (y) at y = 0.18 causes an overshooting, thus leading the estimate at the third
iteration to an extremely high value, definitely outside the valid y parameter bounds, from which the
Newton–Raphson method cannot recover. Note that such behavior is quite common at various pr
values above 20 at all reduced temperatures.
0.2
f(y)
Newton-Raphson
0.15
0.1
0.05
f(y)
-0.05
-0.1
-0.15
-0.2
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45
Parameter y
The objective of this study is to develop a numerical model to predict the Z-factor of hydrocarbon
gases by fitting the Standing–Katz chart so as to overcome the weaknesses of the existing methods.
For this task, the reduced pressure range is split into three regions, each described with its own
submodel. For low reduced pressures, a Kernel Ridge Regression (KRR) model is used, whereas a
linear and a quadratic one are developed for medium and high pressures. Figure 2 provides a general
sketch of the problem.
The combined model acts as a rapid and inexpensive method to estimate the compressibility
factor of a gas stream accurately. Compared to most existing methods, it can be safely used to provide
Z-factor values in an extended operating range of reduced pressure values up to pr = 30, which fully
covers all upstream operations and most of the downstream ones. Unlike other numerical models,
it takes advantage of the simplicity of the industry standard Standing–Katz diagram, thus ensuring a
simple form and guaranteeing continuity of the Z-factor value and its derivative, hence smooth and
physically-sound values. Additionally, the developed model can be utilized for the direct calculation
of the Z-factor of any hydrocarbons mixture, even in the presence of impurities such as N2 , CO2 ,
and H2 S. The model’s accuracy combined with the guaranteed continuity of the compressibility factor
derivatives with respect to pressure and temperature renders it as the perfect tool to predict gas density
in all petroleum engineering applications. Such applications include, but are not limited to, oil and gas
Energies 2019, 12, 2577 5 of 20
reserves’ estimation and reservoir modeling, as well as fluid flow in the wellbore, the pipeline system,
and the surface processing equipment.
Nevertheless, it should be pointed out that the proposed method has been designed to reproduce
the Standing–Katz chart; hence, it can only be used for hydrocarbon mixtures such as those against
which the standard diagram has been developed. Therefore, it might not be applicable to mixtures
encountered in chemical plants, especially those comprised of non-hydrocarbon and/or polar
compounds. Additionally, the non-rigorous background of the method does not allow for safe
extrapolation of the operating conditions beyond those of the original chart, unlike a rigorous, although
computationally-demanding, tuned multi-parameter equation of state model.
The rest of the paper is organized as follows: In Section 2, the proposed methodology is described
in detail, including discussions on the data generation, the Truncated Regularized Kernel Ridge
Regression (TR-KRR) method, and the numerical approach followed. The method’s performance and
related computational issues are discussed in Section 3. Three example applications demonstrating the
efficiency of the proposed method are presented in Section 4. The conclusions are stated in Section 5.
2. Methodology
Thorough examination of the standard Standing–Katz chart and its extension to high reduced
pressures (Figure 3) indicates that it can be split into two regions along the reduced pressure axis based
on the complexity of the isotherms shape. Indeed, at pr values below 10, the change of the Z-factor
versus reduced pressure exhibits complex behavior with specific minima and varying curvature
at most of the isotherms, thus indicating proximity to critical fluid behavior. On the other hand,
for pr ≥ 10, the isotherms exhibit a perfectly straight line shape up to the maximum pr value of 15.
By further examining the supplementary Z-factor chart [12], it is clear that the Z-factor also varies
Energies 2019, 12, 2577 6 of 20
linearly with reduced pressure. Moreover, the average slope at each isotherm in the pr ∈ [15, 30] range
exhibits a very slight change (of less than 0.5%) compared to the slope in the [10, 15] range. As a result,
three distinct regions can be identified in the S-K chart, and each one of them needs to be treated
separately by its own modeling technique. This way, the use of “blind”, data-driven machine learning
methods can be limited to the complex behavior of the low pressure region, whereas simpler models
directly adopting the inherent linearity of the Z-factor with respect to pr can be generated for pr values
above 10. For the sake of notation simplicity, the low, medium, and high pressure range will be labeled
by L = [0, 10], M = [10, 15], H = [15, 30] respectively.
2
Z-factor
1.5
0.5
0
0 5 10 15 20 25 30
Pseudo-reduced pressure
Figure 3. The standard S-K chart and its extension to high reduced pressures.
ŷ = α T k(x) (5)
where:
k = [k(x, x1 ), . . . , k(x, x N )] T (6)
and vector k contains kernel functions k(x, xi ) that involve the conditions x at which the Z-factor
needs to be computed, as well as the pressure and temperature conditions of the training points xi .
The common choices for the kernel function k(x, y) are the polynomial one k(x, y) = (xT y + 1)c with c ∈
N∗ as the polynomial degree and the Radial Basis Function (RBF) kernel k(x, y) = exp(−1/σ||x − y||2 )
where σ > 0 is the width of the kernel [34].
The coefficients vector α is computed as a function of the training data xi and yi , so as to minimize
the deviation between the model estimates on all training data points ŷ = Kα and the digitized Z-factor
values of all training data points y. The kernel matrix is defined by K = {k ij } = {k(xi x j )}, where xi
Energies 2019, 12, 2577 7 of 20
and x j correspond to the inputs of any pair of data points. To satisfy the deviation minimization
requirement, α is given by:
α = (K + λI N )−1 y (7)
Tr Tr −
Tr Tr − Tr + Tr − ZHY − ZHY
ẐSK = ZSK + ( ZSK − ZSK ) Tr + Tr −
(8)
ZHY − ZHY
This way, the neighboring digitized values of the SK chart at Tr− and at Tr+ are fully adopted and
further combined to the curve shape provided by the H-Y method.
To ensure smooth behavior of the KRR model at values close to the pressure and temperature
range boundary, additional densification was run by introducing isotherms at Tr ∈ [1.06, 1.09] and at
Tr ∈ [2.96, 2.99], both in steps of 0.01. Similarly, the pressure range was densified at pr ∈ [0.012, 0.018]
and at pr ∈ [10.42, 10.48] in steps of 0.002. Eventually, the total number of data points of the form
{ pr , Tr , Z } collected by this procedure was 5616.
pr − 10
Z M ( pr , Tr ) = Z ( Tr )| pr =10 + Z ( Tr )| pr =15 − Z ( Tr )| pr =10 (9)
5
The endpoint Z-factor values at pr = 10 and at pr = 15 have been acquired from the S-K chart and
further interpolated with temperature by means of polynomials of Tr , which are given in Appendix B.
Energies 2019, 12, 2577 8 of 20
The plot of the digitized points and their interpolants for Z ( Tr )| pr =10 and Z ( Tr )| pr =15 are shown in
Figures 4 and 5, respectively.
1.23
1.22
1.21
1.2
Z-factor @ pr=10
1.19
1.18
1.17
1.16
1.15
1.14
1.13
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
Pseudo-reduced temperature
1.8
1.75
1.7
1.65
Z-factor @ pr=15
1.6
1.55
1.5
1.45
1.4
1.35
1.3
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
Pseudo-reduced temperature
where the temperature-dependent terms are given in Appendix C. The plot of Z ( Tr )| pr =30 is shown
in Figure 6.
Energies 2019, 12, 2577 9 of 20
2.7
2.6
2.5
2.4
2.2
2.1
1.9
1.8
1.4 1.6 1.8 2 2.2 2.4 2.6 2.8
Pseudo-reduced temperature
where:
pr − 10
w = 1− (12)
0.5
Therefore, the combined Z-factor prediction algorithm is given by the following scheme:
ZL ( pr , Tr ), 0 ≤ pr ≤ 10, 1.05 ≤ Tr ≤ 3.0,
wZ ( p , T ) + (1 − w) Z ( p , T ), 10 ≤ p ≤ 10.5, 1.05 ≤ T ≤ 3.0,
L r r M r r r r
Z ( pr , Tr ) = (13)
Z M ( pr , Tr ),
10.5 ≤ pr ≤ 15, 1.05 ≤ Tr ≤ 3.0,
Z ( p , T ), 15 ≤ pr ≤ 30, 1.4 ≤ Tr ≤ 2.8.
H r r
∂ Z ( Tr )| pr =15 − Z ( Tr )| pr =10 ∂
Z M ( pr , Tr ) = = ZH ( pr , Tr ) (14)
∂pr pr =15 15 − 10 ∂pr pr =15
relative error against the training and the validation datasets, as well as nearly equal training and
prediction error. The examined range of the parameters was σ ∈ [0.001, 0.1], λ ∈ [0.0001, 0.1] and
N ∈ {1000, 2000, 3000, 4000}. After repeatedly examining all possible combinations, it was found that
optimal performance was obtained by selecting σ = 0.01, λ = 0.001 and N = 3000. Clearly, model
accuracy is expected to be further improved when increasing the number of training data points.
However, the selected population size is the minimum that led to a ratio of the training and validation
errors very close to unity, thus minimizing the risk of overfitting.
The performance of the optimal TR-KRR model is shown in Table 1. Judging from the mean errors,
the model was perfectly justified, exhibiting no bias. Moreover, it exhibited excellent agreement with
the S-K chart as the mean absolute relative error was only 0.04% for both the training and the validation
dataset, and the worst case error that might be observed was less than 2%, which is significantly better
than all conventional methods. The scatter plots of the model performance for the training and
prediction dataset are shown in Figures 7 and 8, respectively. A plot of the Z-factor surface that has
been produced by interpolating the training data points together with the validation data points is
shown in Figure 9.
In terms of computational time required for training, TR-KRR was very efficient, and this agrees
with the findings of Maalouf and Homouz [35] that the biggest strength of TR-KRR method lies in its
superior efficiency over other state-of-the-art methods, such as SVM [32]. In addition to predicting
accurately the original temperature curves contained in the dataset, TR-KRR was capable of predicting
new temperature curves. Figure 10 provides four examples of two additional temperature curves
predicted by KRR at Tr = 1.15, Tr = 1.45, Tr = 1.75 and at Tr = 2.65. In all cases, the predicted curves
fell smoothly between neighboring Standing–Katz curves.
Table 1. Performance of the Truncated Regularized Kernel Ridge Regression (TR-KRR) model.
1.2
1.1
Predicted deviation factor Z
0.9
0.8
0.7
0.6
0.5
0.4
0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2
Deviation factor Z
1.2
1.1
0.9
0.8
0.7
0.6
0.5
0.4
0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2
Deviation factor Z
1.2
1
Deviation factor Z
0.8
0.6
0.4
0.2
3
2.5 10
8
2 6
1.5 4
2
1 0
Pseudo-reduced Pressure
Pseudo-reduced Temperature
2.5
2
Deviation factor Z
1.5
Tpr=1.15
1
Tpr=1.45
Tpr=1.75
0.5
Tpr=2.65
0
0 5 10 15 20 25 30
Pseudo-reduced pressure
Implementing the TR-KRR prediction of the Z-factor for low pr and any given Tr can be done
conveniently according to the following simple formula:
N
Z= ∑ αi di ( pr , Tr ) (15)
i
where i
1h
di = exp − ( T̄ri − T̄r )2 + ( p̄ri − p̄r )2 (16)
σ
pri , Tri are the training population pseudo-critical temperature and pressure data, respectively, and the
bar character denotes normalized inputs given by:
The derivative of the Z-factor with respect to pressure, needed to calculate the fluid’s isothermal
compressibility by means of Equation (4), is given by:
N N
θZ θZ θdi θ p̄r θ pr 2
=∑ =− ∑ αi di ( p̄ri − p̄r ) (18)
θp i =1
θdi θ p̄r θ pr θ p σpc max( pri ) − min( pri ) i =1
4. Case Studies
Three case studies are presented to further demonstrate the efficiency of the derived model.
A similar situation was observed at high pressures where the S-K value was 3.1 × 10−5 psi−1 .
The values obtained by Beggs and Brill, Hall and Yarborough, and the new method were 2.3 × 10−5 psi−1 ,
2.8 × 10−5 psi−1 and 3.0 × 10−5 psi−1 , leading to relative errors of 25%, 10%, and 3%, respectively,
thus demonstrating the superiority of the new method.
10-1
S-K chart
Beggs & Brill
H-Y
New method
Ideal gas
10-2
Compressibility (1/psi)
10-3
10-4
10-5
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Pressure (psi)
Figure 11. Performance of four methods for the prediction of natural gas compressibility.
an accurate estimate of the Z-factor, which, in turn, led to an outlet pressure deviation of 10 psi, i.e.,
less than 1 bar.
Table 2. Performance of the various methods on the prediction of the pipeline outlet pressure
(Case Study 2).
p pi pi G p
= − (20)
Z ( p) Z ( pi ) Z ( pi ) G
where p and G p refer to the pressure and recorded cumulative gas production at the current time
instance, while pi denotes the initial reservoir pressure, and G corresponds to the reserves. Evidently,
by recording a single pressure drop and the observed gas production, the equation can be directly
solved for G. However, as such measurements (especially the pressure one) are prone to errors,
most engineers prefer to keep recording p and G p for a longer period and then compute the
statistically-optimal G value in the least squares sense. By rewriting the above equation in the
following form:
p pi 1 p
i
= − Gp (21)
Z ( p) Z ( pi ) G Z ( pi )
it becomes clear that the observed p/Z ratio at any pressure is a linear function of the cumulative
production G p . Therefore, by fitting the p/Z ratios with a linear function of the form p/Z = aG p + b
and considering that G p = G when p = 0, i.e., that the reserves will be fully produced only when the
reservoir pressure becomes equal to zero, we obtain:
p a
= a + bG p ⇒ G = lim G p = − (22)
Z p →0 b
In this example, the pressure and production data, shown in Table 3, from a large gas field have
been utilized. The fluid composition and properties were the same to those in Case study 1 and so
were the computational methods used to estimate the p/Z ratios. The estimated gas reserves G as
obtained by each method are shown in Table 4.
Table 3. Production data and the predicted Z-factor values at various pressure steps (Case Study 3).
P(psi) T(F) G p ( Bsc f ) p pr Tpr Z (B-B) Z (H-Y) Z (S-K Chart) Z (This Work)
3600 150 0.00 5.48 1.51 0.826 0.842 0.833 0.832
3450 150 4.78 5.25 1.51 0.814 0.830 0.822 0.820
3300 150 12.65 5.02 1.51 0.804 0.820 0.811 0.809
3150 150 20.48 4.79 1.51 0.795 0.810 0.800 0.798
2850 150 38.25 4.34 1.51 0.781 0.794 0.785 0.783
2685 150 44.01 4.09 1.51 0.776 0.788 0.780 0.778
Energies 2019, 12, 2577 15 of 20
As expected, the results exhibited significant differences depending on the method utilized.
Once again, the Beggs and Brill method exhibited worst performance, leading to a missed gas volume
of 4.36 billion scf of gas, whereas the Hall and Yarborough method performed better by limiting the
missed reserves to 1.05 Bscf. On the other hand, the method proposed in this work underestimated
reserves only by 0.61 Bscf, which is the most accurate estimate compared to all other approaches.
It should be noted that, unlike density calculations, when it comes to estimating hydrocarbon reserves,
the exact value of the Z-factor did not really affect the results. To show that, we rewrite Equation (20)
by replacing the Z-factor with a random multiple of that, that is:
p pi pi G p
= − (23)
aZ ( p) aZ ( pi ) aZ ( pi ) G
pi /( aZ ( pi ))
G= Gp (24)
pi /( aZ ( pi )) − p/( aZ ( p))
where, clearly, parameter a cancels, thus showing that any multiple of the Z-factor will lead to
the same reserves estimate. As was the case with the prediction of gas compressibility, this result
demonstrates the need for the Z-factor prediction models to preserve the shape of the original S-K
curves, thus exhibiting physically-sound derivatives and isothermal compressibility values.
5. Conclusions
In this work, a new, efficient, consistent, and physically-sound method is presented for the
prediction of the Z-factor of natural gas streams. Our conclusions are summarized as follows:
• At low reduced pressures where critical behavior might be observed and dependency on pressure
is quite complex, the proposed method utilized the non-linear regression TR-KRR modeling
technique to predict the gas compressibility factor.
• Our results indicated that despite the abruptly changing slope of the Z-factor isotherms,
the TR-KRR model was highly accurate and efficient at predicting Z-factor.
• The simplicity of the original S-K chart and its extension at medium and high pressures was
directly inherited by the corresponding linear and quadratic submodels developed for the
prediction of the Z-factor.
• Special attention has been paid to ensure a natural model derivative behavior, so as to end up
with reliable isothermal compressibility values.
Author Contributions: Conceptualization, M.M. and N.K.; methodology, M.M. and D.H.; software, V.G.;
validation, V.G. and D.H.; formal analysis, V.G., D.H., M.M., and K.P.; investigation, K.P., M.M., V.G., N.K.,
and D.H.; resources, K.P., M.M., D.H., and V.G.; data curation, V.G., M.M., and D.H.; writing, original draft
preparation, M.M., K.P., and V.G.; visualization, V.G. and D.H.; funding acquisition, K.P.
Funding: This publication is based on work supported by the Khalifa University of Science and Technology under
Award No. RC2-2018-024.
Acknowledgments: The authors would like to acknowledge the support by Khalifa University of Science and
Technology under Award No. RC2-2018-024.
Conflicts of Interest: The authors declare no conflict of interest.
Energies 2019, 12, 2577 16 of 20
y = f (X) = Xβ + e = ŷ + e (A2)
The weights vector β needs to be optimized so that error e exhibits its minimum value over all
available training pairs, and the optimization problem is defined by:
β = argmin J ( β) (A3)
1 i= N 2 1 1
2 i∑
J ( β) = ei = e T e = (y − ŷ) T (y − ŷ) = (y − Xβ) T (y − Xβ) (A4)
=1
2 2
The closed-form solution of this optimization problem, that is β for which ∇ β J = 0, is given by
the Moore–Penrose inverse [38] of the data matrix X, that is:
β = (X T X ) −1 X T y (A5)
Regularization [39] needs to be used to avoid poor estimation of the regression coefficients due to
the instability of the solution of Equation (A5). This idea lies in “penalizing” high coefficients values,
which, essentially, improves the rank of the covariance matrix XT X. Therefore, ridge regression aims at
minimizing the modified objective function:
1 T 1 λ
J ( β) = e e = (y − Xβ) T (y − Xβ) + β T β (A6)
2 2 2
which is optimized at:
β = (XT X + λId )−1 XT y (A7)
where Id is a d × d identity matrix and λ is a positive constant that adjusts the penalty term.
In order to extend to non-linear relationships, the dual form [40] needs firstly to be introduced.
Let β be expressed as a linear combination of the data points, i.e.,
β = XT α (A8)
y = XXT α + e = Gα + e (A9)
where the Gramian matrix G = XXT . This way, the objective function to be minimized is now expressed
in terms of the new coefficients vector α and turns into:
1 λ
f (α) = (y − Gα)T (y − Gα) + α T α (A10)
2 2
Energies 2019, 12, 2577 17 of 20
In this case, the benefit of the dual form is that solution α depends on G, that is only on dot
products of the input vectors xi . The price to be paid is that the size of α is equal to the number of data
points N, whereas the size of β is equal to the number of features d.
Kernel Ridge Regression (KRR) [34] can be thought of as an extension of the linear regression
dual form, so as to handle non-linear relationships between the input and output. This is done simply
by including a nonlinear map, φ(.), which projects the original input data x into a high-dimensional,
even infinite-dimensional, feature space F such that:
φ : x ∈ R d → φ ( x ) ∈ F. (A12)
thus leading to the generalized Gramian G = Φ(X)Φ(X) T and the regression model:
y = Φ(X)Φ(X) T α + e = Gα + e (A13)
This way output, y is non-linear in the input x, but it is still linear in the coefficients α. In general,
the non-linear mapping φ(.) is unknown; however, the solution is based mainly on linear dot products
of the images φ(x). To overcome the difficulty in working with dot products of high dimensionality in
the feature space F, kernel functions are utilized, which compute a dot product in F as a function of the
dot product of the original inputs, that is φ(x) T φ(y) = k(xT y) for some suitable scalar function k(.).
The most commonly-used kernels are the polynomial kernel k(x, y) = (xT y + 1)c with c ∈ N∗ as the
polynomial degree and the Radial Basis Function (RBF) kernel k (x, y) = exp(−1/σ ||x − y||2 ) where
σ > 0 is the width of the kernel [34]. Based on that, the Kernel Ridge Regression model (KRR) [35] is
given by:
y = Kα + e (A14)
1 λ
f (α) = (y − Kα)T (y − Kα) + αT α (A15)
2 2
The solution now is given by:
α = (K + λI N )−1 y (A16)
Although α is obtained from the solution of a linear system, the fact that matrix K + λI N can be
very large and dense renders the solution for α in Equation (A16) as a very slow process with time
complexity of O(n3 ) [35]. To treat that issue, one should revert to iterative linear systems, solving
methods such as the CG, and placing a threshold on the number of iterations leads to what is called the
truncated Newton. Maalouf and Homouz [35] combined KRR with the truncated Newton method and
developed a TR-KRR algorithm that is very fast to train. Interested readers should refer to Maalouf
and Homouz [35] for a detailed description of TR-KRR.
Once the coefficients values α have been optimized, the predictive model for any new input x is
given by the following simple, linear-in-the-weights model:
y = α T k(x) (A17)
where:
k = [k(x, x1 ), . . . , k(x, x N )] T (A18)
In this work, TR-KRR is terminated when the CG residual is less than a threshold ε = 0.5 or the
maximum number of 200 CG iterations are reached.
Energies 2019, 12, 2577 18 of 20
pr − 10
Z M ( pr , Tr ) = Z ( Tr )| pr =10 + Z ( Tr )| pr =15 − Z ( Tr )| pr =10 (A19)
5
The temperature-dependent endpoint Z-factor values have been acquired from the S-K chart and
further interpolated by means of polynomials of Tr , and they are defined by the following expressions:
and:
Z ( Tr )| pr =15 = 0.048200Tr4 − 0.502345Tr3 + 1.977248Tr2 − 3.546957Tr + 3.820608 (A21)
ZH ( pr , Tr ) = a( Tr ) p2r + b( Tr ) pr + c( Tr ) (A22)
where:
Z ( Tr )| pr =30 − 4Z ( Tr )| pr =15 + 3Z ( Tr )| pr =10
a( Tr ) = (A23)
225
Z ( Tr )| pr =15 − Z ( Tr )| pr =10
b( Tr ) = − 30a( Tr ) (A24)
5
c( Tr ) = Z ( Tr )| pr =15 − 225a( Tr ) − 15b( Tr ); (A25)
and:
Z ( Tr )| pr =30 = 0.090371Tr4 − 0.957066Tr3 + 3.938661Tr2 − 7.726749Tr + 8.039752 (A26)
Energies 2019, 12, 2577 19 of 20
From Equation (A23), it can be seen that the denominator is very large compared to the nominator,
thus verifying that the introduced curvature due to parameter a is very small and that ZH ( pr , Tr ) is
very close to a straight line.
References
1. Tan, S.P.; Qiu, X.; Dejam, M.; Adidharma, H. Critical point of fluid confined in nanopores: Experimental
detection and measurement. J. Phys. Chem. C 2019, 123, 9824–9830. [CrossRef]
2. Qiu, X.; Tan, S.P.; Dejam, M.; Adidharma, H. Simple and accurate isochoric differential scanning calorimetry
measurements: Phase transitions for pure fluids and mixtures in nanopores. Phys. Chem. Chem. Phys. 2019,
21, 224–231. [CrossRef] [PubMed]
3. Qiu, X.; Tan, S.P.; Dejam, M.; Adidharma, H. Novel isochoric measurement of the onset of vapor-liquid
phase transition using differential scanning calorimetry. Phys. Chem. Chem. Phys. 2018, 20, 26241–26248.
[CrossRef] [PubMed]
4. Nikpoor, M.H.; Dejam, M.; Chen, Z.; Clarke, M. Chemical-gravity-thermal diffusion equilibrium in
two-phase non-isothermal petroleum reservoirs. Energy Fuels 2016, 30, 2021–2034. [CrossRef]
5. Standing, M. Volumetric and Phase Behavior of Oil Field Hydrocarbon Systems: PVT for Engineers; California
Research Corporation: Vancouver, BC, Canada, 1951.
6. Amyx, J.W.; Bass, D.M.; Whiting, R.L. Petroleum Reservoir Engineering: Physical Properties; McGraw-Hill:
New York, NY, USA, 1960.
7. Redlich, O.; Kwong, J.N. On the thermodynamics of solutions. v. an equation of state. Fugacities of gaseous
solutions. Chem. Rev. 1949, 44, 233–244. [CrossRef] [PubMed]
8. Whitson, C.; Brule, M. Phase Behavior; SPE: Richardson, TX, USA, 2000.
9. Reid, R.C.; Prausnitz, J.M.; Poling, B.E. The Properties of Gases and Liquids, 4th ed.; McGraw-Hill: New York,
NY, USA, 1987.
10. Zudkevitch, D.; Joffe, J. Correlation and prediction of Vapor-Liquid Equilibrium with the Redlich-Kwong
Equation of State. AIChE J. 1970, 16, 112. [CrossRef]
11. Hayden, J.G.; O’Connell, J.P. A generalized method for predicting second virial coefficients. Ind. Eng. Chem.
Proc. Des. Dev. 1975, 14, 209–216. [CrossRef]
12. Katz, D.L.; Cornell, D.; Kobayashi, R.; Poettmann, F.H.; Vary, J.A.; Elenbaas, J.R.; Weinaug, C.F. Handbook of
Natural Gas Engineering; McGraw-Hill: New York, NY, USA, 1959.
13. Wichert, E.; Aziz, K. Compressibility Factor of Sour Natural Gases. Cdn. J. Chem. Eng. 1975, 49, 267.
[CrossRef]
14. Kay, W. Gases and vapors at high temperature and pressure-density of hydrocarbon. Ind. Eng. Chem. 1936,
28, 1014–1019. [CrossRef]
15. Stewart, W.; Burkhardt, S.; Voo, D. Prediction of pseudo-critical parameters for mixtures. In Proceedings of
the AIChE Meeting, Kansas City, MO, USA, 18 May 1959; Volume 18.
16. Sutton, R. Compressibility factors for high-molecular-weight reservoir gases. In Proceedings of the SPE
Annual Technical Conference and Exhibition, Las Vegas, NV, USA, 22–26 September 1985; Society of
Petroleum Engineers: London, UK, 1985.
17. Danesh, A. Pvt and Phase Behaviour of Petroleum Reservoir Fluids; Developments in Petroleum Science, Elsevier:
Amsterdam, The Netherlands, 1998.
18. Hall, K.R.; Yarborough, L. A New EOS for Z-factor Calculations. Oil Gas J. 1973, 71, 82–92.
19. Dranchuk, P.; Abou-Kassem, H. Calculation of z factors for natural gases using equations of state. J. Can.
Pet. Technol. 1975, 14. [CrossRef]
20. Brill, J.P.; Beggs, H.D. Two-Phase Flow in Pipes; University of Tulsa INTERCOMP Course: The Hague,
The Netherlands, 1974.
21. Azizi, N.; Behbahani, R.; Isazadeh, M. An efficient correlation for calculating compressibility factor of natural
gases. J. Nat. Gas Chem. 2010, 19, 642–645. [CrossRef]
22. Kumar, N. Compressibility Factor for Natural and Sour Reservoir Gases by Correlations and Cubic Equations
of State. Master’s Thesis, Texas Tech University, Lubbock, TX, USA, 2004.
23. Heidaryan, E.; Moghadasi, J.; Rahimi, M. New correlations to predict natural gas viscosity and
compressibility factor. Fluid Phase Equilibria 2009, 218, 1–13. [CrossRef]
Energies 2019, 12, 2577 20 of 20
24. Kareem, L.; Iwalewa, T.; Al-Marhoun, M. New explicit correlation for the compressibility factor of natural
gas: linearized z-factor isotherms. J. Petrol Explor. Prod. Technol. 2016, 6, 481–492. [CrossRef]
25. Elsharkawy, A.M. Efficient methods for calculations of compressibility, density and viscosity of natural
gases. Fluid Phase Equilibria 2004, 218, 1–13. [CrossRef]
26. Moghadassi, A.; Parvizian, F.; Hosseini, S.; Fazlali, A. A new approach for estimation of pvt properties of
pure gases based on artificial neural network model. Braz. J. Chem. Eng. 2009, 26, 199–206. [CrossRef]
27. Irene, A.I.; Sunday, I.S.; Orodu, O.D. Forecasting Gas Compressibility Factor Using Artificial Neural Network
Tool for Niger-Delta Gas Reservoir. Soc. Pet. Eng. 2016. [CrossRef]
28. Kamyab, M.; Sampaio, J.H.; Qanbari, F.; Eustes, A.W. Using artificial neural networks to estimate the z-factor
for natural hydrocarbon gases. J. Pet. Sci. Eng. 2010, 73, 248–257. [CrossRef]
29. Sanjari, E.; Lay, E.N. Estimation of natural gas compressibility factors using artificial neural network
approach. J. Nat. Gas Sci. Eng. 2012, 9, 220–226. [CrossRef]
30. Fayazi, A.; Arabloo, M.; Mohammadi, A.H. Efficient estimation of natural gas compressibility factor using a
rigorous method. J. Nat. Gas Sci. Eng. 2014, 16, 8–17. [CrossRef]
31. Kamari, A.; Hemmati-Sarapardeh, A.; Mirabbasi, S.-M.; Nikookar, M.; Mohammadi, A.H. Prediction of sour
gas compressibility factor using an intelligent approach. Fuel Process. Technol. 2013, 116, 209–216. [CrossRef]
32. Cristianini, N.; Shawe-Taylor, J. An Introduction to Support Vector Machines and other Kernel-Based Learning
Methods; Cambridge University Press: Cambridge, UK, 2000.
33. Mohamadi-Baghmolaei, M.; Azin, R.; Osfouri, S.; Mohamadi-Baghmolaei, R.; Zarei, Z. Prediction of gas
compressibility factor using intelligent models. Nat. Gas Ind. B 2015, 2, 283–294. [CrossRef]
34. Shawe-Taylor, J.; Cristianini, N. Kernel Methods for Pattern Analysis; Cambridge University Press: Cambridge,
UK, 2004.
35. Maalouf, M.; Homouz, D. Kernel ridge regression using truncated newton method. Knowl.-Based Syst. 2014,
71, 339–344. [CrossRef]
36. Efron, B.; Tibshirani, R.J. An Introduction to the Bootstrap; Chapman & Hall/CRC: Vancouver, BC, Canada, 1994.
37. Rencher, A. Methods of Multivariate Analysis; Wiley Interscience: Hoboken, NJ, USA, 2002.
38. Shores, T. Applied Linear Algebra and Matrix Analysis; Springer: Berlin/Heidelberg, Germany, 2007.
39. Bishop, C.M. Pattern Recognition and Machine Learning; Oxford University Press: Oxford, UK, 2006.
40. Nocedal, J.; Wright, S. Numerical Optimization; Springer: Berlin/Heidelberg, Germany, 2006.
c 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).