Skip to content

Fix dimensionality demo for strict units#261

Open
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-dimensionality-demo-strict-units
Open

Fix dimensionality demo for strict units#261
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-dimensionality-demo-strict-units

Conversation

@ss2098

@ss2098 ss2098 commented Jun 20, 2026

Copy link
Copy Markdown

This updates docs/examples/Dimensionality-Demo.py so that it runs with the current strict-units behavior.

The example previously failed because it:

  1. created unit-bearing MeshVariable objects before reference quantities were set,
  2. assigned plain dimensional values directly into .array, and
  3. used older .to_nd(), .from_nd(), and UWQuantity reference-scaling calls that are not available in the current API.

The updated example keeps the dimensionality-tracking demonstration, but uses the current strict-units pattern:

  • set reference quantities before creating unit-bearing variables,
  • write non-dimensional values into .data,
  • use scaling coefficients for dimensional/non-dimensional conversion.

No solver behavior is changed.

Tested with:

pixi run python docs/examples/Dimensionality-Demo.py

Result: script completes successfully.

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