Computing the main parameters of a Water wave, using the small amplitude wave theory.
d = water deep (m)
H = wave height (m)
T = wave period (s)
z = depth below the SWL (m)
anitime = time animation (s)
k = wave number
sigma = Frecuency
L = wave length
C = wave phase velocity
Cg = wave group velocity
Energy = energy density
Energy_flux = energy flux
Sxx = Radiation stress (onshore)
Syy = Radiation stress (longshore)
steepness = wave steepness
ursell = Ursell parameter
eta = wave profile
u, w = water particle velocity
ax, az = water particle accelerations
tseta, epsilon = water particle displacements
p = subsurface pressure
[k,sigma,L,C,Cg,Energy,Energy_flux,Sxx,Syy,ursell,steepness,eta,u,w,ax,az,tseta,epsilon,p] = SmallAmplitude(50,3,10,5,5);
CERC. (1984). Shore Protection Manual. CERC. USA.
Darlymple, R.G. and Dean R.A. (1999). Water Wave Mechanics
for Engineers and Scientist. World Scientific. Singapure
Le Mehuate, Bernard. (1976). An introduction to hidrodynamics
and water waves. Springer-Verlag. USA.
Sarawagi, T. (1995). Coastal Engineering-Waves, Beaches,
Wave-Structure Interactions. Developments in
Geotechnical Engineering, 78. Elservier. Netherlands.
Programming: Gabriel Ruiz Martinez.
Gar (2020). Small Amplitude Wave Theory (https://www.mathworks.com/matlabcentral/fileexchange/18080-small-amplitude-wave-theory), MATLAB Central File Exchange. Retrieved .
Downgrading my rating after finding more serious bugs in the equations for fluid velocity (U,W) which should not be a function of g according to:
More than happy to up my rating again if there is a defence of the system used
At this point it is more rigorous to simply re-write the function rather than comb through line by line looking for more bugs.
re. my previous comment - apologies, the sigma/omega definition is clear and consistent with the intrinsic angular frequency sigma.
The submission is highly unrefined in terms of coding practice. For example, variables (such as z and t) are reassigned during the code, making it very difficult to read.
It is possible this leads to a bug since the values of t are defined in line 82 then redefined as an integer counter in line 98 and elsewhere.
There is a bug in the axial fluid velocity term:
is expressed as
cos(kx - w-t)
on lines 108, 178 248
... and several similar mistakes are made elsewhere.
Some strange definitions are made - for example 'omega' is labelled 'sigma'.
That said, if you're wanting an implementation of the airy wave functions as defined in the table on this page:
It is much easier to alter this function than start from scratch, especially if not familiar with wave theory. So thanks for getting me some of the way there!