https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SteadyBase.C
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// MOOSE includes
11#include "SteadyBase.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
21{
23 params.addParam<Real>("time", 0.0, "System time");
24 return params;
25}
26
28 : Executioner(parameters),
29 _problem(_fe_problem),
30 _system_time(getParam<Real>("time")),
31 _time_step(_problem.timeStep()),
32 _time([this]() -> Real & { return this->_problem.time() = this->_system_time; }()),
33 _output_iteration_number(0)
34{
35}
36
37void
39{
40 if (_app.isRecovering())
41 {
42 _console << "\nCannot recover steady-state solves of type: " << this->type()
43 << "!\nExiting...\n"
44 << std::endl;
46 return;
47 }
48
49 _time_step = 0;
53
54 preExecute();
55
57
58 // first step in any SteadyBase state solve is always 1 (preserving backwards compatibility)
59 _time_step = 1;
60
61#ifdef LIBMESH_ENABLE_AMR
62
63 // Define the refinement loop
64 unsigned int steps = _problem.adaptivity().getSteps();
65 for (unsigned int r_step = 0; r_step <= steps; r_step++)
66 {
67#endif // LIBMESH_ENABLE_AMR
69
71
72 if (!lastSolveConverged())
73 {
74 _console << "Aborting as solve did not converge" << std::endl;
75 break;
76 }
77
80
81 // need to keep _time in sync with _time_step to get correct output
85
86#ifdef LIBMESH_ENABLE_AMR
87 if (r_step != steps)
88 {
90 }
91
92 _time_step++;
93 }
94#endif
95
96 {
97 TIME_SECTION("final", 1, "Executing Final Objects")
105 }
106
107 postExecute();
108}
const ExecFlagType EXEC_TIMESTEP_END
Definition Moose.C:36
const ExecFlagType EXEC_INITIAL
Definition Moose.C:30
const ExecFlagType EXEC_FINAL
Definition Moose.C:48
unsigned int getSteps() const
Pull out the number of steps previously set by calling init()
Definition Adaptivity.h:119
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Executioners are objects that do the actual work of solving your problem.
Definition Executioner.h:37
static InputParameters validParams()
Definition Executioner.C:26
virtual void preExecute()
Override this for actions that should take place before execution.
Definition Executioner.h:73
virtual void postExecute()
Override this for actions that should take place after execution.
Definition Executioner.h:78
std::unique_ptr< FixedPointSolve > _fixed_point_solve
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep.
virtual void postExecute()
Method called at the end of the simulation.
bool execMultiApps(ExecFlagType type, bool auto_advance=true)
Execute the MultiApps associated with the ExecFlagType.
void timestepSetup() override
virtual void computeIndicators()
void finalizeMultiApps()
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
virtual Real & time() const
virtual bool adaptMesh()
Adaptivity & adaptivity()
virtual void computeMarkers()
virtual void outputStep(ExecFlagType type)
Output the current step.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition MooseApp.C:1669
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
Real & _time
The current time.
Definition SteadyBase.h:68
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
Definition SteadyBase.h:38
Real _system_time
The system time.
Definition SteadyBase.h:62
bool _last_solve_converged
Flag showing if the last solve converged.
Definition SteadyBase.h:75
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
Definition SteadyBase.C:38
static InputParameters validParams()
Definition SteadyBase.C:20
int & _time_step
The time step index.
Definition SteadyBase.h:65
SteadyBase(const InputParameters &parameters)
Constructor.
Definition SteadyBase.C:27
FEProblemBase & _problem
Just an alias for now.
Definition SteadyBase.h:59