I have been working on modeling the time taken to empty a cylindrical tank with a sealed top using a moving lid.
The lid, in the form of a disk, moves down as the water level decreases. The discharge hole is being connected with a pipe that is pouring the water back onto the tank and filling it up with water (the water can not transit to the lower area because the top is sealed).
We know: $g$, $h$, $d$, $D=50d$, $m=3 \rho h \frac{D^2\pi}{4}$ and assume inviscous flow.
A picture to visualise this:
Question: How much time will it take for the whole tank to fill out (i.e. when the disk D reaches zero height)?
I wrote a differential equation for modelling how much time it takes for a tank to fill out when the tank not closed (which I will not show here how I derived):
$$dV= -A(z)dz = Q dt$$
$$ -A(z)dz = Qdt$$
$$dt= \frac{-A(z)}{v\cdot A} dz$$
Where $A(z)$ is the area of the cylinder tank, $A$ is the area of the cross section of the discharge hole and $v$ is equal to speed of the fluid at the discharge hole.
The main challenge in this task arises from the fact that the water is being poured back onto the top of the lid.
It is relatively simple to determine the velocity $v$ at the discharge hole using Bernoullie's equation. Due to the conservation of mass law the flow at the beginning of the pipe and the end is the same so:
$$Q_1=Q_2$$
$$v_1=v_2.$$
After this I don't know how to continue. I don't know how to set up a differential equation that will model this. It seams that I have to set up a system of coupled differential equations but that seems to difficult.

Hint.
Considering the energy Bernoulli equation along a flow line we have
$$ p_1+\frac 12\rho v_1^2+\rho g h_1 = p_2+\frac 12\rho v_2^2+\rho g h_2 $$
with
$$ \cases{ p_1 = p_a + \frac{m g}{S}\\ p_2 = p_a\\ v_1 = v\\ v_2 = \frac{v S}{\left(\frac{\pi d^2}{4}\right)}\\ h_1 = h\\ h_2 = 2h } $$
we have
$$ \frac{m g}{S}+\frac 12\rho\left(1-\frac{S^2}{\left(\frac{\pi d^2}{4}\right)^2}\right)v^2-\rho g h=0 $$
and knowing that $v = \frac{dy}{dt}$ we have
$$ \frac{m g}{S}+\frac 12\rho\left(1-\frac{S^2}{\left(\frac{\pi d^2}{4}\right)^2}\right)\left(\frac{dy}{dt}\right)^2-\rho g h=0 $$
Here $S = \frac{\pi D^2}{4}$
NOTE
Considering that $\Delta t = \frac hv$ after substitutions we have
$$ \Delta t = 1250\sqrt{\frac hg} $$