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 "DefaultConvergenceBase.h" 13 : #include "MooseApp.h" 14 : #include "Executioner.h" 15 : 16 : /** 17 : * Default nonlinear convergence criteria for FEProblem 18 : */ 19 : class DefaultNonlinearConvergence : public DefaultConvergenceBase 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : static InputParameters residualConvergenceParams(); 24 : 25 : DefaultNonlinearConvergence(const InputParameters & parameters); 26 : 27 : virtual MooseConvergenceStatus checkConvergence(unsigned int iter) override; 28 : 29 : protected: 30 : /** 31 : * Check the relative convergence of the nonlinear solution 32 : * @param fnorm Norm of the residual vector 33 : * @param ref_norm Norm to use for reference value 34 : * @param rel_tol Relative tolerance 35 : * @param abs_tol Absolute tolerance 36 : * @return Bool signifying convergence 37 : */ 38 : virtual bool checkRelativeConvergence(const unsigned int it, 39 : const Real fnorm, 40 : const Real ref_norm, 41 : const Real rel_tol, 42 : const Real abs_tol, 43 : std::ostringstream & oss); 44 : 45 : /** 46 : * Performs setup necessary for each call to checkConvergence 47 : */ 48 724522 : virtual void nonlinearConvergenceSetup() {} 49 : 50 : protected: 51 : FEProblemBase & _fe_problem; 52 : /// Nonlinear absolute divergence tolerance 53 : const Real _nl_abs_div_tol; 54 : /// Nonlinear relative divergence tolerance 55 : const Real _nl_rel_div_tol; 56 : /// Divergence threshold value 57 : const Real _div_threshold; 58 : /// Number of iterations to force 59 : unsigned int _nl_forced_its; 60 : /// Maximum number of nonlinear ping-pong iterations for a solve 61 : const unsigned int _nl_max_pingpong; 62 : /// Current number of nonlinear ping-pong iterations for the current solve 63 : unsigned int _nl_current_pingpong; 64 : };