Crane differential pressure or flow rate for compressible fluid (Imperial)

This Python code calculates differential pressure or flow rate according to given pipe & fitting information for compressible fluid.

Formula of DP and flow rate


Calculate differential pressure in pipes based on information on the following pipes/accessory equipment

w    : Flow rate [lb/hr]
△P  : Delta Pressure [psia]
L    : Length [ft]
D    : Pipe Diameter [ft]
d    : Pipe Diameter [in]
ρ    : Density [lb/ft3]
f    : Friction factor

Here, Friction factor (f) must be calculated using separate charts and programs.

Calculation formulas based on CRANE BOOK

Kpipe = f * l/D
K     = Kpipe + Kfitting

compressible fluid
△P = (K * W^2) / (1891^2 * d^4 * ρ  * Y^2)
w = 1891 * d^2 * √(△P * ρ / K) * Y


liquid fluid
△P = (K * W^2) / (1891^2 * d^4 * ρ)
w = 1891 * d^2 * √(△P * ρ / K)

Python code


Run Python code below : https://www.mycompiler.io/view/6fwILhy1i1P

import math

def compressibledp(W, l, d, r, Y, f, Kf):

    Kp = f*l/D
    K = Kp + Kf
    dp = (K*pow(W, 2))/(pow(1891, 2)*pow(d, 4)*r*pow(Y, 2))
    return dp

W = 220      # Flow rate (W, lb/hr)
l = 30.48    # Length (L, ft)
D = 0.01524  # Pipe Diameter (D, ft)
d = 1.969    # Pipe Diameter (d, in)
r = 0.0774   # 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, "psia")

def compressibleflow(dp, l, d, r, Y, f, Kf):
    
    Kp = f*l/D
    K = Kp + Kf
    W = 1891 * pow(d, 2) * math.sqrt(dp * r / K) * Y
    return W

dp = 5.933   # Delta Pressure (△P, psia)
m = 30.48    # Length (L, ft)
D = 0.01524  # Pipe Diameter (d, ft)
d = 1.969    # Pipe Diameter (d, in)
r = 0.0774   # Density (ρ, lb/ft3)
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, "lb/hr")

When run the code, you will receive the following results.

delta pressure of pipe =  5.933 psia
mass flow of pipe =  220 lb/hr

No comments:

Post a Comment