Skip to content

Update anisotropic convection demo for current APIs - #480

Open
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/update-aniso-convection-demo-current-api
Open

Update anisotropic convection demo for current APIs#480
ss2098 wants to merge 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/update-aniso-convection-demo-current-api

Conversation

@ss2098

@ss2098 ss2098 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR updates scripts/aniso_convection_demo.py so the annulus convection / metric-redistribution demo runs with the current Underworld3 APIs.

Changes include:

  • convert AdvDiffusionSLCN estimate_dt() output to a scalar before passing it to solve()
  • replace the unstable upper natural Stokes boundary condition with a stable upper essential velocity boundary for this demo
  • create the cache directory before writing the cached convection state
  • replace the retired smooth_mesh_interior(..., method="anisotropic") path with uw.meshing.node_redistribution()
  • update the printed refinement label to match the current node_redistribution path

This does not change solver internals.

Validation:

  • rm -f /tmp/metric_mesh/conv_ra1e+05_res16_n20.npz
  • pixi run python scripts/aniso_convection_demo.py

Example local output:

  • cached → /tmp/metric_mesh/conv_ra1e+05_res16_n20.npz
  • === refine: node_redistribution on ρ∝|∇T| ===
  • saved /tmp/metric_mesh/aniso_convection.png

@ss2098
ss2098 requested a review from lmoresi as a code owner July 29, 2026 17:56
@ss2098

ss2098 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

The failing test_uw3 import-smoke check appears to fail during MPI/UCX initialization before this PR change is reached:

UCX ERROR mana_0 ... failed to create UD QP
MPI_Init_thread failed
MPIDI_UCX_init_worker Input/output error

This PR only updates scripts/aniso_convection_demo.py. Local validation passed with:

rm -f /tmp/metric_mesh/conv_ra1e+05_res16_n20.npz
pixi run python scripts/aniso_convection_demo.py

The script completed and saved /tmp/metric_mesh/aniso_convection.png.

I do not have permission to rerun the upstream workflow, so a maintainer rerun may be needed.

@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.

Adversarial review

The os.makedirs fix for the /tmp cache is real, and the API updates verified correct (_tri_cells/_signed_areas still exported; node_redistribution(mesh, <expr>) valid). One blocking finding:

  1. MAJOR — free-slip → no-slip on the upper boundary. This flips the demo's convection solution (rigid-lid vs free-slip annulus plumes differ visibly), and the demo exists to show refinement following those plumes. Use add_rotated_freeslip_bc(0, "Upper").
  2. MINOR — from underworld3.meshing import smooth_mesh_interior is now unused; the helper block sits mid-imports (E402).
  3. MINOR — zero_init_guess=True per step adds cost; harmless in a demo but unnecessary.

Requested change: the boundary condition. The failing test check was the known runner flake (#461), rerun.

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