Skip to content

Transfinite automatic

Maxence Reberol requested to merge transfiniteAutomatic into master

setTransfiniteAutomatic() automatically sets the transfinite attribute on curves, surfaces and volumes when possible. The objective is to automate a task (setting transfinite) which is very tedious on large CAD models (hundreds of curves), and to help automatic quad meshers by preprocessing the trivial patches. The number of points on curves is automatically determined according to the sizing constraints (same number as when generating the vertices on curves). The number of points is kept coherent between adjacent quadrilateral surfaces by computing the topological chords where possible, and using the averaged values on the independent chords.

Some limitations:

  • It is not possible to automatically and robustly deal with faces with more than 4 edges, even if we could choose 4 corners, as it would create T-junctions and then the automatically propagated constraints may become inconsistent (limit cycles). It is still possible to deal with a subset of these cases, but it is lot of work, much more than this commit.
  • In the quadrilateral faces, the angle corners are computed from the curve tangents but do not use the face normal, so large concave corners are not rejected with the current approach.
  • Currently, the points are uniformly distributed on the transfinite curves. It should be possible to detect existing transfinite curves with non-uniform distributions and propagate them.

API function:

doc = '''Set transfinite meshing constraints on the model entities in `dimTag'. Transfinite meshing constraints are added to the curves of the quadrangular surfaces and to the faces of 6-sided volumes. Quadragular faces with a corner angle superior to `cornerAngle' (in radians) are ignored. The number of points is automatically determined from the sizing constraints. If `dimTag' is empty, the constraints are applied to all entities in the model. If `recombine' is true, the recombine flag is automatically set on the transfinite surfaces.  '''
mesh.add('setTransfiniteAutomatic', doc, None, ivectorpair('dimTags', 'gmsh::vectorpair()', "[]", "[]"), idouble('cornerAngle', '2.35', '2.35', '2.35'), ibool('recombine', 'true', 'True'))

The code:

  • added in meshGFaceTransfinite.cpp, may be not the best place
  • uses C++11, added some preprocessor checks in meshGFaceTransfinite.cpp
  • does not verify if the 6-sided volumes are topological balls, is there a existing function to do this ? (Update: done with Euler characteristic)

Example on Block.stp:

import gmsh
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
gmsh.merge("Block.stp")
gmsh.option.setNumber("Mesh.CharacteristicLengthFactor", 0.1)
gmsh.model.mesh.setTransfiniteAutomatic()
gmsh.model.mesh.generate(2)

Result:

  • 60852 triangles
  • 9016 quads

block

Edited by Maxence Reberol

Merge request reports