www.mooseframework.org
Steady.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
16 #include "Steady.h"
17 #include "FEProblem.h"
18 #include "Factory.h"
19 #include "MooseApp.h"
20 #include "NonlinearSystem.h"
21 
22 #include "libmesh/equation_systems.h"
23 
24 template <>
27 {
28  return validParams<Executioner>();
29 }
30 
31 Steady::Steady(const InputParameters & parameters)
32  : Executioner(parameters),
33  _problem(_fe_problem),
34  _time_step(_problem.timeStep()),
35  _time(_problem.time())
36 {
38 
39  if (!_restart_file_base.empty())
41 }
42 
43 void
45 {
46  if (_app.isRecovering())
47  {
48  _console << "\nCannot recover steady solves!\nExiting...\n" << std::endl;
49  return;
50  }
51 
54 
56 }
57 
58 void
60 {
61  if (_app.isRecovering())
62  return;
63 
64  preExecute();
65 
67 
68  // first step in any steady state solve is always 1 (preserving backwards compatibility)
69  _time_step = 1;
70  _time = _time_step; // need to keep _time in sync with _time_step to get correct output
71 
72 #ifdef LIBMESH_ENABLE_AMR
73 
74  // Define the refinement loop
75  unsigned int steps = _problem.adaptivity().getSteps();
76  for (unsigned int r_step = 0; r_step <= steps; r_step++)
77  {
78 #endif // LIBMESH_ENABLE_AMR
79  preSolve();
83 
84  // Update warehouse active objects
86 
87  _problem.solve();
88  postSolve();
89 
90  if (!lastSolveConverged())
91  {
92  _console << "Aborting as solve did not converge\n";
93  break;
94  }
95 
98 
101 
103 
104 #ifdef LIBMESH_ENABLE_AMR
105  if (r_step != steps)
106  {
108  }
109 
110  _time_step++;
111  _time = _time_step; // need to keep _time in sync with _time_step to get correct output
112  }
113 #endif
114 
116 
117  postExecute();
118 }
119 
120 void
122 {
123  // check to make sure that we don't have any time kernels in this simulation (Steady State)
125  mooseError("You have specified time kernels in your steady state simulation");
126 }
NonlinearSystemBase & getNonlinearSystemBase()
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:607
Object is evaluated only once at the beginning of the simulation.
Definition: MooseTypes.h:94
virtual void postExecute()
Override this for actions that should take place after execution.
Definition: Executioner.C:140
virtual void computeMarkers()
void updateActiveObjects()
Update the active objects in the warehouses.
void setDecomposition(const std::vector< std::string > &decomposition)
If called with a single string, it is used as the name of a the top-level decomposition split...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void onTimestepEnd() override
Object is evaluated at the end of every time step.
Definition: MooseTypes.h:100
virtual void timestepSetup()
std::string _restart_file_base
Definition: Executioner.h:133
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep...
void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
unsigned int getSteps() const
Pull out the number of steps previously set by calling init()
Definition: Adaptivity.h:101
virtual void computeIndicators()
Real & _time
Definition: Steady.h:58
InputParameters validParams< Executioner >()
Definition: Executioner.C:30
virtual void adaptMesh()
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:41
int & _time_step
Definition: Steady.h:57
virtual void preExecute()
Override this for actions that should take place before execution.
Definition: Executioner.C:135
std::vector< std::string > _splitting
Definition: Executioner.h:136
virtual bool lastSolveConverged()
Whether or not the last solve converged.
Definition: Executioner.C:174
virtual void preSolve()
Override this for actions that should take place before execution.
Definition: Executioner.C:145
InputParameters validParams< Steady >()
Definition: Steady.C:26
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:108
FEProblemBase & _problem
Definition: Steady.h:55
virtual void checkIntegrity()
Definition: Steady.C:121
Object is evaluated at the end of the simulations (output only)
Definition: MooseTypes.h:104
Object is evaluated at the beginning of every time step.
Definition: MooseTypes.h:102
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
Definition: Steady.C:59
virtual void initialSetup()
virtual void init() override
Initialize the executioner.
Definition: Steady.C:44
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual void solve() override
virtual void postSolve()
Override this for actions that should take place after execution.
Definition: Executioner.C:150
Adaptivity & adaptivity()
Steady(const InputParameters &parameters)
Constructor.
Definition: Steady.C:31
virtual void outputStep(ExecFlagType type)
Output the current step.