gas_z_factor
Calculate gas compressibility factor (Z-factor) to correct ideal gas law for real gas behavior in reservoir engineering applications including material balance and flow calculations.
Instructions
Calculate gas compressibility factor (Z-factor).
CRITICAL GAS PVT PROPERTY - The Z-factor corrects the ideal gas law (PV=nRT) for real gas behavior. Z = 1.0 for ideal gas, Z < 1.0 for most real gases at reservoir conditions. Essential for all gas reservoir calculations including material balance, reserve estimation, and flow calculations.
Parameters:
sg (float, required): Gas specific gravity (air=1.0). Valid: 0.55-3.0. Typical: 0.6-1.2. Example: 0.7 for dry gas, 0.85 for associated gas.
degf (float, required): Reservoir temperature in °F. Valid: -460 to 1000. Typical: 100-400°F. Example: 180.0.
p (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 3500.0 or [1000, 2000, 3000, 4000].
h2s (float, optional, default=0.0): H2S mole fraction (0-1). Typical: 0-0.05. Example: 0.02 for 2% H2S. High H2S requires special handling.
co2 (float, optional, default=0.0): CO2 mole fraction (0-1). Typical: 0-0.20. Example: 0.05 for 5% CO2.
n2 (float, optional, default=0.0): N2 mole fraction (0-1). Typical: 0-0.10. Example: 0.01 for 1% N2.
method (str, optional, default="DAK"): Correlation method. Options: "DAK", "HY", "WYW", "BUR". DAK recommended.
Z-Factor Behavior:
Low pressure: Z ≈ 1.0 (ideal gas behavior)
Medium pressure: Z < 1.0 (attractive forces dominate)
High pressure: Z > 1.0 (repulsive forces dominate)
Typical range: 0.7-1.2 for reservoir conditions
Method Selection:
DAK (Dranchuk & Abou-Kassem 1975): RECOMMENDED. Most accurate, widely validated. Use for: All applications, high accuracy requirements.
HY (Hall & Yarborough 1973): Classic method, fast. Use for: Quick estimates, compatibility with older methods.
WYW (Wang, Ye & Wu 2021): Newer correlation. Use for: Comparison studies, modern applications.
BUR (Burrows 1981): Alternative method. Use for: Specific regional correlations.
Non-Hydrocarbon Effects:
H2S and CO2 increase Z-factor (reduce compressibility)
N2 has minimal effect
For sour gas (H2S > 5%), use Wichert-Aziz correction (not included here)
Returns: Dictionary with:
value (float or list): Z-factor (dimensionless, matches input p shape)
method (str): Method used
units (str): "dimensionless"
inputs (dict): Echo of input parameters
Common Mistakes:
Using separator temperature instead of reservoir temperature
Pressure in barg/psig instead of psia (must be absolute)
Not accounting for non-hydrocarbon fractions (H2S, CO2, N2)
Using wrong gas gravity (must be separator gas gravity, not sales gas)
Temperature in Celsius instead of Fahrenheit
Example Usage:
Result: Z decreases from ~0.95 at 1000 psia to ~0.85 at 3000 psia, then increases to ~0.90 at 4000 psia (typical behavior).
Note: Z-factor is critical for accurate gas calculations. Always use DAK method unless specific compatibility requirements exist. Account for all non-hydrocarbon components for accurate results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |