Given a curve $(x, a(x))$ in $\mathbb{R}^2$, I am looking for a scalar potential $V(x, y): \mathbb{R}^2 \rightarrow \mathbb{R}$ that has a specific gradient along that curve. The gradient along the curve is given by \begin{equation} \dfrac{\partial V}{\partial x}(x, a(x))=0, \quad \dfrac{\partial V}{\partial y}(x, a(x)) = b(x) \end{equation} where $b: \mathbb{R} \rightarrow \mathbb{R}$ is a given function.
Context
This problem arises when one tries to derive the potential elastic energy of an elastic structure with two degrees of freedom $x$ and $y$ given its equilibrium path. The equilibrium path is the set of all the static equilibrium states the structure can be in when a force acts on it. This path can be represented by a curve in a three-dimension space: two dimensions for the degrees of freedom ($x$ and $y$), and a third dimension for the force $F$ acting on one of the degree of freedom ($y$ in this case). Each triplet of points $(x, y=a(x), F=b(x))$ corresponds to a static configuration of the structure.
When on tries to find the equilibrium path of an elastic structure whose elastic energy is given by $V(x, y)$, the classic approach consists of forming the total potential energy $\Pi$ defined as $$\Pi = V(x, y) - Fy\text{,}$$ where $F$ represents the external force acting on the degree of freedom $y$. We consider the case where no external force acts on the degree of freedom $x$.
The static equilibrium states ($x$, $y$, $F$)=($x$, $a(x)$, $b(x)$) are the stationary points of the potential $\Pi$ (w.r.t the variables $x$ and $y$), which leads to the following set of equations \begin{equation*} 0=\dfrac{\partial V}{\partial x}(x, a(x)),\quad 0=\dfrac{\partial V}{\partial y}(x, a(x)) - b(x)\text{.} \end{equation*}
This question is closely related to this other post I wrote in a very confusing way (I reformulated it to avoid confusion) Finding a scalar potential given its set of stationary points