OGS
CreateNewtonRaphsonSolverParameters.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
7#include "NewtonRaphson.h"
8
9namespace NumLib
10{
12 BaseLib::ConfigTree const& config)
13{
14 DBUG("Create local nonlinear solver parameters.");
15 auto const maximum_iterations =
17 config.getConfigParameter<int>("maximum_iterations");
18
19 DBUG("\tmaximum_iterations: {:d}.", maximum_iterations);
20
21 auto const error_tolerance =
23 config.getConfigParameterOptional<double>("error_tolerance");
24 if (error_tolerance)
25 {
26 WARN(
27 "The 'error_tolerance' tag for the Newton-Raphson solver is "
28 "deprecated.\n"
29 "Use new tags 'residuum_tolerance' and 'increment_tolerance'.\n"
30 "For now we use residuum_tolerance {} and increment_tolerance 0.",
31 *error_tolerance);
32 return {maximum_iterations, *error_tolerance, 0};
33 }
34
35 auto const residuum_tolerance =
37 config.getConfigParameter<double>("residuum_tolerance");
38
39 DBUG("\tresiduum_tolerance: {:g}.", residuum_tolerance);
40
41 auto const increment_tolerance =
43 config.getConfigParameter<double>("increment_tolerance");
44
45 DBUG("\tincrement_tolerance: {:g}.", increment_tolerance);
46
47 return {maximum_iterations, residuum_tolerance, increment_tolerance};
48}
49} // namespace NumLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:34
std::optional< T > getConfigParameterOptional(std::string const &param) const
T getConfigParameter(std::string const &param) const
NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const &config)