CFD streamlines in Grasshopper

As an experience I tried to import streamlines generated in Ansys Fluent into Grasshopper environment and I developed two (actually one and a half!) C# components in Grasshopper to do this. Basically generated tables in CFD Post are saved as a single file so you have to separate different tables and save them as individual .CVS files which is really easy, and then these C# components will do their missions!


#1 Extract Points

“ExtractPoints (C#)” component have been created to read comma separated numbers and generate 3D point objects. It’s fairly simple but tricky when it comes to Ansys Fluent because of its confusing coordination system. To avoid this problem, it reads dimension numbers in X,Z,Y order instead of X,Y,Z.

#2 Follow Trail

To understand how “FollowTrail (C#)” works, first we have to look at connection table structure. Each row in this table indicates two connected points’ indexes of a line which is a small piece of a continuous streamline. So to find all points of a single streamline, it searches through the data in a zigzag iteration pattern and puts related indexes in a DataTree in which each Branch contains indexes of a single streamline’s points.

Finally you can put imported vertexes into separate branches by using “ListItem” native component of Grasshopper.