Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Fix runtime failures in three intermediate Underworld3 utility examples.
These failures were reproduced using the existing Pixi environment with Python 3.12 and PETSc 3.25.3. The corrections preserve the intended demonstrations without modifying the Underworld3 numerical implementation.
Changes
Ex_Projection_Function_Eval.py
Correct the assignment of evaluated scalar and vector fields.
The function evaluator returns arrays with singleton dimensions, whereas individual swarm-variable components expect one-dimensional arrays.
Flatten the evaluated results before assignment.
Ex_Gradient_Methods_Comparison.py
Remove explicit MPI finalization.
Calling MPI.Finalize() manually caused an MPI operation after finalization during interpreter shutdown, terminating the process with a nonzero exit status.
The example completed successfully when MPI finalization was left to mpi4py.
Ex_BCs_from_meshVariables.py
Repair the annular Poisson demonstration.
The original code generated annular geometry but constructed a solid disk for the UW3 solver. It also used outdated boundary-condition arguments and incompatible array shapes.
The corrected example:
A standalone annular Poisson test previously completed successfully with 4,239 solution degrees of freedom and a finite solution ranging from -1 to approximately 1.
Validation
The complete corrected examples were executed separately using the existing Pixi Python installation.
The PR creation command requires all three examples to complete successfully before committing and opening this PR.
Python syntax validation and Git whitespace checks were also performed.
Scope and limitations
Only three verified intermediate example corrections are included.
Other intermediate scripts were also audited. Several visualization examples depend on simulation checkpoints stored outside the repository. Other examples involve older swarm, checkpoint, or internal solver APIs that require separate validation.
These unrelated issues are deliberately excluded rather than changing their scientific behavior or substituting artificial checkpoint data.
No PETSc, MPI, solver-core, or packaging implementation is changed.