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 void checkIterationType(IterationType it_type) const override; 28 : 29 : virtual MooseConvergenceStatus checkConvergence(unsigned int iter) override; 30 : 31 : protected: 32 : /** 33 : * Check the absolute and relative convergence of the nonlinear solution 34 : * @param iter Iteration number 35 : * @param fnorm Norm of the residual vector 36 : * @param ref_norm Norm to use for reference value 37 : * @param rel_tol Relative tolerance 38 : * @param abs_tol Absolute tolerance 39 : * @param oss Output streamstring 40 : * @return Bool signifying convergence 41 : */ 42 : virtual bool checkResidualConvergence(const unsigned int iter, 43 : const Real fnorm, 44 : const Real ref_norm, 45 : const Real rel_tol, 46 : const Real abs_tol, 47 : std::ostringstream & oss); 48 : 49 : /// Performs setup necessary for each call to checkConvergence 50 730636 : virtual void nonlinearConvergenceSetup() {} 51 : 52 : FEProblemBase & _fe_problem; 53 : /// Nonlinear absolute divergence tolerance 54 : const Real _nl_abs_div_tol; 55 : /// Nonlinear relative divergence tolerance 56 : const Real _nl_rel_div_tol; 57 : /// Divergence threshold value 58 : const Real _div_threshold; 59 : /// Number of iterations to force 60 : unsigned int _nl_forced_its; 61 : /// Maximum number of nonlinear ping-pong iterations for a solve 62 : const unsigned int _nl_max_pingpong; 63 : /// Current number of nonlinear ping-pong iterations for the current solve 64 : unsigned int _nl_current_pingpong; 65 : };