PETScSNESSolver.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class PETScSNESSolver

Parent class(es)

This class implements methods for solving nonlinear systems via PETSc’s SNES interface. It includes line search and trust region techniques for globalising the convergence of the nonlinear iteration.

explicit PETScSNESSolver(MPI_Comm comm)

Create SNES solver

PETScSNESSolver(std::string nls_type = "default")

Create SNES solver for a particular method

std::pair<std::size_t, bool> solve(NonlinearProblem &nonlinear_problem, GenericVector &x, const GenericVector &lb, const GenericVector &ub)

Solve a nonlinear variational inequality with bound constraints

Arguments
nonlinear_function (NonlinearProblem)
The nonlinear problem.
x (GenericVector)
The vector.
lb (GenericVector)
The lower bound.
ub (GenericVector)
The upper bound.
Returns
std::pair<std::size_t, bool>
Pair of number of Newton iterations, and whether iteration converged)
std::pair<std::size_t, bool> solve(NonlinearProblem &nonlinear_function, GenericVector &x)

Solve abstract nonlinear problem \(F(x) = 0\) for given \(F\) and Jacobian \(\dfrac{\partial F}{\partial x}\).

Arguments
nonlinear_function (NonlinearProblem)
The nonlinear problem.
x (GenericVector)
The vector.
Returns
std::pair<std::size_t, bool>
Pair of number of Newton iterations, and whether iteration converged)
void init(NonlinearProblem &nonlinear_problem, GenericVector &x)

Set up the SNES object, but don’t do anything yet, in case the user wants to access the SNES object directly

void set_from_options() const

Set options from the PETSc options database

void set_options_prefix(std::string options_prefix)

Sets the prefix used by PETSc when searching the PETSc options database

std::string get_options_prefix() const

Returns the prefix used by PETSc when searching the PETSc options database

MPI_Comm mpi_comm() const

Return the MPI communicator

static std::vector<std::pair<std::string, std::string>> methods()

Return a list of available solver methods

static Parameters default_parameters()

Default parameter values

SNES snes() const

Return PETSc SNES pointer