Archived

This topic is now archived and is closed to further replies.

Vlion

random thought on creating liquid movement.

Recommended Posts

Hey all; Heres a idea for making a liquid movement simulator. Create a 2D grid of entities. entities grid[N][N] Fill the entities with these values. Massy/Unmassy. Velcoity. All particles are given a initial velocity. All particles attract each other with relation to their mass. They move through the grid toward each other. As the large ones move, they draw the unmassy particles after them. The unmassy particles attract each other somewhat less than the massy. When 2 particles occupy the same space, the larger one displaces the smaller one. How does that sound for a idea to create turbulence/clouds, etc, etc ? Good/Bad/Done before 10,000 times ? ~V''lion Bugle4d

Share this post


Link to post
Share on other sites
word.

i've been thinking a lot about cellular automations to represent complex flows with simple rules. to be truly interesting you'd want to move to a [n][n][n] grid (3D). i think the problem all boils down to one of computation power, though. to get an interesting enough visual effect you'd need many particles.

i like the idea of massy/unmassy particles a lot. i've also been thinking similarly b/c it allows you to cut down on computation costs. by making the majority of particles fall into an unmassy category and by making the equations that govern the behavior of unmassy particles simple, you can hopefully cut down on lots of computation. i.e. you have processor intensive particles and follower particles that just respond to something very simple.

fun stuff. it'll be interesting to see how stuff like this pans out on a performance / visual appeal scale.

it'd be really interesting to also try and find a way to use hardware graphics accelerators to do a lot of the leg work for you. my understanding of the hardware is low, but i know that other people have cheated some performance out of complex grid calculations by loading the information into some kind of "pixel" format and then applying transforms via the hardware. basically you're talking about manipulatig grids of data, and meanwhile there's hardware designed to specifically do just that. i'm imagining codefying the particle data somehow into pixels and then pushing various matrices onto the stack, executing them and grabbing the modefied data back....

-me

[edited by - Palidine on October 31, 2002 5:41:37 PM]

Share this post


Link to post
Share on other sites
Hi guys

This seems like an interesting way to generate turbulence.
I like the idea of Massy/Unmassy particles but not with that description.

Consider a simple fluid (i.e. a cuboid container of water).
If one part of the container is of lower pressure then the system will attempt to reach equillibrium resulting in a flow of water to the lower pressure area. This is very similar to your massy/unmassy idea where massy particles occupy the space of unmassy ones.

Also by Benoulli''s (sp?) Principle the faster a fluid is moving the lower the pressure is. This is really easy to demonstrate. Take two pieces of A4 paper and blow down the middle. As the air is moving faster inbetween the paper the air is of lower pressure therefore the air on the outside of the paper pushes inwards and the paper sticks together.

So all you would need to do to simulate turbulent water is to have a bunch of particles moving at a faster speed. Ofcourse the system will eventually reach equilibrium but I''m sure you can think of ways to have a constant stimulus i.e. boiling the water at the bottoms therefore particles have more energy therefore move faster therefore cold water moves downwards in to low pressure area and begins to heat up etc.

Fluid Dynamics is one of the most complicated area of physics to analyse though so you will always be limited by processing power.

A possible way of speeding up the implementation is to use a lookup table of sorts.

Pregenerate the effects of different pressure regions e.g. 1P,2P,3P...NP where P is a pressure (e.g. 100 millibars) and when calculating what each particle does find the nearest effect and apply this.

I hope you can find some useful stuff from my random jibberish.

-Karle

Share this post


Link to post
Share on other sites
This actually was generated by thinking in terms of clouds, but 2D is alot easier to conceptualize.

See, what bernoulli`s law does is describe what happens, if I am not mistaken from reading my phyics book.

I''m more trying to simulate the actions and see if the results approximate reality.

Regarding pushing data onto my 3d card.
I''m pretty sure its possible.
I think all I`d need to do is dl the NVIDIA SDK, lookup the GF3 functions and contort my data and push it into one of the functions.

hmmmmm

I''ll have to code some to see what kind of results I get.

~V''lion

Bugle4d

Share this post


Link to post
Share on other sites
A method purely relying on particle interactions is called a Lagrangian one. They have been studied for fluid interactions, but it''s always nice that one comes up with them by his/her own.

The problem is that the interactions between the particles aren''t quite simple, and I don''t believe many have proposed a system whose behavior converges to realistic fluid movement as the number of particles goes to infinity. Another problem is that the computation of the particle relations is inevitably an O(n^2) problem (with faking the complexity can be brought down, of course, so no flaming OK?).

Therefore, computational fluid dynamics traditionally uses a technique based on continous fields, this kind of approach is called an Eulerian one. The idea is to divide the area of simulation into a finite amount of voxels, and assign some variables like velocity to each voxel. Then the so called Navier-Stokes equations are applied on the grid using discretization. Modern techniques allow 2d flows to be simulated interactively/real time, but 3d flows are still a bit too slow for desktop computers.

- Mikko Kauppila

Share this post


Link to post
Share on other sites
quote:
Original post by uutee
Another problem is that the computation of the particle relations is inevitably an O(n^2) problem (with faking the complexity can be brought down, of course, so no flaming OK?).


a) put the particles in some space subdivision (not even a tree, just some grid..)
b) don''t care about far distance affection => do a distance^2 check first between particles to see if they attrakt eachother in some way. if so, do the complex math. if not, forget it.. i think you can drop most of the O(n^2) actually..

still, you have to find a good equation (or several of them) for your particles to behave correctly. and then you have to integrate the (mostly highly unlinear) thing in a good way to get speed. that can be quite difficult..

anyways, it''s the best approach by theory, the only one that makes sence (we''re build by atoms that interfer with each others.. so.................. :D)

good luck with an implementation..



"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
Original post by uutee: WITH FAKING THE COMPLEXITY CAN BE BROUGHT DOWN, OF COURSE, SO NO FLAMING OK?

A hash-grid is of course possible. It doesn''t exactly bring the complexity down, but speeds the computation up by a factor of the number of hash-nodes on average. This factor is usually very large so it''s a good choice.

Another method would be to construct a "semi-Lagrangian" approach where a "particle density grid" is built on each frame (first it''s zeroed and then each particle is added to the grid by increasing the density values near the particle in some weighted fashion). This reduces the complexity down to O(n), but is clearly more inaccurate (actually the grid spacing will also affect the final complexity). An even more faked method would be to use extrapolation on a portion of the particles on each frame, thus eliminating force computation times.

- Mikko Kauppila

Share this post


Link to post
Share on other sites
quote:
Original post by Palidine
i like the idea of massy/unmassy particles a lot. i''ve also been thinking similarly b/c it allows you to cut down on computation costs. by making the majority of particles fall into an unmassy category and by making the equations that govern the behavior of unmassy particles simple, you can hopefully cut down on lots of computation.


The unmassy particles certainly make it possible to model objects that merely go-with-the-flow rather than causing or influencing the flow. And you can save some computation.



Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
quote:
Original post by Vlion
Massy/Unmassy.
Velcoity.

All particles are given a initial velocity.



I''m with you so far...

quote:
Original post by Vlion
All particles attract each other with relation to their mass.
They move through the grid toward each other.



Particle attraction isn''t really the governing force that drives real fluid flow such as water or even air as we normally think about them----as a continuum. Monte Carlo simulation of rarified gases (upper atmosphere, particles in a near vacuum) is somewhat similar to what you propose. What is interesting is that planetary systems are largely driven by gravitational forces. And if you look at the motion of all the objects in galaxies as a whole, you do get something that is very fluid like. You actually even see shock waves in galactic motion, so the gravitation-driven systems do look like a continuum when you zoom far enough out. So you might very well be able to get an interesting, fluid-like result!

quote:
Original post by Vlion
When 2 particles occupy the same space, the larger one displaces the smaller one.



This is an interesting idea. Did you see Jeff Lander''s discussion of flowing river simulation from GDC 2002? He had an approach to dealing with masses of water that occupied the same 2D grid cell that your comment reminded me of... I think his paper is downloadable from his web site, darwin3d.com.


Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
Hi guys,

quote:
I''m more trying to simulate the actions and see if the results approximate reality.


If I understand you correctly does this mean you want to make up a set of laws which have a similar effect to the actual physical laws?
Here is a random suggestion then (it''s probably quite slow but it might give you a few more ideas hopefully).

In 2D:

Divide your container in to equal size squares. Count the number of particles in each square. For each square determine which adjacent square has the fewest particles. Give the particles in your square a drift towards this square. If the square being analysed has the fewest particles then don''t change anything about them.

You''d have to tweak the numbers quite a bit e.g. consider the difference in number of particles when applying the drift, different square sizes.

This would give you a system of massy and unmassy regions and all the calculations can be scaled ofcourse producing a less reliable model for less divisions).

You could also consider all surrounding squares and calculate the drift based on the difference in particles for each one.
e.g. with a linear example for simplicity.

|-|-|-|
|1|X|2|
|-|-|-|

-----+X->

For the central square the total drift would be equal to the negative X drift = - (X-1)/X plus the positive X drift = (X-2)/X.
So if X was 3 the drift would be - (3-1)/3 + (3-2)/3 = -1/3.

Correct me if I''m wrong here but atoms/molecules in a fluid do not in general interact through gravitational or electrostatic means unless the ''fluid'' is at a _very_ low temperature (e.g. bose-einstein condensates).
So all the interactions are just collisions.
In a dense section of the fluid there will be more collisions and therefore more scattering. So this section will expand and eventually you will reach a macroscopic equillibrium.

A lot of crap there so please if I''ve said something stupid hit me :-)

-Meto / Karle

Share this post


Link to post
Share on other sites
You should investigate SPH (Smooth Particle Hydro-dynamics), invented over 30 years ago by Professor Joe Monoghan. It does everything you want and more and is considered one of the best methods for modelling granular flows (which includes fluids).

Cheers,

Timkin

Share this post


Link to post
Share on other sites
First time I`ve been able to get to the forums.

This link seems to describe basically what I would wind up with.

http://www.ventrella.com/Ideas/Fluid/fluid.html

Basically after my last post I sat down and coded up the basic graphics end.
Then I looked at my Process function which would implement the rules, and I went: okaaay, now how do I translate things into wha I want.

uutee:
What I''m after is not modelling precisly.
Like the Ventrella sim, what I''m after is more of a result-based system, not a simulation system.

Because fluid dynamics+turbulence is such a computationally expensive subject, I''m more looking for somthing that merely looks like whats out there- like Ventrella.

SPH is cool looking but I think I''ll have to reasearch it at the uni library.

~V''lion

Bugle4d

Share this post


Link to post
Share on other sites