PETSc.jl
This is a extension for importing solvers from PETSc.jl SNES into the SciML interface. Note that these solvers do not come by default, and thus one needs to install the package before using these solvers:
using Pkg
Pkg.add("PETSc")
using PETSc, NonlinearSolve
Solver API
NonlinearSolve.PETScSNES
— TypePETScSNES(; petsclib = missing, autodiff = nothing, mpi_comm = missing, kwargs...)
Wrapper over PETSc.jl SNES solvers.
Keyword Arguments
petsclib
: PETSc library to use. If set tomissing
, then we will use the first available PETSc library inPETSc.petsclibs
based on the problem element type.autodiff
: the choice of method for generating the Jacobian. Defaults tonothing
which means that a default is selected according to the problem specification. Can be any valid ADTypes.jl autodiff type (conditional on that backend being supported in NonlinearSolve.jl). If set tomissing
, then PETSc computes the Jacobian using finite differences.mpi_comm
: MPI communicator to use. If set tomissing
, then we will useMPI.COMM_SELF
.kwargs
: Keyword arguments to be passed to the PETSc SNES solver. See PETSc SNES documentation and SNESSetFromOptions for more information.
Options via CommonSolve.solve
These options are forwarded from solve
to the PETSc SNES solver. If these are provided to kwargs
, then they will be ignored.
solve option | PETSc SNES option |
---|---|
atol | snes_atol |
rtol | snes_rtol |
maxiters | snes_max_it |
show_trace | snes_monitor |
This algorithm is only available if PETSc.jl
is installed and loaded.