www.mooseframework.org
ChangeOverTimestepPostprocessor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
16 
17 template <>
20 {
22  params.addRequiredParam<PostprocessorName>("postprocessor", "The name of the postprocessor");
23  params.addParam<bool>(
24  "compute_relative_change", false, "Compute magnitude of relative change instead of change");
25  return params;
26 }
27 
29  : GeneralPostprocessor(parameters),
30  _compute_relative_change(getParam<bool>("compute_relative_change")),
31  _pps_value(getPostprocessorValue("postprocessor")),
32  _pps_value_old(getPostprocessorValueOld("postprocessor"))
33 {
34 }
35 
36 void
38 {
39 }
40 
41 void
43 {
44 }
45 
46 Real
48 {
50  return std::fabs((std::fabs(_pps_value) - std::fabs(_pps_value_old)) *
51  std::pow(std::fabs(_pps_value), -1));
52  else
53  return _pps_value - _pps_value_old;
54 }
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
const PostprocessorValue & _pps_value
current post-processor value
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralPostprocessor >()
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
ChangeOverTimestepPostprocessor(const InputParameters &parameters)
InputParameters validParams< ChangeOverTimestepPostprocessor >()
const PostprocessorValue & _pps_value_old
old post-processor value
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...
const bool _compute_relative_change
option to compute the magnitude of relative change instead of change
virtual void execute() override
Execute method.