www.mooseframework.org
Executioner.h
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "UserObjectInterface.h"
14 #include "PostprocessorInterface.h"
15 #include "Restartable.h"
16 #include "PerfGraphInterface.h"
17 #include "FEProblemSolve.h"
18 #include "FixedPointSolve.h"
19 #include "PicardSolve.h"
20 #include "Reporter.h"
21 #include "ReporterInterface.h"
22 
23 // System includes
24 #include <string>
25 
26 class Problem;
30 class Executioner : public MooseObject,
31  private Reporter, // see addAttributeReporter
32  private ReporterInterface, // see addAttributeReporter
33  public UserObjectInterface,
35  public Restartable,
36  public PerfGraphInterface
37 {
38 public:
45 
48  Executioner(const InputParameters & parameters, bool);
49 
50  virtual ~Executioner() {}
51 
53 
57  virtual void preProblemInit() {}
58 
62  virtual void init() {}
63 
68  virtual void execute() = 0;
69 
73  virtual void preExecute() {}
74 
78  virtual void postExecute() {}
79 
83  virtual void preSolve() {}
84 
88  virtual void postSolve() {}
89 
94  virtual Problem & problem();
95 
100 
105  virtual std::string getTimeStepperName() const { return std::string(); }
106 
111  virtual std::string getTimeIntegratorName() const { return std::string(); }
112 
117  virtual void parentOutputPositionChanged() {}
118 
122  virtual bool lastSolveConverged() const = 0;
123 
126  {
127  mooseDeprecated("picardSolve() is deprecated. Use fixedPointSolve() instead.");
128  if (_iteration_method == "picard")
129  return *(dynamic_cast<PicardSolve *>(_fixed_point_solve.get()));
130  else
131  mooseError("Cannot return a PicardSolve if the iteration method is not Picard.");
132  }
133 
135 
137  virtual bool augmentedPicardConvergenceCheck() const
138  {
140  "augmentedPicardConvergenceCheck() is deprecated. Use augmentedCouplingConvergenceCheck.");
141  return false;
142  }
143 
148  const bool & verbose() const { return _verbose; }
149 
154  static MooseEnum iterationMethods() { return MooseEnum("picard secant steffensen", "picard"); }
155 
156 protected:
163  virtual PostprocessorValue & addAttributeReporter(const std::string & name,
164  Real initial_value = 0);
165 
167 
169  std::unique_ptr<FixedPointSolve> _fixed_point_solve;
170 
171  // Restart
172  std::string _restart_file_base;
173 
175  const bool & _verbose;
176 };
virtual PostprocessorValue & addAttributeReporter(const std::string &name, Real initial_value=0)
Adds a postprocessor that the executioner can directly assign values to.
Definition: Executioner.C:118
virtual void preExecute()
Override this for actions that should take place before execution.
Definition: Executioner.h:73
const bool & verbose() const
Get the verbose output flag.
Definition: Executioner.h:148
static MooseEnum iterationMethods()
Return supported iteration methods that can work with MultiApps on timestep_begin and timestep_end...
Definition: Executioner.h:154
A class for creating restricted objects.
Definition: Restartable.h:28
Executioner(const InputParameters &parameters)
Constructor.
Definition: Executioner.C:53
PicardSolve & picardSolve()
Return underlying PicardSolve object.
Definition: Executioner.h:125
void mooseDeprecated(Args &&... args) const
virtual void init()
Initialize the executioner.
Definition: Executioner.h:62
virtual void preSolve()
Override this for actions that should take place before execution, called by PicardSolve.
Definition: Executioner.h:83
Class that hold the whole problem being solved.
Definition: Problem.h:19
FEProblemBase & feProblem()
Return a reference to this Executioner&#39;s FEProblemBase instance.
Definition: Executioner.C:112
const bool & _verbose
True if printing out additional information.
Definition: Executioner.h:175
virtual bool augmentedPicardConvergenceCheck() const
Augmented Picard convergence check to be called by PicardSolve and can be overridden by derived execu...
Definition: Executioner.h:137
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void parentOutputPositionChanged()
Can be used by subclasses to call parentOutputPositionChanged() on the underlying FEProblemBase...
Definition: Executioner.h:117
MooseEnum _iteration_method
Definition: Executioner.h:168
Reporter objects allow for the declaration of arbitrary data types that are aggregate values for a si...
Definition: Reporter.h:47
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:56
std::string _restart_file_base
Definition: Executioner.h:172
virtual void execute()=0
Pure virtual execute function MUST be overridden by children classes.
static InputParameters validParams()
Definition: Executioner.C:26
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
Interface to allow object to consume Reporter values.
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:191
virtual void postExecute()
Override this for actions that should take place after execution.
Definition: Executioner.h:78
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:30
virtual Problem & problem()
Deprecated: Return a reference to this Executioner&#39;s Problem instance.
Definition: Executioner.C:105
Interface for objects that need to use UserObjects.
Interface for objects interacting with the PerfGraph.
virtual void preProblemInit()
Perform initializations during executing actions right before init_problem task.
Definition: Executioner.h:57
virtual void postSolve()
Override this for actions that should take place after execution, called by PicardSolve.
Definition: Executioner.h:88
FixedPointSolve & fixedPointSolve()
Definition: Executioner.h:134
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const InputParameters & parameters() const
Get the parameters of the object.
virtual ~Executioner()
Definition: Executioner.h:50
virtual bool lastSolveConverged() const =0
Whether or not the last solve converged.
virtual std::string getTimeStepperName() const
The name of the TimeStepper This is an empty string for non-Transient executioners.
Definition: Executioner.h:105
std::unique_ptr< FixedPointSolve > _fixed_point_solve
Definition: Executioner.h:169
Interface class for classes which interact with Postprocessors.
virtual std::string getTimeIntegratorName() const
The name of the TimeIntegrator This is an empty string for non-Transient executioners.
Definition: Executioner.h:111
FEProblemBase & _fe_problem
Definition: Executioner.h:166