OK, that is my second tentative to solve this problem. I think I have a solution this time, thank to the discussion of others in that thread. The solution is $v_{\text{final}}=\sqrt{2gh(0)}\frac{ls}{h(0)S}(1-\frac{\pi}{2})$ if $m\gg M$. This corresponds to a few millimetres per second towards the left for a wagon full of water.
Here is how I've derived it :
Notation
In order not to neglect not negligible contributions, I will pose the problem for a cart of a quite arbitrary shape, before restricting it to our cart.
We have :
- $S(z)$ : section of the cart at altitude $z$
- $h(t)$ : height of water at time $t$
- $l(z)$ : abscissa of the centre of mass (CoM) of the slice of water at altitude $z$
- $M$ : Mass of the empty cart
- $m = \int_0^h(0) dz S(z) \rho$ : initial mass of water
- $\mu(t)$ : remaining mass of water at time $t$
- $f(t)=-dµ/dt > 0$ is the mass flow of water
- $v_v(z,t) < 0$ : vertical speed of the water slice at altitude $z$
- $v_h(z,t)$ : horizontal speed of its CoM.
In the case of the cart, we will have :
- $S(z)$ is constant above the nozzle. Let $\delta+\epsilon$ be the nozzle height. We then have $S(z)=S$ for $z>\delta+\epsilon$. For numerical appplications, we'll suppose a $3\times3\times10$ m³ cart, with $S=30$ m².
- The last part of the nozzle is a pipe of height $\delta\ll h(0)$. In this pipe $S(z<\delta)= s\ll S$. If the output has a 10 cm side, $s=1O^{-2}$ m².
- $h(0) = 3$ m
- Above the nozzle, the CoM of the water is fixed at $l(z>\delta+\epsilon)=0$, while in the lower part, $l(z<\delta)=-l$, wher $l=5$ m.
- I'll assume $M=10^4$ kg, but I've no idea whether it's realistic.
- $\rho = 10^3$ kg·m⁻³
- $m=\rho S h(0) =$ 9·10⁴ kg
- $g=10 m·s⁻²$
Vertical movement of water
In the following, we will assume that the horizontal acceleration $a$ of the cart stays $a\ll g$ during the movement. A nonzero acceleration would induce correction terms proportional to $\frac{a^2}{g^2}$, and we will check that this hypothesis is consistent later. This assumption allows us to neglect any motion of the cart when looking at the movement of water in the cart referential, and then compute $f(t)$, $h(t)$ and $\mu(t)$. We will then use the resulting f this computation to find the horizontal movement of the cart.
The incompressibility of water allows us to write
$$ f(t)=-\rho S(z,t) v_v(z,t) =\rho S(h(t)) \frac{dh}{dt} =- \rho s v_v(0,t) \quad(*)$$
Bernoulli, at altitude $h$ and $0$ gives us
\begin{gather}
\left(\frac{dh}{dt}\right)^2 + 2gh = (v_v(0,t))^2 \\
2gh=(dh/dt)² (\frac{S(h)²}{S(0)}² -1)
\end{gather}
In our case, except in the nozzle, $\frac{S(h)^2}{S(0)^2}=\frac{S^2}{s^2}\simeq 10^7$. We will therefore neglect the $-1$ in the following.
This equation has the following solution :
$$ h(t)=h(0)(1-t/t_m)^2 \text{ for } t\in[0, t_m]$$
and $h(t>t_m)=0$, with $t_m=\frac Ss \sqrt{2h(0)/g}$. Here $t_m=3\cdot 10^3 \sqrt(6/10) \sim 2000$ s.
We have then $\mu(t)=m (1-t/t_m)^2$ and $f(t)=f(0)(1-t/t_m)$ with $f(0)=\rho s \sqrt{2gh(0)}\sim=10^{-2+3}\sqrt{60}\sim80$ kg·s⁻¹.
Conservation of the horizontal momentum
Now comes the interesting part of the problem, the horizontal movement.
Momenta will be computed in the cart referential ($P^{CR}$) and in the rail referential ($P^RR$).If you look at the water inside the cart, its momentum will be
$$P^{CR}_{\text{water}}=\rho\int_{0}^{h(t)}dz S(z) v_h(z,t)$$
with $v_h(z,t)= dl/dz v_v(z,t)$. From that and the expression $(*)$, we have
$$P^{CR}_{\text{water}}=- f(t) \int_{0}{h(t)}dz dl/dz= f(t) (l(0)-l(h(t))).$$
Going back to the more physical rail-refrential, we have then
$$P^{RR}_{\text{water}}=µ(t)v(t) + f(t) (l(0)-l(h(t)))$$
We also have, for the cart,
$$ P^{RR}_{\text{cart}}=M v(t)$$
As stated in other answers (but not my previous one :-(), one should not forget the momentum of the water which has left the cart in previous time :
$$P^{RR}_{\text{leaked water}}=\int_0^t d\tau f(\tau) v(\tau)$$
Summing these term, together with the momentum conservation, we have :
$$ 0=P^{RR}_{\text{total}}=(M+\mu(t))v(t) + f(t) (l(0)-l(h(t))) + \int_0^t d\tau f(\tau) v(\tau) $$
For example when the cart is empty, $f(t)=0$, $\mu(t)=0$ and the above equations becomes :
$$ 0=P^{RR}_{\text{total}}=Mv_{\text{final}} + \int_0^t d\tau f(\tau) v(\tau) $$
The cart can have a final nonzero speed, if its momentum is compensated by the net momentum of the water having left the cart.
Differentiating the momentum conservation relatively to $t$, we obtain,
$$ 0=(M+µ(t))\frac{dv}{dt} - f(t) v(t) + \frac{df}{dt}(l(0)-l(h(t))) - f(t) \frac{dh}{dt} \frac{dl}{dz} + f(t) v(t)$$
This equation can be simplified into
$$ \frac{dv}{dt}=\frac{1}{M+\mu(t)}\left[\frac{df}{dt}[l(h(t))-l(0)] - \frac{dl}{dz}\frac{f(t)^2}{\rho S(h(t))}\right] $$
Knowing $f(t)$ as per the previous section allows us to integrate this equation, at least numerically, for any cart. In the following, we solve the equation for our cart geometry, distinguishing three steps.
Step 1: opening the nozzle
When the nozzle is quickly opened at $t=0$, the cart is full and $\mu=m$ is constant. the equation we have to solve is then
$$\frac{dv}{dt}=\frac{1}{M+m}\frac{df}{dt}l-0 $$
from which we easily deduce
$$\Delta v = \frac{l\Delta f}{M+m}=\frac{lf(0)}{M+m}.$$
With the numerical values above, this corresponds to a speed of 4 mm·s⁻¹. This movement of the cart compensate the internal acceleration of the water inside the cart towards the nozzle.
As wee will see later, this abrupt speed change is the biggest acceleration taken by the cart. If the nozzle is opened in one second, which is still quickly enough to keep $\mu=m$ approximation valid, the horizontal acceleration $a$ is still small : $\frac{a}{g}=4\cdot10^{-4}$.
Step 2: Emptying the cart above the nozzle
Above the nozzle, we have a constant $l(h)=0$ and the differential equation is
$$\frac{dv}{dt}=\frac{l}{M+\mu(t)}\frac{df}{dt}$$.
If the cart is emptied with a constant $f(t)$, it does not accelerate nor slow down, until the f(t) is cut. In that moment the back action is the same in a reverse direction, but with a lower mass. (M instead of M+m). We end therefore with a net speed towards the left of value $lf(1/(M+m)-1/M)$
In the more general case where f slowly decrease to 0, $df/dt <0$, implying a slow down, and indeed a reversal of the speed, since the total mass $M+µ(t)$ decreases.
If we plug into the above equation the values we have for $f(t)$ and $\mu(t)$, we have
$$\frac{dv}{dt}=\frac{lf(0)}{t_m(M+m(1-t/t_m)^2)}=-g\frac{ls^2m}{h(0)S^2M}\frac1{1+\frac mM(1-t/t_m)^2}$$
which can be analytically integrated using $\int dt/(1+t^2)= \arctan t$. We have then
$$v(t)-v(0)=-\frac{ls}{h(0)S}\sqrt{2gh(0)}\left[\arctan\sqrt{\frac mM} - \arctan\left(\frac{t_m-t}{t_m}\sqrt{\frac mM}\right)\right]$$.
We have then
$$v(t_m)=v(0)-\frac{ls}{hS}\sqrt{2gh(0)}\arctan\sqrt{\frac mM}$$
In the limit $m\gg M$, where the mass of water is larger than the cart mass, $\arctan\sqrt{m/M}\simeq\pi/2$ and $v(0)=\sqrt{2gh(0)}\frac{ls}{h(0)S}$, so that :
$$v(t_m)=\sqrt{2gh(0)}\frac{ls}{h(0)S}(1-\frac{\pi}{2})$$
step 3: Showing that the nozzle has no influence, so long at it is small
The problem of the nozzle is the zone where $\frac{dl}{dz}$ is not small. let say that this zone is of height $\epsilon$, above a vertical pipe of height $\delta$, with $\epsilon\ll\delta\ll h(0)$. I have the intuition that the problem is not so dangerous, since the $\propto l/\epsilon$ derivative will be only relevant for a time proportional to $\epsilon$, and the small amount of water involved should keep the corrective term small. But I have nothing more rigorous yet :-(