Skip to content

[BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid.#2857

Merged
duburcqa merged 7 commits into
Genesis-Embodied-AI:mainfrom
yeezhouyi:feature/sph-buoyancy-fix
Jul 20, 2026
Merged

[BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid.#2857
duburcqa merged 7 commits into
Genesis-Embodied-AI:mainfrom
yeezhouyi:feature/sph-buoyancy-fix

Conversation

@yeezhouyi

@yeezhouyi yeezhouyi commented May 28, 2026

Copy link
Copy Markdown
Contributor

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, where sigma is the closed-form plane integral of the cubic spline kernel. Since sigma integrates to 1/2 across the support band, a covering layer of particles transmits exactly p per 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.p by 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.
  • Full tests/particles/, tests/coupling/ and tests/rigid/test_islands.py suites pass locally, including the water-settling check of test_deformable_parallel, which is bit-identical to main thanks to the fixed-link exemption.

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread genesis/engine/couplers/legacy_coupler.py Outdated
@duburcqa

duburcqa commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Please add a minimal unit (integration) test with analytical validation.

@duburcqa
duburcqa force-pushed the feature/sph-buoyancy-fix branch from 189e249 to cdce737 Compare July 20, 2026 05:45
@duburcqa duburcqa changed the title [BUG FIX] Add pressure-based buoyancy force transfer in SPH-rigid coupling (#2070) [BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid Jul 20, 2026
@duburcqa duburcqa changed the title [BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid [BUG FIX] Fix missing buoyancy on rigid bodies submerged in SPH fluid. Jul 20, 2026
@duburcqa

Copy link
Copy Markdown
Collaborator

@codex review

yeezhouyi and others added 6 commits July 20, 2026 10:59
…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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread genesis/engine/couplers/legacy_coupler.py
@duburcqa
duburcqa force-pushed the feature/sph-buoyancy-fix branch from cdce737 to 69f7ea6 Compare July 20, 2026 09:03
duburcqa
duburcqa previously approved these changes Jul 20, 2026
@duburcqa
duburcqa force-pushed the feature/sph-buoyancy-fix branch from 3b800fc to 16ab62a Compare July 20, 2026 10:52
@duburcqa

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 16ab62a65e

ℹ️ 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".

@duburcqa
duburcqa merged commit 5ca64b4 into Genesis-Embodied-AI:main Jul 20, 2026
20 checks passed
robotlearning123 added a commit to oceanworldlabs/genesis-world that referenced this pull request Jul 22, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Strange behavior of SPH.Liquid (rho param)

2 participants