Enable using new PETSc version with Nektar master

Open Parv Khurana requested to merge pk2296/nektar:feature/new_PETSc_v3.19 into master

Issue/feature addressed

The changes enable the use of more recent PETSc versions when -DNEKTAR_USE_PETSC=ON in the CMake settings - either a new default v3.19.3 from https://www.nektar.info/thirdparty/ or a local PETSc installed on your system. Newer PETSc versions enable the use of libraries like Hypre and ML interfaced through PETSc, which provide efficient multigrid preconditioners and solvers.

Proposed solution

Update the cmake/ThirdPartyPETSc.cmake:

  • to correctly identify the installed PETSc path if -DTHIRDPARTY_BUILD_PETSC=OFF.
  • to correctly install the new default PETSc v3.19.3 with MPI and chosen version of BLAS library if -DTHIRDPARTY_BUILD_PETSC=ON.


Updated primarily the cmake/ThirdPartyPETSc.cmake.

  • For -DTHIRDPARTY_BUILD_PETSC=ON: Updated the PETSc v3.19.3 link from the https://www.nektar.info/thirdparty/, added new configure options for it to install correctly.
  • For -DTHIRDPARTY_BUILD_PETSC=OFF: Added identification of existing PETSc through pkg-config by checking the ${PKG_CONFIG_PATH}. Please ensure your local PETSc has been installed using the --with-pkg-config tag in the configure options. Refer to https://petsc.org/main/install/install/ for more details


Yet to add, but would be running small cases with Hypre and ML preconditioners, libraries

Suggested reviewers

@hwustenb , @ai_lio, @ccantwel, @dmoxey


Please try to install Nektar++ locally with the following cmake options: cmake -DNEKTAR_USE_MPI=ON -DNEKTAR_USE_PETSC=ON -DTHIRDPARTY_BUILD_PETSC=ON .. It should install regardless of the choice of the BLAS library - MKL/OpenBLAS/ThirdParty. Please let me know if it does not.


  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Parv Khurana

Merge request reports