gas_sg_from_gradient
Calculate gas specific gravity from measured pressure gradient data using Newton-Raphson solver. Essential for formation fluid identification and gas property verification in petroleum engineering applications.
Instructions
Calculate gas specific gravity from pressure gradient.
DIAGNOSTIC TOOL - Determines gas specific gravity from measured pressure gradient in a gas column. Uses standalone Newton-Raphson solver (fixed implementation) to solve the inverse problem. Essential for formation fluid identification and gas property verification when only gradient data is available.
Parameters:
gradient (float, required): Pressure gradient in psi/ft. Must be > 0. Typical: 0.05-0.15 psi/ft. Example: 0.1 psi/ft.
degf (float, required): Temperature in °F at measurement depth. Valid: -460 to 1000. Typical: 100-400°F. Example: 180.0.
p (float, required): Pressure in psia at measurement depth. Must be > 0. Example: 3500.0.
method (str, optional, default="DAK"): Z-factor method for calculation. Options: "DAK", "HY", "WYW", "BUR". DAK recommended.
Gradient Principle: Gas gradient = dP/dh = (ρg × g) / 144 = (P × MW) / (Z × R × T × 144)
Where:
ρg = gas density (lb/cuft)
MW = molecular weight = sg × 28.97 lb/lbmol
Z = gas compressibility factor
R = gas constant = 10.732 psia·ft³/(lbmol·°R)
T = temperature (°R = °F + 460)
Applications:
Formation Fluid ID: Identify gas vs oil vs water from gradient
Gas Density Verification: Check measured gas gravity against gradient
Completion Fluid Design: Design mud weight based on gas gradient
Wellbore Pressure Modeling: Calculate pressure profiles in gas columns
Typical Gradients:
Dry gas (sg=0.6): ~0.08 psi/ft
Associated gas (sg=0.8): ~0.11 psi/ft
Heavy gas (sg=1.0): ~0.14 psi/ft
Solution Method: Uses Newton-Raphson iterative solver to find sg that yields the specified gradient. This is a standalone fixed implementation that avoids upstream library bugs.
Returns: Dictionary with:
value (float): Gas specific gravity (dimensionless, air=1)
method (str): "Gradient correlation (Newton-Raphson)"
units (str): "dimensionless (air=1)"
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 (affects MW and Z)
Using wrong gradient units (must be psi/ft, not psi/100ft)
Temperature in Celsius instead of Fahrenheit
Example Usage:
Result: Gas SG ≈ 0.7-0.8 for typical natural gas gradient.
Note: This tool uses a standalone fixed implementation to avoid upstream bugs. Always use reservoir conditions (pressure and temperature at measurement depth). Gradient is sensitive to temperature - use correct temperature for accurate results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |