https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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 (n_iter == 0)
43
44 if (std::abs(_postprocessor) <= _tol)
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}
registerMooseObject("MooseApp", PostprocessorSteadyStateConvergence)
Base class for convergence criteria.
Definition Convergence.h:26
static InputParameters validParams()
Definition Convergence.C:16
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.
Compares a post-processor to a tolerance for steady-state checks.
const Real _tol
Tolerance to which post-processor is compared.
PostprocessorSteadyStateConvergence(const InputParameters &parameters)
const PostprocessorValue & _postprocessor
Post-processor to use for convergence criteria.
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) override
Returns convergence status.