https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NumNonlinearIterations.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
12#include "FEProblem.h"
13#include "SubProblem.h"
14#include "SystemBase.h"
15
17
20{
22 params.addParam<bool>("accumulate_over_step",
23 false,
24 "When set to true, accumulates to count the total over all fixed point "
25 "iterations for each step");
26 params.addClassDescription("Outputs the number of nonlinear iterations");
27
28 // Not supported
29 params.suppressParameter<bool>("use_displaced_mesh");
30 return params;
31}
32
34 : GeneralPostprocessor(parameters),
35 _fe_problem(dynamic_cast<FEProblemBase *>(&_subproblem)),
36 _accumulate_over_step(getParam<bool>("accumulate_over_step")),
37 _num_iters(0),
38 _time(-std::numeric_limits<Real>::max())
39{
40 if (!_fe_problem)
41 mooseError("Couldn't cast to FEProblemBase");
42}
43
44void
53
54void
62
63Real
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", NumNonlinearIterations)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual Real & time() const
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
NumNonlinearIterations is a postprocessor that reports the number of nonlinear iterations.
FEProblemBase * _fe_problem
Pointer to the FEProblemBase.
NumNonlinearIterations(const InputParameters &parameters)
unsigned int _num_iters
Stores the nonlinear iteration count.
virtual void timestepSetup() override
Initialization to be done at each timestep.
virtual Real getValue() const override
Get the number of nonlinear iterations.
Real _time
Stores the last time this was executed.
bool _accumulate_over_step
True if we should accumulate over all nonlinear solves done as part of Picard iterations in a step.
static InputParameters validParams()
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
virtual unsigned int nNonlinearIterations(const unsigned int nl_sys_num) const
Definition SubProblem.C:761
unsigned int number() const
Gets the number of this system.
SubProblem & _subproblem
Reference to the Subproblem for this user object.
SystemBase & _sys
Reference to the system object for this user object.