Given 3D Poisson equation $$ \nabla^2 \phi(x, y, z) = f(x, y, z) $$ and the right hand side and the domain, am I free to impose any boundary conditions (BC) on the function $\phi$, or do they have to be somehow consistent with the right hand side? In particular, if I impose periodic BC, will there be exactly one solution for any right hand side?
For example, let: $$ f(x, y, z) = - 3 \pi^{2} \sin{\left (\pi x \right )} \sin{\left (\pi y \right )} \sin{\left (\pi z \right )} $$ and I solve on a box $(0, 1)\times (0, 1) \times (0, 1)$. Now any solution must be a sum of $\phi_0+\phi_1$ where: $$ \phi_0(x, y, z) = \sin{\left (\pi x \right )} \sin{\left (\pi y \right )} \sin{\left (\pi z \right )}\,, $$ because $\nabla^2\phi_0 = f$, and $\phi_1$ is any harmonic function (i.e. $\nabla^2\phi_1 = 0$). Correct?
If I impose zero Dirichlet BC, then $\phi_0$ is the only solution, because it satisfies the BC, satisfies the equation and the solution must be unique. Correct?
What if I impose periodic BC? Does it mean that there will be some harmonic function $\phi_1$ such that $\phi_0+\phi_1$ satisfies the periodic BC and solves the equation? What is this $\phi_1$ explicitly in this case?