Hello everyone,as shown, for the elasticity problem in a 2D area (left side fixed, horizontal traction applied on the right side), if the traction force is constant, the code is as follows:
from fenics import *
mesh = RectangleMesh(Point(0., 0.), Point(5, 5), 10, 10)
V = VectorFunctionSpace(mesh, "P", 1)
def left(x, on_boundary):
return near(x[0], 0) and on_boundary
boundary_mark = MeshFunction("size_t", mesh, 1)
class Rightboundary(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-14
return on_boundary and abs(x[0]-5) < tol
right = Rightboundary()
right.mark(boundary_mark, 1)
ds = Measure('ds', domain=mesh, subdomain_data = boundary_mark)
E = Constant(50e3)
nu = Constant(0.2)
mu = E/2/(1+nu)
lmbda = E*nu/(1+nu)/(1-2*nu)
def eps(v):
return sym(grad(v))
def sigma(v):
return lmbda*tr(eps(v))*Identity(2) + 2.0*mu*eps(v)
bc = DirichletBC(V, Constant((0, 0)), left)
T = 100
du = TrialFunction(V)
u_ = TestFunction(V)
a = inner(sigma(du), eps(u_)) * dx
l = dot(Constant((T, 0)), u_) * ds(1)
u = Function(V, name="Displacement")
solve(a == l, u, bc)
File("result/U.pvd") << u
If the traction force at each node is different (assuming from bottom to top, they are (T0, 0), (T1, 0), (T2, 0)…), how should it be handled? I hope to receive some help, thank you.