Knowing $\vec{g}$, how can above equation be solved for $f$? There is a symmetry in $\phi$ in spherical coordinate, so the equation is a 2D equation. Also, $\vec{g}$ is a complete curl. Could anyone please help me?
more information $\vec{f}$ could be written as $\nabla h(r,\theta)$. Boundary condition:
$\vec{f}_r=0$ at infinity. $f_r(r=1)= - A$
which $A$ is a constant.
If more is needed:
$g_\theta(r,\theta) = \sin \theta (1-\frac{\sin \theta }{2 r^2})-\frac{\alpha \sin ^2 \theta \cos \theta}{r^4}$
$g_r(r,\theta) = -\cos \theta (1-\frac{1}{ r^3})+\frac{3\alpha}{2r^2}(\frac{1}{r^2}-1)(\cos^2 \theta-\frac{1}{3})$
I think without explicit expression for $\vec {g} \cdot \vec {f} $ you are left with trivial solutions for example $ f=0$
Take any continuously differentiable vector field $\vec{f}(r,\theta)$ with a compact support then by Helmholtz decomposition :
$ f= \nabla h + \nabla $ x $ z $
$\nabla^2 h= \vec {g} \cdot \vec {f} $ which is Poisson equation and solution exists given the conditions we have on $\vec {g} $ and $\vec {f} $