Skip to content

Instantly share code, notes, and snippets.

@bradlipovsky
Created August 2, 2022 20:31
Show Gist options
  • Save bradlipovsky/c1e2aea7101b9484e470431f6f730360 to your computer and use it in GitHub Desktop.
Save bradlipovsky/c1e2aea7101b9484e470431f6f730360 to your computer and use it in GitHub Desktop.
Plots of the dispersion relation for SGWs with added physics
import numpy as np
import matplotlib.pyplot as plt
cs=1500
g=9.8
h=100
kappa = np.linspace(-0.08,0.08,100)
fig,ax=plt.subplots(1,4,figsize=(15,4))
plt.subplot(141)
for ky in (0,0.1):
kx = kappa
new_kappa = np.sqrt(kx**2 + ky**2)
omega = np.sqrt(g*new_kappa * np.tanh(new_kappa*h))
plt.plot(kx,omega)
plt.title('Varying incidence angle')
plt.subplot(142)
kappa = np.linspace(-1000,1000,100)
plt.plot(kappa,np.sqrt((g*kappa + 0.074/1000 * kappa**3)*np.tanh(kappa*h)))
plt.plot(kappa,np.sqrt((g*kappa)*np.tanh(kappa*h)))
plt.title('Capilary Effect')
plt.subplot(143)
kappa = np.linspace(-0.08,0.08,100)
plt.plot(kappa,np.sqrt(g*kappa*np.tanh(kappa*h)) + 1.0*kappa)
plt.plot(kappa,np.sqrt((g*kappa)*np.tanh(kappa*h)))
plt.title('Background current (1 m/s)')
plt.subplot(144)
omega = np.linspace(0,200,1000)
for n in (1,2):
kagw = omega * np.sqrt(1/cs**2 - ((n - 1/2)*np.pi*omega/ (omega**2*h - g) )**2 +0j)
k = np.real(kagw)
plt.plot(k[k>0],omega[k>0],c=f'C{n-1}')
plt.plot(-k[k>0],omega[k>0],c=f'C{n-1}')
plt.title('Acoustic Modes')
for axx in ax:
axx.set_ylabel('Frequency (Hz)')
axx.set_xlabel('Wavenumber (1/m)')
plt.tight_layout()
plt.show()
@bradlipovsky
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment