-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[FEATURE] Enhance SAP coupler for coupling between Rigid body and Fem object. #1458
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
Merged
Conversation
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
YilingQiao
reviewed
Jul 28, 2025
YilingQiao
previously approved these changes
Jul 30, 2025
duburcqa
reviewed
Aug 8, 2025
duburcqa
reviewed
Aug 9, 2025
duburcqa
reviewed
Aug 9, 2025
duburcqa
reviewed
Aug 9, 2025
(Note: I'm unsubscribing myself, so please re-tag me if needed) |
@duburcqa First round fix finished. |
Please do so. Thank you!
…On Tue, Aug 12, 2025 at 8:38 PM Alexis DUBURCQ ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In genesis/engine/couplers/sap_coupler.py
<#1458 (comment)>
:
> + # Step 1: Solve w st. L^T @ w = y
+ for i_b, i_e in ti.ndrange(self._B, self.rigid_solver.n_entities):
+ if not self.batch_pcg_active[i_b]:
+ continue
+ entity_dof_start = self.rigid_solver.entities_info.dof_start[i_e]
+ entity_dof_end = self.rigid_solver.entities_info.dof_end[i_e]
+ n_dofs = self.rigid_solver.entities_info.n_dofs[i_e]
+ for i_d_ in range(n_dofs):
+ i_d = entity_dof_end - i_d_ - 1
+ out[i_b, i_d] = vec[i_b, i_d]
+ for j_d in range(i_d + 1, entity_dof_end):
+ out[i_b, i_d] -= self.rigid_solver.mass_mat_L[j_d, i_d, i_b] * out[i_b, j_d]
+
+ # Step 2: z = D^{-1} w
+ for i_b, i_d in ti.ndrange(self._B, self.rigid_solver.n_dofs):
+ if not self.batch_pcg_active[i_b]:
+ continue
+ out[i_b, i_d] *= self.rigid_solver.mass_mat_D_inv[i_d, i_b]
+
+ # Step 3: Solve x st. L @ x = z
+ for i_b, i_e in ti.ndrange(self._B, self.rigid_solver.n_entities):
+ if not self.batch_pcg_active[i_b]:
+ continue
+ entity_dof_start = self.rigid_solver.entities_info.dof_start[i_e]
+ entity_dof_end = self.rigid_solver.entities_info.dof_end[i_e]
+ n_dofs = self.rigid_solver.entities_info.n_dofs[i_e]
+ for i_d in range(entity_dof_start, entity_dof_end):
+ for j_d in range(entity_dof_start, i_d):
+ out[i_b, i_d] -= self.rigid_solver.mass_mat_L[i_d, j_d, i_b] * out[i_b, j_d]
The only way may be to have some very generic ti.func that does LTDL
decomposition and pass everything that it necessary in arguments, without
any simulation related data structure.
I can do this for you tomorrow if necessary.
—
Reply to this email directly, view it on GitHub
<#1458 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM3M7IJQTC23TYMLEQOG7ZD3NKXJVAVCNFSM6AAAAACCKJ23VOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTCMJTHAZTGNBYGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.
Description
Related Issue
Resolves #1450
Motivation and Context
Making SAP solver more general.
How Has This Been / Can This Be Tested?
Tests are added.
Screenshots (if appropriate):
test_fem_articulated.mp4
test_dragon_rigid.mp4
test_fem_rigid.mp4
Checklist:
Submitting Code Changes
section of CONTRIBUTING document.