Unstructured finite volume - #5397
Draft
aabills wants to merge 31 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5397 +/- ##
==========================================
- Coverage 98.12% 96.85% -1.28%
==========================================
Files 339 344 +5
Lines 31996 34489 +2493
==========================================
+ Hits 31396 33403 +2007
- Misses 600 1086 +486 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolve conflicts: - __init__.py: keep both VTKQuickPlot and nyquist_plot imports - functions.py: take main's Max/Min _casadi_evaluate and _evaluate_for_shape - convert_to_casadi.py: accept deletion from main's OOP refactor; port VectorField casadi conversion to _to_casadi method on the class
- vector_field.py: 85% -> 100% - tensor_field.py: 90% -> 100% - unstructured_submesh.py: 64% -> 87% Added tests for quad/hex element types, boundary loops, contains_points_3d on hex, optimize_ordering on single cell, generator error paths, and _parse_lims string-variable handling. Added tensor/vector field getitem edge cases, all-on-edges path, and VectorField._to_casadi coverage.
* lock before big change * update * Add TaggedSubMeshGenerator for per-region Gmsh extraction One-instance-per-region MeshGenerator that pulls a single Gmsh physical group out of a .msh file and wraps it as an UnstructuredSubMesh. Simpler than UserSuppliedUnstructuredMesh when the model already supplies one generator per pybamm domain (e.g. multi-domain 3D thermal w/ body + tab regions). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…inite-volume-check-858f6a # Conflicts: # packages/pybamm/src/pybamm/meshes/unstructured_submesh.py # packages/pybamm/src/pybamm/models/full_battery_models/base_battery_model.py # packages/pybamm/src/pybamm/models/full_battery_models/lithium_ion/basic_dfn_2d_unstructured.py # packages/pybamm/src/pybamm/models/full_battery_models/lithium_ion/basic_dfn_3d_unstructured.py # packages/pybamm/src/pybamm/parameters/parameter_substitutor.py # packages/pybamm/src/pybamm/plotting/plot_vtk.py # packages/pybamm/src/pybamm/spatial_methods/finite_volume_unstructured.py # packages/pybamm/tests/unit/test_meshes/test_unstructured_submesh.py # packages/pybamm/tests/unit/test_spatial_methods/test_finite_volume_unstructured.py # pyproject.toml
Resolve lint on the merged tree: replace .keys() iteration and dict() literals, merge isinstance calls, and drop the blanket except around interface auto-discovery in favour of an explicit dimension check in _interface_face_match, which already reports non-adjacency via its matched flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- sigma() gained an sto parameter on main; pass sto=None in the unstructured DFN models, matching base_thermal and li_metal. - Restore main's strict 3D cell-geometry validation, which the branch had commented out; test_spm covers the arbitrary-geometry rejection. - Reduction._from_json clears domains again after restore, since SpecificFunction._from_json bypasses __init__ and Max/Min would otherwise come back carrying the child's domain. - Component serialises its index via to_json/_from_json, mirroring Magnitude, and gains a hypothesis strategy alongside Norm. - UnstructuredSubMesh joins _SUBMESH_EXEMPT (no _from_json), and Reduction joins _NOT_ROUND_TRIPPABLE as an abstract base. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add API pages for UnstructuredSubMesh and its generators, the FiniteVolumeUnstructured spatial method, VTKQuickPlot, and the two unstructured DFN models, and record the feature in the changelog. Drop the root-level TODO.md: its main item (arbitrary domain names via an explicit tag) is implemented as TaggedSubMeshGenerator, and the workaround script it points at no longer exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Use OSMesa only on Linux and install the software GL backends in CI so save_gif no longer segfaults on headless runners. Co-authored-by: Cursor <cursoragent@cursor.com>
Headless Windows runners lack a software OpenGL backend, so save_gif segfaults; install mesa-dist-win OSMesa via the PyVista setup action. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 31, 2026
Contributor
Author
|
Split into stacked prior PRs (plan B) so this can be reviewed in smaller pieces. Original branch
Once that stack lands, this PR can be closed as superseded. |
Contributor
Author
|
Added a 6th stacked PR: #TBD deprecates Updating once the PR number is known… |
Contributor
Author
|
Also opened #5691: deprecate Full stack:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an unstructured finite volume method for 2 and 3D, allowing for simulations on arbitrary domains with user-provided meshes.
Fixes # (issue)
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)
Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commitnox -s testsnox -s doctests