[BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid.#2857
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c75d2106f8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Please add a minimal unit (integration) test with analytical validation. |
189e249 to
cdce737
Compare
|
@codex review |
…pling (Genesis-Embodied-AI#2070) The SPH-rigid coupling only transferred force when a particle was actively colliding (rvel_normal_magnitude < 0). This meant stationary submerged objects never experienced upward buoyancy force from static fluid pressure. Fix: When a particle overlaps with the rigid body (signed_dist < 0) and has positive pressure, directly transfer the pressure force to the rigid body using the SPH pressure, particle volume, and support radius. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ancy (Genesis-Embodied-AI#2070) DFSPH never writes particles.p (unlike WCSPH which uses equation of state), so the pressure-based buoyancy force transfer added in the previous commit was a no-op for DFSPH scenes. Fix by adding a kernel that derives the implicit pressure from the density solve residual: p = -(drho - 1.0) * dfsph_factor * rho0 after the density solve converges and writes it to particles.p. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…yancy (Genesis-Embodied-AI#2070) Validates that submerged rigid bodies receive physically meaningful upward force from the SPH-rigid coupling and that WCSPH pressure fields follow the hydrostatic gradient. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…e integral and accumulate the DFSPH implicit pressure over the density solve.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cdce737db3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
cdce737 to
69f7ea6
Compare
3b800fc to
16ab62a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Introduces LegacyCouplerOptions.sph_akinci_boundary (default False) for WCSPH boundary-particle buoyancy. Stock Genesis-Embodied-AI#2857 coupler path is unchanged. Includes coupling tests, underwater examples, and UNDERWATER.md.
Description
Rigid geoms now receive the static pressure force of the surrounding SPH fluid. Each particle within kernel support of a geom surface applies the ghost-mirrored pressure force
2 * p * V * sigma(signed_dist)along the surface normal, wheresigmais the closed-form plane integral of the cubic spline kernel. Sincesigmaintegrates to 1/2 across the support band, a covering layer of particles transmits exactlypper unit area, so Archimedes buoyancy is recovered with no tuning constant. The particle receives the opposite reaction, keeping the exchange momentum-conserving. Fixed links are exempt: they cannot respond to the force, and fluid resting on them keeps behaving exactly as before.DFSPH scenes get a physically meaningful
particles.pby accumulating the per-iteration stiffness of the density solve, which matches the equation-of-state pressure that WCSPH already provides. In a settled column the bottom pressure matches the exact column weight per unit area to within 0.2%.Hibernated links now wake when they receive a coupling force from any solver: couplers write forces directly into the coupling-force accumulator, bypassing the wake-aware public force API, and forward dynamics only consumes the forces of awake entities, so a sleeping floater would stay frozen while the fluid keeps receiving the opposite reaction.
Related Issue
Resolves #2070
Motivation and Context
Submerged rigid bodies never floated: the coupling only transferred momentum from particles approaching the surface, and the pressure solve holds fluid nearly static, so static pressure was never transmitted. On main, a rigid ball sinks at every density from 200 to 1500 kg/m^3 in a rho=1000 fluid. With this change the flotation threshold lands near the fluid rest density: between 800 and 1000 under DFSPH, between 500 and 800 under WCSPH (its stiff equation of state under-reads pressure near boundaries; exact Archimedes under WCSPH would require boundary-particle sampling, out of scope for the legacy coupler).
How Has This Been / Can This Be Tested?
tests/coupling/test_sph_rigid.py::test_rigid_flotation_follows_density_ratio: a rho=200 ball must rise and a rho=1500 ball must sink, both pressure solvers, n_envs 0 and 2. Fails on main.tests/particles/test_sph.py::test_pressure_carries_column_weight: bottom-band pressure of a settled column must carry the analytically exact column weight per unit area and decrease with height. The DFSPH case fails on main.tests/coupling/test_sph_rigid.py::test_coupling_force_wakes_hibernated_link: a hibernated resting ball must wake up and float when fluid is teleported over it. Fails with the wake-up scan disabled, with the ball frozen at its resting height.tests/particles/,tests/coupling/andtests/rigid/test_islands.pysuites pass locally, including the water-settling check oftest_deformable_parallel, which is bit-identical to main thanks to the fixed-link exemption.Checklist:
Submitting Code Changessection of CONTRIBUTING document.