Open source 3D SPH solver

Started by
4 comments, last by DominikSeifert 12 years, 4 months ago
Hi,

I am trying to find an open source solver i can use in my Ogre application so needs to be c++ really and also 3D. I have found a few i managed to get OpenTissue working but the demo application for SPH seems very complex and not very easy to implement in Ogre.
I found a 2D solver by Danny Chapman i think http://www.rowlhouse.co.uk/water/index.html but i am not sure how i could convert it into 3D any help with that would be really good.

So does anyone kno any others i could look at implementing or have any ideas what i could use?

Thanks
Adam
Advertisement
There was SPH source code published on the CD accompanying the book, Game Programming Gems 6. The code was for Chapter 2.6 titled "R[font=Verdana, Arial, sans-serif]eal-Time Particle-Based Fluid Simulation with Rigid Body Interaction." It was an adaptation, by a fellow in Japan, of the approach documented by Matthias Müller in the following paper, as I recall:[/font]
[font=Verdana, Arial, sans-serif]
[/font]
[font=Verdana, Arial, sans-serif]http://matthiasmueller.info/publications/sca03.pdf[/font]
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Ah i will check it out thanks :)
I don't know if you realized it yet, but just to share my experiences:
1. The OpenTissue SPH solver (and probably any other default implementation) is way too slow for a game. Any game would require a much faster, incremental and adaptive solution.
2. The simulation of the particles is slow, but the implicit surface creation is even much much slower and will kill performance even for small amounts of fluid.
3. The API is not really great but I guess it works, as long as...

3a) You are not planning to mix fluids. For some reason the default implementation requires you to initialize the system with a single material even though the formulas are all valid even for different types of particles, if you compare them to those mentioned in papers discussing fluid-fluid interaction in SPH, such as "Particle-Based Fluid-Fluid Interactions" et al. The formulas for different materials are there but commented out. Once you change the integrators to use the particle material, rather than the initially set material, it is just a matter of commenting out some lines and uncommenting some others to support mixed fluids.

3b) You don't need incompressibility. At any reasonable time step, the gas constant cannot be set high enough to reduce pressure fluctuations to a level where heavier fluids, i.e. most liquids, under influence of gravitation do not pulse up and down.

3c) You are able to estimate how many particles you need up front. The system is quite static and wants to allocate space for all particles that will ever be in the system to be allocated right away. That is a certain optimization measure that was not well wrapped into the API, so you need to tell it how many particles you will produce when initializing the system.

For more information on SPH and, specifically, the OpenTissue implementation, I recommend you to read the very comprehensive implementation document: "Lagrangian Fluid Dynamics Using Smoothed Particle Hydrodynamics"

It would be interesting to find out what "From Dust" does for it's fluid simulations! Either way, I am sure, they use different levels of detail (consider the most of the ocean in From Dust lays still anyway, and the overall appearance of the moving water seems much simpler than that of any general solver/simulator).
One idea might be to pre-evaluate certain scenarios (like the Tsunami, or "sucking up" liquid or amassing sand in one place in From Dust) on a static geometry and then just scale and "replay" them on top of a much simpler representation of fluid, but that's just a thought....

Sorry for responding so late...
There's this one:

http://www.rchoetzlein.com/eng/graphics/fluids.htm

Cheers,
Mike
I also played around with Fluids v.2 (formerly known as Fluids v.1), and looked into the source, and I found that it is mostly a simpler version of the OpenTissue implementation (e.g. it does not have Surface Tension) with similar flaws in the API (it does not even have a concept of Material, and instead defines all material-dependent variables via a configuration per fluid "system" which in the end yields the same effect as the OpenTissue implementation). On the plus side, it has a fully working cuda implementation of the solver. However, I was unable to test that, since my current computer does not have an NVidia card.

This topic is closed to new replies.

Advertisement