Unstructured grid from randomly disributed points

HI,
I am trying to create an unstructured grid from a set of points loaded from csv file. The points come form Anys Fluent simulation. For a very basic case I consider only a simple 2D rectangle where I calculate only heat conduction. In the file I have around 1000 points (x,y coordinates + temperature at point/node).

I have managed to read those data to Paraview (using C++ examples on vtk webside) with the use of polydata object nd Delaunay2D triangulation. I have checked my code also for some more complicated geometries and I have noticed that with Delaunay2D you have to control Alpha parameter to avoid incorrect connection of the points. I have also checked the code for the case of air flow in 2D channel and it gave more or less OK results in Paraview, however in the boundary layer when I have a lot of thin and long elements in Fluent mesh, the reproduction with Delaunay2D in Paraview is I would say not bad but I think that with unstructured mesh I could have a better result.

Unfortunately, what I have noticed in case of an unstructured meshes, If you want to create it form scratch and build it for example from quad elements you have to take care on the nodes numbering and correct connectivity. Otherwise you will obtain horrible results (or even no vtu file will be created).

With unstructred mesh I was able to visualize only 2 elements what allowed me to get to the above conclusion. Now is the time for my question:

I don’t see a possibility to track a connectivity and numbering of hundred thousands of points (maybe I am wrong), so could you help me understand how I can create (with c++) an unstructured mesh from let’ say randomly distributed points. Is it possible?

Thanks in advance.

vtkDelaunay2D is not designed to be a full-blown mesh generator, especially if you are trying to create quad elements or you have significant geometric constraints etc. There are many alternatives out there depending on your needs, including the license / OS requirements. Triangle is one such mesh generator, but as its name implies it produces triangles :slight_smile:

Hi Will,
Thanks for your comment. However I think that I need something different. As I understand the tool that you are pointing to is a mesh generator right?

My problem is that: I have a Ansys Fluent results and I want to post process them in Paraview. There are couple of readers, that I can try to use, like: Ensight files, Tecplot files or directly Fluent Case files, but this solution for me is unreliable because I have already noticed that with different releases of Fluent or Paraview it may work or not. This is why I wanted to find work around by myself.

For my simplified case, in Fluent I just have in the file the coordinates of the nodes and some scalar and vector data (I skip the differentiation between nodes and cell values for now). With PolyData and Delaunay 2D I was able to visualize all of the results in Paraview but this triangulation is not the best option (I am aware of that).

So what I want to do is to use the nodes coordinates that I store in file and to create the unstructured grid with the usage of vtk libriaries. But currently I am struggling with the convection used for nodes numbering during unstructured mesh generation in VTK because I cannot find any logic there that can be programmed with for example for loops which I see as a must if I have thousands of points.

Are any of the forum members has any experience with that?

Are the points really randomly distributed? I assume you have information about the elements and nodes from your Fluent analysis model which can be used to transform the scalar and vector results into what VTK requires.

Does this help? https://discourse.paraview.org/t/reading-nastran-nas-file-and-results-with-csv-file/1189

Hi,
I have managed to solve this task with this example from vtk:

https://kitware.github.io/vtk-examples/site/Cxx/UnstructuredGrid/UGrid/