ONE_PHASE_DP
Calculates single-phase pressure drop in a pipe from mass flow rate, fluid properties, pipe geometry, and wall roughness using the Darcy-Weisbach framework. The pressure-drop calculation delegates friction-factor evaluation to one of the supported straight-pipe correlations, allowing you to compare methods while keeping the rest of the hydraulic model unchanged.
In Darcy-Weisbach form, the frictional pressure loss scales with the pipe length, diameter, density, velocity, and Darcy friction factor:
\Delta P \propto f_d\frac{L}{D}\frac{\rho v^2}{2}
This wrapper packages the full property and geometry conversion so the result can be obtained directly from mass flow rate and physical inputs.
Excel Usage
=ONE_PHASE_DP(m, rho, mu, D, roughness, L, dp_method)
m(float, required): Mass flow rate of fluid, [kg/s]rho(float, required): Density of fluid, [kg/m³]mu(float, required): Dynamic viscosity of fluid, [Pa·s]D(float, required): Pipe inner diameter, [m]roughness(float, optional, default: 0): Pipe wall roughness, [m]L(float, optional, default: 1): Pipe length, [m]dp_method(str, optional, default: “Clamond”): Friction factor calculation method to use
Returns (float): Frictional single-phase pressure drop in a straight pipe [Pa]
Example 1: Laminar flow pressure drop
Inputs:
| m | rho | mu | D | roughness | L |
|---|---|---|---|---|---|
| 0.01 | 1000 | 0.001 | 0.01 | 0 | 1 |
Excel formula:
=ONE_PHASE_DP(0.01, 1000, 0.001, 0.01, 0, 1)
Expected output:
40.7437
Example 2: Turbulent flow in smooth pipe
Inputs:
| m | rho | mu | D | roughness | L |
|---|---|---|---|---|---|
| 10 | 1000 | 0.00001 | 0.1 | 0 | 1 |
Excel formula:
=ONE_PHASE_DP(10, 1000, 0.00001, 0.1, 0, 1)
Expected output:
63.4345
Example 3: Turbulent flow in rough pipe
Inputs:
| m | rho | mu | D | roughness | L |
|---|---|---|---|---|---|
| 10 | 1000 | 0.00001 | 0.1 | 0.0001 | 10 |
Excel formula:
=ONE_PHASE_DP(10, 1000, 0.00001, 0.1, 0.0001, 10)
Expected output:
1593.6
Example 4: Turbulent flow using Haaland method
Inputs:
| m | rho | mu | D | roughness | L | dp_method |
|---|---|---|---|---|---|---|
| 5 | 800 | 0.001 | 0.05 | 0.00005 | 5 | Haaland |
Excel formula:
=ONE_PHASE_DP(5, 800, 0.001, 0.05, 0.00005, 5, "Haaland")
Expected output:
8726.55
Python Code
Show Code
from fluids.friction import one_phase_dP as fluids_one_phase_dP
def one_phase_dp(m, rho, mu, D, roughness=0, L=1, dp_method='Clamond'):
"""
Calculate single-phase pressure drop in a pipe using the Darcy-Weisbach equation.
See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.one_phase_dP
This example function is provided as-is without any representation of accuracy.
Args:
m (float): Mass flow rate of fluid, [kg/s]
rho (float): Density of fluid, [kg/m³]
mu (float): Dynamic viscosity of fluid, [Pa·s]
D (float): Pipe inner diameter, [m]
roughness (float, optional): Pipe wall roughness, [m] Default is 0.
L (float, optional): Pipe length, [m] Default is 1.
dp_method (str, optional): Friction factor calculation method to use Valid options: Clamond, Colebrook, Moody, Churchill_1977, Haaland, Swamee_Jain_1976. Default is 'Clamond'.
Returns:
float: Frictional single-phase pressure drop in a straight pipe [Pa]
"""
try:
m = float(m)
rho = float(rho)
mu = float(mu)
D = float(D)
roughness = float(roughness)
L = float(L)
dp_method = str(dp_method)
if D <= 0:
return "Error: Pipe diameter must be positive."
if rho <= 0:
return "Error: Density must be positive."
if mu <= 0:
return "Error: Viscosity must be positive."
if roughness < 0:
return "Error: Roughness must be non-negative."
if L <= 0:
return "Error: Pipe length must be positive."
if m == 0:
return 0.0
result = fluids_one_phase_dP(
m=m,
rho=rho,
mu=mu,
D=D,
roughness=roughness,
L=L,
Method=dp_method
)
if result != result:
return "Error: Result is NaN."
if result == float('inf') or result == float('-inf'):
return "Error: Result is not finite."
return float(result)
except Exception as e:
return f"Error: {str(e)}"