www.squinch.org
AGA8 detail, 1992
Given a gas molar analysis, AGA8 detail determines the compressibility of the gas at base conditions and at flowing conditions.
The algorithm for the calculation involves two iterative routines and works as follows:
Paramdl:
Arrange calculation parameters to match entered species. Calculation allows for 21 standard components. Paramdl packs the ones that are used into sets of working arrays.
NOTE: The order of the components appears to be important, as it affects the results returned. Each gas species has an integer ID. These IDs must be processed in ascending numerical order for the result to be correct.
Chardl:
Characterises the gas by calculating parameters b1..b18, and various other parameters, in a pair of for loops.
Normalise component mole fractions (ensure the total = 1.0000)
for i=1 to (number of entered components)
Calculate gas mix mole weight = running total of mole fraction[i]*mole weight[i]
Calculate running total of mole fraction[i]*rki[i]
2.5
Calculate running total of mole fraction[i]*ei[i]
2.5
Calculate running total of mole fraction[i]*wi[i]
Calculate running total of mole fraction[i]*qi[i]
Calculate running total of hi[i]*(mole fraction[i])
2
for j = i to (number of entered components)
This loop calculates interactions between one gas species and another.
xij = xi[i]*xi[j] (if i <> j, we double this number)
eij = beij[i][j] * sqrt(ei[i]*ei[j]) : energy interaction param
s3 = xij*sqrt(rki[i]
3
*rki[j]
3
)
calculate b1..b18 as running totals of various polynomials on s3, eij, etc.
At end of loops, scale b parameters: bi = bi * a[i]
calculate gas base density;
calculate base compressibility.
temp(Tflowing):
calculate temperature dependent parameters fn[13]..fn[58]
ddetail(Pflowing, Tflowing):
Call braket(t, p) to determine a lower and upper limit on the gas density; begin an iterative loop to converge on the density, as follows:
Loop:
Sort pressure and density points in order of decreasing pressure.
Calculate the amount of density change, delx, at pressure point y2
If we have converged,
return x2 + delx
, else...
Save current x2 and y2 as x1 and y1;
calculate x2 as x2 + delx
calculate y2 as pdetail(x2,t)-p
for at most 150 iterations.
braket(t,p):
Braket iterates to find a molar density on either side of the "correct answer" and returns these. This narrows the range over which ddetail needs to converge.
pdetail(d,t):
calculates compressibility with zdetail(d,t) and returns the pressure.
zdetail(d,t):
calls temp(t) if the temperature has changed, then returns a polynomial equation based on density, bmix and the parameters fn[13..58].
Chardl is generally the largest consumer of horsepower. The number of iterations required to perform the characterisation
increases with the square of the number of components in the analysis. Generally the loops in braket and ddetail converge in less than 10 iterations.
The AGA8 Detail algorithm is data intensive and defines approximately 2000 values held in 13 arrays.
AGA8 Detail: Enter a flowing temperature and pressure, and a gas analysis, then press Calculate. The calculation may take a few seconds to complete.
Temp (Deg C) =
Pressure (kPaA) =
C1 Mole % =
C2 Mole % =
C3 Mole % =
iC4 Mole % =
nC4 Mole % =
iC5 Mole % =
nC5 Mole % =
C6 Mole % =
C7 Mole % =
C8 Mole % =
C9 Mole % =
C10 Mole % =
N2 Mole % =
CO2 Mole % =
H2S Mole % =
CO Mole % =
H2 Mole % =
O2 Mole % =
H2O Mole % =
He Mole % =
Ar Mole % =
Results Table