I'm asking for some advice regarding how to create (mesh) a hole in a solid with different subregions.
Initially I had a block of two materials glued together. I want to model a contact gap/crack in a material. It would be OK by me if I could somehow separate a part of the materials interface to create a crack. I was unable to do that, but if anyone has an idea, then please tell.
Then I tried to create a small hole region in material, but it seems that the hole is closed by meshing program as soon as I try to designate some subregions inside it? Question is, how can I fix or sidestep the problem?
from dolfin import *
from mshr import Rectangle, Circle, Ellipse, generate_mesh
# height and width of square with defect width and thickness
height = 20e-3
width = 20e-3
defectwidth = width/2.0
defectthickness = height/20.0
# the block itself
geometry1 = Rectangle(Point(0, 0),
Point(width, height))
# the defect in the middle of the block
geometry2 = Rectangle(Point(width/4.0, (height- defectthickness)/2.0),
Point(width*3.0/4.0, (height + defectthickness)/2.0))
# just see how the block with defect looks
geometry = geometry1 - geometry2
plot(generate_mesh(geometry, 20), interactive=True)
# I now want to set some subdomains in the solid region (not even close to the defect)
geometry.set_subdomain(1, Rectangle(Point(0,0),
Point(width, height/4)))
geometry.set_subdomain(2, Rectangle(Point(0, height/1.5),
Point(width, height)))
# the defect is gone?
plot(generate_mesh(geometry, 20), interactive=True)