# Gmsh Python: Specify mesh regularity conditons

I am using python API of Gmsh to generate a mesh for a rectangular domain. I am really new at this. My code looks like this,

import sys
import gmsh

gmsh.initialize()

lc = 1e-1

gmsh.model.geo.synchronize()

gmsh.model.addPhysicalGroup(2, [1], name = "My surface")

gmsh.model.mesh.generate(2)

gmsh.write("t1.msh")

if '-nopopup' not in sys.argv:
gmsh.fltk.run()

gmsh.finalize()


I want to impose a mesh regularity condition, that the lines joining the cell centres must be orthogonal to the edges. I cannot find how to do that, any reference or solution would be of help.

Edit: I am primarily interested in triangular meshes and I use the centroids of the mesh elements as cell centres.

• How do you define "cell center"? Commented Jan 16, 2023 at 16:44
• I use the centroid of the triangular mesh elements as the cell centres. Commented Jan 16, 2023 at 16:54
• I think it's unlikely the gmsh or any other unstructured mesh generator will produce a mesh with the regularity you're describing. Generally these are engineered to produce meshes with certain good quality measures, like avoidance of very large or small angles or bounded triangle aspect ratio. There are mesh improvement strategies that can take you closer to the condition you describe but again I don't think you can expect this out of the box. Commented Jan 16, 2023 at 19:12
• I wonder if it is even possible to create such meshes. (But don't know the answer to this.) What happens if you take an arbitrary triangle and you subdivided it into four triangles by using the edge midpoints. Does the result satisfy your constraints? Commented Jan 16, 2023 at 20:28
• Besides regular triangles and rectangles are other tesselations that admit the condition that you want to impose? Commented Jan 16, 2023 at 20:56