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
# 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