Sunday, July 13, 2008

Softbodies and soft bugs...

In the interests of interest, I have been working on the softbody section of code in the fluid plugin. Thats right, its called Physics.jar for a reason. The entire structure and methods used are there so that fluids, softbodies and rigid bodies can be integrated into one single engine. This will allow fluids to interact with these objects. But it does mean less optimized "sub solutions".

Currently the softbodies are working, with some known shortcomings while I sort out the finer details. Also I keep finding bugs. Right now there needs to be a little bit of a clean up of the raw simulation code. I have too many methods that don't properly document the contract for the engine. So boundaries are a bit of a interesting mix of problems really. Its all experimental code at the core and thus its far from clear what methods work well in practice. A good example is the no slip boundary conditions that are frequently used. When you are using fixed mass particles this turns out to be a really bad approximation, as the boundary layer is smaller that the particle resolution. Simple friction with velocity normals work very well and are much more stable.

I have now read more papers than I care to count on the subject of SPH. There is a general pattern however, and that's that its generally about a 1st to 2nd order method at best. Boundaries are where the side is let down, and even thou there are corrections (that I use) the smoothing kernels limit the local approximation across the parameters. To make a long story short, I'm not aiming for a 3rd/4th order method. In fact I estimate that I have 1st order at the boundaries and 2nd order throughout the fluid. I use only first order explicit time integrators. The combination turns out to not be so bad after all. So I keep the code that works, and its a little adhoc right now.

So the current softbody list of features and antifeatures:
  • Interact with each other
  • Interact with fluids. ie can float
  • Must be a triMesh
  • the mesh can be set to approximating to smooth deformations.
  • Interactions with each other is from vertex to face. So few vertexs means they tend to interpenetrate a bit.
  • Unfortunately you need quite small time steps to keep stable because of the explicit integration scheme.
And a very small example...
Soft body and fluids

2 comments:

Anonymous said...

Deltor - that looks like ice cubes in a glass will be the next thing!

Though ice cubes are more rigid than softbodies, or not?

I love to see that video and the progress of physics.

Harald

Anonymous said...

I agree - it's really great to see you making progress on this plugin. :)

Keep at it!

Cheers,
TroY