How to get vertices of interior boundary?

Hi, I tried to find some references on how to get vertices on…say…the interior boundary of a mesh but I couldn’t find anything.

The methods that I coded only work for the exterior boundary of a mesh. Here is a small working example of an outer disk which has an inner disk hole inside. I am interested in getting the vertices on the inner boundary.

import gmsh
from dolfinx import mesh
import numpy as np
from mpi4py import MPI
import dolfinx


class DiskwithHoleMesh():
	def __init__(self, 
              radius_inner = 0.3, 
              radius = 1.0, 
			  center = (0.0, 0.0), 
			  resolution: float = 0.005,
			  output_dir: str = './meshes', 
			  ):
		
		self.radius = radius
		self.center = center
		self.resolution = resolution
		self.name = 'disk' 
		self.radius_inner = radius_inner
		self.output_dir = output_dir

		if not os.path.exists(self.output_dir):
			os.makedirs(self.output_dir)


	def create_mesh(self, 
				 order: int = 1):

		domain = self.create_disk(self.name, order)

		return domain


	def create_disk(self, name: str = 'disk_with_hole', order: int = 1) -> gmsh.model:

		gmsh.initialize()
		model = gmsh.model()

		model.add(name)
		model.setCurrent(name)

		outer_sphere = model.occ.addDisk(self.center[0], self.center[1], 0, self.radius, self.radius)
	
		inner_sphere = model.occ.addDisk(self.center[0], self.center[1], 0, self.radius_inner, 
									  self.radius_inner)

		model_dim_tags = model.occ.cut([(2, outer_sphere)], [(2, inner_sphere)], 
								 removeObject=True, removeTool=True)

		model.occ.synchronize()

outer_surface = model.add_physical_group(2, [outer_sphere], tag=1)
		inner_surface = model.add_physical_group(2, [inner_sphere], tag=2)
		model.set_physical_name(2, outer_surface, "Outer Surface")
		model.set_physical_name(2, inner_surface, "Inner Surface")

		gmsh.option.setNumber("Mesh.CharacteristicLengthMin", self.resolution)
		gmsh.option.setNumber("Mesh.CharacteristicLengthMax", self.resolution)

		model.mesh.generate(2)
		gmsh.write(f"{self.output_dir}/{self.name}.msh")

		domain, cell_marker, facet_marker = dolfinx.io.gmshio.model_to_mesh(
			model, MPI.COMM_WORLD, 0, gdim=2)
		gmsh.finalize()

		return domain
	


disk_mesh = DiskwithHoleMesh(radius_inner=0.3, radius=1.0, resolution=0.05)
domain = disk_mesh.create_mesh(order=2)
disk_mesh.plot_mesh()

If I use the following function, it will only retrive the exterior boundary vertices.


    def get_boundary_vertices(self):
          
        boundary_vertices = mesh.locate_entities_boundary(
            self.domain, 0, check_coordinates)
        return boundary_vertices

There is another method called mesh.locate_entities, and which will not restrict the search to the boundary.

Since the interface is between marked with different tags, I would suggest:

  1. loop through all facets
    1.b get the facet to cell connectivity, check for cell tags and that they have two unique cell tags. Add to a list
  2. For the accumulated list of interface facets, use compute_incident_entities(mesh, entities, 1,0)

This has for instance done in: Get boundary points from custom cell tags - #4 by dokken