https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Executioner.h
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#pragma once
11
12#include "MooseObject.h"
13#include "UserObjectInterface.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
26class Problem;
30class Executioner : public MooseObject,
31 private Reporter, // see addAttributeReporter
32 private ReporterInterface, // see addAttributeReporter
35 public Restartable,
37{
38public:
45
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::vector<std::string> getTimeIntegratorNames() const { return {}; }
112
118
122 virtual bool lastSolveConverged() const = 0;
123
125
130 const bool & verbose() const { return _verbose; }
131
136 static MooseEnum iterationMethods() { return MooseEnum("picard secant steffensen", "picard"); }
137
142 void registerSolveObject(const SolveObject & so) { _solve_objects.push_back(&so); }
143
147 template <class T>
148 bool hasSolveObject() const
149 {
150 for (const auto & so : _solve_objects)
151 {
152 const T * tso = dynamic_cast<const T *>(so);
153 if (tso)
154 return true;
155 }
156 return false;
157 }
158
159protected:
166 virtual PostprocessorValue & addAttributeReporter(const std::string & name,
167 Real initial_value = 0);
168
170
172 std::unique_ptr<FixedPointSolve> _fixed_point_solve;
173
174 // Restart
176
178 const bool & _verbose;
179
180private:
182 std::vector<const SolveObject *> _solve_objects;
183};
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
Executioners are objects that do the actual work of solving your problem.
Definition Executioner.h:37
static InputParameters validParams()
Definition Executioner.C:26
virtual Problem & problem()
Deprecated: Return a reference to this Executioner's Problem instance.
virtual std::string getTimeStepperName() const
The name of the TimeStepper This is an empty string for non-Transient executioners.
virtual void preProblemInit()
Perform initializations during executing actions right before init_problem task.
Definition Executioner.h:57
virtual void execute()=0
Pure virtual execute function MUST be overridden by children classes.
virtual std::vector< std::string > getTimeIntegratorNames() const
The name of the TimeIntegrator This is an empty string for non-Transient executioners.
void registerSolveObject(const SolveObject &so)
Register a solve object to the executioner so that we can check whether a solve object has been built...
virtual void preExecute()
Override this for actions that should take place before execution.
Definition Executioner.h:73
FEProblemBase & _fe_problem
virtual void postExecute()
Override this for actions that should take place after execution.
Definition Executioner.h:78
virtual ~Executioner()
Definition Executioner.h:50
virtual void postSolve()
Override this for actions that should take place after execution, called by FixedPointSolve.
Definition Executioner.h:88
virtual PostprocessorValue & addAttributeReporter(const std::string &name, Real initial_value=0)
Adds a postprocessor that the executioner can directly assign values to.
static MooseEnum iterationMethods()
Return supported iteration methods that can work with MultiApps on timestep_begin and timestep_end.
bool hasSolveObject() const
Whether a solve object in a certain type has been built by the executioner.
std::unique_ptr< FixedPointSolve > _fixed_point_solve
virtual void parentOutputPositionChanged()
Can be used by subclasses to call parentOutputPositionChanged() on the underlying FEProblemBase.
std::string _restart_file_base
virtual bool lastSolveConverged() const =0
Whether or not the last solve converged.
virtual void preSolve()
Override this for actions that should take place before execution, called by FixedPointSolve.
Definition Executioner.h:83
FixedPointSolve & fixedPointSolve()
MooseEnum _iteration_method
FEProblemBase & feProblem()
Return a reference to this Executioner's FEProblemBase instance.
std::vector< const SolveObject * > _solve_objects
All solve objects built by this executioner.
const bool & verbose() const
Get the verbose output flag.
virtual void init()
Initialize the executioner.
Definition Executioner.h:62
const bool & _verbose
True if printing out additional information.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
Interface for objects interacting with the PerfGraph.
Interface class for classes which interact with Postprocessors.
Class that hold the whole problem being solved.
Definition Problem.h:20
Interface to allow object to consume Reporter values.
Reporter objects allow for the declaration of arbitrary data types that are aggregate values for a si...
Definition Reporter.h:48
A class for creating restricted objects.
Definition Restartable.h:29
Interface for objects that need to use UserObjects.