Amazingly enough we are just needing to do this myself and you may notice the viscoelastic stuff is still only working for SPH fluids - there is no way to wire up the Gas Elasticity DOP and have it work. Even though it's named “Gas”, it operates on SPH particles and not fields.
Currently I am trying to get some results with a small amount of viscosity and some surface tension (wire in a Gas Surface Tension into the FLIP Solver). This might work for some parts of some shots, but some elastic behaviour would be very much appreciated.
The problem with the SPH elasticity is that it was some stiff forces that required a higher order integrator to be stable.
It is possible with a lot of node surgery to get them to work with FLIP - Nick had them working here with the old FLIP Solver. You have to open up the FLIP solver and wire into the gas integrator a force-update version of the elastic forces.
I think the right way for viscoelastic for FLIP is with the Gas Strain Force & Gas Strain Integrate style approach, as per “A Method for Animating Viscoelastic Fluids”. You'll have to move the strains between particles and fields in a sensible way.
We've not had a chance to experiment ourselves with this to see how it shakes out, however. But in theory all the nodes are there.
good work Ian! Now the only thing missing is to be able to create plasticity with fluids?! I had no luck achieving this, at some point cranking up the viscosity/density settings doesn't really harden the fluid anymore. So is this somehow possible in H12?
That setup looks good for strain. The only big thing missing is the strain isn't being rotated by the velocity field. So if you have a blob that is stretched in X, then rotated 90 degrees, it will still try to restore along the X axis. Gas Velocity Stretch is supposed to fix this, but it is a pretty subtle thing.
It's also a bit not-FLIP like because you are keeping a field from frame to frame. A proper FLIP approach would be to store the strain attribute on the particles and rebuild it from there. This gets a bit tricky, however. But with proper extrapolation you could probably avoid the damping you are currently getting. Without any viscosity, the fluid should keep jiggling forever, while as you see it quickly settles in your example.
As for things not properly seizing up with large viscosities… Have you tried increasing the particle radius scale on the flip object? The default 1.2 is good for splashy sims, but results in lots of underresolved ballistic particles. These particles also have effective zero viscosity. So if you are seeing drips off the edges of your model, try setting the particle radius scale to 2.0. This ensures all particles are resolved (but introduces viscosity) so they should stay together better.
Nice work figuring the strain stuff out, Ian. I think you might still be missing advection of the strain matrix, and as Jeff points out, that's tricky with FLIP since ideally the particles represent the entire state of the simulation at any given time.
I put together a little FLIP elasticity asset that uses the Strain DOPs and FLIP/PIC for advecting the strain matrix, storing the strain in attributes on the particles. The substepping requirement for the explicit GasStrainIntegrate DOP makes it pretty expensive, as does GasParticleToField on a matrix attribute, but it might be useful in some contexts. Also, in my tests it seems like adding a small amount of viscosity helps damp / stabilize the elasticity force.
There may be a bug in Gas Velocity Stretch's handling of matrices, so at the moment I've got that DOP bypassed within the OTL (and offhand I'm not sure the rotation works with a FLIP-style update anyway).
Awesome. Thanks Johner! Makes my life easier. I just got to the point where it was ‘working’ and was like, COOL. Having it track with the particles makes sense… was going to look into that later, but now I don't have to.
I should have mentioned, if you're wondering what those obscure Alpha and Gamma parameters represent on the GasStrainIntegrate DOP, they're from this paper (which is actually somewhat readable as these things go):
Yeah, found that link after Jeff mentioned the paper earlier. Good stuff, but still a bit over my head. I understand what I'm reading, just not the formulas themselves. Thanks again for all your work on the flip solver.