Page 1 of 1

Fluid simulator

PostPosted: Sun Jun 27, 2010 7:11 pm
by Noobody
Hello, everyone!

I'm not sure if this counts as Algodoo related, but I'll post it anyway.

Ever since I discovered Phun two years ago, I've been fascinated by phsysics computer simulations. It was Phun that inspired me to code my own simulations and it's also thanks to Phun that I discovered Smoothed Particle Hydrodynamics.

Today, I'd like to share a few fluid demos I made using Smoothed Particle Hydrodynamics. It's of course not as fancy as Algodoo and neither that feature-rich, but it's fun to play with. It features multiple fluids and soft bodies interacting with each other. The soft bodies still need a bit of work, because water particles tend to get stuck in the soft bodies, resulting in strange 'jumpy' behaviour, but other than that it runs more or less stable.

Screenshot:
Image
Download: Link

Controls: Press Key 1 oder Key 2 to switch between the two demos. The first one features an emitter and a soft body. Space turns the emitter on/off (ADVICE: Turn the emitter off at max. 7500 particles, or the simulation starts to get laggy). Left mouse click spawns new soft bodies, right click spawns obstacles.
The second doesn't have any special controls and only shows three fluids interacting (red: very heavy; blue: heavy; green: light).


There is also a 3D (and multithreaded) version:
Image
Download: Link

Controls: Arrow keys turn the container, allowing interaction with the fluid (since the gravitation always points downward). As for the thread count, enter the amount of cores on your CPU for optimal performance (but not more than 8). Other numbers will work too, just not as fast.

The 3D version spawned a side-project, namely an offline raytracer, that I'm working on here and then (Youtube video).


Nothing of this would have been possible without Phun and I just wanted to thank Mr. Ernerfeldt for creating it. I hope you enjoy these demos.

Re: Fluid simulator

PostPosted: Fri Jul 16, 2010 8:05 pm
by Sonic
That's pretty awesome. How reliable is the fluid simulation? Is it better or worse than Algodoo's?

Re: Fluid simulator

PostPosted: Sat Jul 17, 2010 12:41 am
by Noobody
Thanks! Well, that's hard to tell. Most probably Algodoo's in terms of stability and accuracy, considering the amount of time and knowledge that went into it. I'm not sure what exactly you mean by reliable, though.

Re: Fluid simulator

PostPosted: Sat Jul 17, 2010 5:49 am
by Sonic
I mean will it compress, or go through objects if you push hard enough?

Re: Fluid simulator

PostPosted: Sun Jul 18, 2010 8:35 pm
by Noobody
It's more or less incompressible, but there'll still be slightly noticable changes in the volume under large compression or with more than 5000 particles.

The particles will also go through very small objects sometimes, but under normal circumstances this hardly ever happens.

Re: Fluid simulator

PostPosted: Mon Aug 09, 2010 9:57 pm
by Bronie12345
i like the way it is multi-threaded in the 3d one, because then i can see the full power of my computer, incase of only having one core doing all the work (like in algodoo >.>)

nice work on this!!