Skip to content

Aero recipe: prevent near-wall SDF sign noise from reversing normals - #2011

Open
peterdsharpe wants to merge 2 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-near-wall-normals
Open

peterdsharpe wants to merge 2 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-near-wall-normals

Conversation

@peterdsharpe

@peterdsharpe peterdsharpe commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Near-wall volume queries can receive a tiny negative signed distance from float32 roundoff. ComputeSDFFromBoundary previously used that sign to reverse the fallback face normal, turning an outward normal inward for points on the wall.

Use separate coordinate-scaled tolerances for the SDF sign and closest-point direction. The direction fallback retains its broad 128 * eps * coordinate_scale band; only negative distances within the smaller 8 * eps * coordinate_scale sign-noise band default to the outward face normal. Interior points beyond the sign-noise band retain inward normals, including when the direction fallback is active. Stored SDF values and closest-point directions outside the fallback band are preserved.

For example, translating a box by 10,000 units gives a direction-fallback tolerance of about 0.153. Points 0.01 and 0.1 units inside still receive inward normals; a point on the wall receives the outward face normal. This addresses the interior-normal regression identified in review.

Validation

  • 21 SDF-transform cases passed. Coverage includes real near-wall geometry, controlled sign noise, and real interior/on-wall/exterior queries at original coordinates and after translation along one or all three axes. Near-wall and translation cases run on CPU and CUDA; the translated-geometry regression exercises both winding-number and pseudo-normal SDF signs.
  • Eight translated-interior cases failed on the previous PR head and passed after separating the tolerances. The original near-wall correction remains covered, along with degenerate faces, unchanged SDF values, and cache preservation.
  • 19 synthetic recipe configuration tests passed.
  • Ruff checks and all applicable changed-file pre-commit hooks passed.

Checklist

  • I am familiar with the contributing guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • The changelog is up to date with these changes.
  • An issue is linked to this pull request.

Dependencies

None. Based directly on main.

@copy-pr-bot

copy-pr-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS review map

Current for commit 209f3deb3ad6. An approval covers every file listed for that owner; one owner is sufficient for shared files.

⏳ @coreyjadams — 2 file(s)
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/sdf.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_sdf_transform.py
⏳ @peterdsharpe — 2 file(s)
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/sdf.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_sdf_transform.py

No CODEOWNER

  • CHANGELOG.md

Comment /codeowners-info to refresh.

@peterdsharpe
peterdsharpe marked this pull request as ready for review September 19, 2026 21:41
@greptile-apps

greptile-apps Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

The PR appears safe to merge; the previous interior-normal issue is fully fixed and no new actionable failures remain.

Summary

This PR makes near-wall SDF normal orientation use separate coordinate-scaled tolerances for direction fallback and sign uncertainty.

  • Preserves inward normals for resolved interior points inside the broader direction-fallback band.
  • Keeps outward face normals when tiny negative wall distances are consistent with float32 sign noise.
  • Adds CPU/CUDA coverage for translated geometry, both SDF sign methods, wall noise, and preservation of stored SDF values.

Reviews (2) · Last reviewed commit: "Preserve resolved interior normals in th..."

Comment thread examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/sdf.py Outdated
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

@greptileai

peterdsharpe added a commit to peterdsharpe/physicsnemo that referenced this pull request Sep 19, 2026

This branch has not been deployed

No deployments
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.

1 participant