OGS
ConvergenceCriterionPerComponentResidual.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
10
11namespace NumLib
12{
14
23{
24public:
26 std::vector<double>&& absolute_tolerances,
27 std::vector<double>&& relative_tolerances,
28 std::vector<double>&& damping_alpha,
29 bool daming_alpha_switch,
30 const MathLib::VecNormType norm_type);
31
32 bool hasDeltaXCheck() const override { return true; }
33 bool hasResidualCheck() const override { return true; }
34 bool hasNonNegativeDamping() const override
35 {
37 }
38
41 void checkDeltaX(const GlobalVector& minus_delta_x,
42 GlobalVector const& x) override;
43 void checkResidual(const GlobalVector& residual) override;
44 double getDampingFactor(GlobalVector const& minus_delta_x,
45 GlobalVector const& x,
46 double damping_orig) override;
47
48 void setDOFTable(const LocalToGlobalIndexMap& dof_table,
49 MeshLib::Mesh const& mesh) override;
50
51private:
52 const std::vector<double> _abstols;
53 const std::vector<double> _reltols;
55 MeshLib::Mesh const* _mesh = nullptr;
56 std::vector<double> _residual_norms_0;
57 const std::vector<double> _damping_alpha;
59};
60
61std::unique_ptr<ConvergenceCriterionPerComponentResidual>
63 BaseLib::ConfigTree const& config);
64
65} // namespace NumLib
MathLib::EigenVector GlobalVector
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
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.
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
ConvergenceCriterionPerComponent(const MathLib::VecNormType norm_type)
std::unique_ptr< ConvergenceCriterionPerComponentResidual > createConvergenceCriterionPerComponentResidual(const BaseLib::ConfigTree &config)