Skip to content

Aero: fix sampled GLOBE forces and clarify recipe quadrature - #1971

Open
peterdsharpe wants to merge 18 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-ht-forces
Open

peterdsharpe wants to merge 18 commits into
NVIDIA:mainfrom
peterdsharpe:pr/recipe-ht-forces

Conversation

@peterdsharpe

@peterdsharpe peterdsharpe commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Subsampled GLOBE DrivAerML visualization forces discarded the sampling correction and integrated using geometric triangle areas. Keeping half the surface therefore halved the reported force in a constant-traction case. Postprocessing now preserves the effective measure, and force integration consumes it without retaining reference cell fields that conflict with predictions.

The unified aero recipe already uses effective measures. This PR corrects its force documentation and subsampling warning, and verifies that exported query measures remain usable in physical coordinates.

  • Explain the assumptions for unbiased Horvitz–Thompson estimates: correct inclusion probabilities, fixed field values, and a fixed physical moment origin. Approximate sampling, geometry-dependent predictions, and sample-dependent centering can introduce bias.
  • Verify sampled recipe forces at training and physical scales, plus exported point measures and integrals through serialization.
  • Cover GLOBE force postprocessing on full and subsampled surfaces, with and without prior measure corrections, including all three force coefficients and preservation of source measures.

Builds on the measure API from #1970, which is now merged.

Validation: 41 focused CPU tests passed across GLOBE dataset measures and recipe force/inference tests; all applicable pre-commit hooks passed. Three new regression cases failed before the GLOBE fix. Earlier broader recipe validation had 185 passes, one skip, and a pre-existing failure in test_sdf_normals_near_wall_use_face_normal, also reproduced on #1970 and the pre-update #1971 head (22219d40).

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.
…, drop query measure from saved outputs

forces.py and infer.py said that force/moment coefficients from a
subsampled vehicle surface "cover only the kept cells" and shrink by the
kept-area fraction. That is no longer true: SubsampleMesh records each
kept cell's inverse inclusion probability as a measure weight and
Mesh.integrate multiplies by it, so the coefficients are unbiased (if
noisy) estimates of the full-surface integrals. Correct the module
docstring and the once-per-run warning, and pin the behaviour with a
test on a subsampled closed surface.

MeshToDomainMesh now records the query measure on the interior. It is in
training-geometry units and would be stale after rescale_geometry, so
attach_and_save drops it alongside the training-space targets.
@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.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS review map

Current for commit e39cd39a6e84. 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/src/forces.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/infer.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_forces.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_infer.py
  • physicsnemo/datapipes/transforms/mesh/init.py
  • physicsnemo/datapipes/transforms/mesh/transforms.py
  • test/datapipes/transforms/test_mesh_to_domain_mesh.py
  • test/datapipes/transforms/test_nested_fields.py
⏳ @negin513 — 4 file(s)
  • physicsnemo/datapipes/transforms/mesh/init.py
  • physicsnemo/datapipes/transforms/mesh/transforms.py
  • test/datapipes/transforms/test_mesh_to_domain_mesh.py
  • test/datapipes/transforms/test_nested_fields.py
⏳ @peterdsharpe — 6 file(s)
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/forces.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/src/infer.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_forces.py
  • examples/cfd/external_aerodynamics/unified_external_aero_recipe/tests/test_infer.py
  • physicsnemo/mesh/calculus/measure.py
  • test/mesh/calculus/test_measure.py

No CODEOWNER

  • CHANGELOG.md

Comment /codeowners-info to refresh.

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test e39cd39

…dit-fix-1971-sept9

Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
@peterdsharpe peterdsharpe changed the title Aero recipe: subsampled-surface force coefficients are unbiased estimates; drop query measure from saved outputs Aero recipe: document sampled-force weighting and clean saved query measures Sep 9, 2026
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test a71c242

@peterdsharpe peterdsharpe changed the title Aero recipe: document sampled-force weighting and clean saved query measures Aero recipe: document sampled forces and preserve exported quadrature Sep 19, 2026
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test fc52b33

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

greptile-apps Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

The PR is not safe to merge until the GLOBE visualization force integration preserves and consumes the corrected measure on subsampled prediction surfaces.

Findings

  1. P1 Subsampling Correction Is Discarded ▶

Summary

This PR replaces multiplier-style mesh weights with complete cell and point measures, propagates those measures through sampling and geometry operations, introduces explicit point-sample integration, and updates the external-aero documentation and inference contracts.

  • Adds _effective_measure and represented-dimension metadata with lifecycle helpers.
  • Transfers cell quadrature to centroid query points and preserves it through inference export.
  • Updates readers, transforms, subdivision, remeshing safeguards, GLOBE inputs, and regression coverage.
  • One GLOBE visualization force path still discards the newly stored correction and reports incorrectly scaled coefficients after subsampling.

Reviews (1) · Last reviewed commit: "Merge unified measures into aero force d..."

Comment thread examples/cfd/external_aerodynamics/globe/drivaer/dataset.py
@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test f4475b3

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 697f465

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 1256171

@peterdsharpe

Copy link
Copy Markdown
Collaborator Author

/ok to test 890e992

@peterdsharpe peterdsharpe changed the title Aero recipe: document sampled forces and preserve exported quadrature Aero: fix sampled GLOBE forces and clarify recipe quadrature Sep 29, 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