LCOV - code coverage report
Current view: top level - include/problems - FEProblemBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 8601ad Lines: 194 222 87.4 %
Date: 2025-07-18 13:27:08 Functions: 170 180 94.4 %
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             : // MOOSE includes
      13             : #include "SubProblem.h"
      14             : #include "GeometricSearchData.h"
      15             : #include "MeshDivision.h"
      16             : #include "MortarData.h"
      17             : #include "ReporterData.h"
      18             : #include "Adaptivity.h"
      19             : #include "InitialConditionWarehouse.h"
      20             : #include "FVInitialConditionWarehouse.h"
      21             : #include "ScalarInitialConditionWarehouse.h"
      22             : #include "Restartable.h"
      23             : #include "SolverParams.h"
      24             : #include "PetscSupport.h"
      25             : #include "MooseApp.h"
      26             : #include "ExecuteMooseObjectWarehouse.h"
      27             : #include "MaterialWarehouse.h"
      28             : #include "MooseVariableFE.h"
      29             : #include "MultiAppTransfer.h"
      30             : #include "Postprocessor.h"
      31             : #include "HashMap.h"
      32             : #include "VectorPostprocessor.h"
      33             : #include "PerfGraphInterface.h"
      34             : #include "Attributes.h"
      35             : #include "MooseObjectWarehouse.h"
      36             : #include "MaterialPropertyRegistry.h"
      37             : #include "RestartableEquationSystems.h"
      38             : #include "SolutionInvalidity.h"
      39             : #include "PetscSupport.h"
      40             : 
      41             : #include "libmesh/enum_quadrature_type.h"
      42             : #include "libmesh/equation_systems.h"
      43             : 
      44             : #include <unordered_map>
      45             : #include <memory>
      46             : 
      47             : // Forward declarations
      48             : class AuxiliarySystem;
      49             : class DisplacedProblem;
      50             : class MooseMesh;
      51             : class NonlinearSystemBase;
      52             : class LinearSystem;
      53             : class SolverSystem;
      54             : class NonlinearSystem;
      55             : class RandomInterface;
      56             : class RandomData;
      57             : class MeshChangedInterface;
      58             : class MeshDisplacedInterface;
      59             : class MultiMooseEnum;
      60             : class MaterialPropertyStorage;
      61             : class MaterialData;
      62             : class MooseEnum;
      63             : class Assembly;
      64             : class JacobianBlock;
      65             : class Control;
      66             : class MultiApp;
      67             : class TransientMultiApp;
      68             : class ScalarInitialCondition;
      69             : class Indicator;
      70             : class InternalSideIndicatorBase;
      71             : class Marker;
      72             : class Material;
      73             : class Transfer;
      74             : class XFEMInterface;
      75             : class SideUserObject;
      76             : class NodalUserObject;
      77             : class ElementUserObject;
      78             : class InternalSideUserObject;
      79             : class InterfaceUserObject;
      80             : class GeneralUserObject;
      81             : class Positions;
      82             : class Function;
      83             : class Distribution;
      84             : class Sampler;
      85             : class KernelBase;
      86             : class IntegratedBCBase;
      87             : class LineSearch;
      88             : class UserObject;
      89             : class AutomaticMortarGeneration;
      90             : class VectorPostprocessor;
      91             : class Convergence;
      92             : class MooseAppCoordTransform;
      93             : class MortarUserObject;
      94             : class SolutionInvalidity;
      95             : 
      96             : // libMesh forward declarations
      97             : namespace libMesh
      98             : {
      99             : class CouplingMatrix;
     100             : class NonlinearImplicitSystem;
     101             : class LinearImplicitSystem;
     102             : } // namespace libMesh
     103             : 
     104             : enum class MooseLinearConvergenceReason
     105             : {
     106             :   ITERATING = 0,
     107             :   // CONVERGED_RTOL_NORMAL        =  1,
     108             :   // CONVERGED_ATOL_NORMAL        =  9,
     109             :   CONVERGED_RTOL = 2,
     110             :   CONVERGED_ATOL = 3,
     111             :   CONVERGED_ITS = 4,
     112             :   // CONVERGED_CG_NEG_CURVE       =  5,
     113             :   // CONVERGED_CG_CONSTRAINED     =  6,
     114             :   // CONVERGED_STEP_LENGTH        =  7,
     115             :   // CONVERGED_HAPPY_BREAKDOWN    =  8,
     116             :   DIVERGED_NULL = -2,
     117             :   // DIVERGED_ITS                 = -3,
     118             :   // DIVERGED_DTOL                = -4,
     119             :   // DIVERGED_BREAKDOWN           = -5,
     120             :   // DIVERGED_BREAKDOWN_BICG      = -6,
     121             :   // DIVERGED_NONSYMMETRIC        = -7,
     122             :   // DIVERGED_INDEFINITE_PC       = -8,
     123             :   DIVERGED_NANORINF = -9,
     124             :   // DIVERGED_INDEFINITE_MAT      = -10
     125             :   DIVERGED_PCSETUP_FAILED = -11
     126             : };
     127             : 
     128             : /**
     129             :  * Specialization of SubProblem for solving nonlinear equations plus auxiliary equations
     130             :  *
     131             :  */
     132             : class FEProblemBase : public SubProblem, public Restartable
     133             : {
     134             : public:
     135             :   static InputParameters validParams();
     136             : 
     137             :   FEProblemBase(const InputParameters & parameters);
     138             :   virtual ~FEProblemBase();
     139             : 
     140             :   enum class CoverageCheckMode
     141             :   {
     142             :     FALSE,
     143             :     TRUE,
     144             :     OFF,
     145             :     ON,
     146             :     SKIP_LIST,
     147             :     ONLY_LIST,
     148             :   };
     149             : 
     150     1511986 :   virtual libMesh::EquationSystems & es() override { return _req.set().es(); }
     151    69002069 :   virtual MooseMesh & mesh() override { return _mesh; }
     152  2207638022 :   virtual const MooseMesh & mesh() const override { return _mesh; }
     153             :   const MooseMesh & mesh(bool use_displaced) const override;
     154             : 
     155             :   void setCoordSystem(const std::vector<SubdomainName> & blocks, const MultiMooseEnum & coord_sys);
     156             :   void setAxisymmetricCoordAxis(const MooseEnum & rz_coord_axis);
     157             : 
     158             :   /**
     159             :    * Set the coupling between variables
     160             :    * TODO: allow user-defined coupling
     161             :    * @param type Type of coupling
     162             :    */
     163             :   void setCoupling(Moose::CouplingType type);
     164             : 
     165      477467 :   Moose::CouplingType coupling() const { return _coupling; }
     166             : 
     167             :   /**
     168             :    * Set custom coupling matrix
     169             :    * @param cm coupling matrix to be set
     170             :    * @param nl_sys_num which nonlinear system we are setting the coupling matrix for
     171             :    */
     172             :   void setCouplingMatrix(std::unique_ptr<libMesh::CouplingMatrix> cm,
     173             :                          const unsigned int nl_sys_num);
     174             : 
     175             :   // DEPRECATED METHOD
     176             :   void setCouplingMatrix(libMesh::CouplingMatrix * cm, const unsigned int nl_sys_num);
     177             : 
     178             :   const libMesh::CouplingMatrix * couplingMatrix(const unsigned int nl_sys_num) const override;
     179             : 
     180             :   /// Set custom coupling matrix for variables requiring nonlocal contribution
     181             :   void setNonlocalCouplingMatrix();
     182             : 
     183             :   bool
     184             :   areCoupled(const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const;
     185             : 
     186             :   /**
     187             :    * Whether or not MOOSE will perform a user object/auxiliary kernel state check
     188             :    */
     189             :   bool hasUOAuxStateCheck() const { return _uo_aux_state_check; }
     190             : 
     191             :   /**
     192             :    * Return a flag to indicate whether we are executing user objects and auxliary kernels for state
     193             :    * check
     194             :    * Note: This function can return true only when hasUOAuxStateCheck() returns true, i.e. the check
     195             :    *       has been activated by users through Problem/check_uo_aux_state input parameter.
     196             :    */
     197        3797 :   bool checkingUOAuxState() const { return _checking_uo_aux_state; }
     198             : 
     199             :   /**
     200             :    * Whether to trust the user coupling matrix even if we want to do things like be paranoid and
     201             :    * create a full coupling matrix. See https://github.com/idaholab/moose/issues/16395 for detailed
     202             :    * background
     203             :    */
     204             :   void trustUserCouplingMatrix();
     205             : 
     206             :   std::vector<std::pair<MooseVariableFEBase *, MooseVariableFEBase *>> &
     207             :   couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num);
     208             :   std::vector<std::pair<MooseVariableFEBase *, MooseVariableFEBase *>> &
     209             :   nonlocalCouplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num);
     210             : 
     211             :   virtual bool hasVariable(const std::string & var_name) const override;
     212             :   // NOTE: hasAuxiliaryVariable defined in parent class
     213             :   bool hasSolverVariable(const std::string & var_name) const;
     214             :   using SubProblem::getVariable;
     215             :   virtual const MooseVariableFieldBase &
     216             :   getVariable(const THREAD_ID tid,
     217             :               const std::string & var_name,
     218             :               Moose::VarKindType expected_var_type = Moose::VarKindType::VAR_ANY,
     219             :               Moose::VarFieldType expected_var_field_type =
     220             :                   Moose::VarFieldType::VAR_FIELD_ANY) const override;
     221             :   MooseVariableFieldBase & getActualFieldVariable(const THREAD_ID tid,
     222             :                                                   const std::string & var_name) override;
     223             :   virtual MooseVariable & getStandardVariable(const THREAD_ID tid,
     224             :                                               const std::string & var_name) override;
     225             :   virtual VectorMooseVariable & getVectorVariable(const THREAD_ID tid,
     226             :                                                   const std::string & var_name) override;
     227             :   virtual ArrayMooseVariable & getArrayVariable(const THREAD_ID tid,
     228             :                                                 const std::string & var_name) override;
     229             : 
     230             :   virtual bool hasScalarVariable(const std::string & var_name) const override;
     231             :   virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid,
     232             :                                                   const std::string & var_name) override;
     233             :   virtual libMesh::System & getSystem(const std::string & var_name) override;
     234             : 
     235             :   /**
     236             :    * Set the MOOSE variables to be reinited on each element.
     237             :    * @param moose_vars A set of variables that need to be reinited each time reinit() is called.
     238             :    *
     239             :    * @param tid The thread id
     240             :    */
     241             :   virtual void setActiveElementalMooseVariables(const std::set<MooseVariableFEBase *> & moose_vars,
     242             :                                                 const THREAD_ID tid) override;
     243             : 
     244             :   /**
     245             :    * Clear the active elemental MooseVariableFEBase.  If there are no active variables then they
     246             :    * will all be reinited. Call this after finishing the computation that was using a restricted set
     247             :    * of MooseVariableFEBases
     248             :    *
     249             :    * @param tid The thread id
     250             :    */
     251             :   virtual void clearActiveElementalMooseVariables(const THREAD_ID tid) override;
     252             : 
     253             :   virtual void clearActiveFEVariableCoupleableMatrixTags(const THREAD_ID tid) override;
     254             : 
     255             :   virtual void clearActiveFEVariableCoupleableVectorTags(const THREAD_ID tid) override;
     256             : 
     257             :   virtual void setActiveFEVariableCoupleableVectorTags(std::set<TagID> & vtags,
     258             :                                                        const THREAD_ID tid) override;
     259             : 
     260             :   virtual void setActiveFEVariableCoupleableMatrixTags(std::set<TagID> & mtags,
     261             :                                                        const THREAD_ID tid) override;
     262             : 
     263             :   virtual void clearActiveScalarVariableCoupleableMatrixTags(const THREAD_ID tid) override;
     264             : 
     265             :   virtual void clearActiveScalarVariableCoupleableVectorTags(const THREAD_ID tid) override;
     266             : 
     267             :   virtual void setActiveScalarVariableCoupleableVectorTags(std::set<TagID> & vtags,
     268             :                                                            const THREAD_ID tid) override;
     269             : 
     270             :   virtual void setActiveScalarVariableCoupleableMatrixTags(std::set<TagID> & mtags,
     271             :                                                            const THREAD_ID tid) override;
     272             : 
     273             :   virtual void createQRules(libMesh::QuadratureType type,
     274             :                             libMesh::Order order,
     275             :                             libMesh::Order volume_order = libMesh::INVALID_ORDER,
     276             :                             libMesh::Order face_order = libMesh::INVALID_ORDER,
     277             :                             SubdomainID block = Moose::ANY_BLOCK_ID,
     278             :                             bool allow_negative_qweights = true);
     279             : 
     280             :   /**
     281             :    * Increases the element/volume quadrature order for the specified mesh
     282             :    * block if and only if the current volume quadrature order is lower.  This
     283             :    * can only cause the quadrature level to increase.  If volume_order is
     284             :    * lower than or equal to the current volume/elem quadrature rule order,
     285             :    * then nothing is done (i.e. this function is idempotent).
     286             :    */
     287             :   void bumpVolumeQRuleOrder(libMesh::Order order, SubdomainID block);
     288             : 
     289             :   void bumpAllQRuleOrder(libMesh::Order order, SubdomainID block);
     290             : 
     291             :   /**
     292             :    * @return The maximum number of quadrature points in use on any element in this problem.
     293             :    */
     294             :   unsigned int getMaxQps() const;
     295             : 
     296             :   /**
     297             :    * @return The maximum order for all scalar variables in this problem's systems.
     298             :    */
     299             :   libMesh::Order getMaxScalarOrder() const;
     300             : 
     301             :   /**
     302             :    * @return Flag indicating nonlocal coupling exists or not.
     303             :    */
     304             :   void checkNonlocalCoupling();
     305             :   void checkUserObjectJacobianRequirement(THREAD_ID tid);
     306             :   void setVariableAllDoFMap(const std::vector<const MooseVariableFEBase *> & moose_vars);
     307             : 
     308             :   const std::vector<const MooseVariableFEBase *> &
     309        1458 :   getUserObjectJacobianVariables(const THREAD_ID tid) const
     310             :   {
     311        1458 :     return _uo_jacobian_moose_vars[tid];
     312             :   }
     313             : 
     314             :   virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override;
     315             :   virtual const Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) const override;
     316             : 
     317             :   /**
     318             :    * Returns a list of all the variables in the problem (both from the NL and Aux systems.
     319             :    */
     320             :   virtual std::vector<VariableName> getVariableNames();
     321             : 
     322             :   void initialSetup() override;
     323             :   void checkDuplicatePostprocessorVariableNames();
     324             :   void timestepSetup() override;
     325             :   void customSetup(const ExecFlagType & exec_type) override;
     326             :   void residualSetup() override;
     327             :   void jacobianSetup() override;
     328             : 
     329             :   virtual void prepare(const Elem * elem, const THREAD_ID tid) override;
     330             :   virtual void prepareFace(const Elem * elem, const THREAD_ID tid) override;
     331             :   virtual void prepare(const Elem * elem,
     332             :                        unsigned int ivar,
     333             :                        unsigned int jvar,
     334             :                        const std::vector<dof_id_type> & dof_indices,
     335             :                        const THREAD_ID tid) override;
     336             : 
     337             :   virtual void setCurrentSubdomainID(const Elem * elem, const THREAD_ID tid) override;
     338             :   virtual void
     339             :   setNeighborSubdomainID(const Elem * elem, unsigned int side, const THREAD_ID tid) override;
     340             :   virtual void setNeighborSubdomainID(const Elem * elem, const THREAD_ID tid);
     341             :   virtual void prepareAssembly(const THREAD_ID tid) override;
     342             : 
     343             :   virtual void addGhostedElem(dof_id_type elem_id) override;
     344             :   virtual void addGhostedBoundary(BoundaryID boundary_id) override;
     345             :   virtual void ghostGhostedBoundaries() override;
     346             : 
     347             :   virtual void sizeZeroes(unsigned int size, const THREAD_ID tid);
     348             :   virtual bool reinitDirac(const Elem * elem, const THREAD_ID tid) override;
     349             : 
     350             :   virtual void reinitElem(const Elem * elem, const THREAD_ID tid) override;
     351             :   virtual void reinitElemPhys(const Elem * elem,
     352             :                               const std::vector<Point> & phys_points_in_elem,
     353             :                               const THREAD_ID tid) override;
     354             :   void reinitElemFace(const Elem * elem, unsigned int side, BoundaryID, const THREAD_ID tid);
     355             :   virtual void reinitElemFace(const Elem * elem, unsigned int side, const THREAD_ID tid) override;
     356             :   virtual void reinitLowerDElem(const Elem * lower_d_elem,
     357             :                                 const THREAD_ID tid,
     358             :                                 const std::vector<Point> * const pts = nullptr,
     359             :                                 const std::vector<Real> * const weights = nullptr) override;
     360             :   virtual void reinitNode(const Node * node, const THREAD_ID tid) override;
     361             :   virtual void reinitNodeFace(const Node * node, BoundaryID bnd_id, const THREAD_ID tid) override;
     362             :   virtual void reinitNodes(const std::vector<dof_id_type> & nodes, const THREAD_ID tid) override;
     363             :   virtual void reinitNodesNeighbor(const std::vector<dof_id_type> & nodes,
     364             :                                    const THREAD_ID tid) override;
     365             :   virtual void reinitNeighbor(const Elem * elem, unsigned int side, const THREAD_ID tid) override;
     366             :   virtual void reinitNeighborPhys(const Elem * neighbor,
     367             :                                   unsigned int neighbor_side,
     368             :                                   const std::vector<Point> & physical_points,
     369             :                                   const THREAD_ID tid) override;
     370             :   virtual void reinitNeighborPhys(const Elem * neighbor,
     371             :                                   const std::vector<Point> & physical_points,
     372             :                                   const THREAD_ID tid) override;
     373             :   virtual void
     374             :   reinitElemNeighborAndLowerD(const Elem * elem, unsigned int side, const THREAD_ID tid) override;
     375             :   virtual void reinitScalars(const THREAD_ID tid,
     376             :                              bool reinit_for_derivative_reordering = false) override;
     377             :   virtual void reinitOffDiagScalars(const THREAD_ID tid) override;
     378             : 
     379             :   /// Fills "elems" with the elements that should be looped over for Dirac Kernels
     380             :   virtual void getDiracElements(std::set<const Elem *> & elems) override;
     381             :   virtual void clearDiracInfo() override;
     382             : 
     383             :   virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid);
     384             :   virtual void neighborSubdomainSetup(SubdomainID subdomain, const THREAD_ID tid);
     385             : 
     386             :   virtual void newAssemblyArray(std::vector<std::shared_ptr<SolverSystem>> & solver_systems);
     387             :   virtual void initNullSpaceVectors(const InputParameters & parameters,
     388             :                                     std::vector<std::shared_ptr<NonlinearSystemBase>> & nl);
     389             : 
     390             :   virtual void init() override;
     391             :   virtual void solve(const unsigned int nl_sys_num);
     392             : 
     393             :   /**
     394             :    * Build and solve a linear system
     395             :    * @param linear_sys_num The number of the linear system (1,..,num. of lin. systems)
     396             :    * @param po The petsc options for the solve, if not supplied, the defaults are used
     397             :    */
     398             :   virtual void solveLinearSystem(const unsigned int linear_sys_num,
     399             :                                  const Moose::PetscSupport::PetscOptions * po = nullptr);
     400             : 
     401             :   ///@{
     402             :   /**
     403             :    * In general, {evaluable elements} >= {local elements} U {algebraic ghosting elements}. That is,
     404             :    * the number of evaluable elements does NOT necessarily equal to the number of local and
     405             :    * algebraic ghosting elements. For example, if using a Lagrange basis for all variables,
     406             :    * if a non-local, non-algebraically-ghosted element is surrounded by neighbors which are
     407             :    * local or algebraically ghosted, then all the nodal (Lagrange) degrees of freedom associated
     408             :    * with the non-local, non-algebraically-ghosted element will be evaluable, and hence that
     409             :    * element will be considered evaluable.
     410             :    *
     411             :    * getNonlinearEvaluableElementRange() returns the evaluable element range based on the nonlinear
     412             :    * system dofmap;
     413             :    * getAuxliaryEvaluableElementRange() returns the evaluable element range based on the auxiliary
     414             :    * system dofmap;
     415             :    * getEvaluableElementRange() returns the element range that is evaluable based on both the
     416             :    * nonlinear dofmap and the auxliary dofmap.
     417             :    */
     418             :   const libMesh::ConstElemRange & getEvaluableElementRange();
     419             :   const libMesh::ConstElemRange & getNonlinearEvaluableElementRange();
     420             :   ///@}
     421             : 
     422             :   ///@{
     423             :   /**
     424             :    * These are the element and nodes that contribute to the jacobian and
     425             :    * residual for this local processor.
     426             :    *
     427             :    * getCurrentAlgebraicElementRange() returns the element range that contributes to the
     428             :    * system
     429             :    * getCurrentAlgebraicNodeRange() returns the node range that contributes to the
     430             :    * system
     431             :    * getCurrentAlgebraicBndNodeRange returns the boundary node ranges that contributes
     432             :    * to the system
     433             :    */
     434             :   const libMesh::ConstElemRange & getCurrentAlgebraicElementRange();
     435             :   const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange();
     436             :   const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange();
     437             :   ///@}
     438             : 
     439             :   ///@{
     440             :   /**
     441             :    * These functions allow setting custom ranges for the algebraic elements, nodes,
     442             :    * and boundary nodes that contribute to the jacobian and residual for this local
     443             :    * processor.
     444             :    *
     445             :    * setCurrentAlgebraicElementRange() sets the element range that contributes to the
     446             :    * system. A nullptr will reset the range to use the mesh's range.
     447             :    *
     448             :    * setCurrentAlgebraicNodeRange() sets the node range that contributes to the
     449             :    * system. A nullptr will reset the range to use the mesh's range.
     450             :    *
     451             :    * setCurrentAlgebraicBndNodeRange() sets the boundary node range that contributes
     452             :    * to the system. A nullptr will reset the range to use the mesh's range.
     453             :    *
     454             :    * @param range A pointer to the const range object representing the algebraic
     455             :    *              elements, nodes, or boundary nodes.
     456             :    */
     457             :   void setCurrentAlgebraicElementRange(libMesh::ConstElemRange * range);
     458             :   void setCurrentAlgebraicNodeRange(libMesh::ConstNodeRange * range);
     459             :   void setCurrentAlgebraicBndNodeRange(ConstBndNodeRange * range);
     460             :   ///@}
     461             : 
     462             :   /**
     463             :    * Set an exception, which is stored at this point by toggling a member variable in
     464             :    * this class, and which must be followed up with by a call to
     465             :    * checkExceptionAndStopSolve().
     466             :    *
     467             :    * @param message The error message describing the exception, which will get printed
     468             :    *                when checkExceptionAndStopSolve() is called
     469             :    */
     470             :   virtual void setException(const std::string & message);
     471             : 
     472             :   /**
     473             :    * Whether or not an exception has occurred.
     474             :    */
     475   478850616 :   virtual bool hasException() { return _has_exception; }
     476             : 
     477             :   /**
     478             :    * Check to see if an exception has occurred on any processor and, if possible,
     479             :    * force the solve to fail, which will result in the time step being cut.
     480             :    *
     481             :    * Notes:
     482             :    *  * The exception have be registered by calling setException() prior to calling this.
     483             :    *  * This is collective on MPI, and must be called simultaneously by all processors!
     484             :    *  * If called when the solve can be interruped, it will do so and also throw a
     485             :    *    MooseException, which must be handled.
     486             :    *  * If called at a stage in the execution when the solve cannot be interupted (i.e.,
     487             :    *    there is no solve active), it will generate an error and terminate the application.
     488             :    *  * DO NOT CALL THIS IN A THREADED REGION! This is meant to be called just after a
     489             :    *    threaded section.
     490             :    *
     491             :    * @param print_message whether to print a message with exception information
     492             :    */
     493             :   virtual void checkExceptionAndStopSolve(bool print_message = true);
     494             : 
     495             :   virtual bool solverSystemConverged(const unsigned int solver_sys_num) override;
     496             :   virtual unsigned int nNonlinearIterations(const unsigned int nl_sys_num) const override;
     497             :   virtual unsigned int nLinearIterations(const unsigned int nl_sys_num) const override;
     498             :   virtual Real finalNonlinearResidual(const unsigned int nl_sys_num) const override;
     499             :   virtual bool computingPreSMOResidual(const unsigned int nl_sys_num) const override;
     500             : 
     501             :   /**
     502             :    * Return solver type as a human readable string
     503             :    */
     504             :   virtual std::string solverTypeString(unsigned int solver_sys_num = 0);
     505             : 
     506             :   /**
     507             :    * Returns true if we are in or beyond the initialSetup stage
     508             :    */
     509       69181 :   virtual bool startedInitialSetup() { return _started_initial_setup; }
     510             : 
     511             :   virtual void onTimestepBegin() override;
     512             :   virtual void onTimestepEnd() override;
     513             : 
     514     9487186 :   virtual Real & time() const { return _time; }
     515      895760 :   virtual Real & timeOld() const { return _time_old; }
     516     1344697 :   virtual int & timeStep() const { return _t_step; }
     517    12459019 :   virtual Real & dt() const { return _dt; }
     518      902951 :   virtual Real & dtOld() const { return _dt_old; }
     519             :   /**
     520             :    * Returns the time associated with the requested \p state
     521             :    */
     522             :   Real getTimeFromStateArg(const Moose::StateArg & state) const;
     523             : 
     524       28533 :   virtual void transient(bool trans) { _transient = trans; }
     525  2283819792 :   virtual bool isTransient() const override { return _transient; }
     526             : 
     527             :   virtual void addTimeIntegrator(const std::string & type,
     528             :                                  const std::string & name,
     529             :                                  InputParameters & parameters);
     530             :   virtual void
     531             :   addPredictor(const std::string & type, const std::string & name, InputParameters & parameters);
     532             : 
     533             :   virtual void copySolutionsBackwards();
     534             : 
     535             :   /**
     536             :    * Advance all of the state holding vectors / datastructures so that we can move to the next
     537             :    * timestep.
     538             :    */
     539             :   virtual void advanceState();
     540             : 
     541             :   virtual void restoreSolutions();
     542             : 
     543             :   /**
     544             :    * Allocate vectors and save old solutions into them.
     545             :    */
     546             :   virtual void saveOldSolutions();
     547             : 
     548             :   /**
     549             :    * Restore old solutions from the backup vectors and deallocate them.
     550             :    */
     551             :   virtual void restoreOldSolutions();
     552             : 
     553             :   /**
     554             :    * Declare that we need up to old (1) or older (2) solution states for a given type of iteration
     555             :    * @param oldest_needed oldest solution state needed
     556             :    * @param iteration_type the type of iteration for which old/older states are needed
     557             :    */
     558             :   void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type);
     559             : 
     560             :   /**
     561             :    * Output the current step.
     562             :    * Will ensure that everything is in the proper state to be outputted.
     563             :    * Then tell the OutputWarehouse to do its thing
     564             :    * @param type The type execution flag (see Moose.h)
     565             :    */
     566             :   virtual void outputStep(ExecFlagType type);
     567             : 
     568             :   /**
     569             :    * Method called at the end of the simulation.
     570             :    */
     571             :   virtual void postExecute();
     572             : 
     573             :   ///@{
     574             :   /**
     575             :    * Ability to enable/disable all output calls
     576             :    *
     577             :    * This is needed by Multiapps and applications to disable output for cases when
     578             :    * executioners call other executions and when Multiapps are sub cycling.
     579             :    */
     580             :   void allowOutput(bool state);
     581             :   template <typename T>
     582             :   void allowOutput(bool state);
     583             :   ///@}
     584             : 
     585             :   /**
     586             :    * Indicates that the next call to outputStep should be forced
     587             :    *
     588             :    * This is needed by the MultiApp system, if forceOutput is called the next call to outputStep,
     589             :    * regardless of the type supplied to the call, will be executed with EXEC_FORCED.
     590             :    *
     591             :    * Forced output will NOT override the allowOutput flag.
     592             :    */
     593             :   void forceOutput();
     594             : 
     595             :   /**
     596             :    * Reinitialize PETSc output for proper linear/nonlinear iteration display. This also may be used
     597             :    * for some PETSc-related solver settings
     598             :    */
     599             :   virtual void initPetscOutputAndSomeSolverSettings();
     600             : 
     601             :   /**
     602             :    * Retrieve a writable reference the PETSc options (used by PetscSupport)
     603             :    */
     604      192751 :   Moose::PetscSupport::PetscOptions & getPetscOptions() { return _petsc_options; }
     605             : 
     606             :   /**
     607             :    * Output information about the object just added to the problem
     608             :    */
     609             :   void logAdd(const std::string & system,
     610             :               const std::string & name,
     611             :               const std::string & type,
     612             :               const InputParameters & params) const;
     613             : 
     614             :   // Function /////
     615             :   virtual void
     616             :   addFunction(const std::string & type, const std::string & name, InputParameters & parameters);
     617             :   virtual bool hasFunction(const std::string & name, const THREAD_ID tid = 0);
     618             :   virtual Function & getFunction(const std::string & name, const THREAD_ID tid = 0);
     619             : 
     620             :   /// Add a MeshDivision
     621             :   virtual void
     622             :   addMeshDivision(const std::string & type, const std::string & name, InputParameters & params);
     623             :   /// Get a MeshDivision
     624             :   MeshDivision & getMeshDivision(const std::string & name, const THREAD_ID tid = 0) const;
     625             : 
     626             :   /// Adds a Convergence object
     627             :   virtual void
     628             :   addConvergence(const std::string & type, const std::string & name, InputParameters & parameters);
     629             :   /// Gets a Convergence object
     630             :   virtual Convergence & getConvergence(const std::string & name, const THREAD_ID tid = 0) const;
     631             :   /// Gets the Convergence objects
     632             :   virtual const std::vector<std::shared_ptr<Convergence>> &
     633             :   getConvergenceObjects(const THREAD_ID tid = 0) const;
     634             :   /// Returns true if the problem has a Convergence object of the given name
     635             :   virtual bool hasConvergence(const std::string & name, const THREAD_ID tid = 0) const;
     636             :   /// Returns true if the problem needs to add the default nonlinear convergence
     637       57717 :   bool needToAddDefaultNonlinearConvergence() const
     638             :   {
     639       57717 :     return _need_to_add_default_nonlinear_convergence;
     640             :   }
     641             :   /// Returns true if the problem needs to add the default fixed point convergence
     642       57705 :   bool needToAddDefaultMultiAppFixedPointConvergence() const
     643             :   {
     644       57705 :     return _need_to_add_default_multiapp_fixed_point_convergence;
     645             :   }
     646             :   /// Sets _need_to_add_default_nonlinear_convergence to true
     647       57367 :   void setNeedToAddDefaultNonlinearConvergence()
     648             :   {
     649       57367 :     _need_to_add_default_nonlinear_convergence = true;
     650       57367 :   }
     651             :   /// Sets _need_to_add_default_multiapp_fixed_point_convergence to true
     652       57745 :   void setNeedToAddDefaultMultiAppFixedPointConvergence()
     653             :   {
     654       57745 :     _need_to_add_default_multiapp_fixed_point_convergence = true;
     655       57745 :   }
     656             :   /// Returns true if the problem has set the fixed point convergence name
     657       57693 :   bool hasSetMultiAppFixedPointConvergenceName() const
     658             :   {
     659       57693 :     return _multiapp_fixed_point_convergence_name.has_value();
     660             :   }
     661             :   /**
     662             :    * Adds the default nonlinear Convergence associated with the problem
     663             :    *
     664             :    * This is called if the user does not supply 'nonlinear_convergence'.
     665             :    *
     666             :    * @param[in] params   Parameters to apply to Convergence parameters
     667             :    */
     668             :   virtual void addDefaultNonlinearConvergence(const InputParameters & params);
     669             :   /**
     670             :    * Returns true if an error will result if the user supplies 'nonlinear_convergence'
     671             :    *
     672             :    * Some problems are strongly tied to their convergence, and it does not make
     673             :    * sense to use any convergence other than their default and additionally
     674             :    * would be error-prone.
     675             :    */
     676         292 :   virtual bool onlyAllowDefaultNonlinearConvergence() const { return false; }
     677             :   /**
     678             :    * Adds the default fixed point Convergence associated with the problem
     679             :    *
     680             :    * This is called if the user does not supply 'multiapp_fixed_point_convergence'.
     681             :    *
     682             :    * @param[in] params   Parameters to apply to Convergence parameters
     683             :    */
     684             :   void addDefaultMultiAppFixedPointConvergence(const InputParameters & params);
     685             : 
     686             :   /**
     687             :    * add a MOOSE line search
     688             :    */
     689           0 :   virtual void addLineSearch(const InputParameters & /*parameters*/)
     690             :   {
     691           0 :     mooseError("Line search not implemented for this problem type yet.");
     692             :   }
     693             : 
     694             :   /**
     695             :    * execute MOOSE line search
     696             :    */
     697             :   virtual void lineSearch();
     698             : 
     699             :   /**
     700             :    * getter for the MOOSE line search
     701             :    */
     702           0 :   LineSearch * getLineSearch() override { return _line_search.get(); }
     703             : 
     704             :   /**
     705             :    * The following functions will enable MOOSE to have the capability to import distributions
     706             :    */
     707             :   virtual void
     708             :   addDistribution(const std::string & type, const std::string & name, InputParameters & parameters);
     709             :   virtual Distribution & getDistribution(const std::string & name);
     710             : 
     711             :   /**
     712             :    * The following functions will enable MOOSE to have the capability to import Samplers
     713             :    */
     714             :   virtual void
     715             :   addSampler(const std::string & type, const std::string & name, InputParameters & parameters);
     716             :   virtual Sampler & getSampler(const std::string & name, const THREAD_ID tid = 0);
     717             : 
     718             :   // NL /////
     719             :   NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num);
     720             :   const NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num) const;
     721             :   void setCurrentNonlinearSystem(const unsigned int nl_sys_num);
     722             :   NonlinearSystemBase & currentNonlinearSystem();
     723             :   const NonlinearSystemBase & currentNonlinearSystem() const;
     724             : 
     725             :   virtual const SystemBase & systemBaseNonlinear(const unsigned int sys_num) const override;
     726             :   virtual SystemBase & systemBaseNonlinear(const unsigned int sys_num) override;
     727             : 
     728             :   virtual const SystemBase & systemBaseSolver(const unsigned int sys_num) const override;
     729             :   virtual SystemBase & systemBaseSolver(const unsigned int sys_num) override;
     730             : 
     731             :   virtual const SystemBase & systemBaseAuxiliary() const override;
     732             :   virtual SystemBase & systemBaseAuxiliary() override;
     733             : 
     734             :   virtual NonlinearSystem & getNonlinearSystem(const unsigned int sys_num);
     735             : 
     736             :   /**
     737             :    * Get constant reference to a system in this problem
     738             :    * @param sys_num The number of the system
     739             :    */
     740             :   virtual const SystemBase & getSystemBase(const unsigned int sys_num) const;
     741             : 
     742             :   /**
     743             :    * Get non-constant reference to a system in this problem
     744             :    * @param sys_num The number of the system
     745             :    */
     746             :   virtual SystemBase & getSystemBase(const unsigned int sys_num);
     747             : 
     748             :   /**
     749             :    * Get non-constant reference to a linear system
     750             :    * @param sys_num The number of the linear system
     751             :    */
     752             :   LinearSystem & getLinearSystem(unsigned int sys_num);
     753             : 
     754             :   /**
     755             :    * Get a constant reference to a linear system
     756             :    * @param sys_num The number of the linear system
     757             :    */
     758             :   const LinearSystem & getLinearSystem(unsigned int sys_num) const;
     759             : 
     760             :   /**
     761             :    * Get non-constant reference to a solver system
     762             :    * @param sys_num The number of the solver system
     763             :    */
     764             :   SolverSystem & getSolverSystem(unsigned int sys_num);
     765             : 
     766             :   /**
     767             :    * Get a constant reference to a solver system
     768             :    * @param sys_num The number of the solver system
     769             :    */
     770             :   const SolverSystem & getSolverSystem(unsigned int sys_num) const;
     771             : 
     772             :   /**
     773             :    * Set the current linear system pointer
     774             :    * @param sys_num The number of linear system
     775             :    */
     776             :   void setCurrentLinearSystem(unsigned int sys_num);
     777             : 
     778             :   /// Get a non-constant reference to the current linear system
     779             :   LinearSystem & currentLinearSystem();
     780             :   /// Get a constant reference to the current linear system
     781             :   const LinearSystem & currentLinearSystem() const;
     782             : 
     783             :   /**
     784             :    * Get a constant base class reference to a linear system
     785             :    * @param sys_num The number of the linear system
     786             :    */
     787             :   virtual const SystemBase & systemBaseLinear(unsigned int sys_num) const override;
     788             : 
     789             :   /**
     790             :    * Get a non-constant base class reference to a linear system
     791             :    * @param sys_num The number of the linear system
     792             :    */
     793             :   virtual SystemBase & systemBaseLinear(unsigned int sys_num) override;
     794             : 
     795             :   /**
     796             :    * Canonical method for adding a non-linear variable
     797             :    * @param var_type the type of the variable, e.g. MooseVariableScalar
     798             :    * @param var_name the variable name, e.g. 'u'
     799             :    * @param params the InputParameters from which to construct the variable
     800             :    */
     801             :   virtual void
     802             :   addVariable(const std::string & var_type, const std::string & var_name, InputParameters & params);
     803             : 
     804             :   virtual void addKernel(const std::string & kernel_name,
     805             :                          const std::string & name,
     806             :                          InputParameters & parameters);
     807             :   virtual void addHDGKernel(const std::string & kernel_name,
     808             :                             const std::string & name,
     809             :                             InputParameters & parameters);
     810             :   virtual void addNodalKernel(const std::string & kernel_name,
     811             :                               const std::string & name,
     812             :                               InputParameters & parameters);
     813             :   virtual void addScalarKernel(const std::string & kernel_name,
     814             :                                const std::string & name,
     815             :                                InputParameters & parameters);
     816             :   virtual void addBoundaryCondition(const std::string & bc_name,
     817             :                                     const std::string & name,
     818             :                                     InputParameters & parameters);
     819             :   virtual void
     820             :   addConstraint(const std::string & c_name, const std::string & name, InputParameters & parameters);
     821             : 
     822     1583264 :   virtual void setInputParametersFEProblem(InputParameters & parameters)
     823             :   {
     824     1583264 :     parameters.set<FEProblemBase *>("_fe_problem_base") = this;
     825     1583264 :   }
     826             : 
     827             :   // Aux /////
     828             : 
     829             :   /**
     830             :    * Canonical method for adding an auxiliary variable
     831             :    * @param var_type the type of the variable, e.g. MooseVariableScalar
     832             :    * @param var_name the variable name, e.g. 'u'
     833             :    * @param params the InputParameters from which to construct the variable
     834             :    */
     835             :   virtual void addAuxVariable(const std::string & var_type,
     836             :                               const std::string & var_name,
     837             :                               InputParameters & params);
     838             : 
     839             :   virtual void addAuxVariable(const std::string & var_name,
     840             :                               const libMesh::FEType & type,
     841             :                               const std::set<SubdomainID> * const active_subdomains = NULL);
     842             :   virtual void addAuxArrayVariable(const std::string & var_name,
     843             :                                    const libMesh::FEType & type,
     844             :                                    unsigned int components,
     845             :                                    const std::set<SubdomainID> * const active_subdomains = NULL);
     846             :   virtual void addAuxScalarVariable(const std::string & var_name,
     847             :                                     libMesh::Order order,
     848             :                                     Real scale_factor = 1.,
     849             :                                     const std::set<SubdomainID> * const active_subdomains = NULL);
     850             :   virtual void addAuxKernel(const std::string & kernel_name,
     851             :                             const std::string & name,
     852             :                             InputParameters & parameters);
     853             :   virtual void addAuxScalarKernel(const std::string & kernel_name,
     854             :                                   const std::string & name,
     855             :                                   InputParameters & parameters);
     856             : 
     857     4948612 :   AuxiliarySystem & getAuxiliarySystem() { return *_aux; }
     858             : 
     859             :   // Dirac /////
     860             :   virtual void addDiracKernel(const std::string & kernel_name,
     861             :                               const std::string & name,
     862             :                               InputParameters & parameters);
     863             : 
     864             :   // DG /////
     865             :   virtual void addDGKernel(const std::string & kernel_name,
     866             :                            const std::string & name,
     867             :                            InputParameters & parameters);
     868             :   // FV /////
     869             :   virtual void addFVKernel(const std::string & kernel_name,
     870             :                            const std::string & name,
     871             :                            InputParameters & parameters);
     872             : 
     873             :   virtual void addLinearFVKernel(const std::string & kernel_name,
     874             :                                  const std::string & name,
     875             :                                  InputParameters & parameters);
     876             :   virtual void
     877             :   addFVBC(const std::string & fv_bc_name, const std::string & name, InputParameters & parameters);
     878             :   virtual void addLinearFVBC(const std::string & fv_bc_name,
     879             :                              const std::string & name,
     880             :                              InputParameters & parameters);
     881             : 
     882             :   virtual void addFVInterfaceKernel(const std::string & fv_ik_name,
     883             :                                     const std::string & name,
     884             :                                     InputParameters & parameters);
     885             : 
     886             :   // Interface /////
     887             :   virtual void addInterfaceKernel(const std::string & kernel_name,
     888             :                                   const std::string & name,
     889             :                                   InputParameters & parameters);
     890             : 
     891             :   // IC /////
     892             :   virtual void addInitialCondition(const std::string & ic_name,
     893             :                                    const std::string & name,
     894             :                                    InputParameters & parameters);
     895             :   /**
     896             :    * Add an initial condition for a finite volume variables
     897             :    * @param ic_name The name of the boundary condition object
     898             :    * @param name The user-defined name from the input file
     899             :    * @param parameters The input parameters for construction
     900             :    */
     901             :   virtual void addFVInitialCondition(const std::string & ic_name,
     902             :                                      const std::string & name,
     903             :                                      InputParameters & parameters);
     904             : 
     905             :   void projectSolution();
     906             : 
     907             :   /**
     908             :    *  Retrieves the current initial condition state.
     909             :    * @return  current initial condition state
     910             :    */
     911             :   unsigned short getCurrentICState();
     912             : 
     913             :   /**
     914             :    * Project initial conditions for custom \p elem_range and \p bnd_node_range
     915             :    * This is needed when elements/boundary nodes are added to a specific subdomain
     916             :    * at an intermediate step
     917             :    */
     918             :   void projectInitialConditionOnCustomRange(libMesh::ConstElemRange & elem_range,
     919             :                                             ConstBndNodeRange & bnd_node_range);
     920             : 
     921             :   // Materials /////
     922             :   virtual void addMaterial(const std::string & material_name,
     923             :                            const std::string & name,
     924             :                            InputParameters & parameters);
     925             :   virtual void addMaterialHelper(std::vector<MaterialWarehouse *> warehouse,
     926             :                                  const std::string & material_name,
     927             :                                  const std::string & name,
     928             :                                  InputParameters & parameters);
     929             :   virtual void addInterfaceMaterial(const std::string & material_name,
     930             :                                     const std::string & name,
     931             :                                     InputParameters & parameters);
     932             :   virtual void addFunctorMaterial(const std::string & functor_material_name,
     933             :                                   const std::string & name,
     934             :                                   InputParameters & parameters);
     935             : 
     936             :   /**
     937             :    * Add the MooseVariables and the material properties that the current materials depend on to the
     938             :    * dependency list.
     939             :    * @param consumer_needed_mat_props The material properties needed by consumer objects (other than
     940             :    * the materials themselves)
     941             :    * @param blk_id The subdomain ID for which we are preparing our list of needed vars and props
     942             :    * @param tid The thread ID we are preparing the requirements for
     943             :    *
     944             :    * This MUST be done after the moose variable dependency list has been set for all the other
     945             :    * objects using the \p setActiveElementalMooseVariables API!
     946             :    */
     947             :   void prepareMaterials(const std::unordered_set<unsigned int> & consumer_needed_mat_props,
     948             :                         const SubdomainID blk_id,
     949             :                         const THREAD_ID tid);
     950             : 
     951             :   void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful = true);
     952             : 
     953             :   /**
     954             :    * reinit materials on element faces
     955             :    * @param blk_id The subdomain on which the element owning the face lives
     956             :    * @param tid The thread id
     957             :    * @param swap_stateful Whether to swap stateful material properties between \p MaterialData and
     958             :    * \p MaterialPropertyStorage
     959             :    * @param execute_stateful Whether to execute material objects that have stateful properties. This
     960             :    * should be \p false when for example executing material objects for mortar contexts in which
     961             :    * stateful properties don't make sense
     962             :    */
     963             :   void reinitMaterialsFace(SubdomainID blk_id,
     964             :                            const THREAD_ID tid,
     965             :                            bool swap_stateful = true,
     966             :                            const std::deque<MaterialBase *> * reinit_mats = nullptr);
     967             : 
     968             :   /**
     969             :    * reinit materials on the neighboring element face
     970             :    * @param blk_id The subdomain on which the neighbor element lives
     971             :    * @param tid The thread id
     972             :    * @param swap_stateful Whether to swap stateful material properties between \p MaterialData and
     973             :    * \p MaterialPropertyStorage
     974             :    * @param execute_stateful Whether to execute material objects that have stateful properties. This
     975             :    * should be \p false when for example executing material objects for mortar contexts in which
     976             :    * stateful properties don't make sense
     977             :    */
     978             :   void reinitMaterialsNeighbor(SubdomainID blk_id,
     979             :                                const THREAD_ID tid,
     980             :                                bool swap_stateful = true,
     981             :                                const std::deque<MaterialBase *> * reinit_mats = nullptr);
     982             : 
     983             :   /**
     984             :    * reinit materials on a boundary
     985             :    * @param boundary_id The boundary on which to reinit corresponding materials
     986             :    * @param tid The thread id
     987             :    * @param swap_stateful Whether to swap stateful material properties between \p MaterialData and
     988             :    * \p MaterialPropertyStorage
     989             :    * @param execute_stateful Whether to execute material objects that have stateful properties.
     990             :    * This should be \p false when for example executing material objects for mortar contexts in
     991             :    * which stateful properties don't make sense
     992             :    */
     993             :   void reinitMaterialsBoundary(BoundaryID boundary_id,
     994             :                                const THREAD_ID tid,
     995             :                                bool swap_stateful = true,
     996             :                                const std::deque<MaterialBase *> * reinit_mats = nullptr);
     997             : 
     998             :   void
     999             :   reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful = true);
    1000             : 
    1001             :   /*
    1002             :    * Swap back underlying data storing stateful material properties
    1003             :    */
    1004             :   virtual void swapBackMaterials(const THREAD_ID tid);
    1005             :   virtual void swapBackMaterialsFace(const THREAD_ID tid);
    1006             :   virtual void swapBackMaterialsNeighbor(const THREAD_ID tid);
    1007             : 
    1008             :   /**
    1009             :    * Record and set the material properties required by the current computing thread.
    1010             :    * @param mat_prop_ids The set of material properties required by the current computing thread.
    1011             :    *
    1012             :    * @param tid The thread id
    1013             :    */
    1014             :   void setActiveMaterialProperties(const std::unordered_set<unsigned int> & mat_prop_ids,
    1015             :                                    const THREAD_ID tid);
    1016             : 
    1017             :   /**
    1018             :    * Method to check whether or not a list of active material roperties has been set. This method
    1019             :    * is called by reinitMaterials to determine whether Material computeProperties methods need to be
    1020             :    * called. If the return is False, this check prevents unnecessary material property computation
    1021             :    * @param tid The thread id
    1022             :    *
    1023             :    * @return True if there has been a list of active material properties set, False otherwise
    1024             :    */
    1025             :   bool hasActiveMaterialProperties(const THREAD_ID tid) const;
    1026             : 
    1027             :   /**
    1028             :    * Clear the active material properties. Should be called at the end of every computing thread
    1029             :    *
    1030             :    * @param tid The thread id
    1031             :    */
    1032             :   void clearActiveMaterialProperties(const THREAD_ID tid);
    1033             : 
    1034             :   /**
    1035             :    * Method for creating and adding an object to the warehouse.
    1036             :    *
    1037             :    * @tparam T The base object type (registered in the Factory)
    1038             :    * @param type String type of the object (registered in the Factory)
    1039             :    * @param name Name for the object to be created
    1040             :    * @param parameters InputParameters for the object
    1041             :    * @param threaded Whether or not to create n_threads copies of the object
    1042             :    * @param var_param_name The name of the parameter on the object which holds the primary variable.
    1043             :    * @return A vector of shared_ptrs to the added objects
    1044             :    */
    1045             :   template <typename T>
    1046             :   std::vector<std::shared_ptr<T>> addObject(const std::string & type,
    1047             :                                             const std::string & name,
    1048             :                                             InputParameters & parameters,
    1049             :                                             const bool threaded = true,
    1050             :                                             const std::string & var_param_name = "variable");
    1051             : 
    1052             :   // Postprocessors /////
    1053             :   virtual void addPostprocessor(const std::string & pp_name,
    1054             :                                 const std::string & name,
    1055             :                                 InputParameters & parameters);
    1056             : 
    1057             :   // VectorPostprocessors /////
    1058             :   virtual void addVectorPostprocessor(const std::string & pp_name,
    1059             :                                       const std::string & name,
    1060             :                                       InputParameters & parameters);
    1061             : 
    1062             :   /**
    1063             :    * Add a Reporter object to the simulation.
    1064             :    * @param type C++ object type to construct
    1065             :    * @param name A uniquely identifying object name
    1066             :    * @param parameters Complete parameters for the object to be created.
    1067             :    *
    1068             :    * For an example use, refer to AddReporterAction.C/h
    1069             :    */
    1070             :   virtual void
    1071             :   addReporter(const std::string & type, const std::string & name, InputParameters & parameters);
    1072             : 
    1073             :   /**
    1074             :    * Provides const access the ReporterData object.
    1075             :    *
    1076             :    * NOTE: There is a private non-const version of this function that uses a key object only
    1077             :    *       constructable by the correct interfaces. This was done by design to encourage the use of
    1078             :    *       the Reporter and ReporterInterface classes.
    1079             :    */
    1080      716698 :   const ReporterData & getReporterData() const { return _reporter_data; }
    1081             : 
    1082             :   /**
    1083             :    * Provides non-const access the ReporterData object that is used to store reporter values.
    1084             :    *
    1085             :    * see ReporterData.h
    1086             :    */
    1087      142369 :   ReporterData & getReporterData(ReporterData::WriteKey /*key*/) { return _reporter_data; }
    1088             : 
    1089             :   // UserObjects /////
    1090             :   virtual std::vector<std::shared_ptr<UserObject>> addUserObject(
    1091             :       const std::string & user_object_name, const std::string & name, InputParameters & parameters);
    1092             : 
    1093             :   // TODO: delete this function after apps have been updated to not call it
    1094             :   const ExecuteMooseObjectWarehouse<UserObject> & getUserObjects() const
    1095             :   {
    1096             :     mooseDeprecated(
    1097             :         "This function is deprecated, use theWarehouse().query() to construct a query instead");
    1098             :     return _all_user_objects;
    1099             :   }
    1100             : 
    1101             :   /**
    1102             :    * Get the user object by its name
    1103             :    * @param name The name of the user object being retrieved
    1104             :    * @return Const reference to the user object
    1105             :    */
    1106             :   template <class T>
    1107       10436 :   T & getUserObject(const std::string & name, unsigned int tid = 0) const
    1108             :   {
    1109       10436 :     std::vector<T *> objs;
    1110       10436 :     theWarehouse()
    1111             :         .query()
    1112       20872 :         .condition<AttribSystem>("UserObject")
    1113       10436 :         .condition<AttribThread>(tid)
    1114       10436 :         .condition<AttribName>(name)
    1115       10436 :         .queryInto(objs);
    1116       10436 :     if (objs.empty())
    1117           0 :       mooseError("Unable to find user object with name '" + name + "'");
    1118       20872 :     return *(objs[0]);
    1119       10436 :   }
    1120             :   /**
    1121             :    * Get the user object by its name
    1122             :    * @param name The name of the user object being retrieved
    1123             :    * @param tid The thread of the user object (defaults to 0)
    1124             :    * @return Const reference to the user object
    1125             :    */
    1126             :   const UserObject & getUserObjectBase(const std::string & name, const THREAD_ID tid = 0) const;
    1127             : 
    1128             :   /**
    1129             :    * Get the Positions object by its name
    1130             :    * @param name The name of the Positions object being retrieved
    1131             :    * @return Const reference to the Positions object
    1132             :    */
    1133             :   const Positions & getPositionsObject(const std::string & name) const;
    1134             : 
    1135             :   /**
    1136             :    * Check if there if a user object of given name
    1137             :    * @param name The name of the user object being checked for
    1138             :    * @return true if the user object exists, false otherwise
    1139             :    */
    1140             :   bool hasUserObject(const std::string & name) const;
    1141             : 
    1142             :   /**
    1143             :    * Whether or not a Postprocessor value exists by a given name.
    1144             :    * @param name The name of the Postprocessor
    1145             :    * @return True if a Postprocessor value exists
    1146             :    *
    1147             :    * Note: You should prioritize the use of PostprocessorInterface::hasPostprocessor
    1148             :    * and PostprocessorInterface::hasPostprocessorByName over this method when possible.
    1149             :    */
    1150             :   bool hasPostprocessorValueByName(const PostprocessorName & name) const;
    1151             : 
    1152             :   /**
    1153             :    * Get a read-only reference to the value associated with a Postprocessor that exists.
    1154             :    * @param name The name of the post-processor
    1155             :    * @param t_index Flag for getting current (0), old (1), or older (2) values
    1156             :    * @return The reference to the value at the given time index
    1157             :    *
    1158             :    * Note: This method is only for retrieving values that already exist, the Postprocessor and
    1159             :    *       PostprocessorInterface objects should be used rather than this method for creating
    1160             :    *       and getting values within objects.
    1161             :    */
    1162             :   const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName & name,
    1163             :                                                          std::size_t t_index = 0) const;
    1164             : 
    1165             :   /**
    1166             :    * Set the value of a PostprocessorValue.
    1167             :    * @param name The name of the post-processor
    1168             :    * @param t_index Flag for getting current (0), old (1), or older (2) values
    1169             :    * @return The reference to the value at the given time index
    1170             :    *
    1171             :    * Note: This method is only for setting values that already exist, the Postprocessor and
    1172             :    *       PostprocessorInterface objects should be used rather than this method for creating
    1173             :    *       and getting values within objects.
    1174             :    *
    1175             :    * WARNING!
    1176             :    * This method should be used with caution. It exists to allow Transfers and other
    1177             :    * similar objects to modify Postprocessor values. It is not intended for general use.
    1178             :    */
    1179             :   void setPostprocessorValueByName(const PostprocessorName & name,
    1180             :                                    const PostprocessorValue & value,
    1181             :                                    std::size_t t_index = 0);
    1182             : 
    1183             :   /**
    1184             :    * Deprecated. Use hasPostprocessorValueByName
    1185             :    */
    1186             :   bool hasPostprocessor(const std::string & name) const;
    1187             : 
    1188             :   /**
    1189             :    * Get a read-only reference to the vector value associated with the VectorPostprocessor.
    1190             :    * @param object_name The name of the VPP object.
    1191             :    * @param vector_name The namve of the decalred vector within the object.
    1192             :    * @return Referent to the vector of data.
    1193             :    *
    1194             :    * Note: This method is only for retrieving values that already exist, the VectorPostprocessor and
    1195             :    *       VectorPostprocessorInterface objects should be used rather than this method for creating
    1196             :    *       and getting values within objects.
    1197             :    */
    1198             :   const VectorPostprocessorValue &
    1199             :   getVectorPostprocessorValueByName(const std::string & object_name,
    1200             :                                     const std::string & vector_name,
    1201             :                                     std::size_t t_index = 0) const;
    1202             : 
    1203             :   /**
    1204             :    * Set the value of a VectorPostprocessor vector
    1205             :    * @param object_name The name of the VPP object
    1206             :    * @param vector_name The name of the declared vector
    1207             :    * @param value The data to apply to the vector
    1208             :    * @param t_index Flag for getting current (0), old (1), or older (2) values
    1209             :    */
    1210             :   void setVectorPostprocessorValueByName(const std::string & object_name,
    1211             :                                          const std::string & vector_name,
    1212             :                                          const VectorPostprocessorValue & value,
    1213             :                                          std::size_t t_index = 0);
    1214             : 
    1215             :   /**
    1216             :    * Return the VPP object given the name.
    1217             :    * @param object_name The name of the VPP object
    1218             :    * @return Desired VPP object
    1219             :    *
    1220             :    * This is used by various output objects as well as the scatter value handling.
    1221             :    * @see CSV.C, XMLOutput.C, VectorPostprocessorInterface.C
    1222             :    */
    1223             :   const VectorPostprocessor & getVectorPostprocessorObjectByName(const std::string & object_name,
    1224             :                                                                  const THREAD_ID tid = 0) const;
    1225             : 
    1226             :   ///@{
    1227             :   /**
    1228             :    * Returns whether or not the current simulation has any multiapps
    1229             :    */
    1230         802 :   bool hasMultiApps() const { return _multi_apps.hasActiveObjects(); }
    1231             :   bool hasMultiApps(ExecFlagType type) const;
    1232             :   bool hasMultiApp(const std::string & name) const;
    1233             :   ///@}
    1234             : 
    1235             :   // Dampers /////
    1236             :   virtual void addDamper(const std::string & damper_name,
    1237             :                          const std::string & name,
    1238             :                          InputParameters & parameters);
    1239             :   void setupDampers();
    1240             : 
    1241             :   /**
    1242             :    * Whether or not this system has dampers.
    1243             :    */
    1244      340443 :   bool hasDampers() { return _has_dampers; }
    1245             : 
    1246             :   // Indicators /////
    1247             :   virtual void addIndicator(const std::string & indicator_name,
    1248             :                             const std::string & name,
    1249             :                             InputParameters & parameters);
    1250             : 
    1251             :   // Markers //////
    1252             :   virtual void addMarker(const std::string & marker_name,
    1253             :                          const std::string & name,
    1254             :                          InputParameters & parameters);
    1255             : 
    1256             :   /**
    1257             :    * Add a MultiApp to the problem.
    1258             :    */
    1259             :   virtual void addMultiApp(const std::string & multi_app_name,
    1260             :                            const std::string & name,
    1261             :                            InputParameters & parameters);
    1262             : 
    1263             :   /**
    1264             :    * Get a MultiApp object by name.
    1265             :    */
    1266             :   std::shared_ptr<MultiApp> getMultiApp(const std::string & multi_app_name) const;
    1267             : 
    1268             :   /**
    1269             :    * Get Transfers by ExecFlagType and direction
    1270             :    */
    1271             :   std::vector<std::shared_ptr<Transfer>> getTransfers(ExecFlagType type,
    1272             :                                                       Transfer::DIRECTION direction) const;
    1273             :   std::vector<std::shared_ptr<Transfer>> getTransfers(Transfer::DIRECTION direction) const;
    1274             : 
    1275             :   /**
    1276             :    * Return the complete warehouse for MultiAppTransfer object for the given direction
    1277             :    */
    1278             :   const ExecuteMooseObjectWarehouse<Transfer> &
    1279             :   getMultiAppTransferWarehouse(Transfer::DIRECTION direction) const;
    1280             : 
    1281             :   /**
    1282             :    * Execute MultiAppTransfers associated with execution flag and direction.
    1283             :    * @param type The execution flag to execute.
    1284             :    * @param direction The direction (to or from) to transfer.
    1285             :    */
    1286             :   void execMultiAppTransfers(ExecFlagType type, Transfer::DIRECTION direction);
    1287             : 
    1288             :   /**
    1289             :    * Execute the MultiApps associated with the ExecFlagType
    1290             :    */
    1291             :   bool execMultiApps(ExecFlagType type, bool auto_advance = true);
    1292             : 
    1293             :   void finalizeMultiApps();
    1294             : 
    1295             :   /**
    1296             :    * Advance the MultiApps t_step (incrementStepOrReject) associated with the ExecFlagType
    1297             :    */
    1298             :   void incrementMultiAppTStep(ExecFlagType type);
    1299             : 
    1300             :   /**
    1301             :    * Deprecated method; use finishMultiAppStep and/or incrementMultiAppTStep depending
    1302             :    * on your purpose
    1303             :    */
    1304             :   void advanceMultiApps(ExecFlagType type)
    1305             :   {
    1306             :     mooseDeprecated("Deprecated method; use finishMultiAppStep and/or incrementMultiAppTStep "
    1307             :                     "depending on your purpose");
    1308             :     finishMultiAppStep(type);
    1309             :   }
    1310             : 
    1311             :   /**
    1312             :    * Finish the MultiApp time step (endStep, postStep) associated with the ExecFlagType. Optionally
    1313             :    * recurse through all multi-app levels
    1314             :    */
    1315             :   void finishMultiAppStep(ExecFlagType type, bool recurse_through_multiapp_levels = false);
    1316             : 
    1317             :   /**
    1318             :    * Backup the MultiApps associated with the ExecFlagType
    1319             :    */
    1320             :   void backupMultiApps(ExecFlagType type);
    1321             : 
    1322             :   /**
    1323             :    * Restore the MultiApps associated with the ExecFlagType
    1324             :    * @param force Force restoration because something went wrong with the solve
    1325             :    */
    1326             :   void restoreMultiApps(ExecFlagType type, bool force = false);
    1327             : 
    1328             :   /**
    1329             :    * Find the smallest timestep over all MultiApps
    1330             :    */
    1331             :   Real computeMultiAppsDT(ExecFlagType type);
    1332             : 
    1333             :   /**
    1334             :    * Add a Transfer to the problem.
    1335             :    */
    1336             :   virtual void addTransfer(const std::string & transfer_name,
    1337             :                            const std::string & name,
    1338             :                            InputParameters & parameters);
    1339             : 
    1340             :   /**
    1341             :    * Execute the Transfers associated with the ExecFlagType
    1342             :    *
    1343             :    * Note: This does _not_ execute MultiApp Transfers!
    1344             :    * Those are executed automatically when MultiApps are executed.
    1345             :    */
    1346             :   void execTransfers(ExecFlagType type);
    1347             : 
    1348             :   /**
    1349             :    * Computes the residual of a nonlinear system using whatever is sitting in the current
    1350             :    * solution vector then returns the L2 norm.
    1351             :    */
    1352             :   Real computeResidualL2Norm(NonlinearSystemBase & sys);
    1353             : 
    1354             :   /**
    1355             :    * Computes the residual of a linear system using whatever is sitting in the current
    1356             :    * solution vector then returns the L2 norm.
    1357             :    */
    1358             :   Real computeResidualL2Norm(LinearSystem & sys);
    1359             : 
    1360             :   /**
    1361             :    * Computes the residual using whatever is sitting in the current solution vector then returns the
    1362             :    * L2 norm.
    1363             :    *
    1364             :    * @return The L2 norm of the residual
    1365             :    */
    1366             :   virtual Real computeResidualL2Norm();
    1367             : 
    1368             :   /**
    1369             :    * This function is called by Libmesh to form a residual.
    1370             :    */
    1371             :   virtual void computeResidualSys(libMesh::NonlinearImplicitSystem & sys,
    1372             :                                   const NumericVector<libMesh::Number> & soln,
    1373             :                                   NumericVector<libMesh::Number> & residual);
    1374             :   /**
    1375             :    * This function is called by Libmesh to form a residual. This is deprecated.
    1376             :    * We should remove this as soon as RattleSnake is fixed.
    1377             :    */
    1378             :   void computeResidual(libMesh::NonlinearImplicitSystem & sys,
    1379             :                        const NumericVector<libMesh::Number> & soln,
    1380             :                        NumericVector<libMesh::Number> & residual);
    1381             : 
    1382             :   /**
    1383             :    * Form a residual with default tags (nontime, time, residual).
    1384             :    */
    1385             :   virtual void computeResidual(const NumericVector<libMesh::Number> & soln,
    1386             :                                NumericVector<libMesh::Number> & residual,
    1387             :                                const unsigned int nl_sys_num);
    1388             : 
    1389             :   /**
    1390             :    * Form a residual and Jacobian with default tags
    1391             :    */
    1392             :   void computeResidualAndJacobian(const NumericVector<libMesh::Number> & soln,
    1393             :                                   NumericVector<libMesh::Number> & residual,
    1394             :                                   libMesh::SparseMatrix<libMesh::Number> & jacobian);
    1395             : 
    1396             :   /**
    1397             :    * Form a residual vector for a given tag
    1398             :    */
    1399             :   virtual void computeResidualTag(const NumericVector<libMesh::Number> & soln,
    1400             :                                   NumericVector<libMesh::Number> & residual,
    1401             :                                   TagID tag);
    1402             :   /**
    1403             :    * Form a residual vector for a given tag and "residual" tag
    1404             :    */
    1405             :   virtual void computeResidualType(const NumericVector<libMesh::Number> & soln,
    1406             :                                    NumericVector<libMesh::Number> & residual,
    1407             :                                    TagID tag);
    1408             : 
    1409             :   /**
    1410             :    * Form a residual vector for a set of tags. It should not be called directly
    1411             :    * by users.
    1412             :    */
    1413             :   virtual void computeResidualInternal(const NumericVector<libMesh::Number> & soln,
    1414             :                                        NumericVector<libMesh::Number> & residual,
    1415             :                                        const std::set<TagID> & tags);
    1416             :   /**
    1417             :    * Form multiple residual vectors and each is associated with one tag
    1418             :    */
    1419             :   virtual void computeResidualTags(const std::set<TagID> & tags);
    1420             : 
    1421             :   /**
    1422             :    * Form a Jacobian matrix. It is called by Libmesh.
    1423             :    */
    1424             :   virtual void computeJacobianSys(libMesh::NonlinearImplicitSystem & sys,
    1425             :                                   const NumericVector<libMesh::Number> & soln,
    1426             :                                   libMesh::SparseMatrix<libMesh::Number> & jacobian);
    1427             :   /**
    1428             :    * Form a Jacobian matrix with the default tag (system).
    1429             :    */
    1430             :   virtual void computeJacobian(const NumericVector<libMesh::Number> & soln,
    1431             :                                libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1432             :                                const unsigned int nl_sys_num);
    1433             : 
    1434             :   /**
    1435             :    * Form a Jacobian matrix for a given tag.
    1436             :    */
    1437             :   virtual void computeJacobianTag(const NumericVector<libMesh::Number> & soln,
    1438             :                                   libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1439             :                                   TagID tag);
    1440             : 
    1441             :   /**
    1442             :    * Form a Jacobian matrix for multiple tags. It should not be called directly by users.
    1443             :    */
    1444             :   virtual void computeJacobianInternal(const NumericVector<libMesh::Number> & soln,
    1445             :                                        libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1446             :                                        const std::set<TagID> & tags);
    1447             : 
    1448             :   /**
    1449             :    * Form multiple matrices, and each is associated with a tag.
    1450             :    */
    1451             :   virtual void computeJacobianTags(const std::set<TagID> & tags);
    1452             : 
    1453             :   /**
    1454             :    * Computes several Jacobian blocks simultaneously, summing their contributions into smaller
    1455             :    * preconditioning matrices.
    1456             :    *
    1457             :    * Used by Physics-based preconditioning
    1458             :    *
    1459             :    * @param blocks The blocks to fill in (JacobianBlock is defined in ComputeJacobianBlocksThread)
    1460             :    */
    1461             :   virtual void computeJacobianBlocks(std::vector<JacobianBlock *> & blocks,
    1462             :                                      const unsigned int nl_sys_num);
    1463             : 
    1464             :   /**
    1465             :    * Really not a good idea to use this.
    1466             :    *
    1467             :    * It computes just one block of the Jacobian into a smaller matrix.  Calling this in a loop is
    1468             :    * EXTREMELY ineffecient!
    1469             :    * Try to use computeJacobianBlocks() instead!
    1470             :    *
    1471             :    * @param jacobian The matrix you want to fill
    1472             :    * @param precond_system The libMesh::system of the preconditioning system
    1473             :    * @param ivar the block-row of the Jacobian
    1474             :    * @param jvar the block-column of the Jacobian
    1475             :    *
    1476             :    */
    1477             :   virtual void computeJacobianBlock(libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1478             :                                     libMesh::System & precond_system,
    1479             :                                     unsigned int ivar,
    1480             :                                     unsigned int jvar);
    1481             : 
    1482             :   /**
    1483             :    * Assemble both the right hand side and the system matrix of a given linear
    1484             :    * system.
    1485             :    * @param sys The linear system which should be assembled
    1486             :    * @param system_matrix The sparse matrix which should hold the system matrix
    1487             :    * @param rhs The vector which should hold the right hand side
    1488             :    * @param compute_gradients A flag to disable the computation of new gradients during the
    1489             :    * assembly, can be used to lag gradients
    1490             :    */
    1491             :   virtual void computeLinearSystemSys(libMesh::LinearImplicitSystem & sys,
    1492             :                                       libMesh::SparseMatrix<libMesh::Number> & system_matrix,
    1493             :                                       NumericVector<libMesh::Number> & rhs,
    1494             :                                       const bool compute_gradients = true);
    1495             : 
    1496             :   /**
    1497             :    * Assemble the current linear system given a set of vector and matrix tags.
    1498             :    *
    1499             :    * @param soln The solution which should be used for the system assembly
    1500             :    * @param vector_tags The vector tags for the right hand side
    1501             :    * @param matrix_tags The matrix tags for the matrix
    1502             :    * @param compute_gradients A flag to disable the computation of new gradients during the
    1503             :    * assembly, can be used to lag gradients
    1504             :    */
    1505             :   void computeLinearSystemTags(const NumericVector<libMesh::Number> & soln,
    1506             :                                const std::set<TagID> & vector_tags,
    1507             :                                const std::set<TagID> & matrix_tags,
    1508             :                                const bool compute_gradients = true);
    1509             : 
    1510             :   virtual Real computeDamping(const NumericVector<libMesh::Number> & soln,
    1511             :                               const NumericVector<libMesh::Number> & update);
    1512             : 
    1513             :   /**
    1514             :    * Check to see whether the problem should update the solution
    1515             :    * @return true if the problem should update the solution, false otherwise
    1516             :    */
    1517             :   virtual bool shouldUpdateSolution();
    1518             : 
    1519             :   /**
    1520             :    * Update the solution
    1521             :    * @param vec_solution      Local solution vector that gets modified by this method
    1522             :    * @param ghosted_solution  Ghosted solution vector
    1523             :    * @return true if the solution was modified, false otherwise
    1524             :    */
    1525             :   virtual bool updateSolution(NumericVector<libMesh::Number> & vec_solution,
    1526             :                               NumericVector<libMesh::Number> & ghosted_solution);
    1527             : 
    1528             :   /**
    1529             :    * Perform cleanup tasks after application of predictor to solution vector
    1530             :    * @param ghosted_solution  Ghosted solution vector
    1531             :    */
    1532             :   virtual void predictorCleanup(NumericVector<libMesh::Number> & ghosted_solution);
    1533             : 
    1534             :   virtual void computeBounds(libMesh::NonlinearImplicitSystem & sys,
    1535             :                              NumericVector<libMesh::Number> & lower,
    1536             :                              NumericVector<libMesh::Number> & upper);
    1537             :   virtual void computeNearNullSpace(libMesh::NonlinearImplicitSystem & sys,
    1538             :                                     std::vector<NumericVector<libMesh::Number> *> & sp);
    1539             :   virtual void computeNullSpace(libMesh::NonlinearImplicitSystem & sys,
    1540             :                                 std::vector<NumericVector<libMesh::Number> *> & sp);
    1541             :   virtual void computeTransposeNullSpace(libMesh::NonlinearImplicitSystem & sys,
    1542             :                                          std::vector<NumericVector<libMesh::Number> *> & sp);
    1543             :   virtual void computePostCheck(libMesh::NonlinearImplicitSystem & sys,
    1544             :                                 const NumericVector<libMesh::Number> & old_soln,
    1545             :                                 NumericVector<libMesh::Number> & search_direction,
    1546             :                                 NumericVector<libMesh::Number> & new_soln,
    1547             :                                 bool & changed_search_direction,
    1548             :                                 bool & changed_new_soln);
    1549             : 
    1550             :   virtual void computeIndicatorsAndMarkers();
    1551             :   virtual void computeIndicators();
    1552             :   virtual void computeMarkers();
    1553             : 
    1554             :   virtual void addResidual(const THREAD_ID tid) override;
    1555             :   virtual void addResidualNeighbor(const THREAD_ID tid) override;
    1556             :   virtual void addResidualLower(const THREAD_ID tid) override;
    1557             :   virtual void addResidualScalar(const THREAD_ID tid = 0);
    1558             : 
    1559             :   virtual void cacheResidual(const THREAD_ID tid) override;
    1560             :   virtual void cacheResidualNeighbor(const THREAD_ID tid) override;
    1561             :   virtual void addCachedResidual(const THREAD_ID tid) override;
    1562             : 
    1563             :   /**
    1564             :    * Allows for all the residual contributions that are currently cached to be added directly into
    1565             :    * the vector passed in.
    1566             :    *
    1567             :    * @param residual The vector to add the cached contributions to.
    1568             :    * @param tid The thread id.
    1569             :    */
    1570             :   virtual void addCachedResidualDirectly(NumericVector<libMesh::Number> & residual,
    1571             :                                          const THREAD_ID tid);
    1572             : 
    1573             :   virtual void setResidual(NumericVector<libMesh::Number> & residual, const THREAD_ID tid) override;
    1574             :   virtual void setResidualNeighbor(NumericVector<libMesh::Number> & residual,
    1575             :                                    const THREAD_ID tid) override;
    1576             : 
    1577             :   virtual void addJacobian(const THREAD_ID tid) override;
    1578             :   virtual void addJacobianNeighbor(const THREAD_ID tid) override;
    1579             :   virtual void addJacobianNeighborLowerD(const THREAD_ID tid) override;
    1580             :   virtual void addJacobianLowerD(const THREAD_ID tid) override;
    1581             :   virtual void addJacobianBlockTags(libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1582             :                                     unsigned int ivar,
    1583             :                                     unsigned int jvar,
    1584             :                                     const DofMap & dof_map,
    1585             :                                     std::vector<dof_id_type> & dof_indices,
    1586             :                                     const std::set<TagID> & tags,
    1587             :                                     const THREAD_ID tid);
    1588             :   virtual void addJacobianNeighbor(libMesh::SparseMatrix<libMesh::Number> & jacobian,
    1589             :                                    unsigned int ivar,
    1590             :                                    unsigned int jvar,
    1591             :                                    const DofMap & dof_map,
    1592             :                                    std::vector<dof_id_type> & dof_indices,
    1593             :                                    std::vector<dof_id_type> & neighbor_dof_indices,
    1594             :                                    const std::set<TagID> & tags,
    1595             :                                    const THREAD_ID tid) override;
    1596             :   virtual void addJacobianScalar(const THREAD_ID tid = 0);
    1597             :   virtual void addJacobianOffDiagScalar(unsigned int ivar, const THREAD_ID tid = 0);
    1598             : 
    1599             :   virtual void cacheJacobian(const THREAD_ID tid) override;
    1600             :   virtual void cacheJacobianNeighbor(const THREAD_ID tid) override;
    1601             :   virtual void addCachedJacobian(const THREAD_ID tid) override;
    1602             : 
    1603             :   virtual void prepareShapes(unsigned int var, const THREAD_ID tid) override;
    1604             :   virtual void prepareFaceShapes(unsigned int var, const THREAD_ID tid) override;
    1605             :   virtual void prepareNeighborShapes(unsigned int var, const THREAD_ID tid) override;
    1606             : 
    1607             :   // Displaced problem /////
    1608             :   virtual void addDisplacedProblem(std::shared_ptr<DisplacedProblem> displaced_problem);
    1609           0 :   virtual std::shared_ptr<const DisplacedProblem> getDisplacedProblem() const
    1610             :   {
    1611           0 :     return _displaced_problem;
    1612             :   }
    1613     4305531 :   virtual std::shared_ptr<DisplacedProblem> getDisplacedProblem() { return _displaced_problem; }
    1614             : 
    1615             :   virtual void updateGeomSearch(
    1616             :       GeometricSearchData::GeometricSearchType type = GeometricSearchData::ALL) override;
    1617             :   virtual void updateMortarMesh();
    1618             : 
    1619             :   void createMortarInterface(
    1620             :       const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
    1621             :       const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
    1622             :       bool on_displaced,
    1623             :       bool periodic,
    1624             :       const bool debug,
    1625             :       const bool correct_edge_dropping,
    1626             :       const Real minimum_projection_angle);
    1627             : 
    1628             :   /**
    1629             :    * Return the undisplaced or displaced mortar generation object associated with the provided
    1630             :    * boundaries and subdomains
    1631             :    */
    1632             :   ///@{
    1633             :   const AutomaticMortarGeneration &
    1634             :   getMortarInterface(const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
    1635             :                      const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
    1636             :                      bool on_displaced) const;
    1637             : 
    1638             :   AutomaticMortarGeneration &
    1639             :   getMortarInterface(const std::pair<BoundaryID, BoundaryID> & primary_secondary_boundary_pair,
    1640             :                      const std::pair<SubdomainID, SubdomainID> & primary_secondary_subdomain_pair,
    1641             :                      bool on_displaced);
    1642             :   ///@}
    1643             : 
    1644             :   const std::unordered_map<std::pair<BoundaryID, BoundaryID>, AutomaticMortarGeneration> &
    1645             :   getMortarInterfaces(bool on_displaced) const;
    1646             : 
    1647             :   virtual void possiblyRebuildGeomSearchPatches();
    1648             : 
    1649      606149 :   virtual GeometricSearchData & geomSearchData() override { return _geometric_search_data; }
    1650             : 
    1651             :   /**
    1652             :    * Communicate to the Resurector the name of the restart filer
    1653             :    * @param file_name The file name for restarting from
    1654             :    */
    1655             :   void setRestartFile(const std::string & file_name);
    1656             : 
    1657             :   /**
    1658             :    * @return A reference to the material property registry
    1659             :    */
    1660           0 :   const MaterialPropertyRegistry & getMaterialPropertyRegistry() const
    1661             :   {
    1662           0 :     return _material_prop_registry;
    1663             :   }
    1664             : 
    1665             :   /**
    1666             :    * Return a reference to the material property storage
    1667             :    * @return A const reference to the material property storage
    1668             :    */
    1669             :   ///@{
    1670             :   const MaterialPropertyStorage & getMaterialPropertyStorage() { return _material_props; }
    1671             :   const MaterialPropertyStorage & getBndMaterialPropertyStorage() { return _bnd_material_props; }
    1672             :   const MaterialPropertyStorage & getNeighborMaterialPropertyStorage()
    1673             :   {
    1674             :     return _neighbor_material_props;
    1675             :   }
    1676             :   ///@}
    1677             : 
    1678             :   /**
    1679             :    * Return indicator/marker storage.
    1680             :    */
    1681             :   ///@{
    1682        4722 :   const MooseObjectWarehouse<Indicator> & getIndicatorWarehouse() { return _indicators; }
    1683        4722 :   const MooseObjectWarehouse<InternalSideIndicatorBase> & getInternalSideIndicatorWarehouse()
    1684             :   {
    1685        4722 :     return _internal_side_indicators;
    1686             :   }
    1687        6424 :   const MooseObjectWarehouse<Marker> & getMarkerWarehouse() { return _markers; }
    1688             :   ///@}
    1689             : 
    1690             :   /**
    1691             :    * Return InitialCondition storage
    1692             :    */
    1693     3918852 :   const InitialConditionWarehouse & getInitialConditionWarehouse() const { return _ics; }
    1694             : 
    1695             :   /**
    1696             :    * Return FVInitialCondition storage
    1697             :    */
    1698       10288 :   const FVInitialConditionWarehouse & getFVInitialConditionWarehouse() const { return _fv_ics; }
    1699             : 
    1700             :   /**
    1701             :    * Get the solver parameters
    1702             :    */
    1703             :   SolverParams & solverParams(unsigned int solver_sys_num = 0);
    1704             : 
    1705             :   /**
    1706             :    * const version
    1707             :    */
    1708             :   const SolverParams & solverParams(unsigned int solver_sys_num = 0) const;
    1709             : 
    1710             : #ifdef LIBMESH_ENABLE_AMR
    1711             :   // Adaptivity /////
    1712      145411 :   Adaptivity & adaptivity() { return _adaptivity; }
    1713             :   virtual void initialAdaptMesh();
    1714             : 
    1715             :   /**
    1716             :    * @returns Whether or not the mesh was changed
    1717             :    */
    1718             :   virtual bool adaptMesh();
    1719             : 
    1720             :   /**
    1721             :    * @return The number of adaptivity cycles completed.
    1722             :    */
    1723         165 :   unsigned int getNumCyclesCompleted() { return _cycles_completed; }
    1724             : 
    1725             :   /**
    1726             :    * Return a Boolean indicating whether initial AMR is turned on.
    1727             :    */
    1728             :   bool hasInitialAdaptivity() const { return _adaptivity.getInitialSteps() > 0; }
    1729             : #else
    1730             :   /**
    1731             :    * Return a Boolean indicating whether initial AMR is turned on.
    1732             :    */
    1733             :   bool hasInitialAdaptivity() const { return false; }
    1734             : #endif // LIBMESH_ENABLE_AMR
    1735             : 
    1736             :   /// Create XFEM controller object
    1737             :   void initXFEM(std::shared_ptr<XFEMInterface> xfem);
    1738             : 
    1739             :   /// Get a pointer to the XFEM controller object
    1740             :   std::shared_ptr<XFEMInterface> getXFEM() { return _xfem; }
    1741             : 
    1742             :   /// Find out whether the current analysis is using XFEM
    1743     1182676 :   bool haveXFEM() { return _xfem != nullptr; }
    1744             : 
    1745             :   /// Update the mesh due to changing XFEM cuts
    1746             :   virtual bool updateMeshXFEM();
    1747             : 
    1748             :   /**
    1749             :    * Update data after a mesh change.
    1750             :    * Iff intermediate_change is true, only perform updates as
    1751             :    * necessary to prepare for another mesh change
    1752             :    * immediately-subsequent. An example of data that is not updated during an intermediate change is
    1753             :    * libMesh System matrix data. An example of data that \emph is updated during an intermediate
    1754             :    * change is libMesh System vectors. These vectors are projected or restricted based off of
    1755             :    * adaptive mesh refinement or the changing of element subdomain IDs. The flags \p contract_mesh
    1756             :    * and \p clean_refinement_flags should generally only be set to true when the mesh has changed
    1757             :    * due to mesh refinement. \p contract_mesh deletes children of coarsened elements and renumbers
    1758             :    * nodes and elements. \p clean_refinement_flags resets refinement flags such that any subsequent
    1759             :    * calls to \p System::restrict_vectors or \p System::prolong_vectors before another AMR step do
    1760             :    * not mistakenly attempt to re-do the restriction/prolongation which occurred in this method
    1761             :    */
    1762             :   virtual void
    1763             :   meshChanged(bool intermediate_change, bool contract_mesh, bool clean_refinement_flags);
    1764             : 
    1765             :   /**
    1766             :    * Register an object that derives from MeshChangedInterface
    1767             :    * to be notified when the mesh changes.
    1768             :    */
    1769             :   void notifyWhenMeshChanges(MeshChangedInterface * mci);
    1770             : 
    1771             :   /**
    1772             :    * Register an object that derives from MeshDisplacedInterface
    1773             :    * to be notified when the displaced mesh gets updated.
    1774             :    */
    1775             :   void notifyWhenMeshDisplaces(MeshDisplacedInterface * mdi);
    1776             : 
    1777             :   /**
    1778             :    * Initialize stateful properties for elements in a specific \p elem_range
    1779             :    * This is needed when elements/boundary nodes are added to a specific subdomain
    1780             :    * at an intermediate step
    1781             :    */
    1782             :   void initElementStatefulProps(const libMesh::ConstElemRange & elem_range, const bool threaded);
    1783             : 
    1784             :   /**
    1785             :    * Method called to perform a series of sanity checks before a simulation is run. This method
    1786             :    * doesn't return when errors are found, instead it generally calls mooseError() directly.
    1787             :    */
    1788             :   virtual void checkProblemIntegrity();
    1789             : 
    1790             :   void registerRandomInterface(RandomInterface & random_interface, const std::string & name);
    1791             : 
    1792             :   /**
    1793             :    * Set flag that Jacobian is constant (for optimization purposes)
    1794             :    * @param state True if the Jacobian is constant, false otherwise
    1795             :    */
    1796        4462 :   void setConstJacobian(bool state) { _const_jacobian = state; }
    1797             : 
    1798             :   /**
    1799             :    * Set flag to indicate whether kernel coverage checks should be performed. This check makes
    1800             :    * sure that at least one kernel is active on all subdomains in the domain (default: true).
    1801             :    */
    1802             :   void setKernelCoverageCheck(CoverageCheckMode mode) { _kernel_coverage_check = mode; }
    1803             : 
    1804             :   /**
    1805             :    * Set flag to indicate whether kernel coverage checks should be performed. This check makes
    1806             :    * sure that at least one kernel is active on all subdomains in the domain (default: true).
    1807             :    */
    1808             :   void setKernelCoverageCheck(bool flag)
    1809             :   {
    1810             :     _kernel_coverage_check = flag ? CoverageCheckMode::TRUE : CoverageCheckMode::FALSE;
    1811             :   }
    1812             : 
    1813             :   /**
    1814             :    * Set flag to indicate whether material coverage checks should be performed. This check makes
    1815             :    * sure that at least one material is active on all subdomains in the domain if any material is
    1816             :    * supplied. If no materials are supplied anywhere, a simulation is still considered OK as long as
    1817             :    * no properties are being requested anywhere.
    1818             :    */
    1819             :   void setMaterialCoverageCheck(CoverageCheckMode mode) { _material_coverage_check = mode; }
    1820             : 
    1821             :   /**
    1822             :    * Set flag to indicate whether material coverage checks should be performed. This check makes
    1823             :    * sure that at least one material is active on all subdomains in the domain if any material is
    1824             :    * supplied. If no materials are supplied anywhere, a simulation is still considered OK as long as
    1825             :    * no properties are being requested anywhere.
    1826             :    */
    1827             :   void setMaterialCoverageCheck(bool flag)
    1828             :   {
    1829             :     _material_coverage_check = flag ? CoverageCheckMode::TRUE : CoverageCheckMode::FALSE;
    1830             :   }
    1831             : 
    1832             :   /**
    1833             :    * Toggle parallel barrier messaging (defaults to on).
    1834             :    */
    1835             :   void setParallelBarrierMessaging(bool flag) { _parallel_barrier_messaging = flag; }
    1836             : 
    1837             :   /// Make the problem be verbose
    1838             :   void setVerboseProblem(bool verbose);
    1839             : 
    1840             :   /**
    1841             :    * Whether or not to use verbose printing for MultiApps.
    1842             :    */
    1843      198821 :   bool verboseMultiApps() const { return _verbose_multiapps; }
    1844             : 
    1845             :   /**
    1846             :    * Calls parentOutputPositionChanged() on all sub apps.
    1847             :    */
    1848             :   void parentOutputPositionChanged();
    1849             : 
    1850             :   ///@{
    1851             :   /**
    1852             :    * These methods are used to determine whether stateful material properties need to be stored on
    1853             :    * internal sides.  There are five situations where this may be the case: 1) DGKernels
    1854             :    * 2) IntegratedBCs 3)InternalSideUserObjects 4)ElementalAuxBCs 5)InterfaceUserObjects
    1855             :    *
    1856             :    * Method 1:
    1857             :    * @param bnd_id the boundary id for which to see if stateful material properties need to be
    1858             :    * stored
    1859             :    * @param tid the THREAD_ID of the caller
    1860             :    * @return Boolean indicating whether material properties need to be stored
    1861             :    *
    1862             :    * Method 2:
    1863             :    * @param subdomain_id the subdomain id for which to see if stateful material properties need to
    1864             :    * be stored
    1865             :    * @param tid the THREAD_ID of the caller
    1866             :    * @return Boolean indicating whether material properties need to be stored
    1867             :    */
    1868             :   bool needBoundaryMaterialOnSide(BoundaryID bnd_id, const THREAD_ID tid);
    1869             :   bool needInterfaceMaterialOnSide(BoundaryID bnd_id, const THREAD_ID tid);
    1870             :   bool needSubdomainMaterialOnSide(SubdomainID subdomain_id, const THREAD_ID tid);
    1871             :   ///@}
    1872             : 
    1873             :   /**
    1874             :    * Dimension of the subspace spanned by vectors with a given prefix.
    1875             :    * @param prefix Prefix of the vectors spanning the subspace.
    1876             :    */
    1877      878130 :   unsigned int subspaceDim(const std::string & prefix) const
    1878             :   {
    1879      878130 :     if (_subspace_dim.count(prefix))
    1880      878130 :       return _subspace_dim.find(prefix)->second;
    1881             :     else
    1882           0 :       return 0;
    1883             :   }
    1884             : 
    1885             :   /*
    1886             :    * Return a reference to the material warehouse of *all* Material objects.
    1887             :    */
    1888     5150450 :   const MaterialWarehouse & getMaterialWarehouse() const { return _all_materials; }
    1889             : 
    1890             :   /*
    1891             :    * Return a reference to the material warehouse of Material objects to be computed.
    1892             :    */
    1893        9595 :   const MaterialWarehouse & getRegularMaterialsWarehouse() const { return _materials; }
    1894        8598 :   const MaterialWarehouse & getDiscreteMaterialWarehouse() const { return _discrete_materials; }
    1895        9770 :   const MaterialWarehouse & getInterfaceMaterialsWarehouse() const { return _interface_materials; }
    1896             : 
    1897             :   /**
    1898             :    * Return a pointer to a MaterialBase object.  If no_warn is true, suppress
    1899             :    * warning about retrieving a material reference potentially during the
    1900             :    * material's calculation.
    1901             :    *
    1902             :    * This will return enabled or disabled objects, the main purpose is for iterative materials.
    1903             :    */
    1904             :   std::shared_ptr<MaterialBase> getMaterial(std::string name,
    1905             :                                             Moose::MaterialDataType type,
    1906             :                                             const THREAD_ID tid = 0,
    1907             :                                             bool no_warn = false);
    1908             : 
    1909             :   /*
    1910             :    * @return The MaterialData for the type \p type for thread \p tid
    1911             :    */
    1912             :   MaterialData & getMaterialData(Moose::MaterialDataType type, const THREAD_ID tid = 0) const;
    1913             : 
    1914             :   /**
    1915             :    * @returns Whether the original matrix nonzero pattern is restored before each Jacobian assembly
    1916             :    */
    1917      476443 :   bool restoreOriginalNonzeroPattern() const { return _restore_original_nonzero_pattern; }
    1918             : 
    1919             :   /**
    1920             :    * Will return True if the user wants to get an error when
    1921             :    * a nonzero is reallocated in the Jacobian by PETSc
    1922             :    */
    1923      491861 :   bool errorOnJacobianNonzeroReallocation() const
    1924             :   {
    1925      491861 :     return _error_on_jacobian_nonzero_reallocation;
    1926             :   }
    1927             : 
    1928         296 :   void setErrorOnJacobianNonzeroReallocation(bool state)
    1929             :   {
    1930         296 :     _error_on_jacobian_nonzero_reallocation = state;
    1931         296 :   }
    1932             : 
    1933             :   /**
    1934             :    * Will return True if the executioner in use requires preserving the sparsity pattern of the
    1935             :    * matrices being formed during the solve. This is usually the Jacobian.
    1936             :    */
    1937             :   bool preserveMatrixSparsityPattern() const { return _preserve_matrix_sparsity_pattern; };
    1938             : 
    1939             :   /// Set whether the sparsity pattern of the matrices being formed during the solve (usually the Jacobian)
    1940             :   /// should be preserved. This global setting can be retrieved by kernels, notably those using AD, to decide
    1941             :   /// whether to take additional care to preserve the sparsity pattern
    1942             :   void setPreserveMatrixSparsityPattern(bool preserve);
    1943             : 
    1944             :   /**
    1945             :    * Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
    1946             :    * Note that this can make preserving the matrix sparsity pattern impossible.
    1947             :    */
    1948      485083 :   bool ignoreZerosInJacobian() const { return _ignore_zeros_in_jacobian; }
    1949             : 
    1950             :   /// Set whether the zeros in the Jacobian should be dropped from the sparsity pattern
    1951             :   void setIgnoreZerosInJacobian(bool state) { _ignore_zeros_in_jacobian = state; }
    1952             : 
    1953             :   /**
    1954             :    * Whether or not to accept the solution based on its invalidity.
    1955             :    *
    1956             :    * If this returns false, it means that an invalid solution was encountered
    1957             :    * (an error) that was not allowed.
    1958             :    */
    1959             :   bool acceptInvalidSolution() const;
    1960             :   /**
    1961             :    * Whether to accept / allow an invalid solution
    1962             :    */
    1963      304582 :   bool allowInvalidSolution() const { return _allow_invalid_solution; }
    1964             : 
    1965             :   /**
    1966             :    * Whether or not to print out the invalid solutions summary table in console
    1967             :    */
    1968         690 :   bool showInvalidSolutionConsole() const { return _show_invalid_solution_console; }
    1969             : 
    1970             :   /**
    1971             :    * Whether or not the solution invalid warnings are printed out immediately
    1972             :    */
    1973       90184 :   bool immediatelyPrintInvalidSolution() const { return _immediately_print_invalid_solution; }
    1974             : 
    1975             :   /// Returns whether or not this Problem has a TimeIntegrator
    1976       28970 :   bool hasTimeIntegrator() const { return _has_time_integrator; }
    1977             : 
    1978             :   ///@{
    1979             :   /**
    1980             :    * Return/set the current execution flag.
    1981             :    *
    1982             :    * Returns EXEC_NONE when not being executed.
    1983             :    * @see FEProblemBase::execute
    1984             :    */
    1985             :   const ExecFlagType & getCurrentExecuteOnFlag() const;
    1986             :   void setCurrentExecuteOnFlag(const ExecFlagType &);
    1987             :   ///@}
    1988             : 
    1989             :   /**
    1990             :    * Convenience function for performing execution of MOOSE systems.
    1991             :    */
    1992             :   virtual void execute(const ExecFlagType & exec_type);
    1993             :   virtual void executeAllObjects(const ExecFlagType & exec_type);
    1994             : 
    1995           0 :   virtual Executor & getExecutor(const std::string & name) { return _app.getExecutor(name); }
    1996             : 
    1997             :   /**
    1998             :    * Call compute methods on UserObjects.
    1999             :    */
    2000             :   virtual void computeUserObjects(const ExecFlagType & type, const Moose::AuxGroup & group);
    2001             : 
    2002             :   /**
    2003             :    * Compute an user object with the given name
    2004             :    */
    2005             :   virtual void computeUserObjectByName(const ExecFlagType & type,
    2006             :                                        const Moose::AuxGroup & group,
    2007             :                                        const std::string & name);
    2008             : 
    2009             :   /**
    2010             :    * Set a flag that indicated that user required values for the previous Newton iterate
    2011             :    */
    2012             :   void needsPreviousNewtonIteration(bool state);
    2013             : 
    2014             :   /**
    2015             :    * Check to see whether we need to compute the variable values of the previous Newton iterate
    2016             :    * @return true if the user required values of the previous Newton iterate
    2017             :    */
    2018             :   bool needsPreviousNewtonIteration() const;
    2019             : 
    2020             :   ///@{
    2021             :   /**
    2022             :    * Convenience zeros
    2023             :    */
    2024             :   std::vector<Real> _real_zero;
    2025             :   std::vector<VariableValue> _scalar_zero;
    2026             :   std::vector<VariableValue> _zero;
    2027             :   std::vector<VariablePhiValue> _phi_zero;
    2028             :   std::vector<MooseArray<ADReal>> _ad_zero;
    2029             :   std::vector<VariableGradient> _grad_zero;
    2030             :   std::vector<MooseArray<ADRealVectorValue>> _ad_grad_zero;
    2031             :   std::vector<VariablePhiGradient> _grad_phi_zero;
    2032             :   std::vector<VariableSecond> _second_zero;
    2033             :   std::vector<MooseArray<ADRealTensorValue>> _ad_second_zero;
    2034             :   std::vector<VariablePhiSecond> _second_phi_zero;
    2035             :   std::vector<Point> _point_zero;
    2036             :   std::vector<VectorVariableValue> _vector_zero;
    2037             :   std::vector<VectorVariableCurl> _vector_curl_zero;
    2038             :   ///@}
    2039             : 
    2040             :   /**
    2041             :    * Reference to the control logic warehouse.
    2042             :    */
    2043       57560 :   ExecuteMooseObjectWarehouse<Control> & getControlWarehouse() { return _control_warehouse; }
    2044             : 
    2045             :   /**
    2046             :    * Performs setup and execute calls for Control objects.
    2047             :    */
    2048             :   void executeControls(const ExecFlagType & exec_type);
    2049             : 
    2050             :   /**
    2051             :    * Performs setup and execute calls for Sampler objects.
    2052             :    */
    2053             :   void executeSamplers(const ExecFlagType & exec_type);
    2054             : 
    2055             :   /**
    2056             :    * Update the active objects in the warehouses
    2057             :    */
    2058             :   virtual void updateActiveObjects();
    2059             : 
    2060             :   /**
    2061             :    * Register a MOOSE object dependency so we can either order
    2062             :    * operations properly or report when we cannot.
    2063             :    * a -> b (a depends on b)
    2064             :    */
    2065             :   void reportMooseObjectDependency(MooseObject * a, MooseObject * b);
    2066             : 
    2067       87991 :   ExecuteMooseObjectWarehouse<MultiApp> & getMultiAppWarehouse() { return _multi_apps; }
    2068             : 
    2069             :   /**
    2070             :    * Returns _has_jacobian
    2071             :    */
    2072             :   bool hasJacobian() const;
    2073             : 
    2074             :   /**
    2075             :    * Returns _const_jacobian (whether a MOOSE object has specified that
    2076             :    * the Jacobian is the same as the previous time it was computed)
    2077             :    */
    2078             :   bool constJacobian() const;
    2079             : 
    2080             :   /**
    2081             :    * Adds an Output object.
    2082             :    */
    2083             :   void addOutput(const std::string &, const std::string &, InputParameters &);
    2084             : 
    2085    30402408 :   inline TheWarehouse & theWarehouse() const { return _app.theWarehouse(); }
    2086             : 
    2087             :   /**
    2088             :    * If or not to reuse the base vector for matrix-free calculation
    2089             :    */
    2090       57659 :   void setSNESMFReuseBase(bool reuse, bool set_by_user)
    2091             :   {
    2092       57659 :     _snesmf_reuse_base = reuse, _snesmf_reuse_base_set_by_user = set_by_user;
    2093       57659 :   }
    2094             : 
    2095             :   /**
    2096             :    * Return a flag that indicates if we are reusing the vector base
    2097             :    */
    2098      290346 :   bool useSNESMFReuseBase() { return _snesmf_reuse_base; }
    2099             : 
    2100             :   /**
    2101             :    * Set a flag that indicates if we want to skip exception and stop solve
    2102             :    */
    2103       57659 :   void skipExceptionCheck(bool skip_exception_check)
    2104             :   {
    2105       57659 :     _skip_exception_check = skip_exception_check;
    2106       57659 :   }
    2107             : 
    2108             :   /**
    2109             :    * Return a flag to indicate if _snesmf_reuse_base is set by users
    2110             :    */
    2111             :   bool isSNESMFReuseBaseSetbyUser() { return _snesmf_reuse_base_set_by_user; }
    2112             : 
    2113             :   /**
    2114             :    * If PETSc options are already inserted
    2115             :    */
    2116        1074 :   bool & petscOptionsInserted() { return _is_petsc_options_inserted; }
    2117             : 
    2118             : #if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
    2119          24 :   PetscOptions & petscOptionsDatabase() { return _petsc_option_data_base; }
    2120             : #endif
    2121             : 
    2122             :   /// Set boolean flag to true to store solution time derivative
    2123       57042 :   virtual void setUDotRequested(const bool u_dot_requested) { _u_dot_requested = u_dot_requested; }
    2124             : 
    2125             :   /// Set boolean flag to true to store solution second time derivative
    2126         304 :   virtual void setUDotDotRequested(const bool u_dotdot_requested)
    2127             :   {
    2128         304 :     _u_dotdot_requested = u_dotdot_requested;
    2129         304 :   }
    2130             : 
    2131             :   /// Set boolean flag to true to store old solution time derivative
    2132         304 :   virtual void setUDotOldRequested(const bool u_dot_old_requested)
    2133             :   {
    2134         304 :     _u_dot_old_requested = u_dot_old_requested;
    2135         304 :   }
    2136             : 
    2137             :   /// Set boolean flag to true to store old solution second time derivative
    2138         304 :   virtual void setUDotDotOldRequested(const bool u_dotdot_old_requested)
    2139             :   {
    2140         304 :     _u_dotdot_old_requested = u_dotdot_old_requested;
    2141         304 :   }
    2142             : 
    2143             :   /// Get boolean flag to check whether solution time derivative needs to be stored
    2144       56928 :   virtual bool uDotRequested() { return _u_dot_requested; }
    2145             : 
    2146             :   /// Get boolean flag to check whether solution second time derivative needs to be stored
    2147       85396 :   virtual bool uDotDotRequested() { return _u_dotdot_requested; }
    2148             : 
    2149             :   /// Get boolean flag to check whether old solution time derivative needs to be stored
    2150       56928 :   virtual bool uDotOldRequested()
    2151             :   {
    2152       56928 :     if (_u_dot_old_requested && !_u_dot_requested)
    2153           0 :       mooseError("FEProblemBase: When requesting old time derivative of solution, current time "
    2154             :                  "derivative of solution should also be stored. Please set `u_dot_requested` to "
    2155             :                  "true using setUDotRequested.");
    2156             : 
    2157       56928 :     return _u_dot_old_requested;
    2158             :   }
    2159             : 
    2160             :   /// Get boolean flag to check whether old solution second time derivative needs to be stored
    2161       56928 :   virtual bool uDotDotOldRequested()
    2162             :   {
    2163       56928 :     if (_u_dotdot_old_requested && !_u_dotdot_requested)
    2164           0 :       mooseError("FEProblemBase: When requesting old second time derivative of solution, current "
    2165             :                  "second time derivation of solution should also be stored. Please set "
    2166             :                  "`u_dotdot_requested` to true using setUDotDotRequested.");
    2167       56928 :     return _u_dotdot_old_requested;
    2168             :   }
    2169             : 
    2170             :   using SubProblem::haveADObjects;
    2171             :   void haveADObjects(bool have_ad_objects) override;
    2172             : 
    2173             :   // Whether or not we should solve this system
    2174      316873 :   bool shouldSolve() const { return _solve; }
    2175             : 
    2176             :   /**
    2177             :    * Returns the mortar data object
    2178             :    */
    2179             :   const MortarData & mortarData() const { return _mortar_data; }
    2180        1334 :   MortarData & mortarData() { return _mortar_data; }
    2181             : 
    2182             :   /**
    2183             :    * Whether the simulation has neighbor coupling
    2184             :    */
    2185           0 :   virtual bool hasNeighborCoupling() const { return _has_internal_edge_residual_objects; }
    2186             : 
    2187             :   /**
    2188             :    * Whether the simulation has mortar coupling
    2189             :    */
    2190           0 :   virtual bool hasMortarCoupling() const { return _has_mortar; }
    2191             : 
    2192             :   using SubProblem::computingNonlinearResid;
    2193             :   void computingNonlinearResid(bool computing_nonlinear_residual) final;
    2194             : 
    2195             :   using SubProblem::currentlyComputingResidual;
    2196             :   void setCurrentlyComputingResidual(bool currently_computing_residual) final;
    2197             : 
    2198             :   /**
    2199             :    * Set the number of steps in a grid sequences
    2200             :    */
    2201       57639 :   void numGridSteps(unsigned int num_grid_steps) { _num_grid_steps = num_grid_steps; }
    2202             : 
    2203             :   /**
    2204             :    * uniformly refine the problem mesh(es). This will also prolong the the solution, and in order
    2205             :    * for that to be safe, we can only perform one refinement at a time
    2206             :    */
    2207             :   void uniformRefine();
    2208             : 
    2209             :   using SubProblem::automaticScaling;
    2210             :   void automaticScaling(bool automatic_scaling) override;
    2211             : 
    2212             :   ///@{
    2213             :   /**
    2214             :    * Helpers for calling the necessary setup/execute functions for the supplied objects
    2215             :    */
    2216             :   template <typename T>
    2217             :   static void objectSetupHelper(const std::vector<T *> & objects, const ExecFlagType & exec_flag);
    2218             :   template <typename T>
    2219             :   static void objectExecuteHelper(const std::vector<T *> & objects);
    2220             :   ///@}
    2221             : 
    2222             :   /**
    2223             :    * reinitialize FE objects on a given element on a given side at a given set of reference
    2224             :    * points and then compute variable data. Note that this method makes no assumptions about what's
    2225             :    * been called beforehand, e.g. you don't have to call some prepare method before this one. This
    2226             :    * is an all-in-one reinit
    2227             :    */
    2228             :   virtual void reinitElemFaceRef(const Elem * elem,
    2229             :                                  unsigned int side,
    2230             :                                  Real tolerance,
    2231             :                                  const std::vector<Point> * const pts,
    2232             :                                  const std::vector<Real> * const weights = nullptr,
    2233             :                                  const THREAD_ID tid = 0) override;
    2234             : 
    2235             :   /**
    2236             :    * reinitialize FE objects on a given neighbor element on a given side at a given set of reference
    2237             :    * points and then compute variable data. Note that this method makes no assumptions about what's
    2238             :    * been called beforehand, e.g. you don't have to call some prepare method before this one. This
    2239             :    * is an all-in-one reinit
    2240             :    */
    2241             :   virtual void reinitNeighborFaceRef(const Elem * neighbor_elem,
    2242             :                                      unsigned int neighbor_side,
    2243             :                                      Real tolerance,
    2244             :                                      const std::vector<Point> * const pts,
    2245             :                                      const std::vector<Real> * const weights = nullptr,
    2246             :                                      const THREAD_ID tid = 0) override;
    2247             : 
    2248             :   /**
    2249             :    * @return whether to perform a boundary condition integrity check for finite volume
    2250             :    */
    2251        3246 :   bool fvBCsIntegrityCheck() const { return _fv_bcs_integrity_check; }
    2252             : 
    2253             :   /**
    2254             :    * @param fv_bcs_integrity_check Whether to perform a boundary condition integrity check for
    2255             :    * finite volume
    2256             :    */
    2257             :   void fvBCsIntegrityCheck(bool fv_bcs_integrity_check);
    2258             : 
    2259             :   /**
    2260             :    * Get the materials and variables potentially needed for FV
    2261             :    * @param block_id SubdomainID The subdomain id that we want to retrieve materials for
    2262             :    * @param face_materials The face materials container that we will fill
    2263             :    * @param neighbor_materials The neighbor materials container that we will fill
    2264             :    * @param variables The variables container that we will fill that our materials depend on
    2265             :    * @param tid The thread id
    2266             :    */
    2267             :   void getFVMatsAndDependencies(SubdomainID block_id,
    2268             :                                 std::vector<std::shared_ptr<MaterialBase>> & face_materials,
    2269             :                                 std::vector<std::shared_ptr<MaterialBase>> & neighbor_materials,
    2270             :                                 std::set<MooseVariableFieldBase *> & variables,
    2271             :                                 const THREAD_ID tid);
    2272             : 
    2273             :   /**
    2274             :    * Resize material data
    2275             :    * @param data_type The type of material data to resize
    2276             :    * @param nqp The number of quadrature points to resize for
    2277             :    * @param tid The thread ID
    2278             :    */
    2279             :   void resizeMaterialData(Moose::MaterialDataType data_type, unsigned int nqp, const THREAD_ID tid);
    2280             : 
    2281           0 :   bool haveDisplaced() const override final { return _displaced_problem.get(); }
    2282             : 
    2283             :   /// Whether we have linear convergence objects
    2284             :   bool hasLinearConvergenceObjects() const;
    2285             :   /**
    2286             :    * Sets the nonlinear convergence object name(s) if there is one
    2287             :    */
    2288             :   void setNonlinearConvergenceNames(const std::vector<ConvergenceName> & convergence_names);
    2289             :   /**
    2290             :    * Sets the linear convergence object name(s) if there is one
    2291             :    */
    2292             :   void setLinearConvergenceNames(const std::vector<ConvergenceName> & convergence_names);
    2293             :   /**
    2294             :    * Sets the MultiApp fixed point convergence object name if there is one
    2295             :    */
    2296             :   void setMultiAppFixedPointConvergenceName(const ConvergenceName & convergence_name);
    2297             :   /**
    2298             :    * Gets the nonlinear system convergence object name(s).
    2299             :    */
    2300             :   const std::vector<ConvergenceName> & getNonlinearConvergenceNames() const;
    2301             :   /**
    2302             :    * Gets the linear convergence object name(s).
    2303             :    */
    2304             :   const std::vector<ConvergenceName> & getLinearConvergenceNames() const;
    2305             :   /**
    2306             :    * Gets the MultiApp fixed point convergence object name.
    2307             :    */
    2308             :   const ConvergenceName & getMultiAppFixedPointConvergenceName() const;
    2309             : 
    2310             :   /**
    2311             :    * Setter for whether we're computing the scaling jacobian
    2312             :    */
    2313        1188 :   void computingScalingJacobian(bool computing_scaling_jacobian)
    2314             :   {
    2315        1188 :     _computing_scaling_jacobian = computing_scaling_jacobian;
    2316        1188 :   }
    2317             : 
    2318    72227460 :   bool computingScalingJacobian() const override final { return _computing_scaling_jacobian; }
    2319             : 
    2320             :   /**
    2321             :    * Setter for whether we're computing the scaling residual
    2322             :    */
    2323         100 :   void computingScalingResidual(bool computing_scaling_residual)
    2324             :   {
    2325         100 :     _computing_scaling_residual = computing_scaling_residual;
    2326         100 :   }
    2327             : 
    2328             :   /**
    2329             :    * @return whether we are currently computing a residual for automatic scaling purposes
    2330             :    */
    2331     6269224 :   bool computingScalingResidual() const override final { return _computing_scaling_residual; }
    2332             : 
    2333             :   /**
    2334             :    * @return the coordinate transformation object that describes how to transform this problem's
    2335             :    * coordinate system into the canonical/reference coordinate system
    2336             :    */
    2337             :   MooseAppCoordTransform & coordTransform();
    2338             : 
    2339   165687038 :   virtual std::size_t numNonlinearSystems() const override { return _num_nl_sys; }
    2340             : 
    2341      398126 :   virtual std::size_t numLinearSystems() const override { return _num_linear_sys; }
    2342             : 
    2343    11128476 :   virtual std::size_t numSolverSystems() const override { return _num_nl_sys + _num_linear_sys; }
    2344             : 
    2345             :   /// Check if the solver system is nonlinear
    2346      209933 :   bool isSolverSystemNonlinear(const unsigned int sys_num) { return sys_num < _num_nl_sys; }
    2347             : 
    2348             :   virtual unsigned int currentNlSysNum() const override;
    2349             : 
    2350             :   virtual unsigned int currentLinearSysNum() const override;
    2351             : 
    2352             :   /**
    2353             :    * @return the nonlinear system number corresponding to the provided \p nl_sys_name
    2354             :    */
    2355             :   virtual unsigned int nlSysNum(const NonlinearSystemName & nl_sys_name) const override;
    2356             : 
    2357             :   /**
    2358             :    * @return the linear system number corresponding to the provided \p linear_sys_name
    2359             :    */
    2360             :   unsigned int linearSysNum(const LinearSystemName & linear_sys_name) const override;
    2361             : 
    2362             :   /**
    2363             :    * @return the solver system number corresponding to the provided \p solver_sys_name
    2364             :    */
    2365             :   unsigned int solverSysNum(const SolverSystemName & solver_sys_name) const override;
    2366             : 
    2367             :   /**
    2368             :    * @return the system number for the provided \p variable_name
    2369             :    * Can be nonlinear or auxiliary
    2370             :    */
    2371             :   unsigned int systemNumForVariable(const VariableName & variable_name) const;
    2372             : 
    2373             :   /// Whether it will skip further residual evaluations and fail the next nonlinear convergence check(s)
    2374     2053832 :   bool getFailNextNonlinearConvergenceCheck() const { return getFailNextSystemConvergenceCheck(); }
    2375             :   /// Whether it will fail the next system convergence check(s), triggering failed step behavior
    2376     2056376 :   bool getFailNextSystemConvergenceCheck() const { return _fail_next_system_convergence_check; }
    2377             : 
    2378             :   /// Skip further residual evaluations and fail the next nonlinear convergence check(s)
    2379          89 :   void setFailNextNonlinearConvergenceCheck() { setFailNextSystemConvergenceCheck(); }
    2380             :   /// Tell the problem that the system(s) cannot be considered converged next time convergence is checked
    2381          89 :   void setFailNextSystemConvergenceCheck() { _fail_next_system_convergence_check = true; }
    2382             : 
    2383             :   /// Tell the problem that the nonlinear convergence check(s) may proceed as normal
    2384         203 :   void resetFailNextNonlinearConvergenceCheck() { resetFailNextSystemConvergenceCheck(); }
    2385             :   /// Tell the problem that the system convergence check(s) may proceed as normal
    2386         203 :   void resetFailNextSystemConvergenceCheck() { _fail_next_system_convergence_check = false; }
    2387             : 
    2388             :   /*
    2389             :    * Set the status of loop order of execution printing
    2390             :    * @param print_exec set of execution flags to print on
    2391             :    */
    2392         270 :   void setExecutionPrinting(const ExecFlagEnum & print_exec) { _print_execution_on = print_exec; }
    2393             : 
    2394             :   /**
    2395             :    * Check whether the problem should output execution orders at this time
    2396             :    */
    2397             :   bool shouldPrintExecution(const THREAD_ID tid) const;
    2398             :   /**
    2399             :    * Call \p reinit on mortar user objects with matching primary boundary ID, secondary boundary ID,
    2400             :    * and displacement characteristics
    2401             :    */
    2402             :   void reinitMortarUserObjects(BoundaryID primary_boundary_id,
    2403             :                                BoundaryID secondary_boundary_id,
    2404             :                                bool displaced);
    2405             : 
    2406             :   virtual const std::vector<VectorTag> & currentResidualVectorTags() const override;
    2407             : 
    2408             :   /**
    2409             :    * Class that is used as a parameter to set/clearCurrentResidualVectorTags that allows only
    2410             :    * blessed classes to call said methods
    2411             :    */
    2412             :   class CurrentResidualVectorTagsKey
    2413             :   {
    2414             :     friend class CrankNicolson;
    2415             :     friend class FEProblemBase;
    2416             :     CurrentResidualVectorTagsKey() {}
    2417             :     CurrentResidualVectorTagsKey(const CurrentResidualVectorTagsKey &) {}
    2418             :   };
    2419             : 
    2420             :   /**
    2421             :    * Set the current residual vector tag data structure based on the passed in tag IDs
    2422             :    */
    2423             :   void setCurrentResidualVectorTags(const std::set<TagID> & vector_tags);
    2424             : 
    2425             :   /**
    2426             :    * Clear the current residual vector tag data structure
    2427             :    */
    2428             :   void clearCurrentResidualVectorTags();
    2429             : 
    2430             :   /**
    2431             :    * Clear the current Jacobian matrix tag data structure ... if someone creates it
    2432             :    */
    2433     3531291 :   void clearCurrentJacobianMatrixTags() {}
    2434             : 
    2435        7435 :   virtual void needFV() override { _have_fv = true; }
    2436   359649002 :   virtual bool haveFV() const override { return _have_fv; }
    2437             : 
    2438    51050793 :   virtual bool hasNonlocalCoupling() const override { return _has_nonlocal_coupling; }
    2439             : 
    2440             :   /**
    2441             :    * Whether to identify variable groups in nonlinear systems. This affects dof ordering
    2442             :    */
    2443       57095 :   bool identifyVariableGroupsInNL() const { return _identify_variable_groups_in_nl; }
    2444             : 
    2445             :   virtual void setCurrentLowerDElem(const Elem * const lower_d_elem, const THREAD_ID tid) override;
    2446             :   virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override;
    2447             : 
    2448             :   /**
    2449             :    * @returns the nolinear system names in the problem
    2450             :    */
    2451      126576 :   const std::vector<NonlinearSystemName> & getNonlinearSystemNames() const { return _nl_sys_names; }
    2452             :   /**
    2453             :    * @returns the linear system names in the problem
    2454             :    */
    2455       57917 :   const std::vector<LinearSystemName> & getLinearSystemNames() const { return _linear_sys_names; }
    2456             :   /**
    2457             :    * @returns the solver system names in the problem
    2458             :    */
    2459         440 :   const std::vector<SolverSystemName> & getSolverSystemNames() const { return _solver_sys_names; }
    2460             : 
    2461             :   virtual const libMesh::CouplingMatrix & nonlocalCouplingMatrix(const unsigned i) const override;
    2462             : 
    2463             :   virtual bool checkNonlocalCouplingRequirement() const override;
    2464             : 
    2465      101683 :   virtual Moose::FEBackend feBackend() const { return Moose::FEBackend::LibMesh; }
    2466             : 
    2467             : protected:
    2468             :   /**
    2469             :    * Deprecated. Users should switch to overriding the meshChanged which takes arguments
    2470             :    */
    2471        6268 :   virtual void meshChanged() {}
    2472             : 
    2473             :   /// Create extra tagged vectors and matrices
    2474             :   void createTagVectors();
    2475             : 
    2476             :   /// Create extra tagged solution vectors
    2477             :   void createTagSolutions();
    2478             : 
    2479             :   /**
    2480             :    * Update data after a mesh displaced.
    2481             :    */
    2482             :   virtual void meshDisplaced();
    2483             : 
    2484             :   /**
    2485             :    * Do generic system computations
    2486             :    */
    2487             :   void computeSystems(const ExecFlagType & type);
    2488             : 
    2489             :   MooseMesh & _mesh;
    2490             : 
    2491             : private:
    2492             :   /// The EquationSystems object, wrapped for restart
    2493             :   Restartable::ManagedValue<RestartableEquationSystems> _req;
    2494             : 
    2495             :   /**
    2496             :    * Set the subproblem and system parameters for residual objects and log their addition
    2497             :    * @param ro_name The type of the residual object
    2498             :    * @param name The name of the residual object
    2499             :    * @param parameters The residual object parameters
    2500             :    * @param nl_sys_num The nonlinear system that the residual object belongs to
    2501             :    * @param base_name The base type of the residual object, e.g. Kernel, BoundaryCondition, etc.
    2502             :    * @param reinit_displaced A data member indicating whether a geometric concept should be reinit'd
    2503             :    * for the displaced problem. Examples of valid data members to pass in are \p
    2504             :    * _reinit_displaced_elem and \p _reinit_displaced_face
    2505             :    */
    2506             :   void setResidualObjectParamsAndLog(const std::string & ro_name,
    2507             :                                      const std::string & name,
    2508             :                                      InputParameters & params,
    2509             :                                      const unsigned int nl_sys_num,
    2510             :                                      const std::string & base_name,
    2511             :                                      bool & reinit_displaced);
    2512             : 
    2513             :   /**
    2514             :    * Make basic solver params for linear solves
    2515             :    */
    2516             :   static SolverParams makeLinearSolverParams();
    2517             : 
    2518             : protected:
    2519             :   bool _initialized;
    2520             : 
    2521             :   /// Nonlinear system(s) convergence name(s)
    2522             :   std::optional<std::vector<ConvergenceName>> _nonlinear_convergence_names;
    2523             :   /// Linear system(s) convergence name(s) (if any)
    2524             :   std::optional<std::vector<ConvergenceName>> _linear_convergence_names;
    2525             :   /// MultiApp fixed point convergence name
    2526             :   std::optional<ConvergenceName> _multiapp_fixed_point_convergence_name;
    2527             : 
    2528             :   std::set<TagID> _fe_vector_tags;
    2529             : 
    2530             :   std::set<TagID> _fe_matrix_tags;
    2531             : 
    2532             :   /// Temporary storage for filtered vector tags for linear systems
    2533             :   std::set<TagID> _linear_vector_tags;
    2534             : 
    2535             :   /// Temporary storage for filtered matrix tags for linear systems
    2536             :   std::set<TagID> _linear_matrix_tags;
    2537             : 
    2538             :   /// Whether or not to actually solve the nonlinear system
    2539             :   const bool & _solve;
    2540             : 
    2541             :   bool _transient;
    2542             :   Real & _time;
    2543             :   Real & _time_old;
    2544             :   int & _t_step;
    2545             :   Real & _dt;
    2546             :   Real & _dt_old;
    2547             : 
    2548             :   /// Flag that the problem needs to add the default nonlinear convergence
    2549             :   bool _need_to_add_default_nonlinear_convergence;
    2550             :   /// Flag that the problem needs to add the default fixed point convergence
    2551             :   bool _need_to_add_default_multiapp_fixed_point_convergence;
    2552             : 
    2553             :   /// The linear system names
    2554             :   const std::vector<LinearSystemName> _linear_sys_names;
    2555             : 
    2556             :   /// The number of linear systems
    2557             :   const std::size_t _num_linear_sys;
    2558             : 
    2559             :   /// The vector of linear systems
    2560             :   std::vector<std::shared_ptr<LinearSystem>> _linear_systems;
    2561             : 
    2562             :   /// Map from linear system name to number
    2563             :   std::map<LinearSystemName, unsigned int> _linear_sys_name_to_num;
    2564             : 
    2565             :   /// The current linear system that we are solving
    2566             :   LinearSystem * _current_linear_sys;
    2567             : 
    2568             :   /// Boolean to check if we have the default nonlinear system
    2569             :   const bool _using_default_nl;
    2570             : 
    2571             :   /// The nonlinear system names
    2572             :   const std::vector<NonlinearSystemName> _nl_sys_names;
    2573             : 
    2574             :   /// The number of nonlinear systems
    2575             :   const std::size_t _num_nl_sys;
    2576             : 
    2577             :   /// The nonlinear systems
    2578             :   std::vector<std::shared_ptr<NonlinearSystemBase>> _nl;
    2579             : 
    2580             :   /// Map from nonlinear system name to number
    2581             :   std::map<NonlinearSystemName, unsigned int> _nl_sys_name_to_num;
    2582             : 
    2583             :   /// The current nonlinear system that we are solving
    2584             :   NonlinearSystemBase * _current_nl_sys;
    2585             : 
    2586             :   /// The current solver system
    2587             :   SolverSystem * _current_solver_sys;
    2588             : 
    2589             :   /// Combined container to base pointer of every solver system
    2590             :   std::vector<std::shared_ptr<SolverSystem>> _solver_systems;
    2591             : 
    2592             :   /// Map connecting variable names with their respective solver systems
    2593             :   std::map<SolverVariableName, unsigned int> _solver_var_to_sys_num;
    2594             : 
    2595             :   /// Map connecting solver system names with their respective systems
    2596             :   std::map<SolverSystemName, unsigned int> _solver_sys_name_to_num;
    2597             : 
    2598             :   /// The union of nonlinear and linear system names
    2599             :   std::vector<SolverSystemName> _solver_sys_names;
    2600             : 
    2601             :   /// The auxiliary system
    2602             :   std::shared_ptr<AuxiliarySystem> _aux;
    2603             : 
    2604             :   Moose::CouplingType _coupling;                             ///< Type of variable coupling
    2605             :   std::vector<std::unique_ptr<libMesh::CouplingMatrix>> _cm; ///< Coupling matrix for variables.
    2606             : 
    2607             :   /// Dimension of the subspace spanned by the vectors with a given prefix
    2608             :   std::map<std::string, unsigned int> _subspace_dim;
    2609             : 
    2610             :   /// The Assembly objects. The first index corresponds to the thread ID and the second index
    2611             :   /// corresponds to the nonlinear system number
    2612             :   std::vector<std::vector<std::unique_ptr<Assembly>>> _assembly;
    2613             : 
    2614             :   /// Warehouse to store mesh divisions
    2615             :   /// NOTE: this could probably be moved to the MooseMesh instead of the Problem
    2616             :   /// Time (and people's uses) will tell where this fits best
    2617             :   MooseObjectWarehouse<MeshDivision> _mesh_divisions;
    2618             : 
    2619             :   /// functions
    2620             :   MooseObjectWarehouse<Function> _functions;
    2621             : 
    2622             :   /// convergence warehouse
    2623             :   MooseObjectWarehouse<Convergence> _convergences;
    2624             : 
    2625             :   /// nonlocal kernels
    2626             :   MooseObjectWarehouse<KernelBase> _nonlocal_kernels;
    2627             : 
    2628             :   /// nonlocal integrated_bcs
    2629             :   MooseObjectWarehouse<IntegratedBCBase> _nonlocal_integrated_bcs;
    2630             : 
    2631             :   ///@{
    2632             :   /// Initial condition storage
    2633             :   InitialConditionWarehouse _ics;
    2634             :   FVInitialConditionWarehouse _fv_ics;
    2635             :   ScalarInitialConditionWarehouse _scalar_ics; // use base b/c of setup methods
    2636             :   ///@}
    2637             : 
    2638             :   // material properties
    2639             :   MaterialPropertyRegistry _material_prop_registry;
    2640             :   MaterialPropertyStorage & _material_props;
    2641             :   MaterialPropertyStorage & _bnd_material_props;
    2642             :   MaterialPropertyStorage & _neighbor_material_props;
    2643             : 
    2644             :   ///@{
    2645             :   // Material Warehouses
    2646             :   MaterialWarehouse _materials;           // regular materials
    2647             :   MaterialWarehouse _interface_materials; // interface materials
    2648             :   MaterialWarehouse _discrete_materials;  // Materials that the user must compute
    2649             :   MaterialWarehouse _all_materials; // All materials for error checking and MaterialData storage
    2650             :   ///@}
    2651             : 
    2652             :   ///@{
    2653             :   // Indicator Warehouses
    2654             :   MooseObjectWarehouse<Indicator> _indicators;
    2655             :   MooseObjectWarehouse<InternalSideIndicatorBase> _internal_side_indicators;
    2656             :   ///@}
    2657             : 
    2658             :   // Marker Warehouse
    2659             :   MooseObjectWarehouse<Marker> _markers;
    2660             : 
    2661             :   // Helper class to access Reporter object values
    2662             :   ReporterData _reporter_data;
    2663             : 
    2664             :   // TODO: delete this after apps have been updated to not call getUserObjects
    2665             :   ExecuteMooseObjectWarehouse<UserObject> _all_user_objects;
    2666             : 
    2667             :   /// MultiApp Warehouse
    2668             :   ExecuteMooseObjectWarehouse<MultiApp> _multi_apps;
    2669             : 
    2670             :   /// Storage for TransientMultiApps (only needed for calling 'computeDT')
    2671             :   ExecuteMooseObjectWarehouse<TransientMultiApp> _transient_multi_apps;
    2672             : 
    2673             :   /// Normal Transfers
    2674             :   ExecuteMooseObjectWarehouse<Transfer> _transfers;
    2675             : 
    2676             :   /// Transfers executed just before MultiApps to transfer data to them
    2677             :   ExecuteMooseObjectWarehouse<Transfer> _to_multi_app_transfers;
    2678             : 
    2679             :   /// Transfers executed just after MultiApps to transfer data from them
    2680             :   ExecuteMooseObjectWarehouse<Transfer> _from_multi_app_transfers;
    2681             : 
    2682             :   /// Transfers executed just before MultiApps to transfer data between them
    2683             :   ExecuteMooseObjectWarehouse<Transfer> _between_multi_app_transfers;
    2684             : 
    2685             :   /// A map of objects that consume random numbers
    2686             :   std::map<std::string, std::unique_ptr<RandomData>> _random_data_objects;
    2687             : 
    2688             :   /// Cache for calculating materials on side
    2689             :   std::vector<std::unordered_map<SubdomainID, bool>> _block_mat_side_cache;
    2690             : 
    2691             :   /// Cache for calculating materials on side
    2692             :   std::vector<std::unordered_map<BoundaryID, bool>> _bnd_mat_side_cache;
    2693             : 
    2694             :   /// Cache for calculating materials on interface
    2695             :   std::vector<std::unordered_map<BoundaryID, bool>> _interface_mat_side_cache;
    2696             : 
    2697             :   /// Objects to be notified when the mesh changes
    2698             :   std::vector<MeshChangedInterface *> _notify_when_mesh_changes;
    2699             : 
    2700             :   /// Objects to be notified when the mesh displaces
    2701             :   std::vector<MeshDisplacedInterface *> _notify_when_mesh_displaces;
    2702             : 
    2703             :   /// Helper to check for duplicate variable names across systems or within a single system
    2704             :   bool duplicateVariableCheck(const std::string & var_name,
    2705             :                               const libMesh::FEType & type,
    2706             :                               bool is_aux,
    2707             :                               const std::set<SubdomainID> * const active_subdomains);
    2708             : 
    2709             :   void computeUserObjectsInternal(const ExecFlagType & type,
    2710             :                                   const Moose::AuxGroup & group,
    2711             :                                   TheWarehouse::Query & query);
    2712             : 
    2713             :   /// Verify that SECOND order mesh uses SECOND order displacements.
    2714             :   void checkDisplacementOrders();
    2715             : 
    2716             :   void checkUserObjects();
    2717             : 
    2718             :   /**
    2719             :    * Helper method for checking Material object dependency.
    2720             :    *
    2721             :    * @see checkProblemIntegrity
    2722             :    */
    2723             :   void checkDependMaterialsHelper(
    2724             :       const std::map<SubdomainID, std::vector<std::shared_ptr<MaterialBase>>> & materials_map);
    2725             : 
    2726             :   /// Verify that there are no element type/coordinate type conflicts
    2727             :   void checkCoordinateSystems();
    2728             : 
    2729             :   /**
    2730             :    * Call when it is possible that the needs for ghosted elements has changed.
    2731             :    * @param mortar_changed Whether an update of mortar data has been requested since the last
    2732             :    * EquationSystems (re)initialization
    2733             :    */
    2734             :   void reinitBecauseOfGhostingOrNewGeomObjects(bool mortar_changed = false);
    2735             : 
    2736             :   /**
    2737             :    * Helper for setting the "_subproblem" and "_sys" parameters in addObject() and
    2738             :    * in addUserObject().
    2739             :    *
    2740             :    * This is needed due to header includes/forward declaration issues
    2741             :    */
    2742             :   void addObjectParamsHelper(InputParameters & params,
    2743             :                              const std::string & object_name,
    2744             :                              const std::string & var_param_name = "variable");
    2745             : 
    2746             : #ifdef LIBMESH_ENABLE_AMR
    2747             :   Adaptivity _adaptivity;
    2748             :   unsigned int _cycles_completed;
    2749             : #endif
    2750             : 
    2751             :   /// Pointer to XFEM controller
    2752             :   std::shared_ptr<XFEMInterface> _xfem;
    2753             : 
    2754             :   // Displaced mesh /////
    2755             :   MooseMesh * _displaced_mesh;
    2756             :   std::shared_ptr<DisplacedProblem> _displaced_problem;
    2757             :   GeometricSearchData _geometric_search_data;
    2758             :   MortarData _mortar_data;
    2759             : 
    2760             :   /// Whether to call DisplacedProblem::reinitElem when this->reinitElem is called
    2761             :   bool _reinit_displaced_elem;
    2762             :   /// Whether to call DisplacedProblem::reinitElemFace when this->reinitElemFace is called
    2763             :   bool _reinit_displaced_face;
    2764             :   /// Whether to call DisplacedProblem::reinitNeighbor when this->reinitNeighbor is called
    2765             :   bool _reinit_displaced_neighbor;
    2766             : 
    2767             :   /// whether input file has been written
    2768             :   bool _input_file_saved;
    2769             : 
    2770             :   /// Whether or not this system has any Dampers associated with it.
    2771             :   bool _has_dampers;
    2772             : 
    2773             :   /// Whether or not this system has any Constraints.
    2774             :   bool _has_constraints;
    2775             : 
    2776             :   /// If or not to resuse the base vector for matrix-free calculation
    2777             :   bool _snesmf_reuse_base;
    2778             : 
    2779             :   /// If or not skip 'exception and stop solve'
    2780             :   bool _skip_exception_check;
    2781             : 
    2782             :   /// If or not _snesmf_reuse_base is set by user
    2783             :   bool _snesmf_reuse_base_set_by_user;
    2784             : 
    2785             :   /// Whether nor not stateful materials have been initialized
    2786             :   bool _has_initialized_stateful;
    2787             : 
    2788             :   /// true if the Jacobian is constant
    2789             :   bool _const_jacobian;
    2790             : 
    2791             :   /// Indicates if the Jacobian was computed
    2792             :   bool _has_jacobian;
    2793             : 
    2794             :   /// Indicates that we need to compute variable values for previous Newton iteration
    2795             :   bool _needs_old_newton_iter;
    2796             : 
    2797             :   /// Indicates we need to save the previous NL iteration variable values
    2798             :   bool _previous_nl_solution_required;
    2799             : 
    2800             :   /// Indicates if nonlocal coupling is required/exists
    2801             :   bool _has_nonlocal_coupling;
    2802             :   bool _calculate_jacobian_in_uo;
    2803             : 
    2804             :   std::vector<std::vector<const MooseVariableFEBase *>> _uo_jacobian_moose_vars;
    2805             : 
    2806             :   /// Whether there are active material properties on each thread
    2807             :   std::vector<unsigned char> _has_active_material_properties;
    2808             : 
    2809             :   std::vector<SolverParams> _solver_params;
    2810             : 
    2811             :   /// Determines whether and which subdomains are to be checked to ensure that they have an active kernel
    2812             :   CoverageCheckMode _kernel_coverage_check;
    2813             :   std::vector<SubdomainName> _kernel_coverage_blocks;
    2814             : 
    2815             :   /// whether to perform checking of boundary restricted nodal object variable dependencies,
    2816             :   /// e.g. whether the variable dependencies are defined on the selected boundaries
    2817             :   const bool _boundary_restricted_node_integrity_check;
    2818             : 
    2819             :   /// whether to perform checking of boundary restricted elemental object variable dependencies,
    2820             :   /// e.g. whether the variable dependencies are defined on the selected boundaries
    2821             :   const bool _boundary_restricted_elem_integrity_check;
    2822             : 
    2823             :   /// Determines whether and which subdomains are to be checked to ensure that they have an active material
    2824             :   CoverageCheckMode _material_coverage_check;
    2825             :   std::vector<SubdomainName> _material_coverage_blocks;
    2826             : 
    2827             :   /// Whether to check overlapping Dirichlet and Flux BCs and/or multiple DirichletBCs per sideset
    2828             :   bool _fv_bcs_integrity_check;
    2829             : 
    2830             :   /// Determines whether a check to verify material dependencies on every subdomain
    2831             :   const bool _material_dependency_check;
    2832             : 
    2833             :   /// Whether or not checking the state of uo/aux evaluation
    2834             :   const bool _uo_aux_state_check;
    2835             : 
    2836             :   /// Maximum number of quadrature points used in the problem
    2837             :   unsigned int _max_qps;
    2838             : 
    2839             :   /// Maximum scalar variable order
    2840             :   libMesh::Order _max_scalar_order;
    2841             : 
    2842             :   /// Indicates whether or not this executioner has a time integrator (during setup)
    2843             :   bool _has_time_integrator;
    2844             : 
    2845             :   /// Whether or not an exception has occurred
    2846             :   bool _has_exception;
    2847             : 
    2848             :   /// Whether or not information about how many transfers have completed is printed
    2849             :   bool _parallel_barrier_messaging;
    2850             : 
    2851             :   /// Whether or not to be verbose during setup
    2852             :   MooseEnum _verbose_setup;
    2853             : 
    2854             :   /// Whether or not to be verbose with multiapps
    2855             :   bool _verbose_multiapps;
    2856             : 
    2857             :   /// Whether or not to be verbose on solution restoration post a failed time step
    2858             :   bool _verbose_restore;
    2859             : 
    2860             :   /// The error message to go with an exception
    2861             :   std::string _exception_message;
    2862             : 
    2863             :   /// Current execute_on flag
    2864             :   ExecFlagType _current_execute_on_flag;
    2865             : 
    2866             :   /// The control logic warehouse
    2867             :   ExecuteMooseObjectWarehouse<Control> _control_warehouse;
    2868             : 
    2869             :   /// PETSc option storage
    2870             :   Moose::PetscSupport::PetscOptions _petsc_options;
    2871             : #if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
    2872             :   PetscOptions _petsc_option_data_base;
    2873             : #endif
    2874             : 
    2875             :   /// If or not PETSc options have been added to database
    2876             :   bool _is_petsc_options_inserted;
    2877             : 
    2878             :   std::shared_ptr<LineSearch> _line_search;
    2879             : 
    2880             :   std::unique_ptr<libMesh::ConstElemRange> _evaluable_local_elem_range;
    2881             :   std::unique_ptr<libMesh::ConstElemRange> _nl_evaluable_local_elem_range;
    2882             :   std::unique_ptr<libMesh::ConstElemRange> _aux_evaluable_local_elem_range;
    2883             : 
    2884             :   std::unique_ptr<libMesh::ConstElemRange> _current_algebraic_elem_range;
    2885             :   std::unique_ptr<libMesh::ConstNodeRange> _current_algebraic_node_range;
    2886             :   std::unique_ptr<ConstBndNodeRange> _current_algebraic_bnd_node_range;
    2887             : 
    2888             :   /// Automatic differentiaion (AD) flag which indicates whether any consumer has
    2889             :   /// requested an AD material property or whether any suppier has declared an AD material property
    2890             :   bool _using_ad_mat_props;
    2891             : 
    2892             :   // loop state during projection of initial conditions
    2893             :   unsigned short _current_ic_state;
    2894             : 
    2895             :   /// Whether to assemble matrices using hash tables instead of preallocating matrix memory. This
    2896             :   /// can be a good option if the sparsity pattern changes throughout the course of the simulation
    2897             :   const bool _use_hash_table_matrix_assembly;
    2898             : 
    2899             : private:
    2900             :   /**
    2901             :    * Handle exceptions. Note that the result of this call will be a thrown MooseException. The
    2902             :    * caller of this method must determine how to handle the thrown exception
    2903             :    */
    2904             :   void handleException(const std::string & calling_method);
    2905             : 
    2906             :   /**
    2907             :    * Helper for getting mortar objects corresponding to primary boundary ID, secondary boundary ID,
    2908             :    * and displaced parameters, given some initial set
    2909             :    */
    2910             :   std::vector<MortarUserObject *>
    2911             :   getMortarUserObjects(BoundaryID primary_boundary_id,
    2912             :                        BoundaryID secondary_boundary_id,
    2913             :                        bool displaced,
    2914             :                        const std::vector<MortarUserObject *> & mortar_uo_superset);
    2915             : 
    2916             :   /**
    2917             :    * Helper for getting mortar objects corresponding to primary boundary ID, secondary boundary ID,
    2918             :    * and displaced parameters from the entire active mortar user object set
    2919             :    */
    2920             :   std::vector<MortarUserObject *> getMortarUserObjects(BoundaryID primary_boundary_id,
    2921             :                                                        BoundaryID secondary_boundary_id,
    2922             :                                                        bool displaced);
    2923             : 
    2924             :   /**
    2925             :    * Determine what solver system the provided variable name lies in
    2926             :    * @param var_name The name of the variable we are doing solver system lookups for
    2927             :    * @param error_if_not_found Whether to error if the variable name isn't found in any of the
    2928             :    * solver systems
    2929             :    * @return A pair in which the first member indicates whether the variable was found in the
    2930             :    * solver systems and the second member indicates the solver system number in which the
    2931             :    * variable was found (or an invalid unsigned integer if not found)
    2932             :    */
    2933             :   virtual std::pair<bool, unsigned int>
    2934             :   determineSolverSystem(const std::string & var_name,
    2935             :                         bool error_if_not_found = false) const override;
    2936             : 
    2937             :   /**
    2938             :    * Checks if the variable of the initial condition is getting restarted and errors for specific
    2939             :    * cases
    2940             :    * @param ic_name The name of the initial condition
    2941             :    * @param var_name The name of the variable
    2942             :    */
    2943             :   void checkICRestartError(const std::string & ic_name,
    2944             :                            const std::string & name,
    2945             :                            const VariableName & var_name);
    2946             : 
    2947             :   /*
    2948             :    * Test if stateful property redistribution is expected to be
    2949             :    * necessary, and set it up if so.
    2950             :    */
    2951             :   void addAnyRedistributers();
    2952             : 
    2953             :   void updateMaxQps();
    2954             : 
    2955             :   void joinAndFinalize(TheWarehouse::Query query, bool isgen = false);
    2956             : 
    2957             :   /**
    2958             :    * Reset state of this object in preparation for the next evaluation.
    2959             :    */
    2960             :   virtual void resetState();
    2961             : 
    2962             :   // Parameters handling Jacobian sparsity pattern behavior
    2963             :   /// Whether to error when the Jacobian is re-allocated, usually because the sparsity pattern changed
    2964             :   bool _error_on_jacobian_nonzero_reallocation;
    2965             :   /// Whether we should restore the original nonzero pattern for every Jacobian evaluation. This
    2966             :   /// option is useful if the sparsity pattern is constantly changing and you are using hash table
    2967             :   /// assembly or if you wish to continually restore the matrix to the originally preallocated
    2968             :   /// sparsity pattern computed by relationship managers.
    2969             :   const bool _restore_original_nonzero_pattern;
    2970             :   /// Whether to ignore zeros in the Jacobian, thereby leading to a reduced sparsity pattern
    2971             :   bool _ignore_zeros_in_jacobian;
    2972             :   /// Whether to preserve the system matrix / Jacobian sparsity pattern, using 0-valued entries usually
    2973             :   bool _preserve_matrix_sparsity_pattern;
    2974             : 
    2975             :   const bool _force_restart;
    2976             :   const bool _allow_ics_during_restart;
    2977             :   const bool _skip_nl_system_check;
    2978             :   bool _fail_next_system_convergence_check;
    2979             :   const bool _allow_invalid_solution;
    2980             :   const bool _show_invalid_solution_console;
    2981             :   const bool & _immediately_print_invalid_solution;
    2982             : 
    2983             :   /// At or beyond initialSteup stage
    2984             :   bool _started_initial_setup;
    2985             : 
    2986             :   /// Whether the problem has dgkernels or interface kernels
    2987             :   bool _has_internal_edge_residual_objects;
    2988             : 
    2989             :   /// Whether solution time derivative needs to be stored
    2990             :   bool _u_dot_requested;
    2991             : 
    2992             :   /// Whether solution second time derivative needs to be stored
    2993             :   bool _u_dotdot_requested;
    2994             : 
    2995             :   /// Whether old solution time derivative needs to be stored
    2996             :   bool _u_dot_old_requested;
    2997             : 
    2998             :   /// Whether old solution second time derivative needs to be stored
    2999             :   bool _u_dotdot_old_requested;
    3000             : 
    3001             :   friend class AuxiliarySystem;
    3002             :   friend class NonlinearSystemBase;
    3003             :   friend class MooseEigenSystem;
    3004             :   friend class Resurrector;
    3005             :   friend class Restartable;
    3006             :   friend class DisplacedProblem;
    3007             : 
    3008             :   /// Whether the simulation requires mortar coupling
    3009             :   bool _has_mortar;
    3010             : 
    3011             :   /// Number of steps in a grid sequence
    3012             :   unsigned int _num_grid_steps;
    3013             : 
    3014             :   /// Whether to trust the user coupling matrix no matter what. See
    3015             :   /// https://github.com/idaholab/moose/issues/16395 for detailed background
    3016             :   bool _trust_user_coupling_matrix = false;
    3017             : 
    3018             :   /// Flag used to indicate whether we are computing the scaling Jacobian
    3019             :   bool _computing_scaling_jacobian = false;
    3020             : 
    3021             :   /// Flag used to indicate whether we are computing the scaling Residual
    3022             :   bool _computing_scaling_residual = false;
    3023             : 
    3024             :   /// Flag used to indicate whether we are doing the uo/aux state check in execute
    3025             :   bool _checking_uo_aux_state = false;
    3026             : 
    3027             :   /// When to print the execution of loops
    3028             :   ExecFlagEnum _print_execution_on;
    3029             : 
    3030             :   /// Whether to identify variable groups in nonlinear systems. This affects dof ordering
    3031             :   const bool _identify_variable_groups_in_nl;
    3032             : 
    3033             :   /// A data member to store the residual vector tag(s) passed into \p computeResidualTag(s). This
    3034             :   /// data member will be used when APIs like \p cacheResidual, \p addCachedResiduals, etc. are
    3035             :   /// called
    3036             :   std::vector<VectorTag> _current_residual_vector_tags;
    3037             : 
    3038             :   /// Whether we are performing some calculations with finite volume discretizations
    3039             :   bool _have_fv = false;
    3040             : 
    3041             :   /// If we catch an exception during residual/Jacobian evaluaton for which we don't have specific
    3042             :   /// handling, immediately error instead of allowing the time step to be cut
    3043             :   const bool _regard_general_exceptions_as_errors;
    3044             : 
    3045             :   /// nonlocal coupling matrix
    3046             :   std::vector<libMesh::CouplingMatrix> _nonlocal_cm;
    3047             : 
    3048             :   /// nonlocal coupling requirement flag
    3049             :   bool _requires_nonlocal_coupling;
    3050             : 
    3051             :   friend void Moose::PetscSupport::setSinglePetscOption(const std::string & name,
    3052             :                                                         const std::string & value,
    3053             :                                                         FEProblemBase * const problem);
    3054             : };
    3055             : 
    3056             : using FVProblemBase = FEProblemBase;
    3057             : 
    3058             : template <typename T>
    3059             : void
    3060        1572 : FEProblemBase::allowOutput(bool state)
    3061             : {
    3062        1572 :   _app.getOutputWarehouse().allowOutput<T>(state);
    3063        1572 : }
    3064             : 
    3065             : template <typename T>
    3066             : void
    3067          55 : FEProblemBase::objectSetupHelper(const std::vector<T *> & objects, const ExecFlagType & exec_flag)
    3068             : {
    3069          55 :   if (exec_flag == EXEC_INITIAL)
    3070             :   {
    3071           0 :     for (T * obj_ptr : objects)
    3072           0 :       obj_ptr->initialSetup();
    3073             :   }
    3074             : 
    3075          55 :   else if (exec_flag == EXEC_TIMESTEP_BEGIN)
    3076             :   {
    3077           0 :     for (const auto obj_ptr : objects)
    3078           0 :       obj_ptr->timestepSetup();
    3079             :   }
    3080          55 :   else if (exec_flag == EXEC_SUBDOMAIN)
    3081             :   {
    3082           0 :     for (const auto obj_ptr : objects)
    3083           0 :       obj_ptr->subdomainSetup();
    3084             :   }
    3085             : 
    3086          55 :   else if (exec_flag == EXEC_NONLINEAR)
    3087             :   {
    3088           0 :     for (const auto obj_ptr : objects)
    3089           0 :       obj_ptr->jacobianSetup();
    3090             :   }
    3091             : 
    3092          55 :   else if (exec_flag == EXEC_LINEAR)
    3093             :   {
    3094           0 :     for (const auto obj_ptr : objects)
    3095           0 :       obj_ptr->residualSetup();
    3096             :   }
    3097          55 : }
    3098             : 
    3099             : template <typename T>
    3100             : void
    3101          55 : FEProblemBase::objectExecuteHelper(const std::vector<T *> & objects)
    3102             : {
    3103          78 :   for (T * obj_ptr : objects)
    3104          55 :     obj_ptr->execute();
    3105          23 : }
    3106             : 
    3107             : template <typename T>
    3108             : std::vector<std::shared_ptr<T>>
    3109       50838 : FEProblemBase::addObject(const std::string & type,
    3110             :                          const std::string & name,
    3111             :                          InputParameters & parameters,
    3112             :                          const bool threaded,
    3113             :                          const std::string & var_param_name)
    3114             : {
    3115             :   parallel_object_only();
    3116             : 
    3117       50838 :   logAdd(MooseUtils::prettyCppType<T>(), name, type, parameters);
    3118             :   // Add the _subproblem and _sys parameters depending on use_displaced_mesh
    3119       50838 :   addObjectParamsHelper(parameters, name, var_param_name);
    3120             : 
    3121       50838 :   const auto n_threads = threaded ? libMesh::n_threads() : 1;
    3122       50838 :   std::vector<std::shared_ptr<T>> objects(n_threads);
    3123      102519 :   for (THREAD_ID tid = 0; tid < n_threads; ++tid)
    3124             :   {
    3125       51725 :     std::shared_ptr<T> obj = _factory.create<T>(type, name, parameters, tid);
    3126       51681 :     theWarehouse().add(obj);
    3127       51681 :     objects[tid] = std::move(obj);
    3128             :   }
    3129             : 
    3130       50794 :   return objects;
    3131           0 : }
    3132             : 
    3133             : inline NonlinearSystemBase &
    3134     5772831 : FEProblemBase::getNonlinearSystemBase(const unsigned int sys_num)
    3135             : {
    3136             :   mooseAssert(sys_num < _nl.size(), "System number greater than the number of nonlinear systems");
    3137     5772831 :   return *_nl[sys_num];
    3138             : }
    3139             : 
    3140             : inline const NonlinearSystemBase &
    3141         520 : FEProblemBase::getNonlinearSystemBase(const unsigned int sys_num) const
    3142             : {
    3143             :   mooseAssert(sys_num < _nl.size(), "System number greater than the number of nonlinear systems");
    3144         520 :   return *_nl[sys_num];
    3145             : }
    3146             : 
    3147             : inline SolverSystem &
    3148     4291885 : FEProblemBase::getSolverSystem(const unsigned int sys_num)
    3149             : {
    3150             :   mooseAssert(sys_num < _solver_systems.size(),
    3151             :               "System number greater than the number of solver systems");
    3152     4291885 :   return *_solver_systems[sys_num];
    3153             : }
    3154             : 
    3155             : inline const SolverSystem &
    3156             : FEProblemBase::getSolverSystem(const unsigned int sys_num) const
    3157             : {
    3158             :   mooseAssert(sys_num < _solver_systems.size(),
    3159             :               "System number greater than the number of solver systems");
    3160             :   return *_solver_systems[sys_num];
    3161             : }
    3162             : 
    3163             : inline NonlinearSystemBase &
    3164     9045675 : FEProblemBase::currentNonlinearSystem()
    3165             : {
    3166             :   mooseAssert(_current_nl_sys, "The nonlinear system is not currently set");
    3167     9045675 :   return *_current_nl_sys;
    3168             : }
    3169             : 
    3170             : inline const NonlinearSystemBase &
    3171   538514813 : FEProblemBase::currentNonlinearSystem() const
    3172             : {
    3173             :   mooseAssert(_current_nl_sys, "The nonlinear system is not currently set");
    3174   538514813 :   return *_current_nl_sys;
    3175             : }
    3176             : 
    3177             : inline LinearSystem &
    3178       71386 : FEProblemBase::getLinearSystem(const unsigned int sys_num)
    3179             : {
    3180             :   mooseAssert(sys_num < _linear_systems.size(),
    3181             :               "System number greater than the number of linear systems");
    3182       71386 :   return *_linear_systems[sys_num];
    3183             : }
    3184             : 
    3185             : inline const LinearSystem &
    3186             : FEProblemBase::getLinearSystem(const unsigned int sys_num) const
    3187             : {
    3188             :   mooseAssert(sys_num < _linear_systems.size(),
    3189             :               "System number greater than the number of linear systems");
    3190             :   return *_linear_systems[sys_num];
    3191             : }
    3192             : 
    3193             : inline LinearSystem &
    3194        2544 : FEProblemBase::currentLinearSystem()
    3195             : {
    3196             :   mooseAssert(_current_linear_sys, "The linear system is not currently set");
    3197        2544 :   return *_current_linear_sys;
    3198             : }
    3199             : 
    3200             : inline const LinearSystem &
    3201           0 : FEProblemBase::currentLinearSystem() const
    3202             : {
    3203             :   mooseAssert(_current_linear_sys, "The linear system is not currently set");
    3204           0 :   return *_current_linear_sys;
    3205             : }
    3206             : 
    3207             : inline Assembly &
    3208   681570256 : FEProblemBase::assembly(const THREAD_ID tid, const unsigned int sys_num)
    3209             : {
    3210             :   mooseAssert(tid < _assembly.size(), "Assembly objects not initialized");
    3211             :   mooseAssert(sys_num < _assembly[tid].size(),
    3212             :               "System number larger than the assembly container size");
    3213   681570256 :   return *_assembly[tid][sys_num];
    3214             : }
    3215             : 
    3216             : inline const Assembly &
    3217      503485 : FEProblemBase::assembly(const THREAD_ID tid, const unsigned int sys_num) const
    3218             : {
    3219             :   mooseAssert(tid < _assembly.size(), "Assembly objects not initialized");
    3220             :   mooseAssert(sys_num < _assembly[tid].size(),
    3221             :               "System number larger than the assembly container size");
    3222      503485 :   return *_assembly[tid][sys_num];
    3223             : }
    3224             : 
    3225             : inline const libMesh::CouplingMatrix *
    3226        2766 : FEProblemBase::couplingMatrix(const unsigned int i) const
    3227             : {
    3228        2766 :   return _cm[i].get();
    3229             : }
    3230             : 
    3231             : inline void
    3232             : FEProblemBase::fvBCsIntegrityCheck(const bool fv_bcs_integrity_check)
    3233             : {
    3234             :   if (!_fv_bcs_integrity_check)
    3235             :     // the user has requested that we don't check integrity so we will honor that
    3236             :     return;
    3237             : 
    3238             :   _fv_bcs_integrity_check = fv_bcs_integrity_check;
    3239             : }
    3240             : 
    3241             : inline const std::vector<VectorTag> &
    3242   431770109 : FEProblemBase::currentResidualVectorTags() const
    3243             : {
    3244   431770109 :   return _current_residual_vector_tags;
    3245             : }
    3246             : 
    3247             : inline void
    3248     3047420 : FEProblemBase::setCurrentResidualVectorTags(const std::set<TagID> & vector_tags)
    3249             : {
    3250     3047420 :   _current_residual_vector_tags = getVectorTags(vector_tags);
    3251     3047420 : }
    3252             : 
    3253             : inline void
    3254     3531415 : FEProblemBase::clearCurrentResidualVectorTags()
    3255             : {
    3256     3531415 :   _current_residual_vector_tags.clear();
    3257     3531415 : }

Generated by: LCOV version 1.14