-
Notifications
You must be signed in to change notification settings - Fork 0
/
airy.py
57 lines (42 loc) · 1.18 KB
/
airy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Implement functions for linear wave theory, migrated from Matlab codes in
# Dropbox/matlab/+airy
from __future__ import division
import numpy as np
import wavenumber as wn
def celerity(omega, d):
"""
c = celerity(omega, d)
"""
k = wn.qkfs(omega, d)
c = omega / k
return c
def energydens(a, rho=1025, g=9.81):
"""
E = airy.energydens(rho, g, a)
return energy density following Airy wave theory
rho: water density (1025 kg/m^3 if argument is empty)
g: gravity (9.81 m/s^2 if argument is empty)
a: wave amplitude
"""
return 0.5 * rho * g * a**2
def groupvel(omega, d):
"""
# cg = airy.groupvel(omega, d)
# return group velocity following Airy wave theory
# omega: 2*pi/T
# d: still water depth
"""
k = wn.qkfs(omega, d)
# From Paul & Amos 2011 eq 9 (and elsewhere, obviously)
# also repeated in Lowe et al 2005 eq 5
return 0.5 * (1 + 2 * k * d / np.sinh(2 * k * d)) * omega / k
def uorb(H, omega, d):
"""
compute bottom orbital velocity
H: wave height
omega: 2*pi/T
d: still water depth
returns ub
"""
k = wn.qkfs(omega, d)
return omega * H / 2 / np.sinh(k * d)