Hi, i want to do a small patch test and apply multiple boundary conditions to my 2D rectangular plate.
On the left side of the plate I want to fix only the X-dofs for all points except the lower most corner point (0,0) for which I want to fix both dofs. I cannot however fix the corners
The MWE looks like this :
from dolfin import *
myMesh= RectangleMesh(Point(0,0), Point(2,1), 24, 12)
### define regions for bc applications ###
class LeftEdge(SubDomain):
def inside(self, x, on_boundary):
return (on_boundary and abs(x[0]-0.) < DOLFIN_EPS*1e3)
class RightEdge(SubDomain):
def inside(self, x, on_boundary):
tol = 1e-6
return on_boundary and abs(x[0] - 2.0) < DOLFIN_EPS*1e3
class CornerPoint(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0., DOLFIN_EPS*1e3) and near(x[1], 0., DOLFIN_EPS*1e3) ## is this correct ?
left_edge = LeftEdge()
right_edge = RightEdge()
corner_point = CornerPoint()
right_edge.mark(sub_domains, 5)
corner_point.mark(sub_domains, 6)
ds = Measure("ds")(subdomain_data=sub_domains)
# Material Constants
E=1.0; nu=1.0; rho=1.0;
mu=1.0; bulk=1.0; gamma=1.0;
## Variational Formulation
V = VectorFunctionSpace(mesh, 'Lagrange', degree=1)
u = TrialFunction(V)
d = u.geometric_dimension()
v = TestFunction(V)
a = inner(sigma(u), eps(v))*dx
#Neumann Boundary condition for traction force
force = 1000
g = inner(Constant((force,0)),v) #
l = g*ds(5)
#Applying bc and solving
bc1 = DirichletBC(V.sub(0), Constant(0.), left_edge) #fixing only X-dofs on left edge
bc2 = DirichletBC(V, Constant(0.0, 0.0), corner_point, method='pointwise') #doesn't work
bcs = [bc1, bc2]
A = assemble(a)
b = assemble(l)
for bc in bcs: bc.apply(A,b)
u_fe = Function(V, name="Displacement")
#solve(a == l, u_fe, bc)
solve(A, u_fe.vector(), b)
I get an error saying
UFLException: Invalid cell 0.0.’
when I try to apply bc2
Can anyone suggest how can i achieve this in Fenics ?