Given that the flow is found incompressible (previous question here), is the approach above the right way towards finding the stream function? given that: $\mathbf{u}=\sin{x}\sin{y}\mathbf{i}+\cos{x}\cos{y}\mathbf{j}$
$$\tag{B} \sin{x}\sin{y}=\frac{\partial\phi}{\partial y}\qquad \cos{x}\cos{y}=-\frac{\partial\phi}{\partial x}$$
I have thought of approaching it this way:
$\frac{\partial\phi}{\partial y}=\sin{x}\sin{y} = \int\sin{x}\sin{y}$ and integrating with respect to y:
- $-\cos{y}\sin{x} + f(x)$ where f(x) is a constant of integration, and substituting the second part of (B).
- $\frac{\partial\phi}{\partial x}(-\cos{y}\sin{x} + f(x)) = -f'(x) ; f(x) =-\sin{x}\cos{y} + C $
- Therefore when adding both integrated factors we get : $\phi=-\cos{y}\sin{x}-\sin{x}\cos{y}$ where $\phi$ is a constant.
Which is equal to: $-2\cos{y}\sin{x}?$ when we simplify the equation on the right-side on 3.
Step one gives you
$$ \phi(x,y) = -\cos y\sin x+f(x)$$ for some $f(x)$, and step two gives $$ \phi(x,y) = -\cos y\sin x+g(y),$$ for some $g(y)$. These are both correct.
It does not follow that $\phi$ is constant, i.e. your step 3 is wrong. Instead, combine the first two steps, and you should see $f\equiv0\equiv g$. (get some paper and actually write it out carefully, if it is not clear.)
You can check by direct computation that your guess for $\phi$ is wrong: Well, firstly, $\phi$ is not a constant, and neither is $-2\cos y \sin x$, but if you meant to say that
$$\phi(x,y)=-2\cos y \sin x$$
then just differentiate in either $x$ or $y$ to see that you have an extra factor of $2$.