LCOV - code coverage report
Current view: top level - include/convergence - DefaultNonlinearConvergence.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33380 (547b29) with base 8581c3 Lines: 1 1 100.0 %
Date: 2026-07-20 19:36:28 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          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             : class NonlinearSystemBase;
      17             : 
      18             : /**
      19             :  * Default nonlinear convergence criteria for FEProblem
      20             :  */
      21             : class DefaultNonlinearConvergence : public DefaultConvergenceBase
      22             : {
      23             : public:
      24             :   static InputParameters validParams();
      25             :   static InputParameters residualConvergenceParams();
      26             : 
      27             :   DefaultNonlinearConvergence(const InputParameters & parameters);
      28             : 
      29             :   virtual void checkIterationType(IterationType it_type) const override;
      30             : 
      31             :   virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) override;
      32             : 
      33             : protected:
      34             :   /**
      35             :    * Nonlinear system whose convergence state should be checked.
      36             :    */
      37             :   virtual NonlinearSystemBase & nonlinearSystem();
      38             : 
      39             :   /**
      40             :    * Check the absolute and relative convergence of the nonlinear solution
      41             :    * @param n_iter     Number of iterations performed
      42             :    * @param fnorm      Norm of the residual vector
      43             :    * @param ref_norm   Norm to use for reference value
      44             :    * @param rel_tol    Relative tolerance
      45             :    * @param abs_tol    Absolute tolerance
      46             :    * @param oss        Output streamstring
      47             :    * @return           Bool signifying convergence
      48             :    */
      49             :   virtual bool checkResidualConvergence(const unsigned int n_iter,
      50             :                                         const Real fnorm,
      51             :                                         const Real ref_norm,
      52             :                                         const Real rel_tol,
      53             :                                         const Real abs_tol,
      54             :                                         std::ostringstream & oss);
      55             : 
      56             :   /// Performs setup necessary for each call to checkConvergence
      57      731751 :   virtual void nonlinearConvergenceSetup() {}
      58             : 
      59             :   FEProblemBase & _fe_problem;
      60             :   /// Nonlinear absolute tolerance
      61             :   PetscReal _abs_tol;
      62             :   /// Nonlinear relative tolerance
      63             :   PetscReal _rel_tol;
      64             :   /// Nonlinear absolute divergence tolerance
      65             :   const Real _nl_abs_div_tol;
      66             :   /// Nonlinear relative divergence tolerance
      67             :   const Real _nl_rel_div_tol;
      68             :   /// Divergence threshold value
      69             :   const Real _div_threshold;
      70             :   /// Number of iterations to force
      71             :   unsigned int _nl_forced_its;
      72             :   /// Maximum number of nonlinear ping-pong iterations for a solve
      73             :   const unsigned int _nl_max_pingpong;
      74             :   /// Current number of nonlinear ping-pong iterations for the current solve
      75             :   unsigned int _nl_current_pingpong;
      76             : };

Generated by: LCOV version 1.14