Skip to content

Fix unit-aware coordinate evaluation example#262

Open
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-unit-aware-coordinate-example
Open

Fix unit-aware coordinate evaluation example#262
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-unit-aware-coordinate-example

Conversation

@ss2098

@ss2098 ss2098 commented Jun 20, 2026

Copy link
Copy Markdown

This updates docs/examples/example_unit_aware_coordinates.py so that it runs with the current evaluate() behavior.

The example previously failed because it:

  1. assigned mesh vertex coordinates to a degree=2 MeshVariable, causing a shape mismatch, and
  2. passed a Python list of UWQuantity coordinate tuples directly to uw.function.evaluate(), which is not accepted by the current non-dimensionalisation path.

The updated example:

  • initializes the degree=2 MeshVariable using its own coordinates,
  • converts unit-aware coordinate values explicitly to SI base units,
  • passes numeric coordinate arrays to uw.function.evaluate(),
  • preserves the original purpose of demonstrating coordinate evaluation with unit-aware inputs.

No solver behavior is changed.

Tested with:

pixi run python docs/examples/example_unit_aware_coordinates.py

Result: script completes successfully.

@ss2098 ss2098 requested a review from lmoresi as a code owner June 20, 2026 07:29
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