Specifying boundary conditions using tags

Hi,

I am working with fenicsx version 0.4.1 installed through Conda. I need to impose dirichlet bc on groups of boundaries which have been identified in the gmsh code as follows:

#bounday numbers identified by visual inspection
inner_bnd = [27, 28, 29, 30]
outer_bnd = [31, 32, 33 ,34]
boundaries = [inner_bnd, outer_bnd]
for k, boundary in enumerate(boundaries):
gmsh.model.addPhysicalGroup(1, boundary, tag = k+1) # create the main group/node

However, I am unable to set dirichlet boundary condition by referring to the groups through their tags 1 and 2. I managed to find some discussions around it but they are all using the legacy version. I would really appreciate if someone could help me out on this or point me to a tutorial that addresses it.

Thanks a lot

I would suggest that you start by inspecting the mesh and corresponding tags by writing them to XDMF.

Also, please note, that without a minimal example reproducing the issue it is really tricky to help you.

There are several examples of how to use the Gmsh api with dolfinx (v0.4.0, which should be compatible with 0.4.1) at: dolfinx-tutorial/chapter3 at v0.4.0 · jorgensd/dolfinx-tutorial · GitHub

Thanks a lot for your feedback. It nudged me to once more look into those tutorials and this time the epiphany happened! I was able to stitch code elements from multiple examples to achieve what I wanted.