Aero recipe: document sampled forces and preserve exported quadrature - #1971
peterdsharpe wants to merge 13 commits into
Conversation
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.
CODEOWNERS review mapCurrent for commit ⏳ @coreyjadams — 8 file(s)
⏳ @negin513 — 4 file(s)
⏳ @peterdsharpe — 6 file(s)
No CODEOWNER
Comment |
|
/ok to test e39cd39 |
…dit-fix-1971-sept9 Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
|
/ok to test a71c242 |
Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
Signed-off-by: Peter Sharpe <peterdsharpe@gmail.com>
|
/ok to test fc52b33 |
|
The PR is not safe to merge until the GLOBE visualization force integration preserves and consumes the corrected measure on subsampled prediction surfaces. Findings
SummaryThis 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.
Reviews (1) · Last reviewed commit: "Merge unified measures into aero force d..." |
| total_area = cell_measures(mesh).sum() | ||
| scale_measures(boundary, total_area / cell_measures(boundary).sum()) |
There was a problem hiding this comment.
Subsampling Correction Is Discarded
The visualization path subsamples prediction_mesh and stores the represented-area correction in cell_data["_effective_measure"]. Postprocessing then rebuilds pred_surface with empty cell data, and compute_surface_force_coefficients weights forces using geometric cell_areas. This discards the correction, so the reported predicted Cd/Cl/Cs shrink with the retained surface fraction. Preserve the effective measure on pred_surface and use cell_measures(surface_mesh) for integration.
|
/ok to test f4475b3 |
Stacked on #1970. Its current head (
e2ff58109108d67da4bb26eb8bb35a47b6cb045e) is merged into this branch. Relative to #1970, this PR changes only the force/inference documentation and warning, their regression tests, and the changelog.The aero recipe's force documentation and inference warning said subsampled coefficients shrink by the retained-area fraction. Mesh integration already uses complete effective measures, including sampling corrections. This PR documents that behavior and verifies that exported query measures remain usable in physical coordinates.
cell_measures(mesh). Exact Horvitz–Thompson unbiasedness requires correct inclusion probabilities, fixed field values, and a fixed physical moment origin. Approximate sampling, predictions depending on the sampled geometry, and sample-dependent centering can introduce bias; check convergence with surface resolution.No force-computation or sampling algorithm changes are included. These recipe contracts apply to all supported surface models.
Validation: all 33 force/inference tests and all applicable pre-commit hooks passed. The broader recipe suite had 185 passes, one skip and one failure in
test_sdf_normals_near_wall_use_face_normal. The identical signed-distance assertion failure reproduces on the pre-update #1971 head (22219d40) and #1970, independently of this change.