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

Is there an efficient way to preserve the GMSH boundary numbering scheme on submeshes generated from the global mesh?

+1 vote

I want to find a way to efficiently transfer the number scheme for the boundaries I have specified in GMSH to two submeshes I've generated using the following code:

submesh1 = SubMesh(mesh, subdomains, 1)
subdomain1 = CellFunction("size_t", submesh1)
boundaries1 = FacetFunction("size_t", submesh1)

V1 = FunctionSpace(submesh1, "CG", 1)
dx1 = Measure("dx", domain=submesh1)

submesh2 = SubMesh(mesh, subdomains, 1)
subdomain2 = CellFunction("size_t", submesh2)
boundaries2 = FacetFunction("size_t", submesh2)

V2 = FunctionSpace(submesh2, "CG", 1)
dx2 = Measure("dx", domain=submesh2)

If it helps, I have generated a global mesh in GMSH and I have identified several boundaries--in particular an interfacial boundary between subdomain1 and subdomain2 and two Dirichlet boundaries I want to specify on subdomain 1. Is there an efficient way to do this?

Thanks!

asked Feb 25, 2017 by treblebrewing FEniCS Novice (760 points)

1 Answer

0 votes
 
Best answer

I've been trying to address this question on and off recently, and I'm now wondering if statements like

boundaries1 = FacetFunction("size_t", submesh1)
parent_IDs = boundaries1.data().array('parent_vertex_indices', 0)
boundaries1 = [rename_boundaries.array()[i] for i in range(len(parent_IDs))]

or something like this could be used to obtain the mapping between a FacetFunction() that identifies boundary surface labels on the main or "global" mesh and the surfaces of a submesh.

For example, a smaller cube immersed in a larger cube. If I use GMSH to explicitly label two faces of the larger cube, then I make a submesh of each domain (the larger cube sans the smaller one for the first submesh and the smaller cube for the second), how do I identify the labels from the main mesh to the submesh in order to apply them during my solution process?

answered May 2, 2017 by treblebrewing FEniCS Novice (760 points)
selected May 26, 2017 by treblebrewing
...