Calculating the flow rate of natural gas through a pipeline is a critical task in fluid mechanics and petroleum engineering. Accurate calculations ensure pipeline efficiency, safety, and proper sizing of equipment. This calculator utilizes the Weymouth Equation, a standard formula widely used for sizing compressed air and natural gas pipelines in high-pressure turbulent flow regimes.
The Weymouth Equation Explained
The Weymouth equation is an empirical formula used to estimate the flow rate of gas in a pipe based on the pressure drop between the inlet and outlet. It is particularly effective for high-pressure transmission lines with large diameters.
The general formula logic implemented here considers:
Pressure Differential: The driving force of flow is the difference between the squared upstream pressure ($P_1$) and the squared downstream pressure ($P_2$).
Pipe Dimensions: Flow rate is directly proportional to the pipe diameter raised to the power of 2.667 and inversely proportional to the square root of the pipe length.
Gas Properties: The specific gravity (relative density compared to air) and temperature of the gas affect its compressibility and friction, influencing the flow rate.
Key Input Parameters
Upstream Pressure (P₁): The gauge pressure at the inlet of the pipe section. Higher inlet pressure increases the flow potential.
Downstream Pressure (P₂): The gauge pressure at the outlet. This must be lower than the upstream pressure for flow to occur.
Internal Diameter: The actual inside diameter of the pipe in inches. Small changes in diameter have a significant exponential impact on flow capacity.
Pipe Length: The distance the gas travels. Longer pipes result in greater friction loss and reduced flow rate.
Specific Gravity: For natural gas, this value is typically around 0.60 to 0.70. Air has a specific gravity of 1.0.
Factors Affecting Efficiency
While this calculator provides a robust theoretical estimate, real-world flow rates can be influenced by pipeline efficiency factors. Old pipes with corrosion or debris (scale) will have higher friction factors, reducing the actual flow compared to the theoretical maximum. Additionally, elevation changes along the pipeline route can introduce static pressure heads that affect the final flow rate.
Common Applications
This calculation is essential for:
Sizing gathering lines in natural gas fields.
Designing distribution networks for municipal gas supply.
Evaluating pressure drops across existing transmission lines.
Optimizing compressor station spacing and power requirements.
function calculateGasFlow() {
// Clear previous errors
var errorDiv = document.getElementById('errorDisplay');
var resultDiv = document.getElementById('result');
errorDiv.style.display = 'none';
errorDiv.innerHTML = ";
resultDiv.style.display = 'none';
// 1. Get Input Values
var p1_g = parseFloat(document.getElementById('p1').value); // psig
var p2_g = parseFloat(document.getElementById('p2').value); // psig
var d = parseFloat(document.getElementById('pipeDia').value); // inches
var l_ft = parseFloat(document.getElementById('pipeLen').value); // feet
var sg = parseFloat(document.getElementById('specGrav').value); // Specific Gravity
var t_f = parseFloat(document.getElementById('temp').value); // Fahrenheit
// 2. Validate Inputs
if (isNaN(p1_g) || isNaN(p2_g) || isNaN(d) || isNaN(l_ft) || isNaN(sg) || isNaN(t_f)) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = "Please fill in all fields with valid numbers.";
return;
}
if (d <= 0 || l_ft <= 0 || sg <= 0) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = "Diameter, Length, and Specific Gravity must be greater than zero.";
return;
}
if (p1_g <= p2_g) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = "Upstream Pressure (P₁) must be greater than Downstream Pressure (P₂) for flow to occur.";
return;
}
// 3. Convert Units for Weymouth Equation
// Pressure: Convert psig to psia (Absolute Pressure)
var patm = 14.7; // Atmospheric pressure
var p1_abs = p1_g + patm;
var p2_abs = p2_g + patm;
// Temperature: Convert Fahrenheit to Rankine
var t_r = t_f + 460;
// Length: Convert feet to miles
var l_miles = l_ft / 5280;
// Constants for Standard Conditions (60F, 14.73 psia)
var tb = 520; // Base temperature (Rankine)
var pb = 14.73; // Base pressure (psia)
var e = 1.0; // Efficiency factor (assumed 1.0 for new pipe)
var z = 0.9; // Compressibility factor (average approximation)
// 4. Calculate using Weymouth Equation
// Formula: Q = 433.5 * E * (Tb/Pb) * sqrt( (P1^2 – P2^2) / (G * T * L * Z) ) * D^2.667
var pressureTerm = (Math.pow(p1_abs, 2) – Math.pow(p2_abs, 2));
var denominatorTerm = sg * t_r * l_miles * z;
var radicalTerm = Math.sqrt(pressureTerm / denominatorTerm);
var diameterTerm = Math.pow(d, 2.667);
var constantTerm = 433.5 * e * (tb / pb);
var q_scfd = constantTerm * radicalTerm * diameterTerm;
// 5. Format and Display Result
var formattedResult = Math.round(q_scfd).toLocaleString('en-US');
document.getElementById('flowResult').innerHTML = formattedResult;
resultDiv.style.display = 'block';
}