<jupyter_start><jupyter_text>Wave: Linear Wave Theory<jupyter_code>import numpy as np
from ipywidgets import interact, FloatSlider, IntSlider, FloatText
import ipywidgets as widgets<jupyter_output><empty_output><jupyter_text>Input : Wave Height(m) :Wave Period(s) :Water Depth(m) :Relative depth is defined as 'Deep' when the water depth $Z>0.5L$, 'Intermediate' when $0.05L0.78$ (where HH is wave height) or in deeper water when $H/L>0.17$<jupyter_code>Wave_H = 2
Wave_T = 12
Depth = 80
#define constants
Gravity = 9.8
rho = 1026
L0 = Gravity * Wave_T ** 2 / 2 /np.pi
print("Deep water wavelenght L0 = %.2f m" %L0)
Wave_L = L0 * (np.tanh((np.pi * 2 * np.sqrt(Depth / Gravity) / Wave_T) **(3/2))) ** (2/3)
print("Water wavelenght L = %.2f m" %Wave_L)
k = np.pi * 2 /Wave_L
C = np.sqrt(Gravity / k * np.tanh(k * Depth))
n = 1/2 * ( 1 + 2 * k * Depth/np.sinh(2 * k * Depth))
Cg = n * C
print("Group Celerity Cg = %.2f m/s" %Cg)
E = 1 / 8 * rho * Gravity * Wave_H ** 2
print("Wave energy density (E) = %.2f J/m^2" %E)
P = E * Cg
print("Wave energy flux P = %.2f W/m" %P)
Umax = np.pi * Wave_H / Wave_T * np.exp(k * Depth)
Ub = Wave_H * np.pi / Wave_T / np.sinh(k * (Depth))
print("Maximum horizontal surface orbital velocity Umax = %.2f m/s" %Umax)
print("Maximum horizontal bed orbital velocity Ub = %.4f m/s" %Ub)
from ipywidgets import interact, FloatSlider, IntSlider, FloatText
import ipywidgets as widgets
def multiply(a, b):
 
    return round(a * b , 2)
a_slider = FloatSlider(min = 0, max =20, step = 0.1, value = 10)
b_slider = FloatSlider(min = 0, max =20, step = 0.1, value = 10)
a_box = FloatText()
b_box = FloatText()
alink = widgets.jslink((a_slider, 'value'),(a_box,'value'))
blink = widgets.jslink((b_slider, 'value'),(b_box,'value'))
display(a_slider,a_box)
display(b_slider,b_box)
interact(multiply, a = a_slider, b = b_slider)


Wave_H_slider = FloatSlider(min = 0, max =20, step = 0.1, value = 2)
Wave_T_slider= FloatSlider(min = 0, max =20, step = 0.1, value = 12)
Depth_slider = FloatSlider(min = 0, max =20, step = 0.1, value = 8)

Wave_H_box = FloatText()
Wave_T_box = FloatText()
Depth_box = FloatText()

display(Wave_H_slider,Wave_H_box,)
display(Wave_T_slider,Wave_T_box)
display(Depth_slider,Depth_box)

Wave_H_link = widgets.jslink((Wave_H_slider, 'value'),(Wave_H_box,'value'))
Wave_T_link = widgets.jslink((Wave_T_slider, 'value'),(Wave_T_box,'value'))
Depth_link = widgets.jslink((Depth_slider, 'value'),(Depth_box,'value'))
interact(Wave_H = Wave_H_slider, Wave_T = Wave_T_slider, Depth = Depth_slider)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15645727662895045, 'fraction_numerical': 0.03277409285992977, 'mean_word_length': 4.9489559164733175, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '348202', 'license': 'MIT', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1041, 'n_words': 272, 'path': 'CoastalCalc.ipynb', 'repo_name': 'famiuer/CoastalCalc', 'size': '2563'}