# NeumannValue and FiniteElement Methods : BC not respected

I have noticed on several of my personal cases some issue with the BC using NeumannValue. Let me illustrate the problem.

I take the 1D example of NeumannValue

un = NDSolveValue[{D[-u[x], x, x] + 10 u[x] == 1 + NeumannValue[-1 + u[x], x == 1],
DirichletCondition[u[x] == 0, x == 0]}, u, {x, 0, 1}]


then I check if I do verify the BC un[0] = 0. So that is a good thing for DirichletConditions (seems to work properly)

Now the Robin condition: un'[1] - (-1 + un[1]) = 0.00259342

It is not correct... Ok zero is a little hard to ask but at least it should be of the order of machine errors

Moreover, if I use NDSolve instead :

un = u /.NDSolve[{D[-u[x], x, x] + 10 u[x] == 1, u'[1] == -1 + u[1],u[0] ==0}, u,
{x, 0, 1}][[1]]


I get

un'[1] - (-1 + un[1]) = -3.16211*10^-7
un[0] = 0.


Have you encounter similar issue? how to fix it?

Thanks

• I continued Looking it up. It is possible to improve the result of NDSolveValue by reducing the mesh size : un = NDSolveValue[{D[-u[x], x, x] + 10 u[x] == 1 + NeumannValue[-1 + u[x], x == 1], DirichletCondition[u[x] == 0, x == 0]}, u, {x, 0, 1}, Method -> {"FiniteElement", "MeshOptions" -> {MaxCellMeasure -> 0.0001}}] Mar 11 '16 at 16:08
• I think you could post your comment as an answer for future reference. Mar 22 '16 at 2:03

## 1 Answer

The solution is, as you found out, to use a finer mesh:

un = NDSolveValue[{D[-u[x], x, x] + 10 u[x] ==
1 + NeumannValue[-1 + u[x], x == 1],
DirichletCondition[u[x] == 0, x == 0]}, u, {x, 0, 1},
Method -> {"FiniteElement",
"MeshOptions" -> {MaxCellMeasure -> 0.0001}}];
un'[1] - (-1 + un[1])
1.10517*10^-8