20 Computational Modelling in Hydraulic and Coastal Engineering
% Input data;
Td = 40000;
Qo = 2000;
zo = 50;
zs = 95;
B = 100;
Dt = 100;
nm = 1000;
z = zo;
t = 0;
% Initial conditions;
Qin = Qo;
Qout = 0;
% Main program;
for n = 1:nm;
t = n*Dt;
% Calculation of the inflow hydrograph;
if Qin > 0
Qin = Qo*(1-t/Td);
else Qin = 0;
end;
% Calculation of the outflow discharge;
if z > zs
Qout = B*(z-zs)^1.5;
200
180
160
140
120
100
80
60
40
20
0 0
100 200
300 400
500 600 700
800 900 1000
Number of time steps
Inflow hydrograph × 10 –1 (m 3 /s)
Outflow hydrograph × 10 –1 (m 3 /s)
Water elevation (m)
Figure 2.5 Water stage variation, and inflow and outflow hydrographs.
% Input data;
Td = 40000;
Qo = 2000;
zo = 50;
zs = 95;
B = 100;
Dt = 100;
nm = 1000;
z = zo;
t = 0;
% Initial conditions;
Qin = Qo;
Qout = 0;
% Main program;
for n = 1:nm;
t = n*Dt;
% Calculation of the inflow hydrograph;
if Qin > 0
Qin = Qo*(1-t/Td);
else Qin = 0;
end;
% Calculation of the outflow discharge;
if z > zs
Qout = B*(z-zs)^1.5;
200
180
160
140
120
100
80
60
40
20
0 0
100 200
300 400
500 600 700
800 900 1000
Number of time steps
Inflow hydrograph × 10 –1 (m 3 /s)
Outflow hydrograph × 10 –1 (m 3 /s)
Water elevation (m)
Figure 2.5 Water stage variation, and inflow and outflow hydrographs.
