Skip to content

Check PETSc errors and validate BC assembly#4249

Closed
masaqif wants to merge 1 commit into
FEniCS:mainfrom
masaqif:fix-petsc-error-bc-assembly
Closed

Check PETSc errors and validate BC assembly#4249
masaqif wants to merge 1 commit into
FEniCS:mainfrom
masaqif:fix-petsc-error-bc-assembly

Conversation

@masaqif

@masaqif masaqif commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary:

  • Check return codes for additional PETSc/SLEPc calls in NewtonSolver, la::petsc wrappers, SLEPcEigenSolver, and fem PETSc vector helpers.
  • Reject Dirichlet boundary conditions for same-mesh single bilinear form assembly when trial/test spaces differ, while preserving mixed-domain/submesh assembly.
  • Let the ADIOS2 optional VTX test skip before importing VTXWriter.

Related issues: #3995, #3988, #4045.

Testing:

  • git diff --check
  • /opt/homebrew/bin/python3.11 -m py_compile python/dolfinx/fem/assemble.py python/dolfinx/fem/petsc.py python/test/unit/fem/test_assembler.py python/test/unit/io/test_adios2.py
  • PYTHONPATH=/tmp/dolfinx-pr-ruff /opt/homebrew/bin/python3.11 -m ruff check . (from python/)
  • PYTHONPATH=/tmp/dolfinx-pr-ruff /opt/homebrew/bin/python3.11 -m ruff format --check . (from python/)
  • Not run: focused pytest, because pytest is not installed for the available Python 3.11.
  • Not run: C++ build/clang tooling, because PETSc/SLEPc, clang-tidy, and clang-format are not available locally.

@masaqif masaqif force-pushed the fix-petsc-error-bc-assembly branch from eb7ae34 to 610ad1f Compare June 28, 2026 19:40
Add PETSc/SLEPc error checking in solver and linear algebra wrappers.

Reject unsupported DirichletBC use for bilinear forms with different trial and test spaces, with MatrixCSR and PETSc regression coverage.

Move the ADIOS2 availability check before importing VTXWriter in the optional test.
@masaqif masaqif force-pushed the fix-petsc-error-bc-assembly branch from 610ad1f to 30fa1ef Compare June 29, 2026 18:56
@jhale

jhale commented Jun 30, 2026

Copy link
Copy Markdown
Member

Thanks! Looks good, but:

PETSc errors are already being handled at #4160 where there are some remaining issues.

Please open the other two fixes as separate PRs for easier review and tracking.

@jhale jhale closed this Jun 30, 2026
Vec x)
{
VecAXPY(x, -solver.relaxation_parameter, dx);
check_petsc_error(VecAXPY(x, -solver.relaxation_parameter, dx), "VecAXPY");

@jhale jhale Jun 30, 2026

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.

This is a new third style of checking PETSc errors which is not needed; in the other PR we've agreed to use CHECK_ERROR macro on the returned ierr.

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