In order to maintain a constant water deep in canal, how much water must flow trought the pipe ?

As shown on picture, canal have a rectangular shape. I don't know if canal length have an influence.
EDIT : to simplify things let's consider there is no turbulence, no viscosity, and that water falling from pipe do not disturb water in canal.
I tried to solve the problem by myself (i'm a physics beginner so it could be totally wrong, please do not downvote the question if you think this is not correct) :
Area of canal section : $A = w \, h$
If I calculate water velocity $v$ in canal, using this and surface $A$, I can calculate how much water $Q$ will flow :
$$Q = A \, v$$
and solve the problem...
So only thing left is to calculate $v$.
Let's say the canal have no inclination $Z = 0$, I think water velocity for a given water height can be calculated like this (I'm not sure about this) :
$$ v = \sqrt{ 2 \, g \, h } $$
$$ \delta Q = A \, v = w \, \delta h \, \sqrt{ 2 \, g \, h } $$
integrating h from 0 to H and gives :
$$ Q = w \, \sqrt{ 2 \, g } \int_0^H h^{1/2} \, dh$$
so discharge for a given height and width :
$$ Q = \frac{2}{3} \, w \, \sqrt{ 2 \, g } \, H ^{3/2} $$
Could anyone tell me if the above is correct (assuming there is not inclination), and try to answer my initial question ?