I have an incompressible, inviscid fluid, under the influence of gravity, with a velocity potential:
$$ \mathbf{u} = (-\cos(x)\sin(y), \sin(x)\cos(y), 0) $$
Using Euler's equations,
$$ \mathbf{u} \cdot (\mathbf{\nabla} \cdot \mathbf{u}) = \frac{-1}{\rho} \mathbf{\nabla}p - g\mathbf{\hat{z}} $$
that is,
$$ \frac{\partial p}{\partial x} = \frac{\rho}{2} \sin(2x) $$ $$ \frac{\partial p}{\partial y} = \frac{\rho}{2} \sin(2y) $$ $$ \frac{\partial p}{\partial z} = -\rho gz $$
the pressure, $p$, is then:
$$ p = \frac{-\rho}{4}(\cos(2x) + \cos(2y) + 4gz) $$
and the streamlines are given by:
$$ \frac{dx}{-\cos(x)\sin(y)} = \frac{dy}{\sin(x)\cos(y)} $$
$$\int \frac{-\sin(x)}{\cos(x)}dx = \int \frac{\sin(y)}{\cos(y)}dy $$
$$ \implies \ln|\cos(x)| = \ln|\sec(x)| + c $$
$$ \implies \cos(x)\cos(y) = A = \phi(x,y) $$
Where $A$ is constant. I can't show that the Bernoulli equation is constant along the streamlines.
$$ \frac{1}{\rho}p + \frac{\mathbf{u}^2}{2} + gz $$ $$ = \frac{-1}{4}(\cos(2x) + \cos(2y) + 4gz) + \frac{(-\cos(x)\sin(y))^2 + (\sin(x)\cos(y))^2}{2} + gz $$ $$ = \frac{1}{2}(\sin^2(x) - \cos^2(x)\cos(2y))$$
Which is not of the form $\phi(x,y)$. Am I missing some trigonometric identity or have I made a mistake in my earlier calculations?
I had just missed an identity:
$$ \sin^2(x) - \cos^{2}(x)\cos(2y) = \sin^2(x) - \cos^2(x)(2\cos^2(y)-1) $$ $$ = 1 - 2\cos^2(x)\cos^2(y) = 1 - 2\phi^2 $$