Skip to content

fix(datapipes): write domain-level global_data in SetGlobalField#1820

Open
peterdsharpe wants to merge 3 commits into
NVIDIA:mainfrom
peterdsharpe:psharpe/globaldata-domain-transforms
Open

fix(datapipes): write domain-level global_data in SetGlobalField#1820
peterdsharpe wants to merge 3 commits into
NVIDIA:mainfrom
peterdsharpe:psharpe/globaldata-domain-transforms

Conversation

@peterdsharpe

@peterdsharpe peterdsharpe commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What

SetGlobalField.apply_to_domain broadcast the injected fields to every sub-mesh's global_data, but never wrote them to the DomainMesh's own domain-level global_data. Any code reading DomainMesh.global_data never saw the injected fields.

  • The domain path now writes both records.
  • Sub-mesh behavior is unchanged.
  • Plain Mesh behavior is unchanged.

Tests

New test/datapipes/transforms/test_set_global_field.py:

  • domain-level global_data receives the field
  • the sub-mesh broadcast still happens
  • existing domain-level fields are preserved
  • injecting an existing key overwrites it, matching the documented contract
  • plain Mesh path unchanged

Full transforms suite passes; ruff check/format clean.

Notes

  • Found while integrating a DomainMesh-native model into the unified external-aero recipe, which currently carries a local workaround (SetDomainGlobalField) that this fix makes unnecessary.
  • A companion transform (ComputeUnitGlobalVector) that was previously bundled in this PR is now split out into draft PR feat(datapipes): add ComputeUnitGlobalVector transform #1825, since it is new API rather than a bug fix.

@copy-pr-bot

copy-pr-bot Bot commented Jul 9, 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.

SetGlobalField.apply_to_domain broadcast injected fields to every
sub-mesh's global_data but never wrote them to the DomainMesh's own
domain-level global_data, so code reading DomainMesh.global_data never
saw the fields. The domain path now writes both records; sub-mesh
behavior is unchanged.
@peterdsharpe
peterdsharpe force-pushed the psharpe/globaldata-domain-transforms branch from 99f90d6 to 6540a0a Compare July 10, 2026 05:10
@peterdsharpe peterdsharpe changed the title feat(datapipes): domain-level global_data injection + unit-vector transform fix(datapipes): write domain-level global_data in SetGlobalField Jul 10, 2026
- New test: injecting an existing key overwrites the domain-level
  record, matching the documented contract.
- One-line docstrings on the test class, methods, and helper, matching
  neighboring test files.
@peterdsharpe
peterdsharpe marked this pull request as ready for review July 14, 2026 02:44
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes SetGlobalField for DomainMesh inputs. The main changes are:

  • Domain-level global_data now receives injected fields.
  • Existing per-sub-mesh global_data broadcast is preserved.
  • Tests cover domain insertion, preservation, overwrite behavior, and plain Mesh behavior.
  • The changelog documents the fixed transform behavior.

Important Files Changed

Filename Overview
physicsnemo/datapipes/transforms/mesh/transforms.py Adds a SetGlobalField.apply_to_domain override that updates domain-level global_data after preserving the existing sub-mesh broadcast.
test/datapipes/transforms/test_set_global_field.py Adds tests for the fixed DomainMesh path and confirms the plain Mesh path still works.
CHANGELOG.md Documents that SetGlobalField now writes injected fields to DomainMesh.global_data.

Reviews (1): Last reviewed commit: "Merge branch 'main' into psharpe/globald..." | Re-trigger Greptile

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