I would like to solve a nonlinear integro-differential equations on a 2D square domain $\Omega$ subject to Neumann boundary conditions using finite differences: $$\frac{\partial u}{\partial t} = f(u) + \int_\Omega G(x'-x)\left[u(x')-u(x)\right] dx'.$$

The variable $u(x,t)$ depends on space and time, $f$ is a nonlinear function and $G$ is the integral kernel. Neumann (also called no-flux or reflective) boundary conditions are given as $$ \frac {\partial u}{\partial x}\Bigr|_{\partial\Omega} = 0$$ at the boundary $\partial\Omega$.

Solution Attempt

Usually to implement Neumann boundary conditions, it is either possible to use ghost cells or modify the stencil. Let's try the latter. Starting from the heat (or diffusion) equation in 1d, we know the $2^{nd}$ derivative can be discretized as follows: $$ \Delta u \rightarrow \frac{u_{i+1}-2u_i+u_{i-1}}{h^2}=\frac{1}{h^2}\left((u_{i+1}-u_i)+(u_{i-1}-u_i)\right),$$

where $u_i$ is shorthand notation for $u(x_i)$ and $h$ is the uniform distance between neighboring points.

With $G=1/h^2$, this formula can be rephrased as a discretized version of the integral equation from the top: $$ \sum_{j=i-1}^{i+1} G(x_j-x_i)\left[u_j - u_i\right].$$

Differences that involve points $x_j$ outside the domain are zero, due to the Neumann boundary condition: $$ \frac {\partial u}{\partial x}\Bigr|_{\partial\Omega} \rightarrow \frac{u_j-u_i}{h} \overset{!}{=} 0.$$

Pseudo C code might look like this:

for(j=max(0,i-n); j<min(n-1,i+n); j++){
   uIntegro[i] += G[j-i]*u[j];


Coming back to the original problem, given that the integral kernel ranges beyond the first neighbor, let's say it takes into account the first 5 neighbors, is it correct to just set all differences in the integral involving outside points to zero in order to realize Neumann boundary conditions (in 2d as well)? Bonus: If this is not Neumann, what would it be called instead?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.