Exercise 10, Streamplot of flow around a cylinder
The radial and tangential components of the velocity vector \(\vec{v} = (v_r, v_\theta)\) for inviscid fluid flow around a cylinder are
given by
$\begin{split} v_r &= U(1 - R^2/r^2)\cos(\theta) \qquad r \ge R\\ v_\theta &= -U(1 + R^2/r^2)\sin(\theta) \qquad 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
$\begin{split} v_x &= v_r\cos(\theta) - v_\theta\sin(\theta) \\ v_y &= v_r\sin(\theta) + v_\theta\cos(\theta) \end{split}$
Write a function that returns the x and y components of the velocity vector for fluid flow around a cylinder with \(R = 1.5\)
and \(U = 2\). Test your function by making sure that at \((x, y) = (2, 3)\) the velocity vector is \((v_x, v_y) = \)
\((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,
vy