https://mooseframework.inl.gov
NumFailedTimeSteps.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 #include "NumFailedTimeSteps.h"
11 #include "Transient.h"
12 
14 
17 {
19  params.addClassDescription("Collects the number of failed time steps from the time stepper.");
20  return params;
21 }
22 
24  : GeneralPostprocessor(parameters)
25 {
27  {
28  _timestepper = dynamic_cast<TransientBase *>(_app.getExecutioner())->getTimeStepper();
29  if (!_timestepper)
30  mooseError("No user-specified time stepper in Executioner block");
31  }
32  else
33  mooseError("Problem is not transient, and will not calculate timesteps.");
34 }
35 
36 Real
38 {
39  return _timestepper->numFailures();
40 }
const TimeStepper * _timestepper
Retrieves the current TimeStepper used by the executioner.
unsigned int numFailures() const
Gets the number of failures and returns them.
Definition: TimeStepper.C:191
This postprocessor outputs the amount of failed time steps.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
registerMooseObject("MooseApp", NumFailedTimeSteps)
static InputParameters validParams()
SubProblem & _subproblem
Reference to the Subproblem for this user object.
Definition: UserObject.h:208
static InputParameters validParams()
virtual bool isTransient() const =0
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Definition: TransientBase.h:27
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:353
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.C:2123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
Definition: MooseBase.h:267
NumFailedTimeSteps(const InputParameters &parameters)
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...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.