Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone fluid simulation

Somebody know fluid engine for iphone?I need water and gases simulation.

like image 746
Sergey Zenchenko Avatar asked Nov 23 '09 17:11

Sergey Zenchenko


2 Answers

Simulating fluids is a tremendous challenge for modern desktop computers, so I would not expect the greatest performance when trying to get this working on a mobile device. Running full Navier-Stokes calculations on the iPhone is probably going to chug pretty badly.

However, in the past I was able to perform 2-D fluid modeling simulations on limited hardware using lattice gas automata. With lattice gas automata, you approximate a fluid as a fine hexagonal grid, where particles can travel in one of six directions and obey specific collision rules. There are some limitations to this approach (addressed by the Lattice Boltzmann Method), but it can do a very good job of simulating fluids, even including compressible ones like air. Why this works well on limited hardware is that these calculations can be done using bitwise operators and simple lookup tables, without the need for any floating point calculations. You might be able to make something like this work on the iPhone's processor. For more on this technique, you can consult Appendix A of my Ph.D. dissertation, where I explain the process and have source code for a fluid modeler I wrote.

That said, if all you want to do is mimic the appearance of water in your application, the answers to the following questions provide some good suggestions:

  • "How to implement water ripples?"
  • "How do I make a water effect view with openGLES on the iPhone?"
like image 142
Brad Larson Avatar answered Oct 18 '22 17:10

Brad Larson


I have just released an iPhone fluid simulator that uses a compressible particle in cell method. I have a video here: http://www.youtube.com/watch?v=-CCeeh8EzuA

An incompressible fluid simulator requires many iterations, so I use a compressible simulator. The good thing is if you can make a compressible simulator stable enough, it usually looks incompressible enough.

My app is called GFlow on the app store if you want to see it in action.

like image 26
Grant Kot Avatar answered Oct 18 '22 15:10

Grant Kot