Jupyter Notebook
Exercise 10, Streamplot of flow around a cylinder
The radial and tangential components of the velocity vector for inviscid fluid flow around a cylinder are given by
$egin{split}v_r &= U(1 - R^2/r^2)cos heta quad r ge R \ v_ heta &= -U(1 + R^2/r^2)sin heta quad r ge R end{split}$
and is zero otherwise. The x and y components of the velocity vector may be obtained from the radial and tangential components as
$egin{split}v_x &= v_r cos heta - v_ heta sin heta \ v_y &= v_r sin heta + v_ heta cos heta end{split}$
Write a function that returns the x and y components of the velocity vector for fluid flow around a cylinder with R=0.5 and U=2. Test your function by making sure that at r=2,3 the velocity vector is 2.1331, -0.3195. Compute the x and y components of the velocity vector. Vectorization won't help here, as your function returns two values, so you need a double loop on a grid of 50 by 50 points where x varies from -4 to +4 and y varies from -3 to 3. Create a stream plot using the cool function plt.streamplot, which takes four arguments: x, y, vx,