18 Computational Modelling in Hydraulic and Coastal Engineering
Dz=H/ns;
A=0.005;
Co=0.7;
Dt=5;
S=[5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0];
% Initial conditions;
z=H;
k=0;
% Main program;
for k=1:10000;
if z<0
z=0;
end
Qout=Co*A*sqrt(2*g*z);
j=1;
if z>j*Dz; j=j+1;
end
dH=j*Dz-z;
S1=S(j+1)+(S(j)-S(j+1))*dH/Dt;
znew=z-Qout*Dt/S1;
z=znew;
Z(k)=znew;
% To facilitate plotting take 100*Qout;
Qp(k)=Qout*100; m=k;
end
plot(1:m,Z,'b','Linewidth',1.5)
hold on
plot(1:m,Qp,'m','Linewidth',1.5)
v=[0, 450, 0, 10];
axis(v)
xlabel('Number of time steps'), ylabel('')
legend('z: Water stage [m]','Qout: Outflow discharge x 10E-2
[m^3/s]')
PROBLEM 2.1
Solve the same problem by making the following suggested changes while
keeping the rest of the data constant:
1. Change the shape to a truncated cone-shaped tank of the same height
but with a cross-section area of 1.0 m at the bottom and 11.0 m at the
top, and plot the discharge Q out as a function of time.
2. Change the shape to an inverted truncated cone-shaped tank of the
same height but with a cross-section area of 11.0 m at the bottom and
1.0 m at the top, and plot the water elevation z as a function of time.
3. Change the orifice area from 0.005 m 2 to 0.01 m 2 , and plot the temporal variation of both the discharge Q out and the water elevation z.
Dz=H/ns;
A=0.005;
Co=0.7;
Dt=5;
S=[5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0];
% Initial conditions;
z=H;
k=0;
% Main program;
for k=1:10000;
if z<0
z=0;
end
Qout=Co*A*sqrt(2*g*z);
j=1;
if z>j*Dz; j=j+1;
end
dH=j*Dz-z;
S1=S(j+1)+(S(j)-S(j+1))*dH/Dt;
znew=z-Qout*Dt/S1;
z=znew;
Z(k)=znew;
% To facilitate plotting take 100*Qout;
Qp(k)=Qout*100; m=k;
end
plot(1:m,Z,'b','Linewidth',1.5)
hold on
plot(1:m,Qp,'m','Linewidth',1.5)
v=[0, 450, 0, 10];
axis(v)
xlabel('Number of time steps'), ylabel('')
legend('z: Water stage [m]','Qout: Outflow discharge x 10E-2
[m^3/s]')
PROBLEM 2.1
Solve the same problem by making the following suggested changes while
keeping the rest of the data constant:
1. Change the shape to a truncated cone-shaped tank of the same height
but with a cross-section area of 1.0 m at the bottom and 11.0 m at the
top, and plot the discharge Q out as a function of time.
2. Change the shape to an inverted truncated cone-shaped tank of the
same height but with a cross-section area of 11.0 m at the bottom and
1.0 m at the top, and plot the water elevation z as a function of time.
3. Change the orifice area from 0.005 m 2 to 0.01 m 2 , and plot the temporal variation of both the discharge Q out and the water elevation z.
