23        std::vector<double>&& absolute_tolerances,
 
   24        std::vector<double>&& relative_tolerances,
 
   25        std::vector<double>&& damping_alpha,
 
   26        bool damping_alpha_switch,
 
   29      _abstols(std::move(absolute_tolerances)),
 
   30      _reltols(std::move(relative_tolerances)),
 
   31      _residual_norms_0(_abstols.size()),
 
   32      _damping_alpha(std::move(damping_alpha)),
 
   33      _damping_alpha_switch(damping_alpha_switch)
 
   38            "The number of absolute and relative tolerances given must be the " 
   44        OGS_FATAL(
"The given tolerances vector is empty.");
 
 
   53        OGS_FATAL(
"D.o.f. table has not been set.");
 
   56    for (
unsigned global_component = 0; global_component < 
_abstols.size();
 
   65            "Convergence criterion, component {:d}: |dx|={:.4e}, |x|={:.4e}, " 
   67            global_component, error_dx, norm_x,
 
   68            (norm_x == 0. ? std::numeric_limits<double>::quiet_NaN()
 
   69                          : (error_dx / norm_x)));
 
 
   78        OGS_FATAL(
"D.o.f. table has not been set.");
 
   81    for (
unsigned global_component = 0; global_component < 
_abstols.size();
 
   90            INFO(
"Convergence criterion, component {:d}: |r0|={:.4e}",
 
   91                 global_component, norm_res);
 
   98                "Convergence criterion, component {:d}: |r|={:.4e}, " 
   99                "|r0|={:.4e}, |r|/|r0|={:.4e}",
 
  100                global_component, norm_res, norm_res0,
 
  101                (norm_res0 == 0. ? std::numeric_limits<double>::quiet_NaN()
 
  102                                 : (norm_res / norm_res0)));
 
  105        bool const satisfied_abs = norm_res < 
_abstols[global_component];
 
  108        bool const satisfied_rel =
 
 
  122        OGS_FATAL(
"D.o.f. table or mesh have not been set.");
 
  126    double damping_final = 1;
 
  127    for (
unsigned global_component = 0;
 
  133        DBUG(
"Non-negative damping for component: {:d} alpha: {:g}",
 
  139            damping_final = std::min(
 
  141                damping_orig / std::max(1.0, (minus_delta_x.
get(index) *
 
  146    DBUG(
"Final damping value due to non-negative damping: {:g}",
 
  148    return damping_final;
 
 
  161            "The number of components in the DOF table ({:d}) and the number " 
  162            "of tolerances given ({:d}) do not match.",
 
 
  168std::unique_ptr<ConvergenceCriterionPerComponentResidual>
 
  184    auto const norm_type_str =
 
  188    bool damping_alpha_switch = 
true;
 
  189    if ((!abstols) && (!reltols))
 
  192            "At least one of absolute or relative tolerance has to be " 
  197        abstols = std::vector<double>(reltols->size());
 
  201        reltols = std::vector<double>(abstols->size());
 
  205        damping_alpha = std::vector<double>(abstols->size(), 0.0);
 
  206        damping_alpha_switch = 
false;
 
  213        OGS_FATAL(
"Unknown vector norm type `{:s}'.", norm_type_str);
 
  216    return std::make_unique<ConvergenceCriterionPerComponentResidual>(
 
  217        std::move(*abstols), std::move(*reltols), std::move(*damping_alpha),
 
  218        damping_alpha_switch, norm_type);
 
 
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
 
void DBUG(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.
 
double get(IndexType rowId) const
get entry
 
std::size_t getID() const
Get id of the mesh.
 
const std::vector< double > _damping_alpha
 
ConvergenceCriterionPerComponentResidual(std::vector< double > &&absolute_tolerances, std::vector< double > &&relative_tolerances, std::vector< double > &&damping_alpha, bool daming_alpha_switch, const MathLib::VecNormType norm_type)
 
double getDampingFactor(GlobalVector const &minus_delta_x, GlobalVector const &x, double damping_orig) override
 
MeshLib::Mesh const  * _mesh
 
void setDOFTable(const LocalToGlobalIndexMap &dof_table, MeshLib::Mesh const &mesh) override
Sets the d.o.f. table used to extract data for a specific component.
 
const std::vector< double > _abstols
 
LocalToGlobalIndexMap const  * _dof_table
 
void checkResidual(const GlobalVector &residual) override
Check if the residual satisfies the convergence criterion.
 
void checkDeltaX(const GlobalVector &minus_delta_x, GlobalVector const &x) override
 
std::vector< double > _residual_norms_0
 
const std::vector< double > _reltols
 
const MathLib::VecNormType _norm_type
 
GlobalIndexType getGlobalIndex(MeshLib::Location const &l, int const variable_id, int const component_id) const
 
MeshLib::MeshSubset const & getMeshSubset(int const variable_id, int const component_id) const
 
int getNumberOfGlobalComponents() const
 
void setLocalAccessibleVector(PETScVector const &x)
 
VecNormType convertStringToVecNormType(const std::string &str)
convert string to VecNormType
 
auto meshLocations(Mesh const &mesh, MeshItemType const item_type)
 
bool checkRelativeTolerance(const double reltol, const double numerator, const double denominator)
 
std::unique_ptr< ConvergenceCriterionPerComponentResidual > createConvergenceCriterionPerComponentResidual(const BaseLib::ConfigTree &config)
 
double norm(GlobalVector const &x, unsigned const global_component, MathLib::VecNormType norm_type, LocalToGlobalIndexMap const &dof_table)