I have experimented with setting constant Dirichlet constraints on 3D edges, but run into the error:
*** Warning: Found no facets matching domain for boundary condition.
and
*** Error: Unable to create Dirichlet boundary condition.
*** Reason: User MeshFunction is not a facet MeshFunction (dimension is wrong).
It seems to me that maybe this isn’t currently supported, or maybe I have gotten the syntax wrong. Can someone clarify if this should work?
My simple test script is below:
from fenics import *
from dolfin import *
mesh = BoxMesh(Point(0,0,0), Point(1,1,1), 10,10,10)
E = FiniteElement("P", mesh.ufl_cell(), 3)
V = FunctionSpace(mesh, E)
u = Function(V)
v = TestFunction(V)
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, Constant(0), boundary)
edge_function = MeshFunction("size_t", mesh, mesh.topology().dim()-2, 0)
class Edge(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0) and near(x[1], 0) and on_boundary
Edge().mark(edge_function,1)
bc_edge = DirichletBC(V, Constant(1), Edge())
a = dot(grad(u), grad(v))*dx
f = Constant(1.0)*v*dx
solve(a - f == 0, u, [bc, bc_edge])