Sign in to follow this  
Falhar

SPH and liquid similation

Recommended Posts

Falhar    124
Iam trying to implement 2D liquid simulation using Smoothed Particle Hydrodynamics(SPH). But I dont understand it well, mainly because my math is not high enough(Iam still at high school) and engish is not my language. I understand SPH well(at least basic concept). But i dont understand how Navier-Strokes equations are applied in it (because I dont understand Navier-Strokes equations(wtf is divergence and Laplacian?)). I found some material on it (Particle-Based Fluid Simulation for Interactive Applications paper), but this requies math knowledge i dont have. I also found some source code, but it was far away from learning material. Does anybody know about some better source on this topic or more materials? Sorry for bad english.

Share this post


Link to post
Share on other sites
Vern777    160
Divergence of a vector field is a scalar field.

Roughly speaking Divergence can be thought of as the extent to which the field explodes, or diverges, at some point. I would suggest you read up a text on Vector Analysis.


Suppose we have a vector field F = F1i + F2j + F3k,

The divergence of F is a scalar field, denoted div F, defined by

div F = partial derivative of F1 with respect to X + partial derivative of F2 with respect to Y + partial derivative of F3 with respect to Z.



Argghh! This is annoying way of writing math... Hmm I suggest you do some research on this.

Laplacian of a scalar field f is defined to be div (grad f).

How about this, try reading over the following pages on divergence and laplacian. If you have any questions ask here. If I have time I will try to explain this properly. Sorry if I'm not very helpful :(

http://mathworld.wolfram.com/Divergence.html

http://en.wikipedia.org/wiki/Divergence

http://mathworld.wolfram.com/Laplacian.html

http://en.wikipedia.org/wiki/Laplacian

Share this post


Link to post
Share on other sites
Vern777    160
A good book on vector analysis is: Introduction TO Vector Analaysis by Harry F. Davis.

Man I'm not being very helpful... telling you to read up on Vector Analysis :(

Share this post


Link to post
Share on other sites
grhodes_at_work    1385
John Anderson's book, "Computational Fluid Dynamics" is a pretty good starting point to understanding the nature of fluids and the math behind the Navier-Stokes (and related) equations. The subject gets deep pretty fast, but Anderson does present things in an extremely intuitive way. It is just a damned good book if you want to really begin to understand fluids and how we the human race currently use math to model fluids. The fact that you are in high school will not make it more difficult for you to learn a lot from the beginning sections of this book. Even if your math isn't advanced.

Computational Fluid Dynamics

The SPH technique, as far as I understand it (I've studied CFD, theoretical, and experimental fluids quite extensively, but not the SPH technique specifically) implements Navier-Stokes by choosing kernel functions that happen to satisfy the Navier-Stokes and other governing equations when plugged in. So it is simply the smart design of those kernel functions that enables SPH to model fluids correctly. You don't necessarily have to fully understand fluids to implement this.

By the way, strictly speaking, the "Navier-Stokes" equations are a representation of the conservation of momentum, nothing else. But, in fact, there are three conservation laws for fluids: 1) conservation of momentum (Navier-Stokes); 2) conservation of mass (aka "continuity"); and, 3) conservation of energy. There also various weird conditions or constraints that show up from time-to-time to fixup some messy bits (a closing equation such as the ideal gas law to enable satisfaction of conservation of energy, the Kutta condition to deal with circulatory flows around sharp corners, Rankine-Hugoniot jump conditions to satisfy the 2nd law of thermodynamics and compute physically "correct" compression-only shock waves, etc.). Anyway, this won't mean much...its just a side note.

With SPH, the kernel functions must be chosen to satisfy Navier-Stokes and energy, but continuity is satisfied simply by keeping a fixed # of particles each with a constant mass. (The local density of fluid varies as particles move around, and it is the density that fits into the various governing equations, but the mass carried by a single particle stays constant.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this