www.mooseframework.org
Executioner.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 // Moose includes
11 #include "Executioner.h"
12 
13 #include "MooseApp.h"
14 #include "MooseMesh.h"
15 #include "FEProblem.h"
16 #include "NonlinearSystem.h"
17 #include "SlepcSupport.h"
18 
19 // C++ includes
20 #include <vector>
21 #include <limits>
22 
23 template <>
26 {
28  params += validParams<FEProblemSolve>();
29  params += validParams<PicardSolve>();
30 
31  params.addDeprecatedParam<FileNameNoExtension>(
32  "restart_file_base",
33  "",
34  "File base name used for restart",
35  "Please use \"Problem/restart_file_base\" instead");
36 
37  params.registerBase("Executioner");
38 
39  params.addParamNamesToGroup("restart_file_base", "Restart");
40 
41  return params;
42 }
43 
45  : MooseObject(parameters),
46  UserObjectInterface(this),
48  Restartable(this, "Executioners"),
49  PerfGraphInterface(this),
50  _fe_problem(*getCheckedPointerParam<FEProblemBase *>(
51  "_fe_problem_base", "This might happen if you don't have a mesh")),
52  _feproblem_solve(this),
53  _picard_solve(this),
54  _restart_file_base(getParam<FileNameNoExtension>("restart_file_base"))
55 {
56  if (!_restart_file_base.empty())
58 }
59 
60 Problem &
62 {
63  mooseDoOnce(mooseWarning("This method is deprecated, use feProblem() instead"));
64  return _fe_problem;
65 }
66 
69 {
70  return _fe_problem;
71 }
72 
73 void
74 Executioner::addAttributeReporter(const std::string & name,
75  Real & attribute,
76  const std::string execute_on)
77 {
78  FEProblemBase * problem = getCheckedPointerParam<FEProblemBase *>(
79  "_fe_problem_base",
80  "Failed to retrieve FEProblemBase when adding a attribute reporter in Executioner");
81  InputParameters params = _app.getFactory().getValidParams("ExecutionerAttributeReporter");
82  params.set<Real *>("value") = &attribute;
83  if (!execute_on.empty())
84  params.set<ExecFlagEnum>("execute_on") = execute_on;
85  problem->addPostprocessor("ExecutionerAttributeReporter", name, params);
86 }
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
A class for creating restricted objects.
Definition: Restartable.h:29
virtual void addAttributeReporter(const std::string &name, Real &attribute, const std::string execute_on="")
Adds a postprocessor to report a Real class attribute.
Definition: Executioner.C:74
Executioner(const InputParameters &parameters)
Constructor.
Definition: Executioner.C:44
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void mooseWarning(Args &&... args) const
Definition: MooseObject.h:155
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
Definition: Factory.C:67
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Class that hold the whole problem being solved.
Definition: Problem.h:24
InputParameters validParams< Executioner >()
Definition: Executioner.C:25
FEProblemBase & feProblem()
Return a reference to this Executioner&#39;s FEProblemBase instance.
Definition: Executioner.C:68
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Factory & getFactory()
Retrieve the Factory associated with this App.
Definition: MooseApp.h:286
std::string _restart_file_base
Definition: Executioner.h:133
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
InputParameters validParams< PicardSolve >()
Definition: PicardSolve.C:22
virtual Problem & problem()
Deprecated: Return a reference to this Executioner&#39;s Problem instance.
Definition: Executioner.C:61
Interface for objects that need to use UserObjects.
Interface for objects that needs transient capabilities.
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
void setRestartFile(const std::string &file_name)
Communicate to the Resurector the name of the restart filer.
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:177
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
InputParameters validParams< FEProblemSolve >()
Interface class for classes which interact with Postprocessors.
FEProblemBase & _fe_problem
Definition: Executioner.h:127