20 params.
addRequiredParam<PostprocessorName>(
"postprocessor",
"The name of the postprocessor");
21 params.
addParam<
bool>(
"change_with_respect_to_initial",
23 "Compute change with respect to initial value instead of previous value");
25 "compute_relative_change",
false,
"Compute magnitude of relative change instead of change");
26 params.
addParam<
bool>(
"take_absolute_value",
false,
"Option to take absolute value of change");
27 params.
addParam<
bool>(
"divide_by_dt",
29 "If true, divide by the time step size. This may only be enabled if "
30 "'change_with_respect_to_initial' is 'false'.");
32 params.
addClassDescription(
"Computes the change or relative change in a post-processor value "
33 "over a timestep or the entire transient");
40 _change_with_respect_to_initial(getParam<bool>(
"change_with_respect_to_initial")),
41 _compute_relative_change(getParam<bool>(
"compute_relative_change")),
42 _take_absolute_value(getParam<bool>(
"take_absolute_value")),
43 _divide_by_dt(getParam<bool>(
"divide_by_dt")),
44 _pps_value(getPostprocessorValue(
"postprocessor")),
45 _pps_value_old(getPostprocessorValueOld(
"postprocessor")),
46 _pps_value_initial(declareRestartableData<Real>(
"pps_value_initial")),
52 const PostprocessorName & pp_name = getParam<PostprocessorName>(
"postprocessor");
55 mooseError(
"When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for "
56 "the dependent post-processor ('" +
57 pp_name +
"') must include 'initial'");
61 mooseError(
"When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for "
62 "the ChangeOverTimePostprocessor ('" +
63 name() +
"') must include 'initial'");
70 "The parameter 'divide_by_dt' may only be set to 'true' if "
71 "'change_with_respect_to_initial' is 'false', since this is assumed to be unintended.");
108 change = (
_pps_value - base_value) / base_value;
113 _value = std::fabs(change);
registerMooseObject("MooseApp", ChangeOverTimePostprocessor)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_INITIAL
Computes the change in a post-processor value, or the magnitude of its relative change,...
const bool _compute_relative_change
option to compute the magnitude of relative change instead of change
Real & _pps_value_initial
initial post-processor value
const PostprocessorValue & _pps_value_old
old post-processor value
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
const bool _change_with_respect_to_initial
option to compute change with respect to initial value instead of previous time value
const bool _divide_by_dt
option to divide by the time step size
ChangeOverTimePostprocessor(const InputParameters ¶meters)
const bool _take_absolute_value
option to take the absolute value of the change
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Real _value
This post-processor value.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
const PostprocessorValue & _pps_value
current post-processor value
static InputParameters validParams()
virtual void execute() override
Execute method.
T & getUserObject(const std::string &name, unsigned int tid=0) const
Get the user object by its name.
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
const ExecFlagEnum & _execute_enum
Execute settings for this object.
const ExecFlagEnum & getExecuteOnEnum() const
Return the execute on MultiMooseEnum for this object.
Real & _dt
Time step size.
int & _t_step
The number of the time step.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Base class for user-specific data.