This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Marking a point on the boundary

+1 vote

I am trying to solve a coupled allen cahn and equilibrium equation over a rectangular domain. coordinate of left bottom corner is ( 0, -h) and the coordinate of the right top corner is ( 4h, h). Therefore, the origin is located in the middle of left side. I want to fix the displacement in both direction right at the origin, set the x displacement on left side, apply the external displacement on the right side. Other two sides are traction and displacement free. To mark the boundary I did the following, but I got the error : " Found no facets to apply boundary conditions " mesh is imported from CGAL and works perfect.

I was wondering if anyone can help me to resolve this problem.

domain = Rectangle(0,-1*h, 4.5*h, h)
mesh = Mesh(domain, 100)
# Define boundary conditions and mark the subdomains of boundary
subdomains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
subdomains.set_all(0)
# Sub domain for whole boundary
class Wholeboundary(SubDomain):
    def inside(self, x, on_boundary):
       return on_boundary
# Sub domain for left side
 class Left(SubDomain):
     def inside(self, x, on_boundary):
         return on_boundary and abs(x[0]) < tol_b  
 # Sub domain for bottom side
  class Fix(SubDomain):
     def inside(self, x, on_boundary):
         return on_boundary and abs(x[0]) < tol_b and abs(x[1]) < tol_b 
  # Mark All facets of boundary as sub domain 0
   wholeboundary = Wholeboundary()
   wholeboundary.mark(subdomains, 0)
  # Mark left boundary as sub domain 1
   left = Left()
   left.mark(subdomains, 1)
   # Mark the fix point ofthe boundary as sub domain 2
   fix = Fix()
   fix.mark(subdomains, 2)
   # Defining boundary conditions on left side and fix point
   Gamma_0 = DirichletBC(V.sub(0), Constant(0.), subdomains, 1, method="topological")
   Gamma_1 = DirichletBC(V.sub(1), Constant(0.), subdomains, 2, method="topological")
   u_R = Constant((-1*u_app,0.0))
      def right_boundary(x, on_boundary):
     return on_boundary and abs(x[0]-4.5*h) < tol_b
   Gamma_2 = DirichletBC(V, u_R, right_boundary)
    # All boundary conditions
    bcs = [Gamma_0, Gamma_1, Gamma_2]
asked Aug 22, 2014 by Navid Mozaffari FEniCS Novice (510 points)

1 Answer

+1 vote

Hi, firstly does your mesh actually have a vertex at the origin? If not, I don't think this will work at all.
Secondly, for a pointwise constraint you need pointwise BCs:

DirichletBC(V.sub(1), Constant(0), Fix, method="pointwise")
answered Aug 26, 2014 by mwelland FEniCS User (8,410 points)
How to create a DirichletBC on a single vertex or DOF?
...