Consider a pipe of diameter $D = 0.01$ m and Length $L = 1.0$ m represented in the figure underneath. At the in- and outlet, the pipe cross-section converges, respectively diverges smoothly. We will therefore assume developed velocity profile along the entire pipe. Water ($\mu = 0.001$ Pas, $\rho = 1000$ kg/m$^3$) is feed through the pipe from a big reservoir, maintaining the hydrostatic pressure at the entrance of the tube at a constant level approximately. Downstream, a pump is connected ot the pipe, allowing to set a specific flow rate $Q$


The critical Reynolds number regarding the transition of laminar to turbulent pipe flow is $Re_{D, cr} = 2300$. Therefore, we consider the flow associated to the flow and high flow rate to be laminar and turbulent, respectively.

Next we apply the \textit{Bernoulli} equation with added loss term $\Delta p$ between a point of the surface of the reservoir (point 0) and point 2 at the end of the pipe

$$p_0 + \rho \frac{u_0^2}{2}+ \rho g z_0 = p_2 + \rho \frac{u_2^2}{2} + \rho g z_2$$

The pressure at the surface is the atmospheric pressure, $p_0 = p_{atm} = 101325$ Pa. Due to the big surface area the velocity $u_0$ is very small and we therefore neglect the hydrodynamic pressure at this point. Solving for the pressure in point 2 yields:

$$p_2 = p_{atm} - \rho \frac{u_2^2}{2} + \rho g h - \Delta p$$

where we used $h = z_0 - z_2$. We still have to determine the term $\Delta p$, which represents losses due to viscous shear forces. Having a smooth entrance to the pipe we assume that only losses within the pipe contribute to $\Delta p$. We can apply a general expression of the form

$$\Delta p =\rho \lambda \frac{L}{D}\frac{\bar{u}^2}{2}$$

to determine the pressure drop of a flow with constant mean velocity $u$ in a pipe with diameter $D$ and length $L$ for both laminar and turbulent flow. The friction coefficient $\lambda$ depends either only on the Reynolds number $Re_D$ (laminar flow), or on both the Reynolds number $Re_D$ and the surface roughness $k_S$ (turbulent flow, smooth pipe), or only on $k_S$ (turbulent flow, rough pipe).


Calculate the pressure $p_2$ for the following cases

  1. $Q = 0.01$ l/s, smooth pipe
  2. $Q = 0.5$ l/s, smooth pipe
  3. $Q = 0.5$ l/s, pipe roughness: $k_{\text{S}}/D = 2e10^{-3}$
  4. $Q = 0.5$ l/s, pipe roughness: $k_{\text{S}}/D = 2e10^{-2}$

Here are the given answers for the different flows values:


Here is the code (in Python3) which works for the first question ($Q = 0.01$ l/s)

# Python 3

import numpy as np
Q = 0.01 # in l/s
Q = Q *0.001 # conversion in m^3/s
D = 0.01 #meter
L = 1 #meter
h = 4
g = 9.81 #m/s^2
rho = 1000 #kg/m^3
mu = 0.001
patm = 101325 #Pa
p1 = patm

Area = np.pi*((D/2)**2) #m^2
u_mean = Q/Area #m/s

ReD = rho * u_mean * D / mu

lambda_coef = 64/ReD
delta_p = lambda_coef * rho * L * ((u_mean)**2) / (D*2)
p2 = patm - (rho*((u_mean)**2)/2) + rho*g*h - delta_p
print("velocity: " + str(round(u_mean, 3)) + " m/s")
print("ReD: " + str(round(ReD, 3)))
print("lambda_coef: " + str(round(lambda_coef, 3)))
print("p2: " + str(round(p2, 3)) + " Pa")
print("delta_p: " + str(round(delta_p, 3)) + " Pa")

My Question

How do I have to change my code to get the correct answer 2, 3 and 4? shall I use the info about $\lambda$? Or shall I read it from a Moody diagram?

Moody diagram

  • $\begingroup$ Choosing a value of "1" for one of your variables is probably a poor choice, as the special properties of "1" tend to hide errors. But, to answer your question, why don't you send correct values into your function via a parameter list in order to calculate answers 2-4? $\endgroup$ – David White May 4 '19 at 19:30
  • $\begingroup$ Thank you for your comment @DavidWhite. First for the value "1": I copied the exercice given to me but I'll take note that 1 tends to hide errors. Second: can you send me an example of what you mean? you want to do a list of value Q (e.g. Q = [0.01, 0.5]) and run a for loop on all of them. The main problem is that the $\lambda$ is calculated differently according to roughness and that's the main problem I'm facing: I have trouble to compute the value of $\lambda$ according to rougness as presented in the table $\endgroup$ – ecjb May 4 '19 at 19:40
  • $\begingroup$ Step 1 is to calculate the Reynolds number. This will determine which equation to use. What Reynolds number values did you get for cases 2, 3, and 4? $\endgroup$ – Chet Miller May 4 '19 at 20:47
  • $\begingroup$ @ChetMiller, by replacing Q = 0.01 by Q = 0.5 you get Reynolds number of 63662 (as stated in the answer). But my question is how to compute $\lambda$. Do you have an idea? $\endgroup$ – ecjb May 4 '19 at 20:49
  • $\begingroup$ Next step is to calculate $\frac{uk_s}{\nu}=\frac{uD}{\nu}\frac{k_s}{D}=Re\frac{k_s}{D}$ $\endgroup$ – Chet Miller May 4 '19 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.