20 std::optional<double>&& absolute_tolerance,
21 std::optional<double>&& relative_tolerance,
24 _abstol(std::move(absolute_tolerance)),
25 _reltol(std::move(relative_tolerance))
30 "At least one of absolute or relative tolerance has to be "
41 INFO(
"Convergence criterion: |dx|={:.4e}, |x|={:.4e}, |dx|/|x|={:.4e}",
43 (norm_x == 0. ? std::numeric_limits<double>::quiet_NaN()
44 : (error_dx / norm_x)));
53 INFO(
"Convergence criterion: |r0|={:.4e}", norm_res);
59 (_residual_norm_0 < std::numeric_limits<double>::epsilon())
64 INFO(
"Convergence criterion: |r|={:.4e} |r0|={:.4e}", norm_res,
70 "Convergence criterion: |r|={:.4e} |r0|={:.4e} |r|/|r0|={:.4e}",
73 ? std::numeric_limits<double>::quiet_NaN()
78 bool satisfied_abs =
false;
79 bool satisfied_rel =
false;
83 satisfied_abs = norm_res < *
_abstol;
94std::unique_ptr<ConvergenceCriterionResidual>
104 auto const norm_type_str =
111 OGS_FATAL(
"Unknown vector norm type `{:s}'.", norm_type_str);
114 return std::make_unique<ConvergenceCriterionResidual>(
115 std::move(abstol), std::move(reltol), norm_type);
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
T getConfigParameter(std::string const ¶m) const
void checkConfigParameter(std::string const ¶m, std::string_view const value) const
Global vector based on Eigen vector.
void checkResidual(const GlobalVector &residual) override
Check if the residual satisfies the convergence criterion.
const std::optional< double > _reltol
ConvergenceCriterionResidual(std::optional< double > &&absolute_tolerance, std::optional< double > &&relative_tolerance, const MathLib::VecNormType norm_type)
void checkDeltaX(const GlobalVector &minus_delta_x, GlobalVector const &x) override
const std::optional< double > _abstol
const MathLib::VecNormType _norm_type
double norm(MatrixOrVector const &x, MathLib::VecNormType type)
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
bool checkRelativeTolerance(const double reltol, const double numerator, const double denominator)
std::unique_ptr< ConvergenceCriterionResidual > createConvergenceCriterionResidual(const BaseLib::ConfigTree &config)