Thursday, December 10, 2015

Best of Widap FluidSim 2D

This is a compilation of the the best exports from the old 2D fluid dynamics simulator. All of the code to run the simulation and render the result was created by Widap (aka me, William W Wold) in C++. I used SFML for the GUI but other then that, no external libraries or code was used. The open source program Blender was used to convert the program's output (a series of uncompressed images) into .mp4 clips and it was also used to edit this video and make it look nice.

I started working on FluidSim at some point early in 2015 (my junior year in HS) after seeing a friend do drag calculations in Solidworks. I worked hard on it for a few months, and then fiddled with it from time to time afterword. In the Fall of 2015 I did a nearly complete rewrite of the code to be more focused on the voxel data structure and less on individual particles (the last two clips come from after this rewrite). I never got this version fully functional, however, as I soon made the jump to 3D and stopped development on the 2D version.

I will probably soon post a similar video with clips made from FluidSim 3D. Both versions of FluidSim calculate fluid/gas flow with a combination of particle and voxel calculations. In both versions collision walls can be added (lines detected from a loaded bitmap image in 2D, triangles from a .stl file in 3D) and the simulation can approximate the drag of the objects.

As you can see, a verity of different types of fluid and gas can be modelled. Most of the clips you see here are not one particular substance, but rather the result of tweaking until it looked good. I never put in enough time to set it up to accurately simulate any real fluids. This was partly because there were always going to be limits to the 2D simulation. I hope to overcome many of these limitations in the 3D version