411
views
1
12 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):
def sigma(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