https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FEProblemSolve.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "FEProblemSolve.h"
11
12#include "FEProblem.h"
13#include "NonlinearSystemBase.h"
14#include "LinearSystem.h"
15#include "Convergence.h"
16#include "Executioner.h"
18#include "MooseUtils.h"
19#include "AuxiliarySystem.h"
20
21std::set<std::string> const FEProblemSolve::_moose_line_searches = {"contact", "project"};
22
23const std::set<std::string> &
28
31{
33
34 params.addParam<unsigned int>("nl_max_its", 50, "Max Nonlinear Iterations");
35 params.addParam<unsigned int>("nl_forced_its", 0, "The Number of Forced Nonlinear Iterations");
36 params.addParam<unsigned int>("nl_max_funcs", 10000, "Max Nonlinear solver function evaluations");
37 params.addParam<Real>("nl_abs_tol", 1.0e-50, "Nonlinear Absolute Tolerance");
38 params.addParam<Real>("nl_rel_tol", 1.0e-8, "Nonlinear Relative Tolerance");
39 params.addParam<Real>(
40 "nl_div_tol",
41 1.0e10,
42 "Nonlinear Relative Divergence Tolerance. A negative value disables this check.");
43 params.addParam<Real>(
44 "nl_abs_div_tol",
45 1.0e50,
46 "Nonlinear Absolute Divergence Tolerance. A negative value disables this check.");
47 params.addParam<Real>("nl_abs_step_tol", 0., "Nonlinear Absolute step Tolerance");
48 params.addParam<Real>("nl_rel_step_tol", 0., "Nonlinear Relative step Tolerance");
49 params.addParam<unsigned int>("n_max_nonlinear_pingpong",
50 100,
51 "The maximum number of times the nonlinear residual can ping pong "
52 "before requesting halting the current evaluation and requesting "
53 "timestep cut for transient simulations");
54
56 "nl_max_its nl_forced_its nl_max_funcs nl_abs_tol nl_rel_tol "
57 "nl_rel_step_tol nl_abs_step_tol nl_div_tol nl_abs_div_tol n_max_nonlinear_pingpong",
58 "Nonlinear Solver");
59
60 return params;
61}
62
65{
68
69 std::set<std::string> line_searches = mooseLineSearches();
70
71 std::set<std::string> alias_line_searches = {"default", "none", "basic"};
72 line_searches.insert(alias_line_searches.begin(), alias_line_searches.end());
73 std::set<std::string> petsc_line_searches = Moose::PetscSupport::getPetscValidLineSearches();
74 line_searches.insert(petsc_line_searches.begin(), petsc_line_searches.end());
75 std::string line_search_string = Moose::stringify(line_searches, " ");
76 MooseEnum line_search(line_search_string, "default");
77 std::string addtl_doc_str(" (Note: none = basic)");
78 params.addParam<MooseEnum>(
79 "line_search", line_search, "Specifies the line search type" + addtl_doc_str);
80 MooseEnum line_search_package("petsc moose", "petsc");
81 params.addParam<MooseEnum>("line_search_package",
82 line_search_package,
83 "The solver package to use to conduct the line-search");
84
85 params.addParam<unsigned>("contact_line_search_allowed_lambda_cuts",
86 2,
87 "The number of times lambda is allowed to be cut in half in the "
88 "contact line search. We recommend this number be roughly bounded by 0 "
89 "<= allowed_lambda_cuts <= 3");
90 params.addParam<Real>("contact_line_search_ltol",
91 "The linear relative tolerance to be used while the contact state is "
92 "changing between non-linear iterations. We recommend that this tolerance "
93 "be looser than the standard linear tolerance");
94
96 params.addParam<Real>("l_tol", 1.0e-5, "Linear Relative Tolerance");
97 params.addParam<Real>("l_abs_tol", 1.0e-50, "Linear Absolute Tolerance");
98 params.addParam<unsigned int>("l_max_its", 10000, "Max Linear Iterations");
99 params.addParam<std::vector<ConvergenceName>>(
100 "nonlinear_convergence",
101 "Name of the Convergence object(s) to use to assess convergence of the "
102 "nonlinear system(s) solve. If not provided, the default Convergence "
103 "associated with the Problem will be constructed internally.");
104 params.addParam<std::vector<ConvergenceName>>(
105 "linear_convergence",
106 "Name of the Convergence object(s) to use to assess convergence of the "
107 "linear system(s) solve. If not provided, the linear solver tolerance parameters are used");
108 params.addParam<bool>(
109 "snesmf_reuse_base",
110 true,
111 "Specifies whether or not to reuse the base vector for matrix-free calculation");
112 params.addParam<bool>(
113 "skip_exception_check", false, "Specifies whether or not to skip exception check");
114 params.addParam<bool>(
115 "use_pre_SMO_residual",
116 false,
117 "Compute the pre-SMO residual norm and use it in the relative convergence check. The "
118 "pre-SMO residual is computed at the begining of the time step before solution-modifying "
119 "objects are executed. Solution-modifying objects include preset BCs, constraints, "
120 "predictors, etc.");
121 params.addParam<bool>("automatic_scaling", "Whether to use automatic scaling for the variables.");
122 params.addParam<std::vector<bool>>(
123 "compute_scaling_once",
124 {true},
125 "Whether the scaling factors should only be computed once at the beginning of the simulation "
126 "through an extra Jacobian evaluation. If this is set to false, then the scaling factors "
127 "will be computed during an extra Jacobian evaluation at the beginning of every time step. "
128 "Vector entries correspond to each nonlinear system.");
129 params.addParam<std::vector<bool>>(
130 "off_diagonals_in_auto_scaling",
131 {false},
132 "Whether to consider off-diagonals when determining automatic scaling factors. Vector "
133 "entries correspond to each nonlinear system.");
134 params.addRangeCheckedParam<std::vector<Real>>(
135 "resid_vs_jac_scaling_param",
136 {0},
137 "0<=resid_vs_jac_scaling_param<=1",
138 "A parameter that indicates the weighting of the residual vs the Jacobian in determining "
139 "variable scaling parameters. A value of 1 indicates pure residual-based scaling. A value of "
140 "0 indicates pure Jacobian-based scaling. Vector entries correspond to each nonlinear "
141 "system.");
142 params.addParam<std::vector<std::vector<std::vector<std::string>>>>(
143 "scaling_group_variables",
144 "Name of variables that are grouped together for determining scale factors. (Multiple "
145 "groups can be provided, separated by semicolon). Vector entries correspond to each "
146 "nonlinear system.");
147 params.addParam<std::vector<std::vector<std::string>>>(
148 "ignore_variables_for_autoscaling",
149 "List of variables that do not participate in autoscaling. Vector entries correspond to each "
150 "nonlinear system.");
151 params.addRangeCheckedParam<unsigned int>(
152 "num_grids",
153 1,
154 "num_grids>0",
155 "The number of grids to use for a grid sequencing algorithm. This includes the final grid, "
156 "so num_grids = 1 indicates just one solve in a time-step");
157 params.addParam<std::vector<bool>>("residual_and_jacobian_together",
158 {false},
159 "Whether to compute the residual and Jacobian together. "
160 "Vector entries correspond to each nonlinear system.");
161
162 params.addParam<bool>("reuse_preconditioner",
163 false,
164 "If true reuse the previously calculated "
165 "preconditioner for the linearized "
166 "system across multiple solves "
167 "spanning nonlinear iterations and time steps. "
168 "The preconditioner resets as controlled by "
169 "reuse_preconditioner_max_linear_its");
170 params.addParam<unsigned int>("reuse_preconditioner_max_linear_its",
171 25,
172 "Reuse the previously calculated "
173 "preconditioner for the linear system "
174 "until the number of linear iterations "
175 "exceeds this number");
176
177 params.addParamNamesToGroup("l_tol l_abs_tol l_max_its reuse_preconditioner "
178 "reuse_preconditioner_max_linear_its",
179 "Linear Solver");
181 "solve_type snesmf_reuse_base use_pre_SMO_residual "
182 "num_grids residual_and_jacobian_together nonlinear_convergence linear_convergence",
183 "Nonlinear Solver");
185 "automatic_scaling compute_scaling_once off_diagonals_in_auto_scaling "
186 "scaling_group_variables resid_vs_jac_scaling_param ignore_variables_for_autoscaling",
187 "Solver variable scaling");
188 params.addParamNamesToGroup("line_search line_search_package contact_line_search_ltol "
189 "contact_line_search_allowed_lambda_cuts",
190 "Solver line search");
191 params.addParamNamesToGroup("skip_exception_check", "Advanced");
192
193 return params;
194}
195
198 _num_grid_steps(cast_int<unsigned int>(getParam<unsigned int>("num_grids") - 1))
199{
200 if (_moose_line_searches.find(getParam<MooseEnum>("line_search").operator std::string()) !=
203
204 auto set_solver_params = [this, &ex](const SolverSystem & sys)
205 {
206 const auto prefix = sys.prefix();
207 if (dynamic_cast<const LinearSystem *>(&sys))
211
212 // Set solver parameter prefix and system number
213 auto & solver_params = _problem.solverParams(sys.number());
214 solver_params._prefix = prefix;
215 solver_params._solver_sys_num = sys.number();
216 };
217
218 // Extract and store PETSc related settings on FEProblemBase
219 for (const auto * const sys : _systems)
220 set_solver_params(*sys);
221
222 // Set linear solve parameters in the equation system
223 // Nonlinear solve parameters are added in the DefaultNonlinearConvergence
224 EquationSystems & es = _problem.es();
225 es.parameters.set<Real>("linear solver tolerance") = getParam<Real>("l_tol");
226 es.parameters.set<Real>("linear solver absolute tolerance") = getParam<Real>("l_abs_tol");
227 es.parameters.set<unsigned int>("linear solver maximum iterations") =
228 getParam<unsigned int>("l_max_its");
229 es.parameters.set<bool>("reuse preconditioner") = getParam<bool>("reuse_preconditioner");
230 es.parameters.set<unsigned int>("reuse preconditioner maximum linear iterations") =
231 getParam<unsigned int>("reuse_preconditioner_max_linear_its");
232
233 // Transfer to the Problem misc nonlinear solve optimization parameters
234 _problem.setSNESMFReuseBase(getParam<bool>("snesmf_reuse_base"),
235 _pars.isParamSetByUser("snesmf_reuse_base"));
236 _problem.skipExceptionCheck(getParam<bool>("skip_exception_check"));
237
238 if (isParamValid("nonlinear_convergence"))
239 {
241 mooseError("The selected problem does not allow 'nonlinear_convergence' to be set.");
243 getParam<std::vector<ConvergenceName>>("nonlinear_convergence"));
244 }
245 else
247 if (isParamValid("linear_convergence"))
248 {
249 if (_problem.numLinearSystems() == 0)
251 "linear_convergence",
252 "Setting 'linear_convergence' is currently only possible for solving linear systems");
254 getParam<std::vector<ConvergenceName>>("linear_convergence"));
255 }
256
257 // Check whether the user has explicitly requested automatic scaling and is using a solve type
258 // without a matrix. If so, then we warn them
259 if ((_pars.isParamSetByUser("automatic_scaling") && getParam<bool>("automatic_scaling")) &&
260 std::all_of(_systems.begin(),
261 _systems.end(),
262 [this](const auto & solver_sys)
263 { return _problem.solverParams(solver_sys->number())._type == Moose::ST_JFNK; }))
264 {
265 paramWarning("automatic_scaling",
266 "Automatic scaling isn't implemented for the case where you do not have a "
267 "preconditioning matrix. No scaling will be applied");
269 }
270 else
271 // Check to see whether automatic_scaling has been specified anywhere, including at the
272 // application level. No matter what: if we don't have a matrix, we don't do scaling
274 isParamValid("automatic_scaling")
275 ? getParam<bool>("automatic_scaling")
277 std::any_of(_systems.begin(),
278 _systems.end(),
279 [this](const auto & solver_sys)
280 {
281 return _problem.solverParams(solver_sys->number())._type !=
282 Moose::ST_JFNK;
283 })));
284
285 if (!_using_multi_sys_fp_iterations && isParamValid("multi_system_fixed_point_convergence"))
286 paramError("multi_system_fixed_point_convergence",
287 "Cannot set a convergence object for multi-system fixed point iterations if "
288 "'multi_system_fixed_point' is set to false");
289 if (_using_multi_sys_fp_iterations && !isParamValid("multi_system_fixed_point_convergence"))
290 paramError("multi_system_fixed_point_convergence",
291 "Must set a convergence object for multi-system fixed point iterations if using "
292 "multi-system fixed point iterations");
293
294 // Set the same parameters to every nonlinear system by default
295 int i_nl_sys = -1;
296 for (const auto i_sys : index_range(_systems))
297 {
298 auto nl_ptr = dynamic_cast<NonlinearSystemBase *>(_systems[i_sys]);
299 // Linear systems have very different parameters at the moment
300 if (!nl_ptr)
301 continue;
302 auto & nl = *nl_ptr;
303 i_nl_sys++;
304
305 nl.setPreSMOResidual(getParam<bool>("use_pre_SMO_residual"));
306
307 const auto res_and_jac =
308 getParamFromNonlinearSystemVectorParam<bool>("residual_and_jacobian_together", i_nl_sys);
309 if (res_and_jac)
310 nl.residualAndJacobianTogether();
311
312 // Automatic scaling parameters
313 nl.computeScalingOnce(
314 getParamFromNonlinearSystemVectorParam<bool>("compute_scaling_once", i_nl_sys));
315 nl.autoScalingParam(
316 getParamFromNonlinearSystemVectorParam<Real>("resid_vs_jac_scaling_param", i_nl_sys));
317 nl.offDiagonalsInAutoScaling(
318 getParamFromNonlinearSystemVectorParam<bool>("off_diagonals_in_auto_scaling", i_nl_sys));
319 if (isParamValid("scaling_group_variables"))
320 nl.scalingGroupVariables(
321 getParamFromNonlinearSystemVectorParam<std::vector<std::vector<std::string>>>(
322 "scaling_group_variables", i_nl_sys));
323 if (isParamValid("ignore_variables_for_autoscaling"))
324 {
325 // Before setting ignore_variables_for_autoscaling, check that they are not present in
326 // scaling_group_variables
327 if (isParamValid("scaling_group_variables"))
328 {
329 const auto & ignore_variables_for_autoscaling =
330 getParamFromNonlinearSystemVectorParam<std::vector<std::string>>(
331 "ignore_variables_for_autoscaling", i_nl_sys);
332 const auto & scaling_group_variables =
333 getParamFromNonlinearSystemVectorParam<std::vector<std::vector<std::string>>>(
334 "scaling_group_variables", i_nl_sys);
335 for (const auto & group : scaling_group_variables)
336 for (const auto & var_name : group)
337 if (std::find(ignore_variables_for_autoscaling.begin(),
338 ignore_variables_for_autoscaling.end(),
339 var_name) != ignore_variables_for_autoscaling.end())
340 paramError("ignore_variables_for_autoscaling",
341 "Variables cannot be in a scaling grouping and also be ignored");
342 }
343 nl.ignoreVariablesForAutoscaling(
344 getParamFromNonlinearSystemVectorParam<std::vector<std::string>>(
345 "ignore_variables_for_autoscaling", i_nl_sys));
346 }
347 }
348
349 // Multi-grid options
351}
352
353template <typename T>
354T
356 unsigned int index) const
357{
358 const auto & param_vec = getParam<std::vector<T>>(param_name);
359 if (index > _num_nl_systems)
360 paramError(param_name,
361 "Vector parameter is requested at index (" + std::to_string(index) +
362 ") which is larger than number of nonlinear systems (" +
363 std::to_string(_num_nl_systems) + ").");
364 if (param_vec.size() == 0)
366 param_name,
367 "This parameter was passed to a routine which cannot handle empty vector parameters");
368 if (param_vec.size() != 1 && param_vec.size() != _num_nl_systems)
369 paramError(param_name,
370 "Vector parameter size (" + std::to_string(param_vec.size()) +
371 ") is different than the number of nonlinear systems (" +
372 std::to_string(_num_nl_systems) + ").");
373
374 // User passed only one parameter, assume it applies to all nonlinear systems
375 if (param_vec.size() == 1)
376 return param_vec[0];
377 else
378 return param_vec[index];
379}
380
381void
383{
386 // Keep track of the solution warnings from the setup
387 // before a count reset at the beginning of the time step
388 if (!_app.isRecovering())
389 {
393 }
394
395 // Solution and aux systems may require copying back states due to 2 reasons:
396 // 1. The need for an older state was indicated to the problem.
397 // 2. Fixed point relaxation is to be performed.
398 for (const auto i : index_range(_systems))
399 {
400 const auto sys_num = _systems[i]->number();
403
405 {
406 _systems[i]->needSolutionState(
409 }
410 }
412 {
416 }
417}
418
419void
421{
422 // nonlinear
423 const auto conv_names = _problem.getNonlinearConvergenceNames();
424 for (const auto & conv_name : conv_names)
425 {
426 auto & conv = _problem.getConvergence(conv_name);
428 }
429
430 // linear
431 if (isParamValid("linear_convergence"))
432 {
433 const auto conv_names = getParam<std::vector<ConvergenceName>>("linear_convergence");
434 for (const auto & conv_name : conv_names)
435 {
436 auto & conv = _problem.getConvergence(conv_name);
438 }
439 }
440
441 // multisystem fixed point
442 if (isParamValid("multi_system_fixed_point_convergence"))
443 {
445 &_problem.getConvergence(getParam<ConvergenceName>("multi_system_fixed_point_convergence"));
448 }
449}
450
451bool
453{
454 // Outer loop for multi-grid convergence
455 bool converged = false;
456 unsigned int fp_iter = 0;
457
458 for (MooseIndex(_num_grid_steps) grid_step = 0; grid_step <= _num_grid_steps; ++grid_step)
459 {
460 // Multi-system fixed point loop
461 fp_iter = 0;
462 converged = false;
463 while (!converged)
464 {
466 _console << COLOR_MAGENTA << "Multi-system fixed point iteration " << fp_iter << ":"
467 << COLOR_DEFAULT << "\n"
468 << std::endl;
469
470 // Copy back systems as needed/requested
471 for (auto * sys : _systems_to_copy_back_multi_sys_fp)
472 sys->copyPreviousSolutions(Moose::SolutionIterationType::MultiSystemFixedPoint);
473
474 // Loop over each system
475 for (const auto sys_i : index_range(_systems))
476 {
477 auto * const sys = _systems[sys_i];
478 const bool is_nonlinear = (dynamic_cast<NonlinearSystemBase *>(sys) != nullptr);
479
480 // Call solve on the problem for that system
481 if (is_nonlinear)
482 _problem.solve(sys->number());
483 else
484 {
485 const auto linear_sys_number =
486 cast_int<unsigned int>(sys->number() - _problem.numNonlinearSystems());
487 _problem.solveLinearSystem(linear_sys_number, &_problem.getPetscOptions());
488 }
489
490 // Check convergence
491 const auto solve_name =
492 _systems.size() == 1 ? " Solve" : "System " + sys->name() + ": Solve";
493 if (_problem.shouldSolve())
494 {
495 if (_problem.converged(sys->number()))
496 {
498 sys->applyFixedPointRelaxation(_multi_sys_fp_relax_factors[sys_i],
500 _console << COLOR_GREEN << solve_name << " Converged!" << COLOR_DEFAULT << "\n"
501 << std::endl;
502 }
503 else
504 {
505 _console << COLOR_RED << solve_name << " Did NOT Converge!" << COLOR_DEFAULT << "\n"
506 << std::endl;
507 return false;
508 }
509 }
510 else
511 _console << COLOR_GREEN << solve_name << " Skipped!" << COLOR_DEFAULT << "\n"
512 << std::endl;
513
514 if (!is_nonlinear)
515 {
516 const auto linear_sys_number =
517 cast_int<unsigned int>(sys->number() - _problem.numNonlinearSystems());
518 auto & linear_sys = _problem.getLinearSystem(linear_sys_number);
519
520 // This is for postprocessing purposes in case none of the objects request the gradients.
521 // TODO: Somehow collect information if the postprocessors need gradients and if nothing
522 // needs this, just skip it
523 linear_sys.computeGradients();
524 }
525 }
526
529
530 // Assess convergence of the multi-system fixed point iteration
532 converged = true;
533 else
534 {
535 // checkConvergence expects the number of iterations performed, not the iteration index:
536 const auto n_fp_iter = fp_iter + 1;
537 const auto convergence_status = _multi_sys_fp_convergence->checkConvergence(n_fp_iter);
538 converged = convergence_status == Convergence::MooseConvergenceStatus::CONVERGED;
539 if (convergence_status == Convergence::MooseConvergenceStatus::DIVERGED)
540 break;
541 }
542 fp_iter++;
543 }
544
545 if (grid_step != _num_grid_steps)
547 }
548
549 return converged;
550}
InputParameters emptyInputParameters()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
const ExecFlagType EXEC_MULTISYSTEM_FIXED_POINT_ITERATION_END
Definition Moose.C:46
void ErrorVector unsigned int
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter)=0
Returns convergence status.
virtual void checkIterationType(IterationType) const
Perform checks related to the iteration type.
Definition Convergence.h:48
Executioners are objects that do the actual work of solving your problem.
Definition Executioner.h:37
void numGridSteps(unsigned int num_grid_steps)
Set the number of steps in a grid sequences.
const std::vector< ConvergenceName > & getNonlinearConvergenceNames() const
Gets the nonlinear system convergence object name(s).
void setLinearConvergenceNames(const std::vector< ConvergenceName > &convergence_names)
Sets the linear convergence object name(s) if there is one.
virtual std::size_t numLinearSystems() const override
void setNeedToAddDefaultNonlinearConvergence()
Sets _need_to_add_default_nonlinear_convergence to true.
virtual libMesh::EquationSystems & es() override
virtual void addLineSearch(const InputParameters &)
add a MOOSE line search
void setNonlinearConvergenceNames(const std::vector< ConvergenceName > &convergence_names)
Sets the nonlinear convergence object name(s) if there is one.
virtual std::size_t numNonlinearSystems() const override
bool shouldSolve() const
void skipExceptionCheck(bool skip_exception_check)
Set a flag that indicates if we want to skip exception and stop solve.
void needsPreviousMultiSystemFixedPointIterationAuxiliary(bool state)
Set a flag that indicates that user requires values for the previous multi-system fixed point iterate...
LinearSystem & getLinearSystem(unsigned int sys_num)
Get non-constant reference to a linear system.
virtual void solveLinearSystem(const unsigned int linear_sys_num, const Moose::PetscSupport::PetscOptions *po=nullptr)
Build and solve a linear system.
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
virtual Convergence & getConvergence(const std::string &name, const THREAD_ID tid=0) const
Gets a Convergence object.
void setSNESMFReuseBase(bool reuse, bool set_by_user)
If or not to reuse the base vector for matrix-free calculation.
virtual void solve(const unsigned int nl_sys_num)
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
void automaticScaling(bool automatic_scaling) override
Automatic scaling setter.
virtual bool onlyAllowDefaultNonlinearConvergence() const
Returns true if an error will result if the user supplies 'nonlinear_convergence'.
void needsPreviousMultiSystemFixedPointIterationSolution(bool needed, const unsigned int solver_sys_num)
Set a flag that indicates that user requires values for the previous multi-system fixed point iterate...
virtual void outputStep(ExecFlagType type)
Output the current step.
void uniformRefine()
uniformly refine the problem mesh(es).
static InputParameters feProblemDefaultConvergenceParams()
T getParamFromNonlinearSystemVectorParam(const std::string &param_name, unsigned int index) const
Helper routine to get the nonlinear system parameter at the right index.
static const std::set< std::string > & mooseLineSearches()
void convergenceSetup()
Performs setup related to Convergence objects.
const unsigned int _num_grid_steps
The number of steps to perform in a grid sequencing algorithm.
static std::set< std::string > const _moose_line_searches
Moose provided line searches.
FEProblemSolve(Executioner &ex)
virtual void initialSetup() override
Method that should be executed once, before any solve calls.
virtual bool solve() override
Picard solve the FEProblem.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Linear system to be solved.
void computeGradients()
Compute and store raw and requested limited Green-Gauss gradients for linear FV variables.
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition MooseApp.C:1669
bool defaultAutomaticScaling() const
Whether to enable automatic scaling by default.
Definition MooseApp.h:1055
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition MooseApp.h:185
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
const InputParameters & _pars
The object's parameters.
Definition MooseBase.h:384
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition MooseBase.h:87
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
A solve object for use when wanting to solve multiple systems.
const bool _using_multi_sys_fp_iterations
Whether we are using fixed point iterations for multi-system.
Convergence * _multi_sys_fp_convergence
Convergence object to assess the convergence of the multi-system fixed point iteration.
std::set< SystemBase * > _systems_to_copy_back_multi_sys_fp
Systems that should save their previous multi-system fixed point solutions.
unsigned int _num_nl_systems
Number of nonlinear systems.
std::vector< Real > _multi_sys_fp_relax_factors
Per-system relaxation factors for multi-system fixed point iterations (expanded to match the number/o...
std::vector< bool > _perform_multi_sys_fp_relaxation
Whether to perform relaxation for each solve system, indexed over solve system.
static InputParameters validParams()
std::vector< SolverSystem * > _systems
Vector of pointers to the systems.
Nonlinear system to be solved.
void setPreSMOResidual(bool use)
Set whether to evaluate the pre-SMO residual and use it in the subsequent relative convergence checks...
void paramWarning(const std::string &param, Args... args) const
void accumulateIterationIntoTimeStepOccurences()
Pass the number of solution invalid occurrences from current iteration to cumulative counters.
void accumulateTimeStepIntoTotalOccurences(const unsigned int timestep_index)
Pass the number of solution invalid occurrences from current timestep to cumulative timestep counter ...
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
FEProblemBase & _problem
Reference to FEProblem.
Definition SolveObject.h:47
virtual void initialSetup()
Method that should be executed once, before any solve calls.
Definition SolveObject.h:32
AuxiliarySystem & _aux
Reference to auxiliary system for faster access.
Definition SolveObject.h:57
std::string _prefix
virtual bool converged(const unsigned int sys_num)
Eventually we want to convert this virtual over to taking a solver system number argument.
Definition SubProblem.h:113
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
Registers that the solution state state is needed.
NumericVector< Number > & solution()
Definition SystemBase.h:203
ParallelType type() const
T & set(const std::string &)
void setConvergedReasonFlags(FEProblemBase &fe_problem, std::string prefix)
Set flags that will instruct the user on the reason their simulation diverged from PETSc's perspectiv...
void dontAddCommonSNESOptions(FEProblemBase &fe_problem)
Function to ensure that common SNES options are not added to the PetscOptions storage object to be la...
InputParameters getPetscValidParams()
Returns the PETSc options that are common between Executioners and Preconditioners.
std::set< std::string > getPetscValidLineSearches()
Returns the valid petsc line search options as a set of strings.
void storePetscOptions(FEProblemBase &fe_problem, const std::string &prefix, const ParallelParamObject &param_object)
Stores the PETSc options supplied from the parameter object on the problem.
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64