elasticity cantilever beam - constant load at the corner
Hi teammates,
I have solved a cantilever beam problem fixed at the left end and distributed load at the top... here is the code
from dolfin import *
from dolfin_utils import meshconvert
# Optimization options for the form compiler
parameters[
ffc_options = {"optimize": True, \
# Create classes for defining parts of the boundaries and the interior
# of the domain
class Left(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0.0)
class Right(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 2.0)
class Bottom(SubDomain):
def inside(self, x, on_boundary):
return near(x[1], 0.0)
class Top(SubDomain):
def inside(self, x, on_boundary):
return near(x[1], 1.0)
class Obstacle(
def inside(self, x, on_boundary):
return ((x[1], (1.0)) and (x[0], (2.0)))
#return (between(x[1], (0.5, 0.7)) and between(x[0], (0.2, 1.0)))
class Point(SubDomain):
def inside(self, x, on_boundary):
return pt
# Initialize sub-domain instances
left = Left()
top = Top()
right = Right()
bottom = Bottom()
obstacle = Obstacle()
pt = Point()
# Create mesh and define function space
#mesh = dolfin.
mesh = Rectangle(0.0, 0.0, 2.0, 1.0, 20, 10)
plot(mesh)
print mesh.cells()
print mesh.data()
myArray= mesh.coordinates()
pt = [myArray[
print pt
mesh.geometry()
# Initialize mesh function for interior domains
domains = CellFunction(
domains.set_all(0)
obstacle.
# Initialize mesh function for boundary domains
boundaries = FacetFunction(
boundaries.
left.mark(
top.mark(
right.mark(
bottom.
# Define function space and basis functions
V = VectorFunctionS
U = TrialFunction(V)
v = TestFunction(V)
# Define boundary conditions
c = Expression(("0.0", "0.0"))
bc = DirichletBC(V, c, boundaries, 1)
# Define new measures associated with the interior domains and exterior boundaries
dx = Measure(
ds = Measure(
# Define functions
v = TestFunction(V) # Test function
U = TrialFunction(V)
# Elasticity parameters
E, nu = 10.0, 0.3
mu, lmbda = Constant(E/(2*(1 + nu))), Constant(E*nu/((1 + nu)*(1 - 2*nu)))
def epsilon(v):return 0.5*(grad(
def sigma(v):return 2*mu*epsilon(
# Define variational problem
g_T= Constant((0.0, -0.5))
a = inner(grad(
L= dot(v,g_T)*ds(2)
# Solve problem
U = Function(V)
solve(a == L, U, bc)
# Plot solution and mesh
file = File("elasticit
file << U
# Hold plot
plot(U, interactive=True)
I need to solve the same prb with constant point load acting (in negative y direction only ) @ co-ordinate (2,1)..please suggest me to solve the problem...
thnks
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Niraj Kumar Jha for more information if necessary.