Defining the geometry and specifying symmetry conditions


300
views
0
6 months ago by
I am working on a classical model of a plate with a hole and I want to use a quarter of the geometry and specify boundary conditions accordingly. How is this achieved in Fenics i.e defining this geometry and also applying symmetry?
Image the necessary geometry is attached.
Community: FEniCS Project

1 Answer


1
6 months ago by

Hope this help....

from dolfin import *    
import mshr
# generate mesh
domain = mshr.Rectangle(Point(0,0), Point(1,1))-mshr.Circle(Point(0.0,0.0), 0.1)
mesh = mshr.generate_mesh(domain, 40)
plot(mesh, interactive=True)


lmbda=121.15E3
mu=80.77E3
V = VectorFunctionSpace(mesh, 'CG',1)
u = TrialFunction(V)
v = TestFunction(V)
def epsilon(u):
    return 0.5*(grad(u)  + grad(u).T)

def sigma(u):
    return 2.0*mu*epsilon(u) + lmbda*tr(epsilon(u))*Identity(2)

class left(SubDomain):
    def inside(self,x,on_boundary):
        tol = 1e-5
        return abs(x[0]-0.0) < tol and on_boundary

class right(SubDomain):
    def inside(self,x,on_boundary):
        tol = 1e-5
        return abs(x[0]-1.0) < tol and on_boundary

class bottom(SubDomain):
    def inside(self,x,on_boundary):
        tol = 1e-5
        return abs(x[1]) < tol and on_boundary

Bottom = bottom()
Left = left()
Right = right()
# apply BC
bc1=DirichletBC(V.sub(1),Constant(0.0),Bottom)
bc2 = DirichletBC(V.sub(0),Constant(0.0),Left)
bc = [bc1, bc2]

load =  1.0

g = Constant ((load,0.0 ))
domainBoundaries = FacetFunction("size_t", mesh)
domainBoundaries.set_all(0)
Left.mark(domainBoundaries,1)
Bottom.mark(domainBoundaries,2)
Right.mark(domainBoundaries,3)

ds = Measure("ds")(subdomain_data=domainBoundaries)

Eu = inner(nabla_grad(v), sigma(u))*dx - inner(g,v)*ds(3)
u = Function(V)

solve(lhs(Eu) == rhs(Eu), u, bc)

plot(u, mode = 'displacement')
u1,u2 = split(u)
plot(u1)
plot(u2)
interactive()

Hi,
I fail to understand the below snippet from your code

# apply BC
bc1=DirichletBC(V.sub(1),Constant(0.0),Bottom)
bc2 = DirichletBC(V.sub(0),Constant(0.0),Left)
bc = [bc1, bc2]

load =  100.0

g = Constant ((load,0.0 ))
domainBoundaries = FacetFunction("size_t", mesh)
domainBoundaries.set_all(0)
Left.mark(domainBoundaries,1)
Bottom.mark(domainBoundaries,2)
Right.mark(domainBoundaries,3)

ds = Measure("ds")(subdomain_data=domainBoundaries)

Is that how the symmetry is defined? Is there any documentation you know of regarding the same?

written 6 months ago by Aswin Rajeevan  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »