### Restrict three faces of the cube from moving in its normal directions through Dirichlet BC

169

views

0

Hi there ,

I am trying to solve a nonlinear elasticity problem on a unit cube mesh. I want the cube to contract freely because i want to compare results of my solution with an earlier done work.

For free contraction i must apply Dirichlet BC so that i can restrict three faces of the cube from moving in its normal directions. Although i am able to apply BC but i am not getting correct results. Here is how i have applied the BC

I am trying to solve a nonlinear elasticity problem on a unit cube mesh. I want the cube to contract freely because i want to compare results of my solution with an earlier done work.

For free contraction i must apply Dirichlet BC so that i can restrict three faces of the cube from moving in its normal directions. Although i am able to apply BC but i am not getting correct results. Here is how i have applied the BC

```
from dolfin import*
mesh = UnitCubeMesh (10,10,10)
U = VectorFunctionSpace(mesh,"Lagrange", 2) # Function Space for displacement
def boundary_Left(x, on_boundary):
tol = 1E-14
return near(x[0], 0, tol)
def boundary_Base(x, on_boundary):
tol = 1E-14
return near(x[1], 0, tol)
def boundary_Rear(x, on_boundary):
tol = 1E-14
return near(x[2], 0, tol)
# Restrict three faces of the cube from moving in its normal directions
bc_L = DirichletBC(U.sub(0), 0.0, boundary_Left)
bc_B = DirichletBC(U.sub(1), 0.0, boundary_Base)
bc_R = DirichletBC(U.sub(2), 0.0, boundary_Rear)
bcs = [bc_L, bc_B, bc_R]
```

If you people think that i have done it correctly that please do mention.

I would be thankful for some guidance (with respect to the result that i want to achieve from BC i.e. 'restricting three faces of the cube from moving in its normal directions')

Regards.

Community: FEniCS Project

### 1 Answer

3

May be this will help

```
left = CompiledSubDomain("near(x[0], side) && on_boundary", side = 0.0)
bottom = CompiledSubDomain("near(x[1], side) && on_boundary", side = 0.0)
rear = CompiledSubDomain("near(x[2], side) && on_boundary", side = 0.0)
```

```
bcl = DirichletBC(U.sub(0), Constant(0.0), left)
bcb = DirichletBC(U.sub(1), Constant(0.0), bottom)
bcr = DirichletBC(U.sub(2), Constant(0.0), rear)
bcs = [bcl, bcb, bcr]
```

thanks let me try the code with this BC

written
6 months ago by
Ovais

yes , the boundary condition is working. But i am still getting the same results. At least that confirms that my boundary condition wasnt wrong.

thanks for your response.

thanks for your response.

written
6 months ago by
Ovais

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