IGT_FLOW

Overview

Calculate gas flow rate using the IGT (Institute of Gas Technology) formula.

Excel Usage

=IGT_FLOW(sg, temp_avg, viscosity, length, diameter, p_inlet, p_outlet, comp_factor, efficiency)
  • sg (float, required): Specific gravity of gas relative to air [-]
  • temp_avg (float, required): Average temperature of gas in pipeline [K]
  • viscosity (float, required): Average viscosity of gas [Pa·s]
  • length (float, required): Length of pipe [m]
  • diameter (float, required): Diameter of pipe [m]
  • p_inlet (float, required): Inlet pressure [Pa]
  • p_outlet (float, required): Outlet pressure [Pa]
  • comp_factor (float, optional, default: 1): Average compressibility factor [-]
  • efficiency (float, optional, default: 1): Pipeline efficiency factor [-]

Returns (float): Gas flow rate at reference conditions [m³/s]

Examples

Example 1: Standard natural gas pipeline

Inputs:

sg temp_avg viscosity length diameter p_inlet p_outlet
0.693 277.15 0.00001 160000 0.34 9000000 2000000

Excel formula:

=IGT_FLOW(0.693, 277.15, 0.00001, 160000, 0.34, 9000000, 2000000)

Expected output:

48.92351786788815

Example 2: Short pipeline section

Inputs:

sg temp_avg viscosity length diameter p_inlet p_outlet
0.65 290 0.000012 10000 0.5 5000000 4500000

Excel formula:

=IGT_FLOW(0.65, 290, 0.000012, 10000, 0.5, 5000000, 4500000)

Expected output:

133.54819557700804

Example 3: Pipeline with 92% efficiency

Inputs:

sg temp_avg viscosity length diameter p_inlet p_outlet efficiency
0.7 280 0.00001 50000 0.4 7000000 3000000 0.92

Excel formula:

=IGT_FLOW(0.7, 280, 0.00001, 50000, 0.4, 7000000, 3000000, 0.92)

Expected output:

91.14548836408935

Example 4: Large diameter pipeline

Inputs:

sg temp_avg viscosity length diameter p_inlet p_outlet
0.6 285 0.000011 100000 1 8000000 4000000

Excel formula:

=IGT_FLOW(0.6, 285, 0.000011, 100000, 1, 8000000, 4000000)

Expected output:

901.0645028740394

Python Code

import micropip
await micropip.install(["fluids"])
from fluids.compressible import IGT as fluids_igt

def igt_flow(sg, temp_avg, viscosity, length, diameter, p_inlet, p_outlet, comp_factor=1, efficiency=1):
    """
    Calculate gas flow rate using the IGT (Institute of Gas Technology) formula.

    See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.IGT

    This example function is provided as-is without any representation of accuracy.

    Args:
        sg (float): Specific gravity of gas relative to air [-]
        temp_avg (float): Average temperature of gas in pipeline [K]
        viscosity (float): Average viscosity of gas [Pa·s]
        length (float): Length of pipe [m]
        diameter (float): Diameter of pipe [m]
        p_inlet (float): Inlet pressure [Pa]
        p_outlet (float): Outlet pressure [Pa]
        comp_factor (float, optional): Average compressibility factor [-] Default is 1.
        efficiency (float, optional): Pipeline efficiency factor [-] Default is 1.

    Returns:
        float: Gas flow rate at reference conditions [m³/s]
    """
    # Validate and convert inputs
    try:
        sg = float(sg)
    except (ValueError, TypeError):
        return "Invalid input: sg must be a number."

    try:
        temp_avg = float(temp_avg)
    except (ValueError, TypeError):
        return "Invalid input: temp_avg must be a number."

    try:
        viscosity = float(viscosity)
    except (ValueError, TypeError):
        return "Invalid input: viscosity must be a number."

    try:
        length = float(length)
    except (ValueError, TypeError):
        return "Invalid input: length must be a number."

    try:
        diameter = float(diameter)
    except (ValueError, TypeError):
        return "Invalid input: diameter must be a number."

    try:
        p_inlet = float(p_inlet)
    except (ValueError, TypeError):
        return "Invalid input: p_inlet must be a number."

    try:
        p_outlet = float(p_outlet)
    except (ValueError, TypeError):
        return "Invalid input: p_outlet must be a number."

    try:
        comp_factor = float(comp_factor)
    except (ValueError, TypeError):
        return "Invalid input: comp_factor must be a number."

    try:
        efficiency = float(efficiency)
    except (ValueError, TypeError):
        return "Invalid input: efficiency must be a number."

    # Validation
    if sg <= 0:
        return "Invalid input: sg must be positive."
    if temp_avg <= 0:
        return "Invalid input: temp_avg must be positive."
    if viscosity <= 0:
        return "Invalid input: viscosity must be positive."
    if length <= 0:
        return "Invalid input: length must be positive."
    if diameter <= 0:
        return "Invalid input: diameter must be positive."
    if p_inlet <= 0:
        return "Invalid input: p_inlet must be positive."
    if p_outlet < 0:
        return "Invalid input: p_outlet must be non-negative."
    if p_outlet >= p_inlet:
        return "Invalid input: p_outlet must be less than p_inlet."
    if comp_factor <= 0:
        return "Invalid input: comp_factor must be positive."
    if efficiency <= 0 or efficiency > 1:
        return "Invalid input: efficiency must be between 0 and 1."

    try:
        result = fluids_igt(SG=sg, Tavg=temp_avg, mu=viscosity, L=length, D=diameter, 
                             P1=p_inlet, P2=p_outlet, Zavg=comp_factor, E=efficiency)
        return float(result)
    except Exception as e:
        return f"Error: Failed to compute IGT flow rate: {str(e)}"

Online Calculator