How is the dirichletbc implemented in dolfinx?

In Gmsh, when creating physical boundaries, it automatically assigns IDs:

Physical Curve("block", 561) = {1:4};

In the old version of dolfin, DirichletBC can be applied on the boundary using these IDs:

bcT = DirichletBC(V, Constant(0.0), boundary, 561)

However, in dolfinx, I’m not sure how to achieve this. I have learned that the new dirichletbc requires DOF parameters. How can I obtain these parameters using the boundary IDs from Gmsh and implement the dirichletbc ? I appreciate any help. Below is part of my code (for a quadrilateral mesh):

# Create mesh and define function space
mesh, cell_markers, facet_markers = gmshio.read_from_msh("trapezoid.msh", MPI.COMM_WORLD, gdim=2)
V = functionspace(mesh, ("CG", 1))

# Define boundary condition
bcT = dirichletbc(VT, Constant(0.0), facet_markers, 561)

Please consider the tutorials
https://jsdokken.com/dolfinx-tutorial/chapter3/robin_neumann_dirichlet.html#debugging-boundary-condition

2 Likes

Thank you for your help, I have solved my issue based on this tutorial