Boundary Conditions for BDM elements


I have a question on the implementation of the Dirchlet boundary conditions inside FEniCS. It is to my understanding the tangent component of the basis function should be allowed to float freely. Is this handled internally inside FEniCS?

Using a DirichletBC with a BDM-element only fixes the normal component. You can see this e.g. in this example:

from dolfin import *
import tabulate

mesh = UnitSquareMesh(50,50)
W = FunctionSpace(mesh, 'BDM', 3)

bc = DirichletBC(W, Constant((0,0)), 'on_boundary')

x = SpatialCoordinate(mesh)
n = FacetNormal(mesh)
t = as_vector([-n[1], n[0]])

f = project(as_vector([x[0]*x[0], x[1]*x[1]]), W)

f_bc = f.copy(True)

print(tabulate.tabulate([['before DirichletBC', assemble(dot(f,n)**2 * ds), assemble(dot(f,t)**2 * ds) ], ['after DirichletBC', assemble(dot(f_bc,n)**2 * ds), assemble(dot(f_bc,t)**2 * ds)]], headers=['', 'normal component', 'tangential component']))