144 Computational Modelling in Hydraulic and Coastal Engineering
% Boundary condition at the coastline: Back radiated
wave;
zn(nx)=z(nx)+sqrt(g*h(nx))*Dt/Dx*(z(nx-1)-z(nx));
for i=1:nx
zo(i)=z(i);
z(i)=zn(i);
% Water depth below the water surface;
hwater(i)=z(i)+ho;
end
if k>nx2
% Estimation of the variance (h-rms)^2 (Wave height
root-mean-square);
for i=1:nx
zm(i)=zm(i)+z(i)^2/nx;
end
end
end
plot(1:nx,hwater,'b','Linewidth',1.5)
hold on
plot(1:nx,zm,'g','LineWidth',1.5)
plot(1:nx,bed,'m','LineWidth',2)
plot(1:nx,ev,'r','LineWidth',1.5)
xlabel('Number of spatial steps x 2 [m]')
ylabel('[m], [m^2], [m^2/s]')
text(143,6,'Wave height [m]')
text(20,9.2,'(h-rms)^2 [m^2]')
text(20,2.7,'Time = nt*Dt [s]')
text(115,9.5,'Wave-breaking location')
text(40,1.5,'Bed')
text(112,0.5,'Eddy viscosity [m^2/s]')
PROBLEM 6.1
Solve the same application by making the appropriate assumptions, modifying the computer code as needed and changing one or more of the input
data as suggested. In addition, you may need to change the total number of
time steps (code variable ‘nt’).
1. Change the bed friction to f bo = 0.1 s –1 and 0.01 s –1 , run the simulations and comment on the results.
2. Change the coefficient of the eddy viscosity to ec = 0, 0.2 and 1.0,
then run the simulations. Compare and explain the data obtained.
3. Change the wave period to 2 s, 4 s, 16 s and 32 s. Conduct the simulations, then compare and comment on the results.
4. Change the water depth (a) from 10 m at x = 0 to 5 m at x = 400 m,
and (b) from 10 m at x = 0 to 1 m at x = 400 m. Conduct the simulations, then compare and comment on the results.
% Boundary condition at the coastline: Back radiated
wave;
zn(nx)=z(nx)+sqrt(g*h(nx))*Dt/Dx*(z(nx-1)-z(nx));
for i=1:nx
zo(i)=z(i);
z(i)=zn(i);
% Water depth below the water surface;
hwater(i)=z(i)+ho;
end
if k>nx2
% Estimation of the variance (h-rms)^2 (Wave height
root-mean-square);
for i=1:nx
zm(i)=zm(i)+z(i)^2/nx;
end
end
end
plot(1:nx,hwater,'b','Linewidth',1.5)
hold on
plot(1:nx,zm,'g','LineWidth',1.5)
plot(1:nx,bed,'m','LineWidth',2)
plot(1:nx,ev,'r','LineWidth',1.5)
xlabel('Number of spatial steps x 2 [m]')
ylabel('[m], [m^2], [m^2/s]')
text(143,6,'Wave height [m]')
text(20,9.2,'(h-rms)^2 [m^2]')
text(20,2.7,'Time = nt*Dt [s]')
text(115,9.5,'Wave-breaking location')
text(40,1.5,'Bed')
text(112,0.5,'Eddy viscosity [m^2/s]')
PROBLEM 6.1
Solve the same application by making the appropriate assumptions, modifying the computer code as needed and changing one or more of the input
data as suggested. In addition, you may need to change the total number of
time steps (code variable ‘nt’).
1. Change the bed friction to f bo = 0.1 s –1 and 0.01 s –1 , run the simulations and comment on the results.
2. Change the coefficient of the eddy viscosity to ec = 0, 0.2 and 1.0,
then run the simulations. Compare and explain the data obtained.
3. Change the wave period to 2 s, 4 s, 16 s and 32 s. Conduct the simulations, then compare and comment on the results.
4. Change the water depth (a) from 10 m at x = 0 to 5 m at x = 400 m,
and (b) from 10 m at x = 0 to 1 m at x = 400 m. Conduct the simulations, then compare and comment on the results.
