Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Conjugate gradient solver for fluids with internal boundaries.

This topic is 5323 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

Hello. Im now working on implementing a conjugate gradient solver for the fluids effect, instead of a gauss-seidel solver. Now, I managed to figure out how to construct the coefficients matrix and the two vectors, but ran into two problems: 1. What to do with boundary cells. I mean, if I write the equation system for the pressures, should I pass the boundary cells, if they are present, to the right-hand side, and actually store them in the solution vector, together with velocity divergent? something like - Pi+1,j + Pi-1,j + Pi,j-1 - 4Pi,j = DivUi,j - Pi,j+1 where in this specific equation Pi,j+1 is a boundary cell? 2. What should i do when objects are present in the fluid? if they are static, I can still precompute the matrix, taking into account the new boundary cells, and the reduced number of equations, but if they move, i should recompute this matrix every step, and then I''m sure I wouldnt see any performance gain. Am I right, or maybe occupied cells doesnt change the matrix? Would be glad to know the answer. Thanks.

Share this post

Link to post
Share on other sites

Try reading "Practical Animation of Liquids" by Foster and Fedkiw. It helped me understanding how to handle it. You can find it here:


Share this post

Link to post
Share on other sites

Maybe I'm in the same situation with you. I trying to implement the smoke in the way of "Visual Simulation of Smoke" by Stam et. al.

Of course it's in 3D form.

"where in this specific equation Pi,j+1 is a boundary cell? ", I am managing it by setting the value P of the cell out of the boundary equal to its neighbor in-boundary cell.

For example, if there are 3 out-boundary neighbor of Pi,j , the coefficient of Pi,j alters to -3, which originally is -6.

I think this approach is an simple implement of Neuman boundary condition(@p/@n=0). n is the normal. i change n to x,y or z axis, since now i simulating the smoke in a box.

although i didn't know whether it's right or not, i think it may a bit useful for you. your 2nd question is also my question. if you have any idea, would you please share it? ill trace the topic.

thanx for your patience for my poor English.

[edited by - mljack on April 21, 2004 5:11:08 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!