www.mooseframework.org
Steady.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 "Steady.h"
12 #include "FEProblem.h"
13 #include "Factory.h"
14 #include "MooseApp.h"
15 #include "NonlinearSystem.h"
16 
17 #include "libmesh/equation_systems.h"
18 
19 registerMooseObject("MooseApp", Steady);
20 
21 template <>
24 {
26  params.addClassDescription("Executioner for steady-state simulations.");
27  params.addParam<Real>("time", 0.0, "System time");
28  return params;
29 }
30 
31 Steady::Steady(const InputParameters & parameters)
32  : Executioner(parameters),
33  _problem(_fe_problem),
34  _system_time(getParam<Real>("time")),
35  _time_step(_problem.timeStep()),
36  _time(_problem.time()),
37  _final_timer(registerTimedSection("final", 1))
38 {
40 
42 }
43 
44 void
46 {
47  if (_app.isRecovering())
48  {
49  _console << "\nCannot recover steady solves!\nExiting...\n" << std::endl;
50  return;
51  }
52 
56 }
57 
58 void
60 {
61  if (_app.isRecovering())
62  return;
63 
64  _time_step = 0;
65  _time = _time_step;
68 
69  preExecute();
70 
72 
73  // first step in any steady state solve is always 1 (preserving backwards compatibility)
74  _time_step = 1;
75 
76 #ifdef LIBMESH_ENABLE_AMR
77 
78  // Define the refinement loop
79  unsigned int steps = _problem.adaptivity().getSteps();
80  for (unsigned int r_step = 0; r_step <= steps; r_step++)
81  {
82 #endif // LIBMESH_ENABLE_AMR
84 
86 
87  if (!lastSolveConverged())
88  {
89  _console << "Aborting as solve did not converge\n";
90  break;
91  }
92 
95 
96  // need to keep _time in sync with _time_step to get correct output
97  _time = _time_step;
100 
101 #ifdef LIBMESH_ENABLE_AMR
102  if (r_step != steps)
103  {
105  }
106 
107  _time_step++;
108  }
109 #endif
110 
111  {
112  TIME_SECTION(_final_timer)
114  _time = _time_step;
117  }
118 
119  postExecute();
120 }
121 
122 void
124 {
125  // check to make sure that we don't have any time kernels in this simulation (Steady State)
127  mooseError("You have specified time kernels in your steady state simulation");
128 }
virtual void preExecute()
Override this for actions that should take place before execution.
Definition: Executioner.h:62
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
Definition: Steady.h:48
NonlinearSystemBase & getNonlinearSystemBase()
bool _last_solve_converged
Definition: Steady.h:60
FEProblemSolve _feproblem_solve
Definition: Executioner.h:129
virtual void computeMarkers()
Steady executioners usually only call "solve()" on the NonlinearSystem once.
Definition: Steady.h:31
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const ExecFlagType EXEC_TIMESTEP_END
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
registerMooseObject("MooseApp", Steady)
virtual void setInnerSolve(SolveObject &solve)
Set the inner solve object wrapped by this object.
Definition: SolveObject.h:35
virtual void timestepSetup()
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep...
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
virtual bool solve() override
Picard solve the FEProblem.
Definition: PicardSolve.C:114
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
virtual void computeIndicators()
virtual void postExecute()
Override this for actions that should take place after execution.
Definition: Executioner.h:67
Real & _time
Definition: Steady.h:55
InputParameters validParams< Executioner >()
Definition: Executioner.C:25
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:32
PerfID _final_timer
Definition: Steady.h:57
int & _time_step
Definition: Steady.h:54
PicardSolve _picard_solve
Definition: Executioner.h:130
InputParameters validParams< Steady >()
Definition: Steady.C:23
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:177
unsigned int getSteps() const
Pull out the number of steps previously set by calling init()
Definition: Adaptivity.h:99
FEProblemBase & _problem
Definition: Steady.h:51
virtual void checkIntegrity()
Definition: Steady.C:123
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
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:45
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Adaptivity & adaptivity()
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:859
Steady(const InputParameters &parameters)
Constructor.
Definition: Steady.C:31
const ExecFlagType EXEC_FINAL
virtual void outputStep(ExecFlagType type)
Output the current step.
virtual bool adaptMesh()
Real _system_time
Definition: Steady.h:53
const ExecFlagType EXEC_INITIAL