Skip to content

Fix units setup in vector projection Poisson test#227

Open
ss2098 wants to merge 24 commits into
underworldcode:developmentfrom
ss2098:fix-test-1450-units-reference-scales
Open

Fix units setup in vector projection Poisson test#227
ss2098 wants to merge 24 commits into
underworldcode:developmentfrom
ss2098:fix-test-1450-units-reference-scales

Conversation

@ss2098

@ss2098 ss2098 commented Jun 9, 2026

Copy link
Copy Markdown

Summary

This PR fixes test_vector_projection_after_poisson_with_units() by setting model reference quantities before creating meshes and MeshVariable objects with physical units.

The test previously failed in strict units mode with:

ValueError: Strict units mode: Cannot create variable 'T' with units='kelvin' when model has no reference quantities.

What changed

Added reference quantity setup at the start of test_vector_projection_after_poisson_with_units():

uw.reset_default_model()
model = uw.get_default_model()
model.set_reference_quantities(
    domain_depth=uw.quantity(1.0, "m"),
    plate_velocity=uw.quantity(1.0, "m/s"),
    mantle_viscosity=uw.quantity(1.0, "Pa*s"),
    temperature_difference=uw.quantity(1.0, "K"),
)

Rationale

Strict units mode requires model reference quantities to be configured before creating variables with units. This updates the test setup to match the current units-system behavior. The Poisson solve and vector projection logic are unchanged.

Testing

Ran:

pixi run python tests/test_1450_poisson_vector_projection.py

Output:

Structured box element resolution 16 16
✓ test_vector_projection_after_poisson passed
✓ Units system active with automatic non-dimensionalization
Structured box element resolution 16 16
✓ test_vector_projection_after_poisson_with_units passed
Structured box element resolution 16 16
✓ test_multiple_solvers_sequence passed

✓ All tests passed!

lmoresi and others added 24 commits January 13, 2026 22:52
Required for ReadTheDocs to find build configuration.
API documentation source is on uw3-release-candidate branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- docs/api/conf.py with MyST, napoleon, autodoc mocking
- API pages for meshing, discretisation, solvers, etc.
- requirements.txt for ReadTheDocs dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove pip install of underworld3 package - we use autodoc mocking
so only Sphinx dependencies are needed, not the full package.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Switch from autodoc mocking to full pixi environment with conda-forge
PETSc. This allows proper documentation generation with real imports.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use full path $HOME/.pixi/bin/pixi since each command runs in a
separate shell and PATH exports don't persist.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Follow ReadTheDocs recommended pattern using jobs hooks and asdf
to install pixi, rather than custom curl commands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
With pixi-based builds on ReadTheDocs, we have a real PETSc environment
so mocking is no longer needed and was actually interfering with Cython
module introspection.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sphinx was importing from source instead of installed package,
causing circular import in function/__init__.py -> analytic.
The package is already installed by 'pixi run build' before docs build.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added API docs for:
- function: Expressions, quantities, evaluation
- swarm: Particle swarms and variables
- scaling: Units, quantities, non-dimensionalisation
- maths: Mathematical operations and integrals
- materials: Multi-material systems
- model: Model management and configuration
- utilities: I/O and helper functions
- visualisation: Plotting tools
- adaptivity: Adaptive mesh refinement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Development code has been live for some time and mostly static. Time to bring this into main
# Conflicts:
#	.readthedocs.yaml
#	docs/api/adaptivity.md
#	docs/api/constitutive_models.md
#	docs/api/coordinates.md
#	docs/api/discretisation.md
#	docs/api/function.md
#	docs/api/maths.md
#	docs/api/meshing.md
#	docs/api/solvers.md
#	docs/api/swarm.md
#	docs/api/systems_ddt.md
#	docs/api/utilities.md
#	docs/api/visualisation.md
#	pixi.toml
…ames

- Binder section now shows three versioned launch badges
- Status badges updated from .yml to .yaml (workflow was renamed)
- Added pointer to binder_wizard.py for custom repositories

Underworld development team with AI support from Claude Code
Launcher expects {branch, ref_type} but we were sending {ref, is_release}.
This prevented tag builds from creating launcher branches.

Underworld development team with AI support from Claude Code
Compute REF_TYPE in shell instead of inline GitHub expression to avoid
single-quote conflicts in YAML string. Previous version had nested
single quotes that broke the payload.

Underworld development team with AI support from Claude Code
New workflow_dispatch inputs:
- uw3_branch: override which branch/tag to clone (e.g. v0.99)
- image_tag: override Docker image tag (e.g. v0.99)

Enables building images for old tags that predate the workflow.
Example: run from development with uw3_branch=v0.99, image_tag=v0.99
to build uw3-base:v0.99-slim using the current Dockerfile.

Underworld development team with AI support from Claude Code
Move version-specific lib subdirectories (vtk-X.Y, openvino-X.Y.Z)
into a generic split step using wildcards instead of hardcoded paths.
This allows the same Dockerfile to build images for different UW3
versions that may have different package versions in their pixi env.

Underworld development team with AI support from Claude Code
UW3 is always version 0.0.0, so pip's wheel cache treats every build
as "already cached" and silently reuses stale code. This was the most
common build issue — source changes weren't reflected after ./uw build.

Underworld development team with AI support from Claude Code
…ldcode#80)

petsc_save_checkpoint() now delegates to write_timestep(), gaining
vertex/cell compatibility groups, field projection, and tensor
repacking for ParaView. Previously it used the legacy generateXdmf()
which missed all recent XDMF improvements.

The outputPath argument is split into directory + filename to map
correctly onto write_timestep()'s (filename, outputPath) interface.

Underworld development team with AI support from Claude Code
The docs landing page binder link was hardcoded to 'development',
so tagged RTD builds (e.g. v3.0.0) pointed to the wrong environment.

Now conf.py detects the build context (git tag > READTHEDOCS_VERSION >
branch > fallback) and injects the correct ref via MyST substitution.
Also derives version/release from setuptools-scm instead of hardcoding.

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code

# Conflicts:
#	docs/conf.py
@ss2098 ss2098 requested a review from lmoresi as a code owner June 9, 2026 04:36
@lmoresi lmoresi changed the base branch from main to development June 13, 2026 13:05
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.

2 participants