Home
Generals
Unit converter
Periodic table
Molecular weight
Properties
Hydrocarbon properties
Steam properties
Psychrometric properties
Fuel gas LHV
Flue gas enthalpy
Dynamics
Equation of state
Flow convert (mass - volume)
Energy to emission
Flow rate
Darcy friction factor
Mean pressure
Flow compensation
Orifice sizing
Bernoulli equation
Steam pinhone
Control valve CV
Sizing
LMTD
Flash steam
Pump BHP
Performance
Cooling tower capability
Heater efficiency
Compressor efficiency
Turbine efficiency
About
ID
Name
Title
Keyword
Description
<p style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;">This Python code calculates differential pressure or flow rate according to given pipe & fitting information for compressible fluid.</p><p style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;">Calculate differential pressure in pipes based on information on the following pipes/accessory equipment</p><p><span style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;">Flow rate (W) [kg/hr]<br>Delta Pressure (△P) [kgf/cm2]<br>Length (L) [m]<br>Pipe Diameter (d) [mm]<br>Density (ρ) [kg/m3]<br>Net Expansion Factor (Y)<br>Friction factor (f)</span></p><p style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;">Here, Net Expansion Factor (Y) and Friction factor (f) must be calculated using separate charts and programs.</p><p style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;">Calculation formulas based on CRANE BOOK</p><p><span style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><b><span style="color: rgb(128, 1, 128);">Kpipe = f * l / (d / 1000)</span></b><br><b><span style="color: rgb(128, 1, 128);">K = Kpipe + Kfitting</span></b><br><b style="color: rgb(128, 1, 128);"><br>compressible fluid</b><br><b><span style="color: rgb(128, 1, 128);">△P = (K * W^2) / (1.2646^2 * </span></b><span style="color: rgb(128, 1, 128);"><b>0.981 * </b><b>d^4 * </b>ρ * <b>Y^2)</b></span><br><b style="color: rgb(128, 1, 128);">w = 1.2646 * d^2 * √(△P * 0.981 * </b>ρ<b style="color: rgb(128, 1, 128);"> / K) * Y</b><br><b style="color: rgb(128, 1, 128);"><br>liquid fluid</b><br><b><span style="color: rgb(128, 1, 128);">△P = (K * W^2) / (1.2646^2 * </span></b><span style="color: rgb(128, 1, 128);"><b>0.981 * </b><b>d^4 * </b>ρ<b>)<br></b></span><b style="color: rgb(128, 1, 128);">w = 1.2646 * d^2 * √(△P * 0.981 * </b>ρ<b style="color: rgb(128, 1, 128);"> / K)</b></span></p><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><br></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">import math</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">def compressibledp(W, l, d, r, Y, f, Kf):</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> Kp = f * l / (d / 1000)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> K = Kp + Kf</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> dp = (K * pow(W, 2)) / (pow(1.2646, 2) * 0.981 * pow(d, 4) * r * pow(Y, 2))</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> return dp</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">W = 100 # Flow rate (W, kg/hr)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">l = 100 # Length (L, m)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">d = 50 # Pipe Diameter (d, mm)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">r = 1.24 # Density (ρ, kg/m3)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">Y = 1.0 # Net Expansion Factor (Y)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">f = 0.005 # Friction factor (f)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">Kf = 500 # Resistance coefficient of fittings</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">dp = compressibledp(W, l, d, r, Y, f, Kf)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">print("delta pressure of pipe = ", dp, "kgf/cm2")</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">def compressibleflow(dp, l, d, r, Y, f, Kf):</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> </span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> Kp = f * l / (d / 1000)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> K = Kp + Kf</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> W = 1.2646 * pow(d, 2) * math.sqrt(dp * 0.981 * r / K) * Y</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"> return W</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">dp = 0.42 # Delta Pressure (△P ,kgf/cm2)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">m = 100 # Length (L, m)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">d = 50 # Pipe Diameter (d, mm)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">r = 1.24 # Density (ρ, kg/m3)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">Y = 1 # Net Expansion Factor (Y)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">f = 0.005 # Friction factor (f)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">Kf = 500 # Resistance coefficient of fittings</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">flow = compressibleflow(dp, l, d, r, Y, f, Kf)</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);">print("mass flow of pipe = ", flow, "kg/hr")</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><br></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><div>When run the code, you will receive the following results.</div><div><br></div><span style="color: rgb(43, 0, 254);">delta pressure of pipe = 0.42 kgf/cm2<br>mass flow of pipe = 100 kg/hr</span></div><div style="color: rgb(68, 68, 68); font-family: Consolas; font-size: 15px;"><span style="color: rgb(43, 0, 254);"><br></span></div>