Skip to content

Add VTK plotting for unstructured meshes - #5689

Open
aabills wants to merge 3 commits into
ufv-2-spatialfrom
ufv-3-plotting
Open

Add VTK plotting for unstructured meshes#5689
aabills wants to merge 3 commits into
ufv-2-spatialfrom
ufv-3-plotting

Conversation

@aabills

@aabills aabills commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Stack

  1. Generalise VectorField to N components #5686 — VectorField N-comp
  2. Add unstructured mesh infrastructure #5687 — Meshing
  3. Add unstructured finite volume spatial method #5688 — Spatial method + ProcessedVariable
  4. This PR (Add VTK plotting for unstructured meshes #5689) — VTK plotting
  5. Add unstructured 2D/3D DFN battery models #5690 — Unstructured DFN models

Test plan

  • tests/unit/test_plotting/test_plot_vtk.py (18 passed locally)
  • CI unit suite (incl. Windows OSMesa path)

Also in this stack: #5691 deprecates pybamm.Magnitude.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.97503% with 160 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (ufv-2-spatial@5113026). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/pybamm/src/pybamm/plotting/quick_plot.py 23.65% 142 Missing ⚠️
packages/pybamm/src/pybamm/plotting/plot_vtk.py 98.04% 11 Missing ⚠️
...ackages/pybamm/src/pybamm/plotting/dynamic_plot.py 41.66% 7 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             ufv-2-spatial    #5689   +/-   ##
================================================
  Coverage                 ?   96.95%           
================================================
  Files                    ?      342           
  Lines                    ?    34252           
  Branches                 ?        0           
================================================
  Hits                     ?    33209           
  Misses                   ?     1043           
  Partials                 ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

aabills and others added 3 commits September 3, 2026 12:06
Add VTKQuickPlot, QuickPlot/dynamic_plot hooks, the vtk optional extra,
and headless OSMesa CI setup for GIF export. Extracted from the
unstructured finite-volume stack.

Co-authored-by: Cursor <cursoragent@cursor.com>
Every panel was built from the FIRST spatial variable's mesh, so a
3-domain variable (e.g. electrolyte concentration) plotted alongside
a 5-domain one was painted onto the larger grid: all values shifted
by the leading domains' cell count, rendering electrolyte data on
current-collector tabs. Build each panel's grid from that variable's
own mesh, and make _set_cell/point_scalars raise on a length mismatch
so this bug class errors instead of drawing a wrong picture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The regular visualisation grid, mid-plane slices, quiver sampling and
slice-plane positions used to live on the unstructured processed variables;
the spatial-method PR now ships them as pure point interpolators. Add
pybamm.plotting.unstructured_plot_grid with plot_grid, default_slice_positions,
midplane_slices and quiver_data, and have QuickPlot own the grid and slice
positions per plotted variable (the slice sliders update QuickPlot state).
Meshes expose `vertices`, not `nodes`; fix plot_vtk and its test stand-ins.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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