controlling surface label numbers when importing a brep model
Hello, how does the surface label numbering work when a brep geometry is imported ?
The geometry contains surfaces which have received a specific name. I would like to keep these names through the import and mesh processes in Gmsh.
That means in the script below I would like to set and keep constant the naming or numbering of the surfaces i.e. 'inlet' label must be 1, 'walls' one must be 2, 'outlet' one must be 3 (as this was in the brep file):
gmsh.initialize()
gmsh.initialize(sys.argv)
gmsh.option.setNumber("General.Terminal", 1)
# add a new model
gmsh.model.add("surf")
# Load a BREP file
gmsh.option.setNumber("Geometry.OCCScaling", 1)
v = gmsh.model.occ.importShapes('../geo-brep/model.brep')
# Gmsh geometry tags of relevant parts
# ??? Find the tags in the Gmsh interface ???
# this does not work properly : the labels are wrongly set
tags = {"inlet": 1, "walls": 2, "outlet": 3,}
gmsh.model.occ.synchronize()
gmsh.option.setNumber("Mesh.MeshSizeFactor", 0.1)
gmsh.option.setNumber("Mesh.Algorithm", 2)
gmsh.model.mesh.generate(2)
gmsh.model.addPhysicalGroup(2, [1]) # inlet
gmsh.write("inlet.stl")
gmsh.model.removePhysicalGroups()
gmsh.model.addPhysicalGroup(2, [2]) # walls
gmsh.write("walls.stl")
gmsh.model.removePhysicalGroups()
gmsh.model.addPhysicalGroup(2, [3]) # outlet
gmsh.write("outlet.stl")
gmsh.model.removePhysicalGroups()
gmsh.finalize()
How can I do this ?
thanks in advance for your help Oli
ps: I think that is pretty similar to this post :#1190 (closed) There someone needs to have gmsh matching the tag of the elements in the input geometry. But can it do that ? and how ?
Edited by olivier m