Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication > Class Template Reference

Convergence criterion which looks at the absolute value of the residual and fails if the linear solver stagnates. More...

#include <combinedcriterion.hh>

Inheritance diagram for Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >:
Inheritance graph

Public Member Functions

 CombinedCriterion (const CollectiveCommunication &comm)
 
 CombinedCriterion (const CollectiveCommunication &comm, Scalar residualReductionTolerance, Scalar absResidualTolerance=0.0, Scalar maxResidual=0.0)
 
void setResidualReductionTolerance (Scalar tol)
 Sets the residual reduction tolerance. More...
 
Scalar residualReductionTolerance () const
 Returns the tolerance of the residual reduction of the solution. More...
 
Scalar residualReduction () const
 Returns the reduction of the maximum of the residual compared to the initial solution. More...
 
void setAbsResidualTolerance (Scalar tol)
 Sets the maximum absolute tolerated residual. More...
 
Scalar absResidualTolerance () const
 Returns the tolerated maximum of the the infinity norm of the absolute residual. More...
 
Scalar absResidual () const
 Returns the infinity norm of the absolute residual. More...
 
void setInitial (const Vector &curSol, const Vector &curResid) override
 Set the initial solution of the linear system of equations. More...
 
void update (const Vector &curSol, const Vector &changeIndicator, const Vector &curResid) override
 Update the internal members of the convergence criterion with the current solution. More...
 
bool converged () const override
 Returns true if and only if the convergence criterion is met. More...
 
bool failed () const override
 Returns true if the convergence criterion cannot be met anymore because the solver has broken down. More...
 
Scalar accuracy () const override
 Returns the accuracy of the solution at the last update. More...
 
void printInitial (std::ostream &os=std::cout) const override
 Prints the initial information about the convergence behaviour. More...
 
void print (Scalar iter, std::ostream &os=std::cout) const override
 Prints the information about the convergence behaviour for the current iteration. More...
 
virtual void print (Scalar, std::ostream &=std::cout) const
 Prints the information about the convergence behaviour for the current iteration. More...
 

Detailed Description

template<class Vector, class CollectiveCommunication>
class Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >

Convergence criterion which looks at the absolute value of the residual and fails if the linear solver stagnates.

For the CombinedCriterion, the error of the solution is defined as

\[ e^k = \max_i\{
\left| r^k_i \right| \}\;, \]

where $r^k = \mathbf{A} x^k - b $ is the residual for the k-th iterative solution vector $x^k$.

In addition, to the reduction of the maximum residual, the linear solver is aborted early if the residual goes below or above absolute limits.

Constructor & Destructor Documentation

◆ CombinedCriterion() [1/2]

template<class Vector , class CollectiveCommunication >
Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::CombinedCriterion ( const CollectiveCommunication &  comm)
inline

◆ CombinedCriterion() [2/2]

template<class Vector , class CollectiveCommunication >
Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::CombinedCriterion ( const CollectiveCommunication &  comm,
Scalar  residualReductionTolerance,
Scalar  absResidualTolerance = 0.0,
Scalar  maxResidual = 0.0 
)
inline

Member Function Documentation

◆ absResidual()

template<class Vector , class CollectiveCommunication >
Scalar Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::absResidual ( ) const
inline

◆ absResidualTolerance()

template<class Vector , class CollectiveCommunication >
Scalar Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::absResidualTolerance ( ) const
inline

Returns the tolerated maximum of the the infinity norm of the absolute residual.

Referenced by Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::converged().

◆ accuracy()

template<class Vector , class CollectiveCommunication >
Scalar Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::accuracy ( ) const
inlineoverridevirtual

Returns the accuracy of the solution at the last update.

A value of zero means that the solution was exact.

For the accuracy we only take the residual into account,

Implements Opm::Linear::ConvergenceCriterion< Vector >.

Referenced by Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::print().

◆ converged()

◆ failed()

template<class Vector , class CollectiveCommunication >
bool Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::failed ( ) const
inlineoverridevirtual

Returns true if the convergence criterion cannot be met anymore because the solver has broken down.

Reimplemented from Opm::Linear::ConvergenceCriterion< Vector >.

References Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::converged().

◆ print() [1/2]

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::print ( Scalar  iter,
std::ostream &  os = std::cout 
) const
inlineoverride

Prints the information about the convergence behaviour for the current iteration.

Parameters
iterThe iteration number. The semantics of this parameter are chosen by the linear solver.
osThe output stream to which the message gets written.

References Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::absResidual(), and Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::accuracy().

◆ print() [2/2]

template<class Vector >
virtual void Opm::Linear::ConvergenceCriterion< Vector >::print ( Scalar  ,
std::ostream &  = std::cout 
) const
inlinevirtualinherited

Prints the information about the convergence behaviour for the current iteration.

Parameters
iterThe iteration number. The semantics of this parameter are chosen by the linear solver.
osThe output stream to which the message gets written.

Reimplemented in Opm::Linear::ResidReductionCriterion< Vector >, and Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >.

Referenced by Opm::Linear::BiCGStabSolver< LinearOperator, Vector, Preconditioner >::apply().

◆ printInitial()

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::printInitial ( std::ostream &  os = std::cout) const
inlineoverridevirtual

Prints the initial information about the convergence behaviour.

This method is called after setInitial() if the solver thinks it's a good idea to be verbose. In practice, "printing the initial information" means printing column headers and the initial state.

Parameters
osThe output stream to which the message gets written.

Reimplemented from Opm::Linear::ConvergenceCriterion< Vector >.

◆ residualReduction()

template<class Vector , class CollectiveCommunication >
Scalar Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::residualReduction ( ) const
inline

Returns the reduction of the maximum of the residual compared to the initial solution.

Referenced by Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::converged().

◆ residualReductionTolerance()

template<class Vector , class CollectiveCommunication >
Scalar Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::residualReductionTolerance ( ) const
inline

Returns the tolerance of the residual reduction of the solution.

Referenced by Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::converged().

◆ setAbsResidualTolerance()

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::setAbsResidualTolerance ( Scalar  tol)
inline

Sets the maximum absolute tolerated residual.

◆ setInitial()

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::setInitial ( const Vector &  curSol,
const Vector &  curResid 
)
inlineoverridevirtual

Set the initial solution of the linear system of equations.

This version of the method does NOT take the two-norm of the residual as argument. If the two-norm of the defect is available for the linear solver, the version of the update() method with it should be called.

Parameters
curSolThe current iterative solution of the linear system of equations
curResidThe residual vector of the current iterative solution of the linear system of equations

Implements Opm::Linear::ConvergenceCriterion< Vector >.

◆ setResidualReductionTolerance()

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::setResidualReductionTolerance ( Scalar  tol)
inline

Sets the residual reduction tolerance.

◆ update()

template<class Vector , class CollectiveCommunication >
void Opm::Linear::CombinedCriterion< Vector, CollectiveCommunication >::update ( const Vector &  curSol,
const Vector &  changeIndicator,
const Vector &  curResid 
)
inlineoverridevirtual

Update the internal members of the convergence criterion with the current solution.

This version of the method does NOT take the two-norm of the residual as argument. If the two-norm of the defect is available for the linear solver, the version of the update() method with it should be called.

Parameters
curSolThe current iterative solution of the linear system of equations
changeIndicatorA vector where all non-zero values indicate that the solution has changed since the last iteration.
curResidThe residual vector of the current iterative solution of the linear system of equations

Implements Opm::Linear::ConvergenceCriterion< Vector >.


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