preCICE v3.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
precice::acceleration::impl::Preconditioner Class Referenceabstract

Interface for preconditioner variants that can be applied to quasi-Newton acceleration schemes. More...

#include <Preconditioner.hpp>

Inheritance diagram for precice::acceleration::impl::Preconditioner:
[legend]
Collaboration diagram for precice::acceleration::impl::Preconditioner:
[legend]

Public Member Functions

 Preconditioner (int maxNonConstTimeWindows)
 
virtual ~Preconditioner ()
 Destructor, empty.
 
virtual void initialize (std::vector< size_t > &svs)
 initialize the preconditioner
 
void apply (Eigen::MatrixXd &M, bool transpose)
 Apply preconditioner to matrix.
 
void revert (Eigen::MatrixXd &M, bool transpose)
 Apply inverse preconditioner to matrix.
 
void apply (Eigen::MatrixXd &M)
 To transform physical values to balanced values. Matrix version.
 
void apply (Eigen::VectorXd &v)
 To transform physical values to balanced values. Vector version.
 
void revert (Eigen::MatrixXd &M)
 To transform balanced values back to physical values. Matrix version.
 
void revert (Eigen::VectorXd &v)
 To transform balanced values back to physical values. Vector version.
 
void update (bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res)
 Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)
 
bool requireNewQR ()
 returns true if a QR decomposition from scratch is necessary
 
void newQRfulfilled ()
 to tell the preconditioner that QR-decomposition has been recomputed
 
std::vector< double > & getWeights ()
 
bool isConst ()
 

Protected Member Functions

virtual void _update_ (bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res)=0
 Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)
 

Protected Attributes

std::vector< double > _weights
 Weights used to scale the matrix V and the residual.
 
std::vector< double > _invWeights
 Inverse weights (for efficiency reasons)
 
std::vector< size_t > _subVectorSizes
 Sizes of each sub-vector, i.e. each coupling data.
 
int _maxNonConstTimeWindows
 maximum number of non-const time windows, i.e., after this number of time windows, the preconditioner is frozen with the current weights and becomes a constant preconditioner
 
int _nbNonConstTimeWindows = 0
 Counts the number of completed time windows with a non-const weighting.
 
bool _requireNewQR = false
 True if a QR decomposition from scratch is necessary.
 
bool _frozen = false
 True if _nbNonConstTimeWindows >= _maxNonConstTimeWindows, i.e., preconditioner is not updated any more.
 

Private Attributes

logging::Logger _log {"acceleration::Preconditioner"}
 

Detailed Description

Interface for preconditioner variants that can be applied to quasi-Newton acceleration schemes.

Preconditioning (formerly also known as scaling) improves the balance between several sub-vectors for parallel or multi coupling.

apply() applies the weighting, i.e. transforms from physical values to balanced values. revert() reverts the weighting, i.e. transforms from balanced values back to physical values. update() updates the preconditioner, after every FSI iteration (though some variants might only be updated after a complete time window)

Definition at line 25 of file Preconditioner.hpp.

Constructor & Destructor Documentation

◆ Preconditioner()

precice::acceleration::impl::Preconditioner::Preconditioner ( int maxNonConstTimeWindows)
inline

Definition at line 27 of file Preconditioner.hpp.

◆ ~Preconditioner()

virtual precice::acceleration::impl::Preconditioner::~Preconditioner ( )
inlinevirtual

Destructor, empty.

Definition at line 33 of file Preconditioner.hpp.

Member Function Documentation

◆ _update_()

virtual void precice::acceleration::impl::Preconditioner::_update_ ( bool timeWindowComplete,
const Eigen::VectorXd & oldValues,
const Eigen::VectorXd & res )
protectedpure virtual

Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)

Parameters
[in]timeWindowCompleteTrue if this FSI iteration also completed a time windows

Implemented in precice::acceleration::impl::ConstantPreconditioner, precice::acceleration::impl::ResidualPreconditioner, precice::acceleration::impl::ResidualSumPreconditioner, and precice::acceleration::impl::ValuePreconditioner.

◆ apply() [1/3]

void precice::acceleration::impl::Preconditioner::apply ( Eigen::MatrixXd & M)
inline

To transform physical values to balanced values. Matrix version.

Definition at line 103 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ apply() [2/3]

void precice::acceleration::impl::Preconditioner::apply ( Eigen::MatrixXd & M,
bool transpose )
inline

Apply preconditioner to matrix.

Parameters
transposefalse = from left, true = from right

Definition at line 57 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ apply() [3/3]

void precice::acceleration::impl::Preconditioner::apply ( Eigen::VectorXd & v)
inline

To transform physical values to balanced values. Vector version.

Definition at line 117 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ getWeights()

std::vector< double > & precice::acceleration::impl::Preconditioner::getWeights ( )
inline

Definition at line 194 of file Preconditioner.hpp.

◆ initialize()

virtual void precice::acceleration::impl::Preconditioner::initialize ( std::vector< size_t > & svs)
inlinevirtual

initialize the preconditioner

Parameters
sizeof the pp system (e.g. rows of V)

Reimplemented in precice::acceleration::impl::ConstantPreconditioner, and precice::acceleration::impl::ResidualSumPreconditioner.

Definition at line 39 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ isConst()

bool precice::acceleration::impl::Preconditioner::isConst ( )
inline

Definition at line 199 of file Preconditioner.hpp.

◆ newQRfulfilled()

void precice::acceleration::impl::Preconditioner::newQRfulfilled ( )
inline

to tell the preconditioner that QR-decomposition has been recomputed

Definition at line 189 of file Preconditioner.hpp.

◆ requireNewQR()

bool precice::acceleration::impl::Preconditioner::requireNewQR ( )
inline

returns true if a QR decomposition from scratch is necessary

Definition at line 182 of file Preconditioner.hpp.

◆ revert() [1/3]

void precice::acceleration::impl::Preconditioner::revert ( Eigen::MatrixXd & M)
inline

To transform balanced values back to physical values. Matrix version.

Definition at line 130 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ revert() [2/3]

void precice::acceleration::impl::Preconditioner::revert ( Eigen::MatrixXd & M,
bool transpose )
inline

Apply inverse preconditioner to matrix.

Parameters
transposefalse = from left, true = from right

Definition at line 81 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ revert() [3/3]

void precice::acceleration::impl::Preconditioner::revert ( Eigen::VectorXd & v)
inline

To transform balanced values back to physical values. Vector version.

Definition at line 145 of file Preconditioner.hpp.

Here is the call graph for this function:

◆ update()

void precice::acceleration::impl::Preconditioner::update ( bool timeWindowComplete,
const Eigen::VectorXd & oldValues,
const Eigen::VectorXd & res )
inline

Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)

Parameters
[in]timeWindowCompleteTrue if this FSI iteration also completed a time window

Definition at line 162 of file Preconditioner.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ _frozen

bool precice::acceleration::impl::Preconditioner::_frozen = false
protected

True if _nbNonConstTimeWindows >= _maxNonConstTimeWindows, i.e., preconditioner is not updated any more.

Definition at line 226 of file Preconditioner.hpp.

◆ _invWeights

std::vector<double> precice::acceleration::impl::Preconditioner::_invWeights
protected

Inverse weights (for efficiency reasons)

Definition at line 209 of file Preconditioner.hpp.

◆ _log

logging::Logger precice::acceleration::impl::Preconditioner::_log {"acceleration::Preconditioner"}
private

Definition at line 236 of file Preconditioner.hpp.

◆ _maxNonConstTimeWindows

int precice::acceleration::impl::Preconditioner::_maxNonConstTimeWindows
protected

maximum number of non-const time windows, i.e., after this number of time windows, the preconditioner is frozen with the current weights and becomes a constant preconditioner

Definition at line 217 of file Preconditioner.hpp.

◆ _nbNonConstTimeWindows

int precice::acceleration::impl::Preconditioner::_nbNonConstTimeWindows = 0
protected

Counts the number of completed time windows with a non-const weighting.

Definition at line 220 of file Preconditioner.hpp.

◆ _requireNewQR

bool precice::acceleration::impl::Preconditioner::_requireNewQR = false
protected

True if a QR decomposition from scratch is necessary.

Definition at line 223 of file Preconditioner.hpp.

◆ _subVectorSizes

std::vector<size_t> precice::acceleration::impl::Preconditioner::_subVectorSizes
protected

Sizes of each sub-vector, i.e. each coupling data.

Definition at line 212 of file Preconditioner.hpp.

◆ _weights

std::vector<double> precice::acceleration::impl::Preconditioner::_weights
protected

Weights used to scale the matrix V and the residual.

Definition at line 206 of file Preconditioner.hpp.


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