https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
NonlinearSystemBase Class Referenceabstract

Nonlinear system to be solved. More...

#include <NonlinearSystemBase.h>

Inheritance diagram for NonlinearSystemBase:
[legend]

Public Member Functions

 NonlinearSystemBase (FEProblemBase &problem, libMesh::System &sys, const std::string &name)
 
virtual ~NonlinearSystemBase ()
 
virtual void preInit () override
 This is called prior to the libMesh system has been init'd. More...
 
bool computedScalingJacobian () const
 
virtual void turnOffJacobian ()
 Turn off the Jacobian (must be called before equation system initialization) More...
 
virtual void solve () override=0
 Solve the system (using libMesh magic) More...
 
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver ()=0
 
virtual SNES getSNES ()=0
 
virtual unsigned int getCurrentNonlinearIterationNumber ()=0
 
bool computingPreSMOResidual ()
 Returns true if this system is currently computing the pre-SMO residual for a solve. More...
 
virtual void initialSetup () override
 Setup Functions. More...
 
virtual void timestepSetup () override
 
virtual void customSetup (const ExecFlagType &exec_type) override
 
virtual void residualSetup () override
 
virtual void jacobianSetup () override
 
virtual void setupFiniteDifferencedPreconditioner ()=0
 
void setupFieldDecomposition ()
 
bool haveFiniteDifferencedPreconditioner () const
 
bool haveFieldSplitPreconditioner () const
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a kernel. More...
 
virtual void addHDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a hybridized discontinuous Galerkin (HDG) kernel. More...
 
virtual void addNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a NodalKernel. More...
 
void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a scalar kernel. More...
 
void addBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 Adds a boundary condition. More...
 
void addConstraint (const std::string &c_name, const std::string &name, InputParameters &parameters)
 Adds a Constraint. More...
 
void addDiracKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a Dirac kernel. More...
 
void addDGKernel (std::string dg_kernel_name, const std::string &name, InputParameters &parameters)
 Adds a DG kernel. More...
 
void addInterfaceKernel (std::string interface_kernel_name, const std::string &name, InputParameters &parameters)
 Adds an interface kernel. More...
 
void addDamper (const std::string &damper_name, const std::string &name, InputParameters &parameters)
 Adds a damper. More...
 
void addSplit (const std::string &split_name, const std::string &name, InputParameters &parameters)
 Adds a split. More...
 
std::shared_ptr< SplitgetSplit (const std::string &name)
 Retrieves a split by name. More...
 
MooseObjectWarehouseBase< Split > & getSplits ()
 Retrieves all splits. More...
 
bool shouldEvaluatePreSMOResidual () const
 We offer the option to check convergence against the pre-SMO residual. More...
 
void setPreSMOResidual (bool use)
 Set whether to evaluate the pre-SMO residual and use it in the subsequent relative convergence checks. More...
 
const bool & usePreSMOResidual () const
 Whether we are using pre-SMO residual in relative convergence checks. More...
 
Real referenceResidual () const
 The reference residual used in relative convergence check. More...
 
Real preSMOResidual () const
 The pre-SMO residual. More...
 
Real initialResidual () const
 The initial residual. More...
 
void setInitialResidual (Real r)
 Record the initial residual (for later relative convergence check) More...
 
void zeroVectorForResidual (const std::string &vector_name)
 
void setInitialSolution ()
 
void setConstraintSecondaryValues (NumericVector< Number > &solution, bool displaced)
 Sets the value of constrained variables in the solution vector. More...
 
void constraintResiduals (NumericVector< Number > &residual, bool displaced)
 Add residual contributions from Constraints. More...
 
void computeResidualTag (NumericVector< Number > &residual, TagID tag_id)
 Computes residual for a given tag. More...
 
void computeResidualTags (const std::set< TagID > &tags)
 Form multiple tag-associated residual vectors for all the given tags. More...
 
void computeResidualAndJacobianTags (const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
 Form possibly multiple tag-associated vectors and matrices. More...
 
void computeResidualAndJacobianInternal (const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
 Compute residual and Jacobian from contributions not related to constraints, such as nodal boundary conditions. More...
 
void computeResidual (NumericVector< Number > &residual, TagID tag_id)
 Form a residual vector for a given tag. More...
 
void addImplicitGeometricCouplingEntries (GeometricSearchData &geom_search_data)
 Adds entries to the Jacobian in the correct positions for couplings coming from dofs being coupled that are related geometrically (i.e. More...
 
void constraintJacobians (const SparseMatrix< Number > &jacobian_to_view, bool displaced)
 Add jacobian contributions from Constraints. More...
 
void computeJacobianTags (const std::set< TagID > &tags)
 Computes multiple (tag associated) Jacobian matricese. More...
 
bool computeScaling ()
 Method used to obtain scaling factors for variables. More...
 
void computeJacobian (libMesh::SparseMatrix< Number > &jacobian, const std::set< TagID > &tags)
 Associate jacobian to systemMatrixTag, and then form a matrix for all the tags. More...
 
void computeJacobian (libMesh::SparseMatrix< Number > &jacobian)
 Take all tags in the system, and form a matrix for all tags in the system. More...
 
void computeJacobianBlocks (std::vector< JacobianBlock *> &blocks)
 Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditioning matrices. More...
 
void computeJacobianBlocks (std::vector< JacobianBlock *> &blocks, const std::set< TagID > &tags)
 
Real computeDamping (const NumericVector< Number > &solution, const NumericVector< Number > &update)
 Compute damping. More...
 
void onTimestepBegin ()
 Called at the beginning of the time step. More...
 
virtual void subdomainSetup (SubdomainID subdomain, THREAD_ID tid)
 Called from assembling when we hit a new subdomain. More...
 
void overwriteNodeFace (NumericVector< Number > &soln)
 Called from explicit time stepping to overwrite boundary positions (explicit dynamics). More...
 
void updateActive (THREAD_ID tid)
 Update active objects of Warehouses owned by NonlinearSystemBase. More...
 
virtual void setSolutionUDot (const NumericVector< Number > &udot)
 Set transient term used by residual and Jacobian evaluation. More...
 
virtual void setSolutionUDotDot (const NumericVector< Number > &udotdot)
 Set transient term used by residual and Jacobian evaluation. More...
 
NumericVector< Number > & getResidualTimeVector ()
 Return a numeric vector that is associated with the time tag. More...
 
NumericVector< Number > & getResidualNonTimeVector ()
 Return a numeric vector that is associated with the nontime tag. More...
 
NumericVector< Number > & residualVector (TagID tag)
 Return a residual vector that is associated with the residual tag. More...
 
virtual NumericVector< Number > & residualCopy () override
 
virtual NumericVector< Number > & residualGhosted () override
 
virtual NumericVector< Number > & RHS ()=0
 
virtual void augmentSparsity (libMesh::SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz) override
 Will modify the sparsity pattern to add logical geometric connections. More...
 
void setPreconditioner (std::shared_ptr< MoosePreconditioner > pc)
 Sets a preconditioner. More...
 
MoosePreconditioner const * getPreconditioner () const
 
void useFiniteDifferencedPreconditioner (bool use=true)
 If called with true this system will use a finite differenced form of the Jacobian as the preconditioner. More...
 
void setDecomposition (const std::vector< std::string > &decomposition)
 If called with a single string, it is used as the name of a the top-level decomposition split. More...
 
void useFieldSplitPreconditioner (bool use=true)
 If called with true this system will use a field split preconditioner matrix. More...
 
void addImplicitGeometricCouplingEntriesToJacobian (bool add=true)
 If called with true this will add entries into the jacobian to link together degrees of freedom that are found to be related through the geometric search system. More...
 
void assembleConstraintsSeparately (bool separately=true)
 Indicates whether to assemble residual and Jacobian after each constraint application. More...
 
virtual void attachPreconditioner (libMesh::Preconditioner< Number > *preconditioner)=0
 Attach a customized preconditioner that requires physics knowledge. More...
 
void setupDampers ()
 Setup damping stuff (called before we actually start) More...
 
void reinitIncrementAtQpsForDampers (THREAD_ID tid, const std::set< MooseVariable *> &damped_vars)
 Compute the incremental change in variables at QPs for dampers. More...
 
void reinitIncrementAtNodeForDampers (THREAD_ID tid, const std::set< MooseVariable *> &damped_vars)
 Compute the incremental change in variables at nodes for dampers. More...
 
unsigned int nNonlinearIterations () const
 Return the number of non-linear iterations. More...
 
unsigned int nLinearIterations () const
 Return the number of linear iterations. More...
 
unsigned int nResidualEvaluations () const
 Return the total number of residual evaluations done so far in this calculation. More...
 
Real finalNonlinearResidual () const
 Return the final nonlinear residual. More...
 
Real nonlinearNorm () const
 Return the last nonlinear norm. More...
 
void printAllVariableNorms (bool state)
 Force the printing of all variable norms after each solve. More...
 
void debuggingResiduals (bool state)
 
void setPredictor (std::shared_ptr< Predictor > predictor)
 
PredictorgetPredictor ()
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, THREAD_ID tid) const
 Indicated whether this system needs material properties on boundaries. More...
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, THREAD_ID tid) const
 Indicated whether this system needs material properties on interfaces. More...
 
bool needSubdomainMaterialOnSide (SubdomainID subdomain_id, THREAD_ID tid) const
 Indicates whether this system needs material properties on internal sides. More...
 
bool doingDG () const
 Getter for _doing_dg. More...
 
bool hasSaveIn () const
 Weather or not the nonlinear system has save-ins. More...
 
bool hasDiagSaveIn () const
 Weather or not the nonlinear system has diagonal Jacobian save-ins. More...
 
virtual libMesh::Systemsystem () override
 Get the reference to the libMesh system. More...
 
virtual const libMesh::Systemsystem () const override
 
virtual void setSolutionUDotOld (const NumericVector< Number > &u_dot_old)
 
virtual void setSolutionUDotDotOld (const NumericVector< Number > &u_dotdot_old)
 
virtual void setPreviousNewtonSolution (const NumericVector< Number > &soln)
 
TagID timeVectorTag () const override
 Ideally, we should not need this API. More...
 
TagID nonTimeVectorTag () const override
 
TagID residualVectorTag () const override
 
TagID systemMatrixTag () const override
 Return the Matrix Tag ID for System. More...
 
virtual void residualAndJacobianTogether ()=0
 Call this method if you want the residual and Jacobian to be computed simultaneously. More...
 
bool computeScalingOnce () const
 
void computeScalingOnce (bool compute_scaling_once)
 
void autoScalingParam (Real resid_vs_jac_scaling_param)
 Sets the param that indicates the weighting of the residual vs the Jacobian in determining variable scaling parameters. More...
 
void scalingGroupVariables (const std::vector< std::vector< std::string >> &scaling_group_variables)
 
void ignoreVariablesForAutoscaling (const std::vector< std::string > &ignore_variables_for_autoscaling)
 
bool offDiagonalsInAutoScaling () const
 
void offDiagonalsInAutoScaling (bool off_diagonals_in_auto_scaling)
 
void setupDM ()
 Setup the PETSc DM object (when appropriate) More...
 
virtual void potentiallySetupFiniteDifferencing ()
 Create finite differencing contexts for assembly of the Jacobian and/or approximating the action of the Jacobian on vectors (e.g. More...
 
void destroyColoring ()
 Destroy the coloring object if it exists. More...
 
virtual void subdomainSetup ()
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void restoreSolutions () override final
 Restore current solutions (call after your solve failed) More...
 
void serializeSolution ()
 
virtual void stopSolve (const ExecFlagType &exec_flag, const std::set< TagID > &vector_tags_to_close)=0
 Quit the current solve as soon as possible. More...
 
virtual bool converged ()=0
 Returns the convergence state. More...
 
void setSolution (const NumericVector< Number > &soln)
 Set the solution to a given vector. More...
 
void setPCSide (MooseEnum pcs)
 Set the side on which the preconditioner is applied to. More...
 
Moose::PCSideType getPCSide ()
 Get the current preconditioner side. More...
 
void setMooseKSPNormType (MooseEnum kspnorm)
 Set the norm in which the linear convergence will be measured. More...
 
Moose::MooseKSPNormType getMooseKSPNormType ()
 Get the norm in which the linear convergence is measured. More...
 
virtual const NumericVector< Number > *const & currentSolution () const override final
 The solution vector that is currently being operated on. More...
 
virtual void compute (ExecFlagType type) override
 Compute time derivatives, auxiliary variables, etc. More...
 
unsigned int number () const
 Gets the number of this system. More...
 
MooseMeshmesh ()
 
const MooseMeshmesh () const
 
SubProblemsubproblem ()
 
const SubProblemsubproblem () const
 
FEProblemBasefeProblem ()
 
const FEProblemBasefeProblem () const
 
void applyScalingFactors (const std::vector< Real > &inverse_scaling_factors)
 Applies scaling factors to the system's variables. More...
 
bool computingScalingJacobian () const
 Whether we are computing an initial Jacobian for automatic variable scaling. More...
 
bool automaticScaling () const
 Getter for whether we are performing automatic scaling. More...
 
void automaticScaling (bool automatic_scaling)
 Setter for whether we are performing automatic scaling. More...
 
void setVerboseFlag (const bool &verbose)
 Sets the verbose flag. More...
 
virtual libMesh::DofMapdofMap ()
 Gets writeable reference to the dof map. More...
 
virtual const libMesh::DofMapdofMap () const
 Gets const reference to the dof map. More...
 
virtual void postInit ()
 
virtual void reinit ()
 Reinitialize the system when the degrees of freedom in this system have changed. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
void update ()
 Update the system (doing libMesh magic) More...
 
virtual void copyOldSolutions ()
 Shifts the solutions backwards in time. More...
 
virtual void copyPreviousNonlinearSolutions ()
 Shifts the solutions backwards in nonlinear iteration history. More...
 
NumericVector< Number > & solution ()
 
const NumericVector< Number > & solution () const
 
NumericVector< Number > & solutionOld ()
 
const NumericVector< Number > & solutionOld () const
 
NumericVector< Number > & solutionOlder ()
 
const NumericVector< Number > & solutionOlder () const
 
virtual const NumericVector< Number > * solutionPreviousNewton () const
 
virtual NumericVector< Number > * solutionPreviousNewton ()
 
virtual void initSolutionState ()
 Initializes the solution state. More...
 
virtual NumericVector< Number > & solutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
 Get a state of the solution (0 = current, 1 = old, 2 = older, etc). More...
 
virtual const NumericVector< Number > & solutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
 Get a state of the solution (0 = current, 1 = old, 2 = older, etc). More...
 
virtual void needSolutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
 Registers that the solution state state is needed. More...
 
virtual bool hasSolutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
 Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc). More...
 
virtual void addDotVectors ()
 Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator. More...
 
virtual std::vector< Number > & duDotDus ()
 
virtual NumberduDotDotDu ()
 
virtual const NumberduDotDotDu () const
 
virtual const NumberduDotDu (unsigned int var_num=0) const
 
virtual NumericVector< Number > * solutionUDot ()
 
virtual const NumericVector< Number > * solutionUDot () const
 
virtual NumericVector< Number > * solutionUDotDot ()
 
virtual const NumericVector< Number > * solutionUDotDot () const
 
virtual NumericVector< Number > * solutionUDotOld ()
 
virtual const NumericVector< Number > * solutionUDotOld () const
 
virtual NumericVector< Number > * solutionUDotDotOld ()
 
virtual const NumericVector< Number > * solutionUDotDotOld () const
 
virtual void saveOldSolutions ()
 Save the old and older solutions. More...
 
virtual void restoreOldSolutions ()
 Restore the old and older solutions when the saved solutions present. More...
 
bool hasVector (const std::string &tag_name) const
 Check if the named vector exists in the system. More...
 
virtual bool hasVector (TagID tag_id) const
 Check if the tagged vector exists in the system. More...
 
virtual std::set< TagIDdefaultVectorTags () const
 Get the default vector tags associated with this system. More...
 
virtual std::set< TagIDdefaultMatrixTags () const
 Get the default matrix tags associted with this system. More...
 
virtual void associateVectorToTag (NumericVector< Number > &vec, TagID tag)
 Associate a vector for a given tag. More...
 
virtual void disassociateVectorFromTag (NumericVector< Number > &vec, TagID tag)
 Disassociate a given vector from a given tag. More...
 
virtual void disassociateVectorFromTag (TagID tag)
 Disassociate any vector that is associated with a given tag. More...
 
virtual void disassociateDefaultVectorTags ()
 Disassociate the vectors associated with the default vector tags of this system. More...
 
virtual bool hasMatrix (TagID tag) const
 Check if the tagged matrix exists in the system. More...
 
virtual libMesh::SparseMatrix< Number > & getMatrix (TagID tag)
 Get a raw SparseMatrix. More...
 
virtual const libMesh::SparseMatrix< Number > & getMatrix (TagID tag) const
 Get a raw SparseMatrix. More...
 
virtual void activeAllMatrixTags ()
 Make all exsiting matrices ative. More...
 
virtual void activeMatrixTag (TagID tag)
 Active a matrix for tag. More...
 
virtual bool matrixTagActive (TagID tag) const
 If or not a matrix tag is active. More...
 
virtual void deactiveMatrixTag (TagID tag)
 deactive a matrix for tag More...
 
virtual void deactiveAllMatrixTags ()
 Make matrices inactive. More...
 
void closeTaggedMatrices (const std::set< TagID > &tags)
 Close all matrices associated the tags. More...
 
void flushTaggedMatrices (const std::set< TagID > &tags)
 flushes all matrices associated to tags. More...
 
virtual void associateMatrixToTag (libMesh::SparseMatrix< Number > &matrix, TagID tag)
 Associate a matrix to a tag. More...
 
virtual void disassociateMatrixFromTag (libMesh::SparseMatrix< Number > &matrix, TagID tag)
 Disassociate a matrix from a tag. More...
 
virtual void disassociateMatrixFromTag (TagID tag)
 Disassociate any matrix that is associated with a given tag. More...
 
virtual void disassociateDefaultMatrixTags ()
 Disassociate the matrices associated with the default matrix tags of this system. More...
 
virtual NumericVector< Number > & serializedSolution ()
 Returns a reference to a serialized version of the solution vector for this subproblem. More...
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list)
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual void addVariable (const std::string &var_type, const std::string &var_name, InputParameters &parameters)
 Canonical method for adding a variable. More...
 
virtual bool isArrayVariable (const std::string &var_name) const
 If a variable is an array variable. More...
 
virtual bool isScalarVariable (unsigned int var_name) const
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a variable of with specified name. More...
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, const std::string &var_name)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, unsigned int var_number)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableFV< T > & getFVVariable (THREAD_ID tid, const std::string &var_name)
 Return a finite volume variable. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
virtual const std::set< SubdomainID > * getVariableBlocks (unsigned int var_number)
 Get the block where a variable of this system is defined. More...
 
virtual unsigned int nVariables () const
 Get the number of variables in this system. More...
 
unsigned int nFieldVariables () const
 Get the number of field variables in this system. More...
 
unsigned int nFVVariables () const
 Get the number of finite volume variables in this system. More...
 
std::size_t getMaxVarNDofsPerElem () const
 Gets the maximum number of dofs used by any one variable on any one element. More...
 
std::size_t getMaxVarNDofsPerNode () const
 Gets the maximum number of dofs used by any one variable on any one node. More...
 
void assignMaxVarNDofsPerElem (std::size_t max_dofs)
 assign the maximum element dofs More...
 
void assignMaxVarNDofsPerNode (std::size_t max_dofs)
 assign the maximum node dofs More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual libMesh::Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareLowerD (THREAD_ID tid)
 Prepare the system for use for lower dimensional elements. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid)
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitLowerD (THREAD_ID tid)
 Compute the values of the variables on the lower dimensional element. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of nodes. More...
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of neighbor nodes. More...
 
virtual void reinitScalars (THREAD_ID tid, bool reinit_for_derivative_reordering=false)
 Reinit scalar varaibles. More...
 
virtual void addVariableToCopy (const std::string &dest_name, const std::string &source_name, const std::string &timestep)
 Add info about variable that will be copied. More...
 
const std::vector< MooseVariableFieldBase * > & getVariables (THREAD_ID tid)
 
const std::vector< MooseVariableScalar * > & getScalarVariables (THREAD_ID tid)
 
const std::set< SubdomainID > & getSubdomainsForVar (unsigned int var_number) const
 
const std::set< SubdomainID > & getSubdomainsForVar (const std::string &var_name) const
 Get the block where a variable of this system is defined. More...
 
void removeVector (const std::string &name)
 Remove a vector from the system with the given name. More...
 
void removeVector (TagID tag_id)
 Remove a solution length vector from the system with the specified TagID. More...
 
NumericVector< Number > & addVector (const std::string &vector_name, const bool project, const libMesh::ParallelType type)
 Adds a solution length vector to the system. More...
 
NumericVector< Number > & addVector (TagID tag, const bool project, const libMesh::ParallelType type)
 Adds a solution length vector to the system with the specified TagID. More...
 
void closeTaggedVector (const TagID tag)
 Close vector with the given tag. More...
 
void closeTaggedVectors (const std::set< TagID > &tags)
 Close all vectors for given tags. More...
 
void zeroTaggedVector (const TagID tag)
 Zero vector with the given tag. More...
 
void zeroTaggedVectors (const std::set< TagID > &tags)
 Zero all vectors for given tags. More...
 
void setVariableGlobalDoFs (const std::string &var_name)
 set all the global dof indices for a variable More...
 
const std::vector< dof_id_type > & getVariableGlobalDoFs ()
 Get the global dof indices of a variable, this needs to be called after the indices have been set by setVariableGlobalDoFs More...
 
libMesh::SparseMatrix< Number > & addMatrix (TagID tag)
 Adds a matrix with a given tag. More...
 
void removeMatrix (TagID tag)
 Removes a matrix with a given tag. More...
 
virtual const std::string & name () const
 
const std::vector< VariableName > & getVariableNames () const
 
void getStandardFieldVariableNames (std::vector< VariableName > &std_field_variables) const
 
unsigned int getMaxVariableNumber () const
 Returns the maximum number of all variables on the system. More...
 
virtual void computeVariables (const NumericVector< Number > &)
 
void copyVars (libMesh::ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 
void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters &parameters)
 
bool hasVarCopy () const
 Whether or not there are variables to be restarted from an Exodus mesh file. More...
 
void addScalingVector ()
 Add the scaling factor vector to the system. More...
 
bool solutionStatesInitialized () const
 Whether or not the solution states have been initialized via initSolutionState() More...
 
virtual void subdomainSetup ()
 
void clearAllDofIndices ()
 Clear all dof indices from moose variables. More...
 
void setActiveVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the variables. More...
 
void setActiveScalarVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the scalar variables. More...
 
Moose::VarKindType varKind () const
 
const std::vector< std::unique_ptr< NumericVector< Number > > > & gradientContainer () const
 Reference to the container vector which hold gradients at dofs (if it can be interpreted). More...
 
void copyTimeIntegrators (const SystemBase &other_sys)
 Copy time integrators from another system. More...
 
const TimeIntegratorgetTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const TimeIntegratorqueryTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const std::vector< std::shared_ptr< TimeIntegrator > > & getTimeIntegrators ()
 
std::string prefix () const
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
PerfGraphperfGraph ()
 Get the PerfGraph. More...
 
void checkKernelCoverage (const std::set< SubdomainID > &mesh_subdomains) const
 
virtual bool containsTimeKernel () override
 If the system has a kernel that corresponds to a time derivative. More...
 
virtual std::vector< std::string > timeKernelVariableNames () override
 Returns the names of the variables that have time derivative kernels in the system. More...
 
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse ()
 Access functions to Warehouses from outside NonlinearSystemBase. More...
 
const MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse () const
 
MooseObjectTagWarehouse< DGKernelBase > & getDGKernelWarehouse ()
 
MooseObjectTagWarehouse< InterfaceKernelBase > & getInterfaceKernelWarehouse ()
 
MooseObjectTagWarehouse< DiracKernelBase > & getDiracKernelWarehouse ()
 
MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse ()
 
const MooseObjectTagWarehouse< ScalarKernelBase > & getScalarKernelWarehouse () const
 
const MooseObjectTagWarehouse< NodalKernelBase > & getNodalKernelWarehouse () const
 
MooseObjectTagWarehouse< HDGKernel > & getHDGKernelWarehouse ()
 
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse () const
 
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse () const
 
const ConstraintWarehousegetConstraintWarehouse () const
 
const MooseObjectTagWarehouse< NodalBCBase > & getNodalBCWarehouse () const
 Return the NodalBCBase warehouse. More...
 
const MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse () const
 Return the IntegratedBCBase warehouse. More...
 
virtual NumericVector< Number > & getVector (const std::string &name)
 Get a raw NumericVector by name. More...
 
virtual const NumericVector< Number > & getVector (const std::string &name) const
 
virtual NumericVector< Number > & getVector (TagID tag)
 Get a raw NumericVector by tag. More...
 
virtual const NumericVector< Number > & getVector (TagID tag) const
 
virtual bool hasVariable (const std::string &var_name) const
 Query a system for a variable. More...
 
virtual bool hasScalarVariable (const std::string &var_name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

unsigned int _num_residual_evaluations
 
libMesh::System_sys
 
Real _last_nl_rnorm
 
std::vector< unsigned int_current_l_its
 
unsigned int _current_nl_its
 
const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Member Functions

void computeResidualInternal (const std::set< TagID > &tags)
 Compute the residual for a given tag. More...
 
void computeNodalBCs (NumericVector< Number > &residual)
 Enforces nodal boundary conditions. More...
 
void computeNodalBCs (NumericVector< Number > &residual, const std::set< TagID > &tags)
 Form a residual for BCs that at least has one of the given tags. More...
 
void computeNodalBCs (const std::set< TagID > &tags)
 Form multiple tag-associated residual vectors for the given tags. More...
 
void computeNodalBCsResidualAndJacobian ()
 compute the residual and Jacobian for nodal boundary conditions More...
 
void computeJacobianInternal (const std::set< TagID > &tags)
 Form multiple matrices for all the tags. More...
 
void computeDiracContributions (const std::set< TagID > &tags, bool is_jacobian)
 
void computeScalarKernelsJacobians (const std::set< TagID > &tags)
 
void enforceNodalConstraintsResidual (NumericVector< Number > &residual)
 Enforce nodal constraints. More...
 
void enforceNodalConstraintsJacobian ()
 
void mortarConstraints (Moose::ComputeType compute_type, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
 Do mortar constraint residual/jacobian computations. More...
 
virtual void computeScalingJacobian ()=0
 Compute a "Jacobian" for automatic scaling purposes. More...
 
virtual void computeScalingResidual ()=0
 Compute a "residual" for automatic scaling purposes. More...
 
void assembleScalingVector ()
 Assemble the numeric vector of scaling factors such that it can be used during assembly of the system matrix. More...
 
virtual void postAddResidualObject (ResidualObject &)
 Called after any ResidualObject-derived objects are added to the system. More...
 
void reinitNodeFace (const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
 Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints. More...
 
bool preSolve ()
 Perform some steps to get ready for the solver. More...
 
void getNodeDofs (dof_id_type node_id, std::vector< dof_id_type > &dofs)
 
void checkInvalidSolution ()
 
virtual NumericVector< Number > & solutionInternal () const override final
 Internal getter for solution owned by libMesh. More...
 
virtual bool matrixFromColoring () const
 Whether a system matrix is formed from coloring. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 Call to register a named section for timing. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 Call to register a named section for timing. More...
 
std::string timedSectionName (const std::string &section_name) const
 

Protected Attributes

NumericVector< Number > * _residual_ghosted
 ghosted form of the residual More...
 
std::unique_ptr< NumericVector< Number > > _residual_copy
 Copy of the residual vector, or nullptr if a copy is not needed. More...
 
Number _du_dot_du
 \( {du^dot}\over{du} \) More...
 
Number _du_dotdot_du
 \( {du^dotdot}\over{du} \) More...
 
TagID _Re_time_tag
 Tag for time contribution residual. More...
 
std::set< TagID_nl_vector_tags
 Vector tags to temporarily store all tags associated with the current system. More...
 
std::set< TagID_nl_matrix_tags
 Matrix tags to temporarily store all tags associated with the current system. More...
 
NumericVector< Number > * _Re_time
 residual vector for time contributions More...
 
TagID _Re_non_time_tag
 Tag for non-time contribution residual. More...
 
NumericVector< Number > * _Re_non_time
 residual vector for non-time contributions More...
 
TagID _Re_tag
 Used for the residual vector from PETSc. More...
 
TagID _Ke_non_time_tag
 Tag for non-time contribution Jacobian. More...
 
TagID _Ke_system_tag
 Tag for system contribution Jacobian. More...
 
MooseObjectTagWarehouse< DiracKernelBase_dirac_kernels
 Dirac Kernel storage for each thread. More...
 
MooseObjectWarehouse< ElementDamper_element_dampers
 Element Dampers for each thread. More...
 
MooseObjectWarehouse< NodalDamper_nodal_dampers
 Nodal Dampers for each thread. More...
 
MooseObjectWarehouse< GeneralDamper_general_dampers
 General Dampers. More...
 
MooseObjectTagWarehouse< NodalKernelBase_nodal_kernels
 NodalKernels for each thread. More...
 
MooseObjectWarehouseBase< Split_splits
 Decomposition splits. More...
 
ConstraintWarehouse _constraints
 Constraints storage object. More...
 
NumericVector< Number > * _increment_vec
 increment vector More...
 
std::shared_ptr< MoosePreconditioner_preconditioner
 Preconditioner. More...
 
bool _use_finite_differenced_preconditioner
 Whether or not to use a finite differenced preconditioner. More...
 
MatFDColoring _fdcoloring
 
bool _have_decomposition
 Whether or not the system can be decomposed into splits. More...
 
std::string _decomposition_split
 Name of the top-level split of the decomposition. More...
 
bool _use_field_split_preconditioner
 Whether or not to use a FieldSplitPreconditioner matrix based on the decomposition. More...
 
bool _add_implicit_geometric_coupling_entries_to_jacobian
 Whether or not to add implicit geometric couplings to the Jacobian for FDP. More...
 
bool _assemble_constraints_separately
 Whether or not to assemble the residual and Jacobian after the application of each constraint. More...
 
bool _need_residual_ghosted
 Whether or not a ghosted copy of the residual needs to be made. More...
 
bool _debugging_residuals
 true if debugging residuals More...
 
bool _doing_dg
 true if DG is active (optimization reasons) More...
 
std::vector< std::string > _vecs_to_zero_for_residual
 vectors that will be zeroed before a residual computation More...
 
unsigned int _n_iters
 
unsigned int _n_linear_iters
 
unsigned int _n_residual_evaluations
 Total number of residual evaluations that have been performed. More...
 
Real _final_residual
 
std::shared_ptr< Predictor_predictor
 If predictor is active, this is non-NULL. More...
 
bool _computing_pre_smo_residual
 
Real _pre_smo_residual
 The pre-SMO residual, see setPreSMOResidual for a detailed explanation. More...
 
Real _initial_residual
 The initial (i.e., 0th nonlinear iteration) residual, see setPreSMOResidual for a detailed explanation. More...
 
bool _use_pre_smo_residual
 Whether to use the pre-SMO initial residual in the relative convergence check. More...
 
bool _print_all_var_norms
 
bool _has_save_in
 If there is any Kernel or IntegratedBC having save_in. More...
 
bool _has_diag_save_in
 If there is any Kernel or IntegratedBC having diag_save_in. More...
 
bool _has_nodalbc_save_in
 If there is a nodal BC having save_in. More...
 
bool _has_nodalbc_diag_save_in
 If there is a nodal BC having diag_save_in. More...
 
bool _computed_scaling
 Flag used to indicate whether we have already computed the scaling Jacobian. More...
 
bool _compute_scaling_once
 Whether the scaling factors should only be computed once at the beginning of the simulation through an extra Jacobian evaluation. More...
 
Real _resid_vs_jac_scaling_param
 The param that indicates the weighting of the residual vs the Jacobian in determining variable scaling parameters. More...
 
std::vector< std::vector< std::string > > _scaling_group_variables
 A container of variable groupings that can be used in scaling calculations. More...
 
std::vector< bool > _variable_autoscaled
 Container to hold flag if variable is to participate in autoscaling. More...
 
std::vector< std::string > _ignore_variables_for_autoscaling
 A container for variables that do not partipate in autoscaling. More...
 
bool _off_diagonals_in_auto_scaling
 Whether to include off diagonals when determining automatic scaling factors. More...
 
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
 A diagonal matrix used for computing scaling. More...
 
const NumericVector< Number > * _current_solution
 solution vector from solver More...
 
Moose::PCSideType _pc_side
 Preconditioning side. More...
 
Moose::MooseKSPNormType _ksp_norm
 KSP norm type. More...
 
bool _solution_is_invalid
 Boolean to see if solution is invalid. More...
 
SubProblem_subproblem
 The subproblem for whom this class holds variable data, etc; this can either be the governing finite element/volume problem or a subjugate displaced problem. More...
 
FEProblemBase_fe_problem
 the governing finite element/volume problem More...
 
MooseApp_app
 
Factory_factory
 
MooseMesh_mesh
 
std::string _name
 The name of this system. More...
 
std::vector< VariableWarehouse_vars
 Variable warehouses (one for each thread) More...
 
std::map< unsigned int, std::set< SubdomainID > > _var_map
 Map of variables (variable id -> array of subdomains where it lives) More...
 
unsigned int _max_var_number
 Maximum variable number. More...
 
std::vector< std::string > _vars_to_be_zeroed_on_residual
 
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
 
NumericVector< Number > * _u_dot
 solution vector for u^dot More...
 
NumericVector< Number > * _u_dotdot
 solution vector for u^dotdot More...
 
NumericVector< Number > * _u_dot_old
 old solution vector for u^dot More...
 
NumericVector< Number > * _u_dotdot_old
 old solution vector for u^dotdot More...
 
std::vector< NumericVector< Number > * > _tagged_vectors
 Tagged vectors (pointer) More...
 
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
 Tagged matrices (pointer) More...
 
std::vector< bool > _matrix_tag_active_flags
 Active flags for tagged matrices. More...
 
NumericVector< Real > * _saved_old
 
NumericVector< Real > * _saved_older
 
NumericVector< Real > * _saved_dot_old
 
NumericVector< Real > * _saved_dotdot_old
 
Moose::VarKindType _var_kind
 default kind of variables in this system More...
 
std::vector< VarCopyInfo_var_to_copy
 
size_t _max_var_n_dofs_per_elem
 Maximum number of dofs for any one variable on any one element. More...
 
size_t _max_var_n_dofs_per_node
 Maximum number of dofs for any one variable on any one node. More...
 
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
 Time integrator. More...
 
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
 Map variable number to its pointer. More...
 
bool _automatic_scaling
 Whether to automatically scale the variables. More...
 
bool _verbose
 True if printing out additional information. More...
 
bool _solution_states_initialized
 Whether or not the solution states have been initialized. More...
 
std::vector< dof_id_type_var_all_dof_indices
 Container for the dof indices of a given variable. More...
 
std::unique_ptr< NumericVector< Number > > _serialized_solution
 Serialized version of the solution vector, or nullptr if a serialized solution is not needed. More...
 
std::vector< std::unique_ptr< NumericVector< Number > > > _raw_grad_container
 A cache for storing gradients at dof locations. More...
 
const Parallel::Communicator_communicator
 
MooseApp_pg_moose_app
 The MooseApp that owns the PerfGraph. More...
 
const std::string _prefix
 A prefix to use for all sections. More...
 
MooseObjectTagWarehouse< KernelBase_kernels
 
MooseObjectTagWarehouse< HDGKernel_hybridized_kernels
 
MooseObjectTagWarehouse< ScalarKernelBase_scalar_kernels
 
MooseObjectTagWarehouse< DGKernelBase_dg_kernels
 
MooseObjectTagWarehouse< InterfaceKernelBase_interface_kernels
 
MooseObjectTagWarehouse< IntegratedBCBase_integrated_bcs
 
MooseObjectTagWarehouse< NodalBCBase_nodal_bcs
 
MooseObjectWarehouse< DirichletBCBase_preset_nodal_bcs
 
MooseObjectWarehouse< ADDirichletBCBase_ad_preset_nodal_bcs
 

Private Member Functions

void findImplicitGeometricCouplingEntries (GeometricSearchData &geom_search_data, std::unordered_map< dof_id_type, std::vector< dof_id_type >> &graph)
 Finds the implicit sparsity graph between geometrically related dofs. More...
 
void setupScalingData ()
 Setup group scaling containers. More...
 

Private Attributes

std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor_undisplaced_mortar_functors
 Functors for computing undisplaced mortar constraints. More...
 
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor_displaced_mortar_functors
 Functors for computing displaced mortar constraints. More...
 
std::vector< NumericVector< Number > * > _solution_state
 The current states of the solution (0 = current, 1 = old, etc) More...
 
bool _auto_scaling_initd
 Whether we've initialized the automatic scaling data structures. More...
 
std::unordered_map< unsigned int, unsigned int_var_to_group_var
 A map from variable index to group variable index and it's associated (inverse) scaling factor. More...
 
std::size_t _num_scaling_groups
 The number of scaling groups. More...
 

Detailed Description

Nonlinear system to be solved.

It is a part of FEProblemBase ;-)

Definition at line 66 of file NonlinearSystemBase.h.

Constructor & Destructor Documentation

◆ NonlinearSystemBase()

NonlinearSystemBase::NonlinearSystemBase ( FEProblemBase problem,
libMesh::System sys,
const std::string &  name 
)

Definition at line 113 of file NonlinearSystemBase.C.

116  : SolverSystem(fe_problem, fe_problem, name, Moose::VAR_SOLVER),
117  PerfGraphInterface(fe_problem.getMooseApp().perfGraph(), "NonlinearSystemBase"),
118  _sys(sys),
119  _last_nl_rnorm(0.),
120  _current_nl_its(0),
121  _residual_ghosted(NULL),
122  _Re_time_tag(-1),
123  _Re_time(NULL),
124  _Re_non_time_tag(-1),
125  _Re_non_time(NULL),
126  _scalar_kernels(/*threaded=*/false),
127  _nodal_bcs(/*threaded=*/false),
128  _preset_nodal_bcs(/*threaded=*/false),
129  _ad_preset_nodal_bcs(/*threaded=*/false),
130  _splits(/*threaded=*/false),
131  _increment_vec(NULL),
133  _fdcoloring(nullptr),
134  _have_decomposition(false),
138  _need_residual_ghosted(false),
139  _debugging_residuals(false),
140  _doing_dg(false),
141  _n_iters(0),
142  _n_linear_iters(0),
144  _final_residual(0.),
148  _use_pre_smo_residual(false),
149  _print_all_var_norms(false),
150  _has_save_in(false),
151  _has_diag_save_in(false),
152  _has_nodalbc_save_in(false),
154  _computed_scaling(false),
155  _compute_scaling_once(true),
158  _auto_scaling_initd(false)
159 {
161  // Don't need to add the matrix - it already exists (for now)
163 
164  // The time matrix tag is not normally used - but must be added to the system
165  // in case it is so that objects can have 'time' in their matrix tags by default
166  _fe_problem.addMatrixTag("TIME");
167 
168  _Re_tag = _fe_problem.addVectorTag("RESIDUAL");
169 
171 
173  {
174  auto & dof_map = _sys.get_dof_map();
175  dof_map.remove_algebraic_ghosting_functor(dof_map.default_algebraic_ghosting());
176  dof_map.set_implicit_neighbor_dofs(false);
177  }
178 }
NumericVector< Number > * _Re_time
residual vector for time contributions
SolverSystem(SubProblem &subproblem, FEProblemBase &fe_problem, const std::string &name, Moose::VarKindType var_kind)
Definition: SolverSystem.C:17
TagID _Re_time_tag
Tag for time contribution residual.
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.
Real _initial_residual
The initial (i.e., 0th nonlinear iteration) residual, see setPreSMOResidual for a detailed explanatio...
bool identifyVariableGroupsInNL() const
Whether to identify variable groups in nonlinear systems.
bool _debugging_residuals
true if debugging residuals
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
bool _assemble_constraints_separately
Whether or not to assemble the residual and Jacobian after the application of each constraint...
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:92
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
bool _has_nodalbc_save_in
If there is a nodal BC having save_in.
Real _pre_smo_residual
The pre-SMO residual, see setPreSMOResidual for a detailed explanation.
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
TagID _Ke_system_tag
Tag for system contribution Jacobian.
bool _have_decomposition
Whether or not the system can be decomposed into splits.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
virtual const std::string & name() const
Definition: SystemBase.C:1330
TagID _Re_non_time_tag
Tag for non-time contribution residual.
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...
bool _auto_scaling_initd
Whether we&#39;ve initialized the automatic scaling data structures.
bool _doing_dg
true if DG is active (optimization reasons)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:311
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.
bool identify_variable_groups() const
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
unsigned int _n_residual_evaluations
Total number of residual evaluations that have been performed.
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
TagID _Re_tag
Used for the residual vector from PETSc.
libMesh::System & _sys
NumericVector< Number > * _increment_vec
increment vector
bool _use_field_split_preconditioner
Whether or not to use a FieldSplitPreconditioner matrix based on the decomposition.
PerfGraphInterface(const MooseObject *moose_object)
For objects that are MooseObjects with a default prefix of type()
bool _computed_scaling
Flag used to indicate whether we have already computed the scaling Jacobian.
void remove_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor)
NumericVector< Number > & getResidualNonTimeVector()
Return a numeric vector that is associated with the nontime tag.
bool defaultGhosting()
Whether or not the user has requested default ghosting ot be on.
Definition: SubProblem.h:144
const DofMap & get_dof_map() const
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ ~NonlinearSystemBase()

NonlinearSystemBase::~NonlinearSystemBase ( )
virtualdefault

Member Function Documentation

◆ activeAllMatrixTags()

void SystemBase::activeAllMatrixTags ( )
virtualinherited

Make all exsiting matrices ative.

Definition at line 1137 of file SystemBase.C.

Referenced by computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), computeResidualAndJacobianInternal(), and computeResidualTags().

1138 {
1139  auto num_matrix_tags = _subproblem.numMatrixTags();
1140 
1141  _matrix_tag_active_flags.resize(num_matrix_tags);
1142 
1143  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1144  if (hasMatrix(tag))
1145  _matrix_tag_active_flags[tag] = true;
1146  else
1147  _matrix_tag_active_flags[tag] = false;
1148 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1019
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248

◆ activeMatrixTag()

void SystemBase::activeMatrixTag ( TagID  tag)
virtualinherited

Active a matrix for tag.

Definition at line 1102 of file SystemBase.C.

1103 {
1104  mooseAssert(_subproblem.matrixTagExists(tag),
1105  "Cannot active Matrix with matrix_tag : " << tag << "that does not exist");
1106 
1107  if (_matrix_tag_active_flags.size() < tag + 1)
1108  _matrix_tag_active_flags.resize(tag + 1);
1109 
1110  _matrix_tag_active_flags[tag] = true;
1111 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1019
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ addBoundaryCondition()

void NonlinearSystemBase::addBoundaryCondition ( const std::string &  bc_name,
const std::string &  name,
InputParameters parameters 
)

Adds a boundary condition.

Parameters
bc_nameThe type of the boundary condition
nameThe name of the boundary condition
parametersBoundary condition parameters

Definition at line 521 of file NonlinearSystemBase.C.

524 {
525  // ThreadID
526  THREAD_ID tid = 0;
527 
528  // Create the object
529  std::shared_ptr<BoundaryCondition> bc =
530  _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
532 
533  // Active BoundaryIDs for the object
534  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
535  auto bc_var = dynamic_cast<const MooseVariableFieldBase *>(&bc->variable());
536  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
537 
538  // Cast to the various types of BCs
539  std::shared_ptr<NodalBCBase> nbc = std::dynamic_pointer_cast<NodalBCBase>(bc);
540  std::shared_ptr<IntegratedBCBase> ibc = std::dynamic_pointer_cast<IntegratedBCBase>(bc);
541 
542  // NodalBCBase
543  if (nbc)
544  {
545  if (nbc->checkNodalVar() && !nbc->variable().isNodal())
546  mooseError("Trying to use nodal boundary condition '",
547  nbc->name(),
548  "' on a non-nodal variable '",
549  nbc->variable().name(),
550  "'.");
551 
552  _nodal_bcs.addObject(nbc);
553  // Add to theWarehouse, a centralized storage for all moose objects
555  _vars[tid].addBoundaryVars(boundary_ids, nbc->getCoupledVars());
556 
557  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
558  _has_nodalbc_save_in = true;
559  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
561 
562  // DirichletBCs that are preset
563  std::shared_ptr<DirichletBCBase> dbc = std::dynamic_pointer_cast<DirichletBCBase>(bc);
564  if (dbc && dbc->preset())
566 
567  std::shared_ptr<ADDirichletBCBase> addbc = std::dynamic_pointer_cast<ADDirichletBCBase>(bc);
568  if (addbc && addbc->preset())
570  }
571 
572  // IntegratedBCBase
573  else if (ibc)
574  {
575  _integrated_bcs.addObject(ibc, tid);
576  // Add to theWarehouse, a centralized storage for all moose objects
578  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
579 
580  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
581  _has_save_in = true;
582  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
583  _has_diag_save_in = true;
584 
585  for (tid = 1; tid < libMesh::n_threads(); tid++)
586  {
587  // Create the object
588  bc = _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
589 
590  // Give users opportunity to set some parameters
592 
593  // Active BoundaryIDs for the object
594  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
595  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
596 
597  ibc = std::static_pointer_cast<IntegratedBCBase>(bc);
598 
599  _integrated_bcs.addObject(ibc, tid);
600  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
601  }
602  }
603 
604  else
605  mooseError("Unknown BoundaryCondition type for object named ", bc->name());
606 }
unsigned int n_threads()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
Base class for automatic differentiation Dirichlet BCs.
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Base boundary condition of a Dirichlet type.
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
Factory & _factory
Definition: SystemBase.h:983
bool _has_nodalbc_save_in
If there is a nodal BC having save_in.
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
This class provides an interface for common operations on field variables of both FE and FV types wit...
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1330
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
Base class for deriving any boundary condition that works at nodes.
Definition: NodalBCBase.h:26
Base class for creating new types of boundary conditions.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
Base class for deriving any boundary condition of a integrated type.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ addConstraint()

void NonlinearSystemBase::addConstraint ( const std::string &  c_name,
const std::string &  name,
InputParameters parameters 
)

Adds a Constraint.

Parameters
c_nameThe type of the constraint
nameThe name of the constraint
parametersConstraint parameters

Definition at line 609 of file NonlinearSystemBase.C.

612 {
613  std::shared_ptr<Constraint> constraint = _factory.create<Constraint>(c_name, name, parameters);
614  _constraints.addObject(constraint);
615  postAddResidualObject(*constraint);
616 
617  if (constraint && constraint->addCouplingEntriesToJacobian())
619 }
void addImplicitGeometricCouplingEntriesToJacobian(bool add=true)
If called with true this will add entries into the jacobian to link together degrees of freedom that ...
Base class for all Constraint types.
Definition: Constraint.h:19
Factory & _factory
Definition: SystemBase.h:983
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
ConstraintWarehouse _constraints
Constraints storage object.
void addObject(std::shared_ptr< Constraint > object, THREAD_ID tid=0, bool recurse=true) override
Add Constraint object to the warehouse.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.

◆ addDamper()

void NonlinearSystemBase::addDamper ( const std::string &  damper_name,
const std::string &  name,
InputParameters parameters 
)

Adds a damper.

Parameters
damper_nameThe type of the damper
nameThe name of the damper
parametersDamper parameters

Definition at line 682 of file NonlinearSystemBase.C.

685 {
686  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
687  {
688  std::shared_ptr<Damper> damper = _factory.create<Damper>(damper_name, name, parameters, tid);
689 
690  // Attempt to cast to the damper types
691  std::shared_ptr<ElementDamper> ed = std::dynamic_pointer_cast<ElementDamper>(damper);
692  std::shared_ptr<NodalDamper> nd = std::dynamic_pointer_cast<NodalDamper>(damper);
693  std::shared_ptr<GeneralDamper> gd = std::dynamic_pointer_cast<GeneralDamper>(damper);
694 
695  if (gd)
696  {
698  break; // not threaded
699  }
700  else if (ed)
701  _element_dampers.addObject(ed, tid);
702  else if (nd)
703  _nodal_dampers.addObject(nd, tid);
704  else
705  mooseError("Invalid damper type");
706  }
707 }
Base class for deriving general dampers.
Definition: GeneralDamper.h:21
unsigned int n_threads()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Factory & _factory
Definition: SystemBase.h:983
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
Base class for deriving nodal dampers.
Definition: NodalDamper.h:27
Base class for deriving element dampers.
Definition: ElementDamper.h:33
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
Base class for deriving dampers.
Definition: Damper.h:24
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addDGKernel()

void NonlinearSystemBase::addDGKernel ( std::string  dg_kernel_name,
const std::string &  name,
InputParameters parameters 
)

Adds a DG kernel.

Parameters
dg_kernel_nameThe type of the DG kernel
nameThe name of the DG kernel
parametersDG kernel parameters

Definition at line 638 of file NonlinearSystemBase.C.

641 {
642  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
643  {
644  auto dg_kernel = _factory.create<DGKernelBase>(dg_kernel_name, name, parameters, tid);
645  _dg_kernels.addObject(dg_kernel, tid);
646  // Add to theWarehouse, a centralized storage for all moose objects
647  _fe_problem.theWarehouse().add(dg_kernel);
648  postAddResidualObject(*dg_kernel);
649  }
650 
651  _doing_dg = true;
652 
653  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
654  _has_save_in = true;
655  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
656  _has_diag_save_in = true;
657 }
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
Serves as a base class for DGKernel and ADDGKernel.
Definition: DGKernelBase.h:32
virtual const std::string & name() const
Definition: SystemBase.C:1330
bool _doing_dg
true if DG is active (optimization reasons)
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addDiracKernel()

void NonlinearSystemBase::addDiracKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)

Adds a Dirac kernel.

Parameters
kernel_nameThe type of the dirac kernel
nameThe name of the Dirac kernel
parametersDirac kernel parameters

Definition at line 622 of file NonlinearSystemBase.C.

625 {
626  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
627  {
628  std::shared_ptr<DiracKernelBase> kernel =
629  _factory.create<DiracKernelBase>(kernel_name, name, parameters, tid);
630  postAddResidualObject(*kernel);
631  _dirac_kernels.addObject(kernel, tid);
632  // Add to theWarehouse, a centralized storage for all moose objects
633  _fe_problem.theWarehouse().add(kernel);
634  }
635 }
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
virtual const std::string & name() const
Definition: SystemBase.C:1330
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
DiracKernelBase is the base class for all DiracKernel type classes.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addDotVectors()

void SystemBase::addDotVectors ( )
virtualinherited

Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.

Reimplemented in DisplacedSystem.

Definition at line 1600 of file SystemBase.C.

Referenced by DisplacedSystem::addDotVectors().

1601 {
1602  if (_fe_problem.uDotRequested())
1603  _u_dot = &addVector("u_dot", true, GHOSTED);
1605  _u_dot_old = &addVector("u_dot_old", true, GHOSTED);
1607  _u_dotdot = &addVector("u_dotdot", true, GHOSTED);
1609  _u_dotdot_old = &addVector("u_dotdot_old", true, GHOSTED);
1610 }
virtual bool uDotDotOldRequested()
Get boolean flag to check whether old solution second time derivative needs to be stored...
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1005
virtual bool uDotRequested()
Get boolean flag to check whether solution time derivative needs to be stored.
virtual bool uDotDotRequested()
Get boolean flag to check whether solution second time derivative needs to be stored.
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1002
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
virtual bool uDotOldRequested()
Get boolean flag to check whether old solution time derivative needs to be stored.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1000
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1007

◆ addHDGKernel()

void NonlinearSystemBase::addHDGKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)
virtual

Adds a hybridized discontinuous Galerkin (HDG) kernel.

Parameters
kernel_nameThe type of the hybridized kernel
nameThe name of the hybridized kernel
parametersHDG kernel parameters

Definition at line 469 of file NonlinearSystemBase.C.

472 {
473  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
474  {
475  // Create the kernel object via the factory and add to warehouse
476  auto kernel = _factory.create<HDGKernel>(kernel_name, name, parameters, tid);
477  _kernels.addObject(kernel, tid);
478  _hybridized_kernels.addObject(kernel, tid);
479  // Add to theWarehouse, a centralized storage for all moose objects
480  _fe_problem.theWarehouse().add(kernel);
481  postAddResidualObject(*kernel);
482  }
483 }
A kernel for hybridized finite element formulations.
Definition: HDGKernel.h:17
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
MooseObjectTagWarehouse< HDGKernel > _hybridized_kernels
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addImplicitGeometricCouplingEntries()

void NonlinearSystemBase::addImplicitGeometricCouplingEntries ( GeometricSearchData geom_search_data)

Adds entries to the Jacobian in the correct positions for couplings coming from dofs being coupled that are related geometrically (i.e.

near each other across a gap).

Definition at line 2278 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal().

2279 {
2280  if (!hasMatrix(systemMatrixTag()))
2281  mooseError("Need a system matrix ");
2282 
2283  // At this point, have no idea how to make
2284  // this work with tag system
2285  auto & jacobian = getMatrix(systemMatrixTag());
2286 
2287  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
2288 
2289  findImplicitGeometricCouplingEntries(geom_search_data, graph);
2290 
2291  for (const auto & it : graph)
2292  {
2293  dof_id_type dof = it.first;
2294  const auto & row = it.second;
2295 
2296  for (const auto & coupled_dof : row)
2297  jacobian.add(dof, coupled_dof, 0);
2298  }
2299 }
void findImplicitGeometricCouplingEntries(GeometricSearchData &geom_search_data, std::unordered_map< dof_id_type, std::vector< dof_id_type >> &graph)
Finds the implicit sparsity graph between geometrically related dofs.
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
uint8_t dof_id_type

◆ addImplicitGeometricCouplingEntriesToJacobian()

void NonlinearSystemBase::addImplicitGeometricCouplingEntriesToJacobian ( bool  add = true)
inline

If called with true this will add entries into the jacobian to link together degrees of freedom that are found to be related through the geometric search system.

These entries are really only used by the Finite Difference Preconditioner and the constraint system right now.

Definition at line 472 of file NonlinearSystemBase.h.

Referenced by addConstraint(), and FiniteDifferencePreconditioner::FiniteDifferencePreconditioner().

473  {
475  }
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.

◆ addInterfaceKernel()

void NonlinearSystemBase::addInterfaceKernel ( std::string  interface_kernel_name,
const std::string &  name,
InputParameters parameters 
)

Adds an interface kernel.

Parameters
interface_kernel_nameThe type of the interface kernel
nameThe name of the interface kernel
parametersinterface kernel parameters

Definition at line 660 of file NonlinearSystemBase.C.

663 {
664  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
665  {
666  std::shared_ptr<InterfaceKernelBase> interface_kernel =
667  _factory.create<InterfaceKernelBase>(interface_kernel_name, name, parameters, tid);
668  postAddResidualObject(*interface_kernel);
669 
670  const std::set<BoundaryID> & boundary_ids = interface_kernel->boundaryIDs();
671  auto ik_var = dynamic_cast<const MooseVariableFieldBase *>(&interface_kernel->variable());
672  _vars[tid].addBoundaryVar(boundary_ids, ik_var);
673 
674  _interface_kernels.addObject(interface_kernel, tid);
675  // Add to theWarehouse, a centralized storage for all moose objects
676  _fe_problem.theWarehouse().add(interface_kernel);
677  _vars[tid].addBoundaryVars(boundary_ids, interface_kernel->getCoupledVars());
678  }
679 }
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
InterfaceKernelBase is the base class for all InterfaceKernel type classes.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addKernel()

void NonlinearSystemBase::addKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)
virtual

Adds a kernel.

Parameters
kernel_nameThe type of the kernel
nameThe name of the kernel
parametersKernel parameters

Reimplemented in MooseEigenSystem.

Definition at line 447 of file NonlinearSystemBase.C.

450 {
451  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
452  {
453  // Create the kernel object via the factory and add to warehouse
454  std::shared_ptr<KernelBase> kernel =
455  _factory.create<KernelBase>(kernel_name, name, parameters, tid);
456  _kernels.addObject(kernel, tid);
457  postAddResidualObject(*kernel);
458  // Add to theWarehouse, a centralized storage for all moose objects
459  _fe_problem.theWarehouse().add(kernel);
460  }
461 
462  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
463  _has_save_in = true;
464  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
465  _has_diag_save_in = true;
466 }
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
This is the common base class for the three main kernel types implemented in MOOSE, Kernel, VectorKernel and ArrayKernel.
Definition: KernelBase.h:23
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addMatrix()

SparseMatrix< Number > & SystemBase::addMatrix ( TagID  tag)
inherited

Adds a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 562 of file SystemBase.C.

563 {
564  if (!_subproblem.matrixTagExists(tag))
565  mooseError("Cannot add tagged matrix with TagID ",
566  tag,
567  " in system '",
568  name(),
569  "' because the tag does not exist in the problem");
570 
571  if (hasMatrix(tag))
572  return getMatrix(tag);
573 
574  const auto matrix_name = _subproblem.matrixTagName(tag);
575  SparseMatrix<Number> & mat = system().add_matrix(matrix_name);
576  associateMatrixToTag(mat, tag);
577 
578  return mat;
579 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1059
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:357

◆ addNodalKernel()

void NonlinearSystemBase::addNodalKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)
virtual

Adds a NodalKernel.

Parameters
kernel_nameThe type of the nodal kernel
nameThe name of the kernel
parametersKernel parameters

Definition at line 486 of file NonlinearSystemBase.C.

489 {
490  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
491  {
492  // Create the kernel object via the factory and add to the warehouse
493  std::shared_ptr<NodalKernelBase> kernel =
494  _factory.create<NodalKernelBase>(kernel_name, name, parameters, tid);
495  _nodal_kernels.addObject(kernel, tid);
496  // Add to theWarehouse, a centralized storage for all moose objects
497  _fe_problem.theWarehouse().add(kernel);
498  postAddResidualObject(*kernel);
499  }
500 
501  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
502  _has_save_in = true;
503  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
504  _has_diag_save_in = true;
505 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
Base class for creating new types of nodal kernels.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ addScalarKernel()

void NonlinearSystemBase::addScalarKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)

Adds a scalar kernel.

Parameters
kernel_nameThe type of the kernel
nameThe name of the kernel
parametersKernel parameters

Definition at line 508 of file NonlinearSystemBase.C.

511 {
512  std::shared_ptr<ScalarKernelBase> kernel =
513  _factory.create<ScalarKernelBase>(kernel_name, name, parameters);
514  postAddResidualObject(*kernel);
515  // Add to theWarehouse, a centralized storage for all moose objects
516  _fe_problem.theWarehouse().add(kernel);
517  _scalar_kernels.addObject(kernel);
518 }
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
Base class shared by AD and non-AD scalar kernels.
virtual void postAddResidualObject(ResidualObject &)
Called after any ResidualObject-derived objects are added to the system.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels

◆ addScalingVector()

void SystemBase::addScalingVector ( )
inherited

Add the scaling factor vector to the system.

Definition at line 1512 of file SystemBase.C.

Referenced by MooseVariableBase::initialSetup().

1513 {
1514  addVector("scaling_factors", /*project=*/false, libMesh::ParallelType::GHOSTED);
1516 }
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
void hasScalingVector(const unsigned int nl_sys_num)
Tells this problem that the assembly associated with the given nonlinear system number involves a sca...
Definition: SubProblem.C:1164
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159

◆ addSplit()

void NonlinearSystemBase::addSplit ( const std::string &  split_name,
const std::string &  name,
InputParameters parameters 
)

Adds a split.

Parameters
split_nameThe type of the split
nameThe name of the split
parametersSplit parameters

Definition at line 710 of file NonlinearSystemBase.C.

713 {
714  std::shared_ptr<Split> split = _factory.create<Split>(split_name, name, parameters);
716  // Add to theWarehouse, a centralized storage for all moose objects
718 }
Base class for split-based preconditioners.
Definition: Split.h:25
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:983
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
tbb::split split
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.

◆ addTimeIntegrator()

void SystemBase::addTimeIntegrator ( const std::string &  type,
const std::string &  name,
InputParameters parameters 
)
inherited

Definition at line 1625 of file SystemBase.C.

1628 {
1629  parameters.set<SystemBase *>("_sys") = this;
1630  _time_integrators.push_back(_factory.create<TimeIntegrator>(type, name, parameters));
1631 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
Definition: SystemBase.h:983
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
Base class for time integrators.

◆ addVariable()

void SystemBase::addVariable ( const std::string &  var_type,
const std::string &  var_name,
InputParameters parameters 
)
virtualinherited

Canonical method for adding a variable.

Parameters
var_typethe type of the variable, e.g. MooseVariableScalar
var_namethe variable name, e.g. 'u'
paramsthe InputParameters from which to construct the variable

Reimplemented in AuxiliarySystem.

Definition at line 710 of file SystemBase.C.

Referenced by AuxiliarySystem::addVariable().

713 {
715 
716  auto components = parameters.get<unsigned int>("components");
717 
718  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
719  // System::add_variable method
720  std::set<SubdomainID> blocks;
721  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
722  for (const auto & subdomain_name : block_param)
723  {
724  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
725  blocks.insert(blk_id);
726  }
727 
728  const auto fe_type =
729  FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
730  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
731  const auto fe_field_type = FEInterface::field_type(fe_type);
732 
733  unsigned int var_num;
734 
735  if (var_type == "ArrayMooseVariable")
736  {
737  if (fe_field_type == TYPE_VECTOR)
738  mooseError("Vector family type cannot be used in an array variable");
739 
740  std::vector<std::string> array_var_component_names;
741  const bool has_array_names = parameters.isParamValid("array_var_component_names");
742  if (has_array_names)
743  {
744  array_var_component_names =
745  parameters.get<std::vector<std::string>>("array_var_component_names");
746  if (array_var_component_names.size() != components)
747  mooseError("For variable ",
748  name,
749  ", parameter 'array_var_component_names' has ",
750  array_var_component_names.size(),
751  " name(s), but there are ",
752  components,
753  " array variable component(s).");
754  }
755 
756  // Build up the variable names
757  std::vector<std::string> var_names;
758  for (unsigned int i = 0; i < components; i++)
759  {
760  if (!has_array_names)
761  array_var_component_names.push_back(std::to_string(i));
762  var_names.push_back(name + "_" + array_var_component_names[i]);
763  }
764 
765  // makes sure there is always a name, either the provided one or '1 2 3 ...'
766  parameters.set<std::vector<std::string>>("array_var_component_names") =
767  array_var_component_names;
768 
769  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
770  // _first_
771  var_num = system().add_variables(var_names, fe_type, &blocks) - (components - 1);
772 
773  // Set as array variable
774  if (parameters.isParamSetByUser("array") && !parameters.get<bool>("array"))
775  mooseError("Variable '",
776  name,
777  "' is an array variable ('components' > 1) but 'array' is set to false.");
778  parameters.set<bool>("array") = true;
779  }
780  else
781  {
782  if (parameters.isParamSetByUser("array_var_component_names"))
783  mooseError("Variable '",
784  name,
785  "' is a regular variable. 'array_var_component_names' should not be set.");
786  var_num = system().add_variable(name, fe_type, &blocks);
787  }
788 
789  parameters.set<unsigned int>("_var_num") = var_num;
790  parameters.set<SystemBase *>("_system_base") = this;
791 
792  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
793  {
794  parameters.set<THREAD_ID>("tid") = tid;
795  std::shared_ptr<MooseVariableBase> var =
796  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
797 
798  _vars[tid].add(name, var);
799 
800  if (auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
801  {
802  auto required_size = var_num + components;
803  if (required_size > _numbered_vars[tid].size())
804  _numbered_vars[tid].resize(required_size);
805  for (MooseIndex(components) component = 0; component < components; ++component)
806  _numbered_vars[tid][var_num + component] = fe_var;
807 
808  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(fe_var))
809  _subproblem.addFunctor(name, *functor, tid);
810  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealVectorValue> *>(fe_var))
811  _subproblem.addFunctor(name, *functor, tid);
812  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<RealEigenVector> *>(fe_var))
813  _subproblem.addFunctor(name, *functor, tid);
814  else
815  mooseError("This should be a functor");
816  }
817 
818  if (var->blockRestricted())
819  for (const SubdomainID & id : var->blockIDs())
820  for (MooseIndex(components) component = 0; component < components; ++component)
821  _var_map[var_num + component].insert(id);
822  else
823  for (MooseIndex(components) component = 0; component < components; ++component)
824  _var_map[var_num + component] = std::set<SubdomainID>();
825  }
826 
827  // getMaxVariableNumber is an API method used in Rattlesnake
828  if (var_num > _max_var_number)
829  _max_var_number = var_num;
830  _du_dot_du.resize(var_num + 1);
831 }
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:1044
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
Definition: SystemBase.h:1011
unsigned int n_threads()
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
add a functor to the problem functor container
Definition: SubProblem.h:1375
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
Factory & _factory
Definition: SystemBase.h:983
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual std::unique_ptr< Base > create()=0
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:992
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
MooseMesh & _mesh
Definition: SystemBase.h:985
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:994
unsigned int THREAD_ID
Definition: MooseTypes.h:209
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1728
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ addVariableToCopy()

void SystemBase::addVariableToCopy ( const std::string &  dest_name,
const std::string &  source_name,
const std::string &  timestep 
)
virtualinherited

Add info about variable that will be copied.

Parameters
dest_nameName of the nodal variable being used for copying into (name is from the exodusII file)
source_nameName of the nodal variable being used for copying from (name is from the exodusII file)
timestepTimestep in the file being used

Definition at line 1177 of file SystemBase.C.

Referenced by CopyNodalVarsAction::act(), and PhysicsBase::copyVariablesFromMesh().

1180 {
1181  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
1182 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1032
Information about variables that will be copied.
Definition: SystemBase.h:66

◆ addVariableToZeroOnJacobian()

void SystemBase::addVariableToZeroOnJacobian ( std::string  var_name)
virtualinherited

Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 179 of file SystemBase.C.

Referenced by ADDGKernel::ADDGKernel(), DisplacedSystem::addVariableToZeroOnJacobian(), ADIntegratedBCTempl< T >::ADIntegratedBCTempl(), ADKernelTempl< T >::ADKernelTempl(), ArrayDGKernel::ArrayDGKernel(), ArrayIntegratedBC::ArrayIntegratedBC(), ArrayKernel::ArrayKernel(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernelTempl< T >::InterfaceKernelTempl(), Kernel::Kernel(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

180 {
181  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
182 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:997

◆ addVariableToZeroOnResidual()

void SystemBase::addVariableToZeroOnResidual ( std::string  var_name)
virtualinherited

Adds this variable to the list of variables to be zeroed during each residual evaluation.

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 173 of file SystemBase.C.

Referenced by ADDGKernel::ADDGKernel(), DisplacedSystem::addVariableToZeroOnResidual(), ADIntegratedBCTempl< T >::ADIntegratedBCTempl(), ADKernelTempl< T >::ADKernelTempl(), ArrayDGKernel::ArrayDGKernel(), ArrayIntegratedBC::ArrayIntegratedBC(), ArrayKernel::ArrayKernel(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernelTempl< T >::InterfaceKernelTempl(), Kernel::Kernel(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

174 {
175  _vars_to_be_zeroed_on_residual.push_back(var_name);
176 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:996

◆ addVector() [1/2]

NumericVector<Number>& SystemBase::addVector ( const std::string &  vector_name,
const bool  project,
const libMesh::ParallelType  type 
)
inherited

Adds a solution length vector to the system.

Parameters
vector_nameThe name of the vector.
projectWhether or not to project this vector when doing mesh refinement. If the vector is just going to be recomputed then there is no need to project it.
typeWhat type of parallel vector. This is usually either PARALLEL or GHOSTED. GHOSTED is needed if you are going to be accessing off-processor entries. The ghosting pattern is the same as the solution vector.

Referenced by SystemBase::addDotVectors(), SystemBase::addScalingVector(), NonlinearTimeIntegratorInterface::addVector(), SecantSolve::allocateStorage(), SteffensenSolve::allocateStorage(), PicardSolve::allocateStorage(), getResidualNonTimeVector(), getResidualTimeVector(), CentralDifference::initialSetup(), SystemBase::needSolutionState(), residualGhosted(), and SystemBase::saveOldSolutions().

◆ addVector() [2/2]

NumericVector<Number>& SystemBase::addVector ( TagID  tag,
const bool  project,
const libMesh::ParallelType  type 
)
inherited

Adds a solution length vector to the system with the specified TagID.

Parameters
tag_nameThe name of the tag
projectWhether or not to project this vector when doing mesh refinement. If the vector is just going to be recomputed then there is no need to project it.
typeWhat type of parallel vector. This is usually either PARALLEL or GHOSTED. GHOSTED is needed if you are going to be accessing off-processor entries. The ghosting pattern is the same as the solution vector.

◆ applyScalingFactors()

void SystemBase::applyScalingFactors ( const std::vector< Real > &  inverse_scaling_factors)
inherited

Applies scaling factors to the system's variables.

Parameters
inverse_scaling_factorsA vector containing the inverse of each variable's scaling factor, e.g. 1 / scaling_factor

Definition at line 1462 of file SystemBase.C.

Referenced by computeScaling().

1463 {
1464  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1465  {
1466  auto & field_variables = _vars[thread].fieldVariables();
1467  for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1468  {
1469  auto factors = field_variables[i]->arrayScalingFactor();
1470  for (unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1471  factors[j] /= inverse_scaling_factors[p];
1472 
1473  field_variables[i]->scalingFactor(factors);
1474  }
1475 
1476  auto offset = field_variables.size();
1477 
1478  auto & scalar_variables = _vars[thread].scalars();
1479  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1480  scalar_variables[i]->scalingFactor(
1481  {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1482 
1483  if (thread == 0 && _verbose)
1484  {
1485  _console << "Automatic scaling factors:\n";
1486  auto original_flags = _console.flags();
1487  auto original_precision = _console.precision();
1488  _console.unsetf(std::ios_base::floatfield);
1489  _console.precision(6);
1490 
1491  for (const auto & field_variable : field_variables)
1492  {
1493  const auto & factors = field_variable->arrayScalingFactor();
1494  _console << " " << field_variable->name() << ":";
1495  for (const auto i : make_range(field_variable->count()))
1496  _console << " " << factors[i];
1497  _console << "\n";
1498  }
1499  for (const auto & scalar_variable : scalar_variables)
1500  _console << " " << scalar_variable->name() << ": " << scalar_variable->scalingFactor()
1501  << "\n";
1502  _console << "\n" << std::endl;
1503 
1504  // restore state
1505  _console.flags(original_flags);
1506  _console.precision(original_precision);
1507  }
1508  }
1509 }
std::ios_base::fmtflags flags() const
Return the current flags.
Definition: ConsoleStream.C:56
void unsetf(std::ios_base::fmtflags mask) const
Unset format flags.
Definition: ConsoleStream.C:38
std::streamsize precision() const
Return the current precision.
Definition: ConsoleStream.C:44
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:1050
IntRange< T > make_range(T beg, T end)
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ assembleConstraintsSeparately()

void NonlinearSystemBase::assembleConstraintsSeparately ( bool  separately = true)
inline

Indicates whether to assemble residual and Jacobian after each constraint application.

When true, enables "transitive" constraint application: subsequent constraints can use prior constraints' results.

Definition at line 482 of file NonlinearSystemBase.h.

483  {
485  }
bool _assemble_constraints_separately
Whether or not to assemble the residual and Jacobian after the application of each constraint...

◆ assembleScalingVector()

void NonlinearSystemBase::assembleScalingVector ( )
protected

Assemble the numeric vector of scaling factors such that it can be used during assembly of the system matrix.

Definition at line 4047 of file NonlinearSystemBase.C.

Referenced by computeScaling(), and preSolve().

4048 {
4049  if (!hasVector("scaling_factors"))
4050  // No variables have indicated they need scaling
4051  return;
4052 
4053  auto & scaling_vector = getVector("scaling_factors");
4054 
4055  const auto & lm_mesh = _mesh.getMesh();
4056  const auto & dof_map = dofMap();
4057 
4058  const auto & field_variables = _vars[0].fieldVariables();
4059  const auto & scalar_variables = _vars[0].scalars();
4060 
4061  std::vector<dof_id_type> dof_indices;
4062 
4063  for (const Elem * const elem :
4064  as_range(lm_mesh.active_local_elements_begin(), lm_mesh.active_local_elements_end()))
4065  for (const auto * const field_var : field_variables)
4066  {
4067  const auto & factors = field_var->arrayScalingFactor();
4068  for (const auto i : make_range(field_var->count()))
4069  {
4070  dof_map.dof_indices(elem, dof_indices, field_var->number() + i);
4071  for (const auto dof : dof_indices)
4072  scaling_vector.set(dof, factors[i]);
4073  }
4074  }
4075 
4076  for (const auto * const scalar_var : scalar_variables)
4077  {
4078  mooseAssert(scalar_var->count() == 1,
4079  "Scalar variables should always have only one component.");
4080  dof_map.SCALAR_dof_indices(dof_indices, scalar_var->number());
4081  for (const auto dof : dof_indices)
4082  scaling_vector.set(dof, scalar_var->scalingFactor());
4083  }
4084 
4085  // Parallel assemble
4086  scaling_vector.close();
4087 
4088  if (auto * displaced_problem = _fe_problem.getDisplacedProblem().get())
4089  // copy into the corresponding displaced system vector because they should be the exact same
4090  displaced_problem->systemBaseNonlinear(number()).getVector("scaling_factors") = scaling_vector;
4091 }
std::shared_ptr< DisplacedProblem > displaced_problem
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1165
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3443
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:985
IntRange< T > make_range(T beg, T end)
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ assignMaxVarNDofsPerElem()

void SystemBase::assignMaxVarNDofsPerElem ( std::size_t  max_dofs)
inlineinherited

assign the maximum element dofs

Definition at line 598 of file SystemBase.h.

598 { _max_var_n_dofs_per_elem = max_dofs; }
size_t _max_var_n_dofs_per_elem
Maximum number of dofs for any one variable on any one element.
Definition: SystemBase.h:1035

◆ assignMaxVarNDofsPerNode()

void SystemBase::assignMaxVarNDofsPerNode ( std::size_t  max_dofs)
inlineinherited

assign the maximum node dofs

Definition at line 603 of file SystemBase.h.

603 { _max_var_n_dofs_per_node = max_dofs; }
size_t _max_var_n_dofs_per_node
Maximum number of dofs for any one variable on any one node.
Definition: SystemBase.h:1038

◆ associateMatrixToTag()

void SystemBase::associateMatrixToTag ( libMesh::SparseMatrix< Number > &  matrix,
TagID  tag 
)
virtualinherited

Associate a matrix to a tag.

Reimplemented in DisplacedSystem.

Definition at line 1059 of file SystemBase.C.

Referenced by SystemBase::addMatrix(), DisplacedSystem::associateMatrixToTag(), computeJacobian(), FEProblemBase::computeJacobianInternal(), FEProblemBase::computeJacobianTag(), FEProblemBase::computeLinearSystemSys(), and FEProblemBase::computeResidualAndJacobian().

1060 {
1061  if (!_subproblem.matrixTagExists(tag))
1062  mooseError("Cannot associate matrix to tag ", tag, " because that tag does not exist");
1063 
1064  if (_tagged_matrices.size() < tag + 1)
1065  _tagged_matrices.resize(tag + 1);
1066 
1067  _tagged_matrices[tag] = &matrix;
1068 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1017
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ associateVectorToTag()

void SystemBase::associateVectorToTag ( NumericVector< Number > &  vec,
TagID  tag 
)
virtualinherited

Associate a vector for a given tag.

Reimplemented in DisplacedSystem.

Definition at line 964 of file SystemBase.C.

Referenced by DisplacedSystem::associateVectorToTag(), FEProblemBase::computeLinearSystemSys(), FEProblemBase::computeResidualAndJacobian(), FEProblemBase::computeResidualInternal(), computeResidualTag(), FEProblemBase::computeResidualTag(), FEProblemBase::computeResidualType(), LinearSystem::LinearSystem(), and SolverSystem::setSolution().

965 {
966  if (!_subproblem.vectorTagExists(tag))
967  mooseError("Cannot associate vector to tag ", tag, " because that tag does not exist");
968 
969  if (_tagged_vectors.size() < tag + 1)
970  _tagged_vectors.resize(tag + 1);
971 
972  _tagged_vectors[tag] = &vec;
973 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ attachPreconditioner()

virtual void NonlinearSystemBase::attachPreconditioner ( libMesh::Preconditioner< Number > *  preconditioner)
pure virtual

Attach a customized preconditioner that requires physics knowledge.

Generic preconditioners should be implemented in PETSc, instead.

Implemented in NonlinearEigenSystem, NonlinearSystem, and DumpObjectsNonlinearSystem.

Referenced by PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), and VariableCondensationPreconditioner::VariableCondensationPreconditioner().

◆ augmentSendList()

void SystemBase::augmentSendList ( std::vector< dof_id_type > &  send_list)
virtualinherited

Will modify the send_list to add all of the extra ghosted dofs for this system.

Reimplemented in DisplacedSystem.

Definition at line 444 of file SystemBase.C.

Referenced by DisplacedSystem::augmentSendList(), and extraSendList().

445 {
446  std::set<dof_id_type> & ghosted_elems = _subproblem.ghostedElems();
447 
448  DofMap & dof_map = dofMap();
449 
450  std::vector<dof_id_type> dof_indices;
451 
452  System & sys = system();
453 
454  unsigned int sys_num = sys.number();
455 
456  unsigned int n_vars = sys.n_vars();
457 
458  for (const auto & elem_id : ghosted_elems)
459  {
460  Elem * elem = _mesh.elemPtr(elem_id);
461 
462  if (elem->active())
463  {
464  dof_map.dof_indices(elem, dof_indices);
465 
466  // Only need to ghost it if it's actually not on this processor
467  for (const auto & dof : dof_indices)
468  if (dof < dof_map.first_dof() || dof >= dof_map.end_dof())
469  send_list.push_back(dof);
470 
471  // Now add the DoFs from all of the nodes. This is necessary because of block
472  // restricted variables. A variable might not live _on_ this element but it
473  // might live on nodes connected to this element.
474  for (unsigned int n = 0; n < elem->n_nodes(); n++)
475  {
476  Node * node = elem->node_ptr(n);
477 
478  // Have to get each variable's dofs
479  for (unsigned int v = 0; v < n_vars; v++)
480  {
481  const Variable & var = sys.variable(v);
482  unsigned int var_num = var.number();
483  unsigned int n_comp = var.n_components();
484 
485  // See if this variable has any dofs at this node
486  if (node->n_dofs(sys_num, var_num) > 0)
487  {
488  // Loop over components of the variable
489  for (unsigned int c = 0; c < n_comp; c++)
490  send_list.push_back(node->dof_number(sys_num, var_num, c));
491  }
492  }
493  }
494  }
495  }
496 }
dof_id_type end_dof(const processor_id_type proc) const
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
const Variable & variable(unsigned int var) const
virtual Elem * elemPtr(const dof_id_type i)
Definition: MooseMesh.C:3108
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
unsigned int n_dofs(const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1165
unsigned int number() const
unsigned int n_vars
virtual unsigned int n_nodes() const=0
unsigned int n_components() const
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual std::set< dof_id_type > & ghostedElems()
Return the list of elements that should have their DoFs ghosted to this processor.
Definition: SubProblem.h:672
MooseMesh & _mesh
Definition: SystemBase.h:985
const Node * node_ptr(const unsigned int i) const
dof_id_type first_dof(const processor_id_type proc) const
unsigned int number() const
unsigned int n_vars() const
bool active() const

◆ augmentSparsity()

void NonlinearSystemBase::augmentSparsity ( libMesh::SparsityPattern::Graph sparsity,
std::vector< dof_id_type > &  n_nz,
std::vector< dof_id_type > &  n_oz 
)
overridevirtual

Will modify the sparsity pattern to add logical geometric connections.

Implements SystemBase.

Definition at line 3468 of file NonlinearSystemBase.C.

3471 {
3473  {
3475 
3476  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
3477 
3479 
3482  graph);
3483 
3484  const dof_id_type first_dof_on_proc = dofMap().first_dof(processor_id());
3485  const dof_id_type end_dof_on_proc = dofMap().end_dof(processor_id());
3486 
3487  // The total number of dofs on and off processor
3488  const dof_id_type n_dofs_on_proc = dofMap().n_local_dofs();
3489  const dof_id_type n_dofs_not_on_proc = dofMap().n_dofs() - dofMap().n_local_dofs();
3490 
3491  for (const auto & git : graph)
3492  {
3493  dof_id_type dof = git.first;
3494  dof_id_type local_dof = dof - first_dof_on_proc;
3495 
3496  if (dof < first_dof_on_proc || dof >= end_dof_on_proc)
3497  continue;
3498 
3499  const auto & row = git.second;
3500 
3501  SparsityPattern::Row & sparsity_row = sparsity[local_dof];
3502 
3503  unsigned int original_row_length = sparsity_row.size();
3504 
3505  sparsity_row.insert(sparsity_row.end(), row.begin(), row.end());
3506 
3508  sparsity_row.begin(), sparsity_row.begin() + original_row_length, sparsity_row.end());
3509 
3510  // Fix up nonzero arrays
3511  for (const auto & coupled_dof : row)
3512  {
3513  if (coupled_dof < first_dof_on_proc || coupled_dof >= end_dof_on_proc)
3514  {
3515  if (n_oz[local_dof] < n_dofs_not_on_proc)
3516  n_oz[local_dof]++;
3517  }
3518  else
3519  {
3520  if (n_nz[local_dof] < n_dofs_on_proc)
3521  n_nz[local_dof]++;
3522  }
3523  }
3524  }
3525  }
3526 }
dof_id_type end_dof(const processor_id_type proc) const
void findImplicitGeometricCouplingEntries(GeometricSearchData &geom_search_data, std::unordered_map< dof_id_type, std::vector< dof_id_type >> &graph)
Finds the implicit sparsity graph between geometrically related dofs.
dof_id_type n_dofs(const unsigned int vn) const
dof_id_type n_local_dofs(const unsigned int vn) const
virtual GeometricSearchData & geomSearchData() override
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1165
virtual void updateGeomSearch(GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
dof_id_type first_dof(const processor_id_type proc) const
processor_id_type processor_id() const
uint8_t dof_id_type
static void sort_row(const BidirectionalIterator begin, BidirectionalIterator middle, const BidirectionalIterator end)

◆ automaticScaling() [1/2]

bool SystemBase::automaticScaling ( ) const
inlineinherited

Getter for whether we are performing automatic scaling.

Returns
whether we are performing automatic scaling

Definition at line 122 of file SystemBase.h.

Referenced by SubProblem::automaticScaling().

122 { return _automatic_scaling; }
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1047

◆ automaticScaling() [2/2]

void SystemBase::automaticScaling ( bool  automatic_scaling)
inlineinherited

Setter for whether we are performing automatic scaling.

Parameters
automatic_scalingA boolean representing whether we are performing automatic scaling

Definition at line 128 of file SystemBase.h.

128 { _automatic_scaling = automatic_scaling; }
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1047

◆ autoScalingParam()

void NonlinearSystemBase::autoScalingParam ( Real  resid_vs_jac_scaling_param)
inline

Sets the param that indicates the weighting of the residual vs the Jacobian in determining variable scaling parameters.

A value of 1 indicates pure residual-based scaling. A value of 0 indicates pure Jacobian-based scaling

Definition at line 668 of file NonlinearSystemBase.h.

669  {
670  _resid_vs_jac_scaling_param = resid_vs_jac_scaling_param;
671  }
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...

◆ checkInvalidSolution()

void SolverSystem::checkInvalidSolution ( )
protectedinherited

Definition at line 111 of file SolverSystem.C.

Referenced by NonlinearSystem::solve(), and LinearSystem::solve().

112 {
113  auto & solution_invalidity = _app.solutionInvalidity();
114 
115  // sync all solution invalid counts to rank 0 process
116  solution_invalidity.syncIteration();
117 
118  if (solution_invalidity.hasInvalidSolution())
119  {
122  solution_invalidity.print(_console);
123  else
124  mooseWarning("The Solution Invalidity warnings are detected but silenced! "
125  "Use Problem/show_invalid_solution_console=true to show solution counts");
126  else
127  // output the occurrence of solution invalid in a summary table
129  solution_invalidity.print(_console);
130  }
131 }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:336
void syncIteration()
Sync iteration counts to main processor.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:167
bool showInvalidSolutionConsole() const
Whether or not to print out the invalid solutions summary table in console.
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool acceptInvalidSolution() const
Whether or not to accept the solution based on its invalidity.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ checkKernelCoverage()

void NonlinearSystemBase::checkKernelCoverage ( const std::set< SubdomainID > &  mesh_subdomains) const

System Integrity Checks

Definition at line 3590 of file NonlinearSystemBase.C.

3591 {
3592  // Obtain all blocks and variables covered by all kernels
3593  std::set<SubdomainID> input_subdomains;
3594  std::set<std::string> kernel_variables;
3595 
3596  bool global_kernels_exist = false;
3597  global_kernels_exist |= _scalar_kernels.hasActiveObjects();
3598  global_kernels_exist |= _nodal_kernels.hasActiveObjects();
3599 
3600  _kernels.subdomainsCovered(input_subdomains, kernel_variables);
3601  _dg_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3602  _nodal_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3603  _scalar_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3604  _constraints.subdomainsCovered(input_subdomains, kernel_variables);
3605 
3606  if (_fe_problem.haveFV())
3607  {
3608  std::vector<FVElementalKernel *> fv_elemental_kernels;
3610  .query()
3611  .template condition<AttribSystem>("FVElementalKernel")
3612  .queryInto(fv_elemental_kernels);
3613 
3614  for (auto fv_kernel : fv_elemental_kernels)
3615  {
3616  if (fv_kernel->blockRestricted())
3617  for (auto block_id : fv_kernel->blockIDs())
3618  input_subdomains.insert(block_id);
3619  else
3620  global_kernels_exist = true;
3621  kernel_variables.insert(fv_kernel->variable().name());
3622 
3623  // Check for lagrange multiplier
3624  if (dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel))
3625  kernel_variables.insert(dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel)
3626  ->lambdaVariable()
3627  .name());
3628  }
3629 
3630  std::vector<FVFluxKernel *> fv_flux_kernels;
3632  .query()
3633  .template condition<AttribSystem>("FVFluxKernel")
3634  .queryInto(fv_flux_kernels);
3635 
3636  for (auto fv_kernel : fv_flux_kernels)
3637  {
3638  if (fv_kernel->blockRestricted())
3639  for (auto block_id : fv_kernel->blockIDs())
3640  input_subdomains.insert(block_id);
3641  else
3642  global_kernels_exist = true;
3643  kernel_variables.insert(fv_kernel->variable().name());
3644  }
3645 
3646  std::vector<FVInterfaceKernel *> fv_interface_kernels;
3648  .query()
3649  .template condition<AttribSystem>("FVInterfaceKernel")
3650  .queryInto(fv_interface_kernels);
3651 
3652  for (auto fvik : fv_interface_kernels)
3653  if (auto scalar_fvik = dynamic_cast<FVScalarLagrangeMultiplierInterface *>(fvik))
3654  kernel_variables.insert(scalar_fvik->lambdaVariable().name());
3655 
3656  std::vector<FVFluxBC *> fv_flux_bcs;
3658  .query()
3659  .template condition<AttribSystem>("FVFluxBC")
3660  .queryInto(fv_flux_bcs);
3661 
3662  for (auto fvbc : fv_flux_bcs)
3663  if (auto scalar_fvbc = dynamic_cast<FVBoundaryScalarLagrangeMultiplierConstraint *>(fvbc))
3664  kernel_variables.insert(scalar_fvbc->lambdaVariable().name());
3665  }
3666 
3667  // Check kernel coverage of subdomains (blocks) in your mesh
3668  if (!global_kernels_exist)
3669  {
3670  std::set<SubdomainID> difference;
3671  std::set_difference(mesh_subdomains.begin(),
3672  mesh_subdomains.end(),
3673  input_subdomains.begin(),
3674  input_subdomains.end(),
3675  std::inserter(difference, difference.end()));
3676 
3677  // there supposed to be no kernels on this lower-dimensional subdomain
3678  for (const auto & id : _mesh.interiorLowerDBlocks())
3679  difference.erase(id);
3680  for (const auto & id : _mesh.boundaryLowerDBlocks())
3681  difference.erase(id);
3682 
3683  if (!difference.empty())
3684  {
3685  std::vector<SubdomainID> difference_vec =
3686  std::vector<SubdomainID>(difference.begin(), difference.end());
3687  std::vector<SubdomainName> difference_names = _mesh.getSubdomainNames(difference_vec);
3688  std::stringstream missing_block_names;
3689  std::copy(difference_names.begin(),
3690  difference_names.end(),
3691  std::ostream_iterator<std::string>(missing_block_names, " "));
3692  std::stringstream missing_block_ids;
3693  std::copy(difference.begin(),
3694  difference.end(),
3695  std::ostream_iterator<unsigned int>(missing_block_ids, " "));
3696 
3697  mooseError("Each subdomain must contain at least one Kernel.\nThe following block(s) lack an "
3698  "active kernel: " +
3699  missing_block_names.str(),
3700  " (ids: ",
3701  missing_block_ids.str(),
3702  ")");
3703  }
3704  }
3705 
3706  // Check kernel use of variables
3707  std::set<VariableName> variables(getVariableNames().begin(), getVariableNames().end());
3708 
3709  std::set<VariableName> difference;
3710  std::set_difference(variables.begin(),
3711  variables.end(),
3712  kernel_variables.begin(),
3713  kernel_variables.end(),
3714  std::inserter(difference, difference.end()));
3715 
3716  // skip checks for varaibles defined on lower-dimensional subdomain
3717  std::set<VariableName> vars(difference);
3718  for (auto & var_name : vars)
3719  {
3720  auto blks = getSubdomainsForVar(var_name);
3721  for (const auto & id : blks)
3722  if (_mesh.interiorLowerDBlocks().count(id) > 0 || _mesh.boundaryLowerDBlocks().count(id) > 0)
3723  difference.erase(var_name);
3724  }
3725 
3726  if (!difference.empty())
3727  {
3728  std::stringstream missing_kernel_vars;
3729  std::copy(difference.begin(),
3730  difference.end(),
3731  std::ostream_iterator<std::string>(missing_kernel_vars, " "));
3732  mooseError("Each variable must be referenced by at least one active Kernel.\nThe following "
3733  "variable(s) lack an active kernel: " +
3734  missing_kernel_vars.str());
3735  }
3736 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition: MooseMesh.h:1403
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
char ** vars
TheWarehouse & theWarehouse() const
void subdomainsCovered(std::set< SubdomainID > &subdomains_covered, std::set< std::string > &unique_variables, THREAD_ID tid=0) const
Populates a set of covered subdomains and the associated variable names.
MooseObjectTagWarehouse< KernelBase > _kernels
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition: MooseMesh.h:1407
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
Definition: MooseMesh.C:1764
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
MooseMesh & _mesh
Definition: SystemBase.h:985
bool hasActiveObjects(THREAD_ID tid=0) const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:861
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:762
void subdomainsCovered(std::set< SubdomainID > &subdomains_covered, std::set< std::string > &unique_variables, THREAD_ID tid=0) const
Update supplied subdomain and variable coverate containters.
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels

◆ clearAllDofIndices()

void SystemBase::clearAllDofIndices ( )
inherited

Clear all dof indices from moose variables.

Definition at line 1580 of file SystemBase.C.

Referenced by SubProblem::clearAllDofIndices().

1581 {
1582  for (auto & var_warehouse : _vars)
1583  var_warehouse.clearAllDofIndices();
1584 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ closeTaggedMatrices()

void SystemBase::closeTaggedMatrices ( const std::set< TagID > &  tags)
inherited

Close all matrices associated the tags.

Definition at line 1043 of file SystemBase.C.

Referenced by computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), and computeResidualAndJacobianTags().

1044 {
1045  for (auto tag : tags)
1046  if (hasMatrix(tag))
1047  getMatrix(tag).close();
1048 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual void close()=0
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007

◆ closeTaggedVector()

void SystemBase::closeTaggedVector ( const TagID  tag)
inherited

Close vector with the given tag.

Definition at line 641 of file SystemBase.C.

Referenced by SystemBase::closeTaggedVectors().

642 {
643  if (!_subproblem.vectorTagExists(tag))
644  mooseError("Cannot close vector with TagID ",
645  tag,
646  " in system '",
647  name(),
648  "' because that tag does not exist in the problem");
649  else if (!hasVector(tag))
650  mooseError("Cannot close vector tag with name '",
652  "' in system '",
653  name(),
654  "' because there is no vector associated with that tag");
655  getVector(tag).close();
656 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
virtual void close()=0
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ closeTaggedVectors()

void SystemBase::closeTaggedVectors ( const std::set< TagID > &  tags)
inherited

Close all vectors for given tags.

Definition at line 659 of file SystemBase.C.

Referenced by computeResidualAndJacobianTags(), computeResidualTags(), NonlinearSystem::stopSolve(), and LinearSystem::stopSolve().

660 {
661  for (const auto tag : tags)
662  closeTaggedVector(tag);
663 }
void closeTaggedVector(const TagID tag)
Close vector with the given tag.
Definition: SystemBase.C:641

◆ compute()

void SolverSystem::compute ( ExecFlagType  type)
overridevirtualinherited

Compute time derivatives, auxiliary variables, etc.

Parameters
typeOur current execution stage

Implements SystemBase.

Reimplemented in LinearSystem.

Definition at line 134 of file SolverSystem.C.

135 {
136  // Let's try not to overcompute
137  bool compute_tds = false;
138  if (type == EXEC_LINEAR)
139  compute_tds = true;
140  else if (type == EXEC_NONLINEAR)
141  {
143  compute_tds = true;
144  }
145  else if ((type == EXEC_TIMESTEP_END) || (type == EXEC_FINAL))
146  {
148  // We likely don't have a final residual evaluation upon which we compute the time derivatives
149  // so we need to do so now
150  compute_tds = true;
151  }
152 
153  if (compute_tds && _fe_problem.dt() > 0.)
154  for (auto & ti : _time_integrators)
155  {
156  // avoid division by dt which might be zero.
157  ti->preStep();
158  ti->computeTimeDerivatives();
159  }
160 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041
Solving a linear problem.
Definition: MooseTypes.h:848
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:34
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
virtual bool matrixFromColoring() const
Whether a system matrix is formed from coloring.
Definition: SolverSystem.h:102
Moose::SolveType _type
Definition: SolverParams.h:19
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:29
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:31
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
virtual Real & dt() const
const ExecFlagType EXEC_FINAL
Definition: Moose.C:42

◆ computeDamping()

Real NonlinearSystemBase::computeDamping ( const NumericVector< Number > &  solution,
const NumericVector< Number > &  update 
)

Compute damping.

Parameters
solutionThe trail solution vector
updateThe incremental update to the solution vector
Returns
returns The damping factor

Definition at line 3316 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeDamping().

3318 {
3319  // Default to no damping
3320  Real damping = 1.0;
3321  bool has_active_dampers = false;
3322 
3323  try
3324  {
3326  {
3327  PARALLEL_TRY
3328  {
3329  TIME_SECTION("computeDampers", 3, "Computing Dampers");
3330  has_active_dampers = true;
3334  damping = std::min(cid.damping(), damping);
3335  }
3336  PARALLEL_CATCH;
3337  }
3338 
3340  {
3341  PARALLEL_TRY
3342  {
3343  TIME_SECTION("computeDamping::element", 3, "Computing Element Damping");
3344 
3345  has_active_dampers = true;
3349  damping = std::min(cndt.damping(), damping);
3350  }
3351  PARALLEL_CATCH;
3352  }
3353 
3355  {
3356  PARALLEL_TRY
3357  {
3358  TIME_SECTION("computeDamping::general", 3, "Computing General Damping");
3359 
3360  has_active_dampers = true;
3361  const auto & gdampers = _general_dampers.getActiveObjects();
3362  for (const auto & damper : gdampers)
3363  {
3364  Real gd_damping = damper->computeDamping(solution, update);
3365  try
3366  {
3367  damper->checkMinDamping(gd_damping);
3368  }
3369  catch (MooseException & e)
3370  {
3372  }
3373  damping = std::min(gd_damping, damping);
3374  }
3375  }
3376  PARALLEL_CATCH;
3377  }
3378  }
3379  catch (MooseException & e)
3380  {
3381  // The buck stops here, we have already handled the exception by
3382  // calling stopSolve(), it is now up to PETSc to return a
3383  // "diverged" reason during the next solve.
3384  }
3385 
3386  _communicator.min(damping);
3387 
3388  if (has_active_dampers && damping < 1.0)
3389  _console << " Damping factor: " << damping << std::endl;
3390 
3391  return damping;
3392 }
virtual const char * what() const
Get out the error message.
NumericVector< Number > & solution()
Definition: SystemBase.h:195
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
const Parallel::Communicator & _communicator
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1245
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
void min(const T &r, T &o, Request &req) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
Provides a way for users to bail out of the current solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
NumericVector< Number > * _increment_vec
increment vector
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
auto min(const L &left, const R &right)

◆ computeDiracContributions()

void NonlinearSystemBase::computeDiracContributions ( const std::set< TagID > &  tags,
bool  is_jacobian 
)
protected

Definition at line 3395 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal(), and computeResidualInternal().

3396 {
3398 
3399  std::set<const Elem *> dirac_elements;
3400 
3402  {
3403  TIME_SECTION("computeDirac", 3, "Computing DiracKernels");
3404 
3405  // TODO: Need a threading fix... but it's complicated!
3406  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
3407  {
3408  const auto & dkernels = _dirac_kernels.getActiveObjects(tid);
3409  for (const auto & dkernel : dkernels)
3410  {
3411  dkernel->clearPoints();
3412  dkernel->addPoints();
3413  }
3414  }
3415 
3416  ComputeDiracThread cd(_fe_problem, tags, is_jacobian);
3417 
3418  _fe_problem.getDiracElements(dirac_elements);
3419 
3420  DistElemRange range(dirac_elements.begin(), dirac_elements.end(), 1);
3421  // TODO: Make Dirac work thread!
3422  // Threads::parallel_reduce(range, cd);
3423 
3424  cd(range);
3425  }
3426 }
unsigned int n_threads()
virtual void getDiracElements(std::set< const Elem *> &elems) override
Fills "elems" with the elements that should be looped over for Dirac Kernels.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
virtual void clearDiracInfo() override
Gets called before Dirac Kernels are asked to add the points they are supposed to be evaluated in...
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool hasActiveObjects(THREAD_ID tid=0) const
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ computedScalingJacobian()

bool NonlinearSystemBase::computedScalingJacobian ( ) const
inline

Definition at line 74 of file NonlinearSystemBase.h.

74 { return _computed_scaling; }
bool _computed_scaling
Flag used to indicate whether we have already computed the scaling Jacobian.

◆ computeJacobian() [1/2]

void NonlinearSystemBase::computeJacobian ( libMesh::SparseMatrix< Number > &  jacobian,
const std::set< TagID > &  tags 
)

Associate jacobian to systemMatrixTag, and then form a matrix for all the tags.

Definition at line 3166 of file NonlinearSystemBase.C.

Referenced by computeJacobian().

3167 {
3169 
3170  computeJacobianTags(tags);
3171 
3173 }
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1059
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1071
void computeJacobianTags(const std::set< TagID > &tags)
Computes multiple (tag associated) Jacobian matricese.

◆ computeJacobian() [2/2]

void NonlinearSystemBase::computeJacobian ( libMesh::SparseMatrix< Number > &  jacobian)

Take all tags in the system, and form a matrix for all tags in the system.

Definition at line 3153 of file NonlinearSystemBase.C.

3154 {
3155  _nl_matrix_tags.clear();
3156 
3157  auto & tags = _fe_problem.getMatrixTags();
3158 
3159  for (auto & tag : tags)
3160  _nl_matrix_tags.insert(tag.second);
3161 
3162  computeJacobian(jacobian, _nl_matrix_tags);
3163 }
void computeJacobian(libMesh::SparseMatrix< Number > &jacobian, const std::set< TagID > &tags)
Associate jacobian to systemMatrixTag, and then form a matrix for all the tags.
std::set< TagID > _nl_matrix_tags
Matrix tags to temporarily store all tags associated with the current system.
virtual std::map< TagName, TagID > & getMatrixTags()
Return all matrix tags in the system, where a tag is represented by a map from name to ID...
Definition: SubProblem.h:253
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980

◆ computeJacobianBlocks() [1/2]

void NonlinearSystemBase::computeJacobianBlocks ( std::vector< JacobianBlock *> &  blocks)

Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditioning matrices.

Used by Physics-based preconditioning

Parameters
blocksThe blocks to fill in (JacobianBlock is defined in ComputeJacobianBlocksThread)

Definition at line 3195 of file NonlinearSystemBase.C.

Referenced by EigenProblem::computeJacobianBlocks(), and FEProblemBase::computeJacobianBlocks().

3196 {
3197  _nl_matrix_tags.clear();
3198 
3199  auto & tags = _fe_problem.getMatrixTags();
3200  for (auto & tag : tags)
3201  _nl_matrix_tags.insert(tag.second);
3202 
3204 }
void computeJacobianBlocks(std::vector< JacobianBlock *> &blocks)
Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditio...
char ** blocks
std::set< TagID > _nl_matrix_tags
Matrix tags to temporarily store all tags associated with the current system.
virtual std::map< TagName, TagID > & getMatrixTags()
Return all matrix tags in the system, where a tag is represented by a map from name to ID...
Definition: SubProblem.h:253
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980

◆ computeJacobianBlocks() [2/2]

void NonlinearSystemBase::computeJacobianBlocks ( std::vector< JacobianBlock *> &  blocks,
const std::set< TagID > &  tags 
)

Definition at line 3207 of file NonlinearSystemBase.C.

3209 {
3210  TIME_SECTION("computeJacobianBlocks", 3);
3211  FloatingPointExceptionGuard fpe_guard(_app);
3212 
3213  for (unsigned int i = 0; i < blocks.size(); i++)
3214  {
3215  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3216 
3217  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3218  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
3219  PETSC_TRUE));
3221  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3222  MAT_NEW_NONZERO_ALLOCATION_ERR,
3223  PETSC_TRUE));
3224 
3225  jacobian.zero();
3226  }
3227 
3228  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
3230 
3231  PARALLEL_TRY
3232  {
3235  Threads::parallel_reduce(elem_range, cjb);
3236  }
3237  PARALLEL_CATCH;
3238 
3239  for (unsigned int i = 0; i < blocks.size(); i++)
3240  blocks[i]->_jacobian.close();
3241 
3242  for (unsigned int i = 0; i < blocks.size(); i++)
3243  {
3244  libMesh::System & precond_system = blocks[i]->_precond_system;
3245  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3246 
3247  unsigned int ivar = blocks[i]->_ivar;
3248  unsigned int jvar = blocks[i]->_jvar;
3249 
3250  // Dirichlet BCs
3251  std::vector<numeric_index_type> zero_rows;
3252  PARALLEL_TRY
3253  {
3255  for (const auto & bnode : bnd_nodes)
3256  {
3257  BoundaryID boundary_id = bnode->_bnd_id;
3258  Node * node = bnode->_node;
3259 
3260  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
3261  {
3262  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
3263 
3264  if (node->processor_id() == processor_id())
3265  {
3266  _fe_problem.reinitNodeFace(node, boundary_id, 0);
3267 
3268  for (const auto & bc : bcs)
3269  if (bc->variable().number() == ivar && bc->shouldApply())
3270  {
3271  // The first zero is for the variable number... there is only one variable in
3272  // each mini-system The second zero only works with Lagrange elements!
3273  zero_rows.push_back(node->dof_number(precond_system.number(), 0, 0));
3274  }
3275  }
3276  }
3277  }
3278  }
3279  PARALLEL_CATCH;
3280 
3281  jacobian.close();
3282 
3283  // This zeroes the rows corresponding to Dirichlet BCs and puts a 1.0 on the diagonal
3284  if (ivar == jvar)
3285  jacobian.zero_rows(zero_rows, 1.0);
3286  else
3287  jacobian.zero_rows(zero_rows, 0.0);
3288 
3289  jacobian.close();
3290  }
3291 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
unsigned int n_threads()
char ** blocks
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
Scope guard for starting and stopping Floating Point Exception Trapping.
Specialization for filling multiple "small" preconditioning matrices simulatenously.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
unsigned int number() const
virtual void zero()=0
boundary_id_type BoundaryID
virtual void zero_rows(std::vector< numeric_index_type > &rows, T diag_value=0.0)
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void close()=0
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const

◆ computeJacobianInternal()

void NonlinearSystemBase::computeJacobianInternal ( const std::set< TagID > &  tags)
protected

Form multiple matrices for all the tags.

Users should not call this func directly.

Definition at line 2787 of file NonlinearSystemBase.C.

Referenced by computeJacobianTags().

2788 {
2789  TIME_SECTION("computeJacobianInternal", 3);
2790 
2792 
2793  // Make matrix ready to use
2795 
2796  for (auto tag : tags)
2797  {
2798  if (!hasMatrix(tag))
2799  continue;
2800 
2801  auto & jacobian = getMatrix(tag);
2802  // Necessary for speed
2803  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
2804  {
2805  LibmeshPetscCall(MatSetOption(petsc_matrix->mat(),
2806  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2807  PETSC_TRUE));
2809  LibmeshPetscCall(
2810  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
2812  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2813  MAT_IGNORE_ZERO_ENTRIES,
2814  PETSC_TRUE));
2815  }
2816  }
2817 
2818  jacobianSetup();
2819 
2820  // Jacobian contributions from UOs - for now this is used for ray tracing
2821  // and ray kernels that contribute to the Jacobian (think line sources)
2822  std::vector<UserObject *> uos;
2824  .query()
2825  .condition<AttribSystem>("UserObject")
2826  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
2827  .queryInto(uos);
2828  for (auto & uo : uos)
2829  uo->jacobianSetup();
2830  for (auto & uo : uos)
2831  {
2832  uo->initialize();
2833  uo->execute();
2834  uo->finalize();
2835  }
2836 
2837  // reinit scalar variables
2838  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
2840 
2841  PARALLEL_TRY
2842  {
2843  // We would like to compute ScalarKernels, block NodalKernels, FVFluxKernels, and mortar objects
2844  // up front because we want these included whether we are computing an ordinary Jacobian or a
2845  // Jacobian for determining variable scaling factors
2847 
2848  // Block restricted Nodal Kernels
2850  {
2853  Threads::parallel_reduce(range, cnkjt);
2854 
2855  unsigned int n_threads = libMesh::n_threads();
2856  for (unsigned int i = 0; i < n_threads;
2857  i++) // Add any cached jacobians that might be hanging around
2859  }
2860 
2862  if (_fe_problem.haveFV())
2863  {
2864  // the same loop works for both residual and jacobians because it keys
2865  // off of FEProblem's _currently_computing_jacobian parameter
2867  _fe_problem, this->number(), tags, /*on_displaced=*/false);
2869  Threads::parallel_reduce(faces, fvj);
2870  }
2872  displaced_problem && displaced_problem->haveFV())
2873  {
2875  _fe_problem, this->number(), tags, /*on_displaced=*/true);
2876  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
2877  displaced_problem->mesh().ownedFaceInfoEnd());
2878  Threads::parallel_reduce(faces, fvr);
2879  }
2880 
2882 
2883  // Get our element range for looping over
2885 
2887  {
2888  // Only compute Jacobians corresponding to the diagonals of volumetric compute objects
2889  // because this typically gives us a good representation of the physics. NodalBCs and
2890  // Constraints can introduce dramatically different scales (often order unity).
2891  // IntegratedBCs and/or InterfaceKernels may use penalty factors. DGKernels may be ok, but
2892  // they are almost always used in conjunction with Kernels
2894  Threads::parallel_reduce(elem_range, cj);
2895  unsigned int n_threads = libMesh::n_threads();
2896  for (unsigned int i = 0; i < n_threads;
2897  i++) // Add any Jacobian contributions still hanging around
2899 
2900  // Check whether any exceptions were thrown and propagate this information for parallel
2901  // consistency before
2902  // 1) we do parallel communication when closing tagged matrices
2903  // 2) early returning before reaching our PARALLEL_CATCH below
2905 
2906  closeTaggedMatrices(tags);
2907 
2908  return;
2909  }
2910 
2911  switch (_fe_problem.coupling())
2912  {
2913  case Moose::COUPLING_DIAG:
2914  {
2916  Threads::parallel_reduce(elem_range, cj);
2917 
2918  unsigned int n_threads = libMesh::n_threads();
2919  for (unsigned int i = 0; i < n_threads;
2920  i++) // Add any Jacobian contributions still hanging around
2922 
2923  // Boundary restricted Nodal Kernels
2925  {
2928 
2929  Threads::parallel_reduce(bnd_range, cnkjt);
2930  unsigned int n_threads = libMesh::n_threads();
2931  for (unsigned int i = 0; i < n_threads;
2932  i++) // Add any cached jacobians that might be hanging around
2934  }
2935  }
2936  break;
2937 
2938  default:
2940  {
2942  Threads::parallel_reduce(elem_range, cj);
2943  unsigned int n_threads = libMesh::n_threads();
2944 
2945  for (unsigned int i = 0; i < n_threads; i++)
2947 
2948  // Boundary restricted Nodal Kernels
2950  {
2953 
2954  Threads::parallel_reduce(bnd_range, cnkjt);
2955  unsigned int n_threads = libMesh::n_threads();
2956  for (unsigned int i = 0; i < n_threads;
2957  i++) // Add any cached jacobians that might be hanging around
2959  }
2960  }
2961  break;
2962  }
2963 
2964  computeDiracContributions(tags, true);
2965 
2966  static bool first = true;
2967 
2968  // This adds zeroes into geometric coupling entries to ensure they stay in the matrix
2969  if ((_fe_problem.restoreOriginalNonzeroPattern() || first) &&
2971  {
2972  first = false;
2974 
2977  }
2978  }
2979  PARALLEL_CATCH;
2980 
2981  // Have no idea how to have constraints work
2982  // with the tag system
2983  PARALLEL_TRY
2984  {
2985  // Add in Jacobian contributions from other Constraints
2986  if (_fe_problem._has_constraints && tags.count(systemMatrixTag()))
2987  {
2988  // Some constraints need to be able to read values from the Jacobian, which requires that it
2989  // be closed/assembled
2990  auto & system_matrix = getMatrix(systemMatrixTag());
2991 #if PETSC_RELEASE_GREATER_EQUALS(3, 23, 0)
2992  SparseMatrix<Number> * view_jac_ptr;
2993  std::unique_ptr<SparseMatrix<Number>> hash_copy;
2994  if (system_matrix.use_hash_table())
2995  {
2996  hash_copy = libMesh::cast_ref<PetscMatrix<Number> &>(system_matrix).copy_from_hash();
2997  view_jac_ptr = hash_copy.get();
2998  }
2999  else
3000  view_jac_ptr = &system_matrix;
3001  auto & jacobian_to_view = *view_jac_ptr;
3002 #else
3003  auto & jacobian_to_view = system_matrix;
3004 #endif
3005  if (&jacobian_to_view == &system_matrix)
3006  system_matrix.close();
3007 
3008  // Nodal Constraints
3010 
3011  // Undisplaced Constraints
3012  constraintJacobians(jacobian_to_view, false);
3013 
3014  // Displaced Constraints
3016  constraintJacobians(jacobian_to_view, true);
3017  }
3018  }
3019  PARALLEL_CATCH;
3020 
3021  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
3022  // on boundary nodes
3023  if (_has_diag_save_in)
3025 
3026  PARALLEL_TRY
3027  {
3028  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
3029  // Select nodal kernels
3030  if (tags.size() == _fe_problem.numMatrixTags() || !tags.size())
3031  nbc_warehouse = &_nodal_bcs;
3032  else if (tags.size() == 1)
3033  nbc_warehouse = &(_nodal_bcs.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
3034  else
3035  nbc_warehouse = &(_nodal_bcs.getMatrixTagsObjectWarehouse(tags, 0));
3036 
3037  if (nbc_warehouse->hasActiveObjects())
3038  {
3039  // We may be switching from add to set. Moreover, we rely on a call to MatZeroRows to enforce
3040  // the nodal boundary condition constraints which requires that the matrix be truly assembled
3041  // as opposed to just flushed. Consequently we can't do the following despite any desire to
3042  // keep our initial sparsity pattern honored (see https://gitlab.com/petsc/petsc/-/issues/852)
3043  //
3044  // flushTaggedMatrices(tags);
3045  closeTaggedMatrices(tags);
3046 
3047  // Cache the information about which BCs are coupled to which
3048  // variables, so we don't have to figure it out for each node.
3049  std::map<std::string, std::set<unsigned int>> bc_involved_vars;
3050  const std::set<BoundaryID> & all_boundary_ids = _mesh.getBoundaryIDs();
3051  for (const auto & bid : all_boundary_ids)
3052  {
3053  // Get reference to all the NodalBCs for this ID. This is only
3054  // safe if there are NodalBCBases there to be gotten...
3055  if (nbc_warehouse->hasActiveBoundaryObjects(bid))
3056  {
3057  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(bid);
3058  for (const auto & bc : bcs)
3059  {
3060  const std::vector<MooseVariableFEBase *> & coupled_moose_vars =
3061  bc->getCoupledMooseVars();
3062 
3063  // Create the set of "involved" MOOSE nonlinear vars, which includes all coupled vars
3064  // and the BC's own variable
3065  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
3066  for (const auto & coupled_var : coupled_moose_vars)
3067  if (coupled_var->kind() == Moose::VAR_SOLVER)
3068  var_set.insert(coupled_var->number());
3069 
3070  var_set.insert(bc->variable().number());
3071  }
3072  }
3073  }
3074 
3075  // reinit scalar variables again. This reinit does not re-fill any of the scalar variable
3076  // solution arrays because that was done above. It only will reorder the derivative
3077  // information for AD calculations to be suitable for NodalBC calculations
3078  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
3079  _fe_problem.reinitScalars(tid, true);
3080 
3081  // Get variable coupling list. We do all the NodalBCBase stuff on
3082  // thread 0... The couplingEntries() data structure determines
3083  // which variables are "coupled" as far as the preconditioner is
3084  // concerned, not what variables a boundary condition specifically
3085  // depends on.
3086  auto & coupling_entries = _fe_problem.couplingEntries(/*_tid=*/0, this->number());
3087 
3088  // Compute Jacobians for NodalBCBases
3090  for (const auto & bnode : bnd_nodes)
3091  {
3092  BoundaryID boundary_id = bnode->_bnd_id;
3093  Node * node = bnode->_node;
3094 
3095  if (nbc_warehouse->hasActiveBoundaryObjects(boundary_id) &&
3096  node->processor_id() == processor_id())
3097  {
3098  _fe_problem.reinitNodeFace(node, boundary_id, 0);
3099 
3100  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
3101  for (const auto & bc : bcs)
3102  {
3103  // Get the set of involved MOOSE vars for this BC
3104  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
3105 
3106  // Loop over all the variables whose Jacobian blocks are
3107  // actually being computed, call computeOffDiagJacobian()
3108  // for each one which is actually coupled (otherwise the
3109  // value is zero.)
3110  for (const auto & it : coupling_entries)
3111  {
3112  unsigned int ivar = it.first->number(), jvar = it.second->number();
3113 
3114  // We are only going to call computeOffDiagJacobian() if:
3115  // 1.) the BC's variable is ivar
3116  // 2.) jvar is "involved" with the BC (including jvar==ivar), and
3117  // 3.) the BC should apply.
3118  if ((bc->variable().number() == ivar) && var_set.count(jvar) && bc->shouldApply())
3119  bc->computeOffDiagJacobian(jvar);
3120  }
3121 
3122  const auto & coupled_scalar_vars = bc->getCoupledMooseScalarVars();
3123  for (const auto & jvariable : coupled_scalar_vars)
3124  if (hasScalarVariable(jvariable->name()))
3125  bc->computeOffDiagJacobianScalar(jvariable->number());
3126  }
3127  }
3128  } // end loop over boundary nodes
3129 
3130  // Set the cached NodalBCBase values in the Jacobian matrix
3132  }
3133  }
3134  PARALLEL_CATCH;
3135 
3136  closeTaggedMatrices(tags);
3137 
3138  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
3139  // on boundary nodes
3142 
3143  if (hasDiagSaveIn())
3145 
3146  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
3147  // counters
3150 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase * > > & couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
unsigned int n_threads()
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::shared_ptr< DisplacedProblem > displaced_problem
virtual void checkExceptionAndStopSolve(bool print_message=true)
Check to see if an exception has occurred on any processor and, if possible, force the solve to fail...
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
NumericVector< Number > & solution()
Definition: SystemBase.h:195
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1507
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
bool hasDiagSaveIn() const
Weather or not the nonlinear system has diagonal Jacobian save-ins.
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
virtual GeometricSearchData & geomSearchData() override
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1245
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1043
void solutionInvalidAccumulation()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
void syncIteration()
Sync iteration counts to main processor.
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
void computeDiracContributions(const std::set< TagID > &tags, bool is_jacobian)
TheWarehouse & theWarehouse() const
boundary_id_type BoundaryID
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:167
void addImplicitGeometricCouplingEntries(GeometricSearchData &geom_search_data)
Adds entries to the Jacobian in the correct positions for couplings coming from dofs being coupled th...
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag...
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
Moose::CouplingType coupling() const
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
Definition: SystemBase.C:1137
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void close()=0
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:985
bool hasActiveObjects(THREAD_ID tid=0) const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
MooseObjectWarehouse< T > & getMatrixTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has one of the given matrix tags...
void computeScalarKernelsJacobians(const std::set< TagID > &tags)
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
virtual MooseMesh & mesh() override
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4497
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:52
void mortarConstraints(Moose::ComputeType compute_type, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Do mortar constraint residual/jacobian computations.
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
bool restoreOriginalNonzeroPattern() const
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1516
void constraintJacobians(const SparseMatrix< Number > &jacobian_to_view, bool displaced)
Add jacobian contributions from Constraints.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
bool _has_constraints
Whether or not this system has any Constraints.
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:859
processor_id_type processor_id() const
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition: Assembly.C:3820
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
virtual void jacobianSetup() override
virtual void addCachedJacobian(const THREAD_ID tid) override
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:815

◆ computeJacobianTags()

void NonlinearSystemBase::computeJacobianTags ( const std::set< TagID > &  tags)

Computes multiple (tag associated) Jacobian matricese.

Definition at line 3176 of file NonlinearSystemBase.C.

Referenced by computeJacobian(), and FEProblemBase::computeJacobianTags().

3177 {
3178  TIME_SECTION("computeJacobianTags", 5);
3179 
3180  FloatingPointExceptionGuard fpe_guard(_app);
3181 
3182  try
3183  {
3185  }
3186  catch (MooseException & e)
3187  {
3188  // The buck stops here, we have already handled the exception by
3189  // calling stopSolve(), it is now up to PETSc to return a
3190  // "diverged" reason during the next solve.
3191  }
3192 }
Scope guard for starting and stopping Floating Point Exception Trapping.
MooseApp & _app
Definition: SystemBase.h:982
Provides a way for users to bail out of the current solve.
void computeJacobianInternal(const std::set< TagID > &tags)
Form multiple matrices for all the tags.

◆ computeNodalBCs() [1/3]

void NonlinearSystemBase::computeNodalBCs ( NumericVector< Number > &  residual)
protected

Enforces nodal boundary conditions.

The boundary condition will be implemented in the residual using all the tags in the system.

Referenced by computeResidualTags().

◆ computeNodalBCs() [2/3]

void NonlinearSystemBase::computeNodalBCs ( NumericVector< Number > &  residual,
const std::set< TagID > &  tags 
)
protected

Form a residual for BCs that at least has one of the given tags.

◆ computeNodalBCs() [3/3]

void NonlinearSystemBase::computeNodalBCs ( const std::set< TagID > &  tags)
protected

Form multiple tag-associated residual vectors for the given tags.

Definition at line 2063 of file NonlinearSystemBase.C.

2064 {
2065  // We need to close the diag_save_in variables on the aux system before NodalBCBases clear the
2066  // dofs on boundary nodes
2067  if (_has_save_in)
2069 
2070  // Select nodal kernels
2071  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2072 
2073  if (tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL) || !tags.size())
2074  nbc_warehouse = &_nodal_bcs;
2075  else if (tags.size() == 1)
2076  nbc_warehouse = &(_nodal_bcs.getVectorTagObjectWarehouse(*(tags.begin()), 0));
2077  else
2078  nbc_warehouse = &(_nodal_bcs.getVectorTagsObjectWarehouse(tags, 0));
2079 
2080  // Return early if there is no nodal kernel
2081  if (!nbc_warehouse->size())
2082  return;
2083 
2084  PARALLEL_TRY
2085  {
2087 
2088  if (!bnd_nodes.empty())
2089  {
2090  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2091 
2092  for (const auto & bnode : bnd_nodes)
2093  {
2094  BoundaryID boundary_id = bnode->_bnd_id;
2095  Node * node = bnode->_node;
2096 
2097  if (node->processor_id() == processor_id() &&
2098  nbc_warehouse->hasActiveBoundaryObjects(boundary_id))
2099  {
2100  // reinit variables in nodes
2101  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2102 
2103  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
2104  for (const auto & nbc : bcs)
2105  if (nbc->shouldApply())
2106  nbc->computeResidual();
2107  }
2108  }
2109  }
2110  }
2111  PARALLEL_CATCH;
2112 
2113  if (_Re_time)
2114  _Re_time->close();
2115  _Re_non_time->close();
2116 }
NumericVector< Number > * _Re_time
residual vector for time contributions
unsigned int size(THREAD_ID tid=0) const
Return how many kernels we store in the current warehouse.
bool empty() const
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:195
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
boundary_id_type BoundaryID
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual unsigned int numVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
The total number of tags, which can be limited to the tag type.
Definition: SubProblem.C:195
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const

◆ computeNodalBCsResidualAndJacobian()

void NonlinearSystemBase::computeNodalBCsResidualAndJacobian ( )
protected

compute the residual and Jacobian for nodal boundary conditions

Definition at line 2119 of file NonlinearSystemBase.C.

Referenced by computeResidualAndJacobianTags().

2120 {
2121  PARALLEL_TRY
2122  {
2124 
2125  if (!bnd_nodes.empty())
2126  {
2127  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2128 
2129  for (const auto & bnode : bnd_nodes)
2130  {
2131  BoundaryID boundary_id = bnode->_bnd_id;
2132  Node * node = bnode->_node;
2133 
2134  if (node->processor_id() == processor_id())
2135  {
2136  // reinit variables in nodes
2137  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2138  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
2139  {
2140  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
2141  for (const auto & nbc : bcs)
2142  if (nbc->shouldApply())
2143  nbc->computeResidualAndJacobian();
2144  }
2145  }
2146  }
2147  }
2148  }
2149  PARALLEL_CATCH;
2150 
2151  // Set the cached NodalBCBase values in the Jacobian matrix
2153 }
bool empty() const
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
boundary_id_type BoundaryID
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4497
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:815

◆ computeResidual()

void NonlinearSystemBase::computeResidual ( NumericVector< Number > &  residual,
TagID  tag_id 
)

Form a residual vector for a given tag.

Definition at line 796 of file NonlinearSystemBase.C.

797 {
798  mooseDeprecated(" Please use computeResidualTag");
799 
800  computeResidualTag(residual, tag_id);
801 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
void computeResidualTag(NumericVector< Number > &residual, TagID tag_id)
Computes residual for a given tag.

◆ computeResidualAndJacobianInternal()

void NonlinearSystemBase::computeResidualAndJacobianInternal ( const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags 
)

Compute residual and Jacobian from contributions not related to constraints, such as nodal boundary conditions.

Definition at line 1944 of file NonlinearSystemBase.C.

Referenced by computeResidualAndJacobianTags().

1946 {
1947  TIME_SECTION("computeResidualAndJacobianInternal", 3);
1948 
1949  // Make matrix ready to use
1951 
1952  for (auto tag : matrix_tags)
1953  {
1954  if (!hasMatrix(tag))
1955  continue;
1956 
1957  auto & jacobian = getMatrix(tag);
1958  // Necessary for speed
1959  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
1960  {
1961  LibmeshPetscCall(MatSetOption(petsc_matrix->mat(),
1962  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
1963  PETSC_TRUE));
1965  LibmeshPetscCall(
1966  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
1968  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
1969  MAT_IGNORE_ZERO_ENTRIES,
1970  PETSC_TRUE));
1971  }
1972  }
1973 
1974  residualSetup();
1975 
1976  // Residual contributions from UOs - for now this is used for ray tracing
1977  // and ray kernels that contribute to the residual (think line sources)
1978  std::vector<UserObject *> uos;
1980  .query()
1981  .condition<AttribSystem>("UserObject")
1982  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1983  .queryInto(uos);
1984  for (auto & uo : uos)
1985  uo->residualSetup();
1986  for (auto & uo : uos)
1987  {
1988  uo->initialize();
1989  uo->execute();
1990  uo->finalize();
1991  }
1992 
1993  // reinit scalar variables
1994  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1996 
1997  // residual contributions from the domain
1998  PARALLEL_TRY
1999  {
2000  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
2001 
2003 
2004  ComputeResidualAndJacobianThread crj(_fe_problem, vector_tags, matrix_tags);
2005  Threads::parallel_reduce(elem_range, crj);
2006 
2008  if (_fe_problem.haveFV())
2009  {
2011  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/false);
2013  Threads::parallel_reduce(faces, fvrj);
2014  }
2016  displaced_problem && displaced_problem->haveFV())
2017  {
2019  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/true);
2020  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
2021  displaced_problem->mesh().ownedFaceInfoEnd());
2022  Threads::parallel_reduce(faces, fvr);
2023  }
2024 
2026 
2027  unsigned int n_threads = libMesh::n_threads();
2028  for (unsigned int i = 0; i < n_threads;
2029  i++) // Add any cached residuals that might be hanging around
2030  {
2033  }
2034  }
2035  PARALLEL_CATCH;
2036 }
unsigned int n_threads()
std::shared_ptr< DisplacedProblem > displaced_problem
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1507
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
TheWarehouse & theWarehouse() const
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
Definition: SystemBase.C:1137
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
virtual MooseMesh & mesh() override
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:52
void mortarConstraints(Moose::ComputeType compute_type, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Do mortar constraint residual/jacobian computations.
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1516
virtual void addCachedResidual(const THREAD_ID tid) override
virtual void addCachedJacobian(const THREAD_ID tid) override
virtual void residualSetup() override

◆ computeResidualAndJacobianTags()

void NonlinearSystemBase::computeResidualAndJacobianTags ( const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags 
)

Form possibly multiple tag-associated vectors and matrices.

Definition at line 884 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeResidualAndJacobian().

886 {
887  const bool required_residual =
888  vector_tags.find(residualVectorTag()) == vector_tags.end() ? false : true;
889 
890  try
891  {
892  zeroTaggedVectors(vector_tags);
893  computeResidualAndJacobianInternal(vector_tags, matrix_tags);
894  closeTaggedVectors(vector_tags);
895  closeTaggedMatrices(matrix_tags);
896 
897  if (required_residual)
898  {
899  auto & residual = getVector(residualVectorTag());
900  if (!_time_integrators.empty())
901  {
902  for (auto & ti : _time_integrators)
903  ti->postResidual(residual);
904  }
905  else
906  residual += *_Re_non_time;
907  residual.close();
908  }
909 
911  closeTaggedVectors(vector_tags);
912  closeTaggedMatrices(matrix_tags);
913  }
914  catch (MooseException & e)
915  {
916  // The buck stops here, we have already handled the exception by
917  // calling stopSolve(), it is now up to PETSc to return a
918  // "diverged" reason during the next solve.
919  }
920 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:685
void computeNodalBCsResidualAndJacobian()
compute the residual and Jacobian for nodal boundary conditions
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
void computeResidualAndJacobianInternal(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Compute residual and Jacobian from contributions not related to constraints, such as nodal boundary c...
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1043
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:659
virtual void close()=0
TagID residualVectorTag() const override
Provides a way for users to bail out of the current solve.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ computeResidualInternal()

void NonlinearSystemBase::computeResidualInternal ( const std::set< TagID > &  tags)
protected

Compute the residual for a given tag.

Parameters
tagsThe tags of kernels for which the residual is to be computed.

Definition at line 1724 of file NonlinearSystemBase.C.

Referenced by computeResidualTags().

1725 {
1726  parallel_object_only();
1727 
1728  TIME_SECTION("computeResidualInternal", 3);
1729 
1730  residualSetup();
1731 
1732  const auto vector_tag_data = _fe_problem.getVectorTags(tags);
1733 
1734  // Residual contributions from UOs - for now this is used for ray tracing
1735  // and ray kernels that contribute to the residual (think line sources)
1736  std::vector<UserObject *> uos;
1738  .query()
1739  .condition<AttribSystem>("UserObject")
1740  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1741  .queryInto(uos);
1742  for (auto & uo : uos)
1743  uo->residualSetup();
1744  for (auto & uo : uos)
1745  {
1746  uo->initialize();
1747  uo->execute();
1748  uo->finalize();
1749  }
1750 
1751  // reinit scalar variables
1752  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1754 
1755  // residual contributions from the domain
1756  PARALLEL_TRY
1757  {
1758  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1759 
1761 
1763  Threads::parallel_reduce(elem_range, cr);
1764 
1765  // We pass face information directly to FV residual objects for their evaluation. Consequently
1766  // we must make sure to do separate threaded loops for 1) undisplaced face information objects
1767  // and undisplaced residual objects and 2) displaced face information objects and displaced
1768  // residual objects
1770  if (_fe_problem.haveFV())
1771  {
1773  _fe_problem, this->number(), tags, /*on_displaced=*/false);
1775  Threads::parallel_reduce(faces, fvr);
1776  }
1778  displaced_problem && displaced_problem->haveFV())
1779  {
1781  _fe_problem, this->number(), tags, /*on_displaced=*/true);
1782  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1783  displaced_problem->mesh().ownedFaceInfoEnd());
1784  Threads::parallel_reduce(faces, fvr);
1785  }
1786 
1787  unsigned int n_threads = libMesh::n_threads();
1788  for (unsigned int i = 0; i < n_threads;
1789  i++) // Add any cached residuals that might be hanging around
1791  }
1792  PARALLEL_CATCH;
1793 
1794  // residual contributions from the scalar kernels
1795  PARALLEL_TRY
1796  {
1797  // do scalar kernels (not sure how to thread this)
1799  {
1800  TIME_SECTION("ScalarKernels", 3 /*, "Computing ScalarKernels"*/);
1801 
1802  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
1803  // This code should be refactored once we can do tags for scalar
1804  // kernels
1805  // Should redo this based on Warehouse
1806  if (!tags.size() || tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL))
1807  scalar_kernel_warehouse = &_scalar_kernels;
1808  else if (tags.size() == 1)
1809  scalar_kernel_warehouse =
1810  &(_scalar_kernels.getVectorTagObjectWarehouse(*(tags.begin()), 0));
1811  else
1812  // scalar_kernels is not threading
1813  scalar_kernel_warehouse = &(_scalar_kernels.getVectorTagsObjectWarehouse(tags, 0));
1814 
1815  bool have_scalar_contributions = false;
1816  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
1817  for (const auto & scalar_kernel : scalars)
1818  {
1819  scalar_kernel->reinit();
1820  const std::vector<dof_id_type> & dof_indices = scalar_kernel->variable().dofIndices();
1821  const DofMap & dof_map = scalar_kernel->variable().dofMap();
1822  const dof_id_type first_dof = dof_map.first_dof();
1823  const dof_id_type end_dof = dof_map.end_dof();
1824  for (dof_id_type dof : dof_indices)
1825  {
1826  if (dof >= first_dof && dof < end_dof)
1827  {
1828  scalar_kernel->computeResidual();
1829  have_scalar_contributions = true;
1830  break;
1831  }
1832  }
1833  }
1834  if (have_scalar_contributions)
1836  }
1837  }
1838  PARALLEL_CATCH;
1839 
1840  // residual contributions from Block NodalKernels
1841  PARALLEL_TRY
1842  {
1844  {
1845  TIME_SECTION("NodalKernels", 3 /*, "Computing NodalKernels"*/);
1846 
1848 
1850 
1851  if (range.begin() != range.end())
1852  {
1853  _fe_problem.reinitNode(*range.begin(), 0);
1854 
1855  Threads::parallel_reduce(range, cnk);
1856 
1857  unsigned int n_threads = libMesh::n_threads();
1858  for (unsigned int i = 0; i < n_threads;
1859  i++) // Add any cached residuals that might be hanging around
1861  }
1862  }
1863  }
1864  PARALLEL_CATCH;
1865 
1867  // We computed the volumetric objects. We can return now before we get into
1868  // any strongly enforced constraint conditions or penalty-type objects
1869  // (DGKernels, IntegratedBCs, InterfaceKernels, Constraints)
1870  return;
1871 
1872  // residual contributions from boundary NodalKernels
1873  PARALLEL_TRY
1874  {
1876  {
1877  TIME_SECTION("NodalKernelBCs", 3 /*, "Computing NodalKernelBCs"*/);
1878 
1880 
1882 
1883  Threads::parallel_reduce(bnd_node_range, cnk);
1884 
1885  unsigned int n_threads = libMesh::n_threads();
1886  for (unsigned int i = 0; i < n_threads;
1887  i++) // Add any cached residuals that might be hanging around
1889  }
1890  }
1891  PARALLEL_CATCH;
1892 
1894 
1895  if (_residual_copy.get())
1896  {
1897  _Re_non_time->close();
1899  }
1900 
1902  {
1903  _Re_non_time->close();
1906  }
1907 
1908  PARALLEL_TRY { computeDiracContributions(tags, false); }
1909  PARALLEL_CATCH;
1910 
1912  {
1913  PARALLEL_TRY { enforceNodalConstraintsResidual(*_Re_non_time); }
1914  PARALLEL_CATCH;
1915  _Re_non_time->close();
1916  }
1917 
1918  // Add in Residual contributions from other Constraints
1920  {
1921  PARALLEL_TRY
1922  {
1923  // Undisplaced Constraints
1925 
1926  // Displaced Constraints
1929 
1932  }
1933  PARALLEL_CATCH;
1934  _Re_non_time->close();
1935  }
1936 
1937  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
1938  // counters
1941 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
dof_id_type end_dof(const processor_id_type proc) const
unsigned int n_threads()
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::shared_ptr< DisplacedProblem > displaced_problem
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
virtual void reinitNode(const Node *node, const THREAD_ID tid) override
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1507
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void constraintResiduals(NumericVector< Number > &residual, bool displaced)
Add residual contributions from Constraints.
const Variable & variable(const unsigned int c) const override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
void solutionInvalidAccumulation()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
void syncIteration()
Sync iteration counts to main processor.
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
void computeDiracContributions(const std::set< TagID > &tags, bool is_jacobian)
TheWarehouse & theWarehouse() const
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:167
void computingScalingResidual(bool computing_scaling_residual)
Setter for whether we&#39;re computing the scaling residual.
std::vector< VectorTag > getVectorTags(const std::set< TagID > &tag_ids) const
Definition: SubProblem.C:172
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
void computingNonlinearResid(bool computing_nonlinear_residual) final
Set whether or not the problem is in the process of computing the nonlinear residual.
const_iterator end() const
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.
bool hasActiveObjects(THREAD_ID tid=0) const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
const_iterator begin() const
virtual MooseMesh & mesh() override
virtual unsigned int numVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const
The total number of tags, which can be limited to the tag type.
Definition: SubProblem.C:195
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:52
void mortarConstraints(Moose::ComputeType compute_type, const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Do mortar constraint residual/jacobian computations.
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1516
bool _has_constraints
Whether or not this system has any Constraints.
dof_id_type first_dof(const processor_id_type proc) const
void enforceNodalConstraintsResidual(NumericVector< Number > &residual)
Enforce nodal constraints.
virtual void addResidualScalar(const THREAD_ID tid=0)
virtual void addCachedResidual(const THREAD_ID tid) override
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
virtual void residualEnd(THREAD_ID tid=0) const
uint8_t dof_id_type
virtual void residualSetup() override
virtual void localize(std::vector< T > &v_local) const=0

◆ computeResidualTag()

void NonlinearSystemBase::computeResidualTag ( NumericVector< Number > &  residual,
TagID  tag_id 
)

Computes residual for a given tag.

Parameters
residualResidual is formed in here
thetag of kernels for which the residual is to be computed.

Definition at line 782 of file NonlinearSystemBase.C.

Referenced by computeResidual(), and CrankNicolson::init().

783 {
784  _nl_vector_tags.clear();
785  _nl_vector_tags.insert(tag_id);
787 
789 
791 
793 }
std::set< TagID > _nl_vector_tags
Vector tags to temporarily store all tags associated with the current system.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:964
void computeResidualTags(const std::set< TagID > &tags)
Form multiple tag-associated residual vectors for all the given tags.
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
TagID residualVectorTag() const override

◆ computeResidualTags()

void NonlinearSystemBase::computeResidualTags ( const std::set< TagID > &  tags)

Form multiple tag-associated residual vectors for all the given tags.

Definition at line 804 of file NonlinearSystemBase.C.

Referenced by computeResidualTag(), and FEProblemBase::computeResidualTags().

805 {
806  parallel_object_only();
807 
808  TIME_SECTION("nl::computeResidualTags", 5);
809 
812 
813  bool required_residual = tags.find(residualVectorTag()) == tags.end() ? false : true;
814 
816 
817  // not suppose to do anythin on matrix
819 
821 
822  for (const auto & numeric_vec : _vecs_to_zero_for_residual)
823  if (hasVector(numeric_vec))
824  {
825  NumericVector<Number> & vec = getVector(numeric_vec);
826  vec.close();
827  vec.zero();
828  }
829 
830  try
831  {
832  zeroTaggedVectors(tags);
834  closeTaggedVectors(tags);
835 
836  if (required_residual)
837  {
838  auto & residual = getVector(residualVectorTag());
839  if (!_time_integrators.empty())
840  {
841  for (auto & ti : _time_integrators)
842  ti->postResidual(residual);
843  }
844  else
845  residual += *_Re_non_time;
846  residual.close();
847  }
849  // We don't want to do nodal bcs or anything else
850  return;
851 
852  computeNodalBCs(tags);
853  closeTaggedVectors(tags);
854 
855  // If we are debugging residuals we need one more assignment to have the ghosted copy up to
856  // date
857  if (_need_residual_ghosted && _debugging_residuals && required_residual)
858  {
859  auto & residual = getVector(residualVectorTag());
860 
861  *_residual_ghosted = residual;
863  }
864  // Need to close and update the aux system in case residuals were saved to it.
867  if (hasSaveIn())
869  }
870  catch (MooseException & e)
871  {
872  // The buck stops here, we have already handled the exception by
873  // calling stopSolve(), it is now up to PETSc to return a
874  // "diverged" reason during the next solve.
875  }
876 
877  // not supposed to do anything on matrix
879 
881 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:685
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
bool _debugging_residuals
true if debugging residuals
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:195
void setCurrentlyComputingResidual(bool currently_computing_residual) final
Set whether or not the problem is in the process of computing the residual.
bool _has_nodalbc_save_in
If there is a nodal BC having save_in.
Scope guard for starting and stopping Floating Point Exception Trapping.
virtual void zero()=0
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1245
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
virtual void deactiveAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1126
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
void computingScalingResidual(bool computing_scaling_residual)
Setter for whether we&#39;re computing the scaling residual.
std::vector< std::string > _vecs_to_zero_for_residual
vectors that will be zeroed before a residual computation
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
Definition: SystemBase.C:1137
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
AuxiliarySystem & getAuxiliarySystem()
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:659
void computeResidualInternal(const std::set< TagID > &tags)
Compute the residual for a given tag.
virtual void close()=0
TagID residualVectorTag() const override
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
Provides a way for users to bail out of the current solve.
unsigned int _n_residual_evaluations
Total number of residual evaluations that have been performed.
bool hasSaveIn() const
Weather or not the nonlinear system has save-ins.
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
void computeNodalBCs(NumericVector< Number > &residual)
Enforces nodal boundary conditions.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ computeScalarKernelsJacobians()

void NonlinearSystemBase::computeScalarKernelsJacobians ( const std::set< TagID > &  tags)
protected

Definition at line 2713 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal().

2714 {
2715  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
2716 
2717  if (!tags.size() || tags.size() == _fe_problem.numMatrixTags())
2718  scalar_kernel_warehouse = &_scalar_kernels;
2719  else if (tags.size() == 1)
2720  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
2721  else
2722  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagsObjectWarehouse(tags, 0));
2723 
2724  // Compute the diagonal block for scalar variables
2725  if (scalar_kernel_warehouse->hasActiveObjects())
2726  {
2727  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
2728 
2729  _fe_problem.reinitScalars(/*tid=*/0);
2730 
2731  _fe_problem.reinitOffDiagScalars(/*_tid*/ 0);
2732 
2733  bool have_scalar_contributions = false;
2734  for (const auto & kernel : scalars)
2735  {
2736  kernel->reinit();
2737  const std::vector<dof_id_type> & dof_indices = kernel->variable().dofIndices();
2738  const DofMap & dof_map = kernel->variable().dofMap();
2739  const dof_id_type first_dof = dof_map.first_dof();
2740  const dof_id_type end_dof = dof_map.end_dof();
2741  for (dof_id_type dof : dof_indices)
2742  {
2743  if (dof >= first_dof && dof < end_dof)
2744  {
2745  kernel->computeJacobian();
2746  _fe_problem.addJacobianOffDiagScalar(kernel->variable().number());
2747  have_scalar_contributions = true;
2748  break;
2749  }
2750  }
2751  }
2752 
2753  if (have_scalar_contributions)
2755  }
2756 }
dof_id_type end_dof(const processor_id_type proc) const
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
virtual void addJacobianOffDiagScalar(unsigned int ivar, const THREAD_ID tid=0)
const Variable & variable(const unsigned int c) const override
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag...
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< T > & getMatrixTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has one of the given matrix tags...
dof_id_type first_dof(const processor_id_type proc) const
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
uint8_t dof_id_type
virtual void addJacobianScalar(const THREAD_ID tid=0)

◆ computeScaling()

bool NonlinearSystemBase::computeScaling ( )

Method used to obtain scaling factors for variables.

Returns
whether this method ran without exceptions

Definition at line 3886 of file NonlinearSystemBase.C.

Referenced by preSolve().

3887 {
3889  return true;
3890 
3891  _console << "\nPerforming automatic scaling calculation\n" << std::endl;
3892 
3893  TIME_SECTION("computeScaling", 3, "Computing Automatic Scaling");
3894 
3895  // It's funny but we need to assemble our vector of scaling factors here otherwise we will be
3896  // applying scaling factors of 0 during Assembly of our scaling Jacobian
3898 
3899  // container for repeated access of element global dof indices
3900  std::vector<dof_id_type> dof_indices;
3901 
3902  if (!_auto_scaling_initd)
3903  setupScalingData();
3904 
3905  std::vector<Real> inverse_scaling_factors(_num_scaling_groups, 0);
3906  std::vector<Real> resid_inverse_scaling_factors(_num_scaling_groups, 0);
3907  std::vector<Real> jac_inverse_scaling_factors(_num_scaling_groups, 0);
3908  auto & dof_map = dofMap();
3909 
3910  // what types of scaling do we want?
3911  bool jac_scaling = _resid_vs_jac_scaling_param < 1. - TOLERANCE;
3912  bool resid_scaling = _resid_vs_jac_scaling_param > TOLERANCE;
3913 
3914  const NumericVector<Number> & scaling_residual = RHS();
3915 
3916  if (jac_scaling)
3917  {
3918  // if (!_auto_scaling_initd)
3919  // We need to reinit this when the number of dofs changes
3920  // but there is no good way to track that
3921  // In theory, it is the job of libmesh system to track this,
3922  // but this special matrix is not owned by libMesh system
3923  // Let us reinit eveytime since it is not expensive
3924  {
3925  auto init_vector = NumericVector<Number>::build(this->comm());
3926  init_vector->init(system().n_dofs(), system().n_local_dofs(), /*fast=*/false, PARALLEL);
3927 
3928  _scaling_matrix->clear();
3929  _scaling_matrix->init(*init_vector);
3930  }
3931 
3933  // Dispatch to derived classes to ensure that we use the correct matrix tag
3936  }
3937 
3938  if (resid_scaling)
3939  {
3942  // Dispatch to derived classes to ensure that we use the correct vector tag
3946  }
3947 
3948  // Did something bad happen during residual/Jacobian scaling computation?
3950  return false;
3951 
3952  auto examine_dof_indices = [this,
3953  jac_scaling,
3954  resid_scaling,
3955  &dof_map,
3956  &jac_inverse_scaling_factors,
3957  &resid_inverse_scaling_factors,
3958  &scaling_residual](const auto & dof_indices, const auto var_number)
3959  {
3960  for (auto dof_index : dof_indices)
3961  if (dof_map.local_index(dof_index))
3962  {
3963  if (jac_scaling)
3964  {
3965  // For now we will use the diagonal for determining scaling
3966  auto mat_value = (*_scaling_matrix)(dof_index, dof_index);
3967  auto & factor = jac_inverse_scaling_factors[_var_to_group_var[var_number]];
3968  factor = std::max(factor, std::abs(mat_value));
3969  }
3970  if (resid_scaling)
3971  {
3972  auto vec_value = scaling_residual(dof_index);
3973  auto & factor = resid_inverse_scaling_factors[_var_to_group_var[var_number]];
3974  factor = std::max(factor, std::abs(vec_value));
3975  }
3976  }
3977  };
3978 
3979  // Compute our scaling factors for the spatial field variables
3980  for (const auto & elem : _fe_problem.getCurrentAlgebraicElementRange())
3981  for (const auto i : make_range(system().n_vars()))
3983  {
3984  dof_map.dof_indices(elem, dof_indices, i);
3985  examine_dof_indices(dof_indices, i);
3986  }
3987 
3988  for (const auto i : make_range(system().n_vars()))
3989  if (_variable_autoscaled[i] && system().variable_type(i).family == SCALAR)
3990  {
3991  dof_map.SCALAR_dof_indices(dof_indices, i);
3992  examine_dof_indices(dof_indices, i);
3993  }
3994 
3995  if (resid_scaling)
3996  _communicator.max(resid_inverse_scaling_factors);
3997  if (jac_scaling)
3998  _communicator.max(jac_inverse_scaling_factors);
3999 
4000  if (jac_scaling && resid_scaling)
4001  for (MooseIndex(inverse_scaling_factors) i = 0; i < inverse_scaling_factors.size(); ++i)
4002  {
4003  // Be careful not to take log(0)
4004  if (!resid_inverse_scaling_factors[i])
4005  {
4006  if (!jac_inverse_scaling_factors[i])
4007  inverse_scaling_factors[i] = 1;
4008  else
4009  inverse_scaling_factors[i] = jac_inverse_scaling_factors[i];
4010  }
4011  else if (!jac_inverse_scaling_factors[i])
4012  // We know the resid is not zero
4013  inverse_scaling_factors[i] = resid_inverse_scaling_factors[i];
4014  else
4015  inverse_scaling_factors[i] =
4016  std::exp(_resid_vs_jac_scaling_param * std::log(resid_inverse_scaling_factors[i]) +
4017  (1 - _resid_vs_jac_scaling_param) * std::log(jac_inverse_scaling_factors[i]));
4018  }
4019  else if (jac_scaling)
4020  inverse_scaling_factors = jac_inverse_scaling_factors;
4021  else if (resid_scaling)
4022  inverse_scaling_factors = resid_inverse_scaling_factors;
4023  else
4024  mooseError("We shouldn't be calling this routine if we're not performing any scaling");
4025 
4026  // We have to make sure that our scaling values are not zero
4027  for (auto & scaling_factor : inverse_scaling_factors)
4028  if (scaling_factor == 0)
4029  scaling_factor = 1;
4030 
4031  // Now flatten the group scaling factors to the individual variable scaling factors
4032  std::vector<Real> flattened_inverse_scaling_factors(system().n_vars());
4033  for (const auto i : index_range(flattened_inverse_scaling_factors))
4034  flattened_inverse_scaling_factors[i] = inverse_scaling_factors[_var_to_group_var[i]];
4035 
4036  // Now set the scaling factors for the variables
4037  applyScalingFactors(flattened_inverse_scaling_factors);
4039  displaced_problem->systemBaseNonlinear(number()).applyScalingFactors(
4040  flattened_inverse_scaling_factors);
4041 
4042  _computed_scaling = true;
4043  return true;
4044 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
std::vector< bool > _variable_autoscaled
Container to hold flag if variable is to participate in autoscaling.
std::shared_ptr< DisplacedProblem > displaced_problem
void applyScalingFactors(const std::vector< Real > &inverse_scaling_factors)
Applies scaling factors to the system&#39;s variables.
Definition: SystemBase.C:1462
SCALAR
auto exp(const T &)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const Parallel::Communicator & comm() const
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
const Parallel::Communicator & _communicator
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
std::size_t _num_scaling_groups
The number of scaling groups.
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...
auto max(const L &left, const R &right)
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...
bool _auto_scaling_initd
Whether we&#39;ve initialized the automatic scaling data structures.
virtual void computeScalingResidual()=0
Compute a "residual" for automatic scaling purposes.
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1165
std::unordered_map< unsigned int, unsigned int > _var_to_group_var
A map from variable index to group variable index and it&#39;s associated (inverse) scaling factor...
unsigned int n_vars
void computingScalingResidual(bool computing_scaling_residual)
Setter for whether we&#39;re computing the scaling residual.
virtual void computeScalingJacobian()=0
Compute a "Jacobian" for automatic scaling purposes.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
void setupScalingData()
Setup group scaling containers.
auto log(const T &)
void computingNonlinearResid(bool computing_nonlinear_residual) final
Set whether or not the problem is in the process of computing the nonlinear residual.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual NumericVector< Number > & RHS()=0
const FEType & variable_type(const unsigned int i) const
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
void max(const T &r, T &o, Request &req) const
bool getFailNextNonlinearConvergenceCheck() const
Whether it will skip further residual evaluations and fail the next nonlinear convergence check(s) ...
IntRange< T > make_range(T beg, T end)
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
bool _computed_scaling
Flag used to indicate whether we have already computed the scaling Jacobian.
auto index_range(const T &sizable)
void assembleScalingVector()
Assemble the numeric vector of scaling factors such that it can be used during assembly of the system...
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ computeScalingJacobian()

virtual void NonlinearSystemBase::computeScalingJacobian ( )
protectedpure virtual

Compute a "Jacobian" for automatic scaling purposes.

Implemented in NonlinearEigenSystem, NonlinearSystem, and DumpObjectsNonlinearSystem.

Referenced by computeScaling().

◆ computeScalingOnce() [1/2]

bool NonlinearSystemBase::computeScalingOnce ( ) const
inline

Definition at line 657 of file NonlinearSystemBase.h.

657 { return _compute_scaling_once; }
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...

◆ computeScalingOnce() [2/2]

void NonlinearSystemBase::computeScalingOnce ( bool  compute_scaling_once)
inline

Definition at line 658 of file NonlinearSystemBase.h.

659  {
660  _compute_scaling_once = compute_scaling_once;
661  }
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...

◆ computeScalingResidual()

virtual void NonlinearSystemBase::computeScalingResidual ( )
protectedpure virtual

Compute a "residual" for automatic scaling purposes.

Implemented in NonlinearEigenSystem, NonlinearSystem, and DumpObjectsNonlinearSystem.

Referenced by computeScaling().

◆ computeVariables()

virtual void SystemBase::computeVariables ( const NumericVector< Number > &  )
inlinevirtualinherited

Definition at line 870 of file SystemBase.h.

870 {}

◆ computingPreSMOResidual()

bool NonlinearSystemBase::computingPreSMOResidual ( )
inline

Returns true if this system is currently computing the pre-SMO residual for a solve.

Returns
Whether or not we are currently computing the pre-SMO residual.

Definition at line 93 of file NonlinearSystemBase.h.

◆ computingScalingJacobian()

bool SystemBase::computingScalingJacobian ( ) const
inherited

Whether we are computing an initial Jacobian for automatic variable scaling.

Definition at line 1519 of file SystemBase.C.

Referenced by Assembly::addJacobianBlock(), Assembly::addJacobianBlockNonlocal(), VectorKernel::computeJacobian(), Kernel::computeJacobian(), EigenKernel::computeJacobian(), and FEProblemBase::computeJacobianTags().

1520 {
1522 }
virtual bool computingScalingJacobian() const =0
Getter for whether we&#39;re computing the scaling jacobian.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977

◆ constraintJacobians()

void NonlinearSystemBase::constraintJacobians ( const SparseMatrix< Number > &  jacobian_to_view,
bool  displaced 
)

Add jacobian contributions from Constraints.

Parameters
jacobianreference to a read-only view of the Jacobian matrix
displacedControls whether to do the displaced Constraints or non-displaced

Definition at line 2302 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal().

2304 {
2305  if (!hasMatrix(systemMatrixTag()))
2306  mooseError("A system matrix is required");
2307 
2308  auto & jacobian = getMatrix(systemMatrixTag());
2309 
2311  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2312  MAT_NEW_NONZERO_ALLOCATION_ERR,
2313  PETSC_FALSE));
2315  LibmeshPetscCall(MatSetOption(
2316  static_cast<PetscMatrix<Number> &>(jacobian).mat(), MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE));
2317 
2318  std::vector<numeric_index_type> zero_rows;
2319 
2320  if (displaced)
2321  mooseAssert(_fe_problem.getDisplacedProblem(),
2322  "If we're calling this method with displaced = true, then we better well have a "
2323  "displaced problem");
2324  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
2325  : static_cast<SubProblem &>(_fe_problem);
2326  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
2327 
2328  bool constraints_applied;
2330  constraints_applied = false;
2331  for (const auto & it : penetration_locators)
2332  {
2334  {
2335  // Reset the constraint_applied flag before each new constraint, as they need to be
2336  // assembled separately
2337  constraints_applied = false;
2338  }
2339  PenetrationLocator & pen_loc = *(it.second);
2340 
2341  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
2342 
2343  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
2344  BoundaryID primary_boundary = pen_loc._primary_boundary;
2345 
2346  zero_rows.clear();
2347  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
2348  {
2349  const auto & constraints =
2350  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
2351 
2352  for (const auto & secondary_node_num : secondary_nodes)
2353  {
2354  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
2355 
2356  if (secondary_node.processor_id() == processor_id())
2357  {
2358  if (pen_loc._penetration_info[secondary_node_num])
2359  {
2360  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
2361 
2362  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
2364 
2365  for (const auto & nfc : constraints)
2366  {
2367  if (nfc->isExplicitConstraint())
2368  continue;
2369  // Return if this constraint does not correspond to the primary-secondary pair
2370  // prepared by the outer loops.
2371  // This continue statement is required when, e.g. one secondary surface constrains
2372  // more than one primary surface.
2373  if (nfc->secondaryBoundary() != secondary_boundary ||
2374  nfc->primaryBoundary() != primary_boundary)
2375  continue;
2376 
2377  nfc->_jacobian = &jacobian_to_view;
2378 
2379  if (nfc->shouldApply())
2380  {
2381  constraints_applied = true;
2382 
2383  nfc->prepareShapes(nfc->variable().number());
2384  nfc->prepareNeighborShapes(nfc->variable().number());
2385 
2386  nfc->computeJacobian();
2387 
2388  if (nfc->overwriteSecondaryJacobian())
2389  {
2390  // Add this variable's dof's row to be zeroed
2391  zero_rows.push_back(nfc->variable().nodalDofIndex());
2392  }
2393 
2394  std::vector<dof_id_type> secondary_dofs(1, nfc->variable().nodalDofIndex());
2395 
2396  // Assume that if the user is overwriting the secondary Jacobian, then they are
2397  // supplying Jacobians that do not correspond to their other physics
2398  // (e.g. Kernels), hence we should not apply a scalingFactor that is normally
2399  // based on the order of their other physics (e.g. Kernels)
2400  Real scaling_factor =
2401  nfc->overwriteSecondaryJacobian() ? 1. : nfc->variable().scalingFactor();
2402 
2403  // Cache the jacobian block for the secondary side
2404  nfc->addJacobian(_fe_problem.assembly(0, number()),
2405  nfc->_Kee,
2406  secondary_dofs,
2407  nfc->_connected_dof_indices,
2408  scaling_factor);
2409 
2410  // Cache Ken, Kne, Knn
2411  if (nfc->addCouplingEntriesToJacobian())
2412  {
2413  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2414  // factor when we're overwriting secondary stuff)
2415  nfc->addJacobian(_fe_problem.assembly(0, number()),
2416  nfc->_Ken,
2417  secondary_dofs,
2418  nfc->primaryVariable().dofIndicesNeighbor(),
2419  scaling_factor);
2420 
2421  // Use _connected_dof_indices to get all the correct columns
2422  nfc->addJacobian(_fe_problem.assembly(0, number()),
2423  nfc->_Kne,
2424  nfc->primaryVariable().dofIndicesNeighbor(),
2425  nfc->_connected_dof_indices,
2426  nfc->primaryVariable().scalingFactor());
2427 
2428  // We've handled Ken and Kne, finally handle Knn
2430  }
2431 
2432  // Do the off-diagonals next
2433  const std::vector<MooseVariableFEBase *> coupled_vars = nfc->getCoupledMooseVars();
2434  for (const auto & jvar : coupled_vars)
2435  {
2436  // Only compute jacobians for nonlinear variables
2437  if (jvar->kind() != Moose::VAR_SOLVER)
2438  continue;
2439 
2440  // Only compute Jacobian entries if this coupling is being used by the
2441  // preconditioner
2442  if (nfc->variable().number() == jvar->number() ||
2444  nfc->variable().number(), jvar->number(), this->number()))
2445  continue;
2446 
2447  // Need to zero out the matrices first
2449 
2450  nfc->prepareShapes(nfc->variable().number());
2451  nfc->prepareNeighborShapes(jvar->number());
2452 
2453  nfc->computeOffDiagJacobian(jvar->number());
2454 
2455  // Cache the jacobian block for the secondary side
2456  nfc->addJacobian(_fe_problem.assembly(0, number()),
2457  nfc->_Kee,
2458  secondary_dofs,
2459  nfc->_connected_dof_indices,
2460  scaling_factor);
2461 
2462  // Cache Ken, Kne, Knn
2463  if (nfc->addCouplingEntriesToJacobian())
2464  {
2465  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2466  // factor when we're overwriting secondary stuff)
2467  nfc->addJacobian(_fe_problem.assembly(0, number()),
2468  nfc->_Ken,
2469  secondary_dofs,
2470  jvar->dofIndicesNeighbor(),
2471  scaling_factor);
2472 
2473  // Use _connected_dof_indices to get all the correct columns
2474  nfc->addJacobian(_fe_problem.assembly(0, number()),
2475  nfc->_Kne,
2476  nfc->variable().dofIndicesNeighbor(),
2477  nfc->_connected_dof_indices,
2478  nfc->variable().scalingFactor());
2479 
2480  // We've handled Ken and Kne, finally handle Knn
2482  }
2483  }
2484  }
2485  }
2486  }
2487  }
2488  }
2489  }
2491  {
2492  // See if constraints were applied anywhere
2493  _communicator.max(constraints_applied);
2494 
2495  if (constraints_applied)
2496  {
2497  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2498  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2499  PETSC_TRUE));
2500 
2501  jacobian.close();
2502  jacobian.zero_rows(zero_rows, 0.0);
2503  jacobian.close();
2505  jacobian.close();
2506  }
2507  }
2508  }
2510  {
2511  // See if constraints were applied anywhere
2512  _communicator.max(constraints_applied);
2513 
2514  if (constraints_applied)
2515  {
2516  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2517  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2518  PETSC_TRUE));
2519 
2520  jacobian.close();
2521  jacobian.zero_rows(zero_rows, 0.0);
2522  jacobian.close();
2524  jacobian.close();
2525  }
2526  }
2527 
2528  THREAD_ID tid = 0;
2529  // go over element-element constraint interface
2530  const auto & element_pair_locators = subproblem.geomSearchData()._element_pair_locators;
2531  for (const auto & it : element_pair_locators)
2532  {
2533  ElementPairLocator & elem_pair_loc = *(it.second);
2534 
2535  if (_constraints.hasActiveElemElemConstraints(it.first, displaced))
2536  {
2537  // ElemElemConstraint objects
2538  const auto & _element_constraints =
2539  _constraints.getActiveElemElemConstraints(it.first, displaced);
2540 
2541  // go over pair elements
2542  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
2543  elem_pair_loc.getElemPairs();
2544  for (const auto & pr : elem_pairs)
2545  {
2546  const Elem * elem1 = pr.first;
2547  const Elem * elem2 = pr.second;
2548 
2549  if (elem1->processor_id() != processor_id())
2550  continue;
2551 
2552  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(pr);
2553 
2554  // for each element process constraints on the
2555  for (const auto & ec : _element_constraints)
2556  {
2557  _fe_problem.setCurrentSubdomainID(elem1, tid);
2558  subproblem.reinitElemPhys(elem1, info._elem1_constraint_q_point, tid);
2559  _fe_problem.setNeighborSubdomainID(elem2, tid);
2560  subproblem.reinitNeighborPhys(elem2, info._elem2_constraint_q_point, tid);
2561 
2562  ec->prepareShapes(ec->variable().number());
2563  ec->prepareNeighborShapes(ec->variable().number());
2564 
2565  ec->reinit(info);
2566  ec->computeJacobian();
2569  }
2571  }
2572  }
2573  }
2574 
2575  // go over NodeElemConstraints
2576  std::set<dof_id_type> unique_secondary_node_ids;
2577  constraints_applied = false;
2578  for (const auto & secondary_id : _mesh.meshSubdomains())
2579  {
2580  for (const auto & primary_id : _mesh.meshSubdomains())
2581  {
2582  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
2583  {
2584  const auto & constraints =
2585  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
2586 
2587  // get unique set of ids of all nodes on current block
2588  unique_secondary_node_ids.clear();
2589  const MeshBase & meshhelper = _mesh.getMesh();
2590  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
2591  meshhelper.active_subdomain_elements_end(secondary_id)))
2592  {
2593  for (auto & n : elem->node_ref_range())
2594  unique_secondary_node_ids.insert(n.id());
2595  }
2596 
2597  for (auto secondary_node_id : unique_secondary_node_ids)
2598  {
2599  const Node & secondary_node = _mesh.nodeRef(secondary_node_id);
2600  // check if secondary node is on current processor
2601  if (secondary_node.processor_id() == processor_id())
2602  {
2603  // This reinits the variables that exist on the secondary node
2604  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
2605 
2606  // This will set aside residual and jacobian space for the variables that have dofs
2607  // on the secondary node
2610 
2611  for (const auto & nec : constraints)
2612  {
2613  if (nec->shouldApply())
2614  {
2615  constraints_applied = true;
2616 
2617  nec->_jacobian = &jacobian_to_view;
2618  nec->prepareShapes(nec->variable().number());
2619  nec->prepareNeighborShapes(nec->variable().number());
2620 
2621  nec->computeJacobian();
2622 
2623  if (nec->overwriteSecondaryJacobian())
2624  {
2625  // Add this variable's dof's row to be zeroed
2626  zero_rows.push_back(nec->variable().nodalDofIndex());
2627  }
2628 
2629  std::vector<dof_id_type> secondary_dofs(1, nec->variable().nodalDofIndex());
2630 
2631  // Cache the jacobian block for the secondary side
2632  nec->addJacobian(_fe_problem.assembly(0, number()),
2633  nec->_Kee,
2634  secondary_dofs,
2635  nec->_connected_dof_indices,
2636  nec->variable().scalingFactor());
2637 
2638  // Cache the jacobian block for the primary side
2639  nec->addJacobian(_fe_problem.assembly(0, number()),
2640  nec->_Kne,
2641  nec->primaryVariable().dofIndicesNeighbor(),
2642  nec->_connected_dof_indices,
2643  nec->primaryVariable().scalingFactor());
2644 
2647 
2648  // Do the off-diagonals next
2649  const std::vector<MooseVariableFEBase *> coupled_vars = nec->getCoupledMooseVars();
2650  for (const auto & jvar : coupled_vars)
2651  {
2652  // Only compute jacobians for nonlinear variables
2653  if (jvar->kind() != Moose::VAR_SOLVER)
2654  continue;
2655 
2656  // Only compute Jacobian entries if this coupling is being used by the
2657  // preconditioner
2658  if (nec->variable().number() == jvar->number() ||
2660  nec->variable().number(), jvar->number(), this->number()))
2661  continue;
2662 
2663  // Need to zero out the matrices first
2665 
2666  nec->prepareShapes(nec->variable().number());
2667  nec->prepareNeighborShapes(jvar->number());
2668 
2669  nec->computeOffDiagJacobian(jvar->number());
2670 
2671  // Cache the jacobian block for the secondary side
2672  nec->addJacobian(_fe_problem.assembly(0, number()),
2673  nec->_Kee,
2674  secondary_dofs,
2675  nec->_connected_dof_indices,
2676  nec->variable().scalingFactor());
2677 
2678  // Cache the jacobian block for the primary side
2679  nec->addJacobian(_fe_problem.assembly(0, number()),
2680  nec->_Kne,
2681  nec->variable().dofIndicesNeighbor(),
2682  nec->_connected_dof_indices,
2683  nec->variable().scalingFactor());
2684 
2687  }
2688  }
2689  }
2690  }
2691  }
2692  }
2693  }
2694  }
2695  // See if constraints were applied anywhere
2696  _communicator.max(constraints_applied);
2697 
2698  if (constraints_applied)
2699  {
2700  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2701  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2702  PETSC_TRUE));
2703 
2704  jacobian.close();
2705  jacobian.zero_rows(zero_rows, 0.0);
2706  jacobian.close();
2708  jacobian.close();
2709  }
2710 }
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid)=0
std::map< std::pair< BoundaryID, BoundaryID >, PenetrationLocator * > _penetration_locators
BoundaryID _secondary_boundary
bool _assemble_constraints_separately
Whether or not to assemble the residual and Jacobian after the application of each constraint...
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
MPI_Info info
bool areCoupled(const unsigned int ivar, const unsigned int jvar, const unsigned int nl_sys_num) const
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Data structure used to hold penetration information.
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
const ElementPairInfo & getElemPairInfo(std::pair< const Elem *, const Elem *> elem_pair) const
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
const Parallel::Communicator & _communicator
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
bool hasActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
const std::vector< std::shared_ptr< NodeElemConstraintBase > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
virtual void cacheJacobianNeighbor(const THREAD_ID tid) override
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:831
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3443
const ElementPairList & getElemPairs() const
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:101
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
This is the ElementPairLocator class.
This is the ElementPairInfo class.
std::map< BoundaryID, std::shared_ptr< ElementPairLocator > > _element_pair_locators
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
virtual GeometricSearchData & geomSearchData()=0
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid)=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:985
void max(const T &r, T &o, Request &req) const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
bool hasActiveElemElemConstraints(const InterfaceID interface_id, bool displaced) const
void reinitNodeFace(const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints...
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
processor_id_type processor_id() const
const std::vector< std::shared_ptr< ElemElemConstraint > > & getActiveElemElemConstraints(InterfaceID interface_id, bool displaced) const
virtual void cacheJacobian(const THREAD_ID tid) override
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
processor_id_type processor_id() const
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
BoundaryID _primary_boundary
unsigned int THREAD_ID
Definition: MooseTypes.h:209
NearestNodeLocator & _nearest_node
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3166
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ constraintResiduals()

void NonlinearSystemBase::constraintResiduals ( NumericVector< Number > &  residual,
bool  displaced 
)

Add residual contributions from Constraints.

Parameters
residual- reference to the residual vector where constraint contributions will be computed
displacedControls whether to do the displaced Constraints or non-displaced

Definition at line 1329 of file NonlinearSystemBase.C.

Referenced by computeResidualInternal().

1330 {
1331  // Make sure the residual is in a good state
1332  residual.close();
1333 
1334  if (displaced)
1335  mooseAssert(_fe_problem.getDisplacedProblem(),
1336  "If we're calling this method with displaced = true, then we better well have a "
1337  "displaced problem");
1338  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1339  : static_cast<SubProblem &>(_fe_problem);
1340  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1341 
1342  bool constraints_applied;
1343  bool residual_has_inserted_values = false;
1345  constraints_applied = false;
1346  for (const auto & it : penetration_locators)
1347  {
1349  {
1350  // Reset the constraint_applied flag before each new constraint, as they need to be
1351  // assembled separately
1352  constraints_applied = false;
1353  }
1354  PenetrationLocator & pen_loc = *(it.second);
1355 
1356  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1357 
1358  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1359  BoundaryID primary_boundary = pen_loc._primary_boundary;
1360 
1361  bool has_writable_variables(false);
1362 
1363  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
1364  {
1365  const auto & constraints =
1366  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
1367 
1368  for (unsigned int i = 0; i < secondary_nodes.size(); i++)
1369  {
1370  dof_id_type secondary_node_num = secondary_nodes[i];
1371  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1372 
1373  if (secondary_node.processor_id() == processor_id())
1374  {
1375  if (pen_loc._penetration_info[secondary_node_num])
1376  {
1377  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
1378 
1379  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
1380 
1381  for (const auto & nfc : constraints)
1382  {
1383  // Return if this constraint does not correspond to the primary-secondary pair
1384  // prepared by the outer loops.
1385  // This continue statement is required when, e.g. one secondary surface constrains
1386  // more than one primary surface.
1387  if (nfc->secondaryBoundary() != secondary_boundary ||
1388  nfc->primaryBoundary() != primary_boundary)
1389  continue;
1390 
1391  if (nfc->shouldApply())
1392  {
1393  constraints_applied = true;
1394  nfc->computeResidual();
1395 
1396  if (nfc->overwriteSecondaryResidual())
1397  {
1398  // The below will actually overwrite the residual for every single dof that
1399  // lives on the node. We definitely don't want to do that!
1400  // _fe_problem.setResidual(residual, 0);
1401 
1402  const auto & secondary_var = nfc->variable();
1403  const auto & secondary_dofs = secondary_var.dofIndices();
1404  mooseAssert(secondary_dofs.size() == secondary_var.count(),
1405  "We are on a node so there should only be one dof per variable (for "
1406  "an ArrayVariable we should have a number of dofs equal to the "
1407  "number of components");
1408 
1409  // Assume that if the user is overwriting the secondary residual, then they are
1410  // supplying residuals that do not correspond to their other physics
1411  // (e.g. Kernels), hence we should not apply a scalingFactor that is normally
1412  // based on the order of their other physics (e.g. Kernels)
1413  std::vector<Number> values = {nfc->secondaryResidual()};
1414  residual.insert(values, secondary_dofs);
1415  residual_has_inserted_values = true;
1416  }
1417  else
1420  }
1421  if (nfc->hasWritableCoupledVariables())
1422  {
1423  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1424  has_writable_variables = true;
1425  for (auto * var : nfc->getWritableCoupledVariables())
1426  {
1427  if (var->isNodalDefined())
1428  var->insert(_fe_problem.getAuxiliarySystem().solution());
1429  }
1430  }
1431  }
1432  }
1433  }
1434  }
1435  }
1436  _communicator.max(has_writable_variables);
1437 
1438  if (has_writable_variables)
1439  {
1440  // Explicit contact dynamic constraints write to auxiliary variables and update the old
1441  // displacement solution on the constraint boundaries. Close solutions and update system
1442  // accordingly.
1445  solutionOld().close();
1446  }
1447 
1449  {
1450  // Make sure that secondary contribution to primary are assembled, and ghosts have been
1451  // exchanged, as current primaries might become secondaries on next iteration and will need to
1452  // contribute their former secondaries' contributions to the future primaries. See if
1453  // constraints were applied anywhere
1454  _communicator.max(constraints_applied);
1455 
1456  if (constraints_applied)
1457  {
1458  // If any of the above constraints inserted values in the residual, it needs to be
1459  // assembled before adding the cached residuals below.
1460  _communicator.max(residual_has_inserted_values);
1461  if (residual_has_inserted_values)
1462  {
1463  residual.close();
1464  residual_has_inserted_values = false;
1465  }
1467  residual.close();
1468 
1470  *_residual_ghosted = residual;
1471  }
1472  }
1473  }
1475  {
1476  _communicator.max(constraints_applied);
1477 
1478  if (constraints_applied)
1479  {
1480  // If any of the above constraints inserted values in the residual, it needs to be assembled
1481  // before adding the cached residuals below.
1482  _communicator.max(residual_has_inserted_values);
1483  if (residual_has_inserted_values)
1484  residual.close();
1485 
1487  residual.close();
1488 
1490  *_residual_ghosted = residual;
1491  }
1492  }
1493 
1494  // go over element-element constraint interface
1495  THREAD_ID tid = 0;
1496  const auto & element_pair_locators = subproblem.geomSearchData()._element_pair_locators;
1497  for (const auto & it : element_pair_locators)
1498  {
1499  ElementPairLocator & elem_pair_loc = *(it.second);
1500 
1501  if (_constraints.hasActiveElemElemConstraints(it.first, displaced))
1502  {
1503  // ElemElemConstraint objects
1504  const auto & _element_constraints =
1505  _constraints.getActiveElemElemConstraints(it.first, displaced);
1506 
1507  // go over pair elements
1508  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
1509  elem_pair_loc.getElemPairs();
1510  for (const auto & pr : elem_pairs)
1511  {
1512  const Elem * elem1 = pr.first;
1513  const Elem * elem2 = pr.second;
1514 
1515  if (elem1->processor_id() != processor_id())
1516  continue;
1517 
1518  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(pr);
1519 
1520  // for each element process constraints on the
1521  for (const auto & ec : _element_constraints)
1522  {
1523  _fe_problem.setCurrentSubdomainID(elem1, tid);
1524  subproblem.reinitElemPhys(elem1, info._elem1_constraint_q_point, tid);
1525  _fe_problem.setNeighborSubdomainID(elem2, tid);
1526  subproblem.reinitNeighborPhys(elem2, info._elem2_constraint_q_point, tid);
1527 
1528  ec->prepareShapes(ec->variable().number());
1529  ec->prepareNeighborShapes(ec->variable().number());
1530 
1531  ec->reinit(info);
1532  ec->computeResidual();
1535  }
1537  }
1538  }
1539  }
1540 
1541  // go over NodeElemConstraints
1542  std::set<dof_id_type> unique_secondary_node_ids;
1543 
1544  constraints_applied = false;
1545  residual_has_inserted_values = false;
1546  bool has_writable_variables = false;
1547  for (const auto & secondary_id : _mesh.meshSubdomains())
1548  {
1549  for (const auto & primary_id : _mesh.meshSubdomains())
1550  {
1551  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
1552  {
1553  const auto & constraints =
1554  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
1555 
1556  // get unique set of ids of all nodes on current block
1557  unique_secondary_node_ids.clear();
1558  const MeshBase & meshhelper = _mesh.getMesh();
1559  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
1560  meshhelper.active_subdomain_elements_end(secondary_id)))
1561  {
1562  for (auto & n : elem->node_ref_range())
1563  unique_secondary_node_ids.insert(n.id());
1564  }
1565 
1566  for (auto secondary_node_id : unique_secondary_node_ids)
1567  {
1568  Node & secondary_node = _mesh.nodeRef(secondary_node_id);
1569  // check if secondary node is on current processor
1570  if (secondary_node.processor_id() == processor_id())
1571  {
1572  // This reinits the variables that exist on the secondary node
1573  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
1574 
1575  // This will set aside residual and jacobian space for the variables that have dofs
1576  // on the secondary node
1578 
1579  for (const auto & nec : constraints)
1580  {
1581  if (nec->shouldApply())
1582  {
1583  constraints_applied = true;
1584  nec->computeResidual();
1585 
1586  if (nec->overwriteSecondaryResidual())
1587  {
1588  _fe_problem.setResidual(residual, 0);
1589  residual_has_inserted_values = true;
1590  }
1591  else
1594  }
1595  if (nec->hasWritableCoupledVariables())
1596  {
1597  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1598  has_writable_variables = true;
1599  for (auto * var : nec->getWritableCoupledVariables())
1600  {
1601  if (var->isNodalDefined())
1602  var->insert(_fe_problem.getAuxiliarySystem().solution());
1603  }
1604  }
1605  }
1607  }
1608  }
1609  }
1610  }
1611  }
1612  _communicator.max(constraints_applied);
1613 
1614  if (constraints_applied)
1615  {
1616  // If any of the above constraints inserted values in the residual, it needs to be assembled
1617  // before adding the cached residuals below.
1618  _communicator.max(residual_has_inserted_values);
1619  if (residual_has_inserted_values)
1620  residual.close();
1621 
1623  residual.close();
1624 
1626  *_residual_ghosted = residual;
1627  }
1628  _communicator.max(has_writable_variables);
1629 
1630  if (has_writable_variables)
1631  {
1632  // Explicit contact dynamic constraints write to auxiliary variables and update the old
1633  // displacement solution on the constraint boundaries. Close solutions and update system
1634  // accordingly.
1637  solutionOld().close();
1638  }
1639 
1640  // We may have additional tagged vectors that also need to be accumulated
1642 }
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid)=0
virtual void insert(const T *v, const std::vector< numeric_index_type > &dof_indices)
std::map< std::pair< BoundaryID, BoundaryID >, PenetrationLocator * > _penetration_locators
virtual void cacheResidualNeighbor(const THREAD_ID tid) override
BoundaryID _secondary_boundary
bool _assemble_constraints_separately
Whether or not to assemble the residual and Jacobian after the application of each constraint...
MPI_Info info
NumericVector< Number > & solution()
Definition: SystemBase.h:195
Data structure used to hold penetration information.
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
const ElementPairInfo & getElemPairInfo(std::pair< const Elem *, const Elem *> elem_pair) const
const Parallel::Communicator & _communicator
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
bool hasActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
const std::vector< std::shared_ptr< NodeElemConstraintBase > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:831
virtual void setResidual(NumericVector< libMesh::Number > &residual, const THREAD_ID tid) override
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
virtual void addCachedResidualDirectly(NumericVector< libMesh::Number > &residual, const THREAD_ID tid)
Allows for all the residual contributions that are currently cached to be added directly into the vec...
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3443
const ElementPairList & getElemPairs() const
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:101
virtual void cacheResidual(const THREAD_ID tid) override
This is the ElementPairLocator class.
This is the ElementPairInfo class.
std::map< BoundaryID, std::shared_ptr< ElementPairLocator > > _element_pair_locators
virtual GeometricSearchData & geomSearchData()=0
AuxiliarySystem & getAuxiliarySystem()
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid)=0
virtual void update()
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:985
void max(const T &r, T &o, Request &req) const
bool hasActiveElemElemConstraints(const InterfaceID interface_id, bool displaced) const
void reinitNodeFace(const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints...
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
virtual libMesh::System & system() override
Get the reference to the libMesh system.
NumericVector< Number > & solutionOld()
Definition: SystemBase.h:196
processor_id_type processor_id() const
const std::vector< std::shared_ptr< ElemElemConstraint > > & getActiveElemElemConstraints(InterfaceID interface_id, bool displaced) const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual void addCachedResidual(const THREAD_ID tid) override
BoundaryID _primary_boundary
unsigned int THREAD_ID
Definition: MooseTypes.h:209
uint8_t dof_id_type
NearestNodeLocator & _nearest_node
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3166

◆ containsTimeKernel()

bool NonlinearSystemBase::containsTimeKernel ( )
overridevirtual

If the system has a kernel that corresponds to a time derivative.

Implements SolverSystem.

Definition at line 3739 of file NonlinearSystemBase.C.

Referenced by EigenExecutionerBase::checkIntegrity(), and Eigenvalue::checkIntegrity().

3740 {
3741  auto & time_kernels = _kernels.getVectorTagObjectWarehouse(timeVectorTag(), 0);
3742 
3743  return time_kernels.hasActiveObjects();
3744 }
MooseObjectTagWarehouse< KernelBase > _kernels
TagID timeVectorTag() const override
Ideally, we should not need this API.
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...

◆ converged()

virtual bool SolverSystem::converged ( )
pure virtualinherited

Returns the convergence state.

Returns
true if converged, otherwise false

Implemented in NonlinearEigenSystem, NonlinearEigenSystem, NonlinearSystem, LinearSystem, DumpObjectsLinearSystem, and DumpObjectsNonlinearSystem.

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 1288 of file SystemBase.C.

Referenced by SystemBase::copySolutionsBackwards(), and EigenExecutionerBase::inversePowerIteration().

1289 {
1290  // Copying the solutions backward so the current solution will become the old, and the old will
1291  // become older. 0 index is for time, 1 would be nonlinear iteration.
1292  const auto states = _solution_states[0].size();
1293  if (states > 1)
1294  for (unsigned int i = states - 1; i > 0; --i)
1295  solutionState(i) = solutionState(i - 1);
1296 
1297  if (solutionUDotOld())
1298  *solutionUDotOld() = *solutionUDot();
1299  if (solutionUDotDotOld())
1301 }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:255
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:252
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:254
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:253

◆ copyPreviousNonlinearSolutions()

void SystemBase::copyPreviousNonlinearSolutions ( )
virtualinherited

Shifts the solutions backwards in nonlinear iteration history.

Definition at line 1271 of file SystemBase.C.

Referenced by SystemBase::copySolutionsBackwards().

1272 {
1273  // 1 is for nonlinear, 0 is for time, we do this for nonlinear only here
1274  const auto states = _solution_states[1].size();
1275  if (states > 1)
1276  for (unsigned int i = states - 1; i > 0; --i)
1279 
1280  if (solutionPreviousNewton())
1282 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1345

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 1260 of file SystemBase.C.

1261 {
1262  system().update();
1263  copyOldSolutions();
1265 }
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
Definition: SystemBase.C:1288
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual void copyPreviousNonlinearSolutions()
Shifts the solutions backwards in nonlinear iteration history.
Definition: SystemBase.C:1271
virtual void update()

◆ copyTimeIntegrators()

void SystemBase::copyTimeIntegrators ( const SystemBase other_sys)
inherited

Copy time integrators from another system.

Definition at line 1634 of file SystemBase.C.

1635 {
1637 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041

◆ copyVars()

void SystemBase::copyVars ( libMesh::ExodusII_IO io)
inherited

Definition at line 1185 of file SystemBase.C.

1186 {
1187  int n_steps = io.get_num_time_steps();
1188 
1189  bool did_copy = false;
1190  for (const auto & vci : _var_to_copy)
1191  {
1192  int timestep = -1;
1193 
1194  if (vci._timestep == "LATEST")
1195  // Use the last time step in the file from which to retrieve the solution
1196  timestep = n_steps;
1197  else
1198  {
1199  timestep = MooseUtils::convert<int>(vci._timestep);
1200  if (timestep > n_steps)
1201  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
1202  "a valid integer between 1 and ",
1203  n_steps,
1204  " inclusive, received ",
1205  vci._timestep);
1206  }
1207 
1208  did_copy = true;
1209 
1210  if (hasVariable(vci._dest_name))
1211  {
1212  const auto & var = getVariable(0, vci._dest_name);
1213  if (var.isArray())
1214  {
1215  const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1216  for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1217  {
1218  const auto & exodus_var = var.arrayVariableComponent(i);
1219  const auto & system_var = array_var.componentName(i);
1220  if (var.isNodal())
1221  io.copy_nodal_solution(system(), exodus_var, system_var, timestep);
1222  else
1223  io.copy_elemental_solution(system(), exodus_var, system_var, timestep);
1224  }
1225  }
1226  else
1227  {
1228  if (var.isNodal())
1229  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
1230  else
1231  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
1232  }
1233  }
1234  else if (hasScalarVariable(vci._dest_name))
1235  io.copy_scalar_solution(system(), {vci._dest_name}, {vci._source_name}, timestep);
1236  else
1237  mooseError("Unrecognized variable ", vci._dest_name, " in variables to copy.");
1238  }
1239 
1240  if (did_copy)
1241  solution().close();
1242 }
NumericVector< Number > & solution()
Definition: SystemBase.h:195
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1032
int convert< int >(const std::string &str, bool throw_on_failure)
Definition: MooseUtils.C:1009
void copy_nodal_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:834
virtual void close()=0
void copy_scalar_solution(System &system, std::vector< std::string > system_var_names, std::vector< std::string > exodus_var_names, unsigned int timestep=1)
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:89
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:859

◆ currentSolution()

const NumericVector< Number > *const & SolverSystem::currentSolution ( ) const
inlinefinaloverridevirtualinherited

The solution vector that is currently being operated on.

This is typically a ghosted vector that comes in from the Nonlinear solver.

Implements SystemBase.

Definition at line 117 of file SolverSystem.h.

Referenced by FEProblemBase::computeDamping(), FEProblemBase::computeLinearSystemSys(), FEProblemBase::computeResidualL2Norm(), and AB2PredictorCorrector::step().

118 {
119  return _current_solution;
120 }
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:105

◆ customSetup()

void NonlinearSystemBase::customSetup ( const ExecFlagType exec_type)
overridevirtual

Reimplemented from SystemBase.

Definition at line 360 of file NonlinearSystemBase.C.

361 {
362  SolverSystem::customSetup(exec_type);
363 
364  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
365  {
366  _kernels.customSetup(exec_type, tid);
367  _nodal_kernels.customSetup(exec_type, tid);
368  _dirac_kernels.customSetup(exec_type, tid);
369  if (_doing_dg)
370  _dg_kernels.customSetup(exec_type, tid);
371  _interface_kernels.customSetup(exec_type, tid);
372  _element_dampers.customSetup(exec_type, tid);
373  _nodal_dampers.customSetup(exec_type, tid);
374  _integrated_bcs.customSetup(exec_type, tid);
375 
376  if (_fe_problem.haveFV())
377  {
378  std::vector<FVFluxBC *> bcs;
380  .query()
381  .template condition<AttribSystem>("FVFluxBC")
382  .template condition<AttribThread>(tid)
383  .queryInto(bcs);
384 
385  std::vector<FVInterfaceKernel *> iks;
387  .query()
388  .template condition<AttribSystem>("FVInterfaceKernel")
389  .template condition<AttribThread>(tid)
390  .queryInto(iks);
391 
392  std::vector<FVFluxKernel *> kernels;
394  .query()
395  .template condition<AttribSystem>("FVFluxKernel")
396  .template condition<AttribThread>(tid)
397  .queryInto(kernels);
398 
399  for (auto * bc : bcs)
400  bc->customSetup(exec_type);
401  for (auto * ik : iks)
402  ik->customSetup(exec_type);
403  for (auto * kernel : kernels)
404  kernel->customSetup(exec_type);
405  }
406  }
407  _scalar_kernels.customSetup(exec_type);
408  _constraints.customSetup(exec_type);
409  _general_dampers.customSetup(exec_type);
410  _nodal_bcs.customSetup(exec_type);
411 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual void customSetup(const ExecFlagType &exec_type, THREAD_ID tid=0) const
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
virtual void customSetup(const ExecFlagType &exec_type)
Definition: SystemBase.C:1552
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ deactiveAllMatrixTags()

void SystemBase::deactiveAllMatrixTags ( )
virtualinherited

Make matrices inactive.

Definition at line 1126 of file SystemBase.C.

Referenced by computeResidualTags(), and setInitialSolution().

1127 {
1128  auto num_matrix_tags = _subproblem.numMatrixTags();
1129 
1130  _matrix_tag_active_flags.resize(num_matrix_tags);
1131 
1132  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1133  _matrix_tag_active_flags[tag] = false;
1134 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1019
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248

◆ deactiveMatrixTag()

void SystemBase::deactiveMatrixTag ( TagID  tag)
virtualinherited

deactive a matrix for tag

Definition at line 1114 of file SystemBase.C.

1115 {
1116  mooseAssert(_subproblem.matrixTagExists(tag),
1117  "Cannot deactivate Matrix with matrix_tag : " << tag << "that does not exist");
1118 
1119  if (_matrix_tag_active_flags.size() < tag + 1)
1120  _matrix_tag_active_flags.resize(tag + 1);
1121 
1122  _matrix_tag_active_flags[tag] = false;
1123 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1019
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ debuggingResiduals()

void NonlinearSystemBase::debuggingResiduals ( bool  state)
inline

Definition at line 551 of file NonlinearSystemBase.h.

551 { _debugging_residuals = state; }
bool _debugging_residuals
true if debugging residuals

◆ defaultMatrixTags()

virtual std::set<TagID> SystemBase::defaultMatrixTags ( ) const
inlinevirtualinherited

Get the default matrix tags associted with this system.

Reimplemented in NonlinearEigenSystem, and DisplacedSystem.

Definition at line 310 of file SystemBase.h.

Referenced by DisplacedSystem::defaultMatrixTags(), NonlinearEigenSystem::defaultMatrixTags(), and SystemBase::disassociateDefaultMatrixTags().

310 { return {systemMatrixTag()}; }
virtual TagID systemMatrixTag() const
Return the Matrix Tag ID for System.
Definition: SystemBase.h:288

◆ defaultVectorTags()

virtual std::set<TagID> SystemBase::defaultVectorTags ( ) const
inlinevirtualinherited

Get the default vector tags associated with this system.

Reimplemented in NonlinearEigenSystem, and DisplacedSystem.

Definition at line 303 of file SystemBase.h.

Referenced by DisplacedSystem::defaultVectorTags(), NonlinearEigenSystem::defaultVectorTags(), and SystemBase::disassociateDefaultVectorTags().

304  {
306  }
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:283
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:293
virtual TagID residualVectorTag() const
Definition: SystemBase.h:298

◆ destroyColoring()

void NonlinearSystemBase::destroyColoring ( )

Destroy the coloring object if it exists.

Definition at line 4120 of file NonlinearSystemBase.C.

Referenced by LStableDirk2::solve(), LStableDirk3::solve(), and LStableDirk4::solve().

4121 {
4122  if (matrixFromColoring())
4123  LibmeshPetscCall(MatFDColoringDestroy(&_fdcoloring));
4124 }
virtual bool matrixFromColoring() const
Whether a system matrix is formed from coloring.
Definition: SolverSystem.h:102

◆ disassociateDefaultMatrixTags()

void SystemBase::disassociateDefaultMatrixTags ( )
virtualinherited

Disassociate the matrices associated with the default matrix tags of this system.

Reimplemented in DisplacedSystem.

Definition at line 1093 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultMatrixTags().

1094 {
1095  const auto tags = defaultMatrixTags();
1096  for (const auto tag : tags)
1097  if (_subproblem.matrixTagExists(tag))
1099 }
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1071
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition: SystemBase.h:310
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ disassociateDefaultVectorTags()

void SystemBase::disassociateDefaultVectorTags ( )
virtualinherited

Disassociate the vectors associated with the default vector tags of this system.

Reimplemented in DisplacedSystem.

Definition at line 998 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultVectorTags().

999 {
1000  const auto tags = defaultVectorTags();
1001  for (const auto tag : tags)
1002  if (_subproblem.vectorTagExists(tag))
1004 }
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
Definition: SystemBase.h:303

◆ disassociateMatrixFromTag() [1/2]

void SystemBase::disassociateMatrixFromTag ( libMesh::SparseMatrix< Number > &  matrix,
TagID  tag 
)
virtualinherited

Disassociate a matrix from a tag.

Reimplemented in DisplacedSystem.

Definition at line 1071 of file SystemBase.C.

Referenced by computeJacobian(), FEProblemBase::computeJacobianInternal(), FEProblemBase::computeJacobianTag(), FEProblemBase::computeLinearSystemSys(), FEProblemBase::computeResidualAndJacobian(), SystemBase::disassociateDefaultMatrixTags(), and DisplacedSystem::disassociateMatrixFromTag().

1072 {
1073  if (!_subproblem.matrixTagExists(tag))
1074  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1075  if (hasMatrix(tag) && &getMatrix(tag) != &matrix)
1076  mooseError("You can not disassociate a matrix from a tag which it was not associated to");
1077 
1079 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1071
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ disassociateMatrixFromTag() [2/2]

void SystemBase::disassociateMatrixFromTag ( TagID  tag)
virtualinherited

Disassociate any matrix that is associated with a given tag.

Reimplemented in DisplacedSystem.

Definition at line 1082 of file SystemBase.C.

1083 {
1084  if (!_subproblem.matrixTagExists(tag))
1085  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1086 
1087  if (_tagged_matrices.size() < tag + 1)
1088  _tagged_matrices.resize(tag + 1);
1089  _tagged_matrices[tag] = nullptr;
1090 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1017
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ disassociateVectorFromTag() [1/2]

virtual void SystemBase::disassociateVectorFromTag ( NumericVector< Number > &  vec,
TagID  tag 
)
virtualinherited

◆ disassociateVectorFromTag() [2/2]

void SystemBase::disassociateVectorFromTag ( TagID  tag)
virtualinherited

Disassociate any vector that is associated with a given tag.

Reimplemented in DisplacedSystem.

Definition at line 987 of file SystemBase.C.

988 {
989  if (!_subproblem.vectorTagExists(tag))
990  mooseError("Cannot disassociate vector from tag ", tag, " because that tag does not exist");
991 
992  if (_tagged_vectors.size() < tag + 1)
993  _tagged_vectors.resize(tag + 1);
994  _tagged_vectors[tag] = nullptr;
995 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ dofMap() [1/2]

DofMap & SystemBase::dofMap ( )
virtualinherited

◆ dofMap() [2/2]

const DofMap & SystemBase::dofMap ( ) const
virtualinherited

Gets const reference to the dof map.

Definition at line 1171 of file SystemBase.C.

1172 {
1173  return system().get_dof_map();
1174 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const DofMap & get_dof_map() const

◆ doingDG()

bool NonlinearSystemBase::doingDG ( ) const

Getter for _doing_dg.

Definition at line 3778 of file NonlinearSystemBase.C.

3779 {
3780  return _doing_dg;
3781 }
bool _doing_dg
true if DG is active (optimization reasons)

◆ duDotDotDu() [1/2]

virtual Number& SystemBase::duDotDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 248 of file SystemBase.h.

Referenced by DisplacedSystem::duDotDotDu(), and MooseVariableScalar::reinit().

248 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:1012

◆ duDotDotDu() [2/2]

virtual const Number& SystemBase::duDotDotDu ( ) const
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 250 of file SystemBase.h.

250 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:1012

◆ duDotDu()

const Number & SystemBase::duDotDu ( unsigned int  var_num = 0) const
virtualinherited

Reimplemented in DisplacedSystem.

Definition at line 1668 of file SystemBase.C.

Referenced by DisplacedSystem::duDotDu(), and MooseVariableScalar::reinit().

1669 {
1670  return _du_dot_du[var_num];
1671 }
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
Definition: SystemBase.h:1011

◆ duDotDus()

virtual std::vector<Number>& SystemBase::duDotDus ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 247 of file SystemBase.h.

Referenced by DisplacedSystem::duDotDus().

247 { return _du_dot_du; }
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
Definition: SystemBase.h:1011

◆ enforceNodalConstraintsJacobian()

void NonlinearSystemBase::enforceNodalConstraintsJacobian ( )
protected

Definition at line 1097 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal().

1098 {
1099  if (!hasMatrix(systemMatrixTag()))
1100  mooseError(" A system matrix is required");
1101 
1102  auto & jacobian = getMatrix(systemMatrixTag());
1103  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1104 
1106  {
1107  const auto & ncs = _constraints.getActiveNodalConstraints();
1108  for (const auto & nc : ncs)
1109  {
1110  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1111  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1112 
1113  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1114  {
1115  _fe_problem.reinitNodes(primary_node_ids, tid);
1116  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1117  nc->computeJacobian(jacobian);
1118  }
1119  }
1121  }
1122 }
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const std::vector< std::shared_ptr< NodalConstraint > > & getActiveNodalConstraints() const
Access methods for active objects.
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
bool hasActiveNodalConstraints() const
Deterimine if active objects exist.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007
unsigned int THREAD_ID
Definition: MooseTypes.h:209
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ enforceNodalConstraintsResidual()

void NonlinearSystemBase::enforceNodalConstraintsResidual ( NumericVector< Number > &  residual)
protected

Enforce nodal constraints.

Definition at line 1072 of file NonlinearSystemBase.C.

Referenced by computeResidualInternal().

1073 {
1074  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1075  residual.close();
1077  {
1078  const auto & ncs = _constraints.getActiveNodalConstraints();
1079  for (const auto & nc : ncs)
1080  {
1081  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1082  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1083 
1084  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1085  {
1086  _fe_problem.reinitNodes(primary_node_ids, tid);
1087  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1088  nc->computeResidual(residual);
1089  }
1090  }
1091  _fe_problem.addCachedResidualDirectly(residual, tid);
1092  residual.close();
1093  }
1094 }
const std::vector< std::shared_ptr< NodalConstraint > > & getActiveNodalConstraints() const
Access methods for active objects.
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
bool hasActiveNodalConstraints() const
Deterimine if active objects exist.
virtual void addCachedResidualDirectly(NumericVector< libMesh::Number > &residual, const THREAD_ID tid)
Allows for all the residual contributions that are currently cached to be added directly into the vec...
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ feProblem() [1/2]

FEProblemBase& SystemBase::feProblem ( )
inlineinherited

Definition at line 103 of file SystemBase.h.

Referenced by DMMooseGetEmbedding_Private(), and DMSetUp_Moose_Pre().

103 { return _fe_problem; }
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980

◆ feProblem() [2/2]

const FEProblemBase& SystemBase::feProblem ( ) const
inlineinherited

Definition at line 104 of file SystemBase.h.

104 { return _fe_problem; }
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980

◆ finalNonlinearResidual()

Real NonlinearSystemBase::finalNonlinearResidual ( ) const
inline

Return the final nonlinear residual.

Definition at line 537 of file NonlinearSystemBase.h.

537 { return _final_residual; }

◆ findImplicitGeometricCouplingEntries()

void NonlinearSystemBase::findImplicitGeometricCouplingEntries ( GeometricSearchData geom_search_data,
std::unordered_map< dof_id_type, std::vector< dof_id_type >> &  graph 
)
private

Finds the implicit sparsity graph between geometrically related dofs.

Definition at line 2169 of file NonlinearSystemBase.C.

Referenced by addImplicitGeometricCouplingEntries(), and augmentSparsity().

2172 {
2173  const auto & node_to_elem_map = _mesh.nodeToElemMap();
2174  const auto & nearest_node_locators = geom_search_data._nearest_node_locators;
2175  for (const auto & it : nearest_node_locators)
2176  {
2177  std::vector<dof_id_type> & secondary_nodes = it.second->_secondary_nodes;
2178 
2179  for (const auto & secondary_node : secondary_nodes)
2180  {
2181  std::set<dof_id_type> unique_secondary_indices;
2182  std::set<dof_id_type> unique_primary_indices;
2183 
2184  auto node_to_elem_pair = node_to_elem_map.find(secondary_node);
2185  if (node_to_elem_pair != node_to_elem_map.end())
2186  {
2187  const std::vector<dof_id_type> & elems = node_to_elem_pair->second;
2188 
2189  // Get the dof indices from each elem connected to the node
2190  for (const auto & cur_elem : elems)
2191  {
2192  std::vector<dof_id_type> dof_indices;
2193  dofMap().dof_indices(_mesh.elemPtr(cur_elem), dof_indices);
2194 
2195  for (const auto & dof : dof_indices)
2196  unique_secondary_indices.insert(dof);
2197  }
2198  }
2199 
2200  std::vector<dof_id_type> primary_nodes = it.second->_neighbor_nodes[secondary_node];
2201 
2202  for (const auto & primary_node : primary_nodes)
2203  {
2204  auto primary_node_to_elem_pair = node_to_elem_map.find(primary_node);
2205  mooseAssert(primary_node_to_elem_pair != node_to_elem_map.end(),
2206  "Missing entry in node to elem map");
2207  const std::vector<dof_id_type> & primary_node_elems = primary_node_to_elem_pair->second;
2208 
2209  // Get the dof indices from each elem connected to the node
2210  for (const auto & cur_elem : primary_node_elems)
2211  {
2212  std::vector<dof_id_type> dof_indices;
2213  dofMap().dof_indices(_mesh.elemPtr(cur_elem), dof_indices);
2214 
2215  for (const auto & dof : dof_indices)
2216  unique_primary_indices.insert(dof);
2217  }
2218  }
2219 
2220  for (const auto & secondary_id : unique_secondary_indices)
2221  for (const auto & primary_id : unique_primary_indices)
2222  {
2223  graph[secondary_id].push_back(primary_id);
2224  graph[primary_id].push_back(secondary_id);
2225  }
2226  }
2227  }
2228 
2229  // handle node-to-node constraints
2230  const auto & ncs = _constraints.getActiveNodalConstraints();
2231  for (const auto & nc : ncs)
2232  {
2233  std::vector<dof_id_type> primary_dofs;
2234  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
2235  for (const auto & node_id : primary_node_ids)
2236  {
2237  Node * node = _mesh.queryNodePtr(node_id);
2238  if (node && node->processor_id() == this->processor_id())
2239  {
2240  getNodeDofs(node_id, primary_dofs);
2241  }
2242  }
2243 
2244  _communicator.allgather(primary_dofs);
2245 
2246  std::vector<dof_id_type> secondary_dofs;
2247  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
2248  for (const auto & node_id : secondary_node_ids)
2249  {
2250  Node * node = _mesh.queryNodePtr(node_id);
2251  if (node && node->processor_id() == this->processor_id())
2252  {
2253  getNodeDofs(node_id, secondary_dofs);
2254  }
2255  }
2256 
2257  _communicator.allgather(secondary_dofs);
2258 
2259  for (const auto & primary_id : primary_dofs)
2260  for (const auto & secondary_id : secondary_dofs)
2261  {
2262  graph[primary_id].push_back(secondary_id);
2263  graph[secondary_id].push_back(primary_id);
2264  }
2265  }
2266 
2267  // Make every entry sorted and unique
2268  for (auto & it : graph)
2269  {
2270  std::vector<dof_id_type> & row = it.second;
2271  std::sort(row.begin(), row.end());
2272  std::vector<dof_id_type>::iterator uit = std::unique(row.begin(), row.end());
2273  row.resize(uit - row.begin());
2274  }
2275 }
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
virtual Elem * elemPtr(const dof_id_type i)
Definition: MooseMesh.C:3108
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
const std::vector< std::shared_ptr< NodalConstraint > > & getActiveNodalConstraints() const
Access methods for active objects.
void getNodeDofs(dof_id_type node_id, std::vector< dof_id_type > &dofs)
virtual const Node * queryNodePtr(const dof_id_type i) const
Definition: MooseMesh.C:857
const Parallel::Communicator & _communicator
std::map< std::pair< BoundaryID, BoundaryID >, NearestNodeLocator * > _nearest_node_locators
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1165
ConstraintWarehouse _constraints
Constraints storage object.
MooseMesh & _mesh
Definition: SystemBase.h:985
processor_id_type processor_id() const
processor_id_type processor_id() const
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected...
Definition: MooseMesh.C:1175

◆ flushTaggedMatrices()

void SystemBase::flushTaggedMatrices ( const std::set< TagID > &  tags)
inherited

flushes all matrices associated to tags.

Flush assembles the matrix but doesn't shrink memory allocation

Definition at line 1051 of file SystemBase.C.

1052 {
1053  for (auto tag : tags)
1054  if (hasMatrix(tag))
1055  getMatrix(tag).flush();
1056 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual void flush()
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1007

◆ getActualFieldVariable() [1/2]

template<typename T >
MooseVariableField< T > & SystemBase::getActualFieldVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
inherited

Returns a field variable pointer - this includes finite volume variables.

Definition at line 117 of file SystemBase.C.

Referenced by BoundsBase::BoundsBase(), Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), and Assembly::copyShapes().

118 {
119  return *_vars[tid].getActualFieldVariable<T>(var_name);
120 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getActualFieldVariable() [2/2]

template<typename T >
MooseVariableField< T > & SystemBase::getActualFieldVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
inherited

Returns a field variable pointer - this includes finite volume variables.

Definition at line 138 of file SystemBase.C.

139 {
140  return *_vars[tid].getActualFieldVariable<T>(var_number);
141 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getConstraintWarehouse()

const ConstraintWarehouse& NonlinearSystemBase::getConstraintWarehouse ( ) const
inline

Definition at line 611 of file NonlinearSystemBase.h.

611 { return _constraints; }
ConstraintWarehouse _constraints
Constraints storage object.

◆ getCurrentNonlinearIterationNumber()

virtual unsigned int NonlinearSystemBase::getCurrentNonlinearIterationNumber ( )
pure virtual

◆ getDGKernelWarehouse()

MooseObjectTagWarehouse<DGKernelBase>& NonlinearSystemBase::getDGKernelWarehouse ( )
inline

Definition at line 587 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

587 { return _dg_kernels; }
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels

◆ getDiracKernelWarehouse()

MooseObjectTagWarehouse<DiracKernelBase>& NonlinearSystemBase::getDiracKernelWarehouse ( )
inline

Definition at line 592 of file NonlinearSystemBase.h.

592 { return _dirac_kernels; }
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.

◆ getElementDamperWarehouse()

const MooseObjectWarehouse<ElementDamper>& NonlinearSystemBase::getElementDamperWarehouse ( ) const
inline

Definition at line 603 of file NonlinearSystemBase.h.

Referenced by ComputeElemDampingThread::onElement(), and ComputeElemDampingThread::printGeneralExecutionInformation().

604  {
605  return _element_dampers;
606  }
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.

◆ getFieldVariable() [1/2]

template<typename T >
MooseVariableFE< T > & SystemBase::getFieldVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
inherited

Gets a reference to a variable of with specified name.

This excludes and cannot return finite volume variables.

Parameters
tidThread id
var_namevariable name
Returns
reference the variable (class)

Definition at line 110 of file SystemBase.C.

Referenced by Marker::getMarkerValue().

111 {
112  return *_vars[tid].getFieldVariable<T>(var_name);
113 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getFieldVariable() [2/2]

template<typename T >
MooseVariableFE< T > & SystemBase::getFieldVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
inherited

Gets a reference to a variable with specified number.

This excludes and cannot return finite volume variables.

Parameters
tidThread id
var_numberlibMesh variable number
Returns
reference the variable (class)

Definition at line 131 of file SystemBase.C.

132 {
133  return *_vars[tid].getFieldVariable<T>(var_number);
134 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getFVVariable()

template<typename T >
template MooseVariableFV< Real > & SystemBase::getFVVariable< Real > ( THREAD_ID  tid,
const std::string &  var_name 
)
inherited

Return a finite volume variable.

Definition at line 124 of file SystemBase.C.

125 {
126  return *_vars[tid].getFVVariable<T>(var_name);
127 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getHDGKernelWarehouse()

MooseObjectTagWarehouse<HDGKernel>& NonlinearSystemBase::getHDGKernelWarehouse ( )
inline

Definition at line 602 of file NonlinearSystemBase.h.

602 { return _hybridized_kernels; }
MooseObjectTagWarehouse< HDGKernel > _hybridized_kernels

◆ getIntegratedBCWarehouse() [1/2]

MooseObjectTagWarehouse<IntegratedBCBase>& NonlinearSystemBase::getIntegratedBCWarehouse ( )
inline

Definition at line 593 of file NonlinearSystemBase.h.

Referenced by BoundaryElemIntegrityCheckThread::operator()().

593 { return _integrated_bcs; }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getIntegratedBCWarehouse() [2/2]

const MooseObjectTagWarehouse<IntegratedBCBase>& NonlinearSystemBase::getIntegratedBCWarehouse ( ) const
inline

Return the IntegratedBCBase warehouse.

Definition at line 621 of file NonlinearSystemBase.h.

622  {
623  return _integrated_bcs;
624  }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getInterfaceKernelWarehouse()

MooseObjectTagWarehouse<InterfaceKernelBase>& NonlinearSystemBase::getInterfaceKernelWarehouse ( )
inline

Definition at line 588 of file NonlinearSystemBase.h.

589  {
590  return _interface_kernels;
591  }
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels

◆ getKernelWarehouse() [1/2]

MooseObjectTagWarehouse<KernelBase>& NonlinearSystemBase::getKernelWarehouse ( )
inline

Access functions to Warehouses from outside NonlinearSystemBase.

Definition at line 585 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup(), DOFMapOutput::output(), and BlockRestrictionDebugOutput::printBlockRestrictionMap().

585 { return _kernels; }
MooseObjectTagWarehouse< KernelBase > _kernels

◆ getKernelWarehouse() [2/2]

const MooseObjectTagWarehouse<KernelBase>& NonlinearSystemBase::getKernelWarehouse ( ) const
inline

Definition at line 586 of file NonlinearSystemBase.h.

586 { return _kernels; }
MooseObjectTagWarehouse< KernelBase > _kernels

◆ getMatrix() [1/2]

SparseMatrix< Number > & SystemBase::getMatrix ( TagID  tag)
virtualinherited

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1007 of file SystemBase.C.

Referenced by Assembly::addCachedJacobian(), addImplicitGeometricCouplingEntries(), Assembly::addJacobianCoupledVarPair(), Assembly::addJacobianLowerD(), Assembly::addJacobianNeighbor(), Assembly::addJacobianNeighborLowerD(), Assembly::addJacobianNonlocal(), SystemBase::addMatrix(), SystemBase::closeTaggedMatrices(), computeJacobianInternal(), FEProblemBase::computeJacobianTags(), LinearSystem::computeLinearSystemInternal(), FEProblemBase::computeLinearSystemTags(), FEProblemBase::computeResidualAndJacobian(), computeResidualAndJacobianInternal(), constraintJacobians(), SystemBase::disassociateMatrixFromTag(), enforceNodalConstraintsJacobian(), SystemBase::flushTaggedMatrices(), DisplacedSystem::getMatrix(), LinearSystemContributionObject::linkTaggedVectorsAndMatrices(), MooseVariableScalar::reinit(), Assembly::setCachedJacobian(), and Assembly::zeroCachedJacobian().

1008 {
1009  if (!hasMatrix(tag))
1010  {
1011  if (!_subproblem.matrixTagExists(tag))
1012  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
1013  else
1014  mooseError("Cannot retreive matrix with tag ",
1015  tag,
1016  " in system '",
1017  name(),
1018  "'\nbecause a matrix has not been associated with that tag.");
1019  }
1020 
1021  return *_tagged_matrices[tag];
1022 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1017
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ getMatrix() [2/2]

const SparseMatrix< Number > & SystemBase::getMatrix ( TagID  tag) const
virtualinherited

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1025 of file SystemBase.C.

1026 {
1027  if (!hasMatrix(tag))
1028  {
1029  if (!_subproblem.matrixTagExists(tag))
1030  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
1031  else
1032  mooseError("Cannot retreive matrix with tag ",
1033  tag,
1034  " in system '",
1035  name(),
1036  "'\nbecause a matrix has not been associated with that tag.");
1037  }
1038 
1039  return *_tagged_matrices[tag];
1040 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1017
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inlineinherited

Returns the maximum number of all variables on the system.

Definition at line 868 of file SystemBase.h.

868 { return _max_var_number; }
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:994

◆ getMaxVarNDofsPerElem()

std::size_t SystemBase::getMaxVarNDofsPerElem ( ) const
inlineinherited

Gets the maximum number of dofs used by any one variable on any one element.

Returns
The max

Definition at line 586 of file SystemBase.h.

Referenced by Moose::globalDofIndexToDerivative().

586 { return _max_var_n_dofs_per_elem; }
size_t _max_var_n_dofs_per_elem
Maximum number of dofs for any one variable on any one element.
Definition: SystemBase.h:1035

◆ getMaxVarNDofsPerNode()

std::size_t SystemBase::getMaxVarNDofsPerNode ( ) const
inlineinherited

Gets the maximum number of dofs used by any one variable on any one node.

Returns
The max

Definition at line 593 of file SystemBase.h.

593 { return _max_var_n_dofs_per_node; }
size_t _max_var_n_dofs_per_node
Maximum number of dofs for any one variable on any one node.
Definition: SystemBase.h:1038

◆ getMinQuadratureOrder()

Order SystemBase::getMinQuadratureOrder ( )
virtualinherited

Get minimal quadrature order needed for integrating variables in this system.

Returns
The minimal order of quadrature

Reimplemented in AuxiliarySystem.

Definition at line 240 of file SystemBase.C.

241 {
242  Order order = CONSTANT;
243  const std::vector<MooseVariableFieldBase *> & vars = _vars[0].fieldVariables();
244  for (const auto & var : vars)
245  {
246  FEType fe_type = var->feType();
247  if (fe_type.default_quadrature_order() > order)
248  order = fe_type.default_quadrature_order();
249  }
250 
251  return order;
252 }
Order
char ** vars
Order default_quadrature_order() const
CONSTANT
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getMooseKSPNormType()

Moose::MooseKSPNormType SolverSystem::getMooseKSPNormType ( )
inlineinherited

Get the norm in which the linear convergence is measured.

Definition at line 87 of file SolverSystem.h.

Referenced by Moose::PetscSupport::petscSetDefaultKSPNormType().

87 { return _ksp_norm; }
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Definition: SolverSystem.h:110

◆ getNodalBCWarehouse()

const MooseObjectTagWarehouse<NodalBCBase>& NonlinearSystemBase::getNodalBCWarehouse ( ) const
inline

Return the NodalBCBase warehouse.

Definition at line 616 of file NonlinearSystemBase.h.

616 { return _nodal_bcs; }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs

◆ getNodalDamperWarehouse()

const MooseObjectWarehouse<NodalDamper>& NonlinearSystemBase::getNodalDamperWarehouse ( ) const
inline

Definition at line 607 of file NonlinearSystemBase.h.

Referenced by ComputeNodalDampingThread::onNode(), and ComputeNodalDampingThread::printGeneralExecutionInformation().

608  {
609  return _nodal_dampers;
610  }
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.

◆ getNodalKernelWarehouse()

const MooseObjectTagWarehouse<NodalKernelBase>& NonlinearSystemBase::getNodalKernelWarehouse ( ) const
inline

Definition at line 598 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

599  {
600  return _nodal_kernels;
601  }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.

◆ getNodeDofs()

void NonlinearSystemBase::getNodeDofs ( dof_id_type  node_id,
std::vector< dof_id_type > &  dofs 
)
protected

Definition at line 2156 of file NonlinearSystemBase.C.

Referenced by findImplicitGeometricCouplingEntries().

2157 {
2158  const Node & node = _mesh.nodeRef(node_id);
2159  unsigned int s = number();
2160  if (node.has_dofs(s))
2161  {
2162  for (unsigned int v = 0; v < nVariables(); v++)
2163  for (unsigned int c = 0; c < node.n_comp(s, v); c++)
2164  dofs.push_back(node.dof_number(s, v, c));
2165  }
2166 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
unsigned int n_comp(const unsigned int s, const unsigned int var) const
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:831
virtual unsigned int nVariables() const
Get the number of variables in this system.
Definition: SystemBase.C:874
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
MooseMesh & _mesh
Definition: SystemBase.h:985

◆ getPCSide()

Moose::PCSideType SolverSystem::getPCSide ( )
inlineinherited

Get the current preconditioner side.

Definition at line 76 of file SolverSystem.h.

Referenced by Moose::PetscSupport::petscSetDefaultPCSide().

76 { return _pc_side; }
Moose::PCSideType _pc_side
Preconditioning side.
Definition: SolverSystem.h:108

◆ getPreconditioner()

MoosePreconditioner const * NonlinearSystemBase::getPreconditioner ( ) const

Definition at line 3562 of file NonlinearSystemBase.C.

Referenced by ConsoleUtils::outputExecutionInformation().

3563 {
3564  return _preconditioner.get();
3565 }
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ getPredictor()

Predictor* NonlinearSystemBase::getPredictor ( )
inline

Definition at line 556 of file NonlinearSystemBase.h.

Referenced by AB2PredictorCorrector::estimateTimeError().

556 { return _predictor.get(); }
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ getResidualNonTimeVector()

NumericVector< Number > & NonlinearSystemBase::getResidualNonTimeVector ( )

Return a numeric vector that is associated with the nontime tag.

Definition at line 1032 of file NonlinearSystemBase.C.

Referenced by PseudoTimestep::currentResidualNorm(), NonlinearSystemBase(), and residualVector().

1033 {
1034  if (!_Re_non_time)
1035  {
1037 
1038  // Most applications don't need the expense of ghosting
1040  _Re_non_time = &addVector(_Re_non_time_tag, false, ptype);
1041  }
1043  {
1044  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
1045 
1046  // If an application changes its mind, the libMesh API lets us
1047  // change the vector.
1048  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
1049  }
1050 
1051  return *_Re_non_time;
1052 }
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
PARALLEL
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:92
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
TagID _Re_non_time_tag
Tag for non-time contribution residual.
GHOSTED
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
ParallelType type() const
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
ParallelType
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ getResidualTimeVector()

NumericVector< Number > & NonlinearSystemBase::getResidualTimeVector ( )

Return a numeric vector that is associated with the time tag.

Definition at line 1009 of file NonlinearSystemBase.C.

Referenced by residualVector().

1010 {
1011  if (!_Re_time)
1012  {
1014 
1015  // Most applications don't need the expense of ghosting
1017  _Re_time = &addVector(_Re_time_tag, false, ptype);
1018  }
1019  else if (_need_residual_ghosted && _Re_time->type() == PARALLEL)
1020  {
1021  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
1022 
1023  // If an application changes its mind, the libMesh API lets us
1024  // change the vector.
1025  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
1026  }
1027 
1028  return *_Re_time;
1029 }
NumericVector< Number > * _Re_time
residual vector for time contributions
TagID _Re_time_tag
Tag for time contribution residual.
PARALLEL
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:92
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
GHOSTED
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
ParallelType type() const
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
ParallelType
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ getScalarKernelWarehouse()

const MooseObjectTagWarehouse<ScalarKernelBase>& NonlinearSystemBase::getScalarKernelWarehouse ( ) const
inline

Definition at line 594 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

595  {
596  return _scalar_kernels;
597  }
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels

◆ getScalarVariable() [1/2]

MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
const std::string &  var_name 
) const
virtualinherited

Gets a reference to a scalar variable with specified number.

Parameters
tidThread id
var_nameA string which is the name of the variable to get.
Returns
reference the variable (class)

Definition at line 144 of file SystemBase.C.

Referenced by Assembly::addJacobianOffDiagScalar(), ODEKernel::computeOffDiagJacobianScalar(), VectorKernel::computeOffDiagJacobianScalar(), ArrayKernel::computeOffDiagJacobianScalar(), IntegratedBC::computeOffDiagJacobianScalar(), VectorIntegratedBC::computeOffDiagJacobianScalar(), Kernel::computeOffDiagJacobianScalar(), ArrayIntegratedBC::computeOffDiagJacobianScalar(), ScalarLagrangeMultiplier::computeOffDiagJacobianScalar(), MortarScalarBase::computeOffDiagJacobianScalar(), KernelScalarBase::computeOffDiagJacobianScalarLocal(), KernelScalarBase::computeScalarOffDiagJacobianScalar(), MortarScalarBase::computeScalarOffDiagJacobianScalar(), DMMooseSetVariables(), Assembly::init(), ReferenceResidualConvergence::initialSetup(), and setupScalingData().

145 {
146  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
147  if (!var)
148  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
149  return *var;
150 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
Class for scalar variables (they are different).

◆ getScalarVariable() [2/2]

MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
unsigned int  var_number 
) const
virtualinherited

Gets a reference to a variable with specified number.

Parameters
tidThread id
var_numberlibMesh variable number
Returns
reference the variable (class)

Definition at line 153 of file SystemBase.C.

154 {
155  MooseVariableScalar * var =
156  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
157  if (!var)
158  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
159  return *var;
160 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
Class for scalar variables (they are different).

◆ getScalarVariables()

const std::vector<MooseVariableScalar *>& SystemBase::getScalarVariables ( THREAD_ID  tid)
inlineinherited

◆ getSNES()

virtual SNES NonlinearSystemBase::getSNES ( )
pure virtual

◆ getSplit()

std::shared_ptr< Split > NonlinearSystemBase::getSplit ( const std::string &  name)

Retrieves a split by name.

Parameters
nameThe name of the split

Definition at line 721 of file NonlinearSystemBase.C.

Referenced by Split::setup(), and setupFieldDecomposition().

722 {
723  return _splits.getActiveObject(name);
724 }
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
virtual const std::string & name() const
Definition: SystemBase.C:1330
std::shared_ptr< T > getActiveObject(const std::string &name, THREAD_ID tid=0) const

◆ getSplits()

MooseObjectWarehouseBase<Split>& NonlinearSystemBase::getSplits ( )
inline

Retrieves all splits.

Definition at line 227 of file NonlinearSystemBase.h.

Referenced by ConsoleUtils::outputExecutionInformation().

227 { return _splits; }
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.

◆ getStandardFieldVariableNames()

void SystemBase::getStandardFieldVariableNames ( std::vector< VariableName > &  std_field_variables) const
inherited

◆ getSubdomainsForVar() [1/2]

const std::set<SubdomainID>& SystemBase::getSubdomainsForVar ( unsigned int  var_number) const
inlineinherited

Definition at line 762 of file SystemBase.h.

Referenced by checkKernelCoverage(), and SystemBase::getSubdomainsForVar().

763  {
764  return _var_map.at(var_number);
765  }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:992

◆ getSubdomainsForVar() [2/2]

const std::set< SubdomainID > & SystemBase::getSubdomainsForVar ( const std::string &  var_name) const
inherited

Get the block where a variable of this system is defined.

Parameters
var_nameThe name of the variable
Returns
the set of subdomain ids where the variable is active (defined)

Definition at line 1674 of file SystemBase.C.

1675 {
1676  return getSubdomainsForVar(getVariable(0, var_name).number());
1677 }
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:762
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:89

◆ getTimeIntegrator()

const TimeIntegrator & SystemBase::getTimeIntegrator ( const unsigned int  var_num) const
inherited

Retrieve the time integrator that integrates the given variable's equation.

Definition at line 1650 of file SystemBase.C.

Referenced by AB2PredictorCorrector::estimateTimeError().

1651 {
1652  const auto * const ti = queryTimeIntegrator(var_num);
1653 
1654  if (ti)
1655  return *ti;
1656  else
1657  mooseError("No time integrator found that integrates variable number ",
1658  std::to_string(var_num));
1659 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const TimeIntegrator * queryTimeIntegrator(const unsigned int var_num) const
Retrieve the time integrator that integrates the given variable&#39;s equation.
Definition: SystemBase.C:1640

◆ getTimeIntegrators()

const std::vector< std::shared_ptr< TimeIntegrator > > & SystemBase::getTimeIntegrators ( )
inherited
Returns
All the time integrators owned by this system

Definition at line 1662 of file SystemBase.C.

1663 {
1664  return _time_integrators;
1665 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041

◆ getVariable() [1/2]

MooseVariableFieldBase & SystemBase::getVariable ( THREAD_ID  tid,
const std::string &  var_name 
) const
inherited

Gets a reference to a variable of with specified name.

Parameters
tidThread id
var_namevariable name
Returns
reference the variable (class)

Definition at line 89 of file SystemBase.C.

Referenced by AdaptivityAction::act(), Assembly::addJacobianBlockNonlocal(), FEProblemBase::addJacobianBlockTags(), NonlocalKernel::computeNonlocalOffDiagJacobian(), NonlocalIntegratedBC::computeNonlocalOffDiagJacobian(), Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), Assembly::copyShapes(), SystemBase::copyVars(), DMMooseSetVariables(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), NodeElemConstraint::getConnectedDofIndices(), NodeFaceConstraint::getConnectedDofIndices(), SystemBase::getSubdomainsForVar(), ResidualObject::getVariable(), SubProblem::getVariableHelper(), Assembly::init(), NodalNormalsPreprocessor::initialize(), ExplicitTimeIntegrator::initialSetup(), ReferenceResidualConvergence::initialSetup(), LinearSystem::initialSetup(), Assembly::initNonlocalCoupling(), PNGOutput::makeMeshFunc(), MooseStaticCondensationPreconditioner::MooseStaticCondensationPreconditioner(), UpdateErrorVectorsThread::onElement(), Assembly::prepareBlock(), Assembly::prepareBlockNonlocal(), AddPeriodicBCAction::setPeriodicVars(), setupScalingData(), and VariableCondensationPreconditioner::VariableCondensationPreconditioner().

90 {
92  dynamic_cast<MooseVariableFieldBase *>(_vars[tid].getVariable(var_name));
93  if (!var)
94  mooseError("Variable '", var_name, "' does not exist in this system");
95  return *var;
96 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
This class provides an interface for common operations on field variables of both FE and FV types wit...
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ getVariable() [2/2]

MooseVariableFieldBase & SystemBase::getVariable ( THREAD_ID  tid,
unsigned int  var_number 
) const
inherited

Gets a reference to a variable with specified number.

Parameters
tidThread id
var_numberlibMesh variable number
Returns
reference the variable (class)

Definition at line 99 of file SystemBase.C.

100 {
101  if (var_number < _numbered_vars[tid].size())
102  if (_numbered_vars[tid][var_number])
103  return *_numbered_vars[tid][var_number];
104 
105  mooseError("Variable #", Moose::stringify(var_number), " does not exist in this system");
106 }
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:1044
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64

◆ getVariableBlocks()

const std::set< SubdomainID > * SystemBase::getVariableBlocks ( unsigned int  var_number)
virtualinherited

Get the block where a variable of this system is defined.

Parameters
var_numberThe number of the variable
Returns
the set of subdomain ids where the variable is active (defined)

Definition at line 163 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

164 {
165  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
166  if (_var_map[var_number].empty())
167  return nullptr;
168  else
169  return &_var_map[var_number];
170 }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:992

◆ getVariableGlobalDoFs()

const std::vector<dof_id_type>& SystemBase::getVariableGlobalDoFs ( )
inlineinherited

Get the global dof indices of a variable, this needs to be called after the indices have been set by setVariableGlobalDoFs

Definition at line 843 of file SystemBase.h.

843 { return _var_all_dof_indices; }
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
Definition: SystemBase.h:1056

◆ getVariableNames()

const std::vector<VariableName>& SystemBase::getVariableNames ( ) const
inlineinherited

◆ getVariables()

const std::vector<MooseVariableFieldBase *>& SystemBase::getVariables ( THREAD_ID  tid)
inlineinherited

◆ getVector() [1/4]

NumericVector< Number > & SystemBase::getVector ( const std::string &  name)
virtualinherited

Get a raw NumericVector by name.

Get a raw NumericVector with the given name.

Reimplemented in DisplacedSystem.

Definition at line 916 of file SystemBase.C.

Referenced by Assembly::addCachedResiduals(), Assembly::addResidual(), Assembly::addResidualLower(), Assembly::addResidualNeighbor(), Assembly::addResidualScalar(), assembleScalingVector(), SystemBase::closeTaggedVector(), FEProblemBase::computeBounds(), FEProblemBase::computeNearNullSpace(), FEProblemBase::computeNullSpace(), computeResidualAndJacobianTags(), computeResidualTags(), CentralDifference::computeTimeDerivatives(), FEProblemBase::computeTransposeNullSpace(), DisplacedSystem::getVector(), Assembly::hasScalingVector(), LinearSystemContributionObject::linkTaggedVectorsAndMatrices(), SystemBase::needSolutionState(), ReferenceResidualConvergence::ReferenceResidualConvergence(), MooseVariableScalar::reinit(), SecantSolve::saveVariableValues(), SteffensenSolve::saveVariableValues(), PicardSolve::saveVariableValues(), setPreviousNewtonSolution(), TaggingInterface::setResidual(), SystemBase::solutionPreviousNewton(), SystemBase::solutionState(), MultiAppDofCopyTransfer::transfer(), SecantSolve::transformVariables(), SteffensenSolve::transformVariables(), PicardSolve::transformVariables(), and SystemBase::zeroTaggedVector().

917 {
918  return system().get_vector(name);
919 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual const std::string & name() const
Definition: SystemBase.C:1330
const NumericVector< Number > & get_vector(std::string_view vec_name) const

◆ getVector() [2/4]

const NumericVector< Number > & SystemBase::getVector ( const std::string &  name) const
virtualinherited

Reimplemented in DisplacedSystem.

Definition at line 922 of file SystemBase.C.

923 {
924  return system().get_vector(name);
925 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual const std::string & name() const
Definition: SystemBase.C:1330
const NumericVector< Number > & get_vector(std::string_view vec_name) const

◆ getVector() [3/4]

NumericVector< Number > & SystemBase::getVector ( TagID  tag)
virtualinherited

Get a raw NumericVector by tag.

Reimplemented in DisplacedSystem.

Definition at line 928 of file SystemBase.C.

929 {
930  if (!hasVector(tag))
931  {
932  if (!_subproblem.vectorTagExists(tag))
933  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
934  else
935  mooseError("Cannot retreive vector with tag ",
936  tag,
937  " in system '",
938  name(),
939  "'\nbecause a vector has not been associated with that tag.");
940  }
941 
942  return *_tagged_vectors[tag];
943 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ getVector() [4/4]

const NumericVector< Number > & SystemBase::getVector ( TagID  tag) const
virtualinherited

Reimplemented in DisplacedSystem.

Definition at line 946 of file SystemBase.C.

947 {
948  if (!hasVector(tag))
949  {
950  if (!_subproblem.vectorTagExists(tag))
951  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
952  else
953  mooseError("Cannot retreive vector with tag ",
954  tag,
955  " in system '",
956  name(),
957  "'\nbecause a vector has not been associated with that tag.");
958  }
959 
960  return *_tagged_vectors[tag];
961 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ gradientContainer()

const std::vector<std::unique_ptr<NumericVector<Number> > >& SystemBase::gradientContainer ( ) const
inlineinherited

Reference to the container vector which hold gradients at dofs (if it can be interpreted).

Mainly used for finite volume systems.

Definition at line 931 of file SystemBase.h.

932  {
933  return _raw_grad_container;
934  }
std::vector< std::unique_ptr< NumericVector< Number > > > _raw_grad_container
A cache for storing gradients at dof locations.
Definition: SystemBase.h:1065

◆ hasDiagSaveIn()

bool NonlinearSystemBase::hasDiagSaveIn ( ) const
inline

Weather or not the nonlinear system has diagonal Jacobian save-ins.

Definition at line 636 of file NonlinearSystemBase.h.

Referenced by computeJacobianInternal().

bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.

◆ hasMatrix()

virtual bool SystemBase::hasMatrix ( TagID  tag) const
inlinevirtualinherited

◆ hasSaveIn()

bool NonlinearSystemBase::hasSaveIn ( ) const
inline

Weather or not the nonlinear system has save-ins.

Definition at line 631 of file NonlinearSystemBase.h.

Referenced by computeResidualTags().

631 { return _has_save_in || _has_nodalbc_save_in; }
bool _has_nodalbc_save_in
If there is a nodal BC having save_in.
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.

◆ hasScalarVariable()

bool SystemBase::hasScalarVariable ( const std::string &  var_name) const
virtualinherited

Definition at line 859 of file SystemBase.C.

Referenced by MortarScalarBase::computeJacobian(), computeJacobianInternal(), ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), SystemBase::copyVars(), ExplicitTimeIntegrator::initialSetup(), NonlinearEigenSystem::postAddResidualObject(), AddPeriodicBCAction::setPeriodicVars(), and setupScalingData().

860 {
861  if (system().has_variable(var_name))
862  return system().variable_type(var_name).family == SCALAR;
863  else
864  return false;
865 }
SCALAR
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const FEType & variable_type(const unsigned int i) const

◆ hasSolutionState()

bool SystemBase::hasSolutionState ( const unsigned int  state,
Moose::SolutionIterationType  iteration_type = Moose::SolutionIterationType::Time 
) const
inlinevirtualinherited

Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc).

Reimplemented in DisplacedSystem.

Definition at line 1081 of file SystemBase.h.

Referenced by PointwiseRenormalizeVector::execute(), PointwiseRenormalizeVector::finalize(), DisplacedSystem::hasSolutionState(), SystemBase::needSolutionState(), SystemBase::restoreSolutions(), ElementSubdomainModifierBase::setOldAndOlderSolutions(), and SystemBase::solutionState().

1083 {
1084  return _solution_states[static_cast<unsigned short>(iteration_type)].size() > state;
1085 }
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075

◆ hasVarCopy()

bool SystemBase::hasVarCopy ( ) const
inlineinherited

Whether or not there are variables to be restarted from an Exodus mesh file.

Definition at line 884 of file SystemBase.h.

884 { return _var_to_copy.size() > 0; }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1032

◆ hasVariable()

bool SystemBase::hasVariable ( const std::string &  var_name) const
virtualinherited

Query a system for a variable.

Parameters
var_namename of the variable
Returns
true if the variable exists

Definition at line 834 of file SystemBase.C.

Referenced by ADDGKernel::ADDGKernel(), ArrayDGKernel::ArrayDGKernel(), SystemBase::copyVars(), DGKernel::DGKernel(), DMMooseSetVariables(), FEProblemBase::duplicateVariableCheck(), SubProblem::getVariableHelper(), SubProblem::hasAuxiliaryVariable(), ExplicitTimeIntegrator::initialSetup(), InterfaceKernelTempl< T >::InterfaceKernelTempl(), PNGOutput::makeMeshFunc(), MultiAppVariableValueSamplePostprocessorTransfer::MultiAppVariableValueSamplePostprocessorTransfer(), setupScalingData(), and Coupleable::writableCoupledValue().

835 {
836  auto & names = getVariableNames();
837  if (system().has_variable(var_name))
838  return system().variable_type(var_name).family != SCALAR;
839  if (std::find(names.begin(), names.end(), var_name) != names.end())
840  // array variable
841  return true;
842  else
843  return false;
844 }
SCALAR
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const FEType & variable_type(const unsigned int i) const
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:861

◆ hasVector() [1/2]

bool SystemBase::hasVector ( const std::string &  tag_name) const
inherited

◆ hasVector() [2/2]

virtual bool SystemBase::hasVector ( TagID  tag_id) const
inlinevirtualinherited

Check if the tagged vector exists in the system.

Reimplemented in DisplacedSystem.

Definition at line 272 of file SystemBase.h.

273  {
274  return tag_id < _tagged_vectors.size() && _tagged_vectors[tag_id];
275  }
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ haveFieldSplitPreconditioner()

bool NonlinearSystemBase::haveFieldSplitPreconditioner ( ) const
inline

Definition at line 109 of file NonlinearSystemBase.h.

Referenced by setupDM().

bool _use_field_split_preconditioner
Whether or not to use a FieldSplitPreconditioner matrix based on the decomposition.

◆ haveFiniteDifferencedPreconditioner()

bool NonlinearSystemBase::haveFiniteDifferencedPreconditioner ( ) const
inline

Definition at line 105 of file NonlinearSystemBase.h.

106  {
108  }
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.

◆ ignoreVariablesForAutoscaling()

void NonlinearSystemBase::ignoreVariablesForAutoscaling ( const std::vector< std::string > &  ignore_variables_for_autoscaling)
inline

Definition at line 679 of file NonlinearSystemBase.h.

680  {
681  _ignore_variables_for_autoscaling = ignore_variables_for_autoscaling;
682  }
std::vector< std::string > _ignore_variables_for_autoscaling
A container for variables that do not partipate in autoscaling.

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

Called only once, just before the solve begins so objects can do some precalculations.

Definition at line 173 of file SystemBase.h.

173 {}

◆ initialResidual()

Real NonlinearSystemBase::initialResidual ( ) const

The initial residual.

Definition at line 760 of file NonlinearSystemBase.C.

Referenced by referenceResidual().

761 {
762  return _initial_residual;
763 }
Real _initial_residual
The initial (i.e., 0th nonlinear iteration) residual, see setPreSMOResidual for a detailed explanatio...

◆ initialSetup()

void NonlinearSystemBase::initialSetup ( )
overridevirtual

Setup Functions.

Reimplemented from SystemBase.

Definition at line 202 of file NonlinearSystemBase.C.

203 {
204  TIME_SECTION("nlInitialSetup", 2, "Setting Up Nonlinear System");
205 
207 
208  {
209  TIME_SECTION("kernelsInitialSetup", 2, "Setting Up Kernels/BCs/Constraints");
210 
211  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
212  {
213  _kernels.initialSetup(tid);
216  if (_doing_dg)
219 
223 
224  if (_fe_problem.haveFV())
225  {
226  std::vector<FVElementalKernel *> fv_elemental_kernels;
228  .query()
229  .template condition<AttribSystem>("FVElementalKernel")
230  .template condition<AttribThread>(tid)
231  .queryInto(fv_elemental_kernels);
232 
233  for (auto * fv_kernel : fv_elemental_kernels)
234  fv_kernel->initialSetup();
235 
236  std::vector<FVFluxKernel *> fv_flux_kernels;
238  .query()
239  .template condition<AttribSystem>("FVFluxKernel")
240  .template condition<AttribThread>(tid)
241  .queryInto(fv_flux_kernels);
242 
243  for (auto * fv_kernel : fv_flux_kernels)
244  fv_kernel->initialSetup();
245  }
246  }
247 
252  }
253 
254  {
255  TIME_SECTION("mortarSetup", 2, "Initializing Mortar Interfaces");
256 
257  auto create_mortar_functors = [this](const bool displaced)
258  {
259  // go over mortar interfaces and construct functors
260  const auto & mortar_interfaces = _fe_problem.getMortarInterfaces(displaced);
261  for (const auto & mortar_interface : mortar_interfaces)
262  {
263  const auto primary_secondary_boundary_pair = mortar_interface.first;
264  if (!_constraints.hasActiveMortarConstraints(primary_secondary_boundary_pair, displaced))
265  continue;
266 
267  const auto & mortar_generation_object = mortar_interface.second;
268 
269  auto & mortar_constraints =
270  _constraints.getActiveMortarConstraints(primary_secondary_boundary_pair, displaced);
271 
272  auto & subproblem = displaced
273  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
274  : static_cast<SubProblem &>(_fe_problem);
275 
276  auto & mortar_functors =
278 
279  mortar_functors.emplace(primary_secondary_boundary_pair,
280  ComputeMortarFunctor(mortar_constraints,
281  mortar_generation_object,
282  subproblem,
283  _fe_problem,
284  displaced,
285  subproblem.assembly(0, number())));
286  }
287  };
288 
289  create_mortar_functors(false);
290  create_mortar_functors(true);
291  }
292 
293  if (_automatic_scaling)
294  {
296  _scaling_matrix = std::make_unique<OffDiagonalScalingMatrix<Number>>(_communicator);
297  else
298  _scaling_matrix = std::make_unique<DiagonalMatrix<Number>>(_communicator);
299  }
300 
301  if (_preconditioner)
302  _preconditioner->initialSetup();
303 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
bool hasActiveMortarConstraints(const std::pair< BoundaryID, BoundaryID > &mortar_interface_key, bool displaced) const
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
const Parallel::Communicator & _communicator
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _undisplaced_mortar_functors
Functors for computing undisplaced mortar constraints.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
TheWarehouse & theWarehouse() const
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _displaced_mortar_functors
Functors for computing displaced mortar constraints.
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1047
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.
SubProblem & subproblem()
Definition: SystemBase.h:101
MooseObjectTagWarehouse< KernelBase > _kernels
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
const std::vector< std::shared_ptr< MortarConstraintBase > > & getActiveMortarConstraints(const std::pair< BoundaryID, BoundaryID > &mortar_interface_key, bool displaced) const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num)=0
bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, AutomaticMortarGeneration > & getMortarInterfaces(bool on_displaced) const
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
virtual void initialSetup()
Setup Functions.
Definition: SystemBase.C:1525
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ initSolutionState()

void SystemBase::initSolutionState ( )
virtualinherited

Initializes the solution state.

Reimplemented in DisplacedSystem.

Definition at line 1354 of file SystemBase.C.

Referenced by DisplacedSystem::initSolutionState().

1355 {
1356  // Default is the current solution
1357  unsigned int state = 0;
1358 
1359  // Add additional states as required by the variable states requested
1360  for (const auto & var : getVariables(/* tid = */ 0))
1361  state = std::max(state, var->oldestSolutionStateRequested());
1362  for (const auto & var : getScalarVariables(/* tid = */ 0))
1363  state = std::max(state, var->oldestSolutionStateRequested());
1364 
1366 
1368 }
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Registers that the solution state state is needed.
Definition: SystemBase.C:1428
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
Definition: SystemBase.h:752
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:757
bool _solution_states_initialized
Whether or not the solution states have been initialized.
Definition: SystemBase.h:1053
auto max(const L &left, const R &right)

◆ isArrayVariable()

bool SystemBase::isArrayVariable ( const std::string &  var_name) const
virtualinherited

If a variable is an array variable.

Definition at line 847 of file SystemBase.C.

848 {
849  auto & names = getVariableNames();
850  if (!system().has_variable(var_name) &&
851  std::find(names.begin(), names.end(), var_name) != names.end())
852  // array variable
853  return true;
854  else
855  return false;
856 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:861

◆ isScalarVariable()

bool SystemBase::isScalarVariable ( unsigned int  var_name) const
virtualinherited

Definition at line 868 of file SystemBase.C.

Referenced by Assembly::init(), ReferenceResidualConvergence::initialSetup(), and Assembly::initNonlocalCoupling().

869 {
870  return (system().variable(var_num).type().family == SCALAR);
871 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.

◆ jacobianSetup()

void NonlinearSystemBase::jacobianSetup ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 2759 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal().

2760 {
2762 
2763  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
2764  {
2765  _kernels.jacobianSetup(tid);
2768  if (_doing_dg)
2774  }
2779 
2780  // Avoid recursion
2781  if (this == &_fe_problem.currentNonlinearSystem())
2784 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
virtual void jacobianSetup()
Definition: SystemBase.C:1573
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:167
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
virtual void jacobianSetup(THREAD_ID tid=0) const
ConstraintWarehouse _constraints
Constraints storage object.
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
void resetSolutionInvalidCurrentIteration()
Reset the number of solution invalid occurrences back to zero.
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
void jacobianSetup() override
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ matrixFromColoring()

virtual bool SolverSystem::matrixFromColoring ( ) const
inlineprotectedvirtualinherited

Whether a system matrix is formed from coloring.

This influences things like when to compute time derivatives

Reimplemented in NonlinearSystem.

Definition at line 102 of file SolverSystem.h.

Referenced by SolverSystem::compute(), and destroyColoring().

102 { return false; }

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtualinherited

If or not a matrix tag is active.

Definition at line 1151 of file SystemBase.C.

1152 {
1153  mooseAssert(_subproblem.matrixTagExists(tag), "Matrix tag " << tag << " does not exist");
1154 
1155  return tag < _matrix_tag_active_flags.size() && _matrix_tag_active_flags[tag];
1156 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1019
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ mesh() [1/2]

MooseMesh& SystemBase::mesh ( )
inlineinherited

◆ mesh() [2/2]

const MooseMesh& SystemBase::mesh ( ) const
inlineinherited

Definition at line 100 of file SystemBase.h.

100 { return _mesh; }
MooseMesh & _mesh
Definition: SystemBase.h:985

◆ mortarConstraints()

void NonlinearSystemBase::mortarConstraints ( Moose::ComputeType  compute_type,
const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags 
)
protected

Do mortar constraint residual/jacobian computations.

Definition at line 3791 of file NonlinearSystemBase.C.

Referenced by computeJacobianInternal(), computeResidualAndJacobianInternal(), and computeResidualInternal().

3794 {
3795  parallel_object_only();
3796 
3797  try
3798  {
3799  for (auto & map_pr : _undisplaced_mortar_functors)
3800  map_pr.second(compute_type, vector_tags, matrix_tags);
3801 
3802  for (auto & map_pr : _displaced_mortar_functors)
3803  map_pr.second(compute_type, vector_tags, matrix_tags);
3804  }
3805  catch (MetaPhysicL::LogicError &)
3806  {
3807  mooseError(
3808  "We caught a MetaPhysicL error in NonlinearSystemBase::mortarConstraints. This is very "
3809  "likely due to AD not having a sufficiently large derivative container size. Please run "
3810  "MOOSE configure with the '--with-derivative-size=<n>' option");
3811  }
3812 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _undisplaced_mortar_functors
Functors for computing undisplaced mortar constraints.
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _displaced_mortar_functors
Functors for computing displaced mortar constraints.

◆ name()

const std::string & SystemBase::name ( ) const
virtualinherited

◆ needBoundaryMaterialOnSide()

bool NonlinearSystemBase::needBoundaryMaterialOnSide ( BoundaryID  bnd_id,
THREAD_ID  tid 
) const

Indicated whether this system needs material properties on boundaries.

Returns
Boolean if IntegratedBCs are active

Definition at line 3759 of file NonlinearSystemBase.C.

3760 {
3761  return _integrated_bcs.hasActiveBoundaryObjects(bnd_id, tid);
3762 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ needInterfaceMaterialOnSide()

bool NonlinearSystemBase::needInterfaceMaterialOnSide ( BoundaryID  bnd_id,
THREAD_ID  tid 
) const

Indicated whether this system needs material properties on interfaces.

Returns
Boolean if IntegratedBCs are active

Definition at line 3765 of file NonlinearSystemBase.C.

3766 {
3767  return _interface_kernels.hasActiveBoundaryObjects(bnd_id, tid);
3768 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels

◆ needSolutionState()

void SystemBase::needSolutionState ( const unsigned int  state,
Moose::SolutionIterationType  iteration_type = Moose::SolutionIterationType::Time 
)
virtualinherited

Registers that the solution state state is needed.

Reimplemented in DisplacedSystem.

Definition at line 1428 of file SystemBase.C.

Referenced by EigenExecutionerBase::EigenExecutionerBase(), SystemBase::initSolutionState(), DisplacedSystem::needSolutionState(), and SystemBase::solutionState().

1430 {
1431  libmesh_parallel_only(this->comm());
1432  mooseAssert(!Threads::in_threads,
1433  "This routine is not thread-safe. Request the solution state before using it in "
1434  "a threaded region.");
1435 
1436  if (hasSolutionState(state, iteration_type))
1437  return;
1438 
1439  auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1440  solution_states.resize(state + 1);
1441 
1442  // The 0-th (current) solution state is owned by libMesh
1443  if (!solution_states[0])
1444  solution_states[0] = &solutionInternal();
1445  else
1446  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1447 
1448  // We will manually add all states past current
1449  for (unsigned int i = 1; i <= state; ++i)
1450  if (!solution_states[i])
1451  {
1452  auto tag = _subproblem.addVectorTag(oldSolutionStateVectorName(i, iteration_type),
1454  solution_states[i] = &addVector(tag, true, GHOSTED);
1455  }
1456  else
1457  mooseAssert(solution_states[i] == &getVector(oldSolutionStateVectorName(i, iteration_type)),
1458  "Inconsistent solution state");
1459 }
virtual NumericVector< Number > & solutionInternal() const =0
Internal getter for solution owned by libMesh.
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:92
const Parallel::Communicator & comm() const
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.h:1081
TagName oldSolutionStateVectorName(const unsigned int, Moose::SolutionIterationType iteration_type) const
Gets the vector name used for an old (not current) solution state.
Definition: SystemBase.C:1371
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ needSubdomainMaterialOnSide()

bool NonlinearSystemBase::needSubdomainMaterialOnSide ( SubdomainID  subdomain_id,
THREAD_ID  tid 
) const

Indicates whether this system needs material properties on internal sides.

Returns
Boolean if DGKernels are active

Definition at line 3771 of file NonlinearSystemBase.C.

3773 {
3774  return _doing_dg;
3775 }
bool _doing_dg
true if DG is active (optimization reasons)

◆ nFieldVariables()

unsigned int SystemBase::nFieldVariables ( ) const
inherited

Get the number of field variables in this system.

Returns
the number of field variables

Definition at line 883 of file SystemBase.C.

Referenced by SystemBase::nVariables().

884 {
885  unsigned int n = 0;
886  for (auto & var : _vars[0].fieldVariables())
887  n += var->count();
888 
889  return n;
890 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ nFVVariables()

unsigned int SystemBase::nFVVariables ( ) const
inherited

Get the number of finite volume variables in this system.

Returns
the number of finite volume variables

Definition at line 893 of file SystemBase.C.

894 {
895  unsigned int n = 0;
896  for (auto & var : _vars[0].fieldVariables())
897  if (var->isFV())
898  n += var->count();
899 
900  return n;
901 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ nLinearIterations()

unsigned int NonlinearSystemBase::nLinearIterations ( ) const
inline

Return the number of linear iterations.

Definition at line 527 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

527 { return _n_linear_iters; }

◆ nNonlinearIterations()

unsigned int NonlinearSystemBase::nNonlinearIterations ( ) const
inline

Return the number of non-linear iterations.

Definition at line 522 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

522 { return _n_iters; }

◆ nonlinearNorm()

Real NonlinearSystemBase::nonlinearNorm ( ) const
inline

Return the last nonlinear norm.

Returns
A Real containing the last computed residual norm

Definition at line 543 of file NonlinearSystemBase.h.

Referenced by Console::writeVariableNorms().

543 { return _last_nl_rnorm; }

◆ nonlinearSolver()

virtual libMesh::NonlinearSolver<Number>* NonlinearSystemBase::nonlinearSolver ( )
pure virtual

◆ nonTimeVectorTag()

TagID NonlinearSystemBase::nonTimeVectorTag ( ) const
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 648 of file NonlinearSystemBase.h.

Referenced by FEProblemBase::addCachedResidualDirectly(), and CrankNicolson::init().

648 { return _Re_non_time_tag; }
TagID _Re_non_time_tag
Tag for non-time contribution residual.

◆ nResidualEvaluations()

unsigned int NonlinearSystemBase::nResidualEvaluations ( ) const
inline

Return the total number of residual evaluations done so far in this calculation.

Definition at line 532 of file NonlinearSystemBase.h.

532 { return _n_residual_evaluations; }
unsigned int _n_residual_evaluations
Total number of residual evaluations that have been performed.

◆ number()

unsigned int SystemBase::number ( ) const
inherited

Gets the number of this system.

Returns
The number of this system

Definition at line 1159 of file SystemBase.C.

Referenced by SetupResidualDebugAction::act(), FEProblemBase::addCachedResidualDirectly(), FEProblemBase::addJacobian(), FEProblemBase::addJacobianBlockTags(), FEProblemBase::addJacobianLowerD(), FEProblemBase::addJacobianNeighbor(), FEProblemBase::addJacobianNeighborLowerD(), FEProblemBase::addJacobianOffDiagScalar(), FEProblemBase::addJacobianScalar(), FEProblemBase::addResidual(), FEProblemBase::addResidualLower(), FEProblemBase::addResidualNeighbor(), FEProblemBase::addResidualScalar(), SystemBase::addScalingVector(), ADKernelTempl< T >::ADKernelTempl(), ElementSubdomainModifierBase::applyIC(), ArrayKernel::ArrayKernel(), assembleScalingVector(), NonlinearEigenSystem::attachPreconditioner(), DiffusionLHDGAssemblyHelper::checkCoupling(), SolverSystem::compute(), MooseVariableScalar::computeAD(), FEProblemBase::computeBounds(), Assembly::computeFaceMap(), InternalSideIndicatorBase::computeIndicator(), ArrayNodalBC::computeJacobian(), VectorNodalBC::computeJacobian(), NodalBC::computeJacobian(), FVBoundaryScalarLagrangeMultiplierConstraint::computeJacobian(), FVFluxBC::computeJacobian(), FVFluxKernel::computeJacobian(), FVInterfaceKernel::computeJacobian(), FEProblemBase::computeJacobianBlock(), computeJacobianInternal(), FEProblemBase::computeJacobianTags(), LinearSystem::computeLinearSystemInternal(), FEProblemBase::computeNearNullSpace(), computeNodalBCsResidualAndJacobian(), FEProblemBase::computeNullSpace(), VectorNodalBC::computeOffDiagJacobian(), ArrayNodalBC::computeOffDiagJacobian(), NodalBC::computeOffDiagJacobian(), NodalKernel::computeOffDiagJacobian(), ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), ComputeFullJacobianThread::computeOnInterface(), ComputeFullJacobianThread::computeOnInternalFace(), FEProblemBase::computePostCheck(), FVOrthogonalBoundaryDiffusion::computeQpResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVFluxKernel::computeResidual(), FVInterfaceKernel::computeResidual(), Kernel::computeResidualAndJacobian(), NodalBC::computeResidualAndJacobian(), IntegratedBC::computeResidualAndJacobian(), FEProblemBase::computeResidualAndJacobian(), computeResidualAndJacobianInternal(), computeResidualInternal(), FEProblemBase::computeResidualL2Norm(), computeResidualTags(), computeScaling(), Assembly::computeSinglePointMapAD(), FEProblemBase::computeTransposeNullSpace(), DebugResidualAux::computeValue(), NearestNodeValueAux::computeValue(), SlepcEigenSolverConfiguration::configure_solver(), constraintJacobians(), LinearSystem::containsTimeKernel(), Coupleable::coupled(), FEProblemBase::currentLinearSysNum(), FEProblemBase::currentNlSysNum(), PseudoTimestep::currentResidualNorm(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), Moose::doDerivatives(), VariableResidual::execute(), NodalNormalsEvaluator::execute(), GreaterThanLessThanPostprocessor::execute(), NodalNormalsCorner::execute(), NodalNormalsPreprocessor::execute(), ExplicitTimeIntegrator::ExplicitTimeIntegrator(), InternalSideIndicatorBase::finalize(), NumNonlinearIterations::finalize(), BoundsBase::getDoFIndex(), getNodeDofs(), NonlinearEigenSystem::getSNES(), SystemBase::getSubdomainsForVar(), NumLinearIterations::getValue(), NumResidualEvaluations::getValue(), Residual::getValue(), Moose::globalDofIndexToDerivative(), FVBoundaryCondition::hasFaceSide(), ExplicitTimeIntegrator::init(), ExplicitTimeIntegrator::initialSetup(), initialSetup(), ActivateElementsUserObjectBase::initSolutions(), EigenExecutionerBase::inversePowerIteration(), Kernel::Kernel(), Moose::SlepcSupport::mooseSlepcEigenFormFunctionA(), Moose::SlepcSupport::mooseSlepcEigenFormFunctionAB(), Moose::SlepcSupport::mooseSlepcEigenFormFunctionB(), Moose::SlepcSupport::mooseSlepcEigenFormJacobianA(), MooseStaticCondensationPreconditioner::MooseStaticCondensationPreconditioner(), MooseVariableInterface< Real >::MooseVariableInterface(), EigenExecutionerBase::nonlinearSolve(), ComputeDiracThread::onElement(), ComputeNodalKernelBCJacobiansThread::onNode(), ComputeNodalKernelJacobiansThread::onNode(), VariableResidualNormsDebugOutput::output(), Moose::PetscSupport::petscLinearConverged(), Moose::PetscSupport::petscNonlinearConverged(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), ComputeJacobianThread::postElement(), FEProblemBase::prepareAssembly(), SystemBase::prepareFace(), FEProblemBase::prepareFaceShapes(), FEProblemBase::prepareNeighborShapes(), FEProblemBase::prepareShapes(), FEProblemBase::reinitDirac(), FEProblemBase::reinitOffDiagScalars(), NonlinearSystem::residualAndJacobianTogether(), FEProblemBase::setResidual(), FEProblemBase::setResidualNeighbor(), PhysicsBasedPreconditioner::setup(), FVInterfaceKernel::setupData(), shouldEvaluatePreSMOResidual(), ActuallyExplicitEuler::solve(), NonlinearEigenSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), ExplicitSSPRungeKutta::solveStage(), NonlinearThread::subdomainChanged(), UserObject::systemNumber(), MultiAppDofCopyTransfer::transferDofObject(), FVFluxBC::uOnGhost(), FVFluxBC::uOnUSub(), FVFluxBC::updateCurrentFace(), and MortarConstraintBase::zeroInactiveLMDofs().

1160 {
1161  return system().number();
1162 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
unsigned int number() const

◆ nVariables()

unsigned int SystemBase::nVariables ( ) const
virtualinherited

Get the number of variables in this system.

Returns
the number of variables

Definition at line 874 of file SystemBase.C.

Referenced by AdaptivityAction::act(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), getNodeDofs(), Assembly::init(), ExplicitTimeIntegrator::initialSetup(), MaxVarNDofsPerElem::onElement(), MaxVarNDofsPerNode::onNode(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), and AuxiliarySystem::variableWiseRelativeSolutionDifferenceNorm().

875 {
876  unsigned int n = nFieldVariables();
877  n += _vars[0].scalars().size();
878 
879  return n;
880 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
unsigned int nFieldVariables() const
Get the number of field variables in this system.
Definition: SystemBase.C:883

◆ offDiagonalsInAutoScaling() [1/2]

bool NonlinearSystemBase::offDiagonalsInAutoScaling ( ) const
inline

Definition at line 684 of file NonlinearSystemBase.h.

Referenced by ComputeJacobianForScalingThread::computeOnElement().

bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.

◆ offDiagonalsInAutoScaling() [2/2]

void NonlinearSystemBase::offDiagonalsInAutoScaling ( bool  off_diagonals_in_auto_scaling)
inline

Definition at line 685 of file NonlinearSystemBase.h.

686  {
687  _off_diagonals_in_auto_scaling = off_diagonals_in_auto_scaling;
688  }
bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.

◆ onTimestepBegin()

void NonlinearSystemBase::onTimestepBegin ( )

Called at the beginning of the time step.

Definition at line 923 of file NonlinearSystemBase.C.

924 {
925  for (auto & ti : _time_integrators)
926  ti->preSolve();
927  if (_predictor.get())
928  _predictor->timestepSetup();
929 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ overwriteNodeFace()

void NonlinearSystemBase::overwriteNodeFace ( NumericVector< Number > &  soln)

Called from explicit time stepping to overwrite boundary positions (explicit dynamics).

This will close/assemble the passed-in soln after overwrite

Definition at line 1645 of file NonlinearSystemBase.C.

Referenced by ActuallyExplicitEuler::solve().

1646 {
1647  // Overwrite results from integrator in case we have explicit dynamics contact constraints
1649  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1650  : static_cast<SubProblem &>(_fe_problem);
1651  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1652 
1653  for (const auto & it : penetration_locators)
1654  {
1655  PenetrationLocator & pen_loc = *(it.second);
1656 
1657  const auto & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1658  const BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1659  const BoundaryID primary_boundary = pen_loc._primary_boundary;
1660 
1661  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, true))
1662  {
1663  const auto & constraints =
1664  _constraints.getActiveNodeFaceConstraints(secondary_boundary, true);
1665  for (const auto i : index_range(secondary_nodes))
1666  {
1667  const auto secondary_node_num = secondary_nodes[i];
1668  const Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1669 
1670  if (secondary_node.processor_id() == processor_id())
1671  if (pen_loc._penetration_info[secondary_node_num])
1672  for (const auto & nfc : constraints)
1673  {
1674  if (!nfc->isExplicitConstraint())
1675  continue;
1676 
1677  // Return if this constraint does not correspond to the primary-secondary pair
1678  // prepared by the outer loops.
1679  // This continue statement is required when, e.g. one secondary surface constrains
1680  // more than one primary surface.
1681  if (nfc->secondaryBoundary() != secondary_boundary ||
1682  nfc->primaryBoundary() != primary_boundary)
1683  continue;
1684 
1685  nfc->overwriteBoundaryVariables(soln, secondary_node);
1686  }
1687  }
1688  }
1689  }
1690  soln.close();
1691 }
std::map< std::pair< BoundaryID, BoundaryID >, PenetrationLocator * > _penetration_locators
BoundaryID _secondary_boundary
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:831
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
boundary_id_type BoundaryID
SubProblem & subproblem()
Definition: SystemBase.h:101
virtual GeometricSearchData & geomSearchData()=0
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:985
processor_id_type processor_id() const
processor_id_type processor_id() const
auto index_range(const T &sizable)
BoundaryID _primary_boundary
NearestNodeLocator & _nearest_node

◆ perfGraph()

PerfGraph & PerfGraphInterface::perfGraph ( )
inherited

Get the PerfGraph.

Definition at line 78 of file PerfGraphInterface.C.

Referenced by CommonOutputAction::act(), PerfGraphData::finalize(), and PerfGraphOutput::output().

79 {
80  return _pg_moose_app.perfGraph();
81 }
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:161

◆ postAddResidualObject()

virtual void NonlinearSystemBase::postAddResidualObject ( ResidualObject )
inlineprotectedvirtual

Called after any ResidualObject-derived objects are added to the system.

Reimplemented in NonlinearEigenSystem.

Definition at line 784 of file NonlinearSystemBase.h.

Referenced by addBoundaryCondition(), addConstraint(), addDGKernel(), addDiracKernel(), addHDGKernel(), addInterfaceKernel(), addKernel(), addNodalKernel(), and addScalarKernel().

784 {}

◆ postInit()

virtual void SystemBase::postInit ( )
inlinevirtualinherited

Reimplemented in NonlinearEigenSystem.

Definition at line 162 of file SystemBase.h.

Referenced by NonlinearEigenSystem::postInit().

162 {}

◆ potentiallySetupFiniteDifferencing()

virtual void NonlinearSystemBase::potentiallySetupFiniteDifferencing ( )
inlinevirtual

Create finite differencing contexts for assembly of the Jacobian and/or approximating the action of the Jacobian on vectors (e.g.

FD and/or MFFD respectively)

Reimplemented in NonlinearSystem.

Definition at line 707 of file NonlinearSystemBase.h.

Referenced by LStableDirk2::solve(), LStableDirk3::solve(), and LStableDirk4::solve().

707 {}

◆ prefix()

std::string SystemBase::prefix ( ) const
inherited
Returns
A prefix for solvers

Definition at line 1680 of file SystemBase.C.

Referenced by MoosePreconditioner::initialSetup().

1681 {
1682  return "-" + (system().prefix_with_name() ? system().prefix() : "");
1683 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::string prefix() const
void prefix_with_name(bool value)

◆ preInit()

void NonlinearSystemBase::preInit ( )
overridevirtual

This is called prior to the libMesh system has been init'd.

MOOSE system wrappers can use this method to add vectors and matrices to the libMesh system

Reimplemented from SolverSystem.

Definition at line 183 of file NonlinearSystemBase.C.

184 {
186 
187  if (_fe_problem.hasDampers())
188  setupDampers();
189 
190  if (_residual_copy.get())
191  _residual_copy->init(_sys.n_dofs(), false, SERIAL);
192 }
void setupDampers()
Setup damping stuff (called before we actually start)
bool hasDampers()
Whether or not this system has dampers.
dof_id_type n_dofs() const
SERIAL
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.
virtual void preInit() override
This is called prior to the libMesh system has been init&#39;d.
Definition: SolverSystem.C:32
libMesh::System & _sys

◆ prepare()

void SystemBase::prepare ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 255 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

256 {
258  {
259  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
261  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
262  for (const auto & var : vars)
263  var->clearDofIndices();
264 
265  for (const auto & var : active_elemental_moose_variables)
266  if (&(var->sys()) == this)
267  var->prepare();
268  }
269  else
270  {
271  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
272  for (const auto & var : vars)
273  var->prepare();
274  }
275 }
char ** vars
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:454
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:460

◆ prepareFace()

void SystemBase::prepareFace ( THREAD_ID  tid,
bool  resize_data 
)
virtualinherited

Prepare the system for use on sides.

This will try to reuse the preparation done on the element.

Parameters
tidID of the thread
resize_dataPass True if this system needs to resize residual and jacobian datastructures based on preparing this face

Definition at line 278 of file SystemBase.C.

279 {
280  // We only need to do something if the element prepare was restricted
282  {
283  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
285 
286  std::vector<MooseVariableFieldBase *> newly_prepared_vars;
287 
288  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
289  for (const auto & var : vars)
290  {
291  mooseAssert(&var->sys() == this,
292  "I will cry if we store variables in our warehouse that don't belong to us");
293 
294  // If it wasn't in the active list, we need to prepare it. This has the potential to duplicate
295  // prepare if we have these conditions:
296  //
297  // 1. We have a displaced problem
298  // 2. We are using AD
299  // 3. We are not using global AD indexing
300  //
301  // But I think I would rather risk duplicate prepare than introduce an additional member set
302  // variable for tracking prepared variables. Set insertion is slow and some simulations have a
303  // ton of variables
304  if (!active_elemental_moose_variables.count(var))
305  {
306  var->prepare();
307  newly_prepared_vars.push_back(var);
308  }
309  }
310 
311  // Make sure to resize the residual and jacobian datastructures for all the new variables
312  if (resize_data)
313  for (const auto var_ptr : newly_prepared_vars)
314  {
315  _subproblem.assembly(tid, number()).prepareVariable(var_ptr);
318  }
319  }
320 }
virtual bool checkNonlocalCouplingRequirement() const =0
char ** vars
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:454
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
void prepareVariableNonlocal(MooseVariableFieldBase *var)
Definition: Assembly.C:2777
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num)=0
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:2749
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:460

◆ prepareLowerD()

void SystemBase::prepareLowerD ( THREAD_ID  tid)
virtualinherited

Prepare the system for use for lower dimensional elements.

Parameters
tidID of the thread

Definition at line 331 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

332 {
333  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
334  for (const auto & var : vars)
335  var->prepareLowerD();
336 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 323 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

324 {
325  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
326  for (const auto & var : vars)
327  var->prepareNeighbor();
328 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ preSMOResidual()

Real NonlinearSystemBase::preSMOResidual ( ) const

The pre-SMO residual.

Definition at line 751 of file NonlinearSystemBase.C.

Referenced by Residual::getValue(), and referenceResidual().

752 {
754  mooseError("pre-SMO residual is requested but not evaluated.");
755 
756  return _pre_smo_residual;
757 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Real _pre_smo_residual
The pre-SMO residual, see setPreSMOResidual for a detailed explanation.
bool shouldEvaluatePreSMOResidual() const
We offer the option to check convergence against the pre-SMO residual.

◆ preSolve()

bool NonlinearSystemBase::preSolve ( )
protected

Perform some steps to get ready for the solver.

These include

  • zeroing iteration counters
  • setting initial solutions
  • possibly performing automatic scaling
  • forming a scaling vector which, at least at some point, was required when AD objects were used with non-unity scaling factors for nonlinear variables
    Returns
    Whether any exceptions were raised while running this method

Definition at line 4094 of file NonlinearSystemBase.C.

Referenced by NonlinearSystem::solve(), and NonlinearEigenSystem::solve().

4095 {
4096  // Clear the iteration counters
4097  _current_l_its.clear();
4098  _current_nl_its = 0;
4099 
4100  // Initialize the solution vector using a predictor and known values from nodal bcs
4102 
4103  // Now that the initial solution has ben set, potentially perform a residual/Jacobian evaluation
4104  // to determine variable scaling factors
4105  if (_automatic_scaling)
4106  {
4107  const bool scaling_succeeded = computeScaling();
4108  if (!scaling_succeeded)
4109  return false;
4110  }
4111 
4112  // We do not know a priori what variable a global degree of freedom corresponds to, so we need a
4113  // map from global dof to scaling factor. We just use a ghosted NumericVector for that mapping
4115 
4116  return true;
4117 }
std::vector< unsigned int > _current_l_its
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1047
bool computeScaling()
Method used to obtain scaling factors for variables.
void assembleScalingVector()
Assemble the numeric vector of scaling factors such that it can be used during assembly of the system...

◆ printAllVariableNorms()

void NonlinearSystemBase::printAllVariableNorms ( bool  state)
inline

Force the printing of all variable norms after each solve.

Todo:
{Remove after output update

Definition at line 549 of file NonlinearSystemBase.h.

◆ queryTimeIntegrator()

const TimeIntegrator * SystemBase::queryTimeIntegrator ( const unsigned int  var_num) const
inherited

Retrieve the time integrator that integrates the given variable's equation.

If no suitable time integrator is found (this could happen for instance if we're solving a non-transient problem), then a nullptr will be returned

Definition at line 1640 of file SystemBase.C.

Referenced by SystemBase::getTimeIntegrator(), HDGKernel::HDGKernel(), and MooseVariableData< OutputType >::MooseVariableData().

1641 {
1642  for (auto & ti : _time_integrators)
1643  if (ti->integratesVar(var_num))
1644  return ti.get();
1645 
1646  return nullptr;
1647 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1041

◆ referenceResidual()

Real NonlinearSystemBase::referenceResidual ( ) const

The reference residual used in relative convergence check.

Definition at line 745 of file NonlinearSystemBase.C.

Referenced by DefaultNonlinearConvergence::checkConvergence(), and EigenExecutionerBase::inversePowerIteration().

746 {
748 }
Real preSMOResidual() const
The pre-SMO residual.
Real initialResidual() const
The initial residual.
const bool & usePreSMOResidual() const
Whether we are using pre-SMO residual in relative convergence checks.

◆ registerTimedSection() [1/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
) const
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 53 of file PerfGraphInterface.C.

55 {
56  const auto timed_section_name = timedSectionName(section_name);
57  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
58  return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
59  else
60  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
61 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ registerTimedSection() [2/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level,
const std::string &  live_message,
const bool  print_dots = true 
) const
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
live_messageThe message to be printed to the screen during execution
print_dotsWhether or not progress dots should be printed for this section
Returns
The ID of the section - use when starting timing

Definition at line 64 of file PerfGraphInterface.C.

68 {
69  const auto timed_section_name = timedSectionName(section_name);
70  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
72  timedSectionName(section_name), level, live_message, print_dots);
73  else
74  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
75 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ reinit()

virtual void SystemBase::reinit ( )
inlinevirtualinherited

Reinitialize the system when the degrees of freedom in this system have changed.

This is called after the libMesh system has been reinit'd

Reimplemented in NonlinearEigenSystem.

Definition at line 168 of file SystemBase.h.

Referenced by NonlinearEigenSystem::reinit().

168 {}

◆ reinitElem()

void SystemBase::reinitElem ( const Elem elem,
THREAD_ID  tid 
)
virtualinherited

Reinit an element assembly info.

Parameters
elemWhich element we are reinitializing for
tidID of the thread

Reimplemented in AuxiliarySystem.

Definition at line 339 of file SystemBase.C.

340 {
342  {
343  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
345  for (const auto & var : active_elemental_moose_variables)
346  if (&(var->sys()) == this)
347  var->computeElemValues();
348  }
349  else
350  {
351  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
352  for (const auto & var : vars)
353  var->computeElemValues();
354  }
355 }
char ** vars
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:454
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:460

◆ reinitElemFace()

void SystemBase::reinitElemFace ( const Elem elem,
unsigned int  side,
THREAD_ID  tid 
)
virtualinherited

Reinit assembly info for a side of an element.

Parameters
elemThe element
sideSide of of the element
tidThread ID

Reimplemented in AuxiliarySystem.

Definition at line 358 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

359 {
360  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
361  for (const auto & var : vars)
362  var->computeElemValuesFace();
363 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitIncrementAtNodeForDampers()

void NonlinearSystemBase::reinitIncrementAtNodeForDampers ( THREAD_ID  tid,
const std::set< MooseVariable *> &  damped_vars 
)

Compute the incremental change in variables at nodes for dampers.

Called before we use damping

Parameters
tidThread ID
damped_varsSet of variables for which increment is to be computed

Definition at line 3582 of file NonlinearSystemBase.C.

Referenced by ComputeNodalDampingThread::onNode().

3584 {
3585  for (const auto & var : damped_vars)
3586  var->computeIncrementAtNode(*_increment_vec);
3587 }
NumericVector< Number > * _increment_vec
increment vector

◆ reinitIncrementAtQpsForDampers()

void NonlinearSystemBase::reinitIncrementAtQpsForDampers ( THREAD_ID  tid,
const std::set< MooseVariable *> &  damped_vars 
)

Compute the incremental change in variables at QPs for dampers.

Called before we use damping

Parameters
tidThread ID
damped_varsSet of variables for which increment is to be computed

Definition at line 3574 of file NonlinearSystemBase.C.

Referenced by ComputeElemDampingThread::onElement().

3576 {
3577  for (const auto & var : damped_vars)
3578  var->computeIncrementAtQps(*_increment_vec);
3579 }
NumericVector< Number > * _increment_vec
increment vector

◆ reinitLowerD()

void SystemBase::reinitLowerD ( THREAD_ID  tid)
virtualinherited

Compute the values of the variables on the lower dimensional element.

Definition at line 382 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

383 {
384  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
385  for (const auto & var : vars)
386  var->computeLowerDValues();
387 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNeighbor()

void SystemBase::reinitNeighbor ( const Elem elem,
THREAD_ID  tid 
)
virtualinherited

Compute the values of the variables at all the current points.

Definition at line 374 of file SystemBase.C.

375 {
376  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
377  for (const auto & var : vars)
378  var->computeNeighborValues();
379 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNeighborFace()

void SystemBase::reinitNeighborFace ( const Elem elem,
unsigned int  side,
THREAD_ID  tid 
)
virtualinherited

Compute the values of the variables at all the current points.

Definition at line 366 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

367 {
368  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
369  for (const auto & var : vars)
370  var->computeNeighborValuesFace();
371 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNode()

void SystemBase::reinitNode ( const Node node,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 390 of file SystemBase.C.

391 {
392  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
393  for (const auto & var : vars)
394  {
395  var->reinitNode();
396  if (var->isNodalDefined())
397  var->computeNodalValues();
398  }
399 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNodeFace() [1/3]

void SystemBase::reinitNodeFace

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 402 of file SystemBase.C.

403 {
404  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
405  for (const auto & var : vars)
406  {
407  var->reinitNode();
408  if (var->isNodalDefined())
409  var->computeNodalValues();
410  }
411 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNodeFace() [2/3]

void SystemBase::reinitNodeFace ( const Node node,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 402 of file SystemBase.C.

403 {
404  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
405  for (const auto & var : vars)
406  {
407  var->reinitNode();
408  if (var->isNodalDefined())
409  var->computeNodalValues();
410  }
411 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNodeFace() [3/3]

void NonlinearSystemBase::reinitNodeFace ( const Node secondary_node,
const BoundaryID  secondary_boundary,
const PenetrationInfo info,
const bool  displaced 
)
protected

Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints.

Definition at line 1125 of file NonlinearSystemBase.C.

Referenced by constraintJacobians(), constraintResiduals(), and setConstraintSecondaryValues().

1129 {
1130  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1131  : static_cast<SubProblem &>(_fe_problem);
1132 
1133  const Elem * primary_elem = info._elem;
1134  unsigned int primary_side = info._side_num;
1135  std::vector<Point> points;
1136  points.push_back(info._closest_point);
1137 
1138  // *These next steps MUST be done in this order!*
1139  // ADL: This is a Chesterton's fence situation. I don't know which calls exactly the above comment
1140  // is referring to. If I had to guess I would guess just the reinitNodeFace and prepareAssembly
1141  // calls since the former will size the variable's dof indices and then the latter will resize the
1142  // residual/Jacobian based off the variable's cached dof indices size
1143 
1144  // This reinits the variables that exist on the secondary node
1145  _fe_problem.reinitNodeFace(&secondary_node, secondary_boundary, 0);
1146 
1147  // This will set aside residual and jacobian space for the variables that have dofs on
1148  // the secondary node
1150 
1151  _fe_problem.setNeighborSubdomainID(primary_elem, 0);
1152 
1153  //
1154  // Reinit material on undisplaced mesh
1155  //
1156 
1157  const Elem * const undisplaced_primary_elem =
1158  displaced ? _mesh.elemPtr(primary_elem->id()) : primary_elem;
1159  const Point undisplaced_primary_physical_point =
1160  [&points, displaced, primary_elem, undisplaced_primary_elem]()
1161  {
1162  if (displaced)
1163  {
1164  const Point reference_point =
1165  FEMap::inverse_map(primary_elem->dim(), primary_elem, points[0]);
1166  return FEMap::map(primary_elem->dim(), undisplaced_primary_elem, reference_point);
1167  }
1168  else
1169  // If our penetration locator is on the reference mesh, then our undisplaced
1170  // physical point is simply the point coming from the penetration locator
1171  return points[0];
1172  }();
1173 
1175  undisplaced_primary_elem, primary_side, {undisplaced_primary_physical_point}, 0);
1176  // Stateful material properties are only initialized for neighbor material data for internal faces
1177  // for discontinuous Galerkin methods or for conforming interfaces for interface kernels. We don't
1178  // have either of those use cases here where we likely have disconnected meshes
1179  _fe_problem.reinitMaterialsNeighbor(primary_elem->subdomain_id(), 0, /*swap_stateful=*/false);
1180 
1181  // Reinit points for constraint enforcement
1182  if (displaced)
1183  subproblem.reinitNeighborPhys(primary_elem, primary_side, points, 0);
1184 }
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid)=0
virtual Elem * elemPtr(const dof_id_type i)
Definition: MooseMesh.C:3108
MPI_Info info
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
dof_id_type id() const
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
SubProblem & subproblem()
Definition: SystemBase.h:101
virtual void prepareAssembly(const THREAD_ID tid) override
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:985
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override

◆ reinitNodes()

void SystemBase::reinitNodes ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 414 of file SystemBase.C.

415 {
416  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
417  for (const auto & var : vars)
418  {
419  var->reinitNodes(nodes);
420  var->computeNodalValues();
421  }
422 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitNodesNeighbor()

void SystemBase::reinitNodesNeighbor ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of neighbor nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 425 of file SystemBase.C.

426 {
427  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
428  for (const auto & var : vars)
429  {
430  var->reinitNodesNeighbor(nodes);
431  var->computeNodalNeighborValues();
432  }
433 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ reinitScalars()

void SystemBase::reinitScalars ( THREAD_ID  tid,
bool  reinit_for_derivative_reordering = false 
)
virtualinherited

Reinit scalar varaibles.

Parameters
tidThread ID
reinit_for_derivative_reorderingA flag indicating whether we are reinitializing for the purpose of re-ordering derivative information for ADNodalBCs

Definition at line 436 of file SystemBase.C.

437 {
438  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
439  for (const auto & var : vars)
440  var->reinit(reinit_for_derivative_reordering);
441 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ removeMatrix()

void SystemBase::removeMatrix ( TagID  tag)
inherited

Removes a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 582 of file SystemBase.C.

583 {
584  if (!_subproblem.matrixTagExists(tag_id))
585  mooseError("Cannot remove the matrix with TagID ",
586  tag_id,
587  "\nin system '",
588  name(),
589  "', because that tag does not exist in the problem");
590 
591  if (hasMatrix(tag_id))
592  {
593  const auto matrix_name = _subproblem.matrixTagName(tag_id);
594  system().remove_matrix(matrix_name);
595  _tagged_matrices[tag_id] = nullptr;
596  }
597 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1017
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:351
virtual const std::string & name() const
Definition: SystemBase.C:1330
void remove_matrix(std::string_view mat_name)
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:357

◆ removeVector() [1/2]

void SystemBase::removeVector ( const std::string &  name)
inherited

Remove a vector from the system with the given name.

Definition at line 1324 of file SystemBase.C.

Referenced by SystemBase::restoreOldSolutions().

1325 {
1327 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual const std::string & name() const
Definition: SystemBase.C:1330
void remove_vector(std::string_view vec_name)

◆ removeVector() [2/2]

void SystemBase::removeVector ( TagID  tag_id)
inherited

Remove a solution length vector from the system with the specified TagID.

Parameters
tag_idTag ID

Definition at line 692 of file SystemBase.C.

693 {
694  if (!_subproblem.vectorTagExists(tag_id))
695  mooseError("Cannot remove the vector with TagID ",
696  tag_id,
697  "\nin system '",
698  name(),
699  "', because that tag does not exist in the problem");
700 
701  if (hasVector(tag_id))
702  {
703  auto vector_name = _subproblem.vectorTagName(tag_id);
704  system().remove_vector(vector_name);
705  _tagged_vectors[tag_id] = nullptr;
706  }
707 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual const std::string & name() const
Definition: SystemBase.C:1330
void remove_vector(std::string_view vec_name)
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1015

◆ residualAndJacobianTogether()

virtual void NonlinearSystemBase::residualAndJacobianTogether ( )
pure virtual

Call this method if you want the residual and Jacobian to be computed simultaneously.

Implemented in NonlinearEigenSystem, NonlinearSystem, and DumpObjectsNonlinearSystem.

◆ residualCopy()

NumericVector< Number > & NonlinearSystemBase::residualCopy ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 3429 of file NonlinearSystemBase.C.

3430 {
3431  if (!_residual_copy.get())
3433 
3434  return *_residual_copy;
3435 }
const Parallel::Communicator & _communicator
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.

◆ residualGhosted()

NumericVector< Number > & NonlinearSystemBase::residualGhosted ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 3438 of file NonlinearSystemBase.C.

3439 {
3440  _need_residual_ghosted = true;
3441  if (!_residual_ghosted)
3442  {
3443  // The first time we realize we need a ghosted residual vector,
3444  // we add it.
3445  _residual_ghosted = &addVector("residual_ghosted", false, GHOSTED);
3446 
3447  // If we've already realized we need time and/or non-time
3448  // residual vectors, but we haven't yet realized they need to be
3449  // ghosted, fix that now.
3450  //
3451  // If an application changes its mind, the libMesh API lets us
3452  // change the vector.
3453  if (_Re_time)
3454  {
3455  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
3456  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
3457  }
3458  if (_Re_non_time)
3459  {
3460  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
3461  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
3462  }
3463  }
3464  return *_residual_ghosted;
3465 }
NumericVector< Number > * _Re_time
residual vector for time contributions
TagID _Re_time_tag
Tag for time contribution residual.
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
TagID _Re_non_time_tag
Tag for non-time contribution residual.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ residualSetup()

void NonlinearSystemBase::residualSetup ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 1694 of file NonlinearSystemBase.C.

Referenced by computeResidualAndJacobianInternal(), and computeResidualInternal().

1695 {
1696  TIME_SECTION("residualSetup", 3);
1697 
1699 
1700  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1701  {
1702  _kernels.residualSetup(tid);
1705  if (_doing_dg)
1711  }
1716 
1717  // Avoid recursion
1718  if (this == &_fe_problem.currentNonlinearSystem())
1721 }
virtual void residualSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
void residualSetup() override
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:167
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
void resetSolutionInvalidCurrentIteration()
Reset the number of solution invalid occurrences back to zero.
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
virtual void residualSetup()
Definition: SystemBase.C:1566
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ residualVector()

NumericVector< Number > & NonlinearSystemBase::residualVector ( TagID  tag)

Return a residual vector that is associated with the residual tag.

Definition at line 1055 of file NonlinearSystemBase.C.

1056 {
1057  mooseDeprecated("Please use getVector()");
1058  switch (tag)
1059  {
1060  case 0:
1061  return getResidualNonTimeVector();
1062 
1063  case 1:
1064  return getResidualTimeVector();
1065 
1066  default:
1067  mooseError("The required residual vector is not available");
1068  }
1069 }
NumericVector< Number > & getResidualTimeVector()
Return a numeric vector that is associated with the time tag.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
NumericVector< Number > & getResidualNonTimeVector()
Return a numeric vector that is associated with the nontime tag.

◆ residualVectorTag()

TagID NonlinearSystemBase::residualVectorTag ( ) const
inlineoverridevirtual

◆ restoreOldSolutions()

void SystemBase::restoreOldSolutions ( )
virtualinherited

Restore the old and older solutions when the saved solutions present.

Definition at line 534 of file SystemBase.C.

535 {
536  const auto states =
537  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
538  if (states > 1)
539  for (unsigned int i = 1; i <= states - 1; ++i)
540  if (_saved_solution_states[i])
541  {
543  removeVector("save_solution_state_" + std::to_string(i));
544  _saved_solution_states[i] = nullptr;
545  }
546 
548  {
550  removeVector("save_solution_dot_old");
551  _saved_dot_old = nullptr;
552  }
554  {
556  removeVector("save_solution_dotdot_old");
557  _saved_dotdot_old = nullptr;
558  }
559 }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:255
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:254
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:1026
void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1324
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:1027
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1077

◆ restoreSolutions()

void SolverSystem::restoreSolutions ( )
finaloverridevirtualinherited

Restore current solutions (call after your solve failed)

Reimplemented from SystemBase.

Definition at line 43 of file SolverSystem.C.

44 {
45  // call parent
47  // and update _current_solution
49 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:105
std::unique_ptr< NumericVector< Number > > current_local_solution
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
Definition: SystemBase.C:1307

◆ RHS()

virtual NumericVector<Number>& NonlinearSystemBase::RHS ( )
pure virtual

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 502 of file SystemBase.C.

503 {
504  const auto states =
505  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
506  if (states > 1)
507  {
508  _saved_solution_states.resize(states);
509  for (unsigned int i = 1; i <= states - 1; ++i)
510  if (!_saved_solution_states[i])
512  &addVector("save_solution_state_" + std::to_string(i), false, PARALLEL);
513 
514  for (unsigned int i = 1; i <= states - 1; ++i)
516  }
517 
519  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
521  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
522 
523  if (solutionUDotOld())
525 
526  if (solutionUDotDotOld())
528 }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:255
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:254
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:1026
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:1027
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1077

◆ scalingGroupVariables()

void NonlinearSystemBase::scalingGroupVariables ( const std::vector< std::vector< std::string >> &  scaling_group_variables)
inline

Definition at line 673 of file NonlinearSystemBase.h.

674  {
675  _scaling_group_variables = scaling_group_variables;
676  }
std::vector< std::vector< std::string > > _scaling_group_variables
A container of variable groupings that can be used in scaling calculations.

◆ serializedSolution()

NumericVector< Number > & SystemBase::serializedSolution ( )
virtualinherited

Returns a reference to a serialized version of the solution vector for this subproblem.

Reimplemented in DisplacedSystem.

Definition at line 1613 of file SystemBase.C.

Referenced by PNGOutput::calculateRescalingValues(), PNGOutput::makeMeshFunc(), and DisplacedSystem::serializedSolution().

1614 {
1615  if (!_serialized_solution.get())
1616  {
1618  _serialized_solution->init(system().n_dofs(), false, SERIAL);
1619  }
1620 
1621  return *_serialized_solution;
1622 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const Parallel::Communicator & _communicator
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
Definition: SystemBase.h:1060

◆ serializeSolution()

void SolverSystem::serializeSolution ( )
inherited

Definition at line 52 of file SolverSystem.C.

Referenced by SolverSystem::setSolution().

53 {
54  if (_serialized_solution.get())
55  {
56  if (!_serialized_solution->initialized() || _serialized_solution->size() != system().n_dofs())
57  {
58  _serialized_solution->clear();
59  _serialized_solution->init(system().n_dofs(), false, SERIAL);
60  }
61 
63  }
64 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
Definition: SystemBase.h:1060
dof_id_type n_dofs() const
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:105
virtual void localize(std::vector< T > &v_local) const=0

◆ setActiveScalarVariableCoupleableVectorTags()

void SystemBase::setActiveScalarVariableCoupleableVectorTags ( const std::set< TagID > &  vtags,
THREAD_ID  tid 
)
inherited

Set the active vector tags for the scalar variables.

Definition at line 1593 of file SystemBase.C.

Referenced by SubProblem::setActiveScalarVariableCoupleableVectorTags().

1595 {
1596  _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1597 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ setActiveVariableCoupleableVectorTags()

void SystemBase::setActiveVariableCoupleableVectorTags ( const std::set< TagID > &  vtags,
THREAD_ID  tid 
)
inherited

Set the active vector tags for the variables.

Definition at line 1587 of file SystemBase.C.

Referenced by SubProblem::setActiveFEVariableCoupleableVectorTags().

1588 {
1589  _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1590 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990

◆ setConstraintSecondaryValues()

void NonlinearSystemBase::setConstraintSecondaryValues ( NumericVector< Number > &  solution,
bool  displaced 
)

Sets the value of constrained variables in the solution vector.

Definition at line 1187 of file NonlinearSystemBase.C.

Referenced by setInitialSolution().

1188 {
1189 
1190  if (displaced)
1191  mooseAssert(_fe_problem.getDisplacedProblem(),
1192  "If we're calling this method with displaced = true, then we better well have a "
1193  "displaced problem");
1194  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1195  : static_cast<SubProblem &>(_fe_problem);
1196  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1197 
1198  bool constraints_applied = false;
1199 
1200  for (const auto & it : penetration_locators)
1201  {
1202  PenetrationLocator & pen_loc = *(it.second);
1203 
1204  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1205 
1206  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1207  BoundaryID primary_boundary = pen_loc._primary_boundary;
1208 
1209  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
1210  {
1211  const auto & constraints =
1212  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
1213  std::unordered_set<unsigned int> needed_mat_props;
1214  for (const auto & constraint : constraints)
1215  {
1216  const auto & mp_deps = constraint->getMatPropDependencies();
1217  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
1218  }
1219  _fe_problem.setActiveMaterialProperties(needed_mat_props, /*tid=*/0);
1220 
1221  for (unsigned int i = 0; i < secondary_nodes.size(); i++)
1222  {
1223  dof_id_type secondary_node_num = secondary_nodes[i];
1224  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1225 
1226  if (secondary_node.processor_id() == processor_id())
1227  {
1228  if (pen_loc._penetration_info[secondary_node_num])
1229  {
1230  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
1231 
1232  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
1233 
1234  for (const auto & nfc : constraints)
1235  {
1236  if (nfc->isExplicitConstraint())
1237  continue;
1238  // Return if this constraint does not correspond to the primary-secondary pair
1239  // prepared by the outer loops.
1240  // This continue statement is required when, e.g. one secondary surface constrains
1241  // more than one primary surface.
1242  if (nfc->secondaryBoundary() != secondary_boundary ||
1243  nfc->primaryBoundary() != primary_boundary)
1244  continue;
1245 
1246  if (nfc->shouldApply())
1247  {
1248  constraints_applied = true;
1249  nfc->computeSecondaryValue(solution);
1250  }
1251 
1252  if (nfc->hasWritableCoupledVariables())
1253  {
1254  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1255  for (auto * var : nfc->getWritableCoupledVariables())
1256  {
1257  if (var->isNodalDefined())
1258  var->insert(_fe_problem.getAuxiliarySystem().solution());
1259  }
1260  }
1261  }
1262  }
1263  }
1264  }
1265  }
1266  }
1267 
1268  // go over NodeELemConstraints
1269  std::set<dof_id_type> unique_secondary_node_ids;
1270 
1271  for (const auto & secondary_id : _mesh.meshSubdomains())
1272  {
1273  for (const auto & primary_id : _mesh.meshSubdomains())
1274  {
1275  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
1276  {
1277  const auto & constraints =
1278  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
1279 
1280  // get unique set of ids of all nodes on current block
1281  unique_secondary_node_ids.clear();
1282  const MeshBase & meshhelper = _mesh.getMesh();
1283  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
1284  meshhelper.active_subdomain_elements_end(secondary_id)))
1285  {
1286  for (auto & n : elem->node_ref_range())
1287  unique_secondary_node_ids.insert(n.id());
1288  }
1289 
1290  for (auto secondary_node_id : unique_secondary_node_ids)
1291  {
1292  Node & secondary_node = _mesh.nodeRef(secondary_node_id);
1293 
1294  // check if secondary node is on current processor
1295  if (secondary_node.processor_id() == processor_id())
1296  {
1297  // This reinits the variables that exist on the secondary node
1298  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
1299 
1300  // This will set aside residual and jacobian space for the variables that have dofs
1301  // on the secondary node
1303 
1304  for (const auto & nec : constraints)
1305  {
1306  if (nec->shouldApply())
1307  {
1308  constraints_applied = true;
1309  nec->computeSecondaryValue(solution);
1310  }
1311  }
1312  }
1313  }
1314  }
1315  }
1316  }
1317 
1318  // See if constraints were applied anywhere
1319  _communicator.max(constraints_applied);
1320 
1321  if (constraints_applied)
1322  {
1323  solution.close();
1324  update();
1325  }
1326 }
void setActiveMaterialProperties(const std::unordered_set< unsigned int > &mat_prop_ids, const THREAD_ID tid)
Record and set the material properties required by the current computing thread.
std::map< std::pair< BoundaryID, BoundaryID >, PenetrationLocator * > _penetration_locators
BoundaryID _secondary_boundary
MPI_Info info
NumericVector< Number > & solution()
Definition: SystemBase.h:195
Data structure used to hold penetration information.
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
const Parallel::Communicator & _communicator
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
bool hasActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
const std::vector< std::shared_ptr< NodeElemConstraintBase > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:831
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1245
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3443
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:101
virtual GeometricSearchData & geomSearchData()=0
AuxiliarySystem & getAuxiliarySystem()
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:985
void max(const T &r, T &o, Request &req) const
void reinitNodeFace(const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints...
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
BoundaryID _primary_boundary
uint8_t dof_id_type
NearestNodeLocator & _nearest_node
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3166

◆ setDecomposition()

void NonlinearSystemBase::setDecomposition ( const std::vector< std::string > &  decomposition)

If called with a single string, it is used as the name of a the top-level decomposition split.

If the array is empty, no decomposition is used. In all other cases an error occurs.

Although a single top-level split is allowed in Problem, treat it as a list of splits for conformity with the Split input syntax.

Definition at line 421 of file NonlinearSystemBase.C.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner().

422 {
424  if (splits.size() && splits.size() != 1)
425  mooseError("Only a single top-level split is allowed in a Problem's decomposition.");
426 
427  if (splits.size())
428  {
429  _decomposition_split = splits[0];
430  _have_decomposition = true;
431  }
432  else
433  _have_decomposition = false;
434 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _have_decomposition
Whether or not the system can be decomposed into splits.
std::string _decomposition_split
Name of the top-level split of the decomposition.

◆ setInitialResidual()

void NonlinearSystemBase::setInitialResidual ( Real  r)

Record the initial residual (for later relative convergence check)

Definition at line 766 of file NonlinearSystemBase.C.

Referenced by DefaultNonlinearConvergence::checkConvergence().

767 {
768  _initial_residual = r;
769 }
Real _initial_residual
The initial (i.e., 0th nonlinear iteration) residual, see setPreSMOResidual for a detailed explanatio...

◆ setInitialSolution()

void NonlinearSystemBase::setInitialSolution ( )

Definition at line 932 of file NonlinearSystemBase.C.

Referenced by preSolve().

933 {
935 
936  NumericVector<Number> & initial_solution(solution());
937  if (_predictor.get())
938  {
939  if (_predictor->shouldApply())
940  {
941  TIME_SECTION("applyPredictor", 2, "Applying Predictor");
942 
943  _predictor->apply(initial_solution);
944  _fe_problem.predictorCleanup(initial_solution);
945  }
946  else
947  _console << " Skipping predictor this step" << std::endl;
948  }
949 
950  // do nodal BC
951  {
952  TIME_SECTION("initialBCs", 2, "Applying BCs To Initial Condition");
953 
955  for (const auto & bnode : bnd_nodes)
956  {
957  BoundaryID boundary_id = bnode->_bnd_id;
958  Node * node = bnode->_node;
959 
960  if (node->processor_id() == processor_id())
961  {
962  // reinit variables in nodes
963  _fe_problem.reinitNodeFace(node, boundary_id, 0);
964 
966  {
967  const auto & preset_bcs = _preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
968  for (const auto & preset_bc : preset_bcs)
969  preset_bc->computeValue(initial_solution);
970  }
972  {
973  const auto & preset_bcs_res = _ad_preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
974  for (const auto & preset_bc : preset_bcs_res)
975  preset_bc->computeValue(initial_solution);
976  }
977  }
978  }
979  }
980 
981  _sys.solution->close();
982  update();
983 
984  // Set constraint secondary values
985  setConstraintSecondaryValues(initial_solution, false);
986 
988  setConstraintSecondaryValues(initial_solution, true);
989 }
virtual void predictorCleanup(NumericVector< libMesh::Number > &ghosted_solution)
Perform cleanup tasks after application of predictor to solution vector.
NumericVector< Number > & solution()
Definition: SystemBase.h:195
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1245
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
virtual void deactiveAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1126
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
boundary_id_type BoundaryID
std::unique_ptr< NumericVector< Number > > solution
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
libMesh::System & _sys
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
processor_id_type processor_id() const
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
void setConstraintSecondaryValues(NumericVector< Number > &solution, bool displaced)
Sets the value of constrained variables in the solution vector.
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ setMooseKSPNormType()

void SolverSystem::setMooseKSPNormType ( MooseEnum  kspnorm)
inherited

Set the norm in which the linear convergence will be measured.

Parameters
kspnormThe required norm

Definition at line 94 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

95 {
96  if (kspnorm == "none")
98  else if (kspnorm == "preconditioned")
100  else if (kspnorm == "unpreconditioned")
102  else if (kspnorm == "natural")
104  else if (kspnorm == "default")
106  else
107  mooseError("Unknown ksp norm type specified.");
108 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Use whatever we have in PETSc.
Definition: MooseTypes.h:836
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Definition: SolverSystem.h:110

◆ setPCSide()

void SolverSystem::setPCSide ( MooseEnum  pcs)
inherited

Set the side on which the preconditioner is applied to.

Parameters
pcsThe required preconditioning side

Definition at line 79 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

80 {
81  if (pcs == "left")
83  else if (pcs == "right")
85  else if (pcs == "symmetric")
87  else if (pcs == "default")
89  else
90  mooseError("Unknown PC side specified.");
91 }
Moose::PCSideType _pc_side
Preconditioning side.
Definition: SolverSystem.h:108
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Use whatever we have in PETSc.
Definition: MooseTypes.h:824

◆ setPreconditioner()

void NonlinearSystemBase::setPreconditioner ( std::shared_ptr< MoosePreconditioner pc)

Sets a preconditioner.

Parameters
pcThe preconditioner to be set

Definition at line 3553 of file NonlinearSystemBase.C.

Referenced by SetupPreconditionerAction::act().

3554 {
3555  if (_preconditioner.get() != nullptr)
3556  mooseError("More than one active Preconditioner detected");
3557 
3558  _preconditioner = pc;
3559 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ setPredictor()

void NonlinearSystemBase::setPredictor ( std::shared_ptr< Predictor predictor)

Definition at line 992 of file NonlinearSystemBase.C.

Referenced by SetupPredictorAction::act().

993 {
994  _predictor = predictor;
995 }
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ setPreSMOResidual()

void NonlinearSystemBase::setPreSMOResidual ( bool  use)
inline

Set whether to evaluate the pre-SMO residual and use it in the subsequent relative convergence checks.

If set to true, an additional residual evaluation is performed before any solution-modifying object is executed, and before the initial (0-th nonlinear iteration) residual evaluation. Such residual is referred to as the pre-SMO residual. If the pre-SMO residual is evaluated, it is used in the subsequent relative convergence checks.

If set to false, no residual evaluation takes place before the initial residual evaluation, and the initial residual is used in the subsequent relative convergence checks. This mode is recommended for performance-critical code as it avoids the additional pre-SMO residual evaluation.

Definition at line 251 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

251 { _use_pre_smo_residual = use; }
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.

◆ setPreviousNewtonSolution()

void NonlinearSystemBase::setPreviousNewtonSolution ( const NumericVector< Number > &  soln)
virtual

Definition at line 3784 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computePostCheck().

3785 {
3788 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:28
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ setSolution()

void SolverSystem::setSolution ( const NumericVector< Number > &  soln)
inherited

Set the solution to a given vector.

Parameters
solnThe vector which should be treated as the solution.

Definition at line 67 of file SolverSystem.C.

Referenced by FEProblemBase::computeDamping(), FEProblemBase::computeJacobianInternal(), FEProblemBase::computeJacobianTag(), FEProblemBase::computeLinearSystemTags(), FEProblemBase::computeResidualAndJacobian(), FEProblemBase::computeResidualInternal(), FEProblemBase::computeResidualTag(), FEProblemBase::computeResidualType(), ActuallyExplicitEuler::solve(), and ExplicitSSPRungeKutta::solveStage().

68 {
69  _current_solution = &soln;
70 
72  associateVectorToTag(const_cast<NumericVector<Number> &>(soln), tag);
73 
74  if (_serialized_solution.get())
76 }
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:203
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:964
void serializeSolution()
Definition: SolverSystem.C:52
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
Definition: SystemBase.h:1060
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:105
const TagName SOLUTION_TAG
Definition: MooseTypes.C:25

◆ setSolutionUDot()

void NonlinearSystemBase::setSolutionUDot ( const NumericVector< Number > &  udot)
virtual

Set transient term used by residual and Jacobian evaluation.

Parameters
udottransient term
Note
If the calling sequence for residual evaluation was changed, this could become an explicit argument.

Definition at line 3529 of file NonlinearSystemBase.C.

3530 {
3531  *_u_dot = u_dot;
3532 }
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1000

◆ setSolutionUDotDot()

void NonlinearSystemBase::setSolutionUDotDot ( const NumericVector< Number > &  udotdot)
virtual

Set transient term used by residual and Jacobian evaluation.

Parameters
udotdottransient term
Note
If the calling sequence for residual evaluation was changed, this could become an explicit argument.

Definition at line 3535 of file NonlinearSystemBase.C.

3536 {
3537  *_u_dotdot = u_dotdot;
3538 }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1002

◆ setSolutionUDotDotOld()

void NonlinearSystemBase::setSolutionUDotDotOld ( const NumericVector< Number > &  u_dotdot_old)
virtual

Definition at line 3547 of file NonlinearSystemBase.C.

3548 {
3549  *_u_dotdot_old = u_dotdot_old;
3550 }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1007

◆ setSolutionUDotOld()

void NonlinearSystemBase::setSolutionUDotOld ( const NumericVector< Number > &  u_dot_old)
virtual

Definition at line 3541 of file NonlinearSystemBase.C.

3542 {
3543  *_u_dot_old = u_dot_old;
3544 }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1005

◆ setupDampers()

void NonlinearSystemBase::setupDampers ( )

Setup damping stuff (called before we actually start)

Definition at line 3568 of file NonlinearSystemBase.C.

Referenced by preInit().

3569 {
3570  _increment_vec = &_sys.add_vector("u_increment", true, GHOSTED);
3571 }
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
libMesh::System & _sys
NumericVector< Number > * _increment_vec
increment vector

◆ setupDM()

void NonlinearSystemBase::setupDM ( )

Setup the PETSc DM object (when appropriate)

Definition at line 414 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::solve().

415 {
418 }
void petscSetupDM(NonlinearSystemBase &nl, const std::string &dm_name)
Setup the PETSc DM object.
Definition: PetscSupport.C:190
bool haveFieldSplitPreconditioner() const
std::string _decomposition_split
Name of the top-level split of the decomposition.

◆ setupFieldDecomposition()

void NonlinearSystemBase::setupFieldDecomposition ( )

Definition at line 437 of file NonlinearSystemBase.C.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner().

438 {
439  if (!_have_decomposition)
440  return;
441 
442  std::shared_ptr<Split> top_split = getSplit(_decomposition_split);
443  top_split->setup(*this);
444 }
bool _have_decomposition
Whether or not the system can be decomposed into splits.
std::shared_ptr< Split > getSplit(const std::string &name)
Retrieves a split by name.
std::string _decomposition_split
Name of the top-level split of the decomposition.

◆ setupFiniteDifferencedPreconditioner()

virtual void NonlinearSystemBase::setupFiniteDifferencedPreconditioner ( )
pure virtual

◆ setupScalingData()

void NonlinearSystemBase::setupScalingData ( )
private

Setup group scaling containers.

Definition at line 3815 of file NonlinearSystemBase.C.

Referenced by computeScaling().

3816 {
3817  if (_auto_scaling_initd)
3818  return;
3819 
3820  // Want the libMesh count of variables, not MOOSE, e.g. I don't care about array variable counts
3821  const auto n_vars = system().n_vars();
3822 
3823  if (_scaling_group_variables.empty())
3824  {
3825  _var_to_group_var.reserve(n_vars);
3827 
3828  for (const auto var_number : make_range(n_vars))
3829  _var_to_group_var.emplace(var_number, var_number);
3830  }
3831  else
3832  {
3833  std::set<unsigned int> var_numbers, var_numbers_covered, var_numbers_not_covered;
3834  for (const auto var_number : make_range(n_vars))
3835  var_numbers.insert(var_number);
3836 
3838 
3839  for (const auto group_index : index_range(_scaling_group_variables))
3840  for (const auto & var_name : _scaling_group_variables[group_index])
3841  {
3842  if (!hasVariable(var_name) && !hasScalarVariable(var_name))
3843  mooseError("'",
3844  var_name,
3845  "', provided to the 'scaling_group_variables' parameter, does not exist in "
3846  "the nonlinear system.");
3847 
3848  const MooseVariableBase & var =
3849  hasVariable(var_name)
3850  ? static_cast<MooseVariableBase &>(getVariable(0, var_name))
3851  : static_cast<MooseVariableBase &>(getScalarVariable(0, var_name));
3852  auto map_pair = _var_to_group_var.emplace(var.number(), group_index);
3853  if (!map_pair.second)
3854  mooseError("Variable ", var_name, " is contained in multiple scaling grouplings");
3855  var_numbers_covered.insert(var.number());
3856  }
3857 
3858  std::set_difference(var_numbers.begin(),
3859  var_numbers.end(),
3860  var_numbers_covered.begin(),
3861  var_numbers_covered.end(),
3862  std::inserter(var_numbers_not_covered, var_numbers_not_covered.begin()));
3863 
3864  _num_scaling_groups = _scaling_group_variables.size() + var_numbers_not_covered.size();
3865 
3866  auto index = static_cast<unsigned int>(_scaling_group_variables.size());
3867  for (auto var_number : var_numbers_not_covered)
3868  _var_to_group_var.emplace(var_number, index++);
3869  }
3870 
3871  _variable_autoscaled.resize(n_vars, true);
3872  const auto & number_to_var_map = _vars[0].numberToVariableMap();
3873 
3875  for (const auto i : index_range(_variable_autoscaled))
3876  if (std::find(_ignore_variables_for_autoscaling.begin(),
3878  libmesh_map_find(number_to_var_map, i)->name()) !=
3880  _variable_autoscaled[i] = false;
3881 
3882  _auto_scaling_initd = true;
3883 }
std::vector< bool > _variable_autoscaled
Container to hold flag if variable is to participate in autoscaling.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
unsigned int number() const
Get variable number coming from libMesh.
std::vector< std::string > _ignore_variables_for_autoscaling
A container for variables that do not partipate in autoscaling.
std::size_t _num_scaling_groups
The number of scaling groups.
bool _auto_scaling_initd
Whether we&#39;ve initialized the automatic scaling data structures.
std::unordered_map< unsigned int, unsigned int > _var_to_group_var
A map from variable index to group variable index and it&#39;s associated (inverse) scaling factor...
unsigned int n_vars
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:834
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a scalar variable with specified number.
Definition: SystemBase.C:144
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
IntRange< T > make_range(T beg, T end)
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:89
unsigned int n_vars() const
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:859
std::vector< std::vector< std::string > > _scaling_group_variables
A container of variable groupings that can be used in scaling calculations.
auto index_range(const T &sizable)
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ setVariableGlobalDoFs()

void SystemBase::setVariableGlobalDoFs ( const std::string &  var_name)
inherited

set all the global dof indices for a variable

Parameters
var_nameThe name of the variable

Definition at line 185 of file SystemBase.C.

186 {
187  AllLocalDofIndicesThread aldit(_subproblem, {var_name});
189  Threads::parallel_reduce(elem_range, aldit);
190 
191  // Gather the dof indices across procs to get all the dof indices for var_name
192  aldit.dofIndicesSetUnion();
193 
194  const auto & all_dof_indices = aldit.getDofIndices();
195  _var_all_dof_indices.assign(all_dof_indices.begin(), all_dof_indices.end());
196 }
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1235
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
Definition: SystemBase.h:1056
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in...
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
MooseMesh & _mesh
Definition: SystemBase.h:985

◆ setVerboseFlag()

void SystemBase::setVerboseFlag ( const bool &  verbose)
inlineinherited

Sets the verbose flag.

Parameters
[in]verboseVerbose flag

Definition at line 134 of file SystemBase.h.

Referenced by Executioner::Executioner().

134 { _verbose = verbose; }
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:1050

◆ shouldEvaluatePreSMOResidual()

bool NonlinearSystemBase::shouldEvaluatePreSMOResidual ( ) const

We offer the option to check convergence against the pre-SMO residual.

This method handles the logic as to whether we should perform such residual evaluation.

Returns
A boolean indicating whether we should evaluate the pre-SMO residual.

Definition at line 727 of file NonlinearSystemBase.C.

Referenced by preSMOResidual(), and NonlinearSystem::solve().

728 {
730  return false;
731 
732  // The legacy behavior (#10464) _always_ performs the pre-SMO residual evaluation
733  // regardless of whether it is needed.
734  //
735  // This is not ideal and has been fixed by #23472. This legacy option ensures a smooth transition
736  // to the new behavior. Modules and Apps that want to migrate to the new behavior should set this
737  // parameter to false.
738  if (_app.parameters().get<bool>("use_legacy_initial_residual_evaluation_behavior"))
739  return true;
740 
741  return _use_pre_smo_residual;
742 }
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
Solving a linear problem.
Definition: MooseTypes.h:848
const InputParameters & parameters()
Get the parameters of the object.
Definition: MooseApp.h:150
Moose::SolveType _type
Definition: SolverParams.h:19
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
MooseApp & _app
Definition: SystemBase.h:982
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.

◆ solution() [1/2]

NumericVector<Number>& SystemBase::solution ( )
inlineinherited

Definition at line 195 of file SystemBase.h.

Referenced by Adaptivity::adaptMesh(), TransientMultiApp::appTransferVector(), MooseEigenSystem::combineSystemSolution(), computeDamping(), AuxiliarySystem::computeElementalVarsHelper(), computeJacobianInternal(), AuxiliarySystem::computeMortarNodalVars(), computeNodalBCs(), AuxiliarySystem::computeNodalVarsHelper(), computeResidualTags(), AuxiliarySystem::computeScalarVars(), constraintResiduals(), SystemBase::copyVars(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), NodalNormalsCorner::execute(), NodalNormalsEvaluator::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), NodalNormalsPreprocessor::execute(), NodalNormalsCorner::finalize(), NodalNormalsEvaluator::finalize(), NodalNormalsPreprocessor::finalize(), NodalNormalsEvaluator::initialize(), NodalNormalsCorner::initialize(), NodalNormalsPreprocessor::initialize(), MooseEigenSystem::initSystemSolution(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeNodalUserObjectsThread::onNode(), FEProblemBase::projectInitialConditionOnCustomRange(), FEProblemBase::projectSolution(), Transient::relativeSolutionDifferenceNorm(), MultiApp::restore(), SystemBase::restoreSolutions(), SecantSolve::saveVariableValues(), SteffensenSolve::saveVariableValues(), PicardSolve::saveVariableValues(), MooseEigenSystem::scaleSystemSolution(), AuxiliarySystem::serializeSolution(), setConstraintSecondaryValues(), setInitialSolution(), DisplacedSystem::solutionInternal(), NonlinearEigenSystem::solve(), MultiAppDofCopyTransfer::transfer(), SecantSolve::transformVariables(), SteffensenSolve::transformVariables(), PicardSolve::transformVariables(), AuxiliarySystem::variableWiseRelativeSolutionDifferenceNorm(), and SystemBase::zeroVariables().

195 { return solutionState(0); }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419

◆ solution() [2/2]

const NumericVector<Number>& SystemBase::solution ( ) const
inlineinherited

Definition at line 198 of file SystemBase.h.

198 { return solutionState(0); }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419

◆ solutionInternal()

NumericVector< Number > & SolverSystem::solutionInternal ( ) const
inlinefinaloverrideprotectedvirtualinherited

Internal getter for solution owned by libMesh.

Implements SystemBase.

Definition at line 123 of file SolverSystem.h.

124 {
125  return *system().solution;
126 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::unique_ptr< NumericVector< Number > > solution

◆ solutionOld() [1/2]

NumericVector<Number>& SystemBase::solutionOld ( )
inlineinherited

◆ solutionOld() [2/2]

const NumericVector<Number>& SystemBase::solutionOld ( ) const
inlineinherited

Definition at line 199 of file SystemBase.h.

199 { return solutionState(1); }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419

◆ solutionOlder() [1/2]

NumericVector<Number>& SystemBase::solutionOlder ( )
inlineinherited

Definition at line 197 of file SystemBase.h.

Referenced by MooseEigenSystem::combineSystemSolution(), CentralDifference::computeTimeDerivatives(), ActivateElementsUserObjectBase::initSolutions(), MooseVariableScalar::reinit(), and ElementSubdomainModifierBase::setOldAndOlderSolutions().

197 { return solutionState(2); }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419

◆ solutionOlder() [2/2]

const NumericVector<Number>& SystemBase::solutionOlder ( ) const
inlineinherited

Definition at line 200 of file SystemBase.h.

200 { return solutionState(2); }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1419

◆ solutionPreviousNewton() [1/2]

const NumericVector< Number > * SystemBase::solutionPreviousNewton ( ) const
virtualinherited

Reimplemented in DisplacedSystem.

Definition at line 1345 of file SystemBase.C.

Referenced by AuxiliarySystem::copyCurrentIntoPreviousNL(), SystemBase::copyPreviousNonlinearSolutions(), and SystemBase::restoreSolutions().

1346 {
1349  else
1350  return nullptr;
1351 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:28
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ solutionPreviousNewton() [2/2]

NumericVector< Number > * SystemBase::solutionPreviousNewton ( )
virtualinherited

Reimplemented in DisplacedSystem.

Definition at line 1336 of file SystemBase.C.

1337 {
1340  else
1341  return nullptr;
1342 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:28
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ solutionState() [1/2]

NumericVector< Number > & SystemBase::solutionState ( const unsigned int  state,
Moose::SolutionIterationType  iteration_type = Moose::SolutionIterationType::Time 
)
virtualinherited

Get a state of the solution (0 = current, 1 = old, 2 = older, etc).

If the state does not exist, it will be initialized in addition to any newer states before it that have not been initialized.

Reimplemented in DisplacedSystem.

Definition at line 1419 of file SystemBase.C.

Referenced by SystemBase::copyOldSolutions(), SystemBase::copyPreviousNonlinearSolutions(), PointwiseRenormalizeVector::execute(), PointwiseRenormalizeVector::finalize(), SystemBase::restoreOldSolutions(), SystemBase::saveOldSolutions(), SystemBase::solution(), SystemBase::solutionOld(), SystemBase::solutionOlder(), and DisplacedSystem::solutionState().

1421 {
1422  if (!hasSolutionState(state, iteration_type))
1423  needSolutionState(state, iteration_type);
1424  return *_solution_states[static_cast<unsigned short>(iteration_type)][state];
1425 }
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Registers that the solution state state is needed.
Definition: SystemBase.C:1428
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.h:1081
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075

◆ solutionState() [2/2]

const NumericVector< Number > & SystemBase::solutionState ( const unsigned int  state,
Moose::SolutionIterationType  iteration_type = Moose::SolutionIterationType::Time 
) const
virtualinherited

Get a state of the solution (0 = current, 1 = old, 2 = older, etc).

Reimplemented in DisplacedSystem.

Definition at line 1390 of file SystemBase.C.

1392 {
1393  if (!hasSolutionState(state, iteration_type))
1394  mooseError("For iteration type '",
1395  Moose::stringify(iteration_type),
1396  "': solution state ",
1397  state,
1398  " was requested in ",
1399  name(),
1400  " but only up to state ",
1401  (_solution_states[static_cast<unsigned short>(iteration_type)].size() == 0)
1402  ? 0
1403  : _solution_states[static_cast<unsigned short>(iteration_type)].size() - 1,
1404  " is available.");
1405 
1406  const auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1407 
1408  if (state == 0)
1409  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1410  else
1411  mooseAssert(solution_states[state] ==
1412  &getVector(oldSolutionStateVectorName(state, iteration_type)),
1413  "Inconsistent solution state");
1414 
1415  return *solution_states[state];
1416 }
virtual NumericVector< Number > & solutionInternal() const =0
Internal getter for solution owned by libMesh.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual const std::string & name() const
Definition: SystemBase.C:1330
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.h:1081
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
TagName oldSolutionStateVectorName(const unsigned int, Moose::SolutionIterationType iteration_type) const
Gets the vector name used for an old (not current) solution state.
Definition: SystemBase.C:1371
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1075
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ solutionStatesInitialized()

bool SystemBase::solutionStatesInitialized ( ) const
inlineinherited

Whether or not the solution states have been initialized via initSolutionState()

After the solution states have been initialized, additional solution states cannot be added.

Definition at line 897 of file SystemBase.h.

Referenced by ScalarKernelBase::uOld(), and AuxScalarKernel::uOld().

bool _solution_states_initialized
Whether or not the solution states have been initialized.
Definition: SystemBase.h:1053

◆ solutionUDot() [1/2]

virtual NumericVector<Number>* SystemBase::solutionUDot ( )
inlinevirtualinherited

◆ solutionUDot() [2/2]

virtual const NumericVector<Number>* SystemBase::solutionUDot ( ) const
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 256 of file SystemBase.h.

256 { return _u_dot; }
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1000

◆ solutionUDotDot() [1/2]

virtual NumericVector<Number>* SystemBase::solutionUDotDot ( )
inlinevirtualinherited

◆ solutionUDotDot() [2/2]

virtual const NumericVector<Number>* SystemBase::solutionUDotDot ( ) const
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 257 of file SystemBase.h.

257 { return _u_dotdot; }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1002

◆ solutionUDotDotOld() [1/2]

virtual NumericVector<Number>* SystemBase::solutionUDotDotOld ( )
inlinevirtualinherited

◆ solutionUDotDotOld() [2/2]

virtual const NumericVector<Number>* SystemBase::solutionUDotDotOld ( ) const
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 259 of file SystemBase.h.

259 { return _u_dotdot_old; }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1007

◆ solutionUDotOld() [1/2]

virtual NumericVector<Number>* SystemBase::solutionUDotOld ( )
inlinevirtualinherited

◆ solutionUDotOld() [2/2]

virtual const NumericVector<Number>* SystemBase::solutionUDotOld ( ) const
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 258 of file SystemBase.h.

258 { return _u_dot_old; }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1005

◆ solve()

virtual void NonlinearSystemBase::solve ( )
overridepure virtual

◆ stopSolve()

virtual void SolverSystem::stopSolve ( const ExecFlagType exec_flag,
const std::set< TagID > &  vector_tags_to_close 
)
pure virtualinherited

◆ subdomainSetup() [1/3]

void SystemBase::subdomainSetup

Definition at line 1559 of file SystemBase.C.

1560 {
1561  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1562  _vars[tid].subdomainSetup();
1563 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual void subdomainSetup()
Definition: SystemBase.C:1559
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ subdomainSetup() [2/3]

void NonlinearSystemBase::subdomainSetup ( SubdomainID  subdomain,
THREAD_ID  tid 
)
virtual

Called from assembling when we hit a new subdomain.

Parameters
subdomainID of the new subdomain
tidThread ID

Definition at line 998 of file NonlinearSystemBase.C.

999 {
1001 
1002  _kernels.subdomainSetup(subdomain, tid);
1003  _nodal_kernels.subdomainSetup(subdomain, tid);
1004  _element_dampers.subdomainSetup(subdomain, tid);
1005  _nodal_dampers.subdomainSetup(subdomain, tid);
1006 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
MooseObjectTagWarehouse< KernelBase > _kernels
virtual void subdomainSetup()
Definition: SystemBase.C:1559
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
virtual void subdomainSetup(THREAD_ID tid=0) const

◆ subdomainSetup() [3/3]

void SystemBase::subdomainSetup ( )
virtualinherited

Reimplemented in AuxiliarySystem.

Definition at line 1559 of file SystemBase.C.

Referenced by AuxiliarySystem::subdomainSetup(), and subdomainSetup().

1560 {
1561  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1562  _vars[tid].subdomainSetup();
1563 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:990
virtual void subdomainSetup()
Definition: SystemBase.C:1559
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ subproblem() [1/2]

SubProblem& SystemBase::subproblem ( )
inlineinherited

◆ subproblem() [2/2]

const SubProblem& SystemBase::subproblem ( ) const
inlineinherited

Definition at line 102 of file SystemBase.h.

102 { return _subproblem; }
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977

◆ system() [1/2]

virtual libMesh::System& NonlinearSystemBase::system ( )
inlineoverridevirtual

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 638 of file NonlinearSystemBase.h.

Referenced by Adaptivity::adaptMesh(), PhysicsBasedPreconditioner::addSystem(), PhysicsBasedPreconditioner::apply(), computeScaling(), PseudoTimestep::currentResidualNorm(), DMCreateGlobalVector_Moose(), DMCreateMatrix_Moose(), DMMooseFunction(), DMMooseGetEmbedding_Private(), DMMooseGetMeshBlocks_Private(), DMMooseJacobian(), DMSetUp_Moose_Pre(), VariableResidual::execute(), getResidualNonTimeVector(), getResidualTimeVector(), NonlinearSystem::getSNES(), ExplicitTimeIntegrator::initialSetup(), ReferenceResidualConvergence::initialSetup(), MooseStaticCondensationPreconditioner::MooseStaticCondensationPreconditioner(), Moose::PetscSupport::petscSetDefaults(), Moose::PetscSupport::petscSetupDM(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), residualGhosted(), Moose::PetscSupport::setLineSearchFromParams(), PhysicsBasedPreconditioner::setup(), setupScalingData(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), NonlinearSystem::solve(), NonlinearEigenSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), turnOffJacobian(), ReferenceResidualConvergence::updateReferenceResidual(), VariableCondensationPreconditioner::VariableCondensationPreconditioner(), and Console::writeVariableNorms().

638 { return _sys; }
libMesh::System & _sys

◆ system() [2/2]

virtual const libMesh::System& NonlinearSystemBase::system ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 639 of file NonlinearSystemBase.h.

639 { return _sys; }
libMesh::System & _sys

◆ systemMatrixTag()

TagID NonlinearSystemBase::systemMatrixTag ( ) const
inlineoverridevirtual

◆ timedSectionName()

std::string PerfGraphInterface::timedSectionName ( const std::string &  section_name) const
protectedinherited
Returns
The name of the timed section with the name section_name.

Optionally adds a prefix if one is defined.

Definition at line 47 of file PerfGraphInterface.C.

Referenced by PerfGraphInterface::registerTimedSection().

48 {
49  return _prefix.empty() ? "" : (_prefix + "::") + section_name;
50 }
const std::string _prefix
A prefix to use for all sections.

◆ timeKernelVariableNames()

std::vector< std::string > NonlinearSystemBase::timeKernelVariableNames ( )
overridevirtual

Returns the names of the variables that have time derivative kernels in the system.

Implements SolverSystem.

Definition at line 3747 of file NonlinearSystemBase.C.

3748 {
3749  std::vector<std::string> variable_names;
3750  const auto & time_kernels = _kernels.getVectorTagObjectWarehouse(timeVectorTag(), 0);
3751  if (time_kernels.hasActiveObjects())
3752  for (const auto & kernel : time_kernels.getObjects())
3753  variable_names.push_back(kernel->variable().name());
3754 
3755  return variable_names;
3756 }
MooseObjectTagWarehouse< KernelBase > _kernels
TagID timeVectorTag() const override
Ideally, we should not need this API.
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...

◆ timestepSetup()

void NonlinearSystemBase::timestepSetup ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 306 of file NonlinearSystemBase.C.

307 {
309 
310  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
311  {
312  _kernels.timestepSetup(tid);
315  if (_doing_dg)
321 
322  if (_fe_problem.haveFV())
323  {
324  std::vector<FVFluxBC *> bcs;
326  .query()
327  .template condition<AttribSystem>("FVFluxBC")
328  .template condition<AttribThread>(tid)
329  .queryInto(bcs);
330 
331  std::vector<FVInterfaceKernel *> iks;
333  .query()
334  .template condition<AttribSystem>("FVInterfaceKernel")
335  .template condition<AttribThread>(tid)
336  .queryInto(iks);
337 
338  std::vector<FVFluxKernel *> kernels;
340  .query()
341  .template condition<AttribSystem>("FVFluxKernel")
342  .template condition<AttribThread>(tid)
343  .queryInto(kernels);
344 
345  for (auto * bc : bcs)
346  bc->timestepSetup();
347  for (auto * ik : iks)
348  ik->timestepSetup();
349  for (auto * kernel : kernels)
350  kernel->timestepSetup();
351  }
352  }
357 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
TheWarehouse & theWarehouse() const
virtual void timestepSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:980
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:209
virtual void timestepSetup()
Definition: SystemBase.C:1545

◆ timeVectorTag()

TagID NonlinearSystemBase::timeVectorTag ( ) const
inlineoverridevirtual

Ideally, we should not need this API.

There exists a really bad API "addCachedResidualDirectly " in FEProblem and DisplacedProblem This API should go away once addCachedResidualDirectly is removed in the future Return Tag ID for Time

Reimplemented from SystemBase.

Definition at line 647 of file NonlinearSystemBase.h.

Referenced by FEProblemBase::addCachedResidualDirectly(), containsTimeKernel(), and timeKernelVariableNames().

647 { return _Re_time_tag; }
TagID _Re_time_tag
Tag for time contribution residual.

◆ turnOffJacobian()

void NonlinearSystemBase::turnOffJacobian ( )
virtual

Turn off the Jacobian (must be called before equation system initialization)

Reimplemented in NonlinearEigenSystem.

Definition at line 195 of file NonlinearSystemBase.C.

196 {
198  nonlinearSolver()->jacobian = NULL;
199 }
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver()=0
void set_basic_system_only()
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ update()

void SystemBase::update ( )
inherited

◆ updateActive()

void NonlinearSystemBase::updateActive ( THREAD_ID  tid)

Update active objects of Warehouses owned by NonlinearSystemBase.

Definition at line 3294 of file NonlinearSystemBase.C.

3295 {
3302  _kernels.updateActive(tid);
3304  if (tid == 0)
3305  {
3312  }
3313 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
void updateActive(THREAD_ID tid=0) override
Update the various active lists.
virtual void updateActive(THREAD_ID tid=0) override
Update the active status of Kernels.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
virtual void updateActive(THREAD_ID tid=0) override
Update the active status of Kernels.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ useFieldSplitPreconditioner()

void NonlinearSystemBase::useFieldSplitPreconditioner ( bool  use = true)
inline

If called with true this system will use a field split preconditioner matrix.

Definition at line 462 of file NonlinearSystemBase.h.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner().

bool _use_field_split_preconditioner
Whether or not to use a FieldSplitPreconditioner matrix based on the decomposition.

◆ useFiniteDifferencedPreconditioner()

void NonlinearSystemBase::useFiniteDifferencedPreconditioner ( bool  use = true)
inline

If called with true this system will use a finite differenced form of the Jacobian as the preconditioner.

Definition at line 447 of file NonlinearSystemBase.h.

Referenced by FiniteDifferencePreconditioner::FiniteDifferencePreconditioner().

448  {
450  }
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.

◆ usePreSMOResidual()

const bool& NonlinearSystemBase::usePreSMOResidual ( ) const
inline

Whether we are using pre-SMO residual in relative convergence checks.

Definition at line 254 of file NonlinearSystemBase.h.

Referenced by Console::outputSystemInformation(), and referenceResidual().

254 { return _use_pre_smo_residual; }
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.

◆ validParams()

InputParameters PerfGraphInterface::validParams ( )
staticinherited

Definition at line 16 of file PerfGraphInterface.C.

Referenced by Convergence::validParams().

17 {
19  return params;
20 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()

◆ varKind()

Moose::VarKindType SystemBase::varKind ( ) const
inlineinherited
Returns
the type of variables this system holds, e.g. nonlinear or auxiliary

Definition at line 925 of file SystemBase.h.

Referenced by Coupleable::coupled().

925 { return _var_kind; }
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:1030

◆ zeroTaggedVector()

void SystemBase::zeroTaggedVector ( const TagID  tag)
inherited

Zero vector with the given tag.

Definition at line 666 of file SystemBase.C.

Referenced by SystemBase::zeroTaggedVectors().

667 {
668  if (!_subproblem.vectorTagExists(tag))
669  mooseError("Cannot zero vector with TagID ",
670  tag,
671  " in system '",
672  name(),
673  "' because that tag does not exist in the problem");
674  else if (!hasVector(tag))
675  mooseError("Cannot zero vector tag with name '",
677  "' in system '",
678  name(),
679  "' because there is no vector associated with that tag");
681  getVector(tag).zero();
682 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:907
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool vectorTagNotZeroed(const TagID tag) const
Checks if a vector tag is in the list of vectors that will not be zeroed when other tagged vectors ar...
Definition: SubProblem.C:155
virtual void zero()=0
virtual const std::string & name() const
Definition: SystemBase.C:1330
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:221
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:916

◆ zeroTaggedVectors()

void SystemBase::zeroTaggedVectors ( const std::set< TagID > &  tags)
inherited

Zero all vectors for given tags.

Definition at line 685 of file SystemBase.C.

Referenced by computeResidualAndJacobianTags(), and computeResidualTags().

686 {
687  for (const auto tag : tags)
688  zeroTaggedVector(tag);
689 }
void zeroTaggedVector(const TagID tag)
Zero vector with the given tag.
Definition: SystemBase.C:666

◆ zeroVariables()

void SystemBase::zeroVariables ( std::vector< std::string > &  vars_to_be_zeroed)
virtualinherited

Zero out the solution for the list of variables passed in.

@ param vars_to_be_zeroed The variable names in this vector will have their solutions set to zero after this call

Reimplemented in DisplacedSystem.

Definition at line 199 of file SystemBase.C.

Referenced by DisplacedSystem::zeroVariables(), SystemBase::zeroVariablesForJacobian(), and SystemBase::zeroVariablesForResidual().

200 {
201  if (vars_to_be_zeroed.size() > 0)
202  {
204 
205  auto problem = dynamic_cast<FEProblemBase *>(&_subproblem);
206  if (!problem)
207  mooseError("System needs to be registered in FEProblemBase for using zeroVariables.");
208 
209  AllLocalDofIndicesThread aldit(*problem, vars_to_be_zeroed, true);
211  Threads::parallel_reduce(elem_range, aldit);
212 
213  const auto & dof_indices_to_zero = aldit.getDofIndices();
214 
215  solution.close();
216 
217  for (const auto & dof : dof_indices_to_zero)
218  solution.set(dof, 0);
219 
220  solution.close();
221 
222  // Call update to update the current_local_solution for this system
223  system().update();
224  }
225 }
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1235
NumericVector< Number > & solution()
Definition: SystemBase.h:195
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
void parallel_reduce(const Range &range, Body &body, const Partitioner &)
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in...
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:977
virtual void close()=0
virtual void update()
MooseMesh & _mesh
Definition: SystemBase.h:985
virtual void set(const numeric_index_type i, const T value)=0

◆ zeroVariablesForJacobian()

void SystemBase::zeroVariablesForJacobian ( )
virtualinherited

Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual()

Definition at line 234 of file SystemBase.C.

235 {
237 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:997
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
Definition: SystemBase.C:199

◆ zeroVariablesForResidual()

void SystemBase::zeroVariablesForResidual ( )
virtualinherited

Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual()

Definition at line 228 of file SystemBase.C.

229 {
231 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:996
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
Definition: SystemBase.C:199

◆ zeroVectorForResidual()

void NonlinearSystemBase::zeroVectorForResidual ( const std::string &  vector_name)

Definition at line 772 of file NonlinearSystemBase.C.

773 {
774  for (unsigned int i = 0; i < _vecs_to_zero_for_residual.size(); ++i)
775  if (vector_name == _vecs_to_zero_for_residual[i])
776  return;
777 
778  _vecs_to_zero_for_residual.push_back(vector_name);
779 }
std::vector< std::string > _vecs_to_zero_for_residual
vectors that will be zeroed before a residual computation

Member Data Documentation

◆ _ad_preset_nodal_bcs

MooseObjectWarehouse<ADDirichletBCBase> NonlinearSystemBase::_ad_preset_nodal_bcs
protected

Definition at line 858 of file NonlinearSystemBase.h.

Referenced by addBoundaryCondition(), setInitialSolution(), and updateActive().

◆ _add_implicit_geometric_coupling_entries_to_jacobian

bool NonlinearSystemBase::_add_implicit_geometric_coupling_entries_to_jacobian
protected

Whether or not to add implicit geometric couplings to the Jacobian for FDP.

Definition at line 900 of file NonlinearSystemBase.h.

Referenced by addImplicitGeometricCouplingEntriesToJacobian(), augmentSparsity(), and computeJacobianInternal().

◆ _app

MooseApp& SystemBase::_app
protectedinherited

◆ _assemble_constraints_separately

bool NonlinearSystemBase::_assemble_constraints_separately
protected

Whether or not to assemble the residual and Jacobian after the application of each constraint.

Definition at line 903 of file NonlinearSystemBase.h.

Referenced by assembleConstraintsSeparately(), constraintJacobians(), and constraintResiduals().

◆ _auto_scaling_initd

bool NonlinearSystemBase::_auto_scaling_initd
private

Whether we've initialized the automatic scaling data structures.

Definition at line 1007 of file NonlinearSystemBase.h.

Referenced by computeScaling(), and setupScalingData().

◆ _automatic_scaling

bool SystemBase::_automatic_scaling
protectedinherited

Whether to automatically scale the variables.

Definition at line 1047 of file SystemBase.h.

Referenced by SystemBase::automaticScaling(), initialSetup(), and preSolve().

◆ _compute_scaling_once

bool NonlinearSystemBase::_compute_scaling_once
protected

Whether the scaling factors should only be computed once at the beginning of the simulation through an extra Jacobian evaluation.

If this is set to false, then the scaling factors will be computed during an extra Jacobian evaluation at the beginning of every time step.

Definition at line 958 of file NonlinearSystemBase.h.

Referenced by computeScaling(), and computeScalingOnce().

◆ _computed_scaling

bool NonlinearSystemBase::_computed_scaling
protected

Flag used to indicate whether we have already computed the scaling Jacobian.

Definition at line 953 of file NonlinearSystemBase.h.

Referenced by computedScalingJacobian(), and computeScaling().

◆ _computing_pre_smo_residual

bool NonlinearSystemBase::_computing_pre_smo_residual
protected

Definition at line 927 of file NonlinearSystemBase.h.

Referenced by computingPreSMOResidual(), and NonlinearSystem::solve().

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 31 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), SolverSystem::checkInvalidSolution(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonMatchingEdges(), MeshDiagnosticsGenerator::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualConvergence::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), MeshDiagnosticsGenerator::checkWatertightNodesets(), MeshDiagnosticsGenerator::checkWatertightSidesets(), IterationAdaptiveDT::computeAdaptiveDT(), TransientBase::computeConstrainedDT(), DefaultMultiAppFixedPointConvergence::computeCustomConvergencePostprocessor(), computeDamping(), FixedPointIterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), LinearSystem::computeLinearSystemTags(), FEProblemBase::computeLinearSystemTags(), computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MFEMSteady::execute(), MessageFromInput::execute(), SteadyBase::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualConvergence::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), SolutionInvalidityOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), DefaultMultiAppFixedPointConvergence::outputResidualNorm(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), NEML2Action::printSummary(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), FEProblemBase::restoreSolutions(), setInitialSolution(), MooseApp::setupOptions(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), EigenProblem::solve(), NonlinearSystem::solve(), LinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), TransientBase::takeStep(), TerminateChainControl::terminate(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _constraints

ConstraintWarehouse NonlinearSystemBase::_constraints
protected

◆ _current_l_its

std::vector<unsigned int> NonlinearSystemBase::_current_l_its

Definition at line 693 of file NonlinearSystemBase.h.

Referenced by SolutionHistory::output(), and preSolve().

◆ _current_nl_its

unsigned int NonlinearSystemBase::_current_nl_its

◆ _current_solution

const NumericVector<Number>* SolverSystem::_current_solution
protectedinherited

◆ _debugging_residuals

bool NonlinearSystemBase::_debugging_residuals
protected

true if debugging residuals

Definition at line 908 of file NonlinearSystemBase.h.

Referenced by computeResidualTags(), and debuggingResiduals().

◆ _decomposition_split

std::string NonlinearSystemBase::_decomposition_split
protected

Name of the top-level split of the decomposition.

Definition at line 895 of file NonlinearSystemBase.h.

Referenced by setDecomposition(), setupDM(), and setupFieldDecomposition().

◆ _dg_kernels

MooseObjectTagWarehouse<DGKernelBase> NonlinearSystemBase::_dg_kernels
protected

◆ _dirac_kernels

MooseObjectTagWarehouse<DiracKernelBase> NonlinearSystemBase::_dirac_kernels
protected

◆ _displaced_mortar_functors

std::unordered_map<std::pair<BoundaryID, BoundaryID>, ComputeMortarFunctor> NonlinearSystemBase::_displaced_mortar_functors
private

Functors for computing displaced mortar constraints.

Definition at line 1001 of file NonlinearSystemBase.h.

Referenced by initialSetup(), and mortarConstraints().

◆ _doing_dg

bool NonlinearSystemBase::_doing_dg
protected

true if DG is active (optimization reasons)

Definition at line 911 of file NonlinearSystemBase.h.

Referenced by addDGKernel(), customSetup(), doingDG(), initialSetup(), jacobianSetup(), needSubdomainMaterialOnSide(), residualSetup(), and timestepSetup().

◆ _du_dot_du

Number NonlinearSystemBase::_du_dot_du
protected

\( {du^dot}\over{du} \)

Definition at line 813 of file NonlinearSystemBase.h.

◆ _du_dotdot_du

Number NonlinearSystemBase::_du_dotdot_du
protected

\( {du^dotdot}\over{du} \)

Definition at line 815 of file NonlinearSystemBase.h.

◆ _element_dampers

MooseObjectWarehouse<ElementDamper> NonlinearSystemBase::_element_dampers
protected

◆ _factory

Factory& SystemBase::_factory
protectedinherited

◆ _fdcoloring

MatFDColoring NonlinearSystemBase::_fdcoloring
protected

◆ _fe_problem

FEProblemBase& SystemBase::_fe_problem
protectedinherited

the governing finite element/volume problem

Definition at line 980 of file SystemBase.h.

Referenced by addBoundaryCondition(), addDGKernel(), addDiracKernel(), SystemBase::addDotVectors(), addHDGKernel(), addInterfaceKernel(), addKernel(), addNodalKernel(), addScalarKernel(), addSplit(), assembleScalingVector(), augmentSparsity(), AuxiliarySystem::AuxiliarySystem(), SolverSystem::checkInvalidSolution(), checkKernelCoverage(), AuxiliarySystem::clearScalarVariableCoupleableTags(), SolverSystem::compute(), AuxiliarySystem::compute(), computeDamping(), computeDiracContributions(), AuxiliarySystem::computeElementalVarsHelper(), LinearSystem::computeGradients(), computeJacobian(), computeJacobianBlocks(), computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), LinearSystem::computeLinearSystemTags(), AuxiliarySystem::computeMortarNodalVars(), computeNodalBCs(), computeNodalBCsResidualAndJacobian(), AuxiliarySystem::computeNodalVarsHelper(), computeResidualAndJacobianInternal(), computeResidualInternal(), computeResidualTags(), computeScalarKernelsJacobians(), AuxiliarySystem::computeScalarVars(), computeScaling(), NonlinearSystem::computeScalingJacobian(), NonlinearSystem::computeScalingResidual(), constraintJacobians(), constraintResiduals(), LinearSystem::containsTimeKernel(), NonlinearSystem::converged(), customSetup(), MooseEigenSystem::eigenKernelOnCurrent(), MooseEigenSystem::eigenKernelOnOld(), enforceNodalConstraintsJacobian(), enforceNodalConstraintsResidual(), SystemBase::feProblem(), getResidualNonTimeVector(), getResidualTimeVector(), initialSetup(), jacobianSetup(), LinearSystem::LinearSystem(), NonlinearSystemBase(), overwriteNodeFace(), NonlinearSystem::potentiallySetupFiniteDifferencing(), preInit(), reinitNodeFace(), NonlinearSystem::residualAndJacobianTogether(), residualSetup(), setConstraintSecondaryValues(), setInitialSolution(), AuxiliarySystem::setScalarVariableCoupleableTags(), shouldEvaluatePreSMOResidual(), NonlinearSystem::solve(), and timestepSetup().

◆ _final_residual

Real NonlinearSystemBase::_final_residual
protected

Definition at line 922 of file NonlinearSystemBase.h.

Referenced by finalNonlinearResidual(), and NonlinearSystem::solve().

◆ _general_dampers

MooseObjectWarehouse<GeneralDamper> NonlinearSystemBase::_general_dampers
protected

◆ _has_diag_save_in

bool NonlinearSystemBase::_has_diag_save_in
protected

◆ _has_nodalbc_diag_save_in

bool NonlinearSystemBase::_has_nodalbc_diag_save_in
protected

If there is a nodal BC having diag_save_in.

Definition at line 948 of file NonlinearSystemBase.h.

Referenced by addBoundaryCondition(), computeJacobianInternal(), and hasDiagSaveIn().

◆ _has_nodalbc_save_in

bool NonlinearSystemBase::_has_nodalbc_save_in
protected

If there is a nodal BC having save_in.

Definition at line 945 of file NonlinearSystemBase.h.

Referenced by addBoundaryCondition(), computeResidualTags(), and hasSaveIn().

◆ _has_save_in

bool NonlinearSystemBase::_has_save_in
protected

◆ _have_decomposition

bool NonlinearSystemBase::_have_decomposition
protected

Whether or not the system can be decomposed into splits.

Definition at line 893 of file NonlinearSystemBase.h.

Referenced by setDecomposition(), and setupFieldDecomposition().

◆ _hybridized_kernels

MooseObjectTagWarehouse<HDGKernel> NonlinearSystemBase::_hybridized_kernels
protected

Definition at line 846 of file NonlinearSystemBase.h.

Referenced by addHDGKernel(), and getHDGKernelWarehouse().

◆ _ignore_variables_for_autoscaling

std::vector<std::string> NonlinearSystemBase::_ignore_variables_for_autoscaling
protected

A container for variables that do not partipate in autoscaling.

Definition at line 974 of file NonlinearSystemBase.h.

Referenced by ignoreVariablesForAutoscaling(), and setupScalingData().

◆ _increment_vec

NumericVector<Number>* NonlinearSystemBase::_increment_vec
protected

◆ _initial_residual

Real NonlinearSystemBase::_initial_residual
protected

The initial (i.e., 0th nonlinear iteration) residual, see setPreSMOResidual for a detailed explanation.

Definition at line 932 of file NonlinearSystemBase.h.

Referenced by initialResidual(), and setInitialResidual().

◆ _integrated_bcs

MooseObjectTagWarehouse<IntegratedBCBase> NonlinearSystemBase::_integrated_bcs
protected

◆ _interface_kernels

MooseObjectTagWarehouse<InterfaceKernelBase> NonlinearSystemBase::_interface_kernels
protected

◆ _Ke_non_time_tag

TagID NonlinearSystemBase::_Ke_non_time_tag
protected

Tag for non-time contribution Jacobian.

Definition at line 838 of file NonlinearSystemBase.h.

◆ _Ke_system_tag

TagID NonlinearSystemBase::_Ke_system_tag
protected

Tag for system contribution Jacobian.

Definition at line 841 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase(), and systemMatrixTag().

◆ _kernels

MooseObjectTagWarehouse<KernelBase> NonlinearSystemBase::_kernels
protected

◆ _ksp_norm

Moose::MooseKSPNormType SolverSystem::_ksp_norm
protectedinherited

KSP norm type.

Definition at line 110 of file SolverSystem.h.

Referenced by SolverSystem::getMooseKSPNormType(), and SolverSystem::setMooseKSPNormType().

◆ _last_nl_rnorm

Real NonlinearSystemBase::_last_nl_rnorm

◆ _matrix_tag_active_flags

std::vector<bool> SystemBase::_matrix_tag_active_flags
protectedinherited

◆ _max_var_n_dofs_per_elem

size_t SystemBase::_max_var_n_dofs_per_elem
protectedinherited

Maximum number of dofs for any one variable on any one element.

Definition at line 1035 of file SystemBase.h.

Referenced by SystemBase::assignMaxVarNDofsPerElem(), and SystemBase::getMaxVarNDofsPerElem().

◆ _max_var_n_dofs_per_node

size_t SystemBase::_max_var_n_dofs_per_node
protectedinherited

Maximum number of dofs for any one variable on any one node.

Definition at line 1038 of file SystemBase.h.

Referenced by SystemBase::assignMaxVarNDofsPerNode(), and SystemBase::getMaxVarNDofsPerNode().

◆ _max_var_number

unsigned int SystemBase::_max_var_number
protectedinherited

Maximum variable number.

Definition at line 994 of file SystemBase.h.

Referenced by SystemBase::addVariable(), and SystemBase::getMaxVariableNumber().

◆ _mesh

MooseMesh& SystemBase::_mesh
protectedinherited

◆ _n_iters

unsigned int NonlinearSystemBase::_n_iters
protected

Definition at line 916 of file NonlinearSystemBase.h.

Referenced by nNonlinearIterations(), and NonlinearSystem::solve().

◆ _n_linear_iters

unsigned int NonlinearSystemBase::_n_linear_iters
protected

Definition at line 917 of file NonlinearSystemBase.h.

Referenced by nLinearIterations(), and NonlinearSystem::solve().

◆ _n_residual_evaluations

unsigned int NonlinearSystemBase::_n_residual_evaluations
protected

Total number of residual evaluations that have been performed.

Definition at line 920 of file NonlinearSystemBase.h.

Referenced by computeResidualTags(), and nResidualEvaluations().

◆ _name

std::string SystemBase::_name
protectedinherited

The name of this system.

Definition at line 987 of file SystemBase.h.

◆ _need_residual_ghosted

bool NonlinearSystemBase::_need_residual_ghosted
protected

Whether or not a ghosted copy of the residual needs to be made.

Definition at line 906 of file NonlinearSystemBase.h.

Referenced by computeResidualInternal(), computeResidualTags(), constraintResiduals(), getResidualNonTimeVector(), getResidualTimeVector(), and residualGhosted().

◆ _nl_matrix_tags

std::set<TagID> NonlinearSystemBase::_nl_matrix_tags
protected

Matrix tags to temporarily store all tags associated with the current system.

Definition at line 824 of file NonlinearSystemBase.h.

Referenced by computeJacobian(), and computeJacobianBlocks().

◆ _nl_vector_tags

std::set<TagID> NonlinearSystemBase::_nl_vector_tags
protected

Vector tags to temporarily store all tags associated with the current system.

Definition at line 821 of file NonlinearSystemBase.h.

Referenced by computeResidualTag().

◆ _nodal_bcs

MooseObjectTagWarehouse<NodalBCBase> NonlinearSystemBase::_nodal_bcs
protected

◆ _nodal_dampers

MooseObjectWarehouse<NodalDamper> NonlinearSystemBase::_nodal_dampers
protected

◆ _nodal_kernels

MooseObjectTagWarehouse<NodalKernelBase> NonlinearSystemBase::_nodal_kernels
protected

◆ _num_residual_evaluations

unsigned int NonlinearSystemBase::_num_residual_evaluations

Definition at line 553 of file NonlinearSystemBase.h.

◆ _num_scaling_groups

std::size_t NonlinearSystemBase::_num_scaling_groups
private

The number of scaling groups.

Definition at line 1013 of file NonlinearSystemBase.h.

Referenced by computeScaling(), and setupScalingData().

◆ _numbered_vars

std::vector<std::vector<MooseVariableFieldBase *> > SystemBase::_numbered_vars
protectedinherited

Map variable number to its pointer.

Definition at line 1044 of file SystemBase.h.

Referenced by SystemBase::addVariable(), and SystemBase::getVariable().

◆ _off_diagonals_in_auto_scaling

bool NonlinearSystemBase::_off_diagonals_in_auto_scaling
protected

Whether to include off diagonals when determining automatic scaling factors.

Definition at line 977 of file NonlinearSystemBase.h.

Referenced by initialSetup(), and offDiagonalsInAutoScaling().

◆ _pc_side

Moose::PCSideType SolverSystem::_pc_side
protectedinherited

Preconditioning side.

Definition at line 108 of file SolverSystem.h.

Referenced by SolverSystem::getPCSide(), and SolverSystem::setPCSide().

◆ _pg_moose_app

MooseApp& PerfGraphInterface::_pg_moose_app
protectedinherited

The MooseApp that owns the PerfGraph.

Definition at line 124 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::perfGraph().

◆ _pre_smo_residual

Real NonlinearSystemBase::_pre_smo_residual
protected

The pre-SMO residual, see setPreSMOResidual for a detailed explanation.

Definition at line 930 of file NonlinearSystemBase.h.

Referenced by preSMOResidual(), and NonlinearSystem::solve().

◆ _preconditioner

std::shared_ptr<MoosePreconditioner> NonlinearSystemBase::_preconditioner
protected

◆ _predictor

std::shared_ptr<Predictor> NonlinearSystemBase::_predictor
protected

If predictor is active, this is non-NULL.

Definition at line 925 of file NonlinearSystemBase.h.

Referenced by getPredictor(), onTimestepBegin(), setInitialSolution(), and setPredictor().

◆ _prefix

const std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 127 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::timedSectionName().

◆ _preset_nodal_bcs

MooseObjectWarehouse<DirichletBCBase> NonlinearSystemBase::_preset_nodal_bcs
protected

Definition at line 857 of file NonlinearSystemBase.h.

Referenced by addBoundaryCondition(), setInitialSolution(), and updateActive().

◆ _print_all_var_norms

bool NonlinearSystemBase::_print_all_var_norms
protected

Definition at line 936 of file NonlinearSystemBase.h.

Referenced by printAllVariableNorms().

◆ _raw_grad_container

std::vector<std::unique_ptr<NumericVector<Number> > > SystemBase::_raw_grad_container
protectedinherited

A cache for storing gradients at dof locations.

We store it on the system because we create copies of variables on each thread and that would lead to increased data duplication when using threading-based parallelism.

Definition at line 1065 of file SystemBase.h.

Referenced by LinearSystem::computeGradients(), SystemBase::gradientContainer(), and SystemBase::initialSetup().

◆ _Re_non_time

NumericVector<Number>* NonlinearSystemBase::_Re_non_time
protected

◆ _Re_non_time_tag

TagID NonlinearSystemBase::_Re_non_time_tag
protected

Tag for non-time contribution residual.

Definition at line 830 of file NonlinearSystemBase.h.

Referenced by getResidualNonTimeVector(), nonTimeVectorTag(), and residualGhosted().

◆ _Re_tag

TagID NonlinearSystemBase::_Re_tag
protected

Used for the residual vector from PETSc.

Definition at line 835 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase(), and residualVectorTag().

◆ _Re_time

NumericVector<Number>* NonlinearSystemBase::_Re_time
protected

residual vector for time contributions

Definition at line 827 of file NonlinearSystemBase.h.

Referenced by computeNodalBCs(), getResidualTimeVector(), and residualGhosted().

◆ _Re_time_tag

TagID NonlinearSystemBase::_Re_time_tag
protected

Tag for time contribution residual.

Definition at line 818 of file NonlinearSystemBase.h.

Referenced by getResidualTimeVector(), residualGhosted(), and timeVectorTag().

◆ _resid_vs_jac_scaling_param

Real NonlinearSystemBase::_resid_vs_jac_scaling_param
protected

The param that indicates the weighting of the residual vs the Jacobian in determining variable scaling parameters.

A value of 1 indicates pure residual-based scaling. A value of 0 indicates pure Jacobian-based scaling

Definition at line 963 of file NonlinearSystemBase.h.

Referenced by autoScalingParam(), and computeScaling().

◆ _residual_copy

std::unique_ptr<NumericVector<Number> > NonlinearSystemBase::_residual_copy
protected

Copy of the residual vector, or nullptr if a copy is not needed.

Definition at line 810 of file NonlinearSystemBase.h.

Referenced by computeResidualInternal(), preInit(), and residualCopy().

◆ _residual_ghosted

NumericVector<Number>* NonlinearSystemBase::_residual_ghosted
protected

ghosted form of the residual

Definition at line 807 of file NonlinearSystemBase.h.

Referenced by computeResidualInternal(), computeResidualTags(), constraintResiduals(), and residualGhosted().

◆ _saved_dot_old

NumericVector<Real>* SystemBase::_saved_dot_old
protectedinherited

Definition at line 1026 of file SystemBase.h.

Referenced by SystemBase::restoreOldSolutions(), and SystemBase::saveOldSolutions().

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protectedinherited

Definition at line 1027 of file SystemBase.h.

Referenced by SystemBase::restoreOldSolutions(), and SystemBase::saveOldSolutions().

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 1022 of file SystemBase.h.

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

Definition at line 1023 of file SystemBase.h.

◆ _scalar_kernels

MooseObjectTagWarehouse<ScalarKernelBase> NonlinearSystemBase::_scalar_kernels
protected

◆ _scaling_group_variables

std::vector<std::vector<std::string> > NonlinearSystemBase::_scaling_group_variables
protected

A container of variable groupings that can be used in scaling calculations.

This can be useful for simulations in which vector-like variables are split into invidual scalar-field components like for solid/fluid mechanics

Definition at line 968 of file NonlinearSystemBase.h.

Referenced by scalingGroupVariables(), and setupScalingData().

◆ _scaling_matrix

std::unique_ptr<libMesh::DiagonalMatrix<Number> > NonlinearSystemBase::_scaling_matrix
protected

A diagonal matrix used for computing scaling.

Definition at line 980 of file NonlinearSystemBase.h.

Referenced by computeScaling(), NonlinearSystem::computeScalingJacobian(), NonlinearEigenSystem::computeScalingJacobian(), and initialSetup().

◆ _serialized_solution

std::unique_ptr<NumericVector<Number> > SystemBase::_serialized_solution
protectedinherited

Serialized version of the solution vector, or nullptr if a serialized solution is not needed.

Definition at line 1060 of file SystemBase.h.

Referenced by AuxiliarySystem::compute(), SolverSystem::preInit(), SystemBase::serializedSolution(), SolverSystem::serializeSolution(), AuxiliarySystem::serializeSolution(), and SolverSystem::setSolution().

◆ _solution_is_invalid

bool SolverSystem::_solution_is_invalid
protectedinherited

Boolean to see if solution is invalid.

Definition at line 113 of file SolverSystem.h.

◆ _solution_state

std::vector<NumericVector<Number> *> NonlinearSystemBase::_solution_state
private

The current states of the solution (0 = current, 1 = old, etc)

Definition at line 1004 of file NonlinearSystemBase.h.

◆ _solution_states_initialized

bool SystemBase::_solution_states_initialized
protectedinherited

Whether or not the solution states have been initialized.

Definition at line 1053 of file SystemBase.h.

Referenced by SystemBase::initSolutionState(), and SystemBase::solutionStatesInitialized().

◆ _splits

MooseObjectWarehouseBase<Split> NonlinearSystemBase::_splits
protected

Decomposition splits.

Definition at line 877 of file NonlinearSystemBase.h.

Referenced by addSplit(), getSplit(), and getSplits().

◆ _subproblem

SubProblem& SystemBase::_subproblem
protectedinherited

◆ _sys

libMesh::System& NonlinearSystemBase::_sys

◆ _tagged_matrices

std::vector<libMesh::SparseMatrix<Number> *> SystemBase::_tagged_matrices
protectedinherited

◆ _tagged_vectors

std::vector<NumericVector<Number> *> SystemBase::_tagged_vectors
protectedinherited

◆ _time_integrators

std::vector<std::shared_ptr<TimeIntegrator> > SystemBase::_time_integrators
protectedinherited

◆ _u_dot

NumericVector<Number>* SystemBase::_u_dot
protectedinherited

solution vector for u^dot

Definition at line 1000 of file SystemBase.h.

Referenced by SystemBase::addDotVectors(), setSolutionUDot(), and SystemBase::solutionUDot().

◆ _u_dot_old

NumericVector<Number>* SystemBase::_u_dot_old
protectedinherited

old solution vector for u^dot

Definition at line 1005 of file SystemBase.h.

Referenced by SystemBase::addDotVectors(), setSolutionUDotOld(), and SystemBase::solutionUDotOld().

◆ _u_dotdot

NumericVector<Number>* SystemBase::_u_dotdot
protectedinherited

solution vector for u^dotdot

Definition at line 1002 of file SystemBase.h.

Referenced by SystemBase::addDotVectors(), setSolutionUDotDot(), and SystemBase::solutionUDotDot().

◆ _u_dotdot_old

NumericVector<Number>* SystemBase::_u_dotdot_old
protectedinherited

old solution vector for u^dotdot

Definition at line 1007 of file SystemBase.h.

Referenced by SystemBase::addDotVectors(), setSolutionUDotDotOld(), and SystemBase::solutionUDotDotOld().

◆ _undisplaced_mortar_functors

std::unordered_map<std::pair<BoundaryID, BoundaryID>, ComputeMortarFunctor> NonlinearSystemBase::_undisplaced_mortar_functors
private

Functors for computing undisplaced mortar constraints.

Definition at line 997 of file NonlinearSystemBase.h.

Referenced by initialSetup(), and mortarConstraints().

◆ _use_field_split_preconditioner

bool NonlinearSystemBase::_use_field_split_preconditioner
protected

Whether or not to use a FieldSplitPreconditioner matrix based on the decomposition.

Definition at line 897 of file NonlinearSystemBase.h.

Referenced by haveFieldSplitPreconditioner(), and useFieldSplitPreconditioner().

◆ _use_finite_differenced_preconditioner

bool NonlinearSystemBase::_use_finite_differenced_preconditioner
protected

Whether or not to use a finite differenced preconditioner.

Definition at line 888 of file NonlinearSystemBase.h.

Referenced by haveFiniteDifferencedPreconditioner(), NonlinearSystem::potentiallySetupFiniteDifferencing(), and useFiniteDifferencedPreconditioner().

◆ _use_pre_smo_residual

bool NonlinearSystemBase::_use_pre_smo_residual
protected

Whether to use the pre-SMO initial residual in the relative convergence check.

Definition at line 934 of file NonlinearSystemBase.h.

Referenced by setPreSMOResidual(), shouldEvaluatePreSMOResidual(), and usePreSMOResidual().

◆ _var_all_dof_indices

std::vector<dof_id_type> SystemBase::_var_all_dof_indices
protectedinherited

Container for the dof indices of a given variable.

Definition at line 1056 of file SystemBase.h.

Referenced by SystemBase::getVariableGlobalDoFs(), and SystemBase::setVariableGlobalDoFs().

◆ _var_kind

Moose::VarKindType SystemBase::_var_kind
protectedinherited

default kind of variables in this system

Definition at line 1030 of file SystemBase.h.

Referenced by SystemBase::varKind().

◆ _var_map

std::map<unsigned int, std::set<SubdomainID> > SystemBase::_var_map
protectedinherited

Map of variables (variable id -> array of subdomains where it lives)

Definition at line 992 of file SystemBase.h.

Referenced by SystemBase::addVariable(), SystemBase::getSubdomainsForVar(), and SystemBase::getVariableBlocks().

◆ _var_to_copy

std::vector<VarCopyInfo> SystemBase::_var_to_copy
protectedinherited

◆ _var_to_group_var

std::unordered_map<unsigned int, unsigned int> NonlinearSystemBase::_var_to_group_var
private

A map from variable index to group variable index and it's associated (inverse) scaling factor.

Definition at line 1010 of file NonlinearSystemBase.h.

Referenced by computeScaling(), and setupScalingData().

◆ _variable_autoscaled

std::vector<bool> NonlinearSystemBase::_variable_autoscaled
protected

Container to hold flag if variable is to participate in autoscaling.

Definition at line 971 of file NonlinearSystemBase.h.

Referenced by computeScaling(), and setupScalingData().

◆ _vars

std::vector<VariableWarehouse> SystemBase::_vars
protectedinherited

◆ _vars_to_be_zeroed_on_jacobian

std::vector<std::string> SystemBase::_vars_to_be_zeroed_on_jacobian
protectedinherited

◆ _vars_to_be_zeroed_on_residual

std::vector<std::string> SystemBase::_vars_to_be_zeroed_on_residual
protectedinherited

◆ _vecs_to_zero_for_residual

std::vector<std::string> NonlinearSystemBase::_vecs_to_zero_for_residual
protected

vectors that will be zeroed before a residual computation

Definition at line 914 of file NonlinearSystemBase.h.

Referenced by computeResidualTags(), and zeroVectorForResidual().

◆ _verbose

bool SystemBase::_verbose
protectedinherited

True if printing out additional information.

Definition at line 1050 of file SystemBase.h.

Referenced by SystemBase::applyScalingFactors(), and SystemBase::setVerboseFlag().


The documentation for this class was generated from the following files: