In a fluid dynamics problem appears a stream function $f(x,y)$ which is defined by the following system
$$\begin{align} &\frac{\partial f}{\partial x}=\frac{g'(x)f(x,y)-a_1}{1-g(x)} \\ &\frac{\partial f}{\partial y}=\frac{a_2}{1-g(x)} \end{align}$$
where $a_1$ and $a_2$ are constants and $g(x)$ some arbitrary function of $x$. I would like to find a general procedure in order to express $f(x,y)$ in terms of the arbitrary function $g(x)$ and the variable $y$, i.e. $f(x,y)=F(g(x),y)$.