Fluid modeling is a huge problem for modern desktop computers, so I would not expect maximum performance when trying to get it on a mobile device. Running full Navier-Stokes calculations on the iPhone is likely to be pretty annoying.
However, in the past I was able to perform two-dimensional fluid modeling on limited equipment using gas grills . When using lattice gas machines, you approximate the liquid as a thin hexagonal grid, where particles can move in one of six directions and obey certain collision rules. There are some limitations to this approach (examined by the Boltzmann lattice method), but it can work very well on simulating liquids, even including compressible ones such as air. Why this works well on limited hardware is that these calculations can be performed using bitwise operators and simple lookup tables, without the need for floating point calculations. You might be able to do something similar on the iPhone processor. For more information about this method, you can refer to Appendix A of my Ph.D. a dissertation , where I explain this process and have the source code for the liquid fashion designer that I wrote.
However, if all you want to do is simulate the appearance of water in your application, the answers to the following questions give some good suggestions:
- How to realize ripples of water?
- How to create a water effect look with openGLES on iPhone?
Brad larson
source share