OGS
ConvergenceCriterionPerComponentDeltaX.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
7#include "DampingPolicy.h"
9
10namespace NumLib
11{
13
22 public DampingPolicy
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 false; }
34 DampingPolicy const* dampingPolicy() const override
35 {
36 return _damping_alpha_switch ? this : nullptr;
37 }
38
39 void checkDeltaX(const GlobalVector& minus_delta_x,
40 GlobalVector const& x) override;
41 void checkResidual(const GlobalVector& /*residual*/) override {}
42 double apply(GlobalVector const& minus_delta_x,
43 GlobalVector const& x,
44 double const base_damping) const override;
45
46 void reset() override { this->_satisfied = true; }
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;
54 const std::vector<double> _damping_alpha;
57 MeshLib::Mesh const* _mesh = nullptr;
58};
59
60std::unique_ptr<ConvergenceCriterionPerComponentDeltaX>
62
63} // namespace NumLib
MathLib::EigenVector GlobalVector
ConvergenceCriterionPerComponentDeltaX(std::vector< double > &&absolute_tolerances, std::vector< double > &&relative_tolerances, std::vector< double > &&damping_alpha, bool daming_alpha_switch, const MathLib::VecNormType norm_type)
void checkResidual(const GlobalVector &) override
Check if the residual satisfies the convergence criterion.
void checkDeltaX(const GlobalVector &minus_delta_x, GlobalVector const &x) 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.
double apply(GlobalVector const &minus_delta_x, GlobalVector const &x, double const base_damping) const override
ConvergenceCriterionPerComponent(const MathLib::VecNormType norm_type)
std::unique_ptr< ConvergenceCriterionPerComponentDeltaX > createConvergenceCriterionPerComponentDeltaX(const BaseLib::ConfigTree &config)