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 : #include "IterationInfo.h" 11 : #include "SubProblem.h" 12 : #include "Transient.h" 13 : 14 : registerMooseObject("MooseApp", IterationInfo); 15 : 16 : InputParameters 17 14397 : IterationInfo::validParams() 18 : { 19 14397 : InputParameters params = GeneralReporter::validParams(); 20 14397 : params.addClassDescription("Report the time and iteration information for the simulation."); 21 : 22 : MultiMooseEnum items( 23 14397 : "time timestep num_linear_iterations num_nonlinear_iterations num_fixed_point_iterations"); 24 14397 : params.addParam<MultiMooseEnum>( 25 : "items", 26 : items, 27 : "The iteration information to output, if nothing is provided everything will be output."); 28 14397 : params.addParam<NonlinearSystemName>( 29 : "nl_sys", "nl0", "The nonlinear system that this should report iteration info for."); 30 28794 : return params; 31 14397 : } 32 : 33 66 : IterationInfo::IterationInfo(const InputParameters & parameters) 34 : : GeneralReporter(parameters), 35 66 : _items(getParam<MultiMooseEnum>("items")), 36 66 : _time_value(declareHelper<Real>("time", _dummy_real)), 37 66 : _time_step_value(declareHelper<unsigned int>("timestep", _dummy_unsigned_int)), 38 66 : _num_linear(declareHelper<unsigned int>("num_linear_iterations", _dummy_unsigned_int)), 39 66 : _num_nonlinear(declareHelper<unsigned int>("num_nonlinear_iterations", _dummy_unsigned_int)), 40 66 : _num_fixed_point( 41 66 : declareHelper<unsigned int>("num_fixed_point_iterations", _dummy_unsigned_int)), 42 132 : _nl_sys_num(_subproblem.nlSysNum(getParam<NonlinearSystemName>("nl_sys"))) 43 : { 44 66 : } 45 : 46 : void 47 400 : IterationInfo::execute() 48 : { 49 400 : _time_value = _t; 50 400 : _time_step_value = _t_step; 51 400 : _num_nonlinear = _subproblem.nNonlinearIterations(_nl_sys_num); 52 400 : _num_linear = _subproblem.nLinearIterations(_nl_sys_num); 53 400 : _num_fixed_point = _app.getExecutioner()->fixedPointSolve().numFixedPointIts(); 54 400 : }