libMesh
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
libMesh::NonlinearSolver< T > Class Template Referenceabstract

This base class can be inherited from to provide interfaces to nonlinear solvers from different packages like PETSc and Trilinos. More...

#include <nonlinear_solver.h>

Inheritance diagram for libMesh::NonlinearSolver< T >:
[legend]

Public Types

typedef NonlinearImplicitSystem sys_type
 The type of system. More...
 

Public Member Functions

 NonlinearSolver (sys_type &s)
 Constructor. More...
 
virtual ~NonlinearSolver ()
 Destructor. More...
 
bool initialized () const
 
virtual void clear ()
 Release all memory and clear data structures. More...
 
virtual void init (const char *name=nullptr)=0
 Initialize data structures if not done so already. More...
 
virtual std::pair< unsigned int, Realsolve (SparseMatrix< T > &, NumericVector< T > &, NumericVector< T > &, const double, const unsigned int)=0
 Solves the nonlinear system. More...
 
virtual void print_converged_reason ()
 Prints a useful message about why the latest nonlinear solve con(di)verged. More...
 
virtual int get_total_linear_iterations ()=0
 Get the total number of linear iterations done in the last solve. More...
 
virtual unsigned get_current_nonlinear_iteration_number () const =0
 
const sys_typesystem () const
 
sys_typesystem ()
 
void attach_preconditioner (Preconditioner< T > *preconditioner)
 Attaches a Preconditioner object to be used during the linear solves. More...
 
void set_solver_configuration (SolverConfiguration &solver_configuration)
 Set the solver configuration object. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static std::unique_ptr< NonlinearSolver< T > > build (sys_type &s, const SolverPackage solver_package=libMesh::default_solver_package())
 Builds a NonlinearSolver using the nonlinear solver package specified by solver_package. More...
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Public Attributes

void(* residual )(const NumericVector< Number > &X, NumericVector< Number > &R, sys_type &S)
 Function that computes the residual R(X) of the nonlinear system at the input iterate X. More...
 
NonlinearImplicitSystem::ComputeResidualresidual_object
 Object that computes the residual R(X) of the nonlinear system at the input iterate X. More...
 
NonlinearImplicitSystem::ComputeResidualfd_residual_object
 Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose of forming a finite-differenced Jacobian. More...
 
NonlinearImplicitSystem::ComputeResidualmffd_residual_object
 Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose of forming Jacobian-vector products via finite differencing. More...
 
void(* jacobian )(const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)
 Function that computes the Jacobian J(X) of the nonlinear system at the input iterate X. More...
 
NonlinearImplicitSystem::ComputeJacobianjacobian_object
 Object that computes the Jacobian J(X) of the nonlinear system at the input iterate X. More...
 
void(* matvec )(const NumericVector< Number > &X, NumericVector< Number > *R, SparseMatrix< Number > *J, sys_type &S)
 Function that computes either the residual $ R(X) $ or the Jacobian $ J(X) $ of the nonlinear system at the input iterate $ X $. More...
 
NonlinearImplicitSystem::ComputeResidualandJacobianresidual_and_jacobian_object
 Object that computes either the residual $ R(X) $ or the Jacobian $ J(X) $ of the nonlinear system at the input iterate $ X $. More...
 
void(* bounds )(NumericVector< Number > &XL, NumericVector< Number > &XU, sys_type &S)
 Function that computes the lower and upper bounds XL and XU on the solution of the nonlinear system. More...
 
NonlinearImplicitSystem::ComputeBoundsbounds_object
 Object that computes the bounds vectors $ XL $ and $ XU $. More...
 
void(* nullspace )(std::vector< NumericVector< Number > *> &sp, sys_type &S)
 Function that computes a basis for the Jacobian's nullspace – the kernel or the "zero energy modes" – that can be used in solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP). More...
 
NonlinearImplicitSystem::ComputeVectorSubspacenullspace_object
 A callable object that computes a basis for the Jacobian's nullspace – the kernel or the "zero energy modes" – that can be used in solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP). More...
 
void(* transpose_nullspace )(std::vector< NumericVector< Number > *> &sp, sys_type &S)
 Function that computes a basis for the transpose Jacobian's nullspace – when solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP), it is used to remove contributions outside of R(jac) More...
 
NonlinearImplicitSystem::ComputeVectorSubspacetranspose_nullspace_object
 A callable object that computes a basis for the transpose Jacobian's nullspace – when solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP), it is used to remove contributions outside of R(jac) More...
 
void(* nearnullspace )(std::vector< NumericVector< Number > *> &sp, sys_type &S)
 Function that computes a basis for the Jacobian's near nullspace – the set of "low energy modes" – that can be used for AMG coarsening, if the solver supports it (e.g., ML, PETSc's GAMG). More...
 
NonlinearImplicitSystem::ComputeVectorSubspacenearnullspace_object
 A callable object that computes a basis for the Jacobian's near nullspace – the set of "low energy modes" – that can be used for AMG coarsening, if the solver supports it (e.g., ML, PETSc's GAMG). More...
 
void(* user_presolve )(sys_type &S)
 Customizable function pointer which users can attach to the solver. More...
 
void(* postcheck )(const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, sys_type &S)
 Function that performs a "check" on the Newton search direction and solution after each nonlinear step. More...
 
NonlinearImplicitSystem::ComputePostCheckpostcheck_object
 A callable object that is executed after each nonlinear iteration. More...
 
unsigned int max_nonlinear_iterations
 Maximum number of non-linear iterations. More...
 
unsigned int max_function_evaluations
 Maximum number of function evaluations. More...
 
Real absolute_residual_tolerance
 The NonlinearSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual. More...
 
Real relative_residual_tolerance
 
Real absolute_step_tolerance
 The NonlinearSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far. More...
 
Real relative_step_tolerance
 
unsigned int max_linear_iterations
 Each linear solver step should exit after max_linear_iterations is exceeded. More...
 
Real initial_linear_tolerance
 Any required linear solves will at first be done with this tolerance; the NonlinearSolver may tighten the tolerance for later solves. More...
 
Real minimum_linear_tolerance
 The tolerance for linear solves is kept above this minimum. More...
 
bool converged
 After a call to solve this will reflect whether or not the nonlinear solve was successful. More...
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

sys_type_system
 A reference to the system we are solving. More...
 
bool _is_initialized
 Flag indicating if the data structures have been initialized. More...
 
Preconditioner< T > * _preconditioner
 Holds the Preconditioner object to be used for the linear solves. More...
 
SolverConfiguration_solver_configuration
 Optionally store a SolverOptions object that can be used to set parameters like solver type, tolerances and iteration limits. More...
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int > _n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter
 Flag to control whether reference count information is printed when print_info is called. More...
 

Detailed Description

template<typename T>
class libMesh::NonlinearSolver< T >

This base class can be inherited from to provide interfaces to nonlinear solvers from different packages like PETSc and Trilinos.

Author
Benjamin Kirk
Date
2005

Definition at line 61 of file nonlinear_solver.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

◆ sys_type

template<typename T >
typedef NonlinearImplicitSystem libMesh::NonlinearSolver< T >::sys_type

The type of system.

Definition at line 68 of file nonlinear_solver.h.

Constructor & Destructor Documentation

◆ NonlinearSolver()

template<typename T >
libMesh::NonlinearSolver< T >::NonlinearSolver ( sys_type s)
explicit

Constructor.

Initializes Solver data structures

Definition at line 386 of file nonlinear_solver.h.

386  :
387  ParallelObject (s),
388  residual (nullptr),
389  residual_object (nullptr),
390  fd_residual_object (nullptr),
391  mffd_residual_object (nullptr),
392  jacobian (nullptr),
393  jacobian_object (nullptr),
394  matvec (nullptr),
396  bounds (nullptr),
397  bounds_object (nullptr),
398  nullspace (nullptr),
399  nullspace_object (nullptr),
400  transpose_nullspace (nullptr),
401  transpose_nullspace_object (nullptr),
402  nearnullspace (nullptr),
403  nearnullspace_object (nullptr),
404  user_presolve (nullptr),
405  postcheck (nullptr),
406  postcheck_object (nullptr),
416  converged(false),
417  _system(s),
418  _is_initialized (false),
419  _preconditioner (nullptr),
420  _solver_configuration(nullptr)
421 {
422 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
void(* residual)(const NumericVector< Number > &X, NumericVector< Number > &R, sys_type &S)
Function that computes the residual R(X) of the nonlinear system at the input iterate X...
NonlinearImplicitSystem::ComputeResidualandJacobian * residual_and_jacobian_object
Object that computes either the residual or the Jacobian of the nonlinear system at the input itera...
sys_type & _system
A reference to the system we are solving.
bool converged
After a call to solve this will reflect whether or not the nonlinear solve was successful.
unsigned int max_function_evaluations
Maximum number of function evaluations.
Preconditioner< T > * _preconditioner
Holds the Preconditioner object to be used for the linear solves.
void(* user_presolve)(sys_type &S)
Customizable function pointer which users can attach to the solver.
unsigned int max_linear_iterations
Each linear solver step should exit after max_linear_iterations is exceeded.
SolverConfiguration * _solver_configuration
Optionally store a SolverOptions object that can be used to set parameters like solver type...
NonlinearImplicitSystem::ComputeResidual * residual_object
Object that computes the residual R(X) of the nonlinear system at the input iterate X...
void(* jacobian)(const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)
Function that computes the Jacobian J(X) of the nonlinear system at the input iterate X...
Real absolute_step_tolerance
The NonlinearSolver should exit after the full nonlinear step norm is reduced to either less than abs...
bool _is_initialized
Flag indicating if the data structures have been initialized.
NonlinearImplicitSystem::ComputeJacobian * jacobian_object
Object that computes the Jacobian J(X) of the nonlinear system at the input iterate X...
NonlinearImplicitSystem::ComputeBounds * bounds_object
Object that computes the bounds vectors and .
void(* transpose_nullspace)(std::vector< NumericVector< Number > *> &sp, sys_type &S)
Function that computes a basis for the transpose Jacobian&#39;s nullspace – when solving a degenerate pr...
Real minimum_linear_tolerance
The tolerance for linear solves is kept above this minimum.
void(* nullspace)(std::vector< NumericVector< Number > *> &sp, sys_type &S)
Function that computes a basis for the Jacobian&#39;s nullspace – the kernel or the "zero energy modes" ...
void(* nearnullspace)(std::vector< NumericVector< Number > *> &sp, sys_type &S)
Function that computes a basis for the Jacobian&#39;s near nullspace – the set of "low energy modes" – ...
Real absolute_residual_tolerance
The NonlinearSolver should exit after the residual is reduced to either less than absolute_residual_t...
NonlinearImplicitSystem::ComputePostCheck * postcheck_object
A callable object that is executed after each nonlinear iteration.
void(* bounds)(NumericVector< Number > &XL, NumericVector< Number > &XU, sys_type &S)
Function that computes the lower and upper bounds XL and XU on the solution of the nonlinear system...
NonlinearImplicitSystem::ComputeResidual * mffd_residual_object
Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose...
void(* postcheck)(const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, sys_type &S)
Function that performs a "check" on the Newton search direction and solution after each nonlinear ste...
NonlinearImplicitSystem::ComputeVectorSubspace * nearnullspace_object
A callable object that computes a basis for the Jacobian&#39;s near nullspace – the set of "low energy m...
Real initial_linear_tolerance
Any required linear solves will at first be done with this tolerance; the NonlinearSolver may tighten...
unsigned int max_nonlinear_iterations
Maximum number of non-linear iterations.
NonlinearImplicitSystem::ComputeVectorSubspace * transpose_nullspace_object
A callable object that computes a basis for the transpose Jacobian&#39;s nullspace – when solving a dege...
void(* matvec)(const NumericVector< Number > &X, NumericVector< Number > *R, SparseMatrix< Number > *J, sys_type &S)
Function that computes either the residual or the Jacobian of the nonlinear system at the input ite...
NonlinearImplicitSystem::ComputeResidual * fd_residual_object
Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose...
NonlinearImplicitSystem::ComputeVectorSubspace * nullspace_object
A callable object that computes a basis for the Jacobian&#39;s nullspace – the kernel or the "zero energ...

◆ ~NonlinearSolver()

template<typename T >
libMesh::NonlinearSolver< T >::~NonlinearSolver ( )
virtual

Destructor.

Definition at line 428 of file nonlinear_solver.h.

429 {
430  this->clear ();
431 }
virtual void clear()
Release all memory and clear data structures.

Member Function Documentation

◆ attach_preconditioner()

template<typename T >
void libMesh::NonlinearSolver< T >::attach_preconditioner ( Preconditioner< T > *  preconditioner)

Attaches a Preconditioner object to be used during the linear solves.

◆ build()

template<typename T >
static std::unique_ptr<NonlinearSolver<T> > libMesh::NonlinearSolver< T >::build ( sys_type s,
const SolverPackage  solver_package = libMesh::default_solver_package() 
)
static

Builds a NonlinearSolver using the nonlinear solver package specified by solver_package.

◆ clear()

template<typename T >
virtual void libMesh::NonlinearSolver< T >::clear ( )
virtual

Release all memory and clear data structures.

Reimplemented in libMesh::PetscNonlinearSolver< T >, and libMesh::NoxNonlinearSolver< T >.

Definition at line 97 of file nonlinear_solver.h.

97 {}

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited

◆ disable_print_counter_info()

static void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

◆ enable_print_counter_info()

static void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

◆ get_current_nonlinear_iteration_number()

template<typename T >
virtual unsigned libMesh::NonlinearSolver< T >::get_current_nonlinear_iteration_number ( ) const
pure virtual
Returns
The current nonlinear iteration number if called during the solve(), for example by the user-specified residual or Jacobian function.

Must be overridden in derived classes.

Implemented in libMesh::PetscNonlinearSolver< T >, and libMesh::NoxNonlinearSolver< T >.

◆ get_info()

static std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

◆ get_total_linear_iterations()

template<typename T >
virtual int libMesh::NonlinearSolver< T >::get_total_linear_iterations ( )
pure virtual

Get the total number of linear iterations done in the last solve.

Implemented in libMesh::PetscNonlinearSolver< T >, and libMesh::NoxNonlinearSolver< T >.

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 181 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 194 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ init()

template<typename T >
virtual void libMesh::NonlinearSolver< T >::init ( const char *  name = nullptr)
pure virtual

Initialize data structures if not done so already.

May assign a name to the solver in some implementations

Implemented in libMesh::PetscNonlinearSolver< T >, and libMesh::NoxNonlinearSolver< T >.

◆ initialized()

template<typename T >
bool libMesh::NonlinearSolver< T >::initialized ( ) const
Returns
true if the data structures are initialized, false otherwise.

Definition at line 92 of file nonlinear_solver.h.

References libMesh::NonlinearSolver< T >::_is_initialized.

92 { return _is_initialized; }
bool _is_initialized
Flag indicating if the data structures have been initialized.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

84  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::MeshBase::partition().

94  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ print_converged_reason()

template<typename T >
virtual void libMesh::NonlinearSolver< T >::print_converged_reason ( )
virtual

Prints a useful message about why the latest nonlinear solve con(di)verged.

Reimplemented in libMesh::PetscNonlinearSolver< T >.

Definition at line 118 of file nonlinear_solver.h.

118 { libmesh_not_implemented(); }

◆ print_info()

static void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited

◆ set_solver_configuration()

template<typename T >
void libMesh::NonlinearSolver< T >::set_solver_configuration ( SolverConfiguration solver_configuration)

Set the solver configuration object.

◆ solve()

template<typename T >
virtual std::pair<unsigned int, Real> libMesh::NonlinearSolver< T >::solve ( SparseMatrix< T > &  ,
NumericVector< T > &  ,
NumericVector< T > &  ,
const double  ,
const unsigned  int 
)
pure virtual

Solves the nonlinear system.

Implemented in libMesh::PetscNonlinearSolver< T >, and libMesh::NoxNonlinearSolver< T >.

◆ system() [1/2]

template<typename T >
const sys_type& libMesh::NonlinearSolver< T >::system ( ) const
Returns
A constant reference to the system we are solving.

Definition at line 280 of file nonlinear_solver.h.

References libMesh::NonlinearSolver< T >::_system.

280 { return _system; }
sys_type & _system
A reference to the system we are solving.

◆ system() [2/2]

template<typename T >
sys_type& libMesh::NonlinearSolver< T >::system ( )
Returns
A writable reference to the system we are solving.

Definition at line 285 of file nonlinear_solver.h.

References libMesh::NonlinearSolver< T >::_system.

285 { return _system; }
sys_type & _system
A reference to the system we are solving.

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 141 of file reference_counter.h.

◆ _is_initialized

template<typename T >
bool libMesh::NonlinearSolver< T >::_is_initialized
protected

Flag indicating if the data structures have been initialized.

Definition at line 366 of file nonlinear_solver.h.

Referenced by libMesh::NonlinearSolver< T >::initialized().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _n_objects

Threads::atomic<unsigned int> libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 130 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _preconditioner

template<typename T >
Preconditioner<T>* libMesh::NonlinearSolver< T >::_preconditioner
protected

Holds the Preconditioner object to be used for the linear solves.

Definition at line 371 of file nonlinear_solver.h.

◆ _solver_configuration

template<typename T >
SolverConfiguration* libMesh::NonlinearSolver< T >::_solver_configuration
protected

Optionally store a SolverOptions object that can be used to set parameters like solver type, tolerances and iteration limits.

Definition at line 377 of file nonlinear_solver.h.

◆ _system

template<typename T >
sys_type& libMesh::NonlinearSolver< T >::_system
protected

A reference to the system we are solving.

Definition at line 361 of file nonlinear_solver.h.

Referenced by libMesh::NonlinearSolver< T >::system().

◆ absolute_residual_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::absolute_residual_tolerance

The NonlinearSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual.

Users should increase any of these tolerances that they want to use for a stopping condition.

Definition at line 312 of file nonlinear_solver.h.

◆ absolute_step_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::absolute_step_tolerance

The NonlinearSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far.

Users should increase any of these tolerances that they want to use for a stopping condition.

Note
Not all NonlinearSolvers support relative_step_tolerance!

Definition at line 326 of file nonlinear_solver.h.

◆ bounds

template<typename T >
void(* libMesh::NonlinearSolver< T >::bounds) (NumericVector< Number > &XL, NumericVector< Number > &XU, sys_type &S)

Function that computes the lower and upper bounds XL and XU on the solution of the nonlinear system.

Definition at line 199 of file nonlinear_solver.h.

◆ bounds_object

template<typename T >
NonlinearImplicitSystem::ComputeBounds* libMesh::NonlinearSolver< T >::bounds_object

Object that computes the bounds vectors $ XL $ and $ XU $.

Definition at line 205 of file nonlinear_solver.h.

◆ converged

template<typename T >
bool libMesh::NonlinearSolver< T >::converged

After a call to solve this will reflect whether or not the nonlinear solve was successful.

Definition at line 350 of file nonlinear_solver.h.

◆ fd_residual_object

template<typename T >
NonlinearImplicitSystem::ComputeResidual* libMesh::NonlinearSolver< T >::fd_residual_object

Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose of forming a finite-differenced Jacobian.

Definition at line 152 of file nonlinear_solver.h.

◆ initial_linear_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::initial_linear_tolerance

Any required linear solves will at first be done with this tolerance; the NonlinearSolver may tighten the tolerance for later solves.

Definition at line 339 of file nonlinear_solver.h.

◆ jacobian

template<typename T >
void(* libMesh::NonlinearSolver< T >::jacobian) (const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)

Function that computes the Jacobian J(X) of the nonlinear system at the input iterate X.

Definition at line 165 of file nonlinear_solver.h.

◆ jacobian_object

template<typename T >
NonlinearImplicitSystem::ComputeJacobian* libMesh::NonlinearSolver< T >::jacobian_object

Object that computes the Jacobian J(X) of the nonlinear system at the input iterate X.

Definition at line 173 of file nonlinear_solver.h.

◆ matvec

template<typename T >
void(* libMesh::NonlinearSolver< T >::matvec) (const NumericVector< Number > &X, NumericVector< Number > *R, SparseMatrix< Number > *J, sys_type &S)

Function that computes either the residual $ R(X) $ or the Jacobian $ J(X) $ of the nonlinear system at the input iterate $ X $.

Note
Either R or J could be nullptr.

Definition at line 182 of file nonlinear_solver.h.

◆ max_function_evaluations

template<typename T >
unsigned int libMesh::NonlinearSolver< T >::max_function_evaluations

Maximum number of function evaluations.

Definition at line 300 of file nonlinear_solver.h.

◆ max_linear_iterations

template<typename T >
unsigned int libMesh::NonlinearSolver< T >::max_linear_iterations

Each linear solver step should exit after max_linear_iterations is exceeded.

Definition at line 333 of file nonlinear_solver.h.

◆ max_nonlinear_iterations

template<typename T >
unsigned int libMesh::NonlinearSolver< T >::max_nonlinear_iterations

Maximum number of non-linear iterations.

Definition at line 295 of file nonlinear_solver.h.

◆ mffd_residual_object

template<typename T >
NonlinearImplicitSystem::ComputeResidual* libMesh::NonlinearSolver< T >::mffd_residual_object

Object that computes the residual R(X) of the nonlinear system at the input iterate X for the purpose of forming Jacobian-vector products via finite differencing.

Definition at line 159 of file nonlinear_solver.h.

◆ minimum_linear_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::minimum_linear_tolerance

The tolerance for linear solves is kept above this minimum.

Definition at line 344 of file nonlinear_solver.h.

◆ nearnullspace

template<typename T >
void(* libMesh::NonlinearSolver< T >::nearnullspace) (std::vector< NumericVector< Number > * > &sp, sys_type &S)

Function that computes a basis for the Jacobian's near nullspace – the set of "low energy modes" – that can be used for AMG coarsening, if the solver supports it (e.g., ML, PETSc's GAMG).

Definition at line 242 of file nonlinear_solver.h.

◆ nearnullspace_object

template<typename T >
NonlinearImplicitSystem::ComputeVectorSubspace* libMesh::NonlinearSolver< T >::nearnullspace_object

A callable object that computes a basis for the Jacobian's near nullspace – the set of "low energy modes" – that can be used for AMG coarsening, if the solver supports it (e.g., ML, PETSc's GAMG).

Definition at line 249 of file nonlinear_solver.h.

◆ nullspace

template<typename T >
void(* libMesh::NonlinearSolver< T >::nullspace) (std::vector< NumericVector< Number > * > &sp, sys_type &S)

Function that computes a basis for the Jacobian's nullspace – the kernel or the "zero energy modes" – that can be used in solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP).

Definition at line 213 of file nonlinear_solver.h.

◆ nullspace_object

template<typename T >
NonlinearImplicitSystem::ComputeVectorSubspace* libMesh::NonlinearSolver< T >::nullspace_object

A callable object that computes a basis for the Jacobian's nullspace – the kernel or the "zero energy modes" – that can be used in solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP).

Definition at line 221 of file nonlinear_solver.h.

◆ postcheck

template<typename T >
void(* libMesh::NonlinearSolver< T >::postcheck) (const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, sys_type &S)

Function that performs a "check" on the Newton search direction and solution after each nonlinear step.

See documentation for the NonlinearImplicitSystem::ComputePostCheck object for more information about the calling sequence.

Definition at line 263 of file nonlinear_solver.h.

◆ postcheck_object

template<typename T >
NonlinearImplicitSystem::ComputePostCheck* libMesh::NonlinearSolver< T >::postcheck_object

A callable object that is executed after each nonlinear iteration.

Allows the user to modify both the search direction and the solution vector in an application-specific way.

Definition at line 275 of file nonlinear_solver.h.

◆ relative_residual_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::relative_residual_tolerance

Definition at line 313 of file nonlinear_solver.h.

◆ relative_step_tolerance

template<typename T >
Real libMesh::NonlinearSolver< T >::relative_step_tolerance

Definition at line 327 of file nonlinear_solver.h.

◆ residual

template<typename T >
void(* libMesh::NonlinearSolver< T >::residual) (const NumericVector< Number > &X, NumericVector< Number > &R, sys_type &S)

Function that computes the residual R(X) of the nonlinear system at the input iterate X.

Definition at line 138 of file nonlinear_solver.h.

◆ residual_and_jacobian_object

template<typename T >
NonlinearImplicitSystem::ComputeResidualandJacobian* libMesh::NonlinearSolver< T >::residual_and_jacobian_object

Object that computes either the residual $ R(X) $ or the Jacobian $ J(X) $ of the nonlinear system at the input iterate $ X $.

Note
Either R or J could be nullptr.

Definition at line 194 of file nonlinear_solver.h.

◆ residual_object

template<typename T >
NonlinearImplicitSystem::ComputeResidual* libMesh::NonlinearSolver< T >::residual_object

Object that computes the residual R(X) of the nonlinear system at the input iterate X.

Definition at line 146 of file nonlinear_solver.h.

◆ transpose_nullspace

template<typename T >
void(* libMesh::NonlinearSolver< T >::transpose_nullspace) (std::vector< NumericVector< Number > * > &sp, sys_type &S)

Function that computes a basis for the transpose Jacobian's nullspace – when solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP), it is used to remove contributions outside of R(jac)

Definition at line 228 of file nonlinear_solver.h.

◆ transpose_nullspace_object

template<typename T >
NonlinearImplicitSystem::ComputeVectorSubspace* libMesh::NonlinearSolver< T >::transpose_nullspace_object

A callable object that computes a basis for the transpose Jacobian's nullspace – when solving a degenerate problem iteratively, if the solver supports it (e.g., PETSc's KSP), it is used to remove contributions outside of R(jac)

Definition at line 235 of file nonlinear_solver.h.

◆ user_presolve

template<typename T >
void(* libMesh::NonlinearSolver< T >::user_presolve) (sys_type &S)

Customizable function pointer which users can attach to the solver.

Gets called prior to every call to solve().

Definition at line 255 of file nonlinear_solver.h.


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