Longwave dispersion relationship: $\omega = k\sqrt{gh}$



In [ ]:

import numpy as np

L = 10500  # Lambda [m].
H = 500.  # Water column depth [m].
N0 = 10  # Wave amplitude [m].
K = 2 * np.pi / L  # Wavenumber [m^{-1}].
g = 9.8  # Aceleration of gravity [m s^{-2}]
w = np.sqrt(g * K ** 2 * H)  # Longwave dispersion [rad s^{-1}].
T = 2 * np.pi / w  # Period [s].

t = np.arange(0, 2 * T)  # Two waves.
x = 0.0

z000, z100, z200, z300, z400, z500 = 0, -100, -200, -300, -400, -500




In [ ]:

HoL = H/L
if HoL < 1./20:
print("H/L = %s, Longwave!" % HoL)
else:
print("H/L = %s, This is not a longwave :(" % HoL)



The code below solve the following equations (Check them out in the course notes!):

Free surface displacement: $\eta = N_o\cos({kx - \omega t})$

x displacement: $\chi = -\frac{\eta_o}{kH}\sin({kx - \omega t})$

z displacement: $\zeta = \frac{\eta_o}{H}(z + H)\cos({kx - \omega t})$



In [ ]:

X = -(N0 / K * H) * np.sin((K * x) - (w * t))

N = N0 * np.cos((K * x) - (w * t))

Z000 = ((N0 / H) * (z000 + H)) * np.cos((K * x) - (w * t)) + z000
Z100 = ((N0 / H) * (z100 + H)) * np.cos((K * x) - (w * t)) + z100
Z200 = ((N0 / H) * (z200 + H)) * np.cos((K * x) - (w * t)) + z200
Z300 = ((N0 / H) * (z300 + H)) * np.cos((K * x) - (w * t)) + z300
Z400 = ((N0 / H) * (z400 + H)) * np.cos((K * x) - (w * t)) + z400
Z500 = ((N0 / H) * (z500 + H)) * np.cos((K * x) - (w * t)) + z500




In [ ]:

import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(4, 4))
ax.plot(X, Z000, 'k',
X, Z100, 'k',
X, Z200, 'k',
X, Z300, 'k',
X, Z400, 'k',
X, Z500, 'k')
ax.set_title(u'Ondas de águas rasas (ou ondas longas)')
ax.set_xlabel(u'Distância [m]')

x = np.linspace(-X.max()*6, X.max()*6, N.size)
ax.plot(x, N, 'k:')
ax.set_ylim(-520, 90)
ax.grid(True)
_ = ax.annotate(r'$\eta$', xy=(x[-20], N[-20]),  xycoords='data',
xytext=(20, 20), textcoords='offset points',