Simplifying Mesh

Sometimes I have to simplify the mesh while preserving the model's volume. Many versatile software packages already have some function that can handle this task but often does not keep the geometry's volume intact and results in some level of shrinkage, especially when the geometry is of complex nature.

The following is the geometry that is going to be filled with the fluid particles in the Smooth Particle Hydrodynamics (SPH) software package used for my simulations. When elements of bad quality are used, some part of this geometry may end up with no particles to begin with, which is very bad for the accuracy of the SPH (Fluid-Structure Interaction) simulations. Here, the number of elements is not as important as their quality. Hence, it can be simplified as much possible.
The surface mesh before simplification consists of 8020 triangles.

Now, the software that I use for mesh simplification is called QSlim. The file format that it eats is smf. A script to convert ply to smf comes with its installation. However, not ever software that spits out your mesh in ply format produces it in such a way that this converter will work without a segmentation fault error. The one software that works is MeshLab and the ply files that it spits out work well with this ply2smf converter.

So, after saving your surface mesh file as ply, go the directory qslim/tools/filters where ply2smf is located and type:

./ply2smf < ../../../../filename.ply > ../../../../filename.smf

Now, that I have the smf file type. I can open QVis, that comes with the QSlim and visualizes this mesh:
I keep moving the lower bar left and right to find the least number of elements while not observing a big change in the geometry, settling on the following mesh with 2560 triangles down from 8020:
That was only for the visualization to come up with the number 2560, though. I go back to the command line and type now (in the directory where QSlim is located):

./qslim -t 2560 -o ../../../../filename_slim.smf ../../../../filename.smf

And, convert it back to ply::

./smf2ply < ../../../../filename_slim.smf > ../../../../filename_slim.ply

A mesh file in ply can be easily open in most software packages and converted to anything and used to create the volume mesh.

Contact Us




Dept. of Mechanical Engineering
School of Eng. & Comp. Sciences
New York Institute of Technology
Old Westbury Campus - HSH116A
Northern Boulevard
Old Westbury NY 11568-8000