Loading...
Searching...
No Matches
Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication > Class Template Reference
Linear

Convergence criterion which looks at the weighted absolute value of the residual. More...

`#include <weightedresidreductioncriterion.hh>`

Inheritance diagram for Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >:

## Public Member Functions

| WeightedResidualReductionCriterion (const CollectiveCommunication &comm)
| WeightedResidualReductionCriterion (const CollectiveCommunication &comm, const Vector &residWeights, Scalar residualReductionTolerance, Scalar fixPointTolerance, Scalar absResidualTolerance=0.0, Scalar maxError=0.0)
void | setResidualWeight (const Vector &residWeightVec)
| Sets the relative weight of each row of the residual.
Scalar | residualWeight (size_t outerIdx, unsigned innerIdx) const
| Return the relative weight of a row of the residual.
void | setResidualReductionTolerance (Scalar tol)
| Sets the residual reduction tolerance.
Scalar | residualReductionTolerance () const
| Returns the tolerance of the residual reduction of the solution.
void | setResidualTolerance (Scalar tol)
| Sets the maximum absolute tolerated residual.
Scalar | absResidualTolerance () const
| Returns the maximum absolute tolerated residual.
Scalar | residualAccuracy () const
| Returns the reduction of the weighted maximum of the residual compared to the initial solution.
void | setFixPointTolerance (Scalar tol)
| Sets the fix-point tolerance.
Scalar | fixPointTolerance () const
| Returns the maximum tolerated difference between two iterations to be met before a solution is considered to be converged.
Scalar | fixPointAccuracy () const
| Returns the weighted maximum of the difference between the last two iterative solutions.
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 &, const Vector &curResid) override
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::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >

Convergence criterion which looks at the weighted absolute value of the residual.

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

where is the residual for the k-th iterative solution vector and is the weight of the -th linear equation.

In addition, to the reduction of the maximum defect, the linear solver is also considered to be converged, if the defect goes below a given absolute limit.

## Member Function Documentation

## accuracy()

template<class Vector, class CollectiveCommunication>

Scalar Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::accuracy | ( |  | ) | const

inline override virtual

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::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::converged | ( |  | ) | const

inline override virtual

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::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::failed | ( |  | ) | const

inline override virtual

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::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::print | ( | Scalar | iter,
|  | std::ostream & | os = std::cout ) const

inline override

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

Parameters

  iter | The iteration number. The semantics of this parameter are chosen by the linear solver.
  os | The output stream to which the message gets written.

## printInitial()

template<class Vector, class CollectiveCommunication>

void Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::printInitial | ( | std::ostream & | os = std::cout | ) | const

inline override virtual

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

  os | The output stream to which the message gets written.

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

## residualWeight()

template<class Vector, class CollectiveCommunication>

Scalar Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualWeight | ( | size_t | outerIdx,
|  | unsigned | innerIdx ) const

inline

Return the relative weight of a row of the residual.

Parameters

  outerIdx | The index of the outer vector (i.e. Dune::BlockVector)
  innerIdx | The index of the inner vector (i.e. Dune::FieldVector)

## setInitial()

template<class Vector, class CollectiveCommunication>

void Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setInitial | ( | const Vector & | curSol,
|  | const Vector & | curResid )

inline override virtual

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

  curSol | The current iterative solution of the linear system of equations
  curResid | The residual vector of the current iterative solution of the linear system of equations

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

## setResidualWeight()

template<class Vector, class CollectiveCommunication>

void Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setResidualWeight | ( | const Vector & | residWeightVec | ) |

inline

Sets the relative weight of each row of the residual.

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

where is the residual for the k-th iterative solution vector and is the weight of the -th linear equation.

This method is not part of the generic ConvergenceCriteria interface.

Parameters

  residWeightVec | A Dune::BlockVector<Dune::FieldVector<Scalar, n> > with the relative weights of the linear equations

## update()

template<class Vector, class CollectiveCommunication>

void Opm::Linear::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::update | ( | const Vector & | curSol,
|  | const Vector & | ,
|  | const Vector & | curResid )

inline override virtual

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

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

- opm/simulators/linalg/weightedresidreductioncriterion.hh