Fluid dynamics

Started by
17 comments, last by Inian 17 years, 11 months ago
taby - I'd love a copy of the code you made, all help is welcome and being a programmer code is just so much my friend.

ajas95 - Yes I made some calculations myself on the matter and it grew very fast, I'm thinking of limiting the amount of grid sections in one direction to solve this though. But I don't know if this will produce proper results.

Spoonbender - Thanks for the warning. Actually I can read Danish and would very much love a copy of your thesis if available. Also I'd love a copy of your code and any despription available other than the thesis. (I'm somewhat partial to UML and state-/flowcharts if you have used anything like that)

John Schultz - Well what I am looking for is just a model for calculating how flow behaves with 1 fluid. An example would be lets say a cut out of the ocean a bit underwater, no air to deal with and no 'sides' just the ocean floor. I'm also going to neglect differences in heat/salidity etc and just assume all the water is the same and then 'push' water in from a point (a point can be an entire side) and have water exit somewhere (most likely the opposite side). To visualize that this is happening I'm going to add a set of particles (plankton maybe) to the entire scene and have them follow the flow showing it's presence. The particles/Submarine etc won't be affecting the flow at all, just the ocean floor and whatever large bedrock that is added(Probably not realistic but it is what my client wants).

MrRowl - Sorry I Was a bit harsh earlier, I'm actually not doing to well IRL and am very hostile/defensive and misread you. Thanks for the links and the input! And again sorry for being unfriendly.
Advertisement
Quote:Original post by Inian
John Schultz - Well what I am looking for is just a model for calculating how flow behaves with 1 fluid. An example would be lets say a cut out of the ocean a bit underwater, no air to deal with and no 'sides' just the ocean floor. I'm also going to neglect differences in heat/salidity etc and just assume all the water is the same and then 'push' water in from a point (a point can be an entire side) and have water exit somewhere (most likely the opposite side). To visualize that this is happening I'm going to add a set of particles (plankton maybe) to the entire scene and have them follow the flow showing it's presence. The particles/Submarine etc won't be affecting the flow at all, just the ocean floor and whatever large bedrock that is added(Probably not realistic but it is what my client wants).


I wrote up some ideas regarding your desired sub/water/particle behavior here.
Quote:Original post by John Schultz
Quote:Original post by Inian
John Schultz - Well what I am looking for is just a model for calculating how flow behaves with 1 fluid. An example would be lets say a cut out of the ocean a bit underwater, no air to deal with and no 'sides' just the ocean floor. I'm also going to neglect differences in heat/salidity etc and just assume all the water is the same and then 'push' water in from a point (a point can be an entire side) and have water exit somewhere (most likely the opposite side). To visualize that this is happening I'm going to add a set of particles (plankton maybe) to the entire scene and have them follow the flow showing it's presence. The particles/Submarine etc won't be affecting the flow at all, just the ocean floor and whatever large bedrock that is added(Probably not realistic but it is what my client wants).


I wrote up some ideas regarding your desired sub/water/particle behavior here.


Excellent article. A lot of the information explained in the article is presented from a different view than what I learned. An amazingly straight-forward reference, nice.
Quote:Original post by John Schultz

I wrote up some ideas regarding your desired sub/water/particle behavior here.


Very interesting indeed, although not exactly what I am looking for. It seems that I would myself have to add points in the world where vortices would emerge with this method, if not I have misunderstood.



After talking with my supervisor we decided that since there has already been soe nice models for this kind of simulation (and even ways to optimize them) that I would try and see if I couldn't find more and dish them out agains eachother making a comparison instead of just implementing one of them.

My first method would be the one made by Stam that Spoonbender optimized.

Also your particle method sounds interesting and I have seen several people use particles to simulate fluid flow. Although I have no name for this type of method I was wondering if anyone out there knows of one for internal fluid solving and what it is called. This would be my possible 2nd choice.

My third choice is the Cellular Automata mentioned in Game Programming Gems 3 although I have found very few people implementing this specific model (A kind of reverse engineering of Stams' method) and would appreciate it if anyone knows of any such project.



These are the methods I know of right now and my supervisor says I should have at least 4 but not more than 6. Does anyone know of any other ways of solving internal fluid dynimics in real-time? Do you think my first 3 choices are ok or should I not use them?

Anyway, I sppreciate all the responses people have given thus far and for all the help I have recieved.

Cheers!
Quote:Original post by Inian
Also your particle method sounds interesting and I have seen several people use particles to simulate fluid flow. Although I have no name for this type of method I was wondering if anyone out there knows of one for internal fluid solving and what it is called. This would be my possible 2nd choice.


The method suggested by John isn't really about simulating fluid flow, but about simulating the effects in a purely visual manner - so it's just a "sophisticated" and partly physically-based partical system like you'd find in many games. It's programmed from the top down (in a way) - you know the effects you want to see so you program the particle behaviours that would result in this.

The particle-based fluid simulation method used in physics engines like PhysX and Meqon is (almost certainly) based on a method called Smoothed Particle Hydrodynamics (though also called other things). It's programmed from the bottom up in that the behaviour of each particle is derived from an approximation of the Navier-Stokes equations - each term in those equations being expressed in terms of particle properties (and properties of the distribution of particles).

Consequently, there are two "particle methods" here, bringing your total up to 4 :)

Quote:Original post by taby
Excellent article. A lot of the information explained in the article is presented from a different view than what I learned. An amazingly straight-forward reference, nice.


Thanks, taby. I'll update the page from time to time, when I have time [smile].


Inian, if you have access to 3DSMax, you can test out some of the concepts (in pretty much real-time) using Vortex, Wave, Ripple, (etc.) SpaceWarps and particle systems. Other 3D packages will have similar systems (Maya, SoftImage, etc.).

In your analysis it will probably be useful to compute a metric based on CPU cost-per-pixel. Start with float-ops per pixel to get a basic idea, then benchmark (cache/memory, etc., will make a big difference).

More info on SF-CFD:

Quote:
If you use SF-CFD along with an implicit volume for the sub (ellipsoid or rounded cylinder), it will be intuitively easy to implement, visualize, and debug. If using macro particles (small rigid body spheres) you can increase apparent pixel density by rendering alpha-blended rotating billboards of hundreds or thousands of particles (a texture mapped sphere might also work OK, though the curvature may cause issues with the edges. In the case of the billboard: the texture map would be created with many particles of various sizes, alpha-densities, and have a roughly circular perimeter). Texture coordinate tricks can also be used to swirl and distort the rendered billboard (instead of a simple quad, use a grid with sufficient density to perturb the texture in a pleasing manner).


Googling for SF-CFD (Spatial Field CFD) may not turn up anything; I used the term to describe this system (may have been used before, perhaps not; may be a better term out there).

Whichever method use (could be hybrid), you may need to use some tricks to get the pixel density high enough to render and interact with in real time (and do so on common consumer hardware (unless you are developing for XB360/PS3 in which case you can go to town using the extra processors)). This brings to mind Aegia's fluid demos (HW accelerated): macro particles blended together with what appears to be 'blobby/implicit/meta-balls' rendering. A cool CFD demo and CFD in a real-time game engine are two different animals.
Quote:Original post by Inian
Also your particle method sounds interesting and I have seen several people use particles to simulate fluid flow. Although I have no name for this type of method I was wondering if anyone out there knows of one for internal fluid solving and what it is called. This would be my possible 2nd choice.


a method involving particles instead of a grid is most often referred to as a lagrangian method.
Quote:Original post by Eelco
Quote:Original post by Inian
Also your particle method sounds interesting and I have seen several people use particles to simulate fluid flow. Although I have no name for this type of method I was wondering if anyone out there knows of one for internal fluid solving and what it is called. This would be my possible 2nd choice.


a method involving particles instead of a grid is most often referred to as a lagrangian method.


Lagrangian CFD particle system.
Hamiltonian CFD.
Lots of different ways to formulate and solve the problem. I would start with the simple and intuitive, and find out how far it scales (since you will more easily be able to tweak/tune/optimize/debug).
Very interesting indeed. Then your (John) method will be a particle based method that is similar to CA which is grid based, both relying on the programmer to properly describe rules for the desired behaviour. These will make for an interesting comparison all by themselves in my opinion.

For the reason the Hamiltonian link was down right now but I did a quick google and looked it up, from what I could see it seems to be a method based on calculating curves. I'm on my way out right now so I only had a quick glance at it but it looks somewhat complicated to me.

So now I have 4 methods without counting any form hamiltonian solver.
1. Spoonbenders optimized version of Stams' solver. (Couldn't find any specific name for this method.)
2. SF-CFD.
3. CA.
4. Smoothed Patricle Hydrodynamics.

Is there any method you think I have missed and should add? Do you think I should add a Hamiltonian solver to the comparison?

Anyway, thanks again with all the help everyone.
/Cheers

This topic is closed to new replies.

Advertisement