www.mooseframework.org
PercentChangePostprocessor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 
13 
16 {
18  params.addClassDescription("Computes the percent change of a postprocessor value compared to the "
19  "value at the previous timestep.");
20  params.addRequiredParam<PostprocessorName>(
21  "postprocessor", "The name of the postprocessor used for exit criterion");
22  return params;
23 }
24 
26  : GeneralPostprocessor(parameters),
27  _postprocessor(getPostprocessorValue("postprocessor")),
28  _postprocessor_old(getPostprocessorValueOld("postprocessor"))
29 {
30  mooseDeprecated("PercentChangePostprocessor is deprecated: instead, ",
31  "please use ChangeOverTimePostprocessor using the parameter ",
32  "'compute_relative_change' set to 'true'");
33 }
34 
35 void
37 {
38 }
39 
40 void
42 {
43 }
44 
45 Real
47 {
48  return std::fabs((std::fabs(_postprocessor) - std::fabs(_postprocessor_old)) *
49  std::pow(std::fabs(_postprocessor), -1));
50 }
PercentChangePostprocessor(const InputParameters &parameters)
void mooseDeprecated(Args &&... args) const
const PostprocessorValue & _postprocessor
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...
virtual void execute() override
Execute method.
registerMooseObject("MooseApp", PercentChangePostprocessor)
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...
static InputParameters validParams()
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
static InputParameters validParams()
const PostprocessorValue & _postprocessor_old
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
MooseUnits pow(const MooseUnits &, int)
Definition: Units.C:537
This postprocessor displays the change in the postprocessor between adjacent timesteps.