My Project
Loading...
Searching...
No Matches
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 >:
Opm::Linear::ConvergenceCriterion< Vector >

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.
 
Scalar residualReductionTolerance () const
 Returns the tolerance of the residual reduction of the solution.
 
Scalar residualReduction () const
 Returns the reduction of the maximum of the residual compared to the initial solution.
 
void setAbsResidualTolerance (Scalar tol)
 Sets the maximum absolute tolerated residual.
 
Scalar absResidualTolerance () const
 Returns the tolerated maximum of the the infinity norm of the absolute residual.
 
Scalar absResidual () const
 Returns the infinity norm of the absolute residual.
 
void setInitial (const Vector &curSol, const Vector &curResid) override
 Set the initial solution of the linear system of equations.
 
void update (const Vector &curSol, const Vector &changeIndicator, const Vector &curResid) override
 Update the internal members of the convergence criterion with the current solution.
 
bool converged () const override
 Returns true if and only if the convergence criterion is met.
 
bool failed () const override
 Returns true if the convergence criterion cannot be met anymore because the solver has broken down.
 
Scalar accuracy () const override
 Returns the accuracy of the solution at the last update.
 
void printInitial (std::ostream &os=std::cout) const override
 Prints the initial information about the convergence behaviour.
 
void print (Scalar iter, std::ostream &os=std::cout) const override
 Prints the information about the convergence behaviour for the current iteration.
 
- Public Member Functions inherited from Opm::Linear::ConvergenceCriterion< Vector >
virtual ~ConvergenceCriterion ()
 Destructor.
 
virtual void print (Scalar, std::ostream &=std::cout) const
 Prints the information about the convergence behaviour for the current iteration.
 

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.

Member Function Documentation

◆ 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 >.

◆ converged()

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

Returns true if and only if the convergence criterion is met.

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

◆ 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 >.

◆ print()

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.

◆ 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 >.

◆ 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 >.

◆ 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: