19 params.
addClassDescription(
"Converges if multiple post-processors are all less than tolerances.");
22 "Postprocessors to check");
23 params.
addParam<std::vector<std::string>>(
25 "Description of each Postprocessor. If not provided, the Postprocessor names are used as " 26 "their descriptions.");
27 params.
addRequiredParam<std::vector<Real>>(
"tolerances",
"Tolerance for each Postprocessor");
35 const auto & pp_names = getParam<std::vector<PostprocessorName>>(
"postprocessors");
41 for (
const auto & pp_name : pp_names)
45 for (
const auto & pp_name : pp_names)
50 "The parameters 'postprocessors', 'descriptions', and 'tolerances' must be the same size.");
64 bool all_converged =
true;
65 std::ostringstream oss;
72 all_converged =
false;
90 std::size_t max_desc_length = 0;
92 max_desc_length =
std::max(max_desc_length, description.length());
94 return max_desc_length;
100 const Real tol)
const 102 std::string color, compare_str;
114 std::ostringstream oss;
115 oss <<
" " << description <<
": " << color << std::scientific << std::setprecision(5)
116 <<
std::abs(
err) <<
" " << compare_str <<
" " << tol << COLOR_DEFAULT <<
"\n";
std::vector< const PostprocessorValue * > _pp_values
Postprocessor values.
const std::vector< Real > & _tolerances
Tolerance for each Postprocessor.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
unsigned int _max_desc_length
Maximum description length.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
void verboseOutput(std::ostringstream &oss)
Outputs the stream to the console if verbose output is enabled.
unsigned int getMaxDescriptionLength() const
Returns the maximum description length.
auto max(const L &left, const R &right)
MultiPostprocessorConvergence(const InputParameters ¶meters)
static InputParameters validParams()
static InputParameters validParams()
std::string comparisonLine(const std::string &description, const Real err, const Real tol) const
Generates a colored line for a tolerance comparison.
registerMooseObject("MooseApp", MultiPostprocessorConvergence)
MooseConvergenceStatus
Status returned by calls to checkConvergence.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Converges if multiple post-processors are all less than tolerances.
virtual MooseConvergenceStatus checkConvergenceInner(unsigned int iter) override
Inner check of convergence.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
std::vector< std::string > _descriptions
Description of each Postprocessor.
auto index_range(const T &sizable)
Checks convergence based on the iteration count.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...