# Does someone plan to simulate Fluid on 3D

This topic is 3725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to simulate 3d Fluid, and found some papers about it. But still cannot implement it in 3d. Does someone have some suggestions. 3d codes of the simulations would be best for me... Thanks for you attention.

##### Share on other sites
3D fluid and 2D fluid are basically the same idea. Is it that you're having problems understanding how a fluid simulation works, or that you're having problems scaling up to 3D?

##### Share on other sites

I understand that Crane's chapter in GPU Gems 3 is 3D, but I haven't got my copy yet.

##### Share on other sites
Smoothed Particle Hydrodynamics

##### Share on other sites
Hey this is what I'm doing right now. Like someone suggested read the Stam's paper on his stable solver.

Then visit Mark Harris' page:

http://www.markmark.net/

Read his paper on simulation of clouds. From there follow the references to other papers.

I'm at the point of implementation. At this point I pretty much understand the mathematics behind the stable solver. If you need any help we can work together here.

What I'm doing right now is doing a basic 2D implementation in c++, as a testbed. From there I will probably proceed to a GPU implementation.

##### Share on other sites
I'm also reading a book called Numerical Solutions to P.D.E's, just for kicks LOL.

##### Share on other sites
Quote:
 Original post by xissburgSmoothed Particle Hydrodynamics

Yes, this is a nice technique for modeling fluids with support for splashing, etc. It can be computationally expensive to keep track of the proximities of a large # of particles, e.g., uniform grid is easy to manage but might not cull away enough particles...but hierarchical grid (octree, kd-tree) too expensive to maintain with particles moving around... Also, can be expensive to extract isosurfaces for rendering (though you could use particles to render).

##### Share on other sites
Warning: Possible misinformation, proceed with caution.

Awhile ago I implemented a very simple ray-tracer. I implemented an algorithm called Buckysort/search (I wanted to test it against other algorithms).

http://www.mcnett.org/

His algorithm can be implemented on the GPU. So one may want to look into this algorithm and application to SPH.

My ray-tracing implementation (without any SIMD optimizations) was very slow. But from my tests this algorithm is very fast for searching of nearby regions, i.e collision detection of nearby objects. My ray-tracing adaptation was probably not implemented correctly.

##### Share on other sites
There is another algorithm well suited for dynamic ray-traced scenes, forgive me, but I don't recall the name...

LOL.

##### Share on other sites
If all the particles are the same size (or at least nearly?) in the particle-based approach, then I think a grid would be vastly superior to other methods..

..because a grid is very cheap to update dynamically at O(n) whereas the tree-based methods usualy scale at O(n log n) for dynamic updating (often a full rebuild is best)

..The tree based methods do full O(n log n) collision detection, which is pretty good, but because the particles are (nearly?) the same size a very good grid size can be defined and that too should at least approach O(n) in practice.

..standard grid implementations blow off a lot of memory tho..

##### Share on other sites
Some one tell me a address

"http://graphics.ethz.ch/teaching/imagesynthesis_06/miniprojects/p3/index.html"

But it was written in Linux, Can someone convert it to that in windows???

##### Share on other sites
Youying, the link you provide is coded in SDL and OpenGL. It should be trivial to compile it under windows if you know SDL and OpenGL, probably without any code changes. Even if you didn't, the code should be easy enough to read through to understand how 3D fluid simulation works.

##### Share on other sites
Quote:
 Original post by NumsgilYouying, the link you provide is coded in SDL and OpenGL. It should be trivial to compile it under windows if you know SDL and OpenGL, probably without any code changes. Even if you didn't, the code should be easy enough to read through to understand how 3D fluid simulation works.

---------------------------------------------
Thanks , I will have a try

##### Share on other sites
to erwincoumans :

Maybe those are what I wanted most recently, Thanks a million ; )

to others:
I will rate all replies. Thank all you!

##### Share on other sites
Hi,

Choosing a fluid simulation scheme greatly depends on your type of fluid :
- Do you need to track the free surface of the flow (as for a liquid and as opposite to a gaz)
- Is it a multi-phase simulation and can there be great differences in viscosities or densities between the fluids
- How do you plan to render the scene (is it for real-time, offline rendering etc.)

But basically I would say that today's reasearch in the area focuses on grid simulations with level sets (which is a signed distance field). You could also use the simple MAC grid for its simplicity.

Revelant articles in this scope would be in my opinion :
- Nick Foster and Dimitri Metaxas, Realistic Animation of Liquids (extended), Graphical Models and Image Processing, 58(5), (1996), pp. 471-483.
- Jos Stam, "Stable Fluids", In SIGGRAPH 99 Conference Proceedings, Annual Conference Series, August 1999, 121-128.
- Douglas Enright, Stephen R. Marschner, Ronald Fedkiw: Animation and rendering of complex water surfaces. SIGGRAPH 2002: 736-744.

Mark Harris' article on GPU Gems2 is a good way to start, even though only gaz is simulated.

Hope this helps,
Jeff.

##### Share on other sites
Quote:
 Original post by funkeejeffounetBut basically I would say that today's reasearch in the area focuses on grid simulations with level sets (which is a signed distance field). You could also use the simple MAC grid for its simplicity.

However, the only real-time and useable liquid libraries that I've seen - PhysX and Meqon (RIP) - use particle approaches, so I wouldn't really agree with the statement/suggestion above (though I admit I haven't checked up on things in the last few years). When I last looked, most (almost all!) of the grid-based research was concerned with non-realtime solutions.

Also, some non real-time libraries use particle methods too - e.g. RealFlow I think.

And... SPH in 2D is pretty trivial (though the rendering is tricky). Porting it to 3D is easy too (but the rendering gets even more tricky if you want it realtime). The basic method is a lot easier to get working than grid-based methods.

##### Share on other sites
Quote:
 Original post by erwincoumansHere are some links to 3D fluid implementations:Takashi AMADA's SPH + source codeKenny Erleben's OpenTissue, has some fluids + source codeHarada's GPU fluids, rigidbody and cloth, movies/executables/no source codeHope this helps,Erwinhttp://bulletphysics.com, Bullet physics library

I hate to piggyback this thread, but are there any more source code examples of SPH? Even a simple one will do. I looked at Takashi Amada's one, but it seems berift of comments, and deals with things in a much more complex way than I'm interested in (I'm really just looking for a simple code-based introduction to SPH).

##### Share on other sites
Quote:
 Original post by WinegumsI hate to piggyback this thread, but are there any more source code examples of SPH? Even a simple one will do. I looked at Takashi Amada's one, but it seems berift of comments, and deals with things in a much more complex way than I'm interested in (I'm really just looking for a simple code-based introduction to SPH).

My jiglib. Look for water 2D or something...

##### Share on other sites
Anyone read this book on SPH:

http://www.worldscibooks.com/engineering/5340.html

Any good? I browsing through the preface, sounds interesting.

##### Share on other sites
I glanced through the intro materials for that book online, and I think its probably a decent book. The material feels well presented, but perhaps a bit rushed, and I don't expect it to be a great introduction to fluids simulation in general. But, if you are already familiar with fluids simulation or are willing to go elsewhere for more in depth backround material.

##### Share on other sites
Quote:
Original post by MrRowl
Quote:
 Original post by WinegumsI hate to piggyback this thread, but are there any more source code examples of SPH? Even a simple one will do. I looked at Takashi Amada's one, but it seems berift of comments, and deals with things in a much more complex way than I'm interested in (I'm really just looking for a simple code-based introduction to SPH).

My jiglib. Look for water 2D or something...

hi sorry but i can't see the 2d water there? have i missed it or?

##### Share on other sites
Quote:
 Original post by Winegumshi sorry but i can't see the 2d water there? have i missed it or?

4th paragraph on that page says "You can download my test executable that uses the library here (19 May 2007). Extract everything before running it. It includes the source code."

The source code not only includes jiglib, but also jigtest (my test environment for jiglib) but also a directory called water.

##### Share on other sites
well i've read the code and it looks promising (you have a very nice, clear style of programming. the fact you use those comment things serves to help this).

my only issue is that it won't compile! trying to compile jiglib generates this error:

1>BSCMAKE: error BK1506 : cannot open file '.\debug\line.sbr': No such file or directory

##### Share on other sites
Quote:
 Original post by Winegumsmy only issue is that it won't compile! trying to compile jiglib generates this error:1>BSCMAKE: error BK1506 : cannot open file '.\debug\line.sbr': No such file or directory

Hmmm can't help with that. I don't _think_ I had any problems using MS VS Express - but I can't remember for sure if I did compile it with that.

##### Share on other sites

This topic is 3725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628647
• Total Posts
2984034

• 10
• 9
• 9
• 10
• 21