This Python code calculates differential pressure or flow rate according to given pipe & fitting information for compressible fluid.
Calculate differential pressure in pipes based on information on the following pipes/accessory equipment
Flow rate (W) [kg/hr]Delta Pressure (△P) [kgf/cm2]
Length (L) [m]
Pipe Diameter (d) [mm]
Density (ρ) [kg/m3]
Net Expansion Factor (Y)
Friction factor (f)
Here, Net Expansion Factor (Y) and Friction factor (f) must be calculated using separate charts and programs.
Calculation formulas based on CRANE BOOK
Kpipe = f * l/(d/1000)K = Kpipe + Kfitting
compressible fluid
△P = (K * W^2) / (1.2646^2 * 0.981 * d^4 * ρ * Y^2)
w = 1.2646 * d^2 * √(△P * 0.981 * ρ / K) * Y
liquid fluid
△P = (K * W^2) / (1.2646^2 * 0.981 * d^4 * ρ)
w = 1.2646 * d^2 * √(△P * 0.981 * ρ / K)
Run Python code below : https://www.mycompiler.io/view/2HpJLHzhEeQ
import math
def compressibledp(W, l, d, r, Y, f, Kf):
Kp = f*l/(d/1000)
K = Kp + Kf
dp = (K*pow(W, 2))/(pow(1.2646, 2)*0.981*pow(d, 4)*r*pow(Y, 2))
return dp
W = 100 # Flow rate (W, kg/hr)
l = 100 # Length (L, m)
d = 50 # Pipe Diameter (d, mm)
r = 1.24 # Density (ρ, kg/m3)
Y = 1.0 # Net Expansion Factor (Y)
f = 0.005 # Friction factor (f)
Kf = 500 # Resistance coefficient of fittings
dp = compressibledp(W, l, d, r, Y, f, Kf)
print("delta pressure of pipe = ", dp, "kgf/cm2")
def compressibleflow(dp, l, d, r, Y, f, Kf):
Kp = f*l/(d/1000)
K = Kp + Kf
W = 1.2646 * pow(d, 2) * math.sqrt(dp * 0.981 * r / K) * Y
return W
dp = 0.42 # Delta Pressure (△P ,kgf/cm2)
m = 100 # Length (L, m)
d = 50 # Pipe Diameter (d, mm)
r = 1.24 # Density (ρ, kg/m3)
Y = 1 # Net Expansion Factor (Y)
f = 0.005 # Friction factor (f)
Kf = 500 # Resistance coefficient of fittings
flow = compressibleflow(dp, l, d, r, Y, f, Kf)
print("mass flow of pipe = ", flow, "kg/hr")
When run the code, you will receive the following results.
mass flow of pipe = 100 kg/hr
No comments:
Post a Comment