# Discretization Neumann boundary condition

I'm currently working with the following Poisson equation with mixed boundary conditions, including a Neumann boundary condition.

$$\Delta u = f\\ u(x,0) = g_1(x), 0

on the domain $$\Omega := \{(x,y):\mathbb{R}^2_+:x+y<1\}$$

As far as I understand, $$\partial_n u(x, 1-x)=\nabla u \cdot n$$. Now I'm somewhat confused as to how this should be discretized. How does one obtain the normal vector $$n$$? I think I've seen a discretization using centered finite differences, which looked like this:

$$\partial_n u_{i,j}= \frac{u_{i+1,j}-u_{i-1,j}+u_{i, j+1}-u_{i, j-1}}{2\Delta x}$$

but how does this discretization account for the normal vector $$n$$ in the Neumann BC?

Also, here I have not just $$\partial_n u(x, y) = 0$$ but $$\partial_n u(x, 1-x) = 0$$. So I'm puzzled as to how to discretize this. It is suggested to do so using the Shortley-Weller approximation, but I don't yet quite understand how it works (haven't seen it in action and couldn't find good literature on how exactly this method works mathematically).

So, in my understanding, this can look like this:

$$\partial_n u(x, 1-x)_{|\Delta x}=\partial_n u_{i,1-i}=\frac{u_{i+1,1-i}-u_{i-1,1-i}}{2\Delta x}+\frac{u_{i, 2-i}-u_{i, -i}}{2(1-\Delta x)}$$

Is this correct? How can this be implemented in an algorithm?

Would appreciate some help.

The formula you show is not a general formula for the Neumann Boundary Condition, it is already projected onto $$\mathbf{n}$$. To see this, note that the gradient in finite difference approximation (with central differences) is given by:

$$\boldsymbol{\nabla}f=\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)\approx\left(\frac{f_{i+1,j}-f_{i-1,j}}{2\Delta x}, \frac{f_{i,j+1}-f_{i,j-1}}{2\Delta y}\right)$$

And the boundary over which you are taking the NBC is: $$\Omega=\{(x,y)\in\mathbb{R}^2: y=1-x, 0\leq x\leq 1\}$$ (Note: I am taking the set to be closed because boundaries of sets in $$\mathbb{R}^n$$ are closed and the set you used is neither open nor closed). The plot of this boundary is shown below. As you can see, the vector $$\mathbf{n}=(1,1)$$ is normal to the line, and it is easy to see that in that case $$\Delta y = \Delta x$$ (because it is a line with slope 1). Finally, we verify the formula you posted:

$$\boldsymbol{\nabla}u\cdot\mathbf{n}\approx \left(\frac{u_{i+1,j}-u_{i-1,j}}{2\Delta x}, \frac{u_{i,j+1}-u_{i,j-1}}{2\Delta y}\right)\cdot(1,1)=\left(\frac{u_{i+1,j}-u_{i-1,j}}{2\Delta x}, \frac{u_{i,j+1}-u_{i,j-1}}{2\Delta x}\right)\cdot(1,1)=\frac{u_{i+1,j}-u_{i-1,j}+u_{i,j+1}-u_{i,j-1}}{2\Delta x}$$

• Don’t you want the normal to have unit length. Here the condition is homogeneous, but for non-homogeneous you need it, right? – VorKir Feb 23 '19 at 3:05
• I am not sure what you mean by homogeneous. You could take it to be unitary if you want, but you are taking $\boldsymbol{\nabla}\cdot\mathbf{n}=0$ so it is equivalent because $0\cdot\sqrt{2}=0$ (or any real number for that case). As long as it's a Neumann condition (equal to 0) the norm of the vector is in theory unimportant. BUT if you took a vector $\mathbf{n}$ with arbitrary norm then you could have numerical errors if $||\mathbf{n}||$ is very large or very small. – user30058 Feb 24 '19 at 4:56
• What do you call then the condition when the righthand side is nonzero? Certainly it's a matter of wording. But for me much more common is the usage of Neumann condition as the condition on the normal derivative, homogeneous or not depending on whether the rhs is zero or not – VorKir Feb 24 '19 at 5:29
• Ah, so by non-homogeneous you mean "$\neq 0$" like in differential equations. In that case I believe that the name "Neumann Boundary Condition" no longer applies. I do not know about the general case, but in heat transfer you have a restriction on the heat-flow as if it were subjected to convection (called, quite naturally, Convective Boundary Condition). In CBC, you have that $\boldsymbol{\nabla}\cdot\mathbf{n}\neq 0$. As far as I know the NBC is the "homogeneous case" and you could take the "non-homogeneous case" as a CBC with variable convection coefficient. – user30058 Feb 24 '19 at 14:25