Implement Compatible Particle-In-Cel (CPIC) Particle-Rigid-Body Coupling - #3
Open
kurtkuehnert wants to merge 47 commits into
Open
Implement Compatible Particle-In-Cel (CPIC) Particle-Rigid-Body Coupling#3kurtkuehnert wants to merge 47 commits into
kurtkuehnert wants to merge 47 commits into
Conversation
sebcrozet
requested changes
Mar 15, 2023
sebcrozet
left a comment
Member
There was a problem hiding this comment.
Thanks! This approach is great. I think we can generalize it to 2D too.
fixed the particle distribution
added support for 2D
kurtkuehnert
force-pushed
the
generate_cdf
branch
from
March 15, 2023 11:54
87ac5aa to
e90e836
Compare
50x speedup?
bug in get_node_id_at_coord
added cutting sand example
improved rigid particle generation
improved visualization
grid based or cdf
kurtkuehnert
marked this pull request as ready for review
April 11, 2023 15:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the CPIC algorithm of the "Moving Least Squares Material Point Method" paper.
Its purpose is to couple the GPU particle simulation (sparkl) with the CPU rigid body simulation (rapier).
Therefore we generate a set of evenly spaced rigid particles across the surface of all rigid bodies. These particles are then used to build the Colored Distance Field (CDF) stored as part of the simulation grid. The CDF is a convenient data structure for performing inside/outside queries against all colliders. It stores the adjacency information, a tag indicating, which side of the collider it is on, and the unsigned distance to the closest collider. This gird CDF is then interpolated using the robust MLS technique for each particle of the simulation. Subsequently, the CPIC algorithm partitions the grid nodes surrounding each particle into two sets (compatible/incompatible) based on their affinity and tag information. These sets are handled differently during particle-to-grid and grid-to-particle transfer. The compatible nodes (i.e. the nodes that the particle has not collided with) are the only ones that are influenced by the particle in the p2g phase.
For the g2p phase all compatible nodes are updated. The incompatible nodes (i.e. the node that the particle has collided with) are projected alongside the collider surface using the reconstructed CDF data. Thereby they apply an impulse on the rigid body and a penalty force onto themselves, to avoid penetrating the colliders.
Additionally, this PR updates the examples (and adds a couple of new ones) to showcase these new capabilities.
Finally, I have added a visualization UI to debug the state of the particles, the grid, and the rigid particles.
Todo:
Future Improvements: