https://mooseframework.inl.gov
PostprocessorSteadyStateConvergence.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 
11 
13 
16 {
18 
19  params.addClassDescription(
20  "Compares the absolute value of a post-processor to a tolerance for steady-state checks.");
21 
22  params.addRequiredParam<PostprocessorName>("postprocessor",
23  "Post-processor to use for convergence criteria");
24  params.addRequiredParam<Real>("tolerance", "Tolerance to use for convergence criteria");
25 
26  return params;
27 }
28 
30  const InputParameters & parameters)
31  : Convergence(parameters),
32  _postprocessor(getPostprocessorValue("postprocessor")),
33  _tol(getParam<Real>("tolerance"))
34 {
35 }
36 
39 {
40  // Often post-processors checking steady conditions are falsely 0 on INITIAL
41  if (iter == 0)
43 
45  {
46  std::ostringstream oss;
47  oss << "Converged due to |post-processor| (" << std::abs(_postprocessor) << ") <= tolerance ("
48  << _tol << ").";
49  verboseOutput(oss);
51  }
52  else
53  {
54  std::ostringstream oss;
55  oss << "Still iterating due to |post-processor| (" << std::abs(_postprocessor)
56  << ") > tolerance (" << _tol << ").";
57  verboseOutput(oss);
59  }
60 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
registerMooseObject("MooseApp", PostprocessorSteadyStateConvergence)
void verboseOutput(std::ostringstream &oss)
Outputs the stream to the console if verbose output is enabled.
Definition: Convergence.C:51
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual MooseConvergenceStatus checkConvergence(unsigned int iter) override
Returns convergence status.
Compares a post-processor to a tolerance for steady-state checks.
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...
PostprocessorSteadyStateConvergence(const InputParameters &parameters)
const Real _tol
Tolerance to which post-processor is compared.
const PostprocessorValue & _postprocessor
Post-processor to use for convergence criteria.
Base class for convergence criteria.
Definition: Convergence.h:21
MooseConvergenceStatus
Status returned by calls to checkConvergence.
Definition: Convergence.h:33
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
Definition: Convergence.C:16
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...