Sign in to follow this  

Smoothing kernels for fluid dynamics

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on creating water using smoother-particle-hydrodynamics as described in this paper: http://graphics.ethz.ch/Downloads/Publications/Papers/2003/mue03b/p_Mue03b.pdf One of the key points of the algorithm is to smooth values like pressure across multiple water particles using a smoothing kernel. They give some rules about how the kernel works - it must be normalized is one. Then the kernel they use is this: W(h,r) = (315/(64*3.14*h^9)) * ((h^2-r^2)^3) where h is the smoothing size, and r is the value you're asking for. Problem is, this function isnt normalized?? If you take the integral for h=1, it's .71, not 1. And the integral for h=.1 is 71. But this smoothing kernel is used in numerous other papers. So am I understanding it wrong? Does it not need to be normalized? Or maybe I need to normalize it myself by identifying what ratio i should divide the function? I'm not sure what would happen if it isn't normalized, I suppose it would return values larger than it should when you queried for them, but maybe thats ok because it balances out on both sides? Anyone have any experience with this kind of thing?

Share this post


Link to post
Share on other sites
The rule as listed is:

Integral W(r)dr = 1

I would think it would have some other notation if I was supposed to integral r^3? Though the equation for the smoothing kernel is kind of strange:



Why is there a seperate term on the right after the brackets? I assume youre just supposed to multiply that but why didnt they put it in the original equation.. Then again its been a long time since my calculus classes..

Share this post


Link to post
Share on other sites
The bracket with the conditional terms just makes sure that the equation stays non-negative and limits the influence of a particle. The stuff on the left is just for normalisation.

If you spherically integrate over the function that is multiply with 4*pi*r^2 for the spherical symmetry and integrate from 0 to h with respect to r you should get 1. That's at least what I just got. And AFAICT this result makes sense too.

So as long as you are simulating in R^3 the function is fine. If you are working in 2D you will need to change the normalisation term.

Good luck,
n115

Share this post


Link to post
Share on other sites
As a matter of fact I am planning to use it for a 2d simulation rather than a 3d, so I'll need to modify the function to work in 2d space.

Now I get to demonstrate my calculus ignorance with some easy questions :)

How do I spherically integrate a function? And how is it different if I just want to integrate it circularly, in 2 dimensions?

Thanks for everyones help!
-John

Share this post


Link to post
Share on other sites
I get it now :)

I'll explain it case anyone else comes across this thread (and just to get it out of my head).

The equation (h^2 - r^2)^3 is a nice unnormalized smoothing function. For the purposes in the paper, though, they needed it to be normalized in 3 dimensions.

So how do you normalize it? First you have to integrate it, and in the paper they do that spherically. To integrate it spherically, each value of 'r' needs to apply not just to a single value, but the entire 3d-shell at that radius, a shell of width 'dr'.

So if we multiple our smoothing kernel by 4*pi*r^2 (the formula for surface area of a sphere of radius 'r'), then we can integrate it to get the sum in 3d space. Thus the integral we need to normalize is:

(h^2-r^2)^3 * 4*pi*r^2

After multiplying this all out, integrating, and combining terms we get:
(pi/315) * (420h^6r^3 - 756h^4r^5 + 540h^2r^7 - 140r^9)

This equation gives the integral up to location 'r', and when r=h we want this equation to equal 1, since we need it to be normalized across h. So we can assign r=h and substitute that in and make it equal to 1. Solving that, we get:
315/(64*pi*h^9)

And thats where they get that term from. So all that is the easy stuff they left out of the paper for people who understand calculus better than me :P

Sooo for 2d, we do the same thing, but this time multiply by the circumference of a circle, 2pi*r, since that is the area the kernel will affect at 'r' in a 2d simulation. This proceeds using the same logic as above and yields the term:


4/(pi*h^8)


I tested this and it works! The integral will indeed be normalized. So the final kernel function for the "Particle-Based Fluid Simulation for Interactive Applications" paper if you're using 2D instead of 3D is:

W(r,h) = (4/pi*h^8)*(h^2-r^2)^3

Hope this helps someone, it was kind of fun relearning all this stuff. Thanks heaps to everyone who replied!
-John

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

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