Example: Calculation of the Velocity Field from the Stream Function
Imports and Parameters
import numpy as np
import matplotlib.pyplot as plt
a = 0.50      # (m s)^-1
b = -2.0      # m/s
c = -1.5      # m/s
Computational Grid
# Computational grid
x = np.linspace(0, 5.5, 500)
y = np.linspace(-1, 5.5, 500)
X, Y = np.meshgrid(x, y)
Stream Function and Velocities
psi = a*X**3 + b*Y + c*X
u = b * np.ones_like(X)
v = -3*a*X**2 - c