Getting the same result's with extrude's numElements and recombine option, without using it directly
Hello,
I am creating geometry with OCC kernel, then saving it as a BREP file, then reading it back and meshing it. I do this to decouple my meshing and geometry scripts. However, I use extrusions a lot, and sometimes I cannot get the same results with extrusion operations with numElements
and recombine
options. Since I save it as a BREP file, only the geometry data is saved, so I cannot use numElements
and recombine
options directly. Here is a minimal example below:
import gmsh
gmsh.initialize()
gmsh.model.add("myModel")
# Create a plane surface:
plane = gmsh.model.occ.addDisk(0, 0, 0, 1, 1)
withNumElementsOption = False
if withNumElementsOption:
gmsh.model.occ.extrude([(2, plane)], 0, 0, 10, recombine=True, numElements=[10])
gmsh.model.occ.synchronize()
else:
gmsh.model.occ.extrude([(2, plane)], 0, 0, 10)
gmsh.model.occ.synchronize()
gmsh.model.mesh.setTransfiniteCurve(1, 21)
gmsh.model.mesh.setTransfiniteCurve(2, 11)
gmsh.model.mesh.setTransfiniteCurve(3, 21)
gmsh.model.mesh.setTransfiniteSurface(1)
gmsh.model.mesh.setTransfiniteSurface(2)
gmsh.model.mesh.setTransfiniteSurface(3)
gmsh.model.mesh.setTransfiniteVolume(1)
# Generate mesh:
gmsh.model.mesh.generate()
gmsh.fltk.run()
I thought setting transfinite lines, surfaces, and volumes would give the same result, but I get errors like: Surface 1 is transfinite but has 1 corner. Is there are way to get the same result without using numElements
and recombine
options?
Thank you very much in advance,
Sina