Solution (source code)

= Solution

The <divergence> and scalar <vorticity> are
$$
\nabla\cdot\mathbf u=\partial_x(2xy)+\partial_y(x^2+y^2)=4y,\qquad \partial_xu_y-\partial_yu_x=2x-2x=0.
$$
Thus the flow is \b[irrotational but not incompressible] on the plane. A <velocity potential> satisfying $\mathbf u=\nabla\phi$ is
$$
\boxed{\phi=x^2y+\frac{y^3}{3}+C}.
$$
Indeed its two partial derivatives are the two velocity components. A usual two-dimensional <stream function> would satisfy $u_x=\psi_y$, $u_y=-\psi_x$ and hence have identically zero <divergence>. No such <stream function> exists on an open region where this <divergence> is not identically zero; the line $y=0$ is not a two-dimensional flow domain.