Corresponding author: M. Morales-Hernández, Fluid Mechanics, LIFTEC, EINA, Universidad Zaragoza, María de Luna 3, E-50018 Zaragoza, Spain. (firstname.lastname@example.org)
 This work presents a two-dimensional hydraulic model that includes gates as internal structures. The flow is modeled using the two-dimensional shallow water equations and the gates are formulated as internal boundary conditions to provide a simulation tool for water flood management. When open channel flow in a river passes through a gate, the shallow water equations are no longer valid and energy conservation laws are required. The change in the set of equations is avoided by modeling gates as a spatial discontinuity or internal boundary condition, providing an alternative algorithm to the one used in the rest of the flooded computational domain. In the first part of this work, the requirements of an adequate discretization for gate modeling are provided in the context of a finite volume numerical scheme able to handle all kind of flow regimes over complex bed topography. In the second part of this work, the formulation of the internal boundary conditions is verified by means of a test case with exact solution. A benchmark test case is then proposed as a synthetic river reach with lateral storage areas controlled by gates. Dimensional analysis is used to establish the regulation parameters influencing the attenuation of the outlet peak discharge. It is also shown that the peak outflow discharge can be reduced by coupling the present simulator with a proportional-integral-derivative regulation algorithm. Finally, a river reach of the Ebro River is simulated with a real flooding scenario.
 One-dimensional (1-D) hydraulic models are not adequate for natural river flows where the interaction with the floodplains demands more sophisticated approaches. The cost of nonsimplified three-dimensional numerical models can be avoided using depth averaged two-dimensional (2-D) shallow water equations [Toro, 2001]. The combination of 2-D models for water flow and regulation structures is rarely found in the literature [Jaffe and Sanders, 2001]. This is the main topic of the present work.
 When dealing with the shallow water equations, realistic applications always include source terms describing bed level variation and bed friction that, if not properly discretized, can lead to numerical instabilities. In the last decade, the main effort has been put on keeping a discrete balance between flux and source terms in cases of still water, leading to the notion of well-balanced schemes or C property [Vázquez-Cendón, 1999; Toro, 2001; Rogers et al., 2003; Murillo et al., 2007]. Recently, in order to include properly the effect of source terms in the weak solution, augmented approximate Riemann solvers have been presented [George, 2008; Rosatti et al., 2008; Murillo and García-Navarro, 2010a]. In this way, accurate solutions can be computed avoiding the necessity of imposing case-dependent tuning parameters, which Rutschmann  used frequently to avoid negative values of water depth and other numerical instabilities that appear when including source terms.
 The use of floodplain areas connected to the river by levee breaches supplied with control gates can be considered a measure to mitigate floods. Gate opening creates depression waves that interfere with the flood wave to decrease peak flood discharges. This effect may be useful for hazard mitigation.
 Regulation algorithms are conventionally used to manage open channel systems. These algorithms consider both an open-channel flow model, rather often formulated according to the 1-D Saint-Venant equations, and a hydraulic model of the check structure [Buyalski, 1991]. Using linearization techniques, control algorithms have been developed, designed, and tested [Litrico and Fromion, 2009; Qiao and Yang, 2010; Ooi and Weyer, 2007]. The modeling of gates as inner flow conditions combined with a regulation algorithm makes it possible to consider problems such as flood control [Young, 1968], irrigation [Malaterre and Baume, 1998] or multireservoir system modeling and management [Sigvaldson, 1976; Kelman et al., 1989; Yazicigil et al., 1983].
 The model idealization of the gate operation process is a special case of boundary condition useful for various situations not included in free-surface flow conditions. The gate is formulated to halt the flow when closed and allow free-surface flow and pressurized flow when open. In all cases, the computational cells assigned to the gate location are treated as special cells where boundary conditions have to be imposed. This is not a trivial task in the context of a conservative numerical scheme, and it is precisely the novelty introduced in this work.
 This paper first presents the system of equations, the formulation of gate-type internal boundary conditions, and the finite volume scheme. Next, the particular form adopted to formulate the gates as internal boundary conditions is described. A 1-D case of regulation with exact solution is used to analyze the performance of the proposed numerical model in unsteady flow. The possibility to identify flood diversion areas in order to use them as transient storage zones connected to the river by gates can be considered as a risk mitigation tool for the downstream population. An example is provided in the case of the Ebro River (Spain) that justifies the necessity to develop simulation tools able to reproduce scenarios that can be used to improve design of the size and shape of the areas as well as implement the most convenient management of their inundation. In order to simplify this situation, a 2-D benchmark flood regulation test case is presented inspired by the size and characteristics of an Ebro River reach. Dimensional analysis is used to provide insight into the relationships between the dependent and independent variables of the system. In the benchmark case, the effects of gate regulation in floodplain storages area, flooding peak discharge, flood duration, and gate timing are examined. A proportional-integral-derivative (PID) regulation algorithm is implemented as an example that could be used to reduce the peak discharge at the outflow. Finally, the Ebro River reach chosen previously is performed with a simulation of an actual flooding occurred in 2003.
2. Unsteady Flow Model
 Shallow water flows can be described mathematically by depth averaged mass and momentum conservation equations with all the associated assumptions [Vreugdenhil, 1994]. That system of partial differential equations will be formulated here in a conservative form as follows:
is the vector of conserved variables with h representing the water depth, qx=uh and qy=vh the unit discharges, with (u, v) the depth averaged components of the velocity vector u along the (x, y) coordinates, respectively. The flux vectors are given by:
where g is the acceleration of the gravity. The terms in the fluxes have been obtained after assuming a hydrostatic pressure distribution in every water column, as usually accepted in shallow water models. The source term vector incorporates the effect of pressure force over the bed and the tangential forces generated by the bed stress:
where the bed slopes of the bottom level zb are
and the bed stress contribution is modeled using the Manning friction law so that:
with n the roughness coefficient.
3. Gate Modeling
 The gate is modeled by assuming that the discharge per unit breadth q crossing the gate is governed by the difference between the water surface level (d=h+z) on both sides of the gate, referred to as dl upstream of the gate and dr downstream of the gate, and by the allowable gate opening, Go. Several situations are envisaged. In the case that Go=0, the gate behaves as a solid wall and no flow crosses the gate. When the gate opening is larger than the surface water level on both sides, it no longer influences the flow. In any other case, assuming that dl < dr, without lost of generality, two different flow situations can occur depending on the relative values of Go, zl, zr, dl, and dr. When , Figure 1, the discharge is given by
with K1 an energy loss coefficient. In this work, K1=3.33 [Henderson, 1966].
with K2 another energy loss coefficient. In this work, K2=2.25 [Henderson, 1966].
4. Finite Volume Model
 To introduce the finite volume scheme, (1) is integrated in a volume or grid cell Ω using Gauss theorem:
where E=(F, G) and n=(nx, ny) is the outward unit normal vector to the volume Ω. In order to obtain a numerical solution of system (1), the domain is divided into computational cells, Ωi, using a fixed mesh. Assuming a piecewise representation of the conserved variables and an upwind and unified formulation of fluxes and source terms [Murillo and García-Navarro, 2010a], we get
The approximate solution can be defined using an approximate Jacobian matrix [Roe, 1981] of the nonlinear normal flux En and two approximate matrices , and , built using the eigenvectors of the Jacobian, which diagonalize
with is a diagonal matrix with eigenvalues in the main diagonal
Both the difference in vector U across the grid edge and the source term are projected onto the matrix eigenvectors basis
where contains the set of wave strengths and contains the source strengths. Details are given in the study by Murillo and García-Navarro [2010a]. The complete linearization of all terms in combination with the upwind technique allows to define the flux function as
with and , which when inserted in (10) gives an explicit first-order Godunov method [Godunov, 1959]:
 As the quantity Ei is uniform per cell i and the following geometrical property is given at any cell [Godlewsky and Raviart, 1996]:
The finite volume method can be written using a compact wave splitting formulation as follows:
 The use of (18) is efficient when dealing with boundary conditions. At the same time, it ensures conservation. In the study by Murillo and García-Navarro [2010b], it was demonstrated how for a numerical scheme written in splitting form, the total amount of contributions computed inside the domain at each cell edge, is equal to the balance of fluxes that cross the boundary of the domain, proving exact conservation.
4.1. Numerical Modeling of the Flow Through a Gate
 The flow through a gate, a special case of internal boundary condition defined along a certain number of internal boundary cells, is associated with a series of cell edges called gate edges. Gate edges either stop the flow (solid walls) or allow free surface flow and pressurized flow. Pairs of cells associated with a gate edge are referred to as gate cells. Depending on the flow conditions and the gate management operation, four cases can be defined:
 If the gate opening level is above both surface levels, , the flow will be considered as free surface flow and the gate cells (l, r) are updated as ordinary cells using (18).
 If the gate is closed, Go=0, the associated gate edge kgate is a solid wall, with a zero normal velocity component. As there are no contributions from the gate edge, is set in (18) when updating the conserved values in the gate cells (l, r) at time level n+1.
 When the gate opening is smaller than the free surface of either gate cell, , the flow is assumed pressurized. The discharge is computed using (7) and imposed in both cells (l, r). Moreover, in this case, is imposed at the gate edge.
 Otherwise, the gate discharge is computed using (8) and imposed in both cells (l, r). Also, in this case, is imposed at the gate edge.
 For either the closed gate or pressurized flow, the variation of the water depth at the gate cells (l, r) is a result of contributions from neighboring cells, ensuring exact mass conservation.
5. Comparison With Exact Solutions
 Consider a frictionless rectangular channel 35 km long, 20 m wide, with a discontinuous bed level given by:
 At t=0, a discontinuity is defined in the water level surface at x=20 km so that
with q(x, t=0)=0 m2 s−1.
 Two gates G1 and G2 are located at x1=20 km and x2=28 km, respectively, and are assumed to regulate the flow in time. The regulation for gate G1 is a function of the gate opening G1,o as follows
 During the first 2600 s, gate G2 is completely closed, . For time greater than 2600 s, the gate is operated according to the opening in time shown in Figure 3, ensuring a constant unitary discharge of . The details of the exact solution are given in Appendix A.
 The results for the water level surface (Figure 4) and for the discharge (Figure 5) indicate that the splitting formulation in (18), in combination with the inner conditions for gate regulation, is able to predict faithfully the overall behavior of the solution and of any type of waves.
6. Flooding Areas in the Ebro River
 The Ebro River (928 km in length) is the biggest river by discharge volume and its drainage basin is the largest in Spain (85,550 km2). Because of the climate of the region, there are frequent flooding events of great environmental and socioeconomic interest that justify the necessity of their management.
 One of the most important recent events took place during the first days of February 2003, because of high runoff due to the combination of heavy rains and rapid snow melt from upstream catchments. Maximum peak flows of 3320 m3/s in the early morning of the 6th February in Castejon (Navarra) and 2639 m3/s in the early morning of the 9th February in Zaragoza were registered. Figure 6 shows a map of the basin with a highlight of the area between Castejon and Zaragoza, the main town in the region.
 The Ebro River Basin Authority (SAIH, www.saihebro.es) carried out an intensive follow-up of this event both from the ground and from the air. The data provided were useful to study the space and time evolution of the flooding area. After the event, a combined analysis taking into account both the photographs available from a flight during the flood event and the satellite images taken by Landsat 7 and SPOT 2 and 5 was carried out. It was then possible to estimate the flooding area and to generate an important georeferenced database useful for the knowledge and management of the flood evolution. Figure 7 contains four snapshots of the images produced by this technology. They show the extent of the flooding along the 40 km reach upstream of Zaragoza. Floodplain inundation is clearly complex, hence requiring a 2-D model when numerical simulation is sought as more than one flow direction is relevant.
 Among the different structural and nonstructural measures followed by the Ebro River Basin Authority to mitigate the damage caused by the flood wave, the possible use of suitable floodplain areas adjacent to the river as damping storage zones was considered. Figure 8 shows a sketch of the river reach of interest with identification of the potential location of such areas. Because of the socioeconomic risk linked to the decision of their usage, the environmental discussion, and the uncertainty about the efficiency of measures for peak discharge attenuation, the necessity of a study was justified. The present work is concerned with the preliminary assessment of the potential impact offered by the regulation of lateral transient storage areas with the purpose of reducing floods in rivers by means of numerical simulation.
7. Benchmark Test Case
 For the analysis of the controlled inundation of floodplain areas as a tool to mitigate flood risks, a simplified 2-D example is presented. A river reach provided with three lateral floodplain areas is assumed. The river and the floodplains are separated by vertical walls (levees) everywhere except at certain points where they are connected through a gate. The location of the gates can be observed in Figure 9.
 The river bed bottom line is defined by a sinusoidal curve given by the following parametric equations:
with s=[0, 6000] m, a=400 m, b=3000 m and k=2π/2000 m. The resulting curve can be observed in Figure 9.
 The river cross section is assumed triangular with the same size all along the river reach. It is limited by 8 m high vertical levees as displayed in Figure 10.
 For every point (x, y) in the domain x=[0,6000 m] and y=[−2000 m,2000 m], a minimum distance d to the river bed line is calculated, and an elevation is assigned according to the profile given by the cross sectional shape plotted in Figure 10 and an additional slope of 1/1000 is assigned along the direction d when and along the x direction otherwise.
 The boundary condition used to specify the inlet discharge is a Gaussian hydrograph of the form:
where Qp is the peak discharge, tp is the time of occurrence of the peak discharge, and tb controls the width of the curve, that is, the flood duration. The corresponding water volume is
 A free 2-D mesh generator called triangle has been used to build a suitable computational grid (http://www.cs.cmu.edu/∼quake/triangle.html). A grid convergence has been carried out for the adequate choice of the mesh using four different unstructured grids. The grid resolution is increased in regions of large bed level gradient and reduced otherwise, hence the changing parameter when generating each mesh is the minimum angle constraint. Table 1 provides the information of this parameter as well as the number of cells in each mesh. A 1 day hydrograph with a peak discharge of 750 m3/s is introduced as inlet boundary condition for each mesh, considering gates 1 and 2 closed and gate 3 completely opened during all the simulation. The output hydrograph of each mesh is registered and plotted in Figure 11.
Table 1. Grid Convergence. Details of the Meshes.
Minimum Angle Constraint (°)
Number of Cells
 Providing mesh 3 and 4 similar results, the use of the mesh with less number of cells implies a considerable reduction in the computational time; hence, mesh 3 has been chosen for this purpose. Therefore, the adopted computational grid is made of 9484 nodes and 18,812 unstructured triangles (see Figure 12). Nodes have been labeled defining the river longitudinal line, the river banks, and the levee lines. As an example, Figure 13 shows a snapshot of the solution corresponding to an inlet discharge of 1200 m3/s with three gates completely open. Figure 13 illustrates that the three floodplain areas are partially filled with water.
 A preliminary dimensional analysis of the problem is next presented in order to understand the mutual influence of the different variables involved.
8. Dimensional Analysis
 The peak discharge damping that can be achieved in a given river reach connected to a given floodplain area by means of a gate of fixed width can be written in functional form by
where the variables of influence are the time interval during with the gate is open, with tac and tcc the gate opening and closing times, respectively (in s), the gate opening, G0 (in m), the inlet peak discharge value (in m3/s), the outlet peak discharge value (in m3/s), and the hydrograph volume V (in m3). Using Buckingham's Π theorem:
so that the influence of each Π-parameter
on the relative peak discharge attenuation can be analyzed. The physical meaning of the resulting Π groups is next outlined. compares the time interval during which the gate is open with the characteristic time width of the hydrograph, hence measuring the opportunity interval for storage. is the ratio between the gate opening time and the characteristic time width of the hydrograph, assuming that there is a common initial time at the beginning of the hydrograph. It is, therefore, related to the influence of the time interval between gate opening and peak flow. expresses the size of the gate opening relative to a characteristic length given by the hydrograph volume and, therefore, is related to the flow capacity of the gate opening. To examine the influence of the Π-parameters on the peak discharge attenuation, a systematic parameter study has been performed. Table 2 provides details of the parameter ranges considered.
Table 2. Dimensional Analysis Test Cases.
 This analysis has been carried out considering only one floodplain area (the third pool, which is downstream), a total simulation time of 40,000 s, totally open/closed gate, and SCS hydrographs [Clark, 1945] with peak discharge values increasing from 500 to 1000 m3/s over a steady base flow of 100 m3/s. The hydrograph volume is easily computed in this case as
8.1. Case 1: =0.9 =0.0817
 This case is considered in order to estimate the relationship between peak discharge attenuation and gate opening time. For each peak discharge, and using a fixed =14400 s, 11 gate opening times are considered:
 This choice (29) is useful to see the influence of opening times earlier or later than the peak time . Some examples are plotted in Figure 14. For each peak discharge, 10 simulations have been undertaken giving a total of 110 cases. Figure 15 shows the ratio of the peak discharge attenuation to the peak discharge plotted against . This provides information about the proportion of water stored in the pool. The smaller the value of this ratio, the less efficient the opening. Figure 15 highlights also that, when keeping constant the interval that the gate is open, the peak discharge attenuation is far from optimum when the gate is opened well before or after the peak discharge. This is particularly clear in the first two and the last two cases (the gate is opened too early and too late, respectively).
 The curves in Figure 15 still have some dependence on the peak discharge value, and they do not collapse into a single line. To get closer to a universal line, the dimensionless quantity where Ql is the output discharge when the gate is closed has been used instead of in order to separate the pool influence leaving aside the river attenuation. The dimensionless peak discharge attenuation due to the inundation area is plotted against as displayed in Figure 16, and the curves are closer to a single curve than those in Figure 15.
 On the other hand, there are several opening times that produce an optimum attenuation. This is probably caused by the choice of the parameter . To assess the influence of this parameter, 440 simulations have been carried out with a peak discharge of 850 m3/s but changing , i.e., modifying the time interval the gate is open. Figure 17 shows that, using another value of , there are not as many optimum opening values.
8.2. Case 2: =0.4 =0.0817
 In the second analysis, and remain constant. The relationship between the peak discharge attenuation and the time interval the gate remains open is assessed by varying according to:
 As in case 1, 110 simulations have been carried out, and the results can be observed in Figure 18, which plots as a function of . The plot generated is very similar to that of case 1 but truncated in time. The time interval the gate is open is varied for a fixed opening time. It is observed that the longer the gate remains open, the greater the quantity of water entering the floodplain area and the greater the attenuation of the peak discharge. The plot indicates that, if the gate remains open for too short a time, it is impossible to achieve optimum attenuation unless values of larger than 0.8 are reached.
 As in case 1, the curves do not collapse but still depend on the peak discharge values. The proposed solution is the same as in case 1, i.e., to assess the influence of the floodplain areas, leaving aside what the river damps. Figure 19 presents these results and the tendency to collapse into a single curve is clearer.
8.3. Case 3: =0.9 =0.4
 Now, the relationship between hydrograph volume and peak discharge attenuation is studied. Here, the gate opening time and the gate opening interval are kept constant. As the volume V is present in the other Π-parameters, care must be taken to force the other parameters to be constant when V is varied. Figure 20 plots the relative discharge attenuation versus (which has an inverse dependence on V). According to Figure 20, the smaller the volume inside each hydrograph, the larger the attenuation of the output hydrograph. This conclusion has various interpretations. For example, taking two hydrographs with the same water volume but different peak discharges, the damping produced is not the same in both cases (see Figure 21). In the left plot the peak discharge attenuation is about 20%, whereas in the right plot, it is about 13%.
9. Flow Regulation Using the Gates
 Control systems used to manage canal cross structures are based on measured variables, operating conditions, and objectives (e.g., hydraulic targets).
 In the present case, the control algorithm objective is to provide a new position of the gate according to the water level and the setpoint or level reference established. A discrete function of the gate position will be obtained. With the aim put on the peak hydrograph damping by using the floodplain areas, a PID regulation algorithm is proposed as a complement to the simulation tool.
9.1. PID Controller
 The PID algorithm is the best known feedback controller used within the process industries. It has been successfully used for over 50 years. It is a robust well understood algorithm that can provide control according to the value of an error signal produced as the difference between a real level and a setpoint level.
 The equation of the PID controller can be formulated as a function of time as follows:
where u is the controller action, in this case the gate opening, and e is called the control error ( ) where yref is the setpoint, y is the measured variable, and τ is the variable of integration (time in the present case). The constant K defines the gate position according to the difference between the setpoint and the real level; Ti is related to the data length of the error signal; Td defines the gate reaction to the current changes in the error signal.
 A certain tuning effort is necessary to find the best values for the parameters K, Ti, and Td. Appendix B describes the method used for this purpose and proposes empirical values for these constants.
where Ts is the sampling time (understood as the time in which the controller provides a new gate position) and tk is the current time. After writing (32) in terms of time increments, the discrete representation of the PID equations is:
where yref is the setpoint or target value for the controlled variable and y is the current value of the controlled variable. This algorithm is completely incorporated into the hydraulic numerical scheme (18), providing a new position of the gate when necessary.
9.2. Numerical Results
9.2.1. Benchmark Test Case
 This section presents results obtained from the implementation of the PID algorithm in the benchmark test case. To evaluate the effectiveness of this regulation algorithm for different scenarios, three examples with several input hydrographs are considered.
 Figure 22 shows the input hydrographs. Hydrographs 1 and 2 follow the Gaussian shape with two peaks following equation (24). Hydrograph 3 is a SCS shape [Clark, 1945]. The choice of these hydrographs is driven by the interest to explore the influence of the hydrograph shape and peak value.
 The simulation results are presented as follows: for each hydrograph, results are presented for: (i) a case without regulation, i.e., the gates remain completely opened all the time (from now on NO REG) and (ii) a PID control case (PID). Figure 23 shows the inlet and outlet hydrographs corresponding to hydrograph 1 in the upper subfigures and the gate opening in the lower subfigures for (a) the NO REG case and (b) the PID regulation. The observation of Figure 23 leads to the conclusion that, in this case, the PID regulation strategy has an almost negligible effect in comparison to the NO REG option. Its only useful function is to keep some of the water inside the floodplain areas and to release it after the flooding has occurred.
 Figure 24 shows the inlet and outlet hydrographs corresponding to hydrograph 2 in the upper subfigures and the gate opening in the lower subfigures for (a) the NO REG case and (b) the PID regulation case. In this case, the peak values and volume of the hydrograph are larger. The effect of the regulation is slightly more noticeable but still minor. The shape of the inlet hydrograph is distorted by the regulation.
 Figure 25 shows the inlet and outlet hydrographs corresponding to hydrograph 3 in the upper subfigures and the gate opening in the lower subfigures for (a) the NO REG case and (b) the PID regulation case. In this third case, there is a single peak value and a larger volume of the hydrograph. The effect of the PID regulation is an 8% of reduction in the peak value as well as an important modification in the temporal distribution of the outlet discharge in the descending branch of the hydrograph.
9.2.2. Ebro River Reach
 The Ebro River reach described in Figure 7a is considered now in order to assess the validity of the model. Two simulations have been carried out with the two different strategies presented before: NO REG and PID regulation, respectively. The computation has been run on a computational grid made of 129,259 unstructured triangles and 65,273 nodes from a digital terrain model provided by the Ebro River Basin Administration. A 6 day hydrograph, reproducing the flooding event during the first days of February 2003, is introduced as inlet boundary condition, and a measured gauging curve at the end of the river reach is imposed as outlet boundary condition. Figures 26 and 27 show two snapshots corresponding to times t=3.5 days and t=4.5 days, illustrating the water level surface predicted by both regulations strategies. The location of the gate for the PID case is also indicated in the mentioned figures.
 As can be seen, the difference is not very noticeable between the two strategies because it is a very large flooding event where even the river burst its banks. In these cases, the policy consist of opening completely the gates toward the desired floodplains to keep the majority of the water, hence decreasing the river flow discharge to avoid more important downstream damages. However, the numerical results in both cases approximate very accurate the estimation provided by the Ebro River Basin Administration in Figure 7a in terms of water surface level flooded.
 In this work, a 2-D unsteady flow simulation model has been supplied with internal boundary conditions formulated as control gates. The model is based on an upwind finite volume formulation and can work with both quadrilateral and triangular grids. The wave splitting formulation of the numerical scheme has proved to be a robust tool that allows a direct implementation of interior conditions. In the case of gates, the tool offers the possibility to include regulation in the simulation. The numerical performance of the model for unsteady flow in presence of gates has been tested by means of an idealized case with exact solution. Although the test case corresponds to 1-D flow, it has been computed with the full 2-D model. The obtained results indicate that the new method is able to predict faithfully the overall behavior of shallow water in gate regulation scenarios in both free surface conditions and pressurized states. This is the main conclusion of the work and suggests that the model could be useful as a predictive tool when adapted to the analysis of flood regulation using inundation areas connected by gates to the main river. Driven by the strategy proposed by the Ebro River Basin Authority of using flood diversion areas as a measure to mitigate inundation problems in the Ebro River, the present model has been used to simulate such type of scenarios. First, the ability to reproduce past flooding events has been tested by comparison of the predicted flooded areas with those from aerial photographs. The numerical model is able to compute the detailed evolution of the flooded surface over dry irregular topography with an accuracy limited by the uncertainty in the available terrain data. Because of the lack of data corresponding to real cases involving the active flood diversion areas, a suitable benchmark test case of river reach with storage areas supplied (or not) with gates has been proposed. The relative simplicity of the benchmark case allows evaluation of the sensitivity of the results to different physical quantities. On that basis, dimensional analysis has been used to generate scenarios together with the simulation model. The simulation model has also been combined with a simple PID regulation strategy in order to show the potential applicability of this kind of tool in hydraulic engineering.
Appendix A: Exact Solution
 The exact solution for test case in section 5, where flow conditions in two different gates are imposed in time, can be derived solving the wave evolution by means of setting appropriate boundary conditions and wave relations.
 For time t ≤100s, both gates remain closed, and the water volumes stored at the left and right sides of each gate are independent. Being in each reservoir among the gates water in quiescent equilibrium, the initial solution remains static in this period. At time t=100s, gate G1 opens suddenly allowing mass transfer under free surface conditions. A self-similar solution can be then derived by integrating the Riemann invariants across the rarefaction wave on the left side, connected with an entropy satisfying right moving shock on the left side by imposing the Rankine-Hugoniot conditions at the bed discontinuity. The complete development of the solution is detailed in the studies by Bernetti et al.  and Murillo and García-Navarro [2010a].
 When the shock wave arrives to gate G2, still closed, a left moving shock is produced due to the reflection effect, while the rest of the solution in the rarefaction region and bed discontinuity remains self-similar. The complete evolution of the solution in the vicinity of gate G2 is given by imposing the Rankine-Hugoniot condition considering that the fluid has zero velocity at the gate position. The resulting system provides new height of the water column at this position and the celerity of the left moving shock that has to be entropy satisfying to be physically acceptable [Toro, 2001].
 At time 2600 s, gate G2 is opened, and the resulting unit discharge is assumed constant and equal to q2= 1.5 m2 s−1. The opening time is selected to avoid interference with the left moving shock, allowing to define a rarefaction wave, generated by means of integrating the Riemann invariants departing from the tail and setting the head when the discharge reaches a value equal to q2. The solution remains self-similar allowing to compute the positions of shocks and rarefactions until time t=3100 s when gate G1 is instantaneously closed. The same procedure for the definition of the left moving shock in gate G2 is repeated for the generation of the left moving shock upstream gate G1. The rarefaction wave downstream gate G1 is defined integrating the Riemann invariants and generating the solution moving to the left side until the point of nil discharge in the tail is located. In this way, it is possible to give an exact solution in time that is valid until any of the developed waves encounters another one.
Appendix B: PID Tuning
 The process of selecting the most appropriate controller parameters is known as tuning the controller. Ziegler and Nichols  proposed several rules to determine the values K (proportional gain), Ti (integral time), and Td (derivative time) on the basis of the characteristics of the transient response of a specific system. These rules are convenient when the mathematical model of the system is unknown. According to the reaction curve method, proposed for closed loop systems and later modified by Cohen and Coon , the system has to be set to a normal operating point and then perturbed in order to evaluate the reaction. In the river example, the initial operating point corresponds to an initial steady state flow of 500 m3/s followed by a sudden discharge increase to 580 m3/s. The output discharge is then recorded in time and the values K, Ti, and Td are computed. The simulation results corresponding to this procedure can be observed in Figure B1, and the resulting constant values obtained according to Cohen-Coon are achieved: