Elasticity 2D answer not correct


160
views
0
3 months ago by
Hi,

I am novice to FEniCS. I am trying to solve the 2D elasticity problem. I have not applied any body force. I have just applied a Dirichlet BC on right and fixed the left edge of a square plate. I expect a linear varying displacement. But I am not getting it. I am getting constant displacement throughout the domain. Please find the code and help me.

Thanks
Version: 1.6.0
import numpy as np
from dolfin import *


mesh=UnitSquareMesh(5,5)
V = VectorFunctionSpace(mesh,'P',1)
E = 10e5
nu = 0.28
tol = 1e-14
mu = E/(2*(1+nu))
lamb = E*nu/((1+nu)*(1-2*nu))

def clamped_boundary(x,on_boundary):
    return on_boundary and x[0]<tol

bc1 = DirichletBC(V,Constant((0,0)),clamped_boundary)

def right(x,on_boundary):
    return on_boundary and (x[0]-1)<tol

bc2 = DirichletBC(V.sub(0),Constant((1.0)),right)
bc=[bc1,bc2]
def epsilon(u):
    return 0.5*(grad(u)+grad(u).T)
def sigma(u):
    return lamb*(tr(grad(u))*Identity(d))+2*mu*epsilon(u)

u = TrialFunction(V)
d = u.geometric_dimension()
v = TestFunction(V)
form = inner(sigma(u),epsilon(v))*dx 
a = lhs(form)
L = rhs(form)
u = Function(V)
solve(a == L,u,bc)
u1,u2=u.split()
plot(u,mode='displacement',interactive=True)
​
Community: FEniCS Project

2 Answers


7
3 months ago by
The problem is that in your definition of right, every point satisfies  the condition (x[0]-1)<tol.
You should use abs(x[0]-1)<tol or, better yet, near(x[0], 1).
0
3 months ago by
Thanks. It is resolved now.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »