You are on page 1of 3

Use of Gauss-Jacobi Method in Determining

Hydrocarbon Loss in Natural Gas


Jose Martin S. Arellano, Rainier Angelo S. Narciso
Bachelor of Science in Petroleum Engineering – 2A
College of Engineering, Architecture and Technology
Palawan State University
201940398@psu.palawan.edu.ph
201940371@psu.palawan.edu.ph

Abstract— This paper aims to bring numerical


After isolating the corresponding equations, make
solution of a differential equation applying Gauss-
an initial guess of the solution (usually 0) and then,
Jacobi’s Method with the use of Microsoft Excel
substitute these values into the right-hand side the of
formulas.
the rewritten isolated equations to obtain the first
approximation. This now is the first step of iteration. In
Keywords— Gauss-Jacobi, Iteration,
the second iteration, substitute the first approximation’s
Approximation, matrix equation,
values into the right-hand side of the rewritten isolated
equations.
I. INTRODUCTION
The Gauss-Jacobi method is a method of solving a
Numerical Problem:
matrix equation on a matrix that has no zeroes along its
main diagonal. In Gauss-Jacobi Method, we need a Extraction of natural gas in wells and deposits
square matrix that is linear and diagonally dominant. underneath the surface of the Earth and transfer of gases
The reason for wanting our matrix to be diagonally to condensate tanks may result to hydrocarbon loss.
dominant is for us to guarantee iterative methods on The following equations are used to determine the
linear systems. following factors affecting hydrocarbon loss, (h) height
of condensate tank (in km), (t) temperature (in C), and
Eq 1. (C) concentration (in mg/L). Iteration will terminate
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1 when the variable has ≤ 0.0001 approximate error.
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2
⋮ Let x = h, y = C, z = t
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛
5𝑥 − 2𝑦 + 3𝑧 = −1
−3𝑥 + 9𝑦 + 𝑧 = 2
In the example above, the coefficient matrix must 2𝑥 − 𝑦 − 7𝑧 = 3
have no zeroes on its main diagonal, namely, 𝑎11 , 𝑎22 ,
Solution:
and 𝑎𝑛𝑛 are non-zeroes.
Isolate each equation. (Iterative Formula)
II. METHODOLOGY −1 + 2𝑦 − 3𝑧
𝑥 =
Start solving these equations by isolating the 𝑥1 as 5
first equation, 𝑥2 as the second equation and 𝑥𝑛 as the 2 + 3𝑥 − 𝑧
𝑦 =
nth equation. 9
3 − 2𝑥 + 𝑦
Eq. 2 𝑧 =
−7
(𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 − ⋯ − 𝑎1𝑛 𝑥𝑛
𝑥1 = 1st iteration at, 𝒙 = 𝟎, 𝒚 = 𝟎, 𝒛 = 𝟎
𝑎11
−1 + 2(0) − 3(0)
(𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 − ⋯ − 𝑎2𝑛 𝑥𝑛 𝑥 = = −0.2000
𝑥2 = 5
𝑎21 2 + 3(0) − (0)
𝑦 = = 0.2222
(𝑏𝑛 − 𝑎𝑛1 𝑥1 − 𝑎𝑛2 𝑥2 − ⋯ − 𝑎𝑛,𝑛−1 𝑥𝑛−1 9
𝑥𝑛 = 3 − 2(0) + (0)
𝑎𝑛𝑛 𝑧 = = −0.4286
−7
2nd iteration at, 𝒙 = −𝟎. 𝟐, 𝒚 = 𝟎. 𝟐𝟐𝟐𝟐, 𝒛 = REFERENCES
−𝟎. 𝟒𝟐𝟖𝟔 [1] Bronshtein, I. N. and Semendyayev, K. A. Handbook of
−1 + 2(0.2222) − 3(−0.4286) Mathematics, 3rd ed. New York: Springer-Verlag, p. 892,
𝑥 = = 0.1460 1997.
5 [2] Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling,
2 + 3(−0.2) − (−0.4286) W. T. Numerical Recipes in FORTRAN: The Art of Scientific
𝑦 = = 0.2032 Computing, 2nd ed. Cambridge, England: Cambridge
9
University Press, pp. 864-866, 1992.
3 − 2(−0.2) + (0.2222) [3] Saeid Mokhatab, ... John Y. Mak, in Handbook of Natural Gas
𝑧 = = −0.5175
−7 Transmission and Processing (Fourth Edition), 2019
△ 𝑥 = |0.1460 + 0.2000| = 0.3460
APPENDIX
△ 𝑦 = |0.2032 − 0.2222| = 0.0190
△ 𝑧 = |0.5175 − 0.4286| = 0.0889 Sub Gauss_Jacobi()

Dim A(1 To 36, 1 To 6) 'my [A] matrix


Dim b(1 To 6)
This iteration or approximation with the same Dim x(1 To 6)
process goes on until values are satisfied. With the use Dim u(1 To 6)
of formulas in Microsoft Excel, we would be able to
find the values without going through the long process 'read in my [A] matrix
For RC = 1 To 6
of iteration each value. For CC = 1 To 6
A(RC, CC) =
Worksheets("MatrixProblem").Cells(11 +
III. RESULTS AND DISCUSSIONS RC, 1 + CC).Value
Next CC
This study makes use of the formulas in Microsoft b(RC) =
Excel in finding and tabulating the values of the Worksheets("MatrixProblem").Cells(11 +
variables until values are satisfied. RC, 13).Value
x(RC) =
Table 1. Worksheets("MatrixProblem").Cells(11 +
RC, 11).Value
Next RC
Maxiter =
Worksheets("MatrixProblem").Cells(6,
17).Value
'calculate jacobi algorithm
For iter = 1 To Maxiter

For i = 1 To 6
rowsum = 0
For j = 1 To 6
If j <> i Then
rowsum = rowsum + A(i, j) *
x(j)
The values from doing the iterations one by one are End If
the same from doing it through a computer. (See Next j
Numeric Problem for 1st and 2nd iteration.) u(i) = b(i) - rowsum
Next i
'reassign u vector to x
Results show that we need eight (8) iterations until For m = 1 To 6
our values were satisfied. Further iterations show no x(m) = u(m)
change in x, y, and z variables as shown in 9th iteration Next m
in Table 1. Therefore, hydrocarbon loss stops when
Next iter
height of condensate tanks is 0.1861 km, concentration
at 0.3312 mg/L, and temperature at -0.4227º C. 'write out data
For RC = 1 To 6
IV. CONCLUSIONS For CC = 1 To 6

Worksheets("MatrixProblem").Cells(27 +
In conclusion to this study, the hydrocarbon loss of RC, 1 + CC).Value = A(RC, CC)
natural gas in refineries can be solved with Gauss-
Jacobi method with a numerical problem related to Worksheets("MatrixProblem").Cells(27 +
engineering. Manual iterations and approximations are RC, 13).Value = b(RC)
good but it can be done better and faster with code in Worksheets("MatrixProblem").Cells(27 +
Microsoft Excel through VBA. RC, 9).Value = x(RC)

Next CC
Next RC

End Sub
Group Contribution:
Narciso, Rainier Angelo S. – Introduction,
Methodology, Results and Discussions,
Compilation, References.
Arellano, Jose Martin S. – Introduction,
Conclusion, Appendix (Code), References.

You might also like