Solution (source code)

= Solution

For constant density $\rho$, the inviscid <Euler equations> with conservative <body force> are
$$
\partial_t\mathbf u+(\mathbf u\cdot\nabla)\mathbf u=-\nabla(p/\rho+V).
$$
The vector identity $(\mathbf u\cdot\nabla)\mathbf u=\nabla(|\mathbf u|^2/2)-\mathbf u\times(\nabla\times\mathbf u)$ simplifies for <potential flow> $\mathbf u=\nabla\phi$, since its <vorticity> vanishes. Also $\partial_t\mathbf u=\nabla\phi_t$. Therefore
$$
\nabla\left(\phi_t+\frac12|\mathbf u|^2+\frac p\rho+V\right)=0.
$$
On each connected fluid region the expression is spatially constant but may depend on time, giving the <Unsteady Bernoulli equation>
$$
\boxed{\frac{\partial\phi}{\partial t}+\frac12u^2+\chi=f(t),\qquad \chi=p/\rho+V.}
$$
The arbitrariness of $f$ corresponds to the freedom to add a function of time to the <velocity potential> without changing $\mathbf u$. Replacing $\phi$ by $\phi-\int^t f(s)\,ds$ sets the right-hand side to zero.