Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (773) Games in Android Showcase (230) games submitted by our members Games in WIP (856) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 Fluid Dynamics  (Read 3839 times) 0 Members and 1 Guest are viewing this topic.
darkprophet

Senior Devvie

 « Posted 2006-03-17 23:54:32 »

Hi all,
Ive lately been working on a real time fluid dynamics solver, and its mostly been fun and easy to code. However, ive come up against a problem in the diffusion step of the equation.

Originally, i faked the diffusion of the velocity field by using Oddlab's algorithm for Thermal Decomposition, which is basically this:

For every pixel, find the von-neumann neighbourhood
For every neighbour, find the difference between the neighbour and the current pixel
Find the biggest difference among the neighbours
Divide that difference by 2
Add the new divided difference to the lowest point of the neighbours (the one you obtained the difference from)
Subtract the divided difference from the current pixel

And that has worked fine so far. However, as you can see, the sampling of the neighbours (i.e. extend the setting of the current pixel out to include not just the von-neumann, but also the neighbours' neighbours) or the difference, does not take into account the dt of that frame, and as such, the algorithm becomes extremely unstable and the simulation blows up when dt is high.

So, anybody has any ideas on how to extend that algorithm further to include dt ?

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine

Junior Devvie

Java games rock!

 « Reply #1 - Posted 2006-03-18 03:20:41 »

Hmmm. I for one have no particular knowledge about fluid dynamics. In general, however, when solving differential equations there is the easy way, i.e. Euler's method, and then there is a number of more sophisticated methods that are somewhat more reliable what with the blowing up and so on. Are you familiar with Heun's method and - more generally - Runge-Kutta methods? Unfortunately I do not have any idea how to implement these in terms of partial differential equations such as the Navier-Stokes equations which you are most likely using. In a related matter you may wish to specify which kind of physical problem you are solving in greater detail.

The funny thing is that Oddlab algorithm generates exactly one google result, which leads me to believe that there is a more common term for this, supposing that it is indeed a well-known algorithm.

The common way of solving such problems would - I believe - involve some kind of finite element method which might not be feasible in realtime. So I guess I know no real solution here. But if some of the terms above are not known to you, you may wish to investigate them further.
darkprophet

Senior Devvie

 « Reply #2 - Posted 2006-03-19 22:20:58 »

The Euler's method (and all the other methods you've said) are used to solve first order differential equations. The problem with solving Naiver-Stoke equations is that they are partial differential equations of the second order (!!!) which is a *real* killer. PDE's alone are bad, but second order, that just bad luck

<offtopic>
Coincidently, i met my old maths teacher today, and he is now doing research into numerical fluid dynamics and more specifically, how "swirls" arise in real life and not in numerical and accurate solutions of the Naiver-Stoke equations, and that led him down elliptical partial differential equations, which by the name alone sound horrible.
</offtopic>

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
thijs

Junior Devvie

Lava games rock!

 « Reply #3 - Posted 2006-03-20 09:27:54 »

You know about Jos Stam's work in this field right?

http://www.dgp.toronto.edu/people/stam/reality/index.html
http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf
http://www.dgp.toronto.edu/people/stam/reality/Talks/FluidsTalk/FluidsTalk_files/frame.htm

Thijs

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
darkprophet

Senior Devvie

 « Reply #4 - Posted 2006-03-20 14:13:38 »

I didn't know about it no, but now that i've read it, the ideas presented in it are very interesting. However, its patented, and I just realised my velocity movement step is very very similar to his. Boo Hisss!

Im looking at simulating fluids using the particle approach now rather than the conventional velocity grid now, it seems to make much more sense. If you are interested, Im working from a paper titled "Smoothed Particle Hydrodynamics". Seems to be the business for real-time applications...

I'll post back if I have anything working at decent speeds

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
thijs

Junior Devvie

Lava games rock!

 « Reply #5 - Posted 2006-03-20 21:48:24 »

Quote
I didn't know about it no, but now that i've read it, the ideas presented in it are very interesting. However, its patented, and I just realised my velocity movement step is very very similar to his. Boo Hisss!

Ah ok, wasn't sure if you where expirimenting on your own or you where referring to problems implementing his work...

I would be very surprised if you wouldn't be allowed to use his work because he patented it. Im not sure about this, but I remember researchers can also patent work to prevent others from exploiting their idea commercially... it might be worth checking out if thats the case...

BTW, a very cool game that uses Stam's fluidsolver can be found here: http://www.plasmapong.com/

Quote
Im looking at simulating fluids using the particle approach now rather than the conventional velocity grid now, it seems to make much more sense. If you are interested, Im working from a paper titled "Smoothed Particle Hydrodynamics". Seems to be the business for real-time applications...

Anything like this guy is doing? : http://www.ss.iij4u.or.jp/~amada/fluid/

Also related to fluids, I found this project very interesting:
http://rtfss.sourceforge.net/

Good luck and I'd be very interested to read about any progress you make here!

Thijs

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
darkprophet

Senior Devvie

 « Reply #6 - Posted 2006-03-30 09:58:46 »

Thanks for the links, ive managed to hack together a Fast Fourier Transform thingy and ported over the code for that at the end of his paper and it looks nice, that fluid is running around advocating itself and all sorts, well pleased.

So the next challenge I set myself was volumetric, animatable clouds and after having read two of the papers, i ditched all the techniques and decided to do it on my own, the DP way

I'll post in another thread how I did it (it needed fluid dynamics too!)

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Pages: [1]
 ignore  |  Print

 EgonOlsen (1862 views) 2018-06-10 19:43:48 EgonOlsen (1884 views) 2018-06-10 19:43:44 EgonOlsen (1253 views) 2018-06-10 19:43:20 DesertCoockie (1685 views) 2018-05-13 18:23:11 nelsongames (1351 views) 2018-04-24 18:15:36 nelsongames (1968 views) 2018-04-24 18:14:32 ivj94 (2740 views) 2018-03-24 14:47:39 ivj94 (1943 views) 2018-03-24 14:46:31 ivj94 (3033 views) 2018-03-24 14:43:53 Solater (1084 views) 2018-03-17 05:04:08
 Deployment and Packagingby mudlee2018-08-22 18:09:50Java Gaming Resourcesby gouessej2018-08-22 08:19:41Deployment and Packagingby gouessej2018-08-22 08:04:08Deployment and Packagingby gouessej2018-08-22 08:03:45Deployment and Packagingby philfrei2018-08-20 02:33:38Deployment and Packagingby philfrei2018-08-20 02:29:55Deployment and Packagingby philfrei2018-08-19 23:56:20Deployment and Packagingby philfrei2018-08-19 23:54:46
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org