Skip to content

Fix explicit flow grains script run - #274

Merged
lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-explicit-flow-grains-coordinate-system
Jun 24, 2026
Merged

Fix explicit flow grains script run#274
lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/fix-explicit-flow-grains-coordinate-system

Conversation

@ss2098

@ss2098 ss2098 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This updates docs/examples/porous_flow/advanced/Ex_Explicit_Flow_Grains.py so that the explicit grain-flow example runs correctly as a plain Python script.

The example failed during pipemesh.write_timestep(...) with:

AttributeError: 'NoneType' object has no attribute 'name'

The gmsh-created mesh did not have an explicit coordinate system, so self.CoordinateSystemType was None when the mesh writer serialized coordinate-system metadata. This PR sets:

coordinate_system_type=uw.coordinates.CoordinateSystemType.CARTESIAN

in the uw.discretisation.Mesh(...) constructor.

The example also imported PyVista during a terminal run. The visualization blocks are now guarded with a notebook check, so the solve, timestep writing, porosity calculation, and swarm advection path run without optional notebook visualization dependencies.

The gmsh geometry, boundary tags, Stokes setup, pressure projection, swarm advection, and output logic are otherwise unchanged.

Tested with:

pixi run python docs/examples/porous_flow/advanced/Ex_Explicit_Flow_Grains.py

Result:

Explicit grain flow example complete: 556 steps

@ss2098
ss2098 requested a review from lmoresi as a code owner June 22, 2026 22:28

@lmoresi lmoresi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified it runs end-to-end (exit 0; the only flagged line is a benign geometric-multigrid UserWarning, no traceback). Thanks @ss2098. Merging.

@lmoresi
lmoresi merged commit 1301c55 into underworldcode:development Jun 24, 2026
1 check passed
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