#### Archived

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.

## 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 on other sites
Hmm. Should I post this in another forum?

##### Share on other sites
The physics forum might be more appropriate. I''ll move it for you.

[Moved to: Math and Physics]

##### Share on other sites
Hi

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

http://www.cis.upenn.edu/~fostern/pdfs/foster_siggraph01.pdf

##### Share on other sites
pickups:

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]

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633346
• Total Posts
3011442
• ### Who's Online (See full list)

There are no registered users currently online

×