function calculateFlowRate() {
// 1. Get DOM elements
var velInput = document.getElementById('velocityInput');
var velUnitSelect = document.getElementById('velocityUnit');
var diaInput = document.getElementById('diameterInput');
var diaUnitSelect = document.getElementById('diameterUnit');
var resultBox = document.getElementById('resultBox');
// 2. Parse values
var velocity = parseFloat(velInput.value);
var diameter = parseFloat(diaInput.value);
var velUnit = velUnitSelect.value;
var diaUnit = diaUnitSelect.value;
// 3. Validation
if (isNaN(velocity) || isNaN(diameter) || velocity < 0 || diameter <= 0) {
alert("Please enter valid positive numbers for velocity and diameter.");
resultBox.style.display = 'none';
return;
}
// 4. Convert inputs to Base Units (Meters and Meters/Second)
// Convert Diameter to Meters
var diameterInMeters = 0;
if (diaUnit === 'm') {
diameterInMeters = diameter;
} else if (diaUnit === 'cm') {
diameterInMeters = diameter / 100;
} else if (diaUnit === 'mm') {
diameterInMeters = diameter / 1000;
} else if (diaUnit === 'inch') {
diameterInMeters = diameter * 0.0254;
} else if (diaUnit === 'ft') {
diameterInMeters = diameter * 0.3048;
}
// Convert Velocity to Meters/Second
var velocityInMPS = 0;
if (velUnit === 'mps') {
velocityInMPS = velocity;
} else if (velUnit === 'ftps') {
velocityInMPS = velocity * 0.3048;
} else if (velUnit === 'kmh') {
velocityInMPS = velocity / 3.6;
} else if (velUnit === 'mph') {
velocityInMPS = velocity * 0.44704;
}
// 5. Calculate Cross-Sectional Area (A = pi * r^2 = pi * (d/2)^2)
var radius = diameterInMeters / 2;
var area = Math.PI * Math.pow(radius, 2);
// 6. Calculate Flow Rate (Q = A * v) in Cubic Meters per Second (CMS)
var flowCMS = area * velocityInMPS;
// 7. Convert Flow Rate to Output Units
// Cubic Meters per Hour (CMH) = CMS * 3600
var flowCMH = flowCMS * 3600;
// Liters per Minute (LPM) = CMS * 60000
var flowLPM = flowCMS * 60000;
// US Gallons per Minute (GPM) = CMS * 15850.3231
var flowGPM = flowCMS * 15850.3231;
// Cubic Feet per Minute (CFM) = CMS * 2118.88
var flowCFM = flowCMS * 2118.88;
// 8. Display Results
document.getElementById('resCMH').textContent = flowCMH.toFixed(2) + " m³/h";
document.getElementById('resLPM').textContent = flowLPM.toFixed(2) + " L/min";
document.getElementById('resGPM').textContent = flowGPM.toFixed(2) + " GPM";
document.getElementById('resCFM').textContent = flowCFM.toFixed(2) + " ft³/min";
document.getElementById('resCMS').textContent = flowCMS.toFixed(5) + " m³/s";
resultBox.style.display = 'block';
}
How to Convert Velocity to Flow Rate
Understanding the relationship between fluid velocity and volumetric flow rate is essential for engineers, plumbers, and technicians working with hydraulics, HVAC systems, or water treatment facilities. This calculator helps you determine how much fluid is moving through a pipe based on how fast it is traveling and the size of the pipe.
The Velocity to Flow Rate Formula
The fundamental equation linking flow rate ($Q$), flow velocity ($v$), and cross-sectional area ($A$) is:
Q = A × v
Where:
Q is the volumetric flow rate (e.g., m³/s or GPM).
A is the cross-sectional area of the pipe (e.g., m²).
v is the velocity of the fluid (e.g., m/s).
Step-by-Step Calculation Guide
To perform this calculation manually, follow these steps:
Measure the Diameter: Determine the inner diameter ($d$) of the pipe. It is crucial to use the inner diameter rather than the outer diameter to account for wall thickness.
Calculate the Area: Convert the diameter to the area of a circle using the formula $A = \pi \times (d/2)^2$ or $A = (\pi \times d^2) / 4$. Ensure your units match the velocity units (e.g., meters for diameter if velocity is in m/s).
Multiply by Velocity: Multiply the calculated area by the fluid velocity.
Convert Units: The result will be in cubic units per time unit (e.g., cubic meters per second). You may need to multiply by conversion factors to get to Liters per Minute (LPM) or Gallons per Minute (GPM).
Practical Example
Imagine water flowing through a 4-inch pipe at a velocity of 2.5 meters per second.
Convert to GPM: $0.02027 \times 15850 \approx 321 \text{ GPM}$.
Why is this calculation important?
System Sizing: Engineers use this calculation to ensure pipes are large enough to handle the required flow without causing excessive pressure drop or noise due to high velocity.
Pump Selection: To select the correct pump, one must know the required flow rate. If you can measure the velocity of the fluid in an existing system, you can determine the current flow rate.
Irrigation and Agriculture: Farmers use flow rate calculations to ensure crops receive the specific volume of water needed over a set period.
Common Units Used
Velocity: Meters per second (m/s), Feet per second (ft/s).
Diameter: Millimeters (mm), Inches (in).
Flow Rate: Liters per minute (LPM), US Gallons per minute (GPM), Cubic meters per hour (m³/h), Cubic feet per minute (CFM).