-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Compatible Particle-In-Cel (CPIC) Particle-Rigid-Body Coupling #3
Open
kurtkuehnert
wants to merge
47
commits into
dimforge:master
Choose a base branch
from
kurtkuehnert:generate_cdf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
sebcrozet
requested changes
Mar 15, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
changed the title
Generate CDF
Implement Compatible Particle-In-Cel (CPIC) Particle-Rigid-Body Coupling
Apr 7, 2023
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: