top of page
Writer's picturePatrick Law

Line Sizing Calculation Using AI

Updated: Jun 19




Introduction

Efficient line sizing is crucial for reliable and safe oil and gas extraction. This document outlines a method for optimizing line sizing using AI tools like ChatGPT to enhance precision and efficiency. AI improves the accuracy and reliability of evaluations, facilitating better design and operation.


Line Sizing Calculation Parameters


Line Size Criteria

Pressure Drop

Most pressure drop occurs across a control valve, with relatively little pressure drop in the line compared to that available in the process. Equivalent lengths and elevation changes must be considered when calculating pressure drop, especially for flow between low-pressure and atmospheric vessels.- For Liquid Lines: The Darcy-Weisbach equation is commonly used:


ΔP = f (L/D) (ρv²/2)


Where:

ΔP: Pressure drop (Pa)

f: Darcy friction factor (dimensionless)

L: Length of the pipe (m)

D: Diameter of the pipe (m)

ρ: Density of the fluid (kg/m³)

𝑣: Flow velocity (m/s)

For Gas Lines: The Weymouth equation is used for high-pressure gas pipelines:


  ΔP = 4.79 × 10⁻⁴ T L Q² / d⁵ Pᵢ Z


Where:

ΔP = Pressure drop (psi)

T = Temperature (°R)

L = Length of the pipe (miles)

Q = Gas flow rate (MMscfd)

d = Diameter of the pipe (inches)

Pi​ = Initial pressure (psi)

Z = Compressibility factor (dimensionless)


For Two-Phase Flow: The Lockhart-Martinelli correlation estimates the pressure drop:


  ΔP_two-phase = ΔP_liquid (1 + C (x/(1-x)))


Where:

ΔPtwo−phase​: Two-phase pressure drop (Pa)

ΔPliquid​: Single-phase liquid pressure drop (Pa)

C: Empirical constant (dimensionless)

x: Gas mass fraction (dimensionless)


Velocity of Flow

Liquid Lines: Max 15 ft/sec, Min 3-4 ft/sec. Velocity:


  V = Q/A


Where:

V: Fluid velocity (ft/sec)

Q: Liquid flow rate (bpd)

A: Cross-sectional area of the pipe (sq ft)


Gas Lines: Min 10-15 ft/sec, Max 60-80 ft/sec. Erosional velocity:


  Ve = C √(ρₘ/S)


Where:

ρm​: Fluid density (lb/ft³)

S: Specific gravity of the gas at standard conditions (air = 1)

Ve: Erosional velocity (ft/sec)

C: Erosional flow constant



Wall Thickness Criteria

Wall thickness ensures the line can withstand internal pressure without failure. ANSI standards are commonly used in oil production facility design:- ANSI B 31.3: Chemical Plant and Petroleum Refinery Piping- ANSI B 31.4: Liquid Petroleum Transportation Piping Systems- ANSI B 31.8: Gas Transmission and Distribution Piping SystemsThe required wall thickness (t) can be calculated using the formula:


t = (P D) / (2 S F E)


Where:

t = required wall thickness to be specified in ordering pipe, in.

P = internal pipe pressure, psi

do = pipe OD, in.

S = minimum yield strength of pipe, psi

F = construction type design factor (Table 9-5)

E = longitudinal joint factor


Line Sizing Calculations Using ChatGPT

Efficient line sizing is crucial for reliable and safe oil and gas extraction. This document outlines a method for optimizing line sizing using AI tools like ChatGPT to enhance precision and efficiency. The tailored prompts provided are designed for this project but can be edited for different situations. Python code is used to verify the results, ensuring accuracy and reliability.


Step 1: Establishing the Framework

Copy Prompt 1 into a new ChatGPT session to provide the project context, objectives, inputs, and assumptions.


Step 2: Objectives, Inputs, and Assumptions

Detail your project's goals, data, and assumptions. Insert Prompt 2 and tailor the objectives and variables to fit your scenario. Fill in the input values to reflect your project's details.


Step 3: Executing the Calculation

Copy Prompt 3 to perform calculations, modifying it to clarify your specific calculation goal. Repeat as needed.


Step 4: Verification with Python

Verify calculations with Python by inputting Prompt 4.


Step 5: Finalizing and Referencing

Ensure all data is properly cited. Use Prompt 5 for finalizing and referencing.


Conclusion

Integrating AI in line sizing ensures reliable, efficient, and compliant fluid management in oil and gas extraction systems. This methodology enhances accuracy and efficiency.


 


References

  1. Hadzihafizovic, D. (2023). Oil Processing Facilities Line Size and Wall Thickness. Petroleum Science and Technology. https://doi.org/10.5281/zenodo.10370343

  2. American National Standards Institute. (1984). ANSI B31.3: Chemical Plant and Petroleum Refinery Piping.

  3. American National Standards Institute. (1984). ANSI B31.4: Liquid Petroleum Transportation Piping Systems.

  4. American National Standards Institute. (1984). ANSI B31.8: Gas Transmission and Distribution Piping Systems.

  5. American National Standards Institute. (1981). ANSI B16.5: Pipe Flanges and Flanged Fittings.

  6. American Petroleum Institute. (2004). API 6A: Specification for Wellhead and Christmas Tree Equipment.

77 views0 comments

Recent Posts

See All

Comments


bottom of page