Chi-Tech
NonLinearSolverOptions.cc
Go to the documentation of this file.
2
3#include "ChiObjectFactory.h"
4
5namespace chi_math
6{
7
9
11{
13
14 params.SetGeneralDescription("Options available on NonLinearSolver");
15 params.SetDocGroup("LuaMath");
16
18 "name", "NonLinearSolver", "A name to assign to the solver.");
19
21 "nl_method", "JFNK", "The non-linear method to use.");
23 "l_method", "gmres", "The linear solver method to use.");
24
26 "petsc_snes_type",
27 "newtonls",
28 "The type passed to SNESSetType, if PETSc is used. Consult PETSc's "
29 "documentation for a list of available types.");
30
31 chi::ParameterBlock pc_options;
32 pc_options.AddParameter("pc_type", "hypre");
33 pc_options.AddParameter("pc_hypre_type", "boomeramg");
34
36 "pc_options",
37 pc_options,
38 "A table of parameters used in the preconditioner.");
39
41 "nl_rel_tol", 1.0e-8, "Non-linear relative tolerance");
43 "nl_abs_tol", 1.0e-8, "Non-linear absolute tolerance");
45 "nl_sol_tol", 1.0e-50, "Non-linear solution tolerance");
47 "nl_max_its", 50, "Non-linear maximum iterations");
49 "nl_max_r_evaluations",
50 -1,
51 "The maximum allowed residual evaluations. Negative number disables this.");
52 params.AddOptionalParameter("l_max_failed_iterations",
53 1000,
54 "The maximum allowed non-linear iterations "
55 "where the linear solver failed to converge.");
56
57 params.AddOptionalParameter("l_rel_tol", 1.0e-8, "Linear relative tolerance");
58 params.AddOptionalParameter("l_abs_tol", 1.0e-8, "Linear absolute tolerance");
60 "l_div_tol", 1.0e6, "Linear divergence tolerance");
61 params.AddOptionalParameter("l_max_its", 100, "Linear maximum iterations");
63 "l_gmres_restart_intvl", 30, "GMRes restart interval");
65 "l_gmres_breakdown_tol", 1.0e6, "GMRes breakdown tolerance");
66
67 using namespace chi_data_types;
69 "nl_method", AllowableRangeList::New({"JFNK", "PJFNK", "NEWTON", "LINEAR"}));
70
71 return params;
72}
73
75 const chi::InputParameters& params)
76 : ChiObject(params),
77 nl_method_(params.GetParamValue<std::string>("nl_method")),
78 l_method_(params.GetParamValue<std::string>("l_method")),
79 pc_options_(params.GetParam("pc_options")),
80 petsc_snes_type_(params.GetParamValue<std::string>("petsc_snes_type")),
81 nl_rel_tol_(params.GetParamValue<double>("nl_rel_tol")),
82 nl_abs_tol_(params.GetParamValue<double>("nl_abs_tol")),
83 nl_sol_tol_(params.GetParamValue<double>("nl_sol_tol")),
84 nl_max_its_(params.GetParamValue<int>("nl_max_its")),
85 nl_max_r_evaluations_(params.GetParamValue<int>("nl_max_r_evaluations")),
86 l_max_failed_iterations_(
87 params.GetParamValue<int>("l_max_failed_iterations")),
88 l_rel_tol_(params.GetParamValue<double>("l_rel_tol")),
89 l_abs_tol_(params.GetParamValue<double>("l_abs_tol")),
90 l_div_tol_(params.GetParamValue<double>("l_div_tol")),
91 l_max_its_(params.GetParamValue<int>("l_max_its")),
92 l_gmres_restart_intvl_(params.GetParamValue<int>("l_gmres_restart_intvl")),
93 l_gmres_breakdown_tol_(
94 params.GetParamValue<double>("l_gmres_breakdown_tol"))
95{
96}
97
98} // namespace chi_math
static chi::InputParameters GetInputParameters()
Definition: ChiObject.cc:4
void SetDocGroup(const std::string &doc_group)
void ConstrainParameterRange(const std::string &param_name, AllowableRangePtr allowable_range)
void AddOptionalParameter(const std::string &name, T value, const std::string &doc_string)
void AddOptionalParameterBlock(const std::string &name, const ParameterBlock &block, const std::string &doc_string)
void SetGeneralDescription(const std::string &description)
void AddParameter(ParameterBlock block)
static chi::InputParameters GetInputParameters()
RegisterChiObjectParametersOnly(chi_math, NonLinearSolverOptions)