https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PostprocessorConvergence.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("Compares the absolute value of a post-processor to a tolerance.");
20
21 params.addRequiredParam<PostprocessorName>("postprocessor",
22 "Post-processor to use for convergence criteria");
23 params.addRequiredParam<Real>("tolerance", "Tolerance to use for convergence criteria");
24
25 return params;
26}
27
29 : IterationCountConvergence(parameters),
30 _postprocessor(getPostprocessorValue("postprocessor")),
31 _tol(getParam<Real>("tolerance"))
32{
33}
34
37{
38 if (std::abs(_postprocessor) <= _tol)
39 {
40 std::ostringstream oss;
41 oss << "Converged due to |post-processor| (" << std::abs(_postprocessor) << ") <= tolerance ("
42 << _tol << ").";
43 verboseOutput(oss);
45 }
46 else
47 {
48 std::ostringstream oss;
49 oss << "Still iterating due to |post-processor| (" << std::abs(_postprocessor)
50 << ") > tolerance (" << _tol << ").";
51 verboseOutput(oss);
53 }
54}
registerMooseObject("MooseApp", PostprocessorConvergence)
void verboseOutput(std::ostringstream &oss)
Outputs the stream to the console if verbose output is enabled.
Definition Convergence.C:51
MooseConvergenceStatus
Status returned by calls to checkConvergence.
Definition Convergence.h:34
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
Checks convergence based on the iteration count.
static InputParameters validParams()
Compares a post-processor to a tolerance.
virtual MooseConvergenceStatus checkConvergenceInner(unsigned int n_iter) override
Inner check of convergence.
PostprocessorConvergence(const InputParameters &parameters)
const PostprocessorValue & _postprocessor
Post-processor to use for convergence criteria.
const Real _tol
Tolerance to which post-processor is compared.
static InputParameters validParams()