Solution (source code)

= Solution

Assume an inviscid <barotropic fluid> acted on by a conservative body force $-\boldsymbol\nabla\psi$. Define its <barotropic enthalpy function> by
$$
H(\rho)=\int^{\rho}\frac{p'(s)}s\,ds,\qquad
\boldsymbol\nabla H=\frac{\boldsymbol\nabla p}{\rho}.
$$
The <Euler equations for an inviscid fluid> are then $\partial_t\mathbf v+(\mathbf v\cdot\boldsymbol\nabla)\mathbf v=-\boldsymbol\nabla(H+\psi)$. Using the <vorticity> $\boldsymbol\omega=\boldsymbol\nabla\times\mathbf v$ and the vector identity
$$
(\mathbf v\cdot\boldsymbol\nabla)\mathbf v
=\boldsymbol\nabla(v^2/2)-\mathbf v\times\boldsymbol\omega
$$
gives $\partial_t\mathbf v+\boldsymbol\nabla B=\mathbf v\times\boldsymbol\omega$, where $B=v^2/2+H+\psi$.

For \b[steady flow], dotting this equation with $\mathbf v$ yields $\mathbf v\cdot\boldsymbol\nabla B=0$. Thus <Bernoulli's equation> is
$$
\boxed{\frac{v^2}{2}+\int^{\rho}\frac{p'(s)}s\,ds+\psi
=\text{constant along each streamline}.}
$$
The constant need not agree between different <streamlines>. If the flow is also <irrotational>, the vector equation gives $\boldsymbol\nabla B=0$, so one common constant applies throughout a connected flow region.

For an <isentropic process> with $p=K\rho^\gamma$, $H=\gamma p/[(\gamma-1)\rho]$ up to an additive constant, equal to the thermodynamic <specific enthalpy>. For an externally maintained isothermal gas, $H=a^2\ln(\rho/\rho_{\rm ref})$; this <pressure> potential is not the constant thermodynamic enthalpy of a fixed-temperature ideal gas.

If steady flow is not assumed, a useful additional case is unsteady <potential flow> $\mathbf v=\boldsymbol\nabla\phi$. The same vector equation integrates spatially to
$$
\boxed{\partial_t\phi+\frac{v^2}{2}+H+\psi=C(t).}
$$
General unsteady barotropic flow does not possess the steady streamline constant without further conditions.