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

Applying DirichletBCs/Creating FacetFunctions

0 votes

I have a dolfin xml file created by "dolfin-convert"-ing an Abaqus inp file. It has the mesh as well as the subdomains defined in the same file. For example, one such subdomain has lines like this:

<mesh_value_collection name="collection1" type="uint" dim="0" size="1508"> <value cell_index="6774" local_entity="0" value="1"/>"

I want to apply DirichletBC's on certain mesh_value_collections, which i understand are accessed via mesh.mesh_domains(). I'm confused how to create a FacetFunction to apply boundary conditions. I've tried

bcs_mesh = MeshFunction("size_t", mesh, 2, mesh.domains())

and then created a boundary condition like

bc = DirichletBC(V, Constant(0.0), bcs_mesh, 1)

where here, I want the dirichletBC applied to subdomain '1'. But I get this error:

Warning: Found no facets matching domain for boundary condition.

which clearly tells me I'm not applying boundary conditions correctly. Can someone explain this to me?

I'm having a hard time finding good documentations for BCs and MeshFunctions, etc. I consider myself pretty good at Python, but the logic of these classes are confusing to me.

asked Oct 20, 2016 by joshuawchen FEniCS Novice (200 points)

1 Answer

+1 vote

You can try saving your MeshFunction to file (e.g. as a ".pvd") and visualising with Paraview. You should be able to see which facets are set to value 1 then.

answered Oct 20, 2016 by chris_richardson FEniCS Expert (31,740 points)
...