BC and materials from abaqus

Hello,

I have the geometry of my problem in abaqus (geometry+sets.inp). It is a square with some circles inside (everything is done in one part). The circles are one set and the square is other because each set is a different material.
Using meshio-convert geometry+sets.inp geometry+sets.xdmf I get the mesh of the problem but I don´t know how to identify the sets as subdomains in order to be able to define two differents materials. I have the same problem with the boundary conditions

Thanks!!!

1 Like

Hi
This may help you:

# Define boundaries (Lets say you want to define a boundary on the left edge (x = 0))
class Left(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0)

# Initialize sub-domain instances
left = Left()

#Define your mesh
mesh = "Your Mesh"

# Marking boundary domains
boundaries = MeshFunction('size_t', mesh, mesh.topology().dim()-1)

#Marking the left edge as number 2
left.mark(boundaries, 2)

# Here is how you can define an area (e.g. Subdomain) (0.2 =< x <= 0.3 and 0.2 =< y <= 0.3)
class area(SubDomain):
  def inside(self, x, on_boundary):
      return True if x[0] >= 0.2 and x[0] <= 0.3 and (x[1] >= 0.2 ) and (x[1] <= 0.3 ) else False

#Marking subdomains
domains = MeshFunction('size_t', mesh, mesh.topology().dim())
Area= area()

#Marking the area as number 1
Area.mark(domains, 1)
dx = Measure('dx', domain=mesh, subdomain_data=domains)

# Now in your variational form you can use dx(1) to refer to the Area (Marked as 1)
#This way you can assign your specific material properties for this domain

#Lets say V is your function space
V = VectorFunctionSpace(mesh, 'CG', degree=2)

# Here is how you can apply your Dirichlet BC on the left edge
bc_left= DirichletBC(V,Constant(0), boundaries, 2)

Thanks for your reply. I have around 13 circles that are my fibers. I want all of them as one subdomain. If I have to define the equation of each circle, I think that it is not a very efficient way of declaring the subdomains when we have a very complex geometries.
Is there something else to define subdomains in very complex geometries?
I can do that in abaqus using sets for instance, Is there any way of identifying these sets as subdomains in fenics?
Thank you very much

For complex geometries, I would recommend to create your mesh in GMSH and mark your subodmains as “Physical Surface”. See this example in GMSH:

# 4 points for defining a squared subdomain
Point(1) = {0, 0, 0,1};
Point(2) = {0, 1, 0,1};
Point(3) = {1, 0, 0,1};
Point(4) = {1, 1, 0,1};
# Defining lines
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line Loop(1) = {1, 2, 3, 4};
#Making the square
Plane Surface(2) = {1};
Transfinite Surface{2};
# Marking the square with number.1
Physical Surface(1) = {2};

Then you can convert your mesh using dolfin-convert which will result in generation of physical_region.xml file.

This is how you can handle it:

domains = MeshFunction("size_t", mesh, "physical_region.xml")
dx = Measure('dx', subdomain_data=domains)

You can simply use dx(1) in your variational form to refer to this squared subdomain.

1 Like