dries
August 10, 2022, 2:09pm
1
Hi. I am trying to model 2D simply supported beam in Fenics but I am getting “Warning: Found no facets matching domain for boundary condition”. Thank you.
The code is below.
# Boundary conditions
leftsup = CompiledSubDomain("(near(x[0], 0.0) && near(x[1], 0.0))")
rightsup = CompiledSubDomain("(near(x[0], 40.0) && near(x[1], 0.0))")
leftload = CompiledSubDomain("(near(x[0], 10.0) && near(x[1], 4.0))")
rightload = CompiledSubDomain("(near(x[0], 30.0) && near(x[1], 4.0))")
load = Expression("t", t = 0.0, degree=1)
bcleftsup= DirichletBC(W, Constant((0.0,0.0)), leftsup, "pointwise")
bcrightsup= DirichletBC(W, Constant((0.0,0.0)), rightsup, "pointwise")
bcleftload = DirichletBC(W.sub(1), load, leftload, "pointwise")
bcrightload = DirichletBC(W.sub(1), load, rightload, "pointwise")
bc_u = [bcleftsup, bcrightsup, bcleftload, bcrightload]
boundaries = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
boundaries.set_all(0)
leftload.mark(boundaries,1)
rightload.mark(boundaries,2)
ds = Measure("ds")(subdomain_data=boundaries)
n = FacetNormal(mesh)
nate
August 10, 2022, 2:10pm
2
dries
August 11, 2022, 1:16pm
3
I edited my post. Could you please answer my question now?
nate
August 11, 2022, 1:18pm
4
Your code is incomplete. Your error message states:
“Warning: Found no facets matching domain for boundary condition”
which is an issue with your geometry. But we cannot help without seeing how your mesh is defined.
dries
August 11, 2022, 1:23pm
5
Thank you. This is how I defined my mesh.
# mesh
from dolfin import *
mesh = Mesh('beam.xml')
# Define Space
V = FunctionSpace(mesh, 'CG', 1)
W = VectorFunctionSpace(mesh, 'CG', 1)
WW = FunctionSpace(mesh, 'DG', 0)
p, q = TrialFunction(V), TestFunction(V)
u, v = TrialFunction(W), TestFunction(W)
dokken
August 11, 2022, 2:45pm
6
As you are using an xml file one cannot reproduce your issue.
I would suggest you write
dries:
boundaries = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
boundaries.set_all(0)
leftload.mark(boundaries,1)
rightload.mark(boundaries,2)
boundaries
to file and visualize in paraview to make sure it works as expected.
Similarly you should mark the other boundaries as well to make sure they do what they expect.
1 Like
dries
August 11, 2022, 3:15pm
7
When I do that, I just see the mesh. The boundaries are not present.
dokken
August 11, 2022, 3:23pm
8
That means that your markers are not working as you think they should.
This means that you need to either:
Revisit the creation of the mesh, and for instance import markers from the xml
/xmdf
file of the mesh directly.
Rethink your markers, as they are not marking anything, are you sure they are expressing the correct condition.
1 Like