# Computation at a singular section

At a singular section, one can have as many weirs (five maximum) or gates (five maximum) as needed.

One must then solve equation** [23]** where the fk(Zi, Zj) terms are the discharges going through each device number k. Zi is the water surface elevation upstream of the device and Zj is the water surface elevation downstream of it. This equation is solved by Newton’s method.

The initial value is determined as follows: Consider only one weir with length XL equal to the sum of the lengths of all the devices, and located at the elevation Zmin of the lowest one. If the downstream water elevation Zj is less than Zmin, one initializes with the free-flow weir formula:

Zio = Zmin + ( )2/3

If Zj is greater than Zmin, one considers:

Zio = Zj +

Starting values for the bisection algorithm are:

Zmin = elevation of the lowest device, or Zj if the latter value is greater.

Zmax = elevation of the highest device + 10 meters.

These values are modified as follows:

if f(Zil) > 0 : Zmax = Zil

if f(Zil) < 0 : Zmin = Zil

where f = f_{k}(Z_{i}, Z_{j}) - Q, which is a increasing function.

Let us examine the case of a regulator gate in a singular section. One has to solve the equation **[24]** which is of the type f(W) = 0, W being the regulator gate opening allowing to achieve the target upstream water elevation Zi. One starts calculating the discharges going through all the fixed gates, and one obtains:

fr(Zi, Zj, W) = Q - fk(Zi, Zj)

This equation is solved by bisection algorithm by adopting as the initial opening, half of the maximum authorized opening.

The calculation is stopped when the distance between the limits of the bisection algorithm is less than 1 mm.