Forcing edge seeds
In order to obtain several meshes which are compatible to each other I have to force gmsh to use given nodes on the boundary of my mesh. The best case scenario would be to be able to enforce the usage of points within the mesh, on its surface and on its edges. I am working with the Python API. In my actual use case I want to generate a quad mesh with gmsh.option.setNumber("Mesh.RecombineAll", 1)
.
I have tried to obtain this result by using gmsh.model.mesh.embed
based on Gmsh Python tutorial 15, which resulted in the following demo code:
import gmsh
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
# Create geometry
lc = 1e-2 *4
pnts = []
pnts.append(gmsh.model.occ.addPoint(0, 0, 0, lc, 1))
pnts.append(gmsh.model.occ.addPoint(.1, 0, 0, lc, 2))
pnts.append(gmsh.model.occ.addPoint(.1, .3, 0, lc, 3))
pnts.append(gmsh.model.occ.addPoint(0, .3, 0, lc, 4))
crv = []
crv.append(gmsh.model.occ.addLine(pnts[0], pnts[1], 1))
crv.append(gmsh.model.occ.addLine(pnts[2], pnts[1], 2))
crv.append(gmsh.model.occ.addLine(pnts[2], pnts[3], 3))
crv.append(gmsh.model.occ.addLine(pnts[3], pnts[0], 4))
loop = gmsh.model.occ.addCurveLoop(crv)
srf = gmsh.model.occ.addPlaneSurface([loop], 1)
#Create embedded geometry
epnt = gmsh.model.occ.addPoint(0.02, 0.0, 0.)
gmsh.model.occ.synchronize()
#Embed
gmsh.model.mesh.embed(0, [epnt], 1, crv[0])
gmsh.model.occ.extrude([(2, 1)], 0, 0, 0.1)
gmsh.model.occ.synchronize()
gmsh.model.mesh.generate(3)
gmsh.fltk.run()
gmsh.finalize()
Instead of including the node epnt into the mesh it is ignored. Is my use case beyond the capabilities of the embed function? My current idea for a workaround is to create a larger geometry then required, embed the actual boundary, create the mesh and then purge all elements outside the boundary as can be seen in the attached picture. However, in this case creating an extrusion with the mesh fails, so I would have to implement an alternative Way to generate the volume mesh. Is there a better or more sane way to achieve my goal? I would be very glad for any help since gmsh is more and more becoming a fundamental tool for my research. All the Best, Henrik