OGS
NumLib::ConvergenceCriterion Class Referenceabstract

Detailed Description

Convergence criterion for iterative algorithms, like nonlinear solvers.

It is able to check the difference of the solution vector between iterations and the residual of the equation being solved (e.g. the nonlinear equation system).

Definition at line 31 of file ConvergenceCriterion.h.

#include <ConvergenceCriterion.h>

Inheritance diagram for NumLib::ConvergenceCriterion:
[legend]

Public Member Functions

 ConvergenceCriterion (const MathLib::VecNormType norm_type)
 
virtual bool hasDeltaXCheck () const =0
 
virtual bool hasResidualCheck () const =0
 
virtual void checkDeltaX (GlobalVector const &minus_delta_x, GlobalVector const &x)=0
 
virtual void checkResidual (GlobalVector const &residual)=0
 Check if the residual satisfies the convergence criterion.
 
virtual void preFirstIteration ()
 
virtual void setNoFirstIteration ()
 
virtual void reset ()
 
virtual bool isSatisfied () const
 Tell if the convergence criterion is satisfied.
 
MathLib::VecNormType getVectorNormType () const
 
virtual ~ConvergenceCriterion ()=default
 

Protected Attributes

bool _satisfied = true
 
bool _is_first_iteration = true
 
const MathLib::VecNormType _norm_type
 

Constructor & Destructor Documentation

◆ ConvergenceCriterion()

NumLib::ConvergenceCriterion::ConvergenceCriterion ( const MathLib::VecNormType norm_type)
inlineexplicit

Definition at line 34 of file ConvergenceCriterion.h.

35 : _norm_type(norm_type)
36 {
37 }
const MathLib::VecNormType _norm_type

◆ ~ConvergenceCriterion()

virtual NumLib::ConvergenceCriterion::~ConvergenceCriterion ( )
virtualdefault

Member Function Documentation

◆ checkDeltaX()

virtual void NumLib::ConvergenceCriterion::checkDeltaX ( GlobalVector const & minus_delta_x,
GlobalVector const & x )
pure virtual

Check if the change of the solution between iterations satisfies the convergence criterion.

Parameters
minus_delta_xthe current solution update
xthe new solution from the current iteration
Remarks
The Newton-Raphson solver computes minus_delta_x. x is needed for relative tolerances.

Implemented in NumLib::ConvergenceCriterionDeltaX, NumLib::ConvergenceCriterionPerComponentDeltaX, NumLib::ConvergenceCriterionPerComponentResidual, and NumLib::ConvergenceCriterionResidual.

◆ checkResidual()

virtual void NumLib::ConvergenceCriterion::checkResidual ( GlobalVector const & residual)
pure virtual

◆ getVectorNormType()

MathLib::VecNormType NumLib::ConvergenceCriterion::getVectorNormType ( ) const
inline

Definition at line 92 of file ConvergenceCriterion.h.

92{ return _norm_type; }

References _norm_type.

◆ hasDeltaXCheck()

virtual bool NumLib::ConvergenceCriterion::hasDeltaXCheck ( ) const
pure virtual

Tells if the change of the solution between iterations is checked.

Remarks
This method allows to save some computations if no such check will be done.

Implemented in NumLib::ConvergenceCriterionDeltaX, NumLib::ConvergenceCriterionPerComponentDeltaX, NumLib::ConvergenceCriterionPerComponentResidual, and NumLib::ConvergenceCriterionResidual.

◆ hasResidualCheck()

virtual bool NumLib::ConvergenceCriterion::hasResidualCheck ( ) const
pure virtual

Tells if the residual is checked.

Remarks
This method allows to save some computations if no such check will be done.

Implemented in NumLib::ConvergenceCriterionDeltaX, NumLib::ConvergenceCriterionPerComponentDeltaX, NumLib::ConvergenceCriterionPerComponentResidual, and NumLib::ConvergenceCriterionResidual.

◆ isSatisfied()

virtual bool NumLib::ConvergenceCriterion::isSatisfied ( ) const
inlinevirtual

Tell if the convergence criterion is satisfied.

Definition at line 90 of file ConvergenceCriterion.h.

References _satisfied.

◆ preFirstIteration()

virtual void NumLib::ConvergenceCriterion::preFirstIteration ( )
inlinevirtual

Tell the ConvergenceCriterion that it is called for the first time now (while solving a specific nonlinear system).

Definition at line 70 of file ConvergenceCriterion.h.

References _is_first_iteration.

◆ reset()

virtual void NumLib::ConvergenceCriterion::reset ( )
inlinevirtual

Indicate that a new iteration now starts.

A concrete implementation of ConvergenceCriterion might want to check both delta x and the residual. I.e., in a new iteration both checks have to be done anew. This method will make the ConvergenceCriterion forget the result of all checks already done, s.t. all necessary checks will have to be repeated in order to satisfy the ConvergenceCriterion.

Reimplemented in NumLib::ConvergenceCriterionDeltaX, and NumLib::ConvergenceCriterionPerComponentDeltaX.

Definition at line 83 of file ConvergenceCriterion.h.

84 {
85 _satisfied = true;
86 _is_first_iteration = false;
87 };

References _is_first_iteration, and _satisfied.

◆ setNoFirstIteration()

virtual void NumLib::ConvergenceCriterion::setNoFirstIteration ( )
inlinevirtual

Tell the ConvergenceCriterion that it is not called for the first time (while solving a coupling system).

Definition at line 74 of file ConvergenceCriterion.h.

74{ _is_first_iteration = false; }

References _is_first_iteration.

Member Data Documentation

◆ _is_first_iteration

bool NumLib::ConvergenceCriterion::_is_first_iteration = true
protected

◆ _norm_type

◆ _satisfied


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