88 Computational Modelling in Hydraulic and Coastal Engineering
% n = Manning's coefficient of friction;
% u = Flow velocity [m/s];
% b = Bottom width [m];
% m = Side slope;
% yn = Normal depth [m];
% yc = Critical depth [m};
% A = Cross sectioanl area {m^2];
% Rh = Hydraulic radius [m];
% Pw = Wetted perimeter [m];
% T = Surface width [m];
% L = Channel lenght [m];
% Y = Water depth [m];
% z= Bed elevation from the reference datum [m];
% h = Water elevation from the reference datum [m];
% Dx = Spatial step [m]:;
clc; clear all; close all;
% Input data;
g=9.81;
Q=25;
S=0.001;
n=0.025;
% Initial depth value to start the iterations;
yin=0.1;
% Trapezoidal, rectangular, triangular cross sections;
% Calculation of the normal depth;
for j=1:3
b=[5 5 0];
m=[1 0 1];
y(1)=yin;
i=1;
dyn(1)=0.1;
while (abs(dyn(i))>0.0001)
An(i)=b(j)*y(i)+m(j)*(y(i))^2;
Pwn(i)=b(j)+2*sqrt(m(j)^2+1)*y(i);
Rhn(i)=An(i)/(Pwn(i));
Tc(i)=b(j)+2*m(j)*y(i);
fn(i)=sqrt(S)/n*(An(i)*Rhn(i)^(2/3))-Q;
dfn(i)=sqrt(S)/n*((-4/3)*Rhn(i)^(5/3)*sqrt(1+m(j)^2)
+5/3*Rhn(i)^(2/3)*Tc(i));
y(i+1)=y(i)-fn(i)/dfn(i);
dyn(i+1)=-fn(i)/dfn(i);
i=i+1;
end
yn(j)=y(i);
iter_yn(j)=i;
end
% Calculation of the critical depth;
for j=1:3
yc(1)=yin;
k=1;
% n = Manning's coefficient of friction;
% u = Flow velocity [m/s];
% b = Bottom width [m];
% m = Side slope;
% yn = Normal depth [m];
% yc = Critical depth [m};
% A = Cross sectioanl area {m^2];
% Rh = Hydraulic radius [m];
% Pw = Wetted perimeter [m];
% T = Surface width [m];
% L = Channel lenght [m];
% Y = Water depth [m];
% z= Bed elevation from the reference datum [m];
% h = Water elevation from the reference datum [m];
% Dx = Spatial step [m]:;
clc; clear all; close all;
% Input data;
g=9.81;
Q=25;
S=0.001;
n=0.025;
% Initial depth value to start the iterations;
yin=0.1;
% Trapezoidal, rectangular, triangular cross sections;
% Calculation of the normal depth;
for j=1:3
b=[5 5 0];
m=[1 0 1];
y(1)=yin;
i=1;
dyn(1)=0.1;
while (abs(dyn(i))>0.0001)
An(i)=b(j)*y(i)+m(j)*(y(i))^2;
Pwn(i)=b(j)+2*sqrt(m(j)^2+1)*y(i);
Rhn(i)=An(i)/(Pwn(i));
Tc(i)=b(j)+2*m(j)*y(i);
fn(i)=sqrt(S)/n*(An(i)*Rhn(i)^(2/3))-Q;
dfn(i)=sqrt(S)/n*((-4/3)*Rhn(i)^(5/3)*sqrt(1+m(j)^2)
+5/3*Rhn(i)^(2/3)*Tc(i));
y(i+1)=y(i)-fn(i)/dfn(i);
dyn(i+1)=-fn(i)/dfn(i);
i=i+1;
end
yn(j)=y(i);
iter_yn(j)=i;
end
% Calculation of the critical depth;
for j=1:3
yc(1)=yin;
k=1;
