Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluid dynamic simulation, with obstacles

I'm trying to write a fluid dynamic simulator on the HTML5 canvas. I've found some real damn cool stuff on the internets that always look like a promising starting point, but they are all cell-based and use some crazy math.

I'd like to be able to add arbitrary obstacles (lines of any orientation, circles, etc) to make things more interesting, but I've no idea where do begin.

Does anyone know of some fairly simple equations for fluid simulation that include obstacles of any orientation? Alternatively, could anybody point me towards the math required to take one of the above examples and add obstacles?

I know that this question borders on something I should ask mathoverflow, but they seem more into the theory stuff. Apologies if I'm in the wrong area. I don't really know where to begin - if anyone's worked on fluid simulation with arbitrary obstacles before, I could use some pointers.

Accuracy takes a back seat to simplicity here.

Thanks!

like image 603
So8res Avatar asked Feb 04 '11 02:02

So8res


People also ask

What is fluid dynamic simulation?

This is a simulation of a two-dimensional fluid. Initially the fluid is flowing from left to right, and a linear barrier (shown in black) diverts the fluid and creates vortices. The colors indicate the curl, or local rotational motion, of the fluid.

Why is fluid dynamics hard?

Fluid mechanics is difficult indeed. The primary reason is there seems to be more exceptions than rules. This subject evolves from observing behaviour of fluids and trying to put them in the context of mathematical formulation. Many phenomena are still not accurately explained.


2 Answers

The best book to read for introduction to graphics-oriented fluid simulation is "Fluid Simulation for Computer Graphics" by Robert Bridson (disclaimer: he was my PhD advisor). http://www.cs.ubc.ca/~rbridson/fluidbook/

Ultimately, there is plenty of math involved, but there's also plenty of code examples to clarify things for the less math-inclined.

It covers mainly the cell-based approach you mentioned. The other main alternative is "Smoothed Particle Hydrodynamics" or SPH. Matthias Muller has some papers about this if you're looking to get started.

like image 101
batty Avatar answered Sep 19 '22 13:09

batty


Fluid dynamics isn't a simple topic. All that "theory" they like over at the other site is just the way this field works.

The simplest example of fluid flow is 2D, incompressible, irrotational, laminar flow. I'd start by looking into that.

But it's not an easy field. There's no "Teach Yourself Computational Fluid Dynamics In Ten Days" books out there.

like image 40
duffymo Avatar answered Sep 18 '22 13:09

duffymo