Dear all,
I am trying to solve a boundary problem. As I understand, one way to do that is to apply "boundary conditions" on the interior of the domain, somehow in the opposite way as boundary conditions are commonly used. I first try on vectors before solving a system. I face the problem that the boundary condition that I declare on the interior of the domain (i.e. "not on_boundary") are also applied on the domain boundary. Am I doing something wrong ?
Here is my test code:
from dolfin import *
mesh = RectangleMesh(0, 0, 1, 1, 10, 10)
V = FunctionSpace(mesh, "CG", 1)
def inside(x, on_boundary):
return not on_boundary
u_in = Constant(-1.0)
bc_in = DirichletBC(V, u_in, inside)
u = Function(V)
u.vector()[:] = 0.5
bc_in.apply(u.vector())
plot(u, axes=True)
interactive()
Here is the output:
I would have expected the domain boundary to be 0.5 everywhere, but apart from 2 corners it has taken the -1.0 value of the interior...