From what I can tell, the code looks like it's using Jacobi or Gauss-Seidel methods for solving the divergence <-> pressure Laplace equation. I presume Jacobi because that's what's in the GPU gems reference.
At any rate, I implemented a very similar algorithm in Python but replacing the Jacobi solver with a conjugate gradient solver and found the conjugate gradient method to converge to an error of something like 1e-6 in only about 3 iterations. This is compared to >100 iterations to achieve a similar error using the Jacobi method.
My expectation is that WebGL-FS could also benefit from using the conjugate gradient method and so I'm suggesting testing it keeping in mind the following caveats:
My code also included two Laplace solves in the diffusion step which isn't in WebGL-FS so the solver won't be as much of a bottleneck.
I know the default # of Jacobi iterations is only 20 so it's not obvious that the conjugate-gradient solver would be faster
The conjugate-gradient is also a fair bit more complicated to implement
The pressure solve was one of the slowest parts of my code, that may not be true for WebGL-FS
From what I can tell, the code looks like it's using Jacobi or Gauss-Seidel methods for solving the divergence <-> pressure Laplace equation. I presume Jacobi because that's what's in the GPU gems reference.
At any rate, I implemented a very similar algorithm in Python but replacing the Jacobi solver with a conjugate gradient solver and found the conjugate gradient method to converge to an error of something like 1e-6 in only about 3 iterations. This is compared to >100 iterations to achieve a similar error using the Jacobi method.
My expectation is that WebGL-FS could also benefit from using the conjugate gradient method and so I'm suggesting testing it keeping in mind the following caveats: