# How to import numerical fluid particle data to Blender?

I have numerical files output from a c++ program for fluid simulation by solving Navier Stokes equation using particles, the file looks like this

-0.09 0.02 0.014737 1.26721e-17 4.34908e-19 -0.326667
-0.09 0.02 0.019737 1.02892e-17 2.54586e-17 -0.326667
-0.09 0.02 0.024737 1.08211e-18 3.22247e-17 -0.326667
-0.09 0.02 0.029737 -5.16105e-18 2.42116e-17 -0.326667
-0.09 0.025 -0.040263 -7.48241e-18 -1.33054e-17 -0.326667
-0.09 0.025 -0.035263 -1.51154e-17 -4.43992e-18 -0.326667
-0.09 0.025 -0.030263 -1.83814e-17 -4.67568e-18 -0.326667
-0.09 0.025 -0.025263 -3.33315e-17 -6.81458e-18 -0.326667
-0.09 0.025 -0.020263 -4.54398e-17 -2.37933e-18 -0.326667
-0.09 0.025 -0.015263 -2.15601e-17 4.90648e-18 -0.326667
-0.09 0.025 -0.010263 -2.87995e-18 4.25644e-18 -0.326667
-0.09 0.025 -0.00526297 7.32533e-18 8.69628e-18 -0.326667
-0.09 0.025 -0.000262971 1.73026e-17 1.31652e-17 -0.326667
-0.09 0.025 0.00473703 1.38162e-17 -5.92466e-18 -0.326667
-0.09 0.025 0.00973703 1.64762e-17 -1.85798e-17 -0.326667


Note the first 3 numbers are the particle positions, the last 3 numbers are velocities of the particles. What is the right file format to import to Blender for animation? I am trying to display or visualize the file (3D fluid) that is shown above in Blender and I am not sure how to do that.

EDIT: [mjf] I would like to import the array as a collection of particles that represent the initial position and velocity of particles in a fluid flow and then visualize the state of the flow.

• What do you want to do with the data? As it is, there's no importer that will import data in the format of your file so you'd have to write your own, but to know what it would look like, we'd have to know what you want to do with the velocities and positions. Sep 15, 2021 at 22:49
• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Sep 15, 2021 at 22:49
• Thank you for all your advice, I just edited the questions, does that clarify things a little bit better? Sep 15, 2021 at 22:54
• @MartyFouts Do you know what is the common format for visualizing fluid in Blender? Or files to import as fluid? Are they positions of the particles only or there are something else? Or if you can provide a extension name, that would be very helpful! Thank you very much! Sorry that my question is vague, I am new to fluid animation as I am not familiar with data types for fluid simulation, so any help would be very much appreciated! Sep 15, 2021 at 22:58
• I don't. Mostly people use Blender's Mantaflow simulator and it creates its own fluid particles. I don't know how you would fit an existing array of particles into that simulator, sorry. But now I do know what you want. I'm going to edit your question slightly to see if it will attract people who do know. Sep 15, 2021 at 23:43

After doing some research, I read from this post that Stanford .PLY file can be used to work with Blender, and the particle positions are called "point cloud"!

What I did was using a python script to write the point clouds into a Stanford .PLY file using open3d, the code is given as follows:

def write(file_name):
# file format: "fluid.iii.part"
with open(file_name) as f:

name = file_name[:-5]

n = len(lines)
point_cloud = np.zeros((n-1,3))
for i in range(1,n-1):
position = lines[i]
position_numeric = np.array([float(j) for j in position.split()][:3])
point_cloud[i] = position_numeric

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_cloud)


Then I import all the generated .PLY file into Blender to get the following results:

• Quite interesting and useful. Thanks for the update! Doesn't seem to use the initial velocities? Sep 26, 2021 at 16:44
• You are welcome! No, I didn't use the velocities, I've been doing research about this, it seems we only need point cloud only to generate mesh for liquid. I am trying to give them a mesh in Houdini, cause there seems no mesh generation in Blender. Anyways, I will keep updating if there is anything new! Sep 30, 2021 at 17:17
• I tried someting like this years ago based on Blender 2.7x. Back then, the particle system used to cache particle positions for every frame. These were stored in arrays accessible via Blender's Python API. Having loaded the simulated positions it was possible to animate the external simulation. I didn't find enough time to properly implement a stable workflow for this. Maybe the situation improved with all the progress in Blender's development. I'll try to find some time and see if I can find my code again! Nov 12, 2021 at 16:15