# ZenoGD

Member

22

## Community Reputation

142 Neutral

• Rank
Member

I'm not sure if this is still true, but a couple of generations ago the GeForce cards stopped supporting user-defined OpenGL clip planes in hardware as another way to differentiate the Quadro line.
2. ## Jacobi for Solving Fluid Pressure

Quote:I had a closer look at the mathematics (wiki) today and I think it is not appropriate for shaders. Right, that's the other problem, it does certain things that are not suited to GPU (like finding maximum values and sums) so it would be difficult to write and may not be faster than a CPU version in the end. Quote:On the other hand: The multigrid's restriction and interpolation steps smell like it could be done "abusing" a 2D down/upsampling of the textures, but I really don't know. Haven't found a good multigrid tutorial either, unfortunately. But if the boundary conditions pose a problem... Thanks for the info. I had exactly the same thought! Multigrid is just applying something like Jacobi or Gauss Seidel on multiple "mipmaps" of your grid so that the effects of these solvers (which only access nearest neighbors) don't take so many iterations to travel from one end of the grid to the other. That is, you're helping those algorithms that work well on small scale divergences work efficiently on all scales. GPUs are great at making smaller copies of textures. That's also why I keep saying that CG is needed more for liquids than for gasses - with liquids you almost always have gravity, which adds a huge global divergence that's really hard for Jacobi/GS to get rid of. I think the most difficult part of a multigrid solver (just like fluid simulation in general) would be getting the boundary conditions right. How do you handle a one cell wide boundary after you downsample? That boundary will be lost but it should still affect the fluid at that larger scale. It might be pretty easy if your sim has no internal boundaries. Quote:I'm also considering using a cubic smoothing as shown here at least for the visuals. Yep, I did that, it is a big improvement for rendering. Using the same function for lookup during advection will keep a lot of detail in your sim too. Quote:@ZenoGD: Your info is very helpful, thanks. You're welcome. Maybe I'll post some screenshots tonight comparing these things (cubic on/off, CG vs GS, etc) to help people decide where to spend their effort.
3. ## Jacobi for Solving Fluid Pressure

First let me make a correction, my sim uses either CG or Gauss-Seidel, not Jacobi as I had previously stated, but the GS and Jacobi methods are pretty similar. Anyway, I think the Jacobi, Multigrid, and Gauss-Seidel solvers are all O(N) where N is the number of grid cells, but CG is worse than that - off the top of my head I think it would be O(N^3/2) on a square grid in 2D without a preconditioner. I shouldn't try to dissuade you too much - CG might be faster to converge under some combination of grid sizes and error tolerances so if you have time give it a try. It's just been my experience that there are a lot of easier things you can do that will give you a bigger visual difference in output - I'd put cubic interpolation at the top of that list. Unfortunately I don't know of any good multigrid tutorials and I haven't implemented it myself. I think the people who write tutorials are mostly researchers who don't care much about speed so they end up using CG since everyone is familiar with it and the boundary conditions are easier to handle than they are in multigrid.
4. ## Jacobi for Solving Fluid Pressure

Quote:Original post by Geometrian I think I ought to focus on the conjugate gradient first. Sooo . . . conjugate gradient shaders, anyone? Just to clarify: I don't think you'll be happy with CG unless you need the accuracy for simulating liquids where mass loss is really obvious. It will be slower than Jacobi and challenging to implement on GPU. I think 80 Jacobi iterations is overkill. Try 10-20 and see if you can tell a difference.