TWA Crowdsourcing

Calculating Frictional Pressure Loss in a Pipeline

In engineering, fluid flow and programming is a big deal. A thorough understanding of fluid flow fundamentals is a requirement for any mechanical engineer. Whether you are sizing a pump for a pipeline, designing a heat exchanger, or trying to alleviate bottlenecks in pipeline gathering systems, fluid flow shows up in many cases in our profession. I want to demonstrate a step-by-step procedure to calculate frictional pressure losses in a pipeline for single-phase incompressible flow using a hand calculation. Then I will demonstrate how to code this in excel VBA so the process is repeatable for different cases.

The sample code is presented below:

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 'Gives the pressure gradient in psi/ft in a pipeline 'Uses Oil and Gas Units Function PressureLossgradbbl(Q, D, SG, u, e)           'Q: flow rate, bbl/day     'D: pipeline diameter, in     'SG: specific gravity     'u: viscosity, sp     'e: roughness, in           g = 32.2     A = WorksheetFunction.Pi() / 4 * D ^ 2           Re = Reynoldsbbl(SG, Q, D, u)     f = FrictionFactor(Re, e, D)           'Darcy Weasback Equation in psi/ft     PressureLossgradbbl = 0.433 * SG * (0.00105) * f * (1 / D) * ((Q / A) ^ 2) / (2 * g)   End Function '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Reynolds number for pipeline flow Function Reynoldsbbl(SG, Q, D, u)           'SG: Specific Gravity     'Q: Flow rate,(bbl/day)     'D: Diameter, in     'u: viscosity, cp           Reynoldsbbl = 92.35 * (SG * Q) / (D * u) End Function '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Friction Factor Function FrictionFactor(Re, e, D)     'Re: Reynolds Number     'e: roughness, in           'laminar flow or turbulent('Swamee Jain Friction Factor)?     If Re < 2100 Then         FrictionFactor = 64 / Re     Else         A = e / (3.7 * D)         b = 5.74 / (Re ^ 0.9)           FrictionFactor = 0.25 / (WorksheetFunction.Log10(A + b) ^ 2)           End If   End Function

Stay Connected

Don't miss our latest content, delivered to your inbox monthly. Sign up for the TWA newsletter.  If you are not logged in, you will receive a confirmation email that you will need to click on to confirm you want to receive the newsletter.

What's Trending Now
2
3
4
5