Fix a boundary condition in one point

Good morning,

I was wondering about how to set a boundary condition just in one point of the boundary (this e.g. is needed for the Laplace problem with Neumann b.c.).
In particular, is this command correct?

Gamma = mesh.locate_entities_boundary(domain, dim=1, marker=lambda x: np.logical_and.reduce((
                                                                np.isclose(x[1], 0),  # y=0
                                                                np.isclose(x[0], 2))))# x=2
dofs_p = fem.locate_dofs_topological(W, 1, Gamma)
BCs = [fem.dirichletbc(PETSc.ScalarType(0), dofs_p, W)]

Thanks in advance.

The dimension should be zero (not 1), as you are restricting a vertex not an edge.

2 Likes