test_adv 1.04 KB
clear all;
close all;

% Parameters
g  = 9.81;  % gravitational acceleration
dx = 5000;    % spatial resolution

Hs=1;
Tm=6;

% Waves
fmin  = 1/20;                   % minimum wave frequency
fmax  = 1/2.5;                  % maximum wave frequency
om1   = 2*pi*fmin;              % minimum wave radial frequency
om2   = 2*pi*fmax;              % maximum wave radial fequency
nw    = 61;                     % number of frequency bins
dw    = (om2-om1)/(nw-1);       % integral interval for wave radial frequencies
om    = om1+(0:nw-1)'*dw;       % wave radial frequencies vector
T     = 2*pi./om;               % wave periods vector

wlng  = g.*T.^2./(2.*pi);       % wavelength as a function only of wave period
cp    = sqrt(g.*wlng./(2.*pi)); % phase speed
cg    = cp./2;                  % group speed
cgmax = max(cg);                % group speed maximum
cg(:) = cgmax;                  % no dispersion = all group speed are the same (maximum)

dt     = dx/cgmax;       % time interval (temporal resolution)

Ei    = jonswap(Tm,Hs,om);      % JONSWAP spectrum