Surface gravity water waves 159
% Left and right boundary conditions: Reflection or free
radiation;
for j=1:ny
if h(1,j)>0.1
% Reflection;
% zn(1,j)=zn(2,j);
% Free radiation;
zn(1,j)=z(1,j)+Dt/Dd*sqrt(g*h(1,j))*(z(2,j)-z
(1,j));
end
if h(nx,j)> 0.1
% zn(nx,j)=zn(nx-1,j);
zn(nx,j)=z(nx,j)+Dt/Dd*sqrt(g*h(nx,j))*(z(nx1,j)-z( nx,j));
end
end
% Updating the z wave values;
for j=1:ny
for i=1:nx
zo(i,j)=z(i,j);
z(i,j)=zn(i,j);
end
end
% Free surface time series at the middle of the field;
zmid(k)=z(nx/2,ny/2);
if k>nt/2
% Estimation of flow velocity field and radiation
stresses;
for j=2:ny-1
for i=2:nx-1
if h(i,j)>0.1 && h(i-1,j)>0.1 && h(i+1,j)>0.1
u(i,j)=u(i,j)-Dt/Dd*g*(z(i+1,j)-z
(i-1,j))/2;
end
end
end
for j=2:ny-1
for i=2:nx-1
if h(i,j)>0.1 && h(i,j-1)>0.1 && h(i,j+1)>0.1
v(i,j)=v(i,j)-Dt/Dd*g*(z(i,j+1)-z
(i,j-1))/2;
end
end
end
for j=2:ny-1
for i=2:nx-1
if h(i,j)>0.1
Précédent

- 172/302

Suivant