Line data Source code
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 "PercentChangePostprocessor.h" 11 : 12 : registerMooseObject("MooseApp", PercentChangePostprocessor); 13 : 14 : InputParameters 15 14265 : PercentChangePostprocessor::validParams() 16 : { 17 14265 : InputParameters params = GeneralPostprocessor::validParams(); 18 14265 : params.addClassDescription("Computes the percent change of a postprocessor value compared to the " 19 : "value at the previous timestep."); 20 14265 : params.addRequiredParam<PostprocessorName>( 21 : "postprocessor", "The name of the postprocessor used for exit criterion"); 22 14265 : return params; 23 0 : } 24 : 25 0 : PercentChangePostprocessor::PercentChangePostprocessor(const InputParameters & parameters) 26 : : GeneralPostprocessor(parameters), 27 0 : _postprocessor(getPostprocessorValue("postprocessor")), 28 0 : _postprocessor_old(getPostprocessorValueOld("postprocessor")) 29 : { 30 0 : mooseDeprecated("PercentChangePostprocessor is deprecated: instead, ", 31 : "please use ChangeOverTimePostprocessor using the parameter ", 32 : "'compute_relative_change' set to 'true'"); 33 0 : } 34 : 35 : void 36 0 : PercentChangePostprocessor::initialize() 37 : { 38 0 : } 39 : 40 : void 41 0 : PercentChangePostprocessor::execute() 42 : { 43 0 : } 44 : 45 : Real 46 0 : PercentChangePostprocessor::getValue() const 47 : { 48 0 : return std::fabs((std::fabs(_postprocessor) - std::fabs(_postprocessor_old)) * 49 0 : std::pow(std::fabs(_postprocessor), -1)); 50 : }