12 int maxNonConstTimeWindows,
13 bool preconditionerUpdateOnThreshold)
15 _preconditionerUpdateOnThreshold(preconditionerUpdateOnThreshold)
29 const Eigen::VectorXd &oldValues,
30 const Eigen::VectorXd &res)
32 if (timeWindowComplete) {
46 part(i) = res(i + offset);
56 "All residual sub-vectors in the residual-sum preconditioner are numerically zero ( sum = {}). "
57 "This indicates that the data values exchanged between two successive iterations did not change. "
58 "The simulation may be unstable, e.g. produces NAN values. Please check the data values exchanged "
59 "between the solvers is not identical between iterations. The preconditioner scaling factors were "
60 "not updated in this iteration and the scaling factors determined in the previous iteration were used.",
69 "A sub-vector in the residual-sum preconditioner became numerically zero ( sub-vector = {}). "
70 "If this occurred in the second iteration and the initial-relaxation factor is equal to 1.0, "
71 "check if the coupling data values of one solver is zero in the first iteration. "
72 "The preconditioner scaling factors were not updated for this iteration and the scaling factors "
73 "determined in the previous iteration were used.",
90 if ((factor > 10.0) || (factor < 0.1)) {
92 PRECICE_DEBUG(
"Significant scaling weight change is detected. The pre-scaling weights will be reset.");
111 PRECICE_DEBUG(
"preconditioner scaling factor[{}] = {}", k, 1 / resSum);
#define PRECICE_WARN_IF(condition,...)
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
Interface for preconditioner variants that can be applied to quasi-Newton acceleration schemes.
std::vector< size_t > _subVectorSizes
Sizes of each sub-vector, i.e. each coupling data.
virtual void initialize(std::vector< size_t > &svs)
initialize the preconditioner
std::vector< double > _invWeights
Inverse weights (for efficiency reasons)
std::vector< double > _weights
Weights used to scale the matrix V and the residual.
bool _requireNewQR
True if a QR decomposition from scratch is necessary.
std::vector< double > _residualSum
ResidualSumPreconditioner(int maxNonConstTimeWindows, bool preconditionerUpdateOnThreshold)
std::vector< double > _previousResidualSum
bool _preconditionerUpdateOnThreshold
void initialize(std::vector< size_t > &svs) override
initialize the preconditioner
void _update_(bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res) override
Update the scaling after every FSI iteration.
static double dot(const Eigen::VectorXd &vec1, const Eigen::VectorXd &vec2)
constexpr bool equals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares two Eigen::MatrixBase for equality up to tolerance.
constexpr double NUMERICAL_ZERO_DIFFERENCE