OGS
CreateNewtonRaphsonSolverParameters.cpp
Go to the documentation of this file.
1
11
12#include "BaseLib/ConfigTree.h"
13#include "NewtonRaphson.h"
14
15namespace NumLib
16{
18 BaseLib::ConfigTree const& config)
19{
20 DBUG("Create local nonlinear solver parameters.");
21 auto const maximum_iterations =
23 config.getConfigParameter<int>("maximum_iterations");
24
25 DBUG("\tmaximum_iterations: {:d}.", maximum_iterations);
26
27 auto const error_tolerance =
29 config.getConfigParameterOptional<double>("error_tolerance");
30 if (error_tolerance)
31 {
32 WARN(
33 "The 'error_tolerance' tag for the Newton-Raphson solver is "
34 "deprecated.\n"
35 "Use new tags 'residuum_tolerance' and 'increment_tolerance'.\n"
36 "For now we use residuum_tolerance {} and increment_tolerance 0.",
37 *error_tolerance);
38 return {maximum_iterations, *error_tolerance, 0};
39 }
40
41 auto const residuum_tolerance =
43 config.getConfigParameter<double>("residuum_tolerance");
44
45 DBUG("\tresiduum_tolerance: {:g}.", residuum_tolerance);
46
47 auto const increment_tolerance =
49 config.getConfigParameter<double>("increment_tolerance");
50
51 DBUG("\tincrement_tolerance: {:g}.", increment_tolerance);
52
53 return {maximum_iterations, residuum_tolerance, increment_tolerance};
54}
55} // namespace NumLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
std::optional< T > getConfigParameterOptional(std::string const &param) const
T getConfigParameter(std::string const &param) const
NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const &config)