Skip to content

Aero recipe: filter degenerate cells with consistent measures - #1973

Draft
peterdsharpe wants to merge 14 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-hilift-dataset
Draft

peterdsharpe wants to merge 14 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-hilift-dataset

Conversation

@peterdsharpe

@peterdsharpe peterdsharpe commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1970: main → #1970#1973. The current #1970 head (e2ff58109108d67da4bb26eb8bb35a47b6cb045e) is merged into this branch. Merge #1970 first; this PR uses its unified cell/point measure API and centroid measure transfer. It does not depend on #1971. Review the changes above #1970.

Keep valid surface faces and their positive quadrature measures aligned through filtering and centroid conversion. Previously, a thin triangle could pass a geometric cross-product check while the Gram-based area calculation returned zero, leaving its centroid with an unusable measure for weighted losses.

  • Compute triangle areas from direct area components, with a rescaled norm to avoid overflow and underflow when squaring them. The calculation preserves the input dtype and works in 2D, 3D, and higher-dimensional embeddings.
  • Add the recipe-local DropDegenerateCells transform to the DrivAerML, HiLift, and SHIFT-SUV surface pipelines before MeshToDomainMesh. It recomputes areas from the current coordinates using the same routine as Mesh.cell_areas, rejects zero/non-finite areas, slices cell fields and complete sampling-corrected measures together, and retains vertices. It ignores cached areas; an entirely rejected mesh has empty connectivity and cell fields.
  • Exercise the saved-sample reader, configured rotation and translation, filtering, centroid targets, point measures, and weighted-loss gradients. Fix the rotation axis index to use a Python integer so the configured OmegaConf axis list can be indexed.

Validation: 267 geometry, normals, measure, centroid-conversion, augmentation, and compilation tests passed, including CPU/CUDA, reduced-precision autocast, and gradients. The recipe suite passed 207 tests, including all 15 filtering/pipeline regressions; its one remaining pre-existing failure is test_sdf_normals_near_wall_use_face_normal, addressed separately in #2011. All pre-commit hooks passed. Downstream on the ISLA branch, an actual ISLA forward pass and weighted training loss/backpropagation pass on CPU and CUDA with retained thin faces and sampling-corrected measures.

MeshToDomainMesh in cell_centroids mode turns each source cell into an
interior query point and discards the cells. Any integral over those
points (forces, area-weighted losses or metrics) then has no measure to
weight by, and after SubsampleMesh the retained cells' measure weights
are lost as well.

Record cell_measures(mesh) (area times composed measure weights) on the
interior under the reserved point_data key TARGET_QUADRATURE_MEASURE_KEY,
aligned one-for-one with the centroids. Reject the key as a user target
or as a pre-existing input field so it cannot be silently shadowed.

Also validate the shape of the reserved per-cell measure-weights field
and of tensor factors passed to compose_measure_weights: TensorDict only
checks the leading dimension, so a (n_cells, 1) tensor was storable but
broadcast wrongly against cell_areas.
…ransforms

Two small recipe-local mesh transforms, used by the surface dataset
configs (DrivAerML, HiLiftAeroML, SHIFT-SUV):

- ComputeFreestreamDirection writes the unit freestream direction to a
  new global_data leaf (U_inf_dir); U_inf itself stays physical.
- DropDegenerateCells drops cells whose area is zero or non-finite,
  which can happen to sliver cells after float32 centering/rotation and
  would otherwise yield all-zero surface normals.

Registered via src/datasets.py like the other recipe-local components;
unit tests in tests/test_domain_transforms.py.
@copy-pr-bot

copy-pr-bot Bot commented Sep 8, 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.

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test db19fab

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS review map

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

@coreyjadams — 8 file(s)
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/README.md
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/drivaer_ml_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/highlift_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/shift_suv_estate_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/shift_suv_fastback_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/datasets.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/domain_transforms.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_domain_transforms.py
@peterdsharpe — 8 file(s)
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/README.md
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/drivaer_ml_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/highlift_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/shift_suv_estate_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/datasets/shift_suv_fastback_surface.yaml
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/datasets.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/domain_transforms.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_domain_transforms.py

No CODEOWNER

  • CHANGELOG.md

Comment /codeowners-info to refresh.

…dit-fix-1973-sept9

Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
@peterdsharpe peterdsharpe changed the title Aero recipe: ComputeFreestreamDirection and DropDegenerateCells surface transforms Aero recipe: add freestream direction and robust degenerate-cell filtering Sep 9, 2026
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 414f03b

@peterdsharpe peterdsharpe changed the title Aero recipe: add freestream direction and robust degenerate-cell filtering Aero recipe: filter degenerate cells with consistent measures Sep 19, 2026
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 0a7d751

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 1285236

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