Line data Source code
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 : 10 : #pragma once 11 : 12 : #include "GeneralPostprocessor.h" 13 : 14 : /** 15 : * NumNonlinearIterations is a postprocessor that reports the number of nonlinear iterations 16 : */ 17 : 18 : class NumNonlinearIterations : public GeneralPostprocessor 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : NumNonlinearIterations(const InputParameters & parameters); 24 : 25 : /** 26 : * Initialization to be done at each timestep 27 : */ 28 : virtual void timestepSetup() override; 29 : 30 1049 : virtual void initialize() override {} 31 1049 : virtual void execute() override {} 32 : virtual void finalize() override; 33 : 34 : /** 35 : * Get the number of nonlinear iterations 36 : */ 37 : virtual Real getValue() const override; 38 : 39 : protected: 40 : /// Pointer to the FEProblemBase 41 : FEProblemBase * _fe_problem; 42 : 43 : /// True if we should accumulate over all nonlinear solves done as part of Picard iterations in a step. 44 : bool _accumulate_over_step; 45 : 46 : /// Stores the nonlinear iteration count 47 : unsigned int _num_iters; 48 : 49 : /// Stores the last time this was executed 50 : Real _time; 51 : };