Problem 1: Expanded Knowledge

Example python code for plotting vector fields

Python Code 1: Velocity field (quiver)
import numpy as np
import matplotlib.pyplot as plt

x0 = -1
x1 = 1
y0 = -1
y1 = 1
Nx = 21
Ny = 21
S = 104
A = 14

x = np.linspace(x0, x1, Nx)
y = np.linspace(y0, y1, Ny)
X, Y = np.meshgrid(x, y)
u = A*Y
v = -S*X
# even when the v or u field are zero, multiply with the mesh grid to achieve the correct dimensions

fig, ax = plt.subplots(figsize=(10, 7), tight_layout=True)
ax.quiver(X, Y, u, v)
ax.set_title('Velocity field', fontsize=20)
ax.set_xlabel('xs', fontsize=20)
ax.set_ylabel('ys', fontsize=20)
ax.set_xticklabels(ax.get_xticks(), fontsize=18)
ax.set_yticklabels(ax.get_yticks(), fontsize=18)
Python Code 2: Velocity streamlines (streamplot)
fig, ax = plt.subplots(figsize=(10, 7), tight_layout=True)
plt.streamplot(x, y, u, v)
ax.set_title('Velocity streamlines', fontsize=20)
ax.set_xlabel('xs', fontsize=20)
ax.set_ylabel('ys', fontsize=20)
ax.set_xticklabels(ax.get_xticks(), fontsize=18)
ax.set_yticklabels(ax.get_yticks(), fontsize=18)