Improve and View Mesh Quality Metrics

Dear SALOME Development Team,

I have been an avid user of SALOME for meshing complex geometries for CFD simulations. However, I have encountered challenges with mesh convergence issues, hindering the efficiency and accuracy of my simulations. To address this concern, I would like to propose the integration of an “Improve Mesh Quality” feature within SALOME.

This feature would be akin to the mesh quality enhancement capabilities present in tools like OpenFOAM’s snappyHexMesh. By incorporating such functionality into SALOME, users like myself would benefit from enhanced mesh quality, leading to improved convergence rates and ultimately more accurate CFD results.

Key aspects of this feature could include:

  1. Mesh Smoothing Algorithms: Implementing advanced mesh smoothing algorithms to eliminate irregularities and improve mesh quality, ensuring better convergence behavior in simulations.
  2. Edge Collapse and Refinement: Introducing mechanisms for edge collapse and refinement to optimize mesh structure, particularly in areas of high curvature or complexity.
  3. Quality Metrics Visualization: Providing visual feedback on mesh quality metrics such as aspect ratio, skewness, and orthogonality, allowing users to assess and refine their meshes effectively.
  4. Integration with Mesh Generation Workflow: Seamlessly integrating the “Improve Mesh Quality” functionality into SALOME’s existing mesh generation workflow, ensuring ease of use and compatibility with existing projects.

By incorporating these enhancements, SALOME would become an even more powerful tool for CFD practitioners, empowering them to generate high-quality meshes suitable for complex simulations with greater ease and confidence.

I believe that the addition of such a feature would greatly benefit the SALOME community and significantly enhance the software’s capabilities in the realm of computational fluid dynamics.

Thank you for considering this feature request. I look forward to seeing further advancements in SALOME’s meshing capabilities.

Best regards

Hello PremierCFD.

Thanks for the detailed explanation of your needs. There are two smoothing (Laplacian and Centroidal) algorithms that act on meshed faces. You can share the references for more sofistifaced/usefull smoothing algorithms that could enhanced the quality of your simulations?.

All the mesh quality measures that you mentioned (aspect ratio, skewness, and orthogonality) are already available through the controls menu. For orthogonality see the scaled Jacobian.

There are already some mesh refinement options in smesh, see (https://www.youtube.com/watch?v=cK9f9aG6zg0, https://www.youtube.com/watch?v=TlLYs07RgH8).

About automatic edge collision to coarse the mesh in distorted regions, again, it could be very useful if you could shared a reference where the technique is properly described to evaluate the level of difficulty for this improvement. Finally, I agree with you that making available a fast way of enhancing mesh quality in Salome (through a shortcut in the GUI for instance) could be very useful.

Kinds Regards,
Cesar

hello cesar,
here you have a post I made some time ago.

mesquite is the perfect match for integration with salome for several reasons:

  • it has a easy to integrate API (up to my knowledge at least before it was integrated inside CUBIT mesher and also here is an example of another project that integrates it maybe it helps…mesquite « math - ports - FreeBSD ports tree)
  • it is supposed to work with brep files for constraints of vertexes of the mesh (see chapter 6 https://github.com/sandialabs/mesquite/blob/main/mesquite/doc-2.3.0/users-guide.pdf)
  • it has several smoothing, untaggling algorithms (not only 2D but 3D also)
  • it can ‘fix’ nodes so the viscous layer are not modified during the smoothing process
  • it has a great build in tool to generate viscous layer that is quite powerful
  • one of the input format is the legacy vtk format, that it is exactly the same (1:1) structure of meshes in salome at least from the point of view of what we can have from python mesh objects
  • it is LGPL licence so the same licence as Salome
  • its smoother runs in parallel
    (the only thing that at least out of the box is missing as capability is the possibility of smooth polyhedral meshes as up to my knowledge this feature does not exist in Mesquite, nevertheless today in salome the poly meshes are generated from the dualization of a tet mesh, which this one can be smoothed out, so it could be done before the dualization)

furthermore, also today the 2D smoother of salome, leave a lot of improvements, I need to make a post about it, but I have found some bugs on them.
regards,
franco

Hello Franco.

Thanks for your valuable feedback. Including new dependencies into SALOME has to be consider carefully, an evaluation of the needed work and pro/cons need to be done in this cases.

About the current implemented smother, some problems that affected periodic faces were identified and corrected (SALOME platform Git repositories - modules/smesh.git/commit). Please don’t hesitate to share your observations and finds in the forum.

Best Regards,
Cesar

Pds. I think there should be a more clear position about your proposal to incorporate Mesquite into Salome soon.

Hello Cesar,
I understand about thinking of the pro/cons, the good and bad thing about mesquite is that sadly is a dead project, it hasn’t been developed since eternity (10 years) but it is really robust so it will not change in the future…

I identified 2 different bugs (not sure if it worth making a new post in the forum…)

  1. I developed a snapping nodes to surfaces of a mesh (as input you have a mesh and a surface and you get some nodes of the mesh snapped to the edge of the surface) similar to the behavior of snappyHexMesh.
    I wanted to use the smoother to try to ‘distrbute’ the cells that were modified, but if I fix the nodes that I moved and leave everything else free to be smoothed, the mesh does not evolve, even though one would expect to distribute this distortion a little bit everywhere so you have a ‘general’ good quality and not a great quality in some places and bad in others (as this behaves way WAY worse in numerics) here is an image for example, that even with any of the two smoother algos, and giving 2000 steps it does not move a bit…
    image
  2. I use the smoother in a really ‘particular’ way, where I have a surface that is cut in quads and mesh it with quads and then use the same surface without internal edges (without the surface being cut by quads) and then over the ‘clean’ surface I create a new mesh and use projection 1-2D algorithm, and then I use the smoother (the idea is to smooth the quads that cut the geometry) this works correctly, BUT when I have a surface that has a hole (for example a square with a circle hole in the middle) when I use the smoother, the nodes of the cells will stay inside the surface but the edges will go outside of the surface (and go through the center of the circle and completely destroy the mesh…) I don’t have a image in hand but I could make it if necessary.
    regards

Hello Franco.

For the first case if I understand correctly you suspect the mesh was not smooth because you didn’t see any difference in the mesh. Can you share a script to check this? Just clarifying that All nodes at edges are fixed for both smother.
For the second case, it could be really helpful if you could share a reproducible script. In this case it seems that the projected mesh does not fix the nodes in the edge circle, turning then movable. You can always fix those nodes by hand, though!

Regards,
Cesar

Hello cesar,
for the first case:
I have the mesh of a rectangle surface (quad mesh) and I ‘snap’ to a circle thats where the ‘distortion’ of the mesh comes from, but after this i wanted to smooth the mesh (fixing the nodes on the circle and the nodes on the edges). the thing is, understandably the quality will be by far of the perfect squares from the begining, but the thing is that the resulting mesh (after smoothing) have some nodes that could be moved to have this ‘distortion’ be distributed among the complete mesh, and giving better mean quality instead of perfect quality in some places (as you can see in the image after smoothing) where you have perfect squares and other sections which are really distorted. I imagine that the smoother tests an average value and as it gives the same weight for every cell it says ‘hey your quality have reached to a good average quality I will stop here’ when, it should give a larger weight for the low quality cells so it gets a average with a smaller distribution.
here is the example I gave in the image, and as you can see even if we give 2000 iterations nothing changes in the mesh when at the same time this could clearly be improved.
smoothExample1.py (3,0 KB)

for the second case:
speaking of the smoothing, using the projection workflow, gives some results that at minimum are worse than before smoothing.
here is a before and after the smoothing (with laplacian smoother which in theory (and from the doc) it should not impact badly the mesh quality)


here you have simple example:

  1. do a structured mesh from a block cutted geometry
  2. create the same geometry without the blocks (so basically without internal faces and extra edges)
  3. create a 1D mesh with same number of elements in the edges as the ‘corresponding’ edges as in 1.
  4. create mesh with 1D-2D projection of the surface of the mesh created in 1. over the geometry created in 2.
  5. move the nodes elements on the edges of the mesh created in 4. on the positions of the nodes of the mesh in 3. (so the elements will be equally distributed)
  6. smooth this mesh
    the idea is to smooth the structured mesh of 1. without the constraint nodes of the internal edges and nodes for the quadrangle mesh.


here you can see in:
a. the original mesh
b. the ‘copied’ mesh of step 4. with the 1D mesh created in step 3.
c. the resulting mesh of step 5. (mesh from step 4. with the nodes on the edges moved for a regular stepping over the edges of the non-blocked geometry) obviously, it has really bad elements that should disappear with the Laplacian smoother
d. the resulting mesh of step 6. after smoothing. (so from c->d only laplacian smoothing of the geometry)
and as you can see ‘the nodes in the circle’ are respected what is not respected is that the nodes that should be inside the surface itself are not any more inside of it.
I can not share the file in the forum but if this is going to be addressed I can share it with the developers directly. (if you are part of the developing team dont hesitate to contact me in private)

regards,