29#include "libmesh/equation_systems.h"
40 "use_displaced",
false,
"Enable/disable the use of the displaced mesh for outputting");
46 "time_step_interval > 0",
47 "The interval (number of time steps) at which output occurs. "
48 "Unless explicitly set, the default value of this parameter is set "
49 "to infinity if the wall_time_interval is explicitly set.");
51 "min_simulation_time_interval", 0.0,
"The minimum simulation time between output steps");
54 std::numeric_limits<Real>::max(),
55 "wall_time_interval > 0",
56 "The target wall time interval (in seconds) at which to output");
57 params.
setDocUnit(
"wall_time_interval",
"seconds");
59 "sync_times", {},
"Times at which the output and solution is forced to occur");
62 "Times object providing the times at which the output and solution is forced to occur");
63 params.
addParam<
bool>(
"sync_only",
false,
"Only export results at sync times");
64 params.
addParam<Real>(
"start_time",
"Time at which this output object begins to operate");
65 params.
addParam<Real>(
"end_time",
"Time at which this output object stop operating");
66 params.
addParam<
int>(
"start_step",
"Time step at which this output object begins to operate");
67 params.
addParam<
int>(
"end_step",
"Time step at which this output object stop operating");
69 "time_tolerance", 1e-14,
"Time tolerance utilized checking start and end times");
71 "output_limiting_function",
72 "Piecewise base function that sets sync_times",
73 "Replaced by using the Times system with the sync_times_objects parameter");
79 params.
setDocString(
"execute_on", exec_enum.getDocString());
88 "sync_only start_time end_time "
89 "start_step end_step min_simulation_time_interval "
91 "Timing and frequency of output");
122 _transient(_problem_ptr->isTransient()),
123 _use_displaced(getParam<bool>(
"use_displaced")),
128 _time(_problem_ptr->time()),
129 _time_old(_problem_ptr->timeOld()),
130 _t_step(_problem_ptr->timeStep()),
131 _dt(_problem_ptr->dt()),
132 _dt_old(_problem_ptr->dtOld()),
134 _time_step_interval_set_by_addparam(parameters.isParamSetByAddParam(
"time_step_interval")),
139 (parameters.isParamSetByUser(
"wall_time_interval") && _time_step_interval_set_by_addparam)
140 ?
std::numeric_limits<unsigned
int>::max()
141 : getParam<unsigned
int>(
"time_step_interval")),
142 _min_simulation_time_interval(getParam<Real>(
"min_simulation_time_interval")),
143 _wall_time_interval(getParam<Real>(
"wall_time_interval")),
144 _sync_times(
std::set<Real>(getParam<
std::vector<Real>>(
"sync_times").begin(),
145 getParam<
std::vector<Real>>(
"sync_times").end())),
146 _sync_times_object(isParamValid(
"sync_times_object")
147 ? static_cast<
Times *>(&_problem_ptr->getUserObject<
Times>(
148 getParam<TimesName>(
"sync_times_object")))
150 _start_time(isParamValid(
"start_time") ? getParam<Real>(
"start_time")
151 :
std::numeric_limits<Real>::lowest()),
152 _end_time(isParamValid(
"end_time") ? getParam<Real>(
"end_time")
153 :
std::numeric_limits<Real>::max()),
154 _start_step(isParamValid(
"start_step") ? getParam<
int>(
"start_step")
155 :
std::numeric_limits<
int>::lowest()),
156 _end_step(isParamValid(
"end_step") ? getParam<
int>(
"end_step")
157 :
std::numeric_limits<
int>::max()),
158 _t_tol(getParam<Real>(
"time_tolerance")),
159 _sync_only(getParam<bool>(
"sync_only")),
162 _advanced_execute_on(_execute_on, parameters),
163 _last_output_simulation_time(declareRestartableData<Real>(
"last_output_simulation_time",
164 std::numeric_limits<Real>::lowest())),
165 _last_output_wall_time(
std::chrono::steady_clock::now())
179 ": Parameter 'use_displaced' ignored, there is no displaced problem in your simulation.");
193 const ExecFlagEnum & add = getParam<ExecFlagEnum>(
"additional_execute_on");
194 for (
auto & me : add)
202 if (pwb_olf ==
nullptr)
203 mooseError(
"Function muse have a piecewise base!");
214 "Only one method of specifying sync times is supported at a time");
248 const bool signal_received = signal_number;
249 if (!(on_interval_or_exec_final || signal_received))
264 TIME_SECTION(
"outputStep", 2,
"Outputting Step");
299 mooseError(
"The provided sync times object has changing time values. Only static time "
300 "values are supported since time steppers take sync times from the output "
301 "warehouse which determines its sync times at output construction time.");
320 const auto now = std::chrono::steady_clock::now();
407 mooseError(
"The output object ",
name(),
" is not an AdvancedOutput, use isAdvanced() to check.");
const ExecFlagType EXEC_FORCED
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_FAILED
const ExecFlagType EXEC_NONE
const ExecFlagType EXEC_FINAL
void ErrorVector unsigned int
A MultiMooseEnum object to hold "execute_on" flags.
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual libMesh::EquationSystems & es() override
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual MooseMesh & mesh() override
Interface for objects that need to use functions.
const Function & getFunction(const std::string &name) const
Get a function with a given name.
Base class for function objects.
Interface for notifications that the mesh has changed.
bool isRecovering() const
Whether or not this is a "recover" calculation.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Class for containing MooseEnum item information.
Every object that can be built by the factory should be derived from this class.
static InputParameters validParams()
MooseApp & _app
The MOOSE application this is associated with.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
A helper warehouse class for storing the "execute_on" settings for the various output types.
virtual Real dtOld()
Get old time step size.
Real _wall_time_since_last_output
time in seconds since last output
bool _sync_only
Flag for only executing at sync times.
int _start_step
Start outputting at this time step.
bool _allow_output
Flag for disabling output.
Real _wall_time_interval
Target wall time between outputs in seconds.
Real & _dt_old
Old time step delta.
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
const Real _min_simulation_time_interval
Minimum simulation time between outputs.
const Times *const _sync_times_object
Sync times object for this outputter.
Output(const InputParameters ¶meters)
Class constructor.
void setWallTimeIntervalFromCommandLineParam()
Function to set the wall time interval based on value of command line parameter (used for testing onl...
static InputParameters validParams()
virtual int timeStep()
Get the current time step.
virtual const OutputOnWarehouse & advancedExecuteOn() const
Returns the advanced 'execute_on' settings.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
bool _is_advanced
Flag for advanced output testing.
const bool _time_step_interval_set_by_addparam
Whether time step interval is set by AddParam.
Real & _time_old
The old time.
const MultiMooseEnum & executeOn() const
Get the current 'execute_on' selections for display.
bool isAdvanced()
Returns true if this object is an AdvancedOutput object.
int & _t_step
The current time step.
ExecFlagType _current_execute_flag
Current execute on flag.
virtual Real timeOld()
Get the old output time.
virtual bool onInterval()
Returns true if the output interval is satisfied.
virtual void outputStep(const ExecFlagType &type)
A single call to this function should output all the necessary data for a single timestep.
bool _transient
Transient flag (true = transient)
virtual void solveSetup()
A method called just prior to the solve, this is used by PetscOutput to perform the necessary setup a...
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Real & _time
The current time for output purposes.
Real _start_time
Start outputting time.
Real _t_tol
Time checking tolerance.
bool _use_displaced
Flag for using displaced mesh.
Real & _dt
Time step delta.
virtual Real dt()
Get the current time step size.
Real & _last_output_simulation_time
last simulation time an output has occured
std::set< Real > _sync_times
Sync times for this outputter.
int _end_step
End outputting at this time step.
virtual Real time()
Get the output time.
virtual void output()=0
Overload this function with the desired output activities.
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced")
unsigned int _time_step_interval
The output time step interval.
std::chrono::time_point< std::chrono::steady_clock > _last_output_wall_time
last wall time an output has occured
static ExecFlagEnum getDefaultExecFlagEnum()
Return an ExecFlagEnum object with the available execution flags for Output objects.
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
Interface for objects interacting with the PerfGraph.
Function base which provides a piecewise approximation to a specified (x,y) point data set.
virtual Real functionSize() const
virtual Real domain(const int i) const
Interface class for classes which interact with Postprocessors.
Interface to allow object to consume Reporter values.
A class for creating restricted objects.
static InputParameters validParams()
void mooseWarning(Args &&... args) const
void max(const T &r, T &o, Request &req) const
Times objects are under the hood Reporters, but limited to a vector of Real.
const std::set< Real > getUniqueTimes() const
Getter for a set of the full times.
const Parallel::Communicator & _communicator
const Parallel::Communicator & comm() const
ExecFlagEnum getDefaultExecFlagEnum()
volatile std::sig_atomic_t interrupt_signal_number
Used by the signal handler to determine if we should write a checkpoint file out at any point during ...