The documentation has a full section dedicated to inconsistent boundary conditions in PDEs.
Quoting it,
Occasionally, NDSolve
will issue the NDSolve::ibcinc
message warning
about inconsistent boundary conditions when they are actually
consistent. This happens due to discretization error in approximating
Neumann boundary conditions or any boundary condition that involves a
spatial derivative. The reason this happens is that spatial error
estimates (see "Spatial Error Estimates") used to determine how many
points to discretize with are based on the PDE and the initial
condition, but not the boundary conditions. The one-sided finite
difference formulas that are used to approximate the boundary
conditions also have larger error than a centered formula of the same
order, leading to additional discretization error at the boundary.
Typically this is not a problem, but it is possible to construct
examples where it does occur.
Then an example follows, and a possible solution using the Method
option's "TensorProductGrid"
suboption, which we can also apply to your problem.
When the boundary conditions are consistent, a way to correct this
error is to specify that NDSolve
use a finer spatial discretization.
k = 1/(5*(Pi^2));
soln = NDSolve[{
D[u[x, y, t], t] == k*(D[u[x, y, t], x, x] + D[u[x, y, t], y, y]),
u[x, y, 0] == y + Cos[Pi*x] Sin[2*Pi*y],
u[x, 0, t] == 0,
u[x, 1, t] == 1,
(D[u[x, y, t], x] /. x -> 0) == 0,
(D[u[x, y, t], x] /. x -> 1) == 0},
u, {x, 0, 1}, {y, 0, 1}, {t, 0, 1},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 20}}]
In this instance "MinPoints" -> 20
was sufficient to make the problem go away.
The same problem was discussed here. I vaguely remembered it, but it took me a while to find it again ...