# PETSc for Python

Author:

  Lisandro Dalcin

Contact:

  dalcinl@gmail.com

Web Site:

  https://gitlab.com/petsc/petsc

Date:

  Mar 12, 2025

Abstract

This document describes `petsc4py`, a Python wrapper to the PETSc libraries.

PETSc (the Portable, Extensible Toolkit for Scientific Computation) is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It employs the MPI standard for all message-passing communication.

This package provides an important subset of PETSc functionalities and uses NumPy to efficiently manage input and output of array data.

A good friend of petsc4py is:

> - mpi4py: Python bindings for MPI, the Message Passing Interface.

Other projects depend on petsc4py:

> - slepc4py: Python bindings for SLEPc, the Scalable Library for Eigenvalue Problem Computations.

Contents

- PETSc Overview
  - Components
- Installation
  - Install from PyPI using pip
  - Install from the PETSc source tree
  - Running the testing suite
  - Building the documentation
- Contributing
- Citations

Python specifics

- Reference
  - petsc4py
  - petsc4py.typing
  - petsc4py.PETSc
- PETSc Python types
  - PETSc Python matrix type
  - PETSc Python preconditioner type
  - PETSc Python linear solver type
  - PETSc Python nonlinear solver type (TODO)
  - PETSc Python ode-integrator type (TODO)
  - PETSc Python optimization solver type (TODO)
- Working with PETSc options
- petsc4py demos
- Documentation standards for petsc4py
  - Docstring standards
  - Type hint standards