Skip to content

Instantly share code, notes, and snippets.

@bradlipovsky
Created May 15, 2023 20:42
Show Gist options
  • Save bradlipovsky/a9f44395125bd085ee9ba26b0aaac762 to your computer and use it in GitHub Desktop.
Save bradlipovsky/a9f44395125bd085ee9ba26b0aaac762 to your computer and use it in GitHub Desktop.
Rayleigh waves forced by surface gravity waves
import numpy as np
pp = np.logspace(-5,-1,100)
zz = np.linspace(0,100,101)
q,z=np.meshgrid(pp,zz)
g = 9.8
H=1000
p = np.sqrt(g*q*np.tanh(g*H))
cs = 1000
cd = 2000
als = np.sqrt(1 + (p/q/cs)**2)
ald = np.sqrt(1 + (p/q/cd)**2)
# ux/uz
u1 = 1j*q*als/np.abs(q)*(1-als*ald) * (np.exp(-np.abs(q)*ald*z)-np.exp(-np.abs(q)*als*z))
import matplotlib.pyplot as plt
c=plt.pcolor(p,z,np.log10(np.abs(u1)))
plt.colorbar()
plt.ylabel('Depth (m)')
plt.xlabel('Frequency')
plt.xscale('log')
plt.ylim(100,0)
plt.title('u(z)/w(z=0)')
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