I am trying to solve the following general Poisson equation with homogeneous Neumann boundary conditions in a rectangular domain ($0 \le x \le L$ and $0 \le y \le H$). $$ \frac{\partial^2 p(x,y)}{\partial x^2} + \frac{\partial^2 p(x,y)}{\partial y^2} = \, b(x,y) \\ \left( \frac{\partial p}{\partial y} \right)_{y=0}=0; \qquad \left( \frac{\partial p}{\partial y} \right)_{y=H}=0 \\ \left( \frac{\partial p}{\partial x} \right)_{x=0}=0; \qquad \left( \frac{\partial p}{\partial x} \right)_{x=L}=0 \\ $$ where $b(x,y)$ is a known source term function.
This general Poisson equation doesn't comply with the compatibility condition for all possibilities of $b(x,y)$. Then, the following change of variable is proposed: $$ p(x,y)=p^*(x,y)+F(x,y) $$ where $p^*(x,y)$ is a new variable and $F(x,y)$ is an arbitrary function that must satisfy:
$$ \left( \frac{\partial F}{\partial x} \right)_{x=L} = 0 \qquad (1)\\ \left( \frac{\partial F}{\partial x} \right)_{x=0} = 0 \qquad (2) $$
Applying this change of variable in the original problem, one can get to the following formulation:
$$ \frac{\partial^2 p^*(x,y)}{\partial x^2} + \frac{\partial^2 p^*}{\partial y^2} = \, b(x,y) - \frac{\partial^2 F(x,y)}{\partial x^2} - \frac{\partial^2 F(x,y)}{\partial y^2} \\ \left( \frac{\partial p^*}{\partial y} \right)_{y=0} = - \left(\frac{\partial F(x,y)}{\partial y}\right)_{y=0}; \qquad \left( \frac{\partial p^*}{\partial y} \right)_{y=H} = - \left(\frac{\partial F(x,y)}{\partial y}\right)_{y=H}\\ \left( \frac{\partial p^*}{\partial x} \right)_{x=0} = 0; \qquad \left( \frac{\partial p^*}{\partial x} \right)_{x=L} = 0 \\ $$
For this new problem, the following compatibility condition must be satisfied for this formulation to be mathematically well-posed:
$$ - \int_0^L \left(\left[\left( \frac{\partial F}{\partial y} \right)_{y=H} - \left( \frac{\partial F}{\partial y} \right)_{y=0}\right] \right) \, d x = \\ \int_0^H \int_0^L \, b(x,y) \, d x \, d y - \int_0^H \int_0^L \frac{\partial^2 F}{\partial x^2} \, d x \, d y - \int_0^H \int_0^L \frac{\partial^2 F}{\partial y^2} \, d x \, d y $$
After simplifications, one can arrive at the following equation: $$ \int_0^H \int_0^L \left( \, b(x,y) - \frac{\partial^2 F}{\partial x^2} \right)\, d x \, d y = 0 \qquad (3) $$
I am having trouble to find a function $F(x,y)$ that satisfies the compatibility equation (3) and the boundary conditions for the $x$ direction (1) and (2) described above. I need this function to guarantee that the problem is always well-posed.
You can simplify (3) even further. Using the fundamental theorem of calculus and (1)--(2): $$\int_0^H \int_0^L \left( \frac{\partial^2 F}{\partial x^2} \right)\, d x \, d y = \int_0^H \left( \frac{\partial F}{\partial x} \right)\bigg|_{x=0}^{x=L} \, d y = \int_0^H 0\,dy =0 $$ Thus, (3) says that $$\int_0^H \int_0^L b(x,y) \, d x \, d y = 0 $$ which is precisely the compatibility condition for the original equation. The introduction of $F$ did not win you anything.