So I find the velocity profile for Pressure driven pipe flow and it looks like:

$$u = \frac{h^2}{2 \mu} \frac{\mathrm{d}P}{\mathrm{d}x}\left[1 - \left(\frac{y}{h}\right)^2\right]$$

Here, a fluid flows between two walls separated by a distance $h$. The pressure gradient $\mathrm{d}P/\mathrm{d}X$ drives the flow. The vertical coordinate axis is $y$.

How do I plot this as a velocity profile (VelocityPlot)? When I try do plot this with

μ = 0.02; Px = -0.5; h = 1.0;
VectorPlot[{(h^2/(2 μ)) Px (1 - (y/h)^2), 0}, {x, 0, 3}, {y, -3, 3}]

I get the following figure: enter image description here

However, the velocity profile is parabolic and should look like:

enter image description here

I apologize for the low quality vector plot from ansys but what went wrong with my VectorPlot[...] definition?

  • 2
    $\begingroup$ you are plotting outside the region of validity of your equation. Change {y,-h,h} instead of {y,-3,3} $\endgroup$
    – gpap
    Oct 14, 2013 at 14:59

1 Answer 1


Some comments:

  1. The formula for velocity profile should be $-\frac{dP}{dx}$ as flow travels down a pressure gradient not up.
  2. As gpap observes the region of interest is -h,h within the flow region. The "pipe" walls are separated by $2h$ (radius $h$).
  3. In the following I have retained same Px but corrected formula so to show flow from left to right. If intention was right to left flow then Px should be positive.
  4. I have coloured vector by magnitude of x direction #3&. I have just plotted points at zero to demonstrate parabolic flow profile.

μ = 0.02; Px = -0.5; h = 1.0;
f = (h^2/(2 μ)) (-Px) (1 - (y/h)^2)
VectorPlot[{f, 0}, {x, 0, 3}, {y, -h, h}, 
  VectorPoints -> Table[{0, j}, {j, -1, 1, 0.1}], 
  VectorScale -> {1, 0.2}, VectorColorFunction -> (Hue[#3*.6] &), 
  PlotRange -> {{0, 4}, {-1.1, 1.1}}, 
  Epilog -> 
    {{Red, Thick, Line[{{0, 1}, {4, 1}}]}, {Red, Thick, Line[{{0, -1}, {4, -1}}]}}]


enter image description here

  • $\begingroup$ what is the effect of {x, 0, 3} as the 2nd argument of VectorPlot since the vector {f,0} is only a function of y? I mean can we plot with any range of x? Thank you! $\endgroup$
    – user55777
    Sep 1, 2019 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.