from fenics import *
from mshr import *
L = 2
H = 0.067
b = 1
EI = 5e6
Ny = 3
Nx = Ny * 30
beam = RectangleMesh(Point(0, 0), Point(L, H), Nx, Ny)
beam.init()
def eps(v):
return sym(grad(v))
E = Constant(200e9)
nu = Constant(0.3)
model = “plane_stress”
mu = E/(2*(1+nu))
lmbda = Enu/(1+nu)/(1-2nu)
if model == “plane_stress”:
lmbda = 2mulmbda/(lmbda+2*mu)
def sigma(v):
return lmbdatr(eps(v))Identity(2) + 2.0mueps(v)
f = 0
w = 4e3
P = 6e3
f_thernal = Constant((0, -f))
T_plane = Constant((0, -w))
T_point = Constant((0, -P))
V = VectorFunctionSpace(beam, “CG”, 2)
tol = 1E-14
class Top(SubDomain):
def inside(self, x, on_boundary):
return near(x[1], H) and on_boundary
class Left(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0) and on_boundary
class Point(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], L) and near(x[1], H) and on_boundary
boundaries = MeshFunction(“size_t”, beam, 1)
left = Left()
pt = Point()
top = Top()
boundaries.set_all(0)
top.mark(boundaries, 1)
left.mark(boundaries, 2)
pt.mark(boundaries, 3)
ds = Measure(“ds”, domain=beam, subdomain_data=boundaries)
du = TrialFunction(V)
u_ = TestFunction(V)
a = inner(sigma(du), eps(u_))*dx
left_end_displacement = Constant((0.0, 0.0))
bc = [DirichletBC(V, left_end_displacement, boundaries, 2), DirichletBC(V, T_point, pt, method=“pointwise”)]
l = inner(f_thernal, u_)*dx + dot(T_plane, u_)*ds(1) + dot(T_point, u_)*ds(3)
u = Function(V, name=“Displacement”)
solve(a == l, u, bc)
plot(1e3*u, mode=“displacement”)
print(“Maximal deflection:”, -u(L, H/2)[1])
print(“Beam theory deflection:”, float(((PL**3)/(3EI))+((wL**4)/(8EI))))
I want to calculate the deflection amount of cantilever beam given the uniform distribution load and the point load at the same time. But if I execute this code, only the calculation of the uniform distribution load is applied. How can I even calculate the point load?