### Boundary condition for an linear elastic problem

Good evening every one,

I am new in Fenics and I try to solve an elastic problem.

As it is classical in solids mechanics, I would like to prescribe the displacement in one direction (say x) and force in the two others directions (say y and z) on the same boundary (prescribed normal displacement and no friction contact in a compression test for example).

I do not find in the fenics tutorial how to prescribe boundary condition for only one component of the displacement.

It is necessary to define three trial functions (Ux, Uy and Uz) for the displacement field or does it exist a command to do that ?

I apologize if the question has already been asked and I than you in avance for your answer.

Xavier

### 2 Answers

`u`

is in
`V = VectorFunctionSpace(mesh, 'P', 1)`

Then, you prescribe the boundary condition for the first component as

`bc = DirichletBC(V.sub(0), Expression(...), 'on_boundary')`