242 Computational Modelling in Hydraulic and Coastal Engineering
h(1)=H;
for i=2:nx
h(i)=H-S*(i-1)*Dx;
if h(i)hb
nb=i;
break
end
end
% New depths inside the breaker zone increased by setup;
for i=nb:nx
h(i)=h(i)+set*(i-nb)/(nx-nb);
end
h(nx+1)=2*h(nx)-h(nx-1);
% Main program;
for k=1:nt
hb=h(nb);
% New wave breaking height at nb after the increase of
water depth hb;
ab=hb*G;
% New wave distribution inside breaker zone;
for i=1:nx
if i
a(i)=ao;
else
a(i)=ab-(ab-set*G)*(i-nb)/(nx-nb);
end
end
a(nx+1)=2*a(nx)-a(nx-1);
% Estimation of wave characteristics along domain;
temp=0;
for i=1:nx
l(i)=lo;
while(abs(l(i)-temp)>0.1)
temp=l(i);
arg=2*pi*h(i)/l(i);
l(i)=lo*(exp(arg)-exp(-arg))/
(exp(arg)+exp(-arg));
test=abs(l(i)-temp);
end
end
l(nx+1)=2*l(nx)-l(nx);
% Orbital and residual velocities; Shear stresses;
Sediment discharges;
for i=1:nx
hmm=(h(i)+h(i+1))/2;
amm=(a(i)+a(i+1))/2;
lmm=(l(i)+l(i+1))/2;
if i>nb
arg=2*pi*hmm/lmm;
uc(i)=-2.5*amm^2/T/(0.8*hmm);
h(1)=H;
for i=2:nx
h(i)=H-S*(i-1)*Dx;
if h(i)
nb=i;
break
end
end
% New depths inside the breaker zone increased by setup;
for i=nb:nx
h(i)=h(i)+set*(i-nb)/(nx-nb);
end
h(nx+1)=2*h(nx)-h(nx-1);
% Main program;
for k=1:nt
hb=h(nb);
% New wave breaking height at nb after the increase of
water depth hb;
ab=hb*G;
% New wave distribution inside breaker zone;
for i=1:nx
if i
else
a(i)=ab-(ab-set*G)*(i-nb)/(nx-nb);
end
end
a(nx+1)=2*a(nx)-a(nx-1);
% Estimation of wave characteristics along domain;
temp=0;
for i=1:nx
l(i)=lo;
while(abs(l(i)-temp)>0.1)
temp=l(i);
arg=2*pi*h(i)/l(i);
l(i)=lo*(exp(arg)-exp(-arg))/
(exp(arg)+exp(-arg));
test=abs(l(i)-temp);
end
end
l(nx+1)=2*l(nx)-l(nx);
% Orbital and residual velocities; Shear stresses;
Sediment discharges;
for i=1:nx
hmm=(h(i)+h(i+1))/2;
amm=(a(i)+a(i+1))/2;
lmm=(l(i)+l(i+1))/2;
if i>nb
arg=2*pi*hmm/lmm;
uc(i)=-2.5*amm^2/T/(0.8*hmm);
