Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication > Class Template Reference

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

#include <weightedresidreductioncriterion.hh>

Inheritance diagram for Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >:
Inheritance graph

Public Member Functions

 WeightedResidualReductionCriterion (const CollectiveCommunication &comm)
 
 WeightedResidualReductionCriterion (const CollectiveCommunication &comm, const Vector &residWeights, Scalar fixPointTolerance, Scalar residualReductionTolerance, Scalar absResidualTolerance=0.0)
 
void setResidualWeight (const Vector &residWeightVec)
 Sets the relative weight of each row of the residual. More...
 
Scalar residualWeight (int outerIdx, int innerIdx) const
 Return the relative weight of a row of the residual. More...
 
void setResidualReductionTolerance (Scalar tol)
 Sets the residual reduction tolerance. More...
 
Scalar residualReductionTolerance () const
 Returns the tolerance of the residual reduction of the solution. More...
 
void setResidualTolerance (Scalar tol)
 Sets the maximum absolute tolerated residual. More...
 
Scalar absResidualTolerance () const
 Returns the maximum absolute tolerated residual. More...
 
Scalar residualAccuracy () const
 Returns the reduction of the weighted maximum of the residual compared to the initial solution. More...
 
void setFixPointTolerance (Scalar tol)
 Sets the fix-point tolerance. More...
 
Scalar fixPointTolerance () const
 Returns the maximum tolerated difference between two iterations to be met before a solution is considered to be converged. More...
 
Scalar fixPointAccuracy () const
 Returns the weighted maximum of the difference between the last two iterative solutions. More...
 
void setInitial (const Vector &curSol, const Vector &curResid)
 Set the initial solution of the linear system of equations. More...
 
void update (const Vector &curSol, const Vector &curResid)
 Update the internal members of the convergence criterion with the current solution. More...
 
bool converged () const
 Returns true if and only if the convergence criterion is met. More...
 
Scalar accuracy () const
 Returns the accuracy of the solution at the last update. More...
 
void printInitial (std::ostream &os=std::cout) const
 Prints the initial information about the convergence behaviour. More...
 
void print (Scalar iter, std::ostream &os=std::cout) const
 Prints the information about the convergence behaviour for the current iteration. More...
 

Detailed Description

template<class Vector, class CollectiveCommunication>
class Ewoms::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

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

where $r^k = \mathbf{A} x^k - b $ is the residual for the k-th iterative solution vector $x^k$ and $w_i$ is the weight of the $i$-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.

Constructor & Destructor Documentation

template<class Vector, class CollectiveCommunication>
Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::WeightedResidualReductionCriterion ( const CollectiveCommunication &  comm)
inline
template<class Vector, class CollectiveCommunication>
Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::WeightedResidualReductionCriterion ( const CollectiveCommunication &  comm,
const Vector &  residWeights,
Scalar  fixPointTolerance,
Scalar  residualReductionTolerance,
Scalar  absResidualTolerance = 0.0 
)
inline

Member Function Documentation

template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::absResidualTolerance ( ) const
inline

Returns the maximum absolute tolerated residual.

template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::accuracy ( ) const
inlinevirtual

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 Ewoms::ConvergenceCriterion< Vector >.

template<class Vector, class CollectiveCommunication>
bool Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::converged ( ) const
inlinevirtual
template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::fixPointAccuracy ( ) const
inline

Returns the weighted maximum of the difference between the last two iterative solutions.

Referenced by Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::print().

template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::fixPointTolerance ( ) const
inline

Returns the maximum tolerated difference between two iterations to be met before a solution is considered to be converged.

template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::print ( Scalar  iter,
std::ostream &  os = std::cout 
) const
inlinevirtual

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 from Ewoms::ConvergenceCriterion< Vector >.

References Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::fixPointAccuracy(), and Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualAccuracy().

template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::printInitial ( std::ostream &  os = std::cout) const
inlinevirtual

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 Ewoms::ConvergenceCriterion< Vector >.

References Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualAccuracy().

template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualAccuracy ( ) const
inline
template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualReductionTolerance ( ) const
inline

Returns the tolerance of the residual reduction of the solution.

Referenced by Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::converged().

template<class Vector, class CollectiveCommunication>
Scalar Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::residualWeight ( int  outerIdx,
int  innerIdx 
) const
inline

Return the relative weight of a row of the residual.

Parameters
outerIdxThe index of the outer vector (i.e. Dune::BlockVector)
innerIdxThe index of the inner vector (i.e. Dune::FieldVector)
template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setFixPointTolerance ( Scalar  tol)
inline

Sets the fix-point tolerance.

template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setInitial ( const Vector &  curSol,
const Vector &  curResid 
)
inlinevirtual

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 Ewoms::ConvergenceCriterion< Vector >.

template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setResidualReductionTolerance ( Scalar  tol)
inline

Sets the residual reduction tolerance.

template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::setResidualTolerance ( Scalar  tol)
inline

Sets the maximum absolute tolerated residual.

template<class Vector, class CollectiveCommunication>
void Ewoms::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

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

where $r^k = \mathbf{A} x^k - b $ is the residual for the k-th iterative solution vector $x^k$ and $w_i$ is the weight of the $i$-th linear equation.

This method is not part of the generic ConvergenceCriteria interface.

Parameters
residWeightVecA Dune::BlockVector<Dune::FieldVector<Scalar, n> > with the relative weights of the linear equations
template<class Vector, class CollectiveCommunication>
void Ewoms::WeightedResidualReductionCriterion< Vector, CollectiveCommunication >::update ( const Vector &  curSol,
const Vector &  curResid 
)
inlinevirtual

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
curResidThe residual vector of the current iterative solution of the linear system of equations

Implements Ewoms::ConvergenceCriterion< Vector >.


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