gas_sg_from_composition
Calculate gas specific gravity using hydrocarbon molecular weight and non-hydrocarbon mole fractions when direct SG measurement is unavailable.
Instructions
Calculate gas specific gravity from composition.
COMPOSITIONAL GAS CHARACTERIZATION - Computes gas specific gravity from hydrocarbon molecular weight and non-hydrocarbon mole fractions. Uses molecular weight weighted average method. Essential when gas composition is known but SG measurement is unavailable or unreliable.
Parameters:
hc_mw (float, required): Hydrocarbon molecular weight in lb/lbmol. Valid: 10-200. Typical: 16-50. Example: 18.5 for typical natural gas.
co2 (float, optional, default=0.0): CO2 mole fraction (0-1). Typical: 0-0.20. Example: 0.05 for 5% CO2.
h2s (float, optional, default=0.0): H2S mole fraction (0-1). Typical: 0-0.05. Example: 0.02 for 2% H2S (sour gas).
n2 (float, optional, default=0.0): N2 mole fraction (0-1). Typical: 0-0.10. Example: 0.01 for 1% N2.
h2 (float, optional, default=0.0): H2 mole fraction (0-1). Typical: 0-0.01. Example: 0.0 (rare in natural gas).
Calculation Method: Weighted average based on molecular weights:
HC fraction: User-provided MW (hc_mw)
CO2: MW = 44.01 lb/lbmol
H2S: MW = 34.08 lb/lbmol
N2: MW = 28.01 lb/lbmol
H2: MW = 2.02 lb/lbmol
Air: MW = 28.97 lb/lbmol (reference for SG)
Formula: MW_avg = hc_fraction × hc_mw + co2 × 44.01 + h2s × 34.08 + n2 × 28.01 + h2 × 2.02 SG = MW_avg / 28.97
Typical Hydrocarbon MW:
Pure methane: 16.04
Dry gas (C1-C2): 16-18
Associated gas (C1-C4): 18-25
Wet gas (C1-C6): 25-35
Condensate gas: 35-50
Applications:
Compositional Simulation: Convert composition to SG for black oil models
Gas Plant Feed: Characterize feed gas from composition analysis
Sales Gas Specs: Calculate SG for pipeline specifications
Contaminated Gas: Analyze gas with high non-hydrocarbon content
Laboratory Data: Convert GC analysis to SG
Non-Hydrocarbon Effects:
CO2 increases SG (MW=44.01 > air MW=28.97)
H2S increases SG (MW=34.08 > air MW=28.97)
N2 slightly decreases SG (MW=28.01 ≈ air MW=28.97)
H2 significantly decreases SG (MW=2.02 << air MW=28.97)
Returns: Dictionary with:
gas_specific_gravity (float): Gas SG (dimensionless, air=1)
composition (dict): Detailed composition breakdown
hydrocarbon_fraction: Mole fraction of hydrocarbons
hydrocarbon_mw: Provided hydrocarbon MW
co2_fraction: CO2 mole fraction
h2s_fraction: H2S mole fraction
n2_fraction: N2 mole fraction
h2_fraction: H2 mole fraction
method (str): "Molecular weight weighted average"
units (str): "dimensionless (air=1)"
inputs (dict): Echo of input parameters
Common Mistakes:
Using weight fraction instead of mole fraction
Incorrect hydrocarbon MW (must be average MW of HC fraction)
Mole fractions don't sum to 1.0 (should sum to 1.0)
Using component MW instead of mixture MW for hydrocarbons
Not accounting for all non-hydrocarbon components
Example Usage:
Result: SG ≈ 0.65-0.70 (typical natural gas with 5% CO2, 1% N2).
Note: Mole fractions must sum to 1.0. If only HC fraction is provided, ensure hc_fraction = 1.0 - (co2 + h2s + n2 + h2). Hydrocarbon MW should be the average MW of the hydrocarbon fraction, not individual component MW.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |