DOLFIN-X
DOLFIN-X C++ interface
Public Member Functions | Public Attributes | List of all members
dolfinx::nls::NewtonSolver Class Reference

This class defines a Newton solver for nonlinear systems of equations of the form \(F(x) = 0\). More...

#include <NewtonSolver.h>

Public Member Functions

 NewtonSolver (MPI_Comm comm)
 Create nonlinear solver. More...
 
virtual ~NewtonSolver ()
 Destructor.
 
std::pair< int, bool > solve (NonlinearProblem &nonlinear_function, Vec x)
 Solve abstract nonlinear problem \(`F(x) = 0\) for given \(F\) and Jacobian \(\dfrac{\partial F}{\partial x}\). More...
 
int krylov_iterations () const
 Return number of Krylov iterations elapsed since solve started. More...
 
double residual () const
 Return current residual. More...
 
double residual0 () const
 Return initial residual. More...
 

Public Attributes

int max_it = 50
 Maximum number of iterations.
 
double rtol = 1e-9
 Relative tolerance.
 
double atol = 1e-10
 Absolute tolerance.
 
std::string convergence_criterion = "residual"
 Convergence criterion.
 
bool report = true
 Monitor convergence.
 
bool error_on_nonconvergence = true
 Throw error if solver fails to converge.
 
double relaxation_parameter = 1.0
 Relaxation parameter.
 

Detailed Description

This class defines a Newton solver for nonlinear systems of equations of the form \(F(x) = 0\).

Constructor & Destructor Documentation

◆ NewtonSolver()

nls::NewtonSolver::NewtonSolver ( MPI_Comm  comm)
explicit

Create nonlinear solver.

Parameters
[in]commThe MPI communicator for the solver

Member Function Documentation

◆ krylov_iterations()

int nls::NewtonSolver::krylov_iterations ( ) const

Return number of Krylov iterations elapsed since solve started.

Returns
Number of iterations.

◆ residual()

double nls::NewtonSolver::residual ( ) const

Return current residual.

Returns
Current residual

◆ residual0()

double nls::NewtonSolver::residual0 ( ) const

Return initial residual.

Returns
Initial residual

◆ solve()

std::pair< int, bool > dolfinx::nls::NewtonSolver::solve ( NonlinearProblem nonlinear_function,
Vec  x 
)

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

Parameters
[in]nonlinear_functionThe nonlinear problem
[in,out]xThe vector
Returns
Pair of number of Newton iterations, and whether iteration converged)

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