SPE 167579
Explicit Half Range Cosine Fourier Series Expansion For Z Factor
Lateef A. Kareem; King Fahd University of Petroleum and Minerals
Copyright 2013, Society of Petroleum Engineers
This paper was prepared for presentation at the Nigeria Annual International Conference and Exhibition held in Lagos, Nigeria, 30 July–1 August 2013.
This paper was selected for presentation by an SPE program committee following review of information contained in an abstract submitted by the author(s). Contents of the
paper have not been reviewed by the Society of Petroleum Engineers and are subject to correction by the author(s). The material does not necessarily reflect any position of
the Society of Petroleum Engineers, its officers, or members. Electronic reproduction, distribution, or storage of any part of this paper without the written consent of the
Society of Petroleum Engineers is prohibited. Permission to reproduce in print is restricted to an abstract of not more than 300 words; illustrations may not be copied. The
abstract must contain conspicuous acknowledgment of SPE copyright.
Abstract: All natural gas processes, including production, sweetening, drying, transportation, storage, metering
and selling requires that we possess ability to predict with great accuracy its volume, pressure, temperature,
specific heat capacity etc. Unlike an ideal gas, a real gas does not expand and contract according the simple
pressure-volume-temperature relation.
This deviation from the ideal gas behavior is corrected with the use of z-factor. Z factor is simply the ratio of the
volume of a real gas to that which equal mass of an ideal gas will occupy under the same condition.
Several computational methods of obtaining this factor have been developed, but the implicit nature of these
correlations called for an explicit method of evaluating the multivariate parameter.
In this paper, over 6000 data points prepared by careful laboratory measurement of behavior of natural gas
mixture is used to develop the model. The result was found to match the result to a very high accuracy without
over fitting.
Introduction: Compressibility factor (z-factor) of gasses is used to correct the volume of gas estimated from the
ideal gas equation to the actual value.
It is required in all calculations involving natural gasses. Several attempts have been made to determine the
compressibility factor as a function of the reduced property of the gasses. Result of the experimental
investigation into the z-factor-reduced pressure-reduced temperature relation is available in form of Standing
and Kartz chat [Heidaryan et al. 2010; Sanjari and Lay 2012; Azizi et al. 2010; Londono et al. 2002; Dranchuk
1959; Abou-kassem n.d.; Al-khamis 1995; Trube 1957; Ohirhian 2002; Jeje and Mattar 2004; Corredor et al.
1992; Elsharkawy et al. 2000; Jr 1961; Jaeschke et al. 1991].
2
SPE 167579
1.8
1.05
1.10
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
1.6
1.7
1.8
1.9
2.0
2.2
2.4
2.6
2.8
3.0
1.6
1.4
1.2
z
1
0.8
0.6
0.4
0.2
0
5
10
15
Ppr
Figure 1: Plot of experimental measure of the z factor
For numerical computations, these values are fed into the computing system and values not available are
obtained by interpolation between given values.
The cost of interpolation creates the requirement for a correlation that accurately predicts the values on the chat.
This has been attempted in two directions. First is the data fitting without the use of an equation of state, the
second is the regression of experimental data about an equation of state. One of the most notable members of the
first group is an explicit equation by Brills and Beggs (1974). To the second group belong the most accurate
correlations of evaluating the z-factor till date. Examples of these correlations are Yarborough (HY), Dranchuk,
Purvis and Robinson (DPR) and Dranchuk and Abou Kassem (DAK) correlations
Brill and Beggs (BB) Compressibility Factor
Where
.
.
.
.
.
.
.
.
.
log
.
.
.
.
.
.
.
SPE 167579
3
Hall and Yarborough (HY) Compressibility Factor
,
.
.
.
.
.
.
.
,
.
.
.
,
,
Dranchuk and Abou Kassem (DAK) z factor
.
Where y is the root of the equation
,
.
,
.
.
.
,
,
.
.
,
,
.
,
.
.
,
,
.
,
.
,
.
,
Dranchuk, Purvis and Robinson (DPR) z factor
.
Where y is the root of the equation
.
,
.
.
.
,
,
,
,
,
.
.
.
,
,
.
.
,
,
Problems of associated with BB, HY, DAK and DPR:
Brill and Beggs correlation is the most successful explicit correlation for z, but it leads to unacceptable errors at
higher pressure and temperature close to the critical temperature. While implicit correlations are accurate at
elevated temperature, they are also not very good around the critical temperature. In addition to this, picking an
initial guess that falls within the basins of attraction of the desired root is another problem that also leads to
unwanted result [Heidaryan et al. 2010; Sanjari and Lay 2012; Azizi et al. 2010].
The key to solving this problem is in Fourier expansion using the sines and cosines basis. Fourier expansion gets
better as the number of terms increases thereby eliminating the problem of over fitting associated with explicit
fits in powers of independent variables.
4
SPE 167579
1.8
1.05
1.1
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
1.6
1.7
1.8
1.9
2
2.2
2.4
2.6
2.8
3
1.6
1.4
Z
1.2
1
0.8
0.6
0.4
0.2
0
5
10
15
Ppr
Figure 2: Plot of Hall and Yarborough z factor chart with convergence problem
1.8
1.05
1.1
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
1.6
1.7
1.8
1.9
2
2.2
2.4
2.6
2.8
3
1.6
1.4
Z
1.2
1
0.8
0.6
0.4
0.2
0
5
10
15
Ppr
Figure 3: A plot of Dranchuk Abou Kassem z factor chart with convergence problem
SPE 167579
5
1.8
1.05
1.1
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
1.6
1.7
1.8
1.9
2
2.2
2.4
2.6
2.8
3
1.6
1.4
Z
1.2
1
0.8
0.6
0.4
0.2
0
5
10
15
Ppr
Figure 4: A plot of Dranchuk Purvis Robinson z factor chart with convergence problem
Fourier Series:
In mathematics, a Fourier series is a decomposition of periodic functions or periodic signals into the sum of a
(possibly infinite) set of oscillating circular functions, namely sines and cosines.
,
cos
sin
cos
sin
The use of Fourier can be extended to non-periodic functions and made to be exclusively sine or cosine if
extended into an old or even function respectively.
Expansion of z factor: The Fourier expansion model is developed for pseudo reduced pressure ranging from 0
to 15 and reduced temperature from 1.05 to 3. The half range cosine expansion was selected so as to eliminate
and
.
the Gibbs phenomenon around the boundaries at
Where
,
is the half range length of the reduced pressure
cos
Since the is bivariate, and is being expressed as a Fourier series in , then all the weights of the cosine terms
are functions of
And
is expressed as simple degree 6 polynomial function of reciprocal of
,
6
SPE 167579
Then the z-factor could be written as
,
cos
,
But for the discrete data
is forced to be equal or less than the number of pressure point for a give pseudo
reduced temperature. There is no point taking m to 300 since it a maximum value of 61 produced a very
accurate prediction of z. Thus taking,
cos
as the variable, we can perform least square regression to evaluate
,
cos
,
,
for
and
.
Validation: The explicit correlation was validated by generating the z factor chat and performing statistical
error analysis shown in the table below .
Table 1: Stastical Analysis of the Correlation
Maximum Absolute Error
, , ,…….
Maximum Absolute
Percentage Error
, , ,…….
%
Average Absolute
Percentage Error
∑
%
Root Mean Square of
Absolute percentage Error
∑
%
Correlation of Regression
∑
∑
∑
SPE 167579
7
The error in the estimation of z factor using the explicit correlation is also compared with error generated by the
implicit correlations.
1.8
1.05
1.10
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
1.6
1.7
1.8
1.9
2.0
2.2
2.4
2.6
2.8
3.0
1.6
1.4
z
1.2
1
0.8
0.6
0.4
0.2
0
5
10
15
Ppr
Figure 5: A plot of z factor chart using the explicit Fourier correlation
1.8
1.6
1.4
z -es t
1.2
1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
z-exp
1.2
1.4
Figure 6: A Comparison of Explicit Fourier correlation and the measured z
1.6
1.8
8
SPE 167579
1.8
1.6
1.4
z -es t
1.2
1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
z-exp
1.2
1.4
1.6
1.8
Figure 7: A Comparison of Hall and Yabourough correlation and the measured z
1.8
1.6
1.4
z -es t
1.2
1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
z-exp
1.2
1.4
1.6
Figure 8: A Comparison of Dranchuk & Abou Kaseem correlation and the measured z
1.8
SPE 167579
9
1.8
1.6
1.4
z-est
1.2
1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
z-exp
1.2
1.4
1.6
1.8
Figure 9: A Comparison of Dranchuk, Purvis & Robinson correlation and the measured z
The error plot shown in figure 10 shows that the explicit Fourier z factor correlation generated are closer to zero
than all other correlations hence the far higher correlation of regression coefficient. See table 2
0.03
0.02
0.01
0
-0.01
-0.02
-0.03
Hall and Yaborough
Dranchuk & Abou Kaseem
Dranchuk, Purvis & Robinson
Fourier z
-0.04
-0.05
0
1000
2000
3000
4000
5000
6000
Figure 10: Error plot for Hall & Yaborough, Dranchuk & Abou Kassem, Dranchuk, Purvis & Robinson, and
Fourier z factor correlations
10
SPE 167579
Recommendation
The Fourier series of a function has been known to always converge to the mean of the value of the function at
the point of discontinuity. And by extension, it means the integral of the Fourier series also converges to the
integral of the function, however the same is not always true for the derivative of the Fourier series and the
derivative of the function.
Hence, this correlation should not be used in the evaluation of the Isothermal compressibility of the gas.
Isothermal compressibility is the change in volume per unit volume per unit change in pressure
Using the real gas equation
,
,
∙
In terms of reduced properties
But because
∑
Conclusion
,
,
∑
∑
∑
,
,
The Fourier series expansion of z factor is a very accurate mean of evaluating the z factor explicitly. The
explicit z factor so developed has a better performance in terms of correlation of regression, root mean square of
error and maximum absolute error as shown in the table below.
SPE 167579
11
Table 2: Summary of comparison of the correlations
Maximum
Absolute
Error
Maximum
Absolute
Percentage
Error
Hall and Yarborough
0.0221722
5.22538578
Dranchuk & Abou Kaseem
0.0496129
13.6272523
Dranchuk, Purvis & Robinson
0.0494820
13.1811496
Fourier z
0.0166618
2.944261
Average
Absolute
Percentage
Error
Root mean square
percentage error
0.3129010
0.543093764
Dranchuk & Abou Kaseem
0.3589575
0.752813852
Dranchuk, Purvis & Robinson
0.4410269
0.812348227
Fourier z
0.1409741
0.275287118
Hall and Yarborough
Coefficient of
regression
Hall and Yarborough
0.9998811487
Dranchuk & Abou Kaseem
0.9998350091
Dranchuk, Purvis & Robinson
0.9997621456
Fourier z
0.9999724440
Nomenclature
Gas compressibility
Pseudo reduced compressibility
Number of data point
Universal Gas constant
Pressure
Pseudo critical pressure
Pseudo reduced pressure
Temperature
Pseudo critical temperature
Pseudo reduced temperature
Pseudo critical pressure
Pseudo reduced pressure
Initial guess for iteration process
Pseudo reduced density
Compressibility factor
12
SPE 167579
Reference
ABOU-KASSEM, P.M.D.J.H., EQUATIONS OF STATE.
AL-KHAMIS, M.N., 1995. Evaluation of Correlations for Natural Gas Compressibility Factors by.
AZIZI, N., BEHBAHANI, R. AND ISAZADEH, M. A., 2010. An efficient correlation for calculating compressibility
factor of natural gases. Journal of Natural Gas Chemistry, 19(6), pp.642–645.
CORREDOR, J.H., PIPER, L.D., TEXAS, A., MCCAIN, W.D. AND HOLDITCH, S.A., 1992. Compressibility Factors
for Naturally Occurring Petroleum Gases.
DRANCHUK, R.A.P.D.B.R.P.M., 1959. GENERALIZED COMPRESSIBILITY FACTOR TABLES. , (1).
ELSHARKAWY, A., HASHEM, Y. AND ALIKHAN, A., 2000. Compressibility Factor for Gas Condensates.
Proceedings of SPE Permian Basin Oil and Gas Recovery Conference.
HEIDARYAN, E., MOGHADASI, J. AND RAHIMI, M., 2010. New correlations to predict natural gas viscosity and
compressibility factor. Journal of Petroleum Science and Engineering, 73(1-2), pp.67–72.
JAESCHKE, M. ET AL., 1991. Accurate Prediction of Compressibility ~ actors by the GERG Virial Equation. ,
(August), pp.343–350.
JEJE, O. AND MATTAR, L., 2004. Comparison of Correlations for Viscosity of Sour Natural Gas. Proceedings of
Canadian International Petroleum Conference, pp.1–9.
JR, L.E.R., 1961. Simplified Graphical Method of Determining Gas Compressibility Factors.
LONDONO, F.E., ARCHER, R.A., BLASINGAME, T.A. AND TEXAS, A., 2002. SPE 75721 Simplified Correlations
for Hydrocarbon Gas Viscosity and Gas Density — Validation and Correlation of Behavior Using a
Large-Scale Database.
OHIRHIAN, P.U., 2002. SPE 30332 Calculation of the Pseudo Reduction Compressibility of Natural Gases. , (4),
pp.1–16.
SANJARI, E. AND LAY, E.N., 2012. An accurate empirical correlation for predicting natural gas compressibility
factors. Journal of Natural Gas Chemistry, 21(2), pp.184–188.
TRUBE, A., 1957. Compressibility of Natural Gases. Journal of Petroleum Technology, 9(1).
SPE 167579
13
Appendix 1.
The value of
⁄
0
1
0
1.544
-1.264
2
3
4
5
6
,
1
-3.629
12.865
2
12.312
-58.207
3
-19.352
134.949
4
10.642
-171.040
5
2.667
110.811
6
-3.204
-28.750
0.050
0.479
-0.082
-0.354
-0.491
0.822
-6.793
0.689
2.998
5.531
-7.984
36.040
-2.470
-10.415
-25.626
25.384
-95.710
5.482
19.561
62.664
-34.801
135.666
-7.824
-22.036
-85.018
21.883
-97.241
7.087
14.754
60.625
-5.294
27.582
-2.809
-4.457
-17.623
7
8
9
10
11
-0.604
-0.315
-0.174
-0.231
-0.015
6.988
3.895
2.029
2.568
-0.065
-33.131
-19.415
-9.658
-11.390
1.418
81.932
49.888
23.708
25.656
-6.395
-111.266
-69.432
-31.418
-30.628
12.869
78.530
49.593
21.175
18.189
-12.233
-22.404
-14.155
-5.609
-4.107
4.468
12
13
14
15
16
0.121
0.413
0.598
0.527
0.644
-1.658
-4.918
-6.806
-6.080
-7.153
9.068
23.767
31.529
28.431
32.281
-25.374
-59.655
-76.099
-68.964
-75.731
38.482
82.006
100.928
91.522
97.404
-30.007
-58.526
-69.692
-63.011
-65.101
9.412
16.947
19.570
17.590
17.665
17
18
19
20
21
0.471
0.204
0.135
-0.121
-0.287
-5.161
-2.240
-1.410
1.436
3.209
22.911
9.903
5.850
-6.938
-14.658
-52.810
-22.543
-12.281
17.503
35.003
66.637
27.829
13.645
-24.295
-46.109
-43.618
-17.614
-7.483
17.609
31.790
11.567
4.451
1.532
-5.210
-8.964
22
23
24
25
-0.253
-0.333
-0.333
-0.283
2.880
3.727
3.780
3.180
-13.370
-17.001
-17.419
-14.521
32.406
40.426
41.683
34.460
-43.222
-52.865
-54.635
-44.828
30.089
36.065
37.233
30.327
-8.543
-10.032
-10.318
-8.342
26
27
28
29
30
-0.273
-0.173
-0.148
-0.101
0.086
3.031
1.895
1.592
1.071
-0.932
-13.633
-8.419
-6.962
-4.573
4.120
31.836
19.415
15.800
10.069
-9.538
-40.717
-24.504
-19.602
-12.052
12.228
27.070
16.052
12.604
7.429
-8.239
-7.315
-4.265
-3.281
-1.838
2.282
31
32
33
34
35
0.140
0.172
0.213
0.272
0.190
-1.590
-1.922
-2.356
-3.006
-2.114
7.328
8.756
10.599
13.523
9.599
-17.588
-20.816
-24.871
-31.680
-22.727
23.180
27.243
32.129
40.773
29.586
-15.912
-18.608
-21.676
-27.343
-20.072
4.450
5.185
5.970
7.469
5.546
36
37
38
39
40
0.167
0.084
0.120
0.043
0.051
-1.853
-0.960
-1.299
-0.476
-0.526
8.353
4.451
5.739
2.148
2.209
-19.597
-10.760
-13.201
-5.025
-4.801
25.263
14.280
16.690
6.428
5.702
-16.976
-9.856
-11.001
-4.264
-3.504
4.649
2.764
2.955
1.146
0.869
14
SPE 167579
41
42
-0.043
-0.070
0.485
0.751
-2.237
-3.305
5.345
7.617
-6.986
-9.691
4.750
6.462
-1.317
-1.766
43
44
45
46
-0.041
-0.107
-0.083
-0.061
0.475
1.199
0.915
0.686
-2.244
-5.465
-4.112
-3.148
5.523
12.946
9.656
7.532
-7.457
-16.825
-12.489
-9.895
5.241
11.388
8.440
6.771
-1.500
-3.140
-2.329
-1.887
47
48
49
50
51
-0.033
0.007
-0.005
-0.025
0.008
0.354
-0.047
0.074
0.265
-0.106
-1.588
0.090
-0.437
-1.164
0.559
3.756
0.077
1.250
2.657
-1.506
-4.930
-0.464
-1.870
-3.316
2.180
3.402
0.551
1.409
2.144
-1.616
-0.962
-0.215
-0.421
-0.561
0.481
52
53
54
55
56
0.044
0.045
0.069
0.069
0.045
-0.477
-0.494
-0.757
-0.783
-0.493
2.093
2.207
3.373
3.595
2.209
-4.794
-5.166
-7.849
-8.575
-5.179
6.054
6.679
10.061
11.204
6.702
-4.001
-4.518
-6.736
-7.609
-4.537
1.082
1.249
1.841
2.101
1.255
57
58
59
60
0.012
0.065
0.048
-0.031
-0.147
-0.709
-0.533
0.323
0.742
3.160
2.401
-1.362
-1.931
-7.351
-5.622
2.958
2.734
9.409
7.224
-3.491
-2.000
-6.284
-4.830
2.124
0.591
1.712
1.315
-0.521
SPE 167579
Appendix 2.
Matlab code for evaluating z factor given the specific gravity, temperature and pressure
function z = fourierz (s,T,P)
%% Compressibility Factor (z)
% Author : Kareem Lateef Adewale
% Date
: 28 February 2013
%---------------------------------------% s is the gas gravity, T is the temperature in Fahrenheit and P is
%the pressure in psia
%---------------------------------------% Solving the problem
Tc = 170.491+307.344*s;
%pseudo critical temperature
Pc = 709.604-58.718*s;
%pseudo critical pressure
Tr = (T+460)/Tc;
%pseudo reduced temperature
Pr = P/Pc;
%pseudo reduced pressure
t = Tr^-1;
load ('H.mat');
C =
c =
A =
for
H';
C(:);
zeros(size(c));
h = 1:61
for i = 1:7
m = i + (h-1)*7;
A(m) = (t^(i-1))*cos((h-1)*pi*Pr/15);
end
end
z = sum(c.*A);
15