Elasticity 2D answer not correct

12 months ago by

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.

Version: 1.6.0
import numpy as np
from dolfin import *

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)
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)
Community: FEniCS Project

1 Answer

12 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).
Thanks! It is resolved now.
written 3 months ago by Peter James  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »