Jump to content
bandini

Gas Viscosity in flip sim very slow

Recommended Posts

I am doing a very detailed sim that is dependent on viscosity for the look of the sim. Checking the performance monitor, it seems that the Gas Viscosity microsolver is taking a huge amount of time (the majority of time is spent cooking that node). I am at a pretty small particle separation value (0.016). I am storing viscosity directly on the flip particles. I am wondering if there is a better (faster and more efficient) way of dealing with viscosity. My guess is that storing the viscosity on the particles means the viscosity field is created directly from them, and rebuilding that field each time step is what causes the slow-down, but I can't be sure because the node is a black box. I also see that the solve is taking 545 iterations (which sounds like a lot). The only adjustment I can see for efficiency there is the error tolerance slide.

 

So, any advice? I am wondering if it is possible to create a lower resolution viscosity field and if that would be beneficial or just waste resources. (also, i don't know how to do it, lol).

 

Thanks!

Share this post


Link to post
Share on other sites

Viscosity is disabled by default for the reason you're discovering - it requires a lot of computations. As far as I know there's no silver bullet for making FLIP simulations with viscosity perform better. When you say 545 iterations do you means substeps? If so, yeah, that's a lot. Can you share information about the scene like does it have objects that are moving very quickly? How high is the viscosity? What was it doing when using less than 545 substeps?

Share this post


Link to post
Share on other sites

Hi Luke,

 

The 545 iterations (not substeps) are actually a detail you can see if you check out the performance monitor while doing a sim (toggle the flipsolver until you get to the gas_viscosity solver). Actual sim substeps are 1 for global, and 2 for the flip solver (2 max, 1 min). Viscosity values range from 30-20,000 (it is a lava simulation, so I need that full range, if not higher). Currently, just an emitter, one static collision object (done through vdb and volume velocity update), and a sopsolver to handle the cooling and viscosity parts. Definitely, the viscosity solve is the performance hit, and I know that the higher the viscosity, the more iterations are required for a stable solve.

Edited by bandini

Share this post


Link to post
Share on other sites

Yep, as Luke said, that is the expected behaviour. It's the actual viscosity solve that is taking all that time, not the particle-to-field rebuild.

One thing you could try is disabling the pre-conditioner. The old wisdom is that you should only disable it if you have a lot of cores, but I just happened to be optimizing a viscosity sim today and itseemed to run faster without it - on a brand new 4-core i7.

 

If you don't need much resolution from the variable viscosity field, having it in a lower resolution sounds like a great idea. The execution would be a good DOPland exercise ;)

Share this post


Link to post
Share on other sites

Hi Eetu,

 

Thanks for chiming in. You are right about the building of the viscosity field, which I do not think is taking much time. I set up a gas particle to field DOP just to test it out, and it is not significantly contributing to the overhead. I am not sure how to downsample that field to test if a lower resolution would work. Any suggestions? (I am not currently rebuilding the field, just using gas particle to field to modify the viscosity field with the particle values, which I think is what the flip solver does internally anyway).

Share this post


Link to post
Share on other sites

Yes, unfortunately the Viscosity solve is just expensive.  To get accurate rotation from viscous materials we have to solve for each velocity face separately, and there's more terms per variable.  So if the pressure solve is for N unknowns with 7 terms per unknown, the viscosity solve is for 3*N unknowns with 15 terms per unknown.  Building and solving that big sparse matrix is just expensive unfortunately.  I can say there are improvements on the horizon.

Share this post


Link to post
Share on other sites

Thanks, John. "improvements on the horizon" sound great. I am happy to beta test when appropriate.

Share this post


Link to post
Share on other sites

Thanks, John. "improvements on the horizon" sound great. I am happy to beta test when appropriate.

 

Unfortunately (well, probably fortunately) I'm not in charge of such things. I'm afraid the standard answer for beta testing is "contact your account representative".  

 

By the way, you can try increasing the error tolerance on the Gas Viscosity DOP to get fewer internal solve iterations, but it's tough to get really high viscosity values while allowing a lot of error.  But it's worth a try; it shouldn't break anything or become unstable.

Share this post


Link to post
Share on other sites

you can try having lower values, and the map on points.
then you multiply velocity values down with your map as a look up post solve. so that the new solve has less movement.
that way you will get slower moving fluids where you have high viscocity and faster ones where you have lower settings.
then to get the stacking you can try to use surface tension and divergence...

the combination of that works for me normally doing high viscos fluids hanging and moving on fast moving characters/objects

Edited by JuriBryan

Share this post


Link to post
Share on other sites

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

×