DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
dolfin::PETScSNESSolver Class Reference

#include <PETScSNESSolver.h>

Inheritance diagram for dolfin::PETScSNESSolver:
Collaboration diagram for dolfin::PETScSNESSolver:

Public Member Functions

 PETScSNESSolver (MPI_Comm comm, std::string nls_type="default")
 Create SNES solver.
 
 PETScSNESSolver (std::string nls_type="default")
 Create SNES solver on MPI_COMM_WORLD.
 
virtual ~PETScSNESSolver ()
 Destructor.
 
std::pair< std::size_t, bool > solve (NonlinearProblem &nonlinear_problem, GenericVector &x, const GenericVector &lb, const GenericVector &ub)
 
std::pair< std::size_t, bool > solve (NonlinearProblem &nonlinear_function, GenericVector &x)
 
void init (NonlinearProblem &nonlinear_problem, GenericVector &x)
 
void set_from_options () const
 Set options from the PETSc options database.
 
void set_options_prefix (std::string options_prefix)
 
std::string get_options_prefix () const
 
MPI_Comm mpi_comm () const
 Return the MPI communicator.
 
SNES snes () const
 Return PETSc SNES pointer.
 
- Public Member Functions inherited from dolfin::PETScObject
 PETScObject ()
 Constructor. Ensures that PETSc has been initialised.
 
virtual ~PETScObject ()
 Destructor.
 

Static Public Member Functions

static std::vector< std::pair< std::string, std::string > > methods ()
 Return a list of available solver methods.
 
static Parameters default_parameters ()
 Default parameter values.
 
- Static Public Member Functions inherited from dolfin::PETScObject
static void petsc_error (int error_code, std::string filename, std::string petsc_function)
 Print error message for PETSc calls that return an error.
 

Public Attributes

Parameters parameters
 Parameters.
 

Detailed Description

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.

Member Function Documentation

◆ get_options_prefix()

std::string PETScSNESSolver::get_options_prefix ( ) const

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

◆ init()

void PETScSNESSolver::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

◆ set_options_prefix()

void PETScSNESSolver::set_options_prefix ( std::string options_prefix)

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

◆ solve() [1/2]

std::pair< std::size_t, bool > PETScSNESSolver::solve ( NonlinearProblem & nonlinear_function,
GenericVector & x )

Solve abstract nonlinear problem :math:F(x) = 0 for given :math:F and Jacobian :math:\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)

◆ solve() [2/2]

std::pair< std::size_t, bool > PETScSNESSolver::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)


The documentation for this class was generated from the following files: