# Role of boundary conditions (e.g. periodic) in Poisson equation

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?

• Technically, this question is more appropriate for math.SE. – David Ketcheson Apr 25 '13 at 14:41
• I didn't mention it in the question explicitly, but I implicitly assume in the context of a finite element based numerical solver (that's why I am interested in the answer), but the question itself is indeed general. – Ondřej Čertík Apr 25 '13 at 15:24

From a numerical perspective, it's perhaps easiest to discuss the discretizations directly.

For the Poisson equation with homogeneous Dirichlet boundary conditions, there is a unique solution for any right-hand side. Once discretized, the equation can be written in the form $Ax = b$, where $A$ is the standard discretization of the 3D Laplacian operator with Dirichlet boundary and $b$ is a standard discretization of $f$. Since $A$ is positive definitive, it is invertible, and the system will have a unique solution for any $b$, and thus any $f$.

There are, of course, the usual issues with undersampling; if two different values of $f$ give rise to the same discretization due to use of a coarse grid or due to discontinuities in $f$, there may be some ambiguity about what system is actually being solved. But provided the discretization of $f$ is well-behaved, a meaningful unique solution will exist.

The situation is slightly more complicated in the case of periodic boundary conditions because the standard discretization of the 3D Laplacian operator with periodic boundary is positive semidefinite and has a one-dimensional kernel $K$ comprising solutions of the form $x \equiv C$ with $C$ constant.

Because $A$ is still symmetric in the periodic case, we have that $\operatorname{Range} A = K^\perp$, and so $Ax = b$ will not have a solution unless $\mathbf{1} \cdot b = 0$, where $\mathbf{1}$ is the vector consisting of all 1s. This provides the consistency condition for the right-hand side in discretized form.

Note that, analytically, there is a somewhat simpler way to look at it. Recall that, for $\phi \in C^2(\Omega)$, where $\Omega$ is our domain, we have $$\int_\Omega \Delta \phi \, dx = \int_{\partial \Omega} \frac{\partial \phi}{\partial \mathbf{n}}\, dS.$$ If we stipulate a periodic boundary condition on $\phi$, then the boundary term in the right-hand side disappears, and we're left with $$\int_\Omega \Delta\phi\, dx = 0.$$ So if $\phi$ satisfies $\Delta \phi = f$, it immediately follows that we must have $$\int_\Omega f\, dx = 0.$$ This is the analytical analog to $\mathbf{1} \cdot b = 0$, as both are expressing the fact that the average value of $f$, and thus $b$, over the domain must be zero.

• John, thank you so much for this amazing answer! It provides a clear insight into how it works. I felt that there is a catch for the periodic condition, but couldn't quite point a finger on it. Thanks again. – Ondřej Čertík Apr 26 '13 at 6:40

I know its been 2 years.. but here is an example from physics to hammer it home. Consider you are solving the Poisson equation: $$\nabla^2\phi =f$$for electrostatic potentials(ϕ) with the right hand side: $$f=(-ρ/εo)$$ And, ρ(the charge density) is specified at all the grid points.

Statement: For Periodic solution, the ∫ρdv=0 condition (described by Ben above) sets the system to be net neutral. This is a nice (physical) way to think about average value of f over the periodic box.

Now let's test this statement. For periodic boundary conditions, the integral of the Electric field has to be zero over the surface of the box (you can always find pairs of points on the box surface canceling each other out in the integral).

Then by divergence theorem (gauss law), the box should be neutral and this is what we set out to prove. $$\oint_S {E_n dA = \frac{1}{{\varepsilon _0 }}} Q_{inside} =0$$

A little bit of physics here, but I think it provides a nice reinforcement to the discussion here.

Need to be careful specifically in generating method of manufactured solutions for Poisson's equation. Since definition of the source term has to satisfy the strong form of the PDE as well as the weak form of the PDE. The derivation given above is basically using the weak form of the PDE. In other words, there is a relation between the gradient of the solution at the boundary and the source term integral on the domain.