### Prescribed displacement on one point

390

views

0

Hello,

I'am trying to prescribed a Dirichlet boundary condition on only one point located on the boundary of a body.

I use the following script (I report only the part of the script in which I try to prescribe the boundary condition, the rest of the script is classical and works well).

def P0(x, on_boundary):
Why do you supply three arguments to the near() function? I'm not very experienced with Fenics yet, but thus far I have only seen it used with two arguments, where the first one describes the coordinate and the second the point on the coordinate (so in your case just scrapping the tol argument). This way I have successfully implemented a prescribed displacement Dirichlet boundary condition for a single point.

I'am trying to prescribed a Dirichlet boundary condition on only one point located on the boundary of a body.

I use the following script (I report only the part of the script in which I try to prescribe the boundary condition, the rest of the script is classical and works well).

def P0(x, on_boundary):

tol = 1.0E-14

return on_boundary and near(x[0], 0, tol) and near(x[1], 0, tol) and near(x[2], 0, tol)

bc_P0 = DirichletBC(V, Constant((0, 0, 0)) , P0)

And I obtained the following error:

*** Warning: Found no facets matching domain for boundary condition.

It seems that the definition of a boundary does not work for only one point.

If someone can help me, it would be great.

Thank you in avance

Xavier

Community: FEniCS Project

written
12 months ago by
Alexandra K. Diem

### 4 Answers

4

Something like this worked for me:

```
P0 = 'near(x[0], 0.0) && near(x[1], 0.0) && near(x[2], 0.0)'
bc_P0 = DirichletBC(V, Constant(0.0, 0.0, 0.0), P0, 'pointwise')
```

0

0

pointwise can work.

like

like

```
class Pinpoint(SubDomain):
def __init__(self, coords):
self.coords = np.array(coords)
SubDomain.__init__(self)
def move(self, coords):
self.coords[:] = np.array(coords)
def inside(self, x, on_boundary):
return np.linalg.norm(x-self.coords) < DOLFIN_EPS
```

0

Please login to add an answer/comment or follow this question.