www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MooseEigenSystem Class Reference

#include <MooseEigenSystem.h>

Inheritance diagram for MooseEigenSystem:
[legend]

Public Types

enum  SYSTEMTAG { ALL, EIGEN }
 System or kernel tags. More...
 

Public Member Functions

 MooseEigenSystem (FEProblemBase &problem, const std::string &name)
 
virtual ~MooseEigenSystem ()
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a kernel. More...
 
virtual void markEigenVariable (const VariableName &var_name)
 Mark a variable as a variable of the eigen system. More...
 
void scaleSystemSolution (SYSTEMTAG tag, Real scaling_factor)
 Scale the solution vector. More...
 
void combineSystemSolution (SYSTEMTAG tag, const std::vector< Real > &coefficients)
 Linear combination of the solution vectors. More...
 
void initSystemSolution (SYSTEMTAG tag, Real v)
 Initialize the solution vector with a constant value. More...
 
void initSystemSolutionOld (SYSTEMTAG tag, Real v)
 
void eigenKernelOnOld ()
 Ask eigenkernels to operate on old or current solution vectors. More...
 
void eigenKernelOnCurrent ()
 
void buildSystemDoFIndices (SYSTEMTAG tag=ALL)
 Build DoF indices for a system. More...
 
bool activeOnOld ()
 Return if eigen kernels should be on old solution. More...
 
const std::set< VariableName > & getEigenVariableNames () const
 Get variable names of the eigen system. More...
 
bool containsEigenKernel () const
 Weather or not the system contains eigen kernels. More...
 
virtual void solve () override
 Solve the system (using libMesh magic) More...
 
void init () override
 Initialize the system. More...
 
virtual void stopSolve (const ExecFlagType &exec_flag) override
 Quit the current solve as soon as possible. More...
 
virtual unsigned int getCurrentNonlinearIterationNumber () override
 Returns the current nonlinear iteration number. More...
 
virtual void setupFiniteDifferencedPreconditioner () override
 
virtual bool converged () override
 Returns the convergence state. More...
 
virtual NumericVector< Number > & RHS () override
 
virtual NonlinearSolver< Number > * nonlinearSolver () override
 
virtual SNES getSNES () override
 
virtual NonlinearImplicitSystem & sys ()
 
virtual void attachPreconditioner (Preconditioner< Number > *preconditioner) override
 Attach a customized preconditioner that requires physics knowledge. More...
 
void residualAndJacobianTogether () override
 Call this method if you want the residual and Jacobian to be computed simultaneously. More...
 
bool computedScalingJacobian () const
 
virtual void turnOffJacobian ()
 Turn off the Jacobian (must be called before equation system initialization) More...
 
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
 
void setupFieldDecomposition ()
 
bool haveFiniteDifferencedPreconditioner () const
 
bool haveFieldSplitPreconditioner () const
 
void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters &parameters) override
 Add a time integrator. More...
 
virtual void addTimeIntegrator (const std::string &, const std::string &, InputParameters &)
 
virtual void addTimeIntegrator (std::shared_ptr< TimeIntegrator >)
 
virtual void addTimeIntegrator (std::shared_ptr< TimeIntegrator >)
 
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...
 
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 (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 (SparseMatrix< Number > &jacobian, const std::set< TagID > &tags)
 Associate jacobian to systemMatrixTag, and then form a matrix for all the tags. More...
 
void computeJacobian (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...
 
virtual void subdomainSetup ()
 
virtual void subdomainSetup ()
 
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 void augmentSparsity (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...
 
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 System & system () override
 Get the reference to the libMesh system. More...
 
virtual const System & system () 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...
 
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 reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
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 ()
 
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 DofMap & dofMap ()
 Gets writeable reference to the dof map. More...
 
virtual const DofMap & dofMap () const
 Gets const reference to the dof map. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
virtual void update (bool update_libmesh_system=true)
 Update the system (doing libMesh magic) More...
 
virtual void copyOldSolutions ()
 Shifts the solutions backwards in time. 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 NumberduDotDu ()
 
virtual const NumberduDotDu () const
 
virtual NumberduDotDotDu ()
 
virtual const NumberduDotDotDu () 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 SparseMatrix< Number > & getMatrix (TagID tag)
 Get a raw SparseMatrix. More...
 
virtual const 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 (SparseMatrix< Number > &matrix, TagID tag)
 Associate a matrix to a tag. More...
 
virtual void disassociateMatrixFromTag (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 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, BoundaryID bnd_id, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, BoundaryID bnd_id, 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 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 ParallelType type)
 Adds a solution length vector to the system. More...
 
NumericVector< Number > & addVector (TagID tag, const bool project, const 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...
 
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 (ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 
TimeIntegratorgetTimeIntegrator ()
 
const TimeIntegratorgetTimeIntegrator () const
 
std::shared_ptr< TimeIntegratorgetSharedTimeIntegrator ()
 
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...
 
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
 
std::vector< std::unique_ptr< NumericVector< Number > > > & gradientContainer ()
 Reference to the container vector which hold gradients at dofs (if it can be interpreted). More...
 
const Parallel::Communicator & comm () 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
 
bool containsTimeKernel ()
 
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse ()
 Access functions to Warehouses from outside NonlinearSystemBase. More...
 
MooseObjectTagWarehouse< DGKernelBase > & getDGKernelWarehouse ()
 
MooseObjectTagWarehouse< InterfaceKernelBase > & getInterfaceKernelWarehouse ()
 
MooseObjectTagWarehouse< DiracKernelBase > & getDiracKernelWarehouse ()
 
MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse ()
 
const MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse () const
 Return the IntegratedBCBase warehouse. More...
 
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse () const
 
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse () const
 
const ConstraintWarehousegetConstraintWarehouse () const
 
const MooseObjectTagWarehouse< NodalBCBase > & getNodalBCWarehouse () const
 Return the NodalBCBase 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
 
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 computeScalingJacobian () override
 Compute a "Jacobian" for automatic scaling purposes. More...
 
void computeScalingResidual () override
 Compute a "residual" for automatic scaling purposes. More...
 
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...
 
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...
 
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

std::set< VariableName > _eigen_var_names
 
bool _all_eigen_vars
 
std::set< dof_id_type_eigen_var_indices
 
bool _active_on_old
 
unsigned int _eigen_kernel_counter
 counter of eigen kernels More...
 
NonlinearImplicitSystem & _nl_implicit_sys
 
ComputeResidualFunctor _nl_residual_functor
 
ComputeFDResidualFunctor _fd_residual_functor
 
ComputeResidualAndJacobian _resid_and_jac_functor
 
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< 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< 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::shared_ptr< TimeIntegrator_time_integrator
 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< 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
 

Detailed Description

Definition at line 19 of file MooseEigenSystem.h.

Member Enumeration Documentation

◆ SYSTEMTAG

System or kernel tags.

Enumerator
ALL 
EIGEN 

Definition at line 44 of file MooseEigenSystem.h.

Constructor & Destructor Documentation

◆ MooseEigenSystem()

MooseEigenSystem::MooseEigenSystem ( FEProblemBase problem,
const std::string &  name 
)

Definition at line 16 of file MooseEigenSystem.C.

17  : NonlinearSystem(fe_problem, name),
18  _all_eigen_vars(false),
19  _active_on_old(false),
21 {
22 }
unsigned int _eigen_kernel_counter
counter of eigen kernels
NonlinearSystem(FEProblemBase &problem, const std::string &name)
virtual const std::string & name() const
Definition: SystemBase.C:1293

◆ ~MooseEigenSystem()

MooseEigenSystem::~MooseEigenSystem ( )
virtual

Definition at line 24 of file MooseEigenSystem.C.

24 {}

Member Function Documentation

◆ activeAllMatrixTags()

void SystemBase::activeAllMatrixTags ( )
virtualinherited

Make all exsiting matrices ative.

Definition at line 1110 of file SystemBase.C.

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

1111 {
1112  auto num_matrix_tags = _subproblem.numMatrixTags();
1113 
1114  _matrix_tag_active_flags.resize(num_matrix_tags);
1115 
1116  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1117  if (hasMatrix(tag))
1118  _matrix_tag_active_flags[tag] = true;
1119  else
1120  _matrix_tag_active_flags[tag] = false;
1121 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:991
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:220

◆ activeMatrixTag()

void SystemBase::activeMatrixTag ( TagID  tag)
virtualinherited

Active a matrix for tag.

Definition at line 1075 of file SystemBase.C.

1076 {
1077  mooseAssert(_subproblem.matrixTagExists(tag),
1078  "Cannot active Matrix with matrix_tag : " << tag << "that does not exist");
1079 
1080  if (_matrix_tag_active_flags.size() < tag + 1)
1081  _matrix_tag_active_flags.resize(tag + 1);
1082 
1083  _matrix_tag_active_flags[tag] = true;
1084 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:991
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ activeOnOld()

bool MooseEigenSystem::activeOnOld ( )

Return if eigen kernels should be on old solution.

Definition at line 220 of file MooseEigenSystem.C.

Referenced by EigenKernel::enabled().

221 {
222  return _active_on_old;
223 }

◆ addBoundaryCondition()

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

Adds a boundary condition.

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

Definition at line 501 of file NonlinearSystemBase.C.

504 {
505  // ThreadID
506  THREAD_ID tid = 0;
507 
508  // Create the object
509  std::shared_ptr<BoundaryCondition> bc =
510  _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
512 
513  // Active BoundaryIDs for the object
514  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
515  auto bc_var = dynamic_cast<const MooseVariableFieldBase *>(&bc->variable());
516  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
517 
518  // Cast to the various types of BCs
519  std::shared_ptr<NodalBCBase> nbc = std::dynamic_pointer_cast<NodalBCBase>(bc);
520  std::shared_ptr<IntegratedBCBase> ibc = std::dynamic_pointer_cast<IntegratedBCBase>(bc);
521 
522  // NodalBCBase
523  if (nbc)
524  {
525  if (nbc->checkNodalVar() && !nbc->variable().isNodal())
526  mooseError("Trying to use nodal boundary condition '",
527  nbc->name(),
528  "' on a non-nodal variable '",
529  nbc->variable().name(),
530  "'.");
531 
532  _nodal_bcs.addObject(nbc);
533  _vars[tid].addBoundaryVars(boundary_ids, nbc->getCoupledVars());
534 
535  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
536  _has_nodalbc_save_in = true;
537  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
539 
540  // DirichletBCs that are preset
541  std::shared_ptr<DirichletBCBase> dbc = std::dynamic_pointer_cast<DirichletBCBase>(bc);
542  if (dbc && dbc->preset())
544 
545  std::shared_ptr<ADDirichletBCBase> addbc = std::dynamic_pointer_cast<ADDirichletBCBase>(bc);
546  if (addbc && addbc->preset())
548  }
549 
550  // IntegratedBCBase
551  else if (ibc)
552  {
553  _integrated_bcs.addObject(ibc, tid);
554  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
555 
556  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
557  _has_save_in = true;
558  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
559  _has_diag_save_in = true;
560 
561  for (tid = 1; tid < libMesh::n_threads(); tid++)
562  {
563  // Create the object
564  bc = _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
565 
566  // Give users opportunity to set some parameters
568 
569  // Active BoundaryIDs for the object
570  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
571  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
572 
573  ibc = std::static_pointer_cast<IntegratedBCBase>(bc);
574 
575  _integrated_bcs.addObject(ibc, tid);
576  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
577  }
578  }
579 
580  else
581  mooseError("Unknown BoundaryCondition type for object named ", bc->name());
582 }
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:299
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
Base class for automatic differentiation Dirichlet BCs.
Base boundary condition of a Dirichlet type.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
Factory & _factory
Definition: SystemBase.h:957
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:1293
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
Base class for deriving any boundary condition that works at nodes.
Definition: NodalBCBase.h:26
Base class for creating new types of boundary conditions.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
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:198
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ addConstraint()

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

Adds a Constraint.

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

Definition at line 585 of file NonlinearSystemBase.C.

588 {
589  std::shared_ptr<Constraint> constraint = _factory.create<Constraint>(c_name, name, parameters);
590  _constraints.addObject(constraint);
591  postAddResidualObject(*constraint);
592 
593  if (constraint && constraint->addCouplingEntriesToJacobian())
595 }
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
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
virtual const std::string & name() const
Definition: SystemBase.C:1293
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 
)
inherited

Adds a damper.

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

Definition at line 652 of file NonlinearSystemBase.C.

655 {
656  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
657  {
658  std::shared_ptr<Damper> damper = _factory.create<Damper>(damper_name, name, parameters, tid);
659 
660  // Attempt to cast to the damper types
661  std::shared_ptr<ElementDamper> ed = std::dynamic_pointer_cast<ElementDamper>(damper);
662  std::shared_ptr<NodalDamper> nd = std::dynamic_pointer_cast<NodalDamper>(damper);
663  std::shared_ptr<GeneralDamper> gd = std::dynamic_pointer_cast<GeneralDamper>(damper);
664 
665  if (gd)
666  {
668  break; // not threaded
669  }
670  else if (ed)
671  _element_dampers.addObject(ed, tid);
672  else if (nd)
673  _nodal_dampers.addObject(nd, tid);
674  else
675  mooseError("Invalid damper type");
676  }
677 }
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:299
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
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:1293
Base class for deriving nodal dampers.
Definition: NodalDamper.h:27
Base class for deriving element dampers.
Definition: ElementDamper.h:28
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:198

◆ addDGKernel()

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

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 612 of file NonlinearSystemBase.C.

615 {
616  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
617  {
618  auto dg_kernel = _factory.create<DGKernelBase>(dg_kernel_name, name, parameters, tid);
619  _dg_kernels.addObject(dg_kernel, tid);
620  postAddResidualObject(*dg_kernel);
621  }
622 
623  _doing_dg = true;
624 
625  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
626  _has_save_in = true;
627  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
628  _has_diag_save_in = true;
629 }
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
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:1293
bool _doing_dg
true if DG is active (optimization reasons)
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:198

◆ addDiracKernel()

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

Adds a Dirac kernel.

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

Definition at line 598 of file NonlinearSystemBase.C.

601 {
602  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
603  {
604  std::shared_ptr<DiracKernelBase> kernel =
605  _factory.create<DiracKernelBase>(kernel_name, name, parameters, tid);
606  postAddResidualObject(*kernel);
607  _dirac_kernels.addObject(kernel, tid);
608  }
609 }
unsigned int n_threads()
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
virtual const std::string & name() const
Definition: SystemBase.C:1293
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
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:198

◆ 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 1558 of file SystemBase.C.

Referenced by DisplacedSystem::addDotVectors().

1559 {
1560  if (_fe_problem.uDotRequested())
1561  _u_dot = &addVector("u_dot", true, GHOSTED);
1563  _u_dot_old = &addVector("u_dot_old", true, GHOSTED);
1565  _u_dotdot = &addVector("u_dotdot", true, GHOSTED);
1567  _u_dotdot_old = &addVector("u_dotdot_old", true, GHOSTED);
1568 }
virtual bool uDotDotOldRequested()
Get boolean flag to check whether old solution second time derivative needs to be stored...
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:979
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:976
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:954
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:974
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:981

◆ addImplicitGeometricCouplingEntries()

void NonlinearSystemBase::addImplicitGeometricCouplingEntries ( GeometricSearchData geom_search_data)
inherited

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 2211 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2212 {
2213  if (!hasMatrix(systemMatrixTag()))
2214  mooseError("Need a system matrix ");
2215 
2216  // At this point, have no idea how to make
2217  // this work with tag system
2218  auto & jacobian = getMatrix(systemMatrixTag());
2219 
2220  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
2221 
2222  findImplicitGeometricCouplingEntries(geom_search_data, graph);
2223 
2224  for (const auto & it : graph)
2225  {
2226  dof_id_type dof = it.first;
2227  const auto & row = it.second;
2228 
2229  for (const auto & coupled_dof : row)
2230  jacobian.add(dof, coupled_dof, 0);
2231  }
2232 }
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:299
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
uint8_t dof_id_type

◆ addImplicitGeometricCouplingEntriesToJacobian()

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

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 473 of file NonlinearSystemBase.h.

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

474  {
476  }
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 
)
inherited

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 632 of file NonlinearSystemBase.C.

635 {
636  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
637  {
638  std::shared_ptr<InterfaceKernelBase> interface_kernel =
639  _factory.create<InterfaceKernelBase>(interface_kernel_name, name, parameters, tid);
640  postAddResidualObject(*interface_kernel);
641 
642  const std::set<BoundaryID> & boundary_ids = interface_kernel->boundaryIDs();
643  auto ik_var = dynamic_cast<const MooseVariableFieldBase *>(&interface_kernel->variable());
644  _vars[tid].addBoundaryVar(boundary_ids, ik_var);
645 
646  _interface_kernels.addObject(interface_kernel, tid);
647  _vars[tid].addBoundaryVars(boundary_ids, interface_kernel->getCoupledVars());
648  }
649 }
unsigned int n_threads()
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
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:1293
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
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:198

◆ addKernel()

void MooseEigenSystem::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 from NonlinearSystemBase.

Definition at line 27 of file MooseEigenSystem.C.

30 {
31  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
32  {
33  // In the case of EigenKernels, we might need to add two to the system
34  if (parameters.have_parameter<bool>("eigen"))
35  {
36  {
37  // EigenKernel
38  parameters.set<bool>("implicit") = true;
39  std::shared_ptr<KernelBase> ekernel =
40  _factory.create<KernelBase>(kernel_name, name, parameters, tid);
41  if (parameters.get<bool>("eigen"))
42  markEigenVariable(parameters.get<NonlinearVariableName>("variable"));
43  _kernels.addObject(ekernel, tid);
44  }
45  if (parameters.get<bool>("eigen"))
46  {
47  // EigenKernel_old
48  parameters.set<bool>("implicit") = false;
49  std::string old_name(name + "_old");
50 
51  std::shared_ptr<KernelBase> ekernel =
52  _factory.create<KernelBase>(kernel_name, old_name, parameters, tid);
53  _eigen_var_names.insert(parameters.get<NonlinearVariableName>("variable"));
54  _kernels.addObject(ekernel, tid);
56  }
57  }
58  else // Standard nonlinear system kernel
59  {
60  // Create the kernel object via the factory
61  std::shared_ptr<KernelBase> kernel =
62  _factory.create<KernelBase>(kernel_name, name, parameters, tid);
63  _kernels.addObject(kernel, tid);
64  }
65  }
66 
67  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
68  _has_save_in = true;
69  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
70  _has_diag_save_in = true;
71 }
unsigned int _eigen_kernel_counter
counter of eigen kernels
unsigned int n_threads()
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1293
This is the common base class for the three main kernel types implemented in MOOSE, Kernel, VectorKernel and ArrayKernel.
Definition: KernelBase.h:22
MooseObjectTagWarehouse< KernelBase > _kernels
virtual void markEigenVariable(const VariableName &var_name)
Mark a variable as a variable of the eigen system.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
std::set< VariableName > _eigen_var_names
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
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:198

◆ 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 566 of file SystemBase.C.

567 {
568  if (!_subproblem.matrixTagExists(tag))
569  mooseError("Cannot add tagged matrix with TagID ",
570  tag,
571  " in system '",
572  name(),
573  "' because the tag does not exist in the problem");
574 
575  if (hasMatrix(tag))
576  return getMatrix(tag);
577 
578  const auto matrix_name = _subproblem.matrixTagName(tag);
579  SparseMatrix<Number> & mat = system().add_matrix(matrix_name);
580  associateMatrixToTag(mat, tag);
581 
582  return mat;
583 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual const std::string & name() const
Definition: SystemBase.C:1293
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1032
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual System & system()=0
Get the reference to the libMesh system.
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:335

◆ addNodalKernel()

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

Adds a NodalKernel.

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

Definition at line 470 of file NonlinearSystemBase.C.

473 {
474  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
475  {
476  // Create the kernel object via the factory and add to the warehouse
477  std::shared_ptr<NodalKernelBase> kernel =
478  _factory.create<NodalKernelBase>(kernel_name, name, parameters, tid);
479  _nodal_kernels.addObject(kernel, tid);
480  postAddResidualObject(*kernel);
481  }
482 
483  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
484  _has_save_in = true;
485  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
486  _has_diag_save_in = true;
487 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1293
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:198

◆ addScalarKernel()

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

Adds a scalar kernel.

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

Definition at line 490 of file NonlinearSystemBase.C.

493 {
494  std::shared_ptr<ScalarKernelBase> kernel =
495  _factory.create<ScalarKernelBase>(kernel_name, name, parameters);
496  postAddResidualObject(*kernel);
497  _scalar_kernels.addObject(kernel);
498 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
virtual const std::string & name() const
Definition: SystemBase.C:1293
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 1470 of file SystemBase.C.

Referenced by MooseVariableBase::initialSetup().

1471 {
1472  addVector("scaling_factors", /*project=*/false, libMesh::ParallelType::GHOSTED);
1474 }
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
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:1127
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132

◆ addSplit()

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

Adds a split.

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

Definition at line 680 of file NonlinearSystemBase.C.

683 {
684  std::shared_ptr<Split> split = _factory.create<Split>(split_name, name, parameters);
686 }
Base class for split-based preconditioners.
Definition: Split.h:25
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
virtual const std::string & name() const
Definition: SystemBase.C:1293
tbb::split split
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.

◆ addTimeIntegrator() [1/4]

void NonlinearSystemBase::addTimeIntegrator ( const std::string &  type,
const std::string &  name,
InputParameters parameters 
)
overridevirtualinherited

Add a time integrator.

Parameters
typeType of the integrator
nameThe name of the integrator
parametersIntegrator params

Reimplemented from SystemBase.

Definition at line 439 of file NonlinearSystemBase.C.

442 {
443  parameters.set<SystemBase *>("_sys") = this;
444 
445  std::shared_ptr<TimeIntegrator> ti = _factory.create<TimeIntegrator>(type, name, parameters);
446  _time_integrator = ti;
447 }
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
Factory & _factory
Definition: SystemBase.h:957
Base class for a system (of equations)
Definition: SystemBase.h:85
virtual const std::string & name() const
Definition: SystemBase.C:1293
Base class for time integrators.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013

◆ addTimeIntegrator() [2/4]

virtual void SystemBase::addTimeIntegrator
inlineinherited

Definition at line 871 of file SystemBase.h.

874  {
875  }

◆ addTimeIntegrator() [3/4]

virtual void SystemBase::addTimeIntegrator
inlineinherited

Definition at line 877 of file SystemBase.h.

877 {}

◆ addTimeIntegrator() [4/4]

virtual void SystemBase::addTimeIntegrator ( std::shared_ptr< TimeIntegrator )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 877 of file SystemBase.h.

877 {}

◆ 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 715 of file SystemBase.C.

Referenced by AuxiliarySystem::addVariable().

718 {
720 
721  auto components = parameters.get<unsigned int>("components");
722 
723  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
724  // System::add_variable method
725  std::set<SubdomainID> blocks;
726  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
727  for (const auto & subdomain_name : block_param)
728  {
729  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
730  blocks.insert(blk_id);
731  }
732 
733  auto fe_type = FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
734  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
735 
736  unsigned int var_num;
737 
738  if (var_type == "ArrayMooseVariable")
739  {
740  if (fe_type.family == NEDELEC_ONE || fe_type.family == LAGRANGE_VEC ||
741  fe_type.family == MONOMIAL_VEC || fe_type.family == RAVIART_THOMAS)
742  mooseError("Vector family type cannot be used in an array variable");
743 
744  // Build up the variable names
745  std::vector<std::string> var_names;
746  for (unsigned int i = 0; i < components; i++)
747  var_names.push_back(SubProblem::arrayVariableComponent(name, i));
748 
749  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
750  // _first_
751  var_num = system().add_variables(var_names, fe_type, &blocks) - (components - 1);
752 
753  // Set as array variable
754  if (parameters.isParamSetByUser("array") && !parameters.get<bool>("array"))
755  mooseError("Variable '",
756  name,
757  "' is an array variable ('components' > 1) but 'array' is set to false.");
758  parameters.set<bool>("array") = true;
759  }
760  else
761  var_num = system().add_variable(name, fe_type, &blocks);
762 
763  parameters.set<unsigned int>("_var_num") = var_num;
764  parameters.set<SystemBase *>("_system_base") = this;
765 
766  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
767  {
768  parameters.set<THREAD_ID>("tid") = tid;
769  std::shared_ptr<MooseVariableBase> var =
770  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
771 
772  _vars[tid].add(name, var);
773 
774  if (auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
775  {
776  auto required_size = var_num + components;
777  if (required_size > _numbered_vars[tid].size())
778  _numbered_vars[tid].resize(required_size);
779  for (MooseIndex(components) component = 0; component < components; ++component)
780  _numbered_vars[tid][var_num + component] = fe_var;
781 
782  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(fe_var))
783  _subproblem.addFunctor(name, *functor, tid);
784  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealVectorValue> *>(fe_var))
785  _subproblem.addFunctor(name, *functor, tid);
786  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<RealEigenVector> *>(fe_var))
787  _subproblem.addFunctor(name, *functor, tid);
788  else
789  mooseError("This should be a functor");
790  }
791 
792  if (var->blockRestricted())
793  for (const SubdomainID & id : var->blockIDs())
794  for (MooseIndex(components) component = 0; component < components; ++component)
795  _var_map[var_num + component].insert(id);
796  else
797  for (MooseIndex(components) component = 0; component < components; ++component)
798  _var_map[var_num + component] = std::set<SubdomainID>();
799  }
800 
801  // getMaxVariableNumber is an API method used in Rattlesnake
802  if (var_num > _max_var_number)
803  _max_var_number = var_num;
804 }
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:1016
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:299
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.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition: Factory.C:110
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:1332
Factory & _factory
Definition: SystemBase.h:957
Base class for a system (of equations)
Definition: SystemBase.h:85
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
subdomain_id_type SubdomainID
virtual System & system()=0
Get the reference to the libMesh system.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:966
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was by the user.
static std::string arrayVariableComponent(const std::string &var_name, unsigned int i)
Returns the variable name of a component of an array variable.
Definition: SubProblem.h:271
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
MooseMesh & _mesh
Definition: SystemBase.h:959
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:968
unsigned int THREAD_ID
Definition: MooseTypes.h:198
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1514

◆ 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 1150 of file SystemBase.C.

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

1153 {
1154  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
1155 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1004
Information about variables that will be copied.
Definition: SystemBase.h:67

◆ 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 176 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().

177 {
178  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
179 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:971

◆ 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 170 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().

171 {
172  _vars_to_be_zeroed_on_residual.push_back(var_name);
173 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:970

◆ addVector() [1/2]

NumericVector< Number > & SystemBase::addVector ( const std::string &  vector_name,
const bool  project,
const 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.

Definition at line 604 of file SystemBase.C.

Referenced by SystemBase::addDotVectors(), SystemBase::addScalingVector(), SecantSolve::allocateStorage(), SteffensenSolve::allocateStorage(), PicardSolve::allocateStorage(), AStableDirk4::AStableDirk4(), ExplicitTimeIntegrator::ExplicitTimeIntegrator(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), CentralDifference::initialSetup(), LStableDirk3::LStableDirk3(), LStableDirk4::LStableDirk4(), SystemBase::needSolutionState(), NonlinearSystemBase::residualGhosted(), and SystemBase::saveOldSolutions().

605 {
606  if (hasVector(vector_name))
607  return getVector(vector_name);
608 
609  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
610  return vec;
611 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ addVector() [2/2]

NumericVector< Number > & SystemBase::addVector ( TagID  tag,
const bool  project,
const 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.

Definition at line 614 of file SystemBase.C.

615 {
616  if (!_subproblem.vectorTagExists(tag))
617  mooseError("Cannot add tagged vector with TagID ",
618  tag,
619  " in system '",
620  name(),
621  "' because the tag does not exist in the problem");
622 
623  if (hasVector(tag))
624  {
625  auto & vec = getVector(tag);
626 
627  if (type != ParallelType::AUTOMATIC && vec.type() != type)
628  mooseError("Cannot add tagged vector '",
630  "', in system '",
631  name(),
632  "' because a vector with the same name was found with a different parallel type");
633 
634  return vec;
635  }
636 
637  const auto vector_name = _subproblem.vectorTagName(tag);
638  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
639  associateVectorToTag(vec, tag);
640 
641  return vec;
642 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:937
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
virtual System & system()=0
Get the reference to the libMesh system.
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:199
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ 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 1420 of file SystemBase.C.

Referenced by NonlinearSystemBase::computeScaling().

1421 {
1422  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1423  {
1424  auto & field_variables = _vars[thread].fieldVariables();
1425  for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1426  {
1427  auto factors = field_variables[i]->arrayScalingFactor();
1428  for (unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1429  factors[j] /= inverse_scaling_factors[p];
1430 
1431  field_variables[i]->scalingFactor(factors);
1432  }
1433 
1434  auto offset = field_variables.size();
1435 
1436  auto & scalar_variables = _vars[thread].scalars();
1437  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1438  scalar_variables[i]->scalingFactor(
1439  {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1440 
1441  if (thread == 0 && _verbose)
1442  {
1443  _console << "Automatic scaling factors:\n";
1444  auto original_flags = _console.flags();
1445  auto original_precision = _console.precision();
1446  _console.unsetf(std::ios_base::floatfield);
1447  _console.precision(6);
1448 
1449  for (const auto & field_variable : field_variables)
1450  {
1451  const auto & factors = field_variable->arrayScalingFactor();
1452  _console << " " << field_variable->name() << ":";
1453  for (const auto i : make_range(field_variable->count()))
1454  _console << " " << factors[i];
1455  _console << "\n";
1456  }
1457  for (const auto & scalar_variable : scalar_variables)
1458  _console << " " << scalar_variable->name() << ": " << scalar_variable->scalingFactor()
1459  << "\n";
1460  _console << "\n" << std::endl;
1461 
1462  // restore state
1463  _console.flags(original_flags);
1464  _console.precision(original_precision);
1465  }
1466  }
1467 }
std::ios_base::fmtflags flags() const
Return the current flags.
Definition: ConsoleStream.C:58
void unsetf(std::ios_base::fmtflags mask) const
Unset format flags.
Definition: ConsoleStream.C:40
std::streamsize precision() const
Return the current precision.
Definition: ConsoleStream.C:46
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:1022
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)
inlineinherited

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 483 of file NonlinearSystemBase.h.

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

◆ assembleScalingVector()

void NonlinearSystemBase::assembleScalingVector ( )
protectedinherited

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

Definition at line 3941 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeScaling(), and NonlinearSystemBase::preSolve().

3942 {
3943  if (!hasVector("scaling_factors"))
3944  // No variables have indicated they need scaling
3945  return;
3946 
3947  auto & scaling_vector = getVector("scaling_factors");
3948 
3949  const auto & lm_mesh = _mesh.getMesh();
3950  const auto & dof_map = dofMap();
3951 
3952  const auto & field_variables = _vars[0].fieldVariables();
3953  const auto & scalar_variables = _vars[0].scalars();
3954 
3955  std::vector<dof_id_type> dof_indices;
3956 
3957  for (const Elem * const elem :
3958  as_range(lm_mesh.active_local_elements_begin(), lm_mesh.active_local_elements_end()))
3959  for (const auto * const field_var : field_variables)
3960  {
3961  const auto & factors = field_var->arrayScalingFactor();
3962  for (const auto i : make_range(field_var->count()))
3963  {
3964  dof_map.dof_indices(elem, dof_indices, field_var->number() + i);
3965  for (const auto dof : dof_indices)
3966  scaling_vector.set(dof, factors[i]);
3967  }
3968  }
3969 
3970  for (const auto * const scalar_var : scalar_variables)
3971  {
3972  mooseAssert(scalar_var->count() == 1,
3973  "Scalar variables should always have only one component.");
3974  dof_map.SCALAR_dof_indices(dof_indices, scalar_var->number());
3975  for (const auto dof : dof_indices)
3976  scaling_vector.set(dof, scalar_var->scalingFactor());
3977  }
3978 
3979  // Parallel assemble
3980  scaling_vector.close();
3981 
3982  if (auto * displaced_problem = _fe_problem.getDisplacedProblem().get())
3983  // copy into the corresponding displaced system vector because they should be the exact same
3984  displaced_problem->systemBaseNonlinear(number()).getVector("scaling_factors") = scaling_vector;
3985 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1138
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3199
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:959
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:889

◆ assignMaxVarNDofsPerElem()

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

assign the maximum element dofs

Definition at line 585 of file SystemBase.h.

585 { _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:1007

◆ assignMaxVarNDofsPerNode()

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

assign the maximum node dofs

Definition at line 590 of file SystemBase.h.

590 { _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:1010

◆ associateMatrixToTag()

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

Associate a matrix to a tag.

Reimplemented in DisplacedSystem.

Definition at line 1032 of file SystemBase.C.

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

1033 {
1034  if (!_subproblem.matrixTagExists(tag))
1035  mooseError("Cannot associate matrix to tag ", tag, " because that tag does not exist");
1036 
1037  if (_tagged_matrices.size() < tag + 1)
1038  _tagged_matrices.resize(tag + 1);
1039 
1040  _tagged_matrices[tag] = &matrix;
1041 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:989
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ associateVectorToTag()

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

Associate a vector for a given tag.

Reimplemented in DisplacedSystem.

Definition at line 937 of file SystemBase.C.

Referenced by SystemBase::addVector(), DisplacedSystem::associateVectorToTag(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeNodalBCs(), FEProblemBase::computeResidual(), FEProblemBase::computeResidualAndJacobian(), FEProblemBase::computeResidualInternal(), NonlinearSystemBase::computeResidualTag(), FEProblemBase::computeResidualTag(), FEProblemBase::computeResidualType(), and SolverSystem::setSolution().

938 {
939  if (!_subproblem.vectorTagExists(tag))
940  mooseError("Cannot associate vector to tag ", tag, " because that tag does not exist");
941 
942  if (_tagged_vectors.size() < tag + 1)
943  _tagged_vectors.resize(tag + 1);
944 
945  _tagged_vectors[tag] = &vec;
946 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:987

◆ attachPreconditioner()

void NonlinearSystem::attachPreconditioner ( Preconditioner< Number > *  preconditioner)
overridevirtualinherited

Attach a customized preconditioner that requires physics knowledge.

Generic preconditioners should be implemented in PETSc, instead.

Implements NonlinearSystemBase.

Definition at line 335 of file NonlinearSystem.C.

336 {
337  nonlinearSolver()->attach_preconditioner(preconditioner);
338 }
void attach_preconditioner(Preconditioner< Number > *preconditioner)
virtual NonlinearSolver< Number > * nonlinearSolver() override

◆ 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 448 of file SystemBase.C.

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

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

◆ augmentSparsity()

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

Will modify the sparsity pattern to add logical geometric connections.

Implements SystemBase.

Definition at line 3377 of file NonlinearSystemBase.C.

3380 {
3382  {
3384 
3385  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
3386 
3388 
3391  graph);
3392 
3393  const dof_id_type first_dof_on_proc = dofMap().first_dof(processor_id());
3394  const dof_id_type end_dof_on_proc = dofMap().end_dof(processor_id());
3395 
3396  // The total number of dofs on and off processor
3397  const dof_id_type n_dofs_on_proc = dofMap().n_local_dofs();
3398  const dof_id_type n_dofs_not_on_proc = dofMap().n_dofs() - dofMap().n_local_dofs();
3399 
3400  for (const auto & git : graph)
3401  {
3402  dof_id_type dof = git.first;
3403  dof_id_type local_dof = dof - first_dof_on_proc;
3404 
3405  if (dof < first_dof_on_proc || dof >= end_dof_on_proc)
3406  continue;
3407 
3408  const auto & row = git.second;
3409 
3410  SparsityPattern::Row & sparsity_row = sparsity[local_dof];
3411 
3412  unsigned int original_row_length = sparsity_row.size();
3413 
3414  sparsity_row.insert(sparsity_row.end(), row.begin(), row.end());
3415 
3416  SparsityPattern::sort_row(
3417  sparsity_row.begin(), sparsity_row.begin() + original_row_length, sparsity_row.end());
3418 
3419  // Fix up nonzero arrays
3420  for (const auto & coupled_dof : row)
3421  {
3422  if (coupled_dof < first_dof_on_proc || coupled_dof >= end_dof_on_proc)
3423  {
3424  if (n_oz[local_dof] < n_dofs_not_on_proc)
3425  n_oz[local_dof]++;
3426  }
3427  else
3428  {
3429  if (n_nz[local_dof] < n_dofs_on_proc)
3430  n_nz[local_dof]++;
3431  }
3432  }
3433  }
3434  }
3435 }
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.
virtual GeometricSearchData & geomSearchData() override
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1138
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:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
processor_id_type processor_id() const
uint8_t dof_id_type

◆ 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 123 of file SystemBase.h.

Referenced by SubProblem::automaticScaling().

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

◆ 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 129 of file SystemBase.h.

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

◆ autoScalingParam()

void NonlinearSystemBase::autoScalingParam ( Real  resid_vs_jac_scaling_param)
inlineinherited

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 658 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

659  {
660  _resid_vs_jac_scaling_param = resid_vs_jac_scaling_param;
661  }
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...

◆ buildSystemDoFIndices()

void MooseEigenSystem::buildSystemDoFIndices ( SYSTEMTAG  tag = ALL)

Build DoF indices for a system.

Definition at line 226 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

227 {
228  if (tag == ALL)
229  {
230  }
231  else if (tag == EIGEN)
232  {
233  // build DoF indices for the eigen system
234  _eigen_var_indices.clear();
236  if (!_all_eigen_vars)
237  {
238  for (std::set<VariableName>::const_iterator it = getEigenVariableNames().begin();
239  it != getEigenVariableNames().end();
240  it++)
241  {
242  unsigned int i = sys().variable_number(*it);
243  std::set<dof_id_type> var_indices;
244  sys().local_dof_indices(i, var_indices);
245  _eigen_var_indices.insert(var_indices.begin(), var_indices.end());
246  }
247  }
248  }
249 }
const std::set< VariableName > & getEigenVariableNames() const
Get variable names of the eigen system.
std::set< dof_id_type > _eigen_var_indices
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:853
virtual NonlinearImplicitSystem & sys()

◆ checkInvalidSolution()

void SolverSystem::checkInvalidSolution ( )
protectedinherited

Definition at line 109 of file SolverSystem.C.

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

110 {
111  // determine whether solution invalid occurs in the converged solution
113 
114  // output the solution invalid summary
116  {
117  // sync all solution invalid counts to rank 0 process
119 
121  mooseWarning("The Solution Invalidity warnings are detected but silenced! "
122  "Use Problem/allow_invalid_solution=false to activate ");
123  else
124  // output the occurrence of solution invalid in a summary table
126  }
127 }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:333
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:138
bool allowInvalidSolution() const
Whether or not the invalid solutions are allowed.
bool _solution_is_invalid
Boolean to see if solution is invalid.
Definition: SolverSystem.h:87
bool solutionInvalid() const
Loop over all the tracked objects and determine whether solution invalid is detected.
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
void print(const ConsoleStream &console) const
Print the summary table of Solution Invalid warnings.
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
inherited

System Integrity Checks

Definition at line 3499 of file NonlinearSystemBase.C.

3500 {
3501  // Obtain all blocks and variables covered by all kernels
3502  std::set<SubdomainID> input_subdomains;
3503  std::set<std::string> kernel_variables;
3504 
3505  bool global_kernels_exist = false;
3506  global_kernels_exist |= _scalar_kernels.hasActiveObjects();
3507  global_kernels_exist |= _nodal_kernels.hasActiveObjects();
3508 
3509  _kernels.subdomainsCovered(input_subdomains, kernel_variables);
3510  _dg_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3511  _nodal_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3512  _scalar_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3513  _constraints.subdomainsCovered(input_subdomains, kernel_variables);
3514 
3515  if (_fe_problem.haveFV())
3516  {
3517  std::vector<FVElementalKernel *> fv_elemental_kernels;
3519  .query()
3520  .template condition<AttribSystem>("FVElementalKernel")
3521  .queryInto(fv_elemental_kernels);
3522 
3523  for (auto fv_kernel : fv_elemental_kernels)
3524  {
3525  if (fv_kernel->blockRestricted())
3526  for (auto block_id : fv_kernel->blockIDs())
3527  input_subdomains.insert(block_id);
3528  else
3529  global_kernels_exist = true;
3530  kernel_variables.insert(fv_kernel->variable().name());
3531 
3532  // Check for lagrange multiplier
3533  if (dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel))
3534  kernel_variables.insert(dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel)
3535  ->lambdaVariable()
3536  .name());
3537  }
3538 
3539  std::vector<FVFluxKernel *> fv_flux_kernels;
3541  .query()
3542  .template condition<AttribSystem>("FVFluxKernel")
3543  .queryInto(fv_flux_kernels);
3544 
3545  for (auto fv_kernel : fv_flux_kernels)
3546  {
3547  if (fv_kernel->blockRestricted())
3548  for (auto block_id : fv_kernel->blockIDs())
3549  input_subdomains.insert(block_id);
3550  else
3551  global_kernels_exist = true;
3552  kernel_variables.insert(fv_kernel->variable().name());
3553  }
3554 
3555  std::vector<FVInterfaceKernel *> fv_interface_kernels;
3557  .query()
3558  .template condition<AttribSystem>("FVInterfaceKernel")
3559  .queryInto(fv_interface_kernels);
3560 
3561  for (auto fvik : fv_interface_kernels)
3562  if (auto scalar_fvik = dynamic_cast<FVScalarLagrangeMultiplierInterface *>(fvik))
3563  kernel_variables.insert(scalar_fvik->lambdaVariable().name());
3564 
3565  std::vector<FVFluxBC *> fv_flux_bcs;
3567  .query()
3568  .template condition<AttribSystem>("FVFluxBC")
3569  .queryInto(fv_flux_bcs);
3570 
3571  for (auto fvbc : fv_flux_bcs)
3572  if (auto scalar_fvbc = dynamic_cast<FVBoundaryScalarLagrangeMultiplierConstraint *>(fvbc))
3573  kernel_variables.insert(scalar_fvbc->lambdaVariable().name());
3574  }
3575 
3576  // Check kernel coverage of subdomains (blocks) in your mesh
3577  if (!global_kernels_exist)
3578  {
3579  std::set<SubdomainID> difference;
3580  std::set_difference(mesh_subdomains.begin(),
3581  mesh_subdomains.end(),
3582  input_subdomains.begin(),
3583  input_subdomains.end(),
3584  std::inserter(difference, difference.end()));
3585 
3586  // there supposed to be no kernels on this lower-dimensional subdomain
3587  difference.erase(Moose::INTERNAL_SIDE_LOWERD_ID);
3588  difference.erase(Moose::BOUNDARY_SIDE_LOWERD_ID);
3589 
3590  if (!difference.empty())
3591  {
3592  std::vector<SubdomainID> difference_vec =
3593  std::vector<SubdomainID>(difference.begin(), difference.end());
3594  std::vector<SubdomainName> difference_names = _mesh.getSubdomainNames(difference_vec);
3595  std::stringstream missing_block_names;
3596  std::copy(difference_names.begin(),
3597  difference_names.end(),
3598  std::ostream_iterator<std::string>(missing_block_names, " "));
3599  std::stringstream missing_block_ids;
3600  std::copy(difference.begin(),
3601  difference.end(),
3602  std::ostream_iterator<unsigned int>(missing_block_ids, " "));
3603 
3604  mooseError("Each subdomain must contain at least one Kernel.\nThe following block(s) lack an "
3605  "active kernel: " +
3606  missing_block_names.str(),
3607  " (ids: ",
3608  missing_block_ids.str(),
3609  ")");
3610  }
3611  }
3612 
3613  // Check kernel use of variables
3614  std::set<VariableName> variables(getVariableNames().begin(), getVariableNames().end());
3615 
3616  std::set<VariableName> difference;
3617  std::set_difference(variables.begin(),
3618  variables.end(),
3619  kernel_variables.begin(),
3620  kernel_variables.end(),
3621  std::inserter(difference, difference.end()));
3622 
3623  // skip checks for varaibles defined on lower-dimensional subdomain
3624  std::set<VariableName> vars(difference);
3625  for (auto & var_name : vars)
3626  {
3627  auto blks = getSubdomainsForVar(var_name);
3628  if (blks.count(Moose::INTERNAL_SIDE_LOWERD_ID) || blks.count(Moose::BOUNDARY_SIDE_LOWERD_ID))
3629  difference.erase(var_name);
3630  }
3631 
3632  if (!difference.empty())
3633  {
3634  std::stringstream missing_kernel_vars;
3635  std::copy(difference.begin(),
3636  difference.end(),
3637  std::ostream_iterator<std::string>(missing_kernel_vars, " "));
3638  mooseError("Each variable must be referenced by at least one active Kernel.\nThe following "
3639  "variable(s) lack an active kernel: " +
3640  missing_kernel_vars.str());
3641  }
3642 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
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:299
const SubdomainID BOUNDARY_SIDE_LOWERD_ID
Definition: MooseTypes.C:21
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
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:1544
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
MooseMesh & _mesh
Definition: SystemBase.h:959
bool hasActiveObjects(THREAD_ID tid=0) const
const SubdomainID INTERNAL_SIDE_LOWERD_ID
Definition: MooseTypes.C:20
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:853
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:752
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 1538 of file SystemBase.C.

Referenced by SubProblem::clearAllDofIndices().

1539 {
1540  for (auto & var_warehouse : _vars)
1541  var_warehouse.clearAllDofIndices();
1542 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ closeTaggedMatrices()

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

Close all matrices associated the tags.

Definition at line 1016 of file SystemBase.C.

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

1017 {
1018  for (auto tag : tags)
1019  if (hasMatrix(tag))
1020  getMatrix(tag).close();
1021 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual void close()=0
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980

◆ closeTaggedVector()

void SystemBase::closeTaggedVector ( const TagID  tag)
inherited

Close vector with the given tag.

Definition at line 645 of file SystemBase.C.

Referenced by SystemBase::closeTaggedVectors().

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

◆ closeTaggedVectors()

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

Close all vectors for given tags.

Definition at line 664 of file SystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags(), and NonlinearSystemBase::computeResidualTags().

665 {
666  for (const auto tag : tags)
667  closeTaggedVector(tag);
668 }
void closeTaggedVector(const TagID tag)
Close vector with the given tag.
Definition: SystemBase.C:645

◆ combineSystemSolution()

void MooseEigenSystem::combineSystemSolution ( SYSTEMTAG  tag,
const std::vector< Real > &  coefficients 
)

Linear combination of the solution vectors.

Parameters
tagSystem tag.
coefficientsCoefficients for current, old and older solutions.

Definition at line 103 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::chebyshev().

104 {
105  mooseAssert(coefficients.size() > 0 && coefficients.size() <= 3, "Size error on coefficients");
106  if (tag == ALL)
107  {
108  solution().scale(coefficients[0]);
109  if (coefficients.size() > 1)
110  solution().add(coefficients[1], solutionOld());
111  if (coefficients.size() > 2)
112  solution().add(coefficients[2], solutionOlder());
113  }
114  else if (tag == EIGEN)
115  {
116  if (_all_eigen_vars)
117  {
118  solution().scale(coefficients[0]);
119  if (coefficients.size() > 1)
120  solution().add(coefficients[1], solutionOld());
121  if (coefficients.size() > 2)
122  solution().add(coefficients[2], solutionOlder());
123  }
124  else
125  {
126  if (coefficients.size() > 2)
127  {
128  for (const auto & dof : _eigen_var_indices)
129  {
130  Real t = solution()(dof) * coefficients[0];
131  t += solutionOld()(dof) * coefficients[1];
132  t += solutionOlder()(dof) * coefficients[2];
133  solution().set(dof, t);
134  }
135  }
136  else if (coefficients.size() > 1)
137  {
138  for (const auto & dof : _eigen_var_indices)
139  {
140  Real t = solution()(dof) * coefficients[0];
141  t += solutionOld()(dof) * coefficients[1];
142  solution().set(dof, t);
143  }
144  }
145  else
146  {
147  for (const auto & dof : _eigen_var_indices)
148  {
149  Real t = solution()(dof) * coefficients[0];
150  solution().set(dof, t);
151  }
152  }
153  }
154  }
155  solution().close();
156  update();
157 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
NumericVector< Number > & solution()
Definition: SystemBase.h:182
NumericVector< Number > & solutionOlder()
Definition: SystemBase.h:184
virtual void scale(const Number factor)=0
virtual void close()=0
std::set< dof_id_type > _eigen_var_indices
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void set(const numeric_index_type i, const Number value)=0
virtual void add(const numeric_index_type i, const Number value)=0
NumericVector< Number > & solutionOld()
Definition: SystemBase.h:183

◆ compute()

void SolverSystem::compute ( ExecFlagType  type)
overridevirtualinherited

Compute time derivatives, auxiliary variables, etc.

Parameters
typeOur current execution stage

Implements SystemBase.

Definition at line 130 of file SolverSystem.C.

131 {
132  // Let's try not to overcompute
133  bool compute_tds = false;
134  if (type == EXEC_LINEAR)
135  compute_tds = true;
136  else if (type == EXEC_NONLINEAR)
137  {
139  compute_tds = true;
140  }
141  else if ((type == EXEC_TIMESTEP_END) || (type == EXEC_FINAL))
142  {
144  // We likely don't have a final residual evaluation upon which we compute the time derivatives
145  // so we need to do so now
146  compute_tds = true;
147  }
148 
149  if (compute_tds && _fe_problem.dt() > 0. && _time_integrator)
150  {
151  // avoid division by dt which might be zero.
152  _time_integrator->preStep();
153  _time_integrator->computeTimeDerivatives();
154  }
155 }
SolverParams & solverParams()
Get the solver parameters.
Solving a linear problem.
Definition: MooseTypes.h:761
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:32
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:94
Moose::SolveType _type
Definition: SolverParams.h:19
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:29
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:30
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013
virtual Real & dt() const
const ExecFlagType EXEC_FINAL
Definition: Moose.C:38

◆ computeDamping()

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

Compute damping.

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

Definition at line 3225 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeDamping().

3227 {
3228  // Default to no damping
3229  Real damping = 1.0;
3230  bool has_active_dampers = false;
3231 
3232  try
3233  {
3235  {
3236  PARALLEL_TRY
3237  {
3238  TIME_SECTION("computeDampers", 3, "Computing Dampers");
3239  has_active_dampers = true;
3242  Threads::parallel_reduce(*_mesh.getActiveLocalElementRange(), cid);
3243  damping = std::min(cid.damping(), damping);
3244  }
3245  PARALLEL_CATCH;
3246  }
3247 
3249  {
3250  PARALLEL_TRY
3251  {
3252  TIME_SECTION("computeDamping::element", 3, "Computing Element Damping");
3253 
3254  has_active_dampers = true;
3257  Threads::parallel_reduce(*_mesh.getLocalNodeRange(), cndt);
3258  damping = std::min(cndt.damping(), damping);
3259  }
3260  PARALLEL_CATCH;
3261  }
3262 
3264  {
3265  PARALLEL_TRY
3266  {
3267  TIME_SECTION("computeDamping::general", 3, "Computing General Damping");
3268 
3269  has_active_dampers = true;
3270  const auto & gdampers = _general_dampers.getActiveObjects();
3271  for (const auto & damper : gdampers)
3272  {
3273  Real gd_damping = damper->computeDamping(solution, update);
3274  try
3275  {
3276  damper->checkMinDamping(gd_damping);
3277  }
3278  catch (MooseException & e)
3279  {
3281  }
3282  damping = std::min(gd_damping, damping);
3283  }
3284  }
3285  PARALLEL_CATCH;
3286  }
3287  }
3288  catch (MooseException & e)
3289  {
3290  // The buck stops here, we have already handled the exception by
3291  // calling stopSolve(), it is now up to PETSc to return a
3292  // "diverged" reason during the next solve.
3293  }
3294 
3295  _communicator.min(damping);
3296 
3297  if (has_active_dampers && damping < 1.0)
3298  _console << " Damping factor: " << damping << std::endl;
3299 
3300  return damping;
3301 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
virtual const char * what() const
Get out the error message.
NumericVector< Number > & solution()
Definition: SystemBase.h:182
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
ConstNodeRange * getLocalNodeRange()
Definition: MooseMesh.C:1078
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:954
Provides a way for users to bail out of the current solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseMesh & _mesh
Definition: SystemBase.h:959
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 
)
protectedinherited

Definition at line 3304 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal(), and NonlinearSystemBase::computeResidualInternal().

3305 {
3307 
3308  std::set<const Elem *> dirac_elements;
3309 
3311  {
3312  TIME_SECTION("computeDirac", 3, "Computing DiracKernels");
3313 
3314  // TODO: Need a threading fix... but it's complicated!
3315  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
3316  {
3317  const auto & dkernels = _dirac_kernels.getActiveObjects(tid);
3318  for (const auto & dkernel : dkernels)
3319  {
3320  dkernel->clearPoints();
3321  dkernel->addPoints();
3322  }
3323  }
3324 
3325  ComputeDiracThread cd(_fe_problem, tags, is_jacobian);
3326 
3327  _fe_problem.getDiracElements(dirac_elements);
3328 
3329  DistElemRange range(dirac_elements.begin(), dirac_elements.end(), 1);
3330  // TODO: Make Dirac work thread!
3331  // Threads::parallel_reduce(range, cd);
3332 
3333  cd(range);
3334  }
3335 }
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:954
StoredRange< std::set< const Elem * >::const_iterator, const Elem * > DistElemRange
bool hasActiveObjects(THREAD_ID tid=0) const
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ computedScalingJacobian()

bool NonlinearSystemBase::computedScalingJacobian ( ) const
inlineinherited

Definition at line 73 of file NonlinearSystemBase.h.

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

◆ computeJacobian() [1/2]

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

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

Definition at line 3075 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobian().

3076 {
3078 
3079  computeJacobianTags(tags);
3080 
3082 }
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
void computeJacobianTags(const std::set< TagID > &tags)
Computes multiple (tag associated) Jacobian matricese.
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1032
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1044

◆ computeJacobian() [2/2]

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

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

Definition at line 3062 of file NonlinearSystemBase.C.

3063 {
3064  _nl_matrix_tags.clear();
3065 
3066  auto & tags = _fe_problem.getMatrixTags();
3067 
3068  for (auto & tag : tags)
3069  _nl_matrix_tags.insert(tag.second);
3070 
3071  computeJacobian(jacobian, _nl_matrix_tags);
3072 }
void computeJacobian(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:225
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ computeJacobianBlocks() [1/2]

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

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 3104 of file NonlinearSystemBase.C.

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

3105 {
3106  _nl_matrix_tags.clear();
3107 
3108  auto & tags = _fe_problem.getMatrixTags();
3109  for (auto & tag : tags)
3110  _nl_matrix_tags.insert(tag.second);
3111 
3113 }
void computeJacobianBlocks(std::vector< JacobianBlock *> &blocks)
Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditio...
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:225
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ computeJacobianBlocks() [2/2]

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

Definition at line 3116 of file NonlinearSystemBase.C.

3118 {
3119  TIME_SECTION("computeJacobianBlocks", 3);
3120  FloatingPointExceptionGuard fpe_guard(_app);
3121 
3122  for (unsigned int i = 0; i < blocks.size(); i++)
3123  {
3124  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3125 
3126  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3127  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
3128  PETSC_TRUE);
3130  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3131  MAT_NEW_NONZERO_ALLOCATION_ERR,
3132  PETSC_TRUE);
3133 
3134  jacobian.zero();
3135  }
3136 
3137  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
3139 
3140  PARALLEL_TRY
3141  {
3143  ComputeJacobianBlocksThread cjb(_fe_problem, blocks, tags);
3144  Threads::parallel_reduce(elem_range, cjb);
3145  }
3146  PARALLEL_CATCH;
3147 
3148  for (unsigned int i = 0; i < blocks.size(); i++)
3149  blocks[i]->_jacobian.close();
3150 
3151  for (unsigned int i = 0; i < blocks.size(); i++)
3152  {
3153  libMesh::System & precond_system = blocks[i]->_precond_system;
3154  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3155 
3156  unsigned int ivar = blocks[i]->_ivar;
3157  unsigned int jvar = blocks[i]->_jvar;
3158 
3159  // Dirichlet BCs
3160  std::vector<numeric_index_type> zero_rows;
3161  PARALLEL_TRY
3162  {
3163  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
3164  for (const auto & bnode : bnd_nodes)
3165  {
3166  BoundaryID boundary_id = bnode->_bnd_id;
3167  Node * node = bnode->_node;
3168 
3169  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
3170  {
3171  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
3172 
3173  if (node->processor_id() == processor_id())
3174  {
3175  _fe_problem.reinitNodeFace(node, boundary_id, 0);
3176 
3177  for (const auto & bc : bcs)
3178  if (bc->variable().number() == ivar && bc->shouldApply())
3179  {
3180  // The first zero is for the variable number... there is only one variable in
3181  // each mini-system The second zero only works with Lagrange elements!
3182  zero_rows.push_back(node->dof_number(precond_system.number(), 0, 0));
3183  }
3184  }
3185  }
3186  }
3187  }
3188  PARALLEL_CATCH;
3189 
3190  jacobian.close();
3191 
3192  // This zeroes the rows corresponding to Dirichlet BCs and puts a 1.0 on the diagonal
3193  if (ivar == jvar)
3194  jacobian.zero_rows(zero_rows, 1.0);
3195  else
3196  jacobian.zero_rows(zero_rows, 0.0);
3197 
3198  jacobian.close();
3199  }
3200 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
unsigned int n_threads()
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
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
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
unsigned int number() const
virtual void zero()=0
boundary_id_type BoundaryID
virtual void zero_rows(std::vector< numeric_index_type > &rows, Number 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:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
virtual void close()=0
MooseMesh & _mesh
Definition: SystemBase.h:959
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092

◆ computeJacobianInternal()

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

Form multiple matrices for all the tags.

Users should not call this func directly.

Definition at line 2719 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianTags().

2720 {
2721  TIME_SECTION("computeJacobianInternal", 3);
2722 
2724 
2725  // Make matrix ready to use
2727 
2728  for (auto tag : tags)
2729  {
2730  if (!hasMatrix(tag))
2731  continue;
2732 
2733  auto & jacobian = getMatrix(tag);
2734  // Necessary for speed
2735  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
2736  {
2737  MatSetOption(petsc_matrix->mat(),
2738  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2739  PETSC_TRUE);
2741  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
2742  }
2743  }
2744 
2745  jacobianSetup();
2746 
2747  // Jacobian contributions from UOs - for now this is used for ray tracing
2748  // and ray kernels that contribute to the Jacobian (think line sources)
2749  std::vector<UserObject *> uos;
2751  .query()
2752  .condition<AttribSystem>("UserObject")
2753  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
2754  .queryInto(uos);
2755  for (auto & uo : uos)
2756  uo->jacobianSetup();
2757  for (auto & uo : uos)
2758  {
2759  uo->initialize();
2760  uo->execute();
2761  uo->finalize();
2762  }
2763 
2764  // reinit scalar variables
2765  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
2767 
2768  PARALLEL_TRY
2769  {
2770  // We would like to compute ScalarKernels, block NodalKernels, FVFluxKernels, and mortar objects
2771  // up front because we want these included whether we are computing an ordinary Jacobian or a
2772  // Jacobian for determining variable scaling factors
2774 
2775  // Block restricted Nodal Kernels
2777  {
2779  ConstNodeRange & range = *_mesh.getLocalNodeRange();
2780  Threads::parallel_reduce(range, cnkjt);
2781 
2782  unsigned int n_threads = libMesh::n_threads();
2783  for (unsigned int i = 0; i < n_threads;
2784  i++) // Add any cached jacobians that might be hanging around
2786  }
2787 
2788  using FVRange = StoredRange<MooseMesh::const_face_info_iterator, const FaceInfo *>;
2789  if (_fe_problem.haveFV())
2790  {
2791  // the same loop works for both residual and jacobians because it keys
2792  // off of FEProblem's _currently_computing_jacobian parameter
2794  _fe_problem, this->number(), tags, /*on_displaced=*/false);
2796  Threads::parallel_reduce(faces, fvj);
2797  }
2798  if (auto displaced_problem = _fe_problem.getDisplacedProblem();
2799  displaced_problem && displaced_problem->haveFV())
2800  {
2802  _fe_problem, this->number(), tags, /*on_displaced=*/true);
2803  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
2804  displaced_problem->mesh().ownedFaceInfoEnd());
2805  Threads::parallel_reduce(faces, fvr);
2806  }
2807 
2809 
2810  // Get our element range for looping over
2812 
2814  {
2815  // Only compute Jacobians corresponding to the diagonals of volumetric compute objects
2816  // because this typically gives us a good representation of the physics. NodalBCs and
2817  // Constraints can introduce dramatically different scales (often order unity).
2818  // IntegratedBCs and/or InterfaceKernels may use penalty factors. DGKernels may be ok, but
2819  // they are almost always used in conjunction with Kernels
2821  Threads::parallel_reduce(elem_range, cj);
2822  unsigned int n_threads = libMesh::n_threads();
2823  for (unsigned int i = 0; i < n_threads;
2824  i++) // Add any Jacobian contributions still hanging around
2826 
2827  // Check whether any exceptions were thrown and propagate this information for parallel
2828  // consistency before
2829  // 1) we do parallel communication when closing tagged matrices
2830  // 2) early returning before reaching our PARALLEL_CATCH below
2832 
2833  closeTaggedMatrices(tags);
2834 
2835  return;
2836  }
2837 
2838  switch (_fe_problem.coupling())
2839  {
2840  case Moose::COUPLING_DIAG:
2841  {
2843  Threads::parallel_reduce(elem_range, cj);
2844 
2845  unsigned int n_threads = libMesh::n_threads();
2846  for (unsigned int i = 0; i < n_threads;
2847  i++) // Add any Jacobian contributions still hanging around
2849 
2850  // Boundary restricted Nodal Kernels
2852  {
2854  ConstBndNodeRange & bnd_range = *_mesh.getBoundaryNodeRange();
2855 
2856  Threads::parallel_reduce(bnd_range, cnkjt);
2857  unsigned int n_threads = libMesh::n_threads();
2858  for (unsigned int i = 0; i < n_threads;
2859  i++) // Add any cached jacobians that might be hanging around
2861  }
2862  }
2863  break;
2864 
2865  default:
2867  {
2869  Threads::parallel_reduce(elem_range, cj);
2870  unsigned int n_threads = libMesh::n_threads();
2871 
2872  for (unsigned int i = 0; i < n_threads; i++)
2874 
2875  // Boundary restricted Nodal Kernels
2877  {
2879  ConstBndNodeRange & bnd_range = *_mesh.getBoundaryNodeRange();
2880 
2881  Threads::parallel_reduce(bnd_range, cnkjt);
2882  unsigned int n_threads = libMesh::n_threads();
2883  for (unsigned int i = 0; i < n_threads;
2884  i++) // Add any cached jacobians that might be hanging around
2886  }
2887  }
2888  break;
2889  }
2890 
2891  computeDiracContributions(tags, true);
2892 
2893  static bool first = true;
2894 
2895  // This adds zeroes into geometric coupling entries to ensure they stay in the matrix
2897  {
2898  first = false;
2900 
2903  }
2904  }
2905  PARALLEL_CATCH;
2906 
2907  // Have no idea how to have constraints work
2908  // with the tag system
2909  PARALLEL_TRY
2910  {
2911  // Add in Jacobian contributions from other Constraints
2912  if (_fe_problem._has_constraints && tags.count(systemMatrixTag()))
2913  {
2914  // Some constraints need values from the Jacobian
2915  closeTaggedMatrices(tags);
2916 
2917  // Nodal Constraints
2919 
2920  // Undisplaced Constraints
2921  constraintJacobians(false);
2922 
2923  // Displaced Constraints
2925  constraintJacobians(true);
2926  }
2927  }
2928  PARALLEL_CATCH;
2929 
2930  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
2931  // on boundary nodes
2932  if (_has_diag_save_in)
2934 
2935  PARALLEL_TRY
2936  {
2937  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2938  // Select nodal kernels
2939  if (tags.size() == _fe_problem.numMatrixTags() || !tags.size())
2940  nbc_warehouse = &_nodal_bcs;
2941  else if (tags.size() == 1)
2942  nbc_warehouse = &(_nodal_bcs.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
2943  else
2944  nbc_warehouse = &(_nodal_bcs.getMatrixTagsObjectWarehouse(tags, 0));
2945 
2946  if (nbc_warehouse->hasActiveObjects())
2947  {
2948  // We may be switching from add to set. Moreover, we rely on a call to MatZeroRows to enforce
2949  // the nodal boundary condition constraints which requires that the matrix be truly assembled
2950  // as opposed to just flushed. Consequently we can't do the following despite any desire to
2951  // keep our initial sparsity pattern honored (see https://gitlab.com/petsc/petsc/-/issues/852)
2952  //
2953  // flushTaggedMatrices(tags);
2954  closeTaggedMatrices(tags);
2955 
2956  // Cache the information about which BCs are coupled to which
2957  // variables, so we don't have to figure it out for each node.
2958  std::map<std::string, std::set<unsigned int>> bc_involved_vars;
2959  const std::set<BoundaryID> & all_boundary_ids = _mesh.getBoundaryIDs();
2960  for (const auto & bid : all_boundary_ids)
2961  {
2962  // Get reference to all the NodalBCs for this ID. This is only
2963  // safe if there are NodalBCBases there to be gotten...
2964  if (nbc_warehouse->hasActiveBoundaryObjects(bid))
2965  {
2966  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(bid);
2967  for (const auto & bc : bcs)
2968  {
2969  const std::vector<MooseVariableFEBase *> & coupled_moose_vars =
2970  bc->getCoupledMooseVars();
2971 
2972  // Create the set of "involved" MOOSE nonlinear vars, which includes all coupled vars
2973  // and the BC's own variable
2974  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
2975  for (const auto & coupled_var : coupled_moose_vars)
2976  if (coupled_var->kind() == Moose::VAR_SOLVER)
2977  var_set.insert(coupled_var->number());
2978 
2979  var_set.insert(bc->variable().number());
2980  }
2981  }
2982  }
2983 
2984  // reinit scalar variables again. This reinit does not re-fill any of the scalar variable
2985  // solution arrays because that was done above. It only will reorder the derivative
2986  // information for AD calculations to be suitable for NodalBC calculations
2987  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
2988  _fe_problem.reinitScalars(tid, true);
2989 
2990  // Get variable coupling list. We do all the NodalBCBase stuff on
2991  // thread 0... The couplingEntries() data structure determines
2992  // which variables are "coupled" as far as the preconditioner is
2993  // concerned, not what variables a boundary condition specifically
2994  // depends on.
2995  auto & coupling_entries = _fe_problem.couplingEntries(/*_tid=*/0, this->number());
2996 
2997  // Compute Jacobians for NodalBCBases
2998  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
2999  for (const auto & bnode : bnd_nodes)
3000  {
3001  BoundaryID boundary_id = bnode->_bnd_id;
3002  Node * node = bnode->_node;
3003 
3004  if (nbc_warehouse->hasActiveBoundaryObjects(boundary_id) &&
3005  node->processor_id() == processor_id())
3006  {
3007  _fe_problem.reinitNodeFace(node, boundary_id, 0);
3008 
3009  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
3010  for (const auto & bc : bcs)
3011  {
3012  // Get the set of involved MOOSE vars for this BC
3013  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
3014 
3015  // Loop over all the variables whose Jacobian blocks are
3016  // actually being computed, call computeOffDiagJacobian()
3017  // for each one which is actually coupled (otherwise the
3018  // value is zero.)
3019  for (const auto & it : coupling_entries)
3020  {
3021  unsigned int ivar = it.first->number(), jvar = it.second->number();
3022 
3023  // We are only going to call computeOffDiagJacobian() if:
3024  // 1.) the BC's variable is ivar
3025  // 2.) jvar is "involved" with the BC (including jvar==ivar), and
3026  // 3.) the BC should apply.
3027  if ((bc->variable().number() == ivar) && var_set.count(jvar) && bc->shouldApply())
3028  bc->computeOffDiagJacobian(jvar);
3029  }
3030 
3031  const auto & coupled_scalar_vars = bc->getCoupledMooseScalarVars();
3032  for (const auto & jvariable : coupled_scalar_vars)
3033  if (hasScalarVariable(jvariable->name()))
3034  bc->computeOffDiagJacobianScalar(jvariable->number());
3035  }
3036  }
3037  } // end loop over boundary nodes
3038 
3039  // Set the cached NodalBCBase values in the Jacobian matrix
3041  }
3042  }
3043  PARALLEL_CATCH;
3044 
3045  closeTaggedMatrices(tags);
3046 
3047  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
3048  // on boundary nodes
3051 
3052  if (hasDiagSaveIn())
3054 
3055  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
3056  // counters
3059 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
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
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:182
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:1293
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
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
bool hasDiagSaveIn() const
Weather or not the nonlinear system has diagonal Jacobian save-ins.
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
ConstNodeRange * getLocalNodeRange()
Definition: MooseMesh.C:1078
virtual GeometricSearchData & geomSearchData() override
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1016
void solutionInvalidAccumulation()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
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:138
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...
StoredRange< MeshBase::const_node_iterator, const Node *> ConstNodeRange
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:1110
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
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:220
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
void constraintJacobians(bool displaced)
Add jacobian contributions from Constraints.
MooseMesh & _mesh
Definition: SystemBase.h:959
bool hasActiveObjects(THREAD_ID tid=0) const
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
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:4486
Moose::CouplingType coupling()
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. ...
Definition: MooseMesh.C:2720
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:48
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:1302
bool _has_constraints
Whether or not this system has any Constraints.
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:832
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:3811
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
virtual void jacobianSetup() override
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092
virtual void addCachedJacobian(const THREAD_ID tid) override
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:794

◆ computeJacobianTags()

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

Computes multiple (tag associated) Jacobian matricese.

Definition at line 3085 of file NonlinearSystemBase.C.

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

3086 {
3087  TIME_SECTION("computeJacobianTags", 5);
3088 
3089  FloatingPointExceptionGuard fpe_guard(_app);
3090 
3091  try
3092  {
3094  }
3095  catch (MooseException & e)
3096  {
3097  // The buck stops here, we have already handled the exception by
3098  // calling stopSolve(), it is now up to PETSc to return a
3099  // "diverged" reason during the next solve.
3100  }
3101 }
Scope guard for starting and stopping Floating Point Exception Trapping.
MooseApp & _app
Definition: SystemBase.h:956
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)
protectedinherited

Enforces nodal boundary conditions.

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

Definition at line 1975 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeNodalBCs(), and NonlinearSystemBase::computeResidualTags().

1976 {
1977  _nl_vector_tags.clear();
1978 
1979  const auto & residual_vector_tags = _fe_problem.getVectorTags(Moose::VECTOR_TAG_RESIDUAL);
1980  for (const auto & residual_vector_tag : residual_vector_tags)
1981  _nl_vector_tags.insert(residual_vector_tag._id);
1982 
1984  computeNodalBCs(residual, _nl_vector_tags);
1986 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:949
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:937
std::vector< VectorTag > getVectorTags(const std::set< TagID > &tag_ids) const
Definition: SubProblem.C:150
TagID residualVectorTag() const override
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
void computeNodalBCs(NumericVector< Number > &residual)
Enforces nodal boundary conditions.

◆ computeNodalBCs() [2/3]

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

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

Definition at line 1989 of file NonlinearSystemBase.C.

1990 {
1992 
1993  computeNodalBCs(tags);
1994 
1996 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:949
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:937
TagID residualVectorTag() const override
void computeNodalBCs(NumericVector< Number > &residual)
Enforces nodal boundary conditions.

◆ computeNodalBCs() [3/3]

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

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

Definition at line 1999 of file NonlinearSystemBase.C.

2000 {
2001  // We need to close the diag_save_in variables on the aux system before NodalBCBases clear the
2002  // dofs on boundary nodes
2003  if (_has_save_in)
2005 
2006  PARALLEL_TRY
2007  {
2008  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
2009 
2010  if (!bnd_nodes.empty())
2011  {
2012  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2013 
2014  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2015 
2016  // Select nodal kernels
2017  if (tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL) || !tags.size())
2018  nbc_warehouse = &_nodal_bcs;
2019  else if (tags.size() == 1)
2020  nbc_warehouse = &(_nodal_bcs.getVectorTagObjectWarehouse(*(tags.begin()), 0));
2021  else
2022  nbc_warehouse = &(_nodal_bcs.getVectorTagsObjectWarehouse(tags, 0));
2023 
2024  for (const auto & bnode : bnd_nodes)
2025  {
2026  BoundaryID boundary_id = bnode->_bnd_id;
2027  Node * node = bnode->_node;
2028 
2029  if (node->processor_id() == processor_id())
2030  {
2031  // reinit variables in nodes
2032  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2033  if (nbc_warehouse->hasActiveBoundaryObjects(boundary_id))
2034  {
2035  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
2036  for (const auto & nbc : bcs)
2037  if (nbc->shouldApply())
2038  nbc->computeResidual();
2039  }
2040  }
2041  }
2042  }
2043  }
2044  PARALLEL_CATCH;
2045 
2046  if (_Re_time)
2047  _Re_time->close();
2048  _Re_non_time->close();
2049 }
NumericVector< Number > * _Re_time
residual vector for time contributions
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:182
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
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:954
MooseMesh & _mesh
Definition: SystemBase.h:959
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:173
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092

◆ computeNodalBCsResidualAndJacobian()

void NonlinearSystemBase::computeNodalBCsResidualAndJacobian ( )
protectedinherited

compute the residual and Jacobian for nodal boundary conditions

Definition at line 2052 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

2053 {
2054  PARALLEL_TRY
2055  {
2056  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
2057 
2058  if (!bnd_nodes.empty())
2059  {
2060  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2061 
2062  for (const auto & bnode : bnd_nodes)
2063  {
2064  BoundaryID boundary_id = bnode->_bnd_id;
2065  Node * node = bnode->_node;
2066 
2067  if (node->processor_id() == processor_id())
2068  {
2069  // reinit variables in nodes
2070  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2071  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
2072  {
2073  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
2074  for (const auto & nbc : bcs)
2075  if (nbc->shouldApply())
2076  nbc->computeResidualAndJacobian();
2077  }
2078  }
2079  }
2080  }
2081  }
2082  PARALLEL_CATCH;
2083 
2084  // Set the cached NodalBCBase values in the Jacobian matrix
2086 }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
boundary_id_type BoundaryID
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
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:954
MooseMesh & _mesh
Definition: SystemBase.h:959
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4486
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:794

◆ computeResidual()

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

Form a residual vector for a given tag.

Definition at line 764 of file NonlinearSystemBase.C.

765 {
766  mooseDeprecated(" Please use computeResidualTag");
767 
768  computeResidualTag(residual, tag_id);
769 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:350
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 
)
inherited

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

Definition at line 1885 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

1887 {
1888  TIME_SECTION("computeResidualAndJacobianInternal", 3);
1889 
1890  // Make matrix ready to use
1892 
1893  for (auto tag : matrix_tags)
1894  {
1895  if (!hasMatrix(tag))
1896  continue;
1897 
1898  auto & jacobian = getMatrix(tag);
1899  // Necessary for speed
1900  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
1901  {
1902  MatSetOption(petsc_matrix->mat(),
1903  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
1904  PETSC_TRUE);
1906  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
1907  }
1908  }
1909 
1910  residualSetup();
1911 
1912  // Residual contributions from UOs - for now this is used for ray tracing
1913  // and ray kernels that contribute to the residual (think line sources)
1914  std::vector<UserObject *> uos;
1916  .query()
1917  .condition<AttribSystem>("UserObject")
1918  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1919  .queryInto(uos);
1920  for (auto & uo : uos)
1921  uo->residualSetup();
1922  for (auto & uo : uos)
1923  {
1924  uo->initialize();
1925  uo->execute();
1926  uo->finalize();
1927  }
1928 
1929  // reinit scalar variables
1930  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1932 
1933  // residual contributions from the domain
1934  PARALLEL_TRY
1935  {
1936  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1937 
1939 
1940  ComputeResidualAndJacobianThread crj(_fe_problem, vector_tags, matrix_tags);
1941  Threads::parallel_reduce(elem_range, crj);
1942 
1943  using FVRange = StoredRange<MooseMesh::const_face_info_iterator, const FaceInfo *>;
1944  if (_fe_problem.haveFV())
1945  {
1947  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/false);
1949  Threads::parallel_reduce(faces, fvrj);
1950  }
1951  if (auto displaced_problem = _fe_problem.getDisplacedProblem();
1952  displaced_problem && displaced_problem->haveFV())
1953  {
1955  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/true);
1956  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1957  displaced_problem->mesh().ownedFaceInfoEnd());
1958  Threads::parallel_reduce(faces, fvr);
1959  }
1960 
1962 
1963  unsigned int n_threads = libMesh::n_threads();
1964  for (unsigned int i = 0; i < n_threads;
1965  i++) // Add any cached residuals that might be hanging around
1966  {
1969  }
1970  }
1971  PARALLEL_CATCH;
1972 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
unsigned int n_threads()
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:1293
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 bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
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:1110
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:959
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
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
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:48
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:1302
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 
)
inherited

Form possibly multiple tag-associated vectors and matrices.

Definition at line 849 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeResidualAndJacobian().

851 {
852  const bool required_residual =
853  vector_tags.find(residualVectorTag()) == vector_tags.end() ? false : true;
854 
855  try
856  {
857  zeroTaggedVectors(vector_tags);
858  computeResidualAndJacobianInternal(vector_tags, matrix_tags);
859  closeTaggedVectors(vector_tags);
860  closeTaggedMatrices(matrix_tags);
861 
862  if (required_residual)
863  {
864  auto & residual = getVector(residualVectorTag());
865  if (_time_integrator)
866  _time_integrator->postResidual(residual);
867  else
868  residual += *_Re_non_time;
869  residual.close();
870  }
871 
873  closeTaggedVectors(vector_tags);
874  closeTaggedMatrices(matrix_tags);
875  }
876  catch (MooseException & e)
877  {
878  // The buck stops here, we have already handled the exception by
879  // calling stopSolve(), it is now up to PETSc to return a
880  // "diverged" reason during the next solve.
881  }
882 }
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:690
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:1016
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:664
virtual void close()=0
TagID residualVectorTag() const override
Provides a way for users to bail out of the current solve.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ computeResidualInternal()

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

Compute the residual for a given tag.

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

Definition at line 1665 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualTags().

1666 {
1667  parallel_object_only();
1668 
1669  TIME_SECTION("computeResidualInternal", 3);
1670 
1671  residualSetup();
1672 
1673  const auto vector_tag_data = _fe_problem.getVectorTags(tags);
1674 
1675  // Residual contributions from UOs - for now this is used for ray tracing
1676  // and ray kernels that contribute to the residual (think line sources)
1677  std::vector<UserObject *> uos;
1679  .query()
1680  .condition<AttribSystem>("UserObject")
1681  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1682  .queryInto(uos);
1683  for (auto & uo : uos)
1684  uo->residualSetup();
1685  for (auto & uo : uos)
1686  {
1687  uo->initialize();
1688  uo->execute();
1689  uo->finalize();
1690  }
1691 
1692  // reinit scalar variables
1693  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1695 
1696  // residual contributions from the domain
1697  PARALLEL_TRY
1698  {
1699  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1700 
1702 
1704  Threads::parallel_reduce(elem_range, cr);
1705 
1706  // We pass face information directly to FV residual objects for their evaluation. Consequently
1707  // we must make sure to do separate threaded loops for 1) undisplaced face information objects
1708  // and undisplaced residual objects and 2) displaced face information objects and displaced
1709  // residual objects
1710  using FVRange = StoredRange<MooseMesh::const_face_info_iterator, const FaceInfo *>;
1711  if (_fe_problem.haveFV())
1712  {
1714  _fe_problem, this->number(), tags, /*on_displaced=*/false);
1716  Threads::parallel_reduce(faces, fvr);
1717  }
1718  if (auto displaced_problem = _fe_problem.getDisplacedProblem();
1719  displaced_problem && displaced_problem->haveFV())
1720  {
1722  _fe_problem, this->number(), tags, /*on_displaced=*/true);
1723  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1724  displaced_problem->mesh().ownedFaceInfoEnd());
1725  Threads::parallel_reduce(faces, fvr);
1726  }
1727 
1728  unsigned int n_threads = libMesh::n_threads();
1729  for (unsigned int i = 0; i < n_threads;
1730  i++) // Add any cached residuals that might be hanging around
1732  }
1733  PARALLEL_CATCH;
1734 
1735  // residual contributions from the scalar kernels
1736  PARALLEL_TRY
1737  {
1738  // do scalar kernels (not sure how to thread this)
1740  {
1741  TIME_SECTION("ScalarKernels", 3 /*, "Computing ScalarKernels"*/);
1742 
1743  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
1744  // This code should be refactored once we can do tags for scalar
1745  // kernels
1746  // Should redo this based on Warehouse
1747  if (!tags.size() || tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL))
1748  scalar_kernel_warehouse = &_scalar_kernels;
1749  else if (tags.size() == 1)
1750  scalar_kernel_warehouse =
1751  &(_scalar_kernels.getVectorTagObjectWarehouse(*(tags.begin()), 0));
1752  else
1753  // scalar_kernels is not threading
1754  scalar_kernel_warehouse = &(_scalar_kernels.getVectorTagsObjectWarehouse(tags, 0));
1755 
1756  bool have_scalar_contributions = false;
1757  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
1758  for (const auto & scalar_kernel : scalars)
1759  {
1760  scalar_kernel->reinit();
1761  const std::vector<dof_id_type> & dof_indices = scalar_kernel->variable().dofIndices();
1762  const DofMap & dof_map = scalar_kernel->variable().dofMap();
1763  const dof_id_type first_dof = dof_map.first_dof();
1764  const dof_id_type end_dof = dof_map.end_dof();
1765  for (dof_id_type dof : dof_indices)
1766  {
1767  if (dof >= first_dof && dof < end_dof)
1768  {
1769  scalar_kernel->computeResidual();
1770  have_scalar_contributions = true;
1771  break;
1772  }
1773  }
1774  }
1775  if (have_scalar_contributions)
1777  }
1778  }
1779  PARALLEL_CATCH;
1780 
1781  // residual contributions from Block NodalKernels
1782  PARALLEL_TRY
1783  {
1785  {
1786  TIME_SECTION("NodalKernels", 3 /*, "Computing NodalKernels"*/);
1787 
1789 
1790  ConstNodeRange & range = *_mesh.getLocalNodeRange();
1791 
1792  if (range.begin() != range.end())
1793  {
1794  _fe_problem.reinitNode(*range.begin(), 0);
1795 
1796  Threads::parallel_reduce(range, cnk);
1797 
1798  unsigned int n_threads = libMesh::n_threads();
1799  for (unsigned int i = 0; i < n_threads;
1800  i++) // Add any cached residuals that might be hanging around
1802  }
1803  }
1804  }
1805  PARALLEL_CATCH;
1806 
1808  // We computed the volumetric objects. We can return now before we get into
1809  // any strongly enforced constraint conditions or penalty-type objects
1810  // (DGKernels, IntegratedBCs, InterfaceKernels, Constraints)
1811  return;
1812 
1813  // residual contributions from boundary NodalKernels
1814  PARALLEL_TRY
1815  {
1817  {
1818  TIME_SECTION("NodalKernelBCs", 3 /*, "Computing NodalKernelBCs"*/);
1819 
1821 
1822  ConstBndNodeRange & bnd_node_range = *_mesh.getBoundaryNodeRange();
1823 
1824  Threads::parallel_reduce(bnd_node_range, cnk);
1825 
1826  unsigned int n_threads = libMesh::n_threads();
1827  for (unsigned int i = 0; i < n_threads;
1828  i++) // Add any cached residuals that might be hanging around
1830  }
1831  }
1832  PARALLEL_CATCH;
1833 
1835 
1836  if (_residual_copy.get())
1837  {
1838  _Re_non_time->close();
1840  }
1841 
1843  {
1844  _Re_non_time->close();
1847  }
1848 
1849  PARALLEL_TRY { computeDiracContributions(tags, false); }
1850  PARALLEL_CATCH;
1851 
1853  {
1854  PARALLEL_TRY { enforceNodalConstraintsResidual(*_Re_non_time); }
1855  PARALLEL_CATCH;
1856  _Re_non_time->close();
1857  }
1858 
1859  // Add in Residual contributions from other Constraints
1861  {
1862  PARALLEL_TRY
1863  {
1864  // Undisplaced Constraints
1866 
1867  // Displaced Constraints
1870 
1873  }
1874  PARALLEL_CATCH;
1875  _Re_non_time->close();
1876  }
1877 
1878  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
1879  // counters
1882 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
unsigned int n_threads()
bool hasActiveBlockObjects(THREAD_ID tid=0) const
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:1293
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
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...
ConstNodeRange * getLocalNodeRange()
Definition: MooseMesh.C:1078
void constraintResiduals(NumericVector< Number > &residual, bool displaced)
Add residual contributions from Constraints.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
void solutionInvalidAccumulation()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
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:138
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:150
StoredRange< MeshBase::const_node_iterator, const Node *> ConstNodeRange
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
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.
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
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.
MooseMesh & _mesh
Definition: SystemBase.h:959
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
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:173
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:48
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:1302
bool _has_constraints
Whether or not this system has any Constraints.
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
void enforceNodalConstraintsResidual(NumericVector< Number > &residual)
Enforce nodal constraints.
virtual void addResidualScalar(const THREAD_ID tid=0)
virtual void addCachedResidual(const THREAD_ID tid) override
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092
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< Number > &v_local) const =0

◆ computeResidualTag()

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

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 750 of file NonlinearSystemBase.C.

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

751 {
752  _nl_vector_tags.clear();
753  _nl_vector_tags.insert(tag_id);
755 
757 
759 
761 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:949
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:937
void computeResidualTags(const std::set< TagID > &tags)
Form multiple tag-associated residual vectors for all the given tags.
TagID residualVectorTag() const override

◆ computeResidualTags()

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

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

Definition at line 772 of file NonlinearSystemBase.C.

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

773 {
774  parallel_object_only();
775 
776  TIME_SECTION("nl::computeResidualTags", 5);
777 
780 
781  bool required_residual = tags.find(residualVectorTag()) == tags.end() ? false : true;
782 
784 
785  // not suppose to do anythin on matrix
787 
789 
790  for (const auto & numeric_vec : _vecs_to_zero_for_residual)
791  if (hasVector(numeric_vec))
792  {
793  NumericVector<Number> & vec = getVector(numeric_vec);
794  vec.close();
795  vec.zero();
796  }
797 
798  try
799  {
800  zeroTaggedVectors(tags);
802  closeTaggedVectors(tags);
803 
804  if (required_residual)
805  {
806  auto & residual = getVector(residualVectorTag());
807  if (_time_integrator)
808  _time_integrator->postResidual(residual);
809  else
810  residual += *_Re_non_time;
811  residual.close();
812  }
814  // We don't want to do nodal bcs or anything else
815  return;
816 
817  computeNodalBCs(tags);
818  closeTaggedVectors(tags);
819 
820  // If we are debugging residuals we need one more assignment to have the ghosted copy up to
821  // date
822  if (_need_residual_ghosted && _debugging_residuals && required_residual)
823  {
824  auto & residual = getVector(residualVectorTag());
825 
826  *_residual_ghosted = residual;
828  }
829  // Need to close and update the aux system in case residuals were saved to it.
832  if (hasSaveIn())
834  }
835  catch (MooseException & e)
836  {
837  // The buck stops here, we have already handled the exception by
838  // calling stopSolve(), it is now up to PETSc to return a
839  // "diverged" reason during the next solve.
840  }
841 
842  // not supposed to do anything on matrix
844 
846 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:690
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
bool _debugging_residuals
true if debugging residuals
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:182
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
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:1099
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:1110
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
AuxiliarySystem & getAuxiliarySystem()
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:664
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:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
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.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013
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:889

◆ computeScalarKernelsJacobians()

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

Definition at line 2645 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2646 {
2647  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
2648 
2649  if (!tags.size() || tags.size() == _fe_problem.numMatrixTags())
2650  scalar_kernel_warehouse = &_scalar_kernels;
2651  else if (tags.size() == 1)
2652  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
2653  else
2654  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagsObjectWarehouse(tags, 0));
2655 
2656  // Compute the diagonal block for scalar variables
2657  if (scalar_kernel_warehouse->hasActiveObjects())
2658  {
2659  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
2660 
2661  _fe_problem.reinitScalars(/*tid=*/0);
2662 
2663  _fe_problem.reinitOffDiagScalars(/*_tid*/ 0);
2664 
2665  bool have_scalar_contributions = false;
2666  for (const auto & kernel : scalars)
2667  {
2668  kernel->reinit();
2669  const std::vector<dof_id_type> & dof_indices = kernel->variable().dofIndices();
2670  const DofMap & dof_map = kernel->variable().dofMap();
2671  const dof_id_type first_dof = dof_map.first_dof();
2672  const dof_id_type end_dof = dof_map.end_dof();
2673  for (dof_id_type dof : dof_indices)
2674  {
2675  if (dof >= first_dof && dof < end_dof)
2676  {
2677  kernel->computeJacobian();
2678  _fe_problem.addJacobianOffDiagScalar(kernel->variable().number());
2679  have_scalar_contributions = true;
2680  break;
2681  }
2682  }
2683  }
2684 
2685  if (have_scalar_contributions)
2687  }
2688 }
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 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:220
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
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...
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 ( )
inherited

Method used to obtain scaling factors for variables.

Returns
whether this method ran without exceptions

Definition at line 3780 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preSolve().

3781 {
3783  return true;
3784 
3785  _console << "\nPerforming automatic scaling calculation\n" << std::endl;
3786 
3787  TIME_SECTION("computeScaling", 3, "Computing Automatic Scaling");
3788 
3789  // It's funny but we need to assemble our vector of scaling factors here otherwise we will be
3790  // applying scaling factors of 0 during Assembly of our scaling Jacobian
3792 
3793  // container for repeated access of element global dof indices
3794  std::vector<dof_id_type> dof_indices;
3795 
3796  if (!_auto_scaling_initd)
3797  setupScalingData();
3798 
3799  std::vector<Real> inverse_scaling_factors(_num_scaling_groups, 0);
3800  std::vector<Real> resid_inverse_scaling_factors(_num_scaling_groups, 0);
3801  std::vector<Real> jac_inverse_scaling_factors(_num_scaling_groups, 0);
3802  auto & dof_map = dofMap();
3803 
3804  // what types of scaling do we want?
3805  bool jac_scaling = _resid_vs_jac_scaling_param < 1. - TOLERANCE;
3806  bool resid_scaling = _resid_vs_jac_scaling_param > TOLERANCE;
3807 
3808  const NumericVector<Number> & scaling_residual = RHS();
3809 
3810  if (jac_scaling)
3811  {
3812  // if (!_auto_scaling_initd)
3813  // We need to reinit this when the number of dofs changes
3814  // but there is no good way to track that
3815  // In theory, it is the job of libmesh system to track this,
3816  // but this special matrix is not owned by libMesh system
3817  // Let us reinit eveytime since it is not expensive
3818  {
3819  auto init_vector = NumericVector<Number>::build(this->comm());
3820  init_vector->init(system().n_dofs(), system().n_local_dofs(), /*fast=*/false, PARALLEL);
3821 
3822  _scaling_matrix->clear();
3823  _scaling_matrix->init(*init_vector);
3824  }
3825 
3827  // Dispatch to derived classes to ensure that we use the correct matrix tag
3830  }
3831 
3832  if (resid_scaling)
3833  {
3836  // Dispatch to derived classes to ensure that we use the correct vector tag
3840  }
3841 
3842  // Did something bad happen during residual/Jacobian scaling computation?
3844  return false;
3845 
3846  auto examine_dof_indices = [this,
3847  jac_scaling,
3848  resid_scaling,
3849  &dof_map,
3850  &jac_inverse_scaling_factors,
3851  &resid_inverse_scaling_factors,
3852  &scaling_residual](const auto & dof_indices, const auto var_number)
3853  {
3854  for (auto dof_index : dof_indices)
3855  if (dof_map.local_index(dof_index))
3856  {
3857  if (jac_scaling)
3858  {
3859  // For now we will use the diagonal for determining scaling
3860  auto mat_value = (*_scaling_matrix)(dof_index, dof_index);
3861  auto & factor = jac_inverse_scaling_factors[_var_to_group_var[var_number]];
3862  factor = std::max(factor, std::abs(mat_value));
3863  }
3864  if (resid_scaling)
3865  {
3866  auto vec_value = scaling_residual(dof_index);
3867  auto & factor = resid_inverse_scaling_factors[_var_to_group_var[var_number]];
3868  factor = std::max(factor, std::abs(vec_value));
3869  }
3870  }
3871  };
3872 
3873  // Compute our scaling factors for the spatial field variables
3874  for (const auto & elem : *mesh().getActiveLocalElementRange())
3875  for (const auto i : make_range(system().n_vars()))
3876  if (_variable_autoscaled[i] && system().variable_type(i).family != SCALAR)
3877  {
3878  dof_map.dof_indices(elem, dof_indices, i);
3879  examine_dof_indices(dof_indices, i);
3880  }
3881 
3882  for (const auto i : make_range(system().n_vars()))
3883  if (_variable_autoscaled[i] && system().variable_type(i).family == SCALAR)
3884  {
3885  dof_map.SCALAR_dof_indices(dof_indices, i);
3886  examine_dof_indices(dof_indices, i);
3887  }
3888 
3889  if (resid_scaling)
3890  _communicator.max(resid_inverse_scaling_factors);
3891  if (jac_scaling)
3892  _communicator.max(jac_inverse_scaling_factors);
3893 
3894  if (jac_scaling && resid_scaling)
3895  for (MooseIndex(inverse_scaling_factors) i = 0; i < inverse_scaling_factors.size(); ++i)
3896  {
3897  // Be careful not to take log(0)
3898  if (!resid_inverse_scaling_factors[i])
3899  {
3900  if (!jac_inverse_scaling_factors[i])
3901  inverse_scaling_factors[i] = 1;
3902  else
3903  inverse_scaling_factors[i] = jac_inverse_scaling_factors[i];
3904  }
3905  else if (!jac_inverse_scaling_factors[i])
3906  // We know the resid is not zero
3907  inverse_scaling_factors[i] = resid_inverse_scaling_factors[i];
3908  else
3909  inverse_scaling_factors[i] =
3910  std::exp(_resid_vs_jac_scaling_param * std::log(resid_inverse_scaling_factors[i]) +
3911  (1 - _resid_vs_jac_scaling_param) * std::log(jac_inverse_scaling_factors[i]));
3912  }
3913  else if (jac_scaling)
3914  inverse_scaling_factors = jac_inverse_scaling_factors;
3915  else if (resid_scaling)
3916  inverse_scaling_factors = resid_inverse_scaling_factors;
3917  else
3918  mooseError("We shouldn't be calling this routine if we're not performing any scaling");
3919 
3920  // We have to make sure that our scaling values are not zero
3921  for (auto & scaling_factor : inverse_scaling_factors)
3922  if (scaling_factor == 0)
3923  scaling_factor = 1;
3924 
3925  // Now flatten the group scaling factors to the individual variable scaling factors
3926  std::vector<Real> flattened_inverse_scaling_factors(system().n_vars());
3927  for (const auto i : index_range(flattened_inverse_scaling_factors))
3928  flattened_inverse_scaling_factors[i] = inverse_scaling_factors[_var_to_group_var[i]];
3929 
3930  // Now set the scaling factors for the variables
3931  applyScalingFactors(flattened_inverse_scaling_factors);
3932  if (auto displaced_problem = _fe_problem.getDisplacedProblem().get())
3933  displaced_problem->systemBaseNonlinear(number()).applyScalingFactors(
3934  flattened_inverse_scaling_factors);
3935 
3936  _computed_scaling = true;
3937  return true;
3938 }
std::unique_ptr< DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
MooseMesh & mesh()
Definition: SystemBase.h:100
std::vector< bool > _variable_autoscaled
Container to hold flag if variable is to participate in autoscaling.
void applyScalingFactors(const std::vector< Real > &inverse_scaling_factors)
Applies scaling factors to the system&#39;s variables.
Definition: SystemBase.C:1420
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:299
const Parallel::Communicator & comm() const
const Parallel::Communicator & _communicator
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)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
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 DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1138
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:1132
void setupScalingData()
Setup group scaling containers.
auto log(const T &)
static std::unique_ptr< NumericVector< Number > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
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:954
virtual NumericVector< Number > & RHS()=0
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
void max(const T &r, T &o, Request &req) const
virtual System & system() override
Get the reference to the libMesh system.
bool getFailNextNonlinearConvergenceCheck() const
Whether it will skip further residual evaluations and fail the next nonlinear convergence check...
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...

◆ computeScalingJacobian()

void NonlinearSystem::computeScalingJacobian ( )
overrideprotectedvirtualinherited

Compute a "Jacobian" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 341 of file NonlinearSystem.C.

342 {
344 }
std::unique_ptr< DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
virtual void computeJacobianSys(NonlinearImplicitSystem &sys, const NumericVector< Number > &soln, SparseMatrix< Number > &jacobian)
Form a Jacobian matrix.
NonlinearImplicitSystem & _nl_implicit_sys
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ computeScalingOnce() [1/2]

bool NonlinearSystemBase::computeScalingOnce ( ) const
inlineinherited

Definition at line 647 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

647 { 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)
inlineinherited

Definition at line 648 of file NonlinearSystemBase.h.

649  {
650  _compute_scaling_once = compute_scaling_once;
651  }
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...

◆ computeScalingResidual()

void NonlinearSystem::computeScalingResidual ( )
overrideprotectedvirtualinherited

Compute a "residual" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 347 of file NonlinearSystem.C.

348 {
350 }
NonlinearImplicitSystem & _nl_implicit_sys
virtual NumericVector< Number > & RHS() override
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
virtual void computeResidualSys(NonlinearImplicitSystem &sys, const NumericVector< Number > &soln, NumericVector< Number > &residual)
This function is called by Libmesh to form a residual.

◆ computeVariables()

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

Definition at line 862 of file SystemBase.h.

862 {}

◆ computingPreSMOResidual()

bool NonlinearSystemBase::computingPreSMOResidual ( )
inlineinherited

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 92 of file NonlinearSystemBase.h.

◆ computingScalingJacobian()

bool SystemBase::computingScalingJacobian ( ) const
inherited

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

Definition at line 1477 of file SystemBase.C.

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

1478 {
1480 }
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:951

◆ constraintJacobians()

void NonlinearSystemBase::constraintJacobians ( bool  displaced)
inherited

Add jacobian contributions from Constraints.

Parameters
jacobianreference to the Jacobian matrix
displacedControls whether to do the displaced Constraints or non-displaced

Definition at line 2235 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2236 {
2237  if (!hasMatrix(systemMatrixTag()))
2238  mooseError("A system matrix is required");
2239 
2240  auto & jacobian = getMatrix(systemMatrixTag());
2241 
2243  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2244  MAT_NEW_NONZERO_ALLOCATION_ERR,
2245  PETSC_FALSE);
2247  MatSetOption(
2248  static_cast<PetscMatrix<Number> &>(jacobian).mat(), MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);
2249 
2250  std::vector<numeric_index_type> zero_rows;
2251 
2252  if (displaced)
2253  mooseAssert(_fe_problem.getDisplacedProblem(),
2254  "If we're calling this method with displaced = true, then we better well have a "
2255  "displaced problem");
2256  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
2257  : static_cast<SubProblem &>(_fe_problem);
2258  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
2259 
2260  bool constraints_applied;
2262  constraints_applied = false;
2263  for (const auto & it : penetration_locators)
2264  {
2266  {
2267  // Reset the constraint_applied flag before each new constraint, as they need to be
2268  // assembled separately
2269  constraints_applied = false;
2270  }
2271  PenetrationLocator & pen_loc = *(it.second);
2272 
2273  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
2274 
2275  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
2276  BoundaryID primary_boundary = pen_loc._primary_boundary;
2277 
2278  zero_rows.clear();
2279  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
2280  {
2281  const auto & constraints =
2282  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
2283 
2284  for (const auto & secondary_node_num : secondary_nodes)
2285  {
2286  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
2287 
2288  if (secondary_node.processor_id() == processor_id())
2289  {
2290  if (pen_loc._penetration_info[secondary_node_num])
2291  {
2292  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
2293 
2294  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
2296 
2297  for (const auto & nfc : constraints)
2298  {
2299  if (nfc->isExplicitConstraint())
2300  continue;
2301  // Return if this constraint does not correspond to the primary-secondary pair
2302  // prepared by the outer loops.
2303  // This continue statement is required when, e.g. one secondary surface constrains
2304  // more than one primary surface.
2305  if (nfc->secondaryBoundary() != secondary_boundary ||
2306  nfc->primaryBoundary() != primary_boundary)
2307  continue;
2308 
2309  nfc->_jacobian = &jacobian;
2310 
2311  if (nfc->shouldApply())
2312  {
2313  constraints_applied = true;
2314 
2315  nfc->prepareShapes(nfc->variable().number());
2316  nfc->prepareNeighborShapes(nfc->variable().number());
2317 
2318  nfc->computeJacobian();
2319 
2320  if (nfc->overwriteSecondaryJacobian())
2321  {
2322  // Add this variable's dof's row to be zeroed
2323  zero_rows.push_back(nfc->variable().nodalDofIndex());
2324  }
2325 
2326  std::vector<dof_id_type> secondary_dofs(1, nfc->variable().nodalDofIndex());
2327 
2328  // Assume that if the user is overwriting the secondary Jacobian, then they are
2329  // supplying Jacobians that do not correspond to their other physics
2330  // (e.g. Kernels), hence we should not apply a scalingFactor that is normally
2331  // based on the order of their other physics (e.g. Kernels)
2332  Real scaling_factor =
2333  nfc->overwriteSecondaryJacobian() ? 1. : nfc->variable().scalingFactor();
2334 
2335  // Cache the jacobian block for the secondary side
2336  nfc->addJacobian(_fe_problem.assembly(0, number()),
2337  nfc->_Kee,
2338  secondary_dofs,
2339  nfc->_connected_dof_indices,
2340  scaling_factor);
2341 
2342  // Cache Ken, Kne, Knn
2343  if (nfc->addCouplingEntriesToJacobian())
2344  {
2345  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2346  // factor when we're overwriting secondary stuff)
2347  nfc->addJacobian(_fe_problem.assembly(0, number()),
2348  nfc->_Ken,
2349  secondary_dofs,
2350  nfc->primaryVariable().dofIndicesNeighbor(),
2351  scaling_factor);
2352 
2353  // Use _connected_dof_indices to get all the correct columns
2354  nfc->addJacobian(_fe_problem.assembly(0, number()),
2355  nfc->_Kne,
2356  nfc->primaryVariable().dofIndicesNeighbor(),
2357  nfc->_connected_dof_indices,
2358  nfc->variable().scalingFactor());
2359 
2360  // We've handled Ken and Kne, finally handle Knn
2362  }
2363 
2364  // Do the off-diagonals next
2365  const std::vector<MooseVariableFEBase *> coupled_vars = nfc->getCoupledMooseVars();
2366  for (const auto & jvar : coupled_vars)
2367  {
2368  // Only compute jacobians for nonlinear variables
2369  if (jvar->kind() != Moose::VAR_SOLVER)
2370  continue;
2371 
2372  // Only compute Jacobian entries if this coupling is being used by the
2373  // preconditioner
2374  if (nfc->variable().number() == jvar->number() ||
2376  nfc->variable().number(), jvar->number(), this->number()))
2377  continue;
2378 
2379  // Need to zero out the matrices first
2381 
2382  nfc->prepareShapes(nfc->variable().number());
2383  nfc->prepareNeighborShapes(jvar->number());
2384 
2385  nfc->computeOffDiagJacobian(jvar->number());
2386 
2387  // Cache the jacobian block for the secondary side
2388  nfc->addJacobian(_fe_problem.assembly(0, number()),
2389  nfc->_Kee,
2390  secondary_dofs,
2391  nfc->_connected_dof_indices,
2392  scaling_factor);
2393 
2394  // Cache Ken, Kne, Knn
2395  if (nfc->addCouplingEntriesToJacobian())
2396  {
2397  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2398  // factor when we're overwriting secondary stuff)
2399  nfc->addJacobian(_fe_problem.assembly(0, number()),
2400  nfc->_Ken,
2401  secondary_dofs,
2402  jvar->dofIndicesNeighbor(),
2403  scaling_factor);
2404 
2405  // Use _connected_dof_indices to get all the correct columns
2406  nfc->addJacobian(_fe_problem.assembly(0, number()),
2407  nfc->_Kne,
2408  nfc->variable().dofIndicesNeighbor(),
2409  nfc->_connected_dof_indices,
2410  nfc->variable().scalingFactor());
2411 
2412  // We've handled Ken and Kne, finally handle Knn
2414  }
2415  }
2416  }
2417  }
2418  }
2419  }
2420  }
2421  }
2423  {
2424  // See if constraints were applied anywhere
2425  _communicator.max(constraints_applied);
2426 
2427  if (constraints_applied)
2428  {
2429  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2430  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2431  PETSC_TRUE);
2432 
2433  jacobian.close();
2434  jacobian.zero_rows(zero_rows, 0.0);
2435  jacobian.close();
2437  jacobian.close();
2438  }
2439  }
2440  }
2442  {
2443  // See if constraints were applied anywhere
2444  _communicator.max(constraints_applied);
2445 
2446  if (constraints_applied)
2447  {
2448  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2449  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2450  PETSC_TRUE);
2451 
2452  jacobian.close();
2453  jacobian.zero_rows(zero_rows, 0.0);
2454  jacobian.close();
2456  jacobian.close();
2457  }
2458  }
2459 
2460  THREAD_ID tid = 0;
2461  // go over element-element constraint interface
2462  const auto & element_pair_locators = subproblem.geomSearchData()._element_pair_locators;
2463  for (const auto & it : element_pair_locators)
2464  {
2465  ElementPairLocator & elem_pair_loc = *(it.second);
2466 
2467  if (_constraints.hasActiveElemElemConstraints(it.first, displaced))
2468  {
2469  // ElemElemConstraint objects
2470  const auto & _element_constraints =
2471  _constraints.getActiveElemElemConstraints(it.first, displaced);
2472 
2473  // go over pair elements
2474  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
2475  elem_pair_loc.getElemPairs();
2476  for (const auto & pr : elem_pairs)
2477  {
2478  const Elem * elem1 = pr.first;
2479  const Elem * elem2 = pr.second;
2480 
2481  if (elem1->processor_id() != processor_id())
2482  continue;
2483 
2484  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(pr);
2485 
2486  // for each element process constraints on the
2487  for (const auto & ec : _element_constraints)
2488  {
2489  _fe_problem.setCurrentSubdomainID(elem1, tid);
2490  subproblem.reinitElemPhys(elem1, info._elem1_constraint_q_point, tid);
2491  _fe_problem.setNeighborSubdomainID(elem2, tid);
2492  subproblem.reinitNeighborPhys(elem2, info._elem2_constraint_q_point, tid);
2493 
2494  ec->prepareShapes(ec->variable().number());
2495  ec->prepareNeighborShapes(ec->variable().number());
2496 
2497  ec->reinit(info);
2498  ec->computeJacobian();
2501  }
2503  }
2504  }
2505  }
2506 
2507  // go over NodeELemConstraints
2508  std::set<dof_id_type> unique_secondary_node_ids;
2509  constraints_applied = false;
2510  for (const auto & secondary_id : _mesh.meshSubdomains())
2511  {
2512  for (const auto & primary_id : _mesh.meshSubdomains())
2513  {
2514  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
2515  {
2516  const auto & constraints =
2517  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
2518 
2519  // get unique set of ids of all nodes on current block
2520  unique_secondary_node_ids.clear();
2521  const MeshBase & meshhelper = _mesh.getMesh();
2522  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
2523  meshhelper.active_subdomain_elements_end(secondary_id)))
2524  {
2525  for (auto & n : elem->node_ref_range())
2526  unique_secondary_node_ids.insert(n.id());
2527  }
2528 
2529  for (auto secondary_node_id : unique_secondary_node_ids)
2530  {
2531  const Node & secondary_node = _mesh.nodeRef(secondary_node_id);
2532  // check if secondary node is on current processor
2533  if (secondary_node.processor_id() == processor_id())
2534  {
2535  // This reinits the variables that exist on the secondary node
2536  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
2537 
2538  // This will set aside residual and jacobian space for the variables that have dofs
2539  // on the secondary node
2542 
2543  for (const auto & nec : constraints)
2544  {
2545  if (nec->shouldApply())
2546  {
2547  constraints_applied = true;
2548 
2549  nec->_jacobian = &jacobian;
2550  nec->prepareShapes(nec->variable().number());
2551  nec->prepareNeighborShapes(nec->variable().number());
2552 
2553  nec->computeJacobian();
2554 
2555  if (nec->overwriteSecondaryJacobian())
2556  {
2557  // Add this variable's dof's row to be zeroed
2558  zero_rows.push_back(nec->variable().nodalDofIndex());
2559  }
2560 
2561  std::vector<dof_id_type> secondary_dofs(1, nec->variable().nodalDofIndex());
2562 
2563  // Cache the jacobian block for the secondary side
2564  nec->addJacobian(_fe_problem.assembly(0, number()),
2565  nec->_Kee,
2566  secondary_dofs,
2567  nec->_connected_dof_indices,
2568  nec->variable().scalingFactor());
2569 
2570  // Cache the jacobian block for the primary side
2571  nec->addJacobian(_fe_problem.assembly(0, number()),
2572  nec->_Kne,
2573  nec->primaryVariable().dofIndicesNeighbor(),
2574  nec->_connected_dof_indices,
2575  nec->variable().scalingFactor());
2576 
2579 
2580  // Do the off-diagonals next
2581  const std::vector<MooseVariableFEBase *> coupled_vars = nec->getCoupledMooseVars();
2582  for (const auto & jvar : coupled_vars)
2583  {
2584  // Only compute jacobians for nonlinear variables
2585  if (jvar->kind() != Moose::VAR_SOLVER)
2586  continue;
2587 
2588  // Only compute Jacobian entries if this coupling is being used by the
2589  // preconditioner
2590  if (nec->variable().number() == jvar->number() ||
2592  nec->variable().number(), jvar->number(), this->number()))
2593  continue;
2594 
2595  // Need to zero out the matrices first
2597 
2598  nec->prepareShapes(nec->variable().number());
2599  nec->prepareNeighborShapes(jvar->number());
2600 
2601  nec->computeOffDiagJacobian(jvar->number());
2602 
2603  // Cache the jacobian block for the secondary side
2604  nec->addJacobian(_fe_problem.assembly(0, number()),
2605  nec->_Kee,
2606  secondary_dofs,
2607  nec->_connected_dof_indices,
2608  nec->variable().scalingFactor());
2609 
2610  // Cache the jacobian block for the primary side
2611  nec->addJacobian(_fe_problem.assembly(0, number()),
2612  nec->_Kne,
2613  nec->variable().dofIndicesNeighbor(),
2614  nec->_connected_dof_indices,
2615  nec->variable().scalingFactor());
2616 
2619  }
2620  }
2621  }
2622  }
2623  }
2624  }
2625  }
2626  }
2627  // See if constraints were applied anywhere
2628  _communicator.max(constraints_applied);
2629 
2630  if (constraints_applied)
2631  {
2632  MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2633  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2634  PETSC_TRUE);
2635 
2636  jacobian.close();
2637  jacobian.zero_rows(zero_rows, 0.0);
2638  jacobian.close();
2640  jacobian.close();
2641  }
2642 }
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:299
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:338
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
virtual void cacheJacobianNeighbor(const THREAD_ID tid) override
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:637
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:3199
const ElementPairList & getElemPairs() const
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:102
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:1132
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:954
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:75
MooseMesh & _mesh
Definition: SystemBase.h:959
void max(const T &r, T &o, Request &req) const
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
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
const std::vector< std::shared_ptr< NodeElemConstraint > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
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
BoundaryID _primary_boundary
unsigned int THREAD_ID
Definition: MooseTypes.h:198
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
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:2922
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ constraintResiduals()

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

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 1292 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualInternal().

1293 {
1294  // Make sure the residual is in a good state
1295  residual.close();
1296 
1297  if (displaced)
1298  mooseAssert(_fe_problem.getDisplacedProblem(),
1299  "If we're calling this method with displaced = true, then we better well have a "
1300  "displaced problem");
1301  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1302  : static_cast<SubProblem &>(_fe_problem);
1303  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1304 
1305  bool constraints_applied;
1306  bool residual_has_inserted_values = false;
1308  constraints_applied = false;
1309  for (const auto & it : penetration_locators)
1310  {
1312  {
1313  // Reset the constraint_applied flag before each new constraint, as they need to be
1314  // assembled separately
1315  constraints_applied = false;
1316  }
1317  PenetrationLocator & pen_loc = *(it.second);
1318 
1319  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1320 
1321  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1322  BoundaryID primary_boundary = pen_loc._primary_boundary;
1323 
1324  bool has_writable_variables(false);
1325 
1326  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
1327  {
1328  const auto & constraints =
1329  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
1330 
1331  for (unsigned int i = 0; i < secondary_nodes.size(); i++)
1332  {
1333  dof_id_type secondary_node_num = secondary_nodes[i];
1334  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1335 
1336  if (secondary_node.processor_id() == processor_id())
1337  {
1338  if (pen_loc._penetration_info[secondary_node_num])
1339  {
1340  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
1341 
1342  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
1343 
1344  for (const auto & nfc : constraints)
1345  {
1346  // Return if this constraint does not correspond to the primary-secondary pair
1347  // prepared by the outer loops.
1348  // This continue statement is required when, e.g. one secondary surface constrains
1349  // more than one primary surface.
1350  if (nfc->secondaryBoundary() != secondary_boundary ||
1351  nfc->primaryBoundary() != primary_boundary)
1352  continue;
1353 
1354  if (nfc->shouldApply())
1355  {
1356  constraints_applied = true;
1357  nfc->computeResidual();
1358 
1359  if (nfc->overwriteSecondaryResidual())
1360  {
1361  // The below will actually overwrite the residual for every single dof that
1362  // lives on the node. We definitely don't want to do that!
1363  // _fe_problem.setResidual(residual, 0);
1364 
1365  const auto & secondary_var = nfc->variable();
1366  const auto & secondary_dofs = secondary_var.dofIndices();
1367  mooseAssert(secondary_dofs.size() == secondary_var.count(),
1368  "We are on a node so there should only be one dof per variable (for "
1369  "an ArrayVariable we should have a number of dofs equal to the "
1370  "number of components");
1371 
1372  // Assume that if the user is overwriting the secondary residual, then they are
1373  // supplying residuals that do not correspond to their other physics
1374  // (e.g. Kernels), hence we should not apply a scalingFactor that is normally
1375  // based on the order of their other physics (e.g. Kernels)
1376  std::vector<Number> values = {nfc->secondaryResidual()};
1377  residual.insert(values, secondary_dofs);
1378  residual_has_inserted_values = true;
1379  }
1380  else
1383  }
1384  if (nfc->hasWritableCoupledVariables())
1385  {
1386  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1387  has_writable_variables = true;
1388  for (auto * var : nfc->getWritableCoupledVariables())
1389  {
1390  if (var->isNodalDefined())
1391  var->insert(_fe_problem.getAuxiliarySystem().solution());
1392  }
1393  }
1394  }
1395  }
1396  }
1397  }
1398  }
1399  _communicator.max(has_writable_variables);
1400 
1401  if (has_writable_variables)
1402  {
1403  // Explicit contact dynamic constraints write to auxiliary variables and update the old
1404  // displacement solution on the constraint boundaries. Close solutions and update system
1405  // accordingly.
1407  _fe_problem.getAuxiliarySystem().system().update();
1408  solutionOld().close();
1409  }
1410 
1412  {
1413  // Make sure that secondary contribution to primary are assembled, and ghosts have been
1414  // exchanged, as current primaries might become secondaries on next iteration and will need to
1415  // contribute their former secondaries' contributions to the future primaries. See if
1416  // constraints were applied anywhere
1417  _communicator.max(constraints_applied);
1418 
1419  if (constraints_applied)
1420  {
1421  // If any of the above constraints inserted values in the residual, it needs to be
1422  // assembled before adding the cached residuals below.
1423  _communicator.max(residual_has_inserted_values);
1424  if (residual_has_inserted_values)
1425  {
1426  residual.close();
1427  residual_has_inserted_values = false;
1428  }
1430  residual.close();
1431 
1433  *_residual_ghosted = residual;
1434  }
1435  }
1436  }
1438  {
1439  _communicator.max(constraints_applied);
1440 
1441  if (constraints_applied)
1442  {
1443  // If any of the above constraints inserted values in the residual, it needs to be assembled
1444  // before adding the cached residuals below.
1445  _communicator.max(residual_has_inserted_values);
1446  if (residual_has_inserted_values)
1447  residual.close();
1448 
1450  residual.close();
1451 
1453  *_residual_ghosted = residual;
1454  }
1455  }
1456 
1457  // go over element-element constraint interface
1458  THREAD_ID tid = 0;
1459  const auto & element_pair_locators = subproblem.geomSearchData()._element_pair_locators;
1460  for (const auto & it : element_pair_locators)
1461  {
1462  ElementPairLocator & elem_pair_loc = *(it.second);
1463 
1464  if (_constraints.hasActiveElemElemConstraints(it.first, displaced))
1465  {
1466  // ElemElemConstraint objects
1467  const auto & _element_constraints =
1468  _constraints.getActiveElemElemConstraints(it.first, displaced);
1469 
1470  // go over pair elements
1471  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
1472  elem_pair_loc.getElemPairs();
1473  for (const auto & pr : elem_pairs)
1474  {
1475  const Elem * elem1 = pr.first;
1476  const Elem * elem2 = pr.second;
1477 
1478  if (elem1->processor_id() != processor_id())
1479  continue;
1480 
1481  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(pr);
1482 
1483  // for each element process constraints on the
1484  for (const auto & ec : _element_constraints)
1485  {
1486  _fe_problem.setCurrentSubdomainID(elem1, tid);
1487  subproblem.reinitElemPhys(elem1, info._elem1_constraint_q_point, tid);
1488  _fe_problem.setNeighborSubdomainID(elem2, tid);
1489  subproblem.reinitNeighborPhys(elem2, info._elem2_constraint_q_point, tid);
1490 
1491  ec->prepareShapes(ec->variable().number());
1492  ec->prepareNeighborShapes(ec->variable().number());
1493 
1494  ec->reinit(info);
1495  ec->computeResidual();
1498  }
1500  }
1501  }
1502  }
1503 
1504  // go over NodeELemConstraints
1505  std::set<dof_id_type> unique_secondary_node_ids;
1506 
1507  constraints_applied = false;
1508  residual_has_inserted_values = false;
1509  for (const auto & secondary_id : _mesh.meshSubdomains())
1510  {
1511  for (const auto & primary_id : _mesh.meshSubdomains())
1512  {
1513  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
1514  {
1515  const auto & constraints =
1516  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
1517 
1518  // get unique set of ids of all nodes on current block
1519  unique_secondary_node_ids.clear();
1520  const MeshBase & meshhelper = _mesh.getMesh();
1521  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
1522  meshhelper.active_subdomain_elements_end(secondary_id)))
1523  {
1524  for (auto & n : elem->node_ref_range())
1525  unique_secondary_node_ids.insert(n.id());
1526  }
1527 
1528  for (auto secondary_node_id : unique_secondary_node_ids)
1529  {
1530  Node & secondary_node = _mesh.nodeRef(secondary_node_id);
1531  // check if secondary node is on current processor
1532  if (secondary_node.processor_id() == processor_id())
1533  {
1534  // This reinits the variables that exist on the secondary node
1535  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
1536 
1537  // This will set aside residual and jacobian space for the variables that have dofs
1538  // on the secondary node
1540 
1541  for (const auto & nec : constraints)
1542  {
1543  if (nec->shouldApply())
1544  {
1545  constraints_applied = true;
1546  nec->computeResidual();
1547 
1548  if (nec->overwriteSecondaryResidual())
1549  {
1550  _fe_problem.setResidual(residual, 0);
1551  residual_has_inserted_values = true;
1552  }
1553  else
1556  }
1557  }
1559  }
1560  }
1561  }
1562  }
1563  }
1564  _communicator.max(constraints_applied);
1565 
1566  if (constraints_applied)
1567  {
1568  // If any of the above constraints inserted values in the residual, it needs to be assembled
1569  // before adding the cached residuals below.
1570  _communicator.max(residual_has_inserted_values);
1571  if (residual_has_inserted_values)
1572  residual.close();
1573 
1575  residual.close();
1576 
1578  *_residual_ghosted = residual;
1579  }
1580 
1581  // We may have additional tagged vectors that also need to be accumulated
1583 }
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 Number *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:182
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
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:637
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
virtual void addCachedResidualDirectly(NumericVector< 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 setResidual(NumericVector< Number > &residual, const THREAD_ID tid) override
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3199
const ElementPairList & getElemPairs() const
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:102
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:954
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid)=0
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
MooseMesh & _mesh
Definition: SystemBase.h:959
void max(const T &r, T &o, Request &req) const
virtual System & system() override
Get the reference to the libMesh system.
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
const std::vector< std::shared_ptr< NodeElemConstraint > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
NumericVector< Number > & solutionOld()
Definition: SystemBase.h:183
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
virtual void addCachedResidual(const THREAD_ID tid) override
BoundaryID _primary_boundary
unsigned int THREAD_ID
Definition: MooseTypes.h:198
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
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:2922

◆ containsEigenKernel()

bool MooseEigenSystem::containsEigenKernel ( ) const

Weather or not the system contains eigen kernels.

Definition at line 252 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::checkIntegrity().

253 {
254  return _eigen_kernel_counter > 0;
255 }
unsigned int _eigen_kernel_counter
counter of eigen kernels

◆ containsTimeKernel()

bool NonlinearSystemBase::containsTimeKernel ( )
inherited

Definition at line 3645 of file NonlinearSystemBase.C.

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

3646 {
3647  auto & time_kernels = _kernels.getVectorTagObjectWarehouse(timeVectorTag(), 0);
3648 
3649  return time_kernels.hasActiveObjects();
3650 }
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()

bool NonlinearSystem::converged ( )
overridevirtualinherited

Returns the convergence state.

Returns
true if converged, otherwise false

Implements NonlinearSystemBase.

Definition at line 322 of file NonlinearSystem.C.

323 {
325  return false;
327  {
328  mooseWarning("The solution is not converged due to the solution being invalid.");
329  return false;
330  }
331  return _nl_implicit_sys.nonlinear_solver->converged;
332 }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:333
NonlinearImplicitSystem & _nl_implicit_sys
bool allowInvalidSolution() const
Whether or not the invalid solutions are allowed.
bool _solution_is_invalid
Boolean to see if solution is invalid.
Definition: SolverSystem.h:87
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
bool getFailNextNonlinearConvergenceCheck() const
Whether it will skip further residual evaluations and fail the next nonlinear convergence check...
virtual bool hasException()
Whether or not an exception has occurred.

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 1245 of file SystemBase.C.

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

1246 {
1247  // Copying the solutions backward so the current solution will become the old, and the old will
1248  // become older. The same applies to the nonlinear iterates.
1249  for (const auto iteration_index : index_range(_solution_states))
1250  {
1251  const auto states = _solution_states[iteration_index].size();
1252  if (states > 1)
1253  for (unsigned int i = states - 1; i > 0; --i)
1254  solutionState(i, Moose::SolutionIterationType(iteration_index)) =
1255  solutionState(i - 1, Moose::SolutionIterationType(iteration_index));
1256  }
1257 
1258  if (solutionUDotOld())
1259  *solutionUDotOld() = *solutionUDot();
1260  if (solutionUDotDotOld())
1262  if (solutionPreviousNewton())
1264 }
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:1380
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:242
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:239
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:241
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1308
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:240
auto index_range(const T &sizable)
SolutionIterationType
Definition: MooseTypes.h:229

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 1234 of file SystemBase.C.

1235 {
1236  system().update();
1237 
1238  copyOldSolutions();
1239 }
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
Definition: SystemBase.C:1245
virtual System & system()=0
Get the reference to the libMesh system.

◆ copyVars()

void SystemBase::copyVars ( ExodusII_IO &  io)
inherited

Definition at line 1158 of file SystemBase.C.

1159 {
1160  int n_steps = io.get_num_time_steps();
1161 
1162  bool did_copy = false;
1163  for (const auto & vci : _var_to_copy)
1164  {
1165  int timestep = -1;
1166 
1167  if (vci._timestep == "LATEST")
1168  // Use the last time step in the file from which to retrieve the solution
1169  timestep = n_steps;
1170  else
1171  {
1172  timestep = MooseUtils::convert<int>(vci._timestep);
1173  if (timestep > n_steps)
1174  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
1175  "a valid integer between 1 and ",
1176  n_steps,
1177  " inclusive, received ",
1178  vci._timestep);
1179  }
1180 
1181  did_copy = true;
1182 
1183  if (hasVariable(vci._dest_name))
1184  {
1185  const auto & var = getVariable(0, vci._dest_name);
1186  if (var.isArray())
1187  {
1188  const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1189  for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1190  {
1191  const auto exodus_var = _subproblem.arrayVariableComponent(vci._source_name, i);
1192  const auto system_var = array_var.componentName(i);
1193  if (var.isNodal())
1194  io.copy_nodal_solution(system(), exodus_var, system_var, timestep);
1195  else
1196  io.copy_elemental_solution(system(), exodus_var, system_var, timestep);
1197  }
1198  }
1199  else
1200  {
1201  if (var.isNodal())
1202  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
1203  else
1204  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
1205  }
1206  }
1207  else if (hasScalarVariable(vci._dest_name))
1208  io.copy_scalar_solution(system(), {vci._dest_name}, {vci._source_name}, timestep);
1209  else
1210  mooseError("Unrecognized variable ", vci._dest_name, " in variables to copy.");
1211  }
1212 
1213  if (did_copy)
1214  solution().close();
1215 }
NumericVector< Number > & solution()
Definition: SystemBase.h:182
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1004
int convert< int >(const std::string &str, bool throw_on_failure)
Definition: MooseUtils.C:999
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual System & system()=0
Get the reference to the libMesh system.
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:807
virtual void close()=0
static std::string arrayVariableComponent(const std::string &var_name, unsigned int i)
Returns the variable name of a component of an array variable.
Definition: SubProblem.h:271
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:86
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:832

◆ 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 98 of file SolverSystem.h.

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

99 {
100  return _current_solution;
101 }
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79

◆ customSetup()

void NonlinearSystemBase::customSetup ( const ExecFlagType exec_type)
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 352 of file NonlinearSystemBase.C.

353 {
354  SolverSystem::customSetup(exec_type);
355 
356  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
357  {
358  _kernels.customSetup(exec_type, tid);
359  _nodal_kernels.customSetup(exec_type, tid);
360  _dirac_kernels.customSetup(exec_type, tid);
361  if (_doing_dg)
362  _dg_kernels.customSetup(exec_type, tid);
363  _interface_kernels.customSetup(exec_type, tid);
364  _element_dampers.customSetup(exec_type, tid);
365  _nodal_dampers.customSetup(exec_type, tid);
366  _integrated_bcs.customSetup(exec_type, tid);
367 
368  if (_fe_problem.haveFV())
369  {
370  std::vector<FVFluxBC *> bcs;
372  .query()
373  .template condition<AttribSystem>("FVFluxBC")
374  .template condition<AttribThread>(tid)
375  .queryInto(bcs);
376 
377  std::vector<FVInterfaceKernel *> iks;
379  .query()
380  .template condition<AttribSystem>("FVInterfaceKernel")
381  .template condition<AttribThread>(tid)
382  .queryInto(iks);
383 
384  std::vector<FVFluxKernel *> kernels;
386  .query()
387  .template condition<AttribSystem>("FVFluxKernel")
388  .template condition<AttribThread>(tid)
389  .queryInto(kernels);
390 
391  for (auto * bc : bcs)
392  bc->customSetup(exec_type);
393  for (auto * ik : iks)
394  ik->customSetup(exec_type);
395  for (auto * kernel : kernels)
396  kernel->customSetup(exec_type);
397  }
398  }
399  _scalar_kernels.customSetup(exec_type);
400  _constraints.customSetup(exec_type);
401  _general_dampers.customSetup(exec_type);
402  _nodal_bcs.customSetup(exec_type);
403 }
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:954
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:1510
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:198

◆ deactiveAllMatrixTags()

void SystemBase::deactiveAllMatrixTags ( )
virtualinherited

Make matrices inactive.

Definition at line 1099 of file SystemBase.C.

Referenced by NonlinearSystemBase::computeResidualTags(), and NonlinearSystemBase::setInitialSolution().

1100 {
1101  auto num_matrix_tags = _subproblem.numMatrixTags();
1102 
1103  _matrix_tag_active_flags.resize(num_matrix_tags);
1104 
1105  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1106  _matrix_tag_active_flags[tag] = false;
1107 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:991
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:220

◆ deactiveMatrixTag()

void SystemBase::deactiveMatrixTag ( TagID  tag)
virtualinherited

deactive a matrix for tag

Definition at line 1087 of file SystemBase.C.

1088 {
1089  mooseAssert(_subproblem.matrixTagExists(tag),
1090  "Cannot deactivate Matrix with matrix_tag : " << tag << "that does not exist");
1091 
1092  if (_matrix_tag_active_flags.size() < tag + 1)
1093  _matrix_tag_active_flags.resize(tag + 1);
1094 
1095  _matrix_tag_active_flags[tag] = false;
1096 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:991
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ debuggingResiduals()

void NonlinearSystemBase::debuggingResiduals ( bool  state)
inlineinherited

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 297 of file SystemBase.h.

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

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

◆ 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 290 of file SystemBase.h.

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

291  {
293  }
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:270
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:280
virtual TagID residualVectorTag() const
Definition: SystemBase.h:285

◆ disassociateDefaultMatrixTags()

void SystemBase::disassociateDefaultMatrixTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 1066 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultMatrixTags().

1067 {
1068  const auto tags = defaultMatrixTags();
1069  for (const auto tag : tags)
1070  if (_subproblem.matrixTagExists(tag))
1072 }
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition: SystemBase.h:297
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1044
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ disassociateDefaultVectorTags()

void SystemBase::disassociateDefaultVectorTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 971 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultVectorTags().

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

◆ disassociateMatrixFromTag() [1/2]

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

Disassociate a matrix from a tag.

Reimplemented in DisplacedSystem.

Definition at line 1044 of file SystemBase.C.

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

1045 {
1046  if (!_subproblem.matrixTagExists(tag))
1047  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1048  if (hasMatrix(tag) && &getMatrix(tag) != &matrix)
1049  mooseError("You can not disassociate a matrix from a tag which it was not associated to");
1050 
1052 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1044
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ 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 1055 of file SystemBase.C.

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

◆ disassociateVectorFromTag() [1/2]

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

Disassociate a given vector from a given tag.

Reimplemented in DisplacedSystem.

Definition at line 949 of file SystemBase.C.

Referenced by FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeNodalBCs(), FEProblemBase::computeResidualAndJacobian(), FEProblemBase::computeResidualInternal(), NonlinearSystemBase::computeResidualTag(), FEProblemBase::computeResidualTag(), FEProblemBase::computeResidualType(), SystemBase::disassociateDefaultVectorTags(), DisplacedSystem::disassociateVectorFromTag(), and CentralDifference::initialSetup().

950 {
951  if (!_subproblem.vectorTagExists(tag))
952  mooseError("Cannot disassociate vector from tag ", tag, " because that tag does not exist");
953  if (hasVector(tag) && &getVector(tag) != &vec)
954  mooseError("You can not disassociate a vector from a tag which it was not associated to");
955 
957 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:949
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ 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 960 of file SystemBase.C.

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

◆ 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 1144 of file SystemBase.C.

1145 {
1146  return system().get_dof_map();
1147 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ doingDG()

bool NonlinearSystemBase::doingDG ( ) const
inherited

Getter for _doing_dg.

Definition at line 3672 of file NonlinearSystemBase.C.

3673 {
3674  return _doing_dg;
3675 }
bool _doing_dg
true if DG is active (optimization reasons)

◆ duDotDotDu() [1/2]

virtual Number& SystemBase::duDotDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 235 of file SystemBase.h.

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

235 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:984

◆ duDotDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 237 of file SystemBase.h.

237 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:984

◆ duDotDu() [1/2]

virtual Number& SystemBase::duDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 234 of file SystemBase.h.

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

234 { return _du_dot_du; }
Real _du_dot_du
Definition: SystemBase.h:983

◆ duDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 236 of file SystemBase.h.

236 { return _du_dot_du; }
Real _du_dot_du
Definition: SystemBase.h:983

◆ eigenKernelOnCurrent()

void MooseEigenSystem::eigenKernelOnCurrent ( )

Definition at line 213 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::nonlinearSolve().

214 {
215  _active_on_old = false;
216  _fe_problem.updateActiveObjects(); // update warehouse active objects
217 }
virtual void updateActiveObjects()
Update the active objects in the warehouses.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ eigenKernelOnOld()

void MooseEigenSystem::eigenKernelOnOld ( )

Ask eigenkernels to operate on old or current solution vectors.

Definition at line 206 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::inversePowerIteration().

207 {
208  _active_on_old = true;
209  _fe_problem.updateActiveObjects(); // update warehouse active objects
210 }
virtual void updateActiveObjects()
Update the active objects in the warehouses.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ enforceNodalConstraintsJacobian()

void NonlinearSystemBase::enforceNodalConstraintsJacobian ( )
protectedinherited

Definition at line 1059 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

1060 {
1061  if (!hasMatrix(systemMatrixTag()))
1062  mooseError(" A system matrix is required");
1063 
1064  auto & jacobian = getMatrix(systemMatrixTag());
1065  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1066 
1068  {
1069  const auto & ncs = _constraints.getActiveNodalConstraints();
1070  for (const auto & nc : ncs)
1071  {
1072  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1073  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1074 
1075  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1076  {
1077  _fe_problem.reinitNodes(primary_node_ids, tid);
1078  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1079  nc->computeJacobian(jacobian);
1080  }
1081  }
1083  jacobian.close();
1084  }
1085 }
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:299
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:338
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:954
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980
unsigned int THREAD_ID
Definition: MooseTypes.h:198
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ enforceNodalConstraintsResidual()

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

Enforce nodal constraints.

Definition at line 1034 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualInternal().

1035 {
1036  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1037  residual.close();
1039  {
1040  const auto & ncs = _constraints.getActiveNodalConstraints();
1041  for (const auto & nc : ncs)
1042  {
1043  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1044  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1045 
1046  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1047  {
1048  _fe_problem.reinitNodes(primary_node_ids, tid);
1049  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1050  nc->computeResidual(residual);
1051  }
1052  }
1053  _fe_problem.addCachedResidualDirectly(residual, tid);
1054  residual.close();
1055  }
1056 }
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< 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:954
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ feProblem() [1/2]

FEProblemBase& SystemBase::feProblem ( )
inlineinherited

Definition at line 104 of file SystemBase.h.

Referenced by DMMooseGetEmbedding_Private(), DMSetFromOptions_Moose(), and DMSetUp_Moose_Pre().

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

◆ feProblem() [2/2]

const FEProblemBase& SystemBase::feProblem ( ) const
inlineinherited

Definition at line 105 of file SystemBase.h.

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

◆ finalNonlinearResidual()

Real NonlinearSystemBase::finalNonlinearResidual ( ) const
inlineinherited

Return the final nonlinear residual.

Definition at line 537 of file NonlinearSystemBase.h.

537 { return _final_residual; }

◆ 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 1024 of file SystemBase.C.

1025 {
1026  for (auto tag : tags)
1027  if (hasMatrix(tag))
1028  getMatrix(tag).flush();
1029 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual void flush()
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:980

◆ 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 114 of file SystemBase.C.

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

115 {
116  return *_vars[tid].getActualFieldVariable<T>(var_name);
117 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 135 of file SystemBase.C.

136 {
137  return *_vars[tid].getActualFieldVariable<T>(var_number);
138 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ getConstraintWarehouse()

const ConstraintWarehouse& NonlinearSystemBase::getConstraintWarehouse ( ) const
inlineinherited

Definition at line 601 of file NonlinearSystemBase.h.

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

◆ getCurrentNonlinearIterationNumber()

virtual unsigned int NonlinearSystem::getCurrentNonlinearIterationNumber ( )
inlineoverridevirtualinherited

Returns the current nonlinear iteration number.

In libmesh, this is updated during the nonlinear solve, so it should be up-to-date.

Implements NonlinearSystemBase.

Definition at line 46 of file NonlinearSystem.h.

47  {
48  return _nl_implicit_sys.get_current_nonlinear_iteration_number();
49  }
NonlinearImplicitSystem & _nl_implicit_sys

◆ getDGKernelWarehouse()

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

Definition at line 586 of file NonlinearSystemBase.h.

586 { return _dg_kernels; }
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels

◆ getDiracKernelWarehouse()

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

Definition at line 591 of file NonlinearSystemBase.h.

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

◆ getEigenVariableNames()

const std::set<VariableName>& MooseEigenSystem::getEigenVariableNames ( ) const
inline

Get variable names of the eigen system.

Definition at line 94 of file MooseEigenSystem.h.

Referenced by buildSystemDoFIndices().

94 { return _eigen_var_names; }
std::set< VariableName > _eigen_var_names

◆ getElementDamperWarehouse()

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

Definition at line 593 of file NonlinearSystemBase.h.

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

594  {
595  return _element_dampers;
596  }
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 107 of file SystemBase.C.

Referenced by Marker::getMarkerValue().

108 {
109  return *_vars[tid].getFieldVariable<T>(var_name);
110 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 128 of file SystemBase.C.

129 {
130  return *_vars[tid].getFieldVariable<T>(var_number);
131 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 121 of file SystemBase.C.

122 {
123  return *_vars[tid].getFVVariable<T>(var_name);
124 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ getIntegratedBCWarehouse() [1/2]

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

Definition at line 592 of file NonlinearSystemBase.h.

Referenced by BoundaryElemIntegrityCheckThread::operator()().

592 { return _integrated_bcs; }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getIntegratedBCWarehouse() [2/2]

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

Return the IntegratedBCBase warehouse.

Definition at line 611 of file NonlinearSystemBase.h.

612  {
613  return _integrated_bcs;
614  }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getInterfaceKernelWarehouse()

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

Definition at line 587 of file NonlinearSystemBase.h.

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

◆ getKernelWarehouse()

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

Access functions to Warehouses from outside NonlinearSystemBase.

Definition at line 585 of file NonlinearSystemBase.h.

Referenced by DOFMapOutput::output().

585 { 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 980 of file SystemBase.C.

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

981 {
982  if (!hasMatrix(tag))
983  {
984  if (!_subproblem.matrixTagExists(tag))
985  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
986  else
987  mooseError("Cannot retreive matrix with tag ",
988  tag,
989  " in system '",
990  name(),
991  "'\nbecause a matrix has not been associated with that tag.");
992  }
993 
994  return *_tagged_matrices[tag];
995 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:989
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ getMatrix() [2/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 998 of file SystemBase.C.

999 {
1000  if (!hasMatrix(tag))
1001  {
1002  if (!_subproblem.matrixTagExists(tag))
1003  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
1004  else
1005  mooseError("Cannot retreive matrix with tag ",
1006  tag,
1007  " in system '",
1008  name(),
1009  "'\nbecause a matrix has not been associated with that tag.");
1010  }
1011 
1012  return *_tagged_matrices[tag];
1013 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:989
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:338
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:306

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inlineinherited

Returns the maximum number of all variables on the system.

Definition at line 860 of file SystemBase.h.

860 { return _max_var_number; }
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:968

◆ 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 573 of file SystemBase.h.

Referenced by Moose::globalDofIndexToDerivative().

573 { 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:1007

◆ 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 580 of file SystemBase.h.

580 { 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:1010

◆ 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 237 of file SystemBase.C.

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

◆ getMooseKSPNormType()

Moose::MooseKSPNormType SolverSystem::getMooseKSPNormType ( )
inlineinherited

Get the norm in which the linear convergence is measured.

Definition at line 67 of file SolverSystem.h.

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

67 { return _ksp_norm; }
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Definition: SolverSystem.h:84

◆ getNodalBCWarehouse()

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

Return the NodalBCBase warehouse.

Definition at line 606 of file NonlinearSystemBase.h.

606 { return _nodal_bcs; }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs

◆ getNodalDamperWarehouse()

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

Definition at line 597 of file NonlinearSystemBase.h.

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

598  {
599  return _nodal_dampers;
600  }
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.

◆ getNodeDofs()

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

Definition at line 2089 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::findImplicitGeometricCouplingEntries().

2090 {
2091  const Node & node = _mesh.nodeRef(node_id);
2092  unsigned int s = number();
2093  if (node.has_dofs(s))
2094  {
2095  for (unsigned int v = 0; v < nVariables(); v++)
2096  for (unsigned int c = 0; c < node.n_comp(s, v); c++)
2097  dofs.push_back(node.dof_number(s, v, c));
2098  }
2099 }
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:637
virtual unsigned int nVariables() const
Get the number of variables in this system.
Definition: SystemBase.C:847
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
MooseMesh & _mesh
Definition: SystemBase.h:959

◆ getPCSide()

Moose::PCSideType SolverSystem::getPCSide ( )
inlineinherited

Get the current preconditioner side.

Definition at line 56 of file SolverSystem.h.

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

56 { return _pc_side; }
Moose::PCSideType _pc_side
Preconditioning side.
Definition: SolverSystem.h:82

◆ getPreconditioner()

MoosePreconditioner const * NonlinearSystemBase::getPreconditioner ( ) const
inherited

Definition at line 3471 of file NonlinearSystemBase.C.

Referenced by ConsoleUtils::outputExecutionInformation().

3472 {
3473  return _preconditioner.get();
3474 }
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ getPredictor()

Predictor* NonlinearSystemBase::getPredictor ( )
inlineinherited

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 ( )
inherited

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

Definition at line 994 of file NonlinearSystemBase.C.

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

995 {
996  if (!_Re_non_time)
997  {
999 
1000  // Most applications don't need the expense of ghosting
1002  _Re_non_time = &addVector(_Re_non_time_tag, false, ptype);
1003  }
1005  {
1006  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
1007 
1008  // If an application changes its mind, the libMesh API lets us
1009  // change the vector.
1010  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
1011  }
1012 
1013  return *_Re_non_time;
1014 }
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
PARALLEL
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:82
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:951
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
ParallelType type() const
virtual System & system() override
Get the reference to the libMesh system.
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:199
ParallelType

◆ getResidualTimeVector()

NumericVector< Number > & NonlinearSystemBase::getResidualTimeVector ( )
inherited

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

Definition at line 971 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::residualVector().

972 {
973  if (!_Re_time)
974  {
976 
977  // Most applications don't need the expense of ghosting
979  _Re_time = &addVector(_Re_time_tag, false, ptype);
980  }
981  else if (_need_residual_ghosted && _Re_time->type() == PARALLEL)
982  {
983  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
984 
985  // If an application changes its mind, the libMesh API lets us
986  // change the vector.
987  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
988  }
989 
990  return *_Re_time;
991 }
NumericVector< Number > * _Re_time
residual vector for time contributions
TagID _Re_time_tag
Tag for time contribution residual.
PARALLEL
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:82
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:951
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
ParallelType type() const
virtual System & system() override
Get the reference to the libMesh system.
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:199
ParallelType

◆ 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 141 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(), ReferenceResidualProblem::initialSetup(), and NonlinearSystemBase::setupScalingData().

142 {
143  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
144  if (!var)
145  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
146  return *var;
147 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
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 150 of file SystemBase.C.

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

◆ getScalarVariables()

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

◆ getSharedTimeIntegrator()

std::shared_ptr<TimeIntegrator> SystemBase::getSharedTimeIntegrator ( )
inlineinherited

Definition at line 882 of file SystemBase.h.

Referenced by DisplacedProblem::DisplacedProblem().

882 { return _time_integrator; }
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013

◆ getSNES()

SNES NonlinearSystem::getSNES ( )
overridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 353 of file NonlinearSystem.C.

354 {
355  PetscNonlinearSolver<Number> * petsc_solver =
357 
358  if (petsc_solver)
359  return petsc_solver->snes();
360  else
361  mooseError("It is not a petsc nonlinear solver");
362 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual NonlinearSolver< Number > * nonlinearSolver() override

◆ getSplit()

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

Retrieves a split by name.

Parameters
nameThe name of the split

Definition at line 689 of file NonlinearSystemBase.C.

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

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

◆ 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 752 of file SystemBase.h.

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

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

◆ getSubdomainsForVar() [2/2]

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

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 763 of file SystemBase.h.

764  {
765  return getSubdomainsForVar(getVariable(0, var_name).number());
766  }
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:752
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:86

◆ getTimeIntegrator() [1/2]

TimeIntegrator* SystemBase::getTimeIntegrator ( )
inlineinherited

◆ getTimeIntegrator() [2/2]

const TimeIntegrator* SystemBase::getTimeIntegrator ( ) const
inlineinherited

Definition at line 880 of file SystemBase.h.

880 { return _time_integrator.get(); }
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013

◆ 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 86 of file SystemBase.C.

Referenced by AdaptivityAction::act(), Assembly::addJacobianBlock(), Assembly::addJacobianBlockNonlocal(), FEProblemBase::addJacobianBlockTags(), Assembly::addJacobianNeighbor(), 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(), ReferenceResidualProblem::initialSetup(), LinearSystem::initialSetup(), Assembly::initNonlocalCoupling(), PNGOutput::makeMeshFunc(), FEProblemBase::prepare(), Assembly::prepareBlock(), Assembly::prepareBlockNonlocal(), AddPeriodicBCAction::setPeriodicVars(), NonlinearSystemBase::setupScalingData(), UpdateErrorVectorsThread::UpdateErrorVectorsThread(), and VariableCondensationPreconditioner::VariableCondensationPreconditioner().

87 {
89  dynamic_cast<MooseVariableFieldBase *>(_vars[tid].getVariable(var_name));
90  if (!var)
91  mooseError("Variable '", var_name, "' does not exist in this system");
92  return *var;
93 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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:964

◆ 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 96 of file SystemBase.C.

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

◆ 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 160 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

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

◆ 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 835 of file SystemBase.h.

835 { 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:1028

◆ getVariableNames()

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

Definition at line 853 of file SystemBase.h.

Referenced by buildSystemDoFIndices(), NonlinearSystemBase::checkKernelCoverage(), SystemBase::hasVariable(), SystemBase::isArrayVariable(), AddPeriodicBCAction::setPeriodicVars(), and SingleMatrixPreconditioner::SingleMatrixPreconditioner().

853 { return _vars[0].names(); }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 889 of file SystemBase.C.

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

890 {
891  return system().get_vector(name);
892 }
virtual const std::string & name() const
Definition: SystemBase.C:1293
virtual System & system()=0
Get the reference to the libMesh system.

◆ getVector() [2/4]

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

Reimplemented in DisplacedSystem.

Definition at line 895 of file SystemBase.C.

896 {
897  return system().get_vector(name);
898 }
virtual const std::string & name() const
Definition: SystemBase.C:1293
virtual System & system()=0
Get the reference to the libMesh system.

◆ getVector() [3/4]

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

Get a raw NumericVector by tag.

Reimplemented in DisplacedSystem.

Definition at line 901 of file SystemBase.C.

902 {
903  if (!hasVector(tag))
904  {
905  if (!_subproblem.vectorTagExists(tag))
906  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
907  else
908  mooseError("Cannot retreive vector with tag ",
909  tag,
910  " in system '",
911  name(),
912  "'\nbecause a vector has not been associated with that tag.");
913  }
914 
915  return *_tagged_vectors[tag];
916 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:987

◆ getVector() [4/4]

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

Reimplemented in DisplacedSystem.

Definition at line 919 of file SystemBase.C.

920 {
921  if (!hasVector(tag))
922  {
923  if (!_subproblem.vectorTagExists(tag))
924  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
925  else
926  mooseError("Cannot retreive vector with tag ",
927  tag,
928  " in system '",
929  name(),
930  "'\nbecause a vector has not been associated with that tag.");
931  }
932 
933  return *_tagged_vectors[tag];
934 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:987

◆ gradientContainer()

std::vector<std::unique_ptr<NumericVector<Number> > >& SystemBase::gradientContainer ( )
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 932 of file SystemBase.h.

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

◆ hasDiagSaveIn()

bool NonlinearSystemBase::hasDiagSaveIn ( ) const
inlineinherited

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

Definition at line 626 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::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

Check if the tagged matrix exists in the system.

Reimplemented in DisplacedSystem.

Definition at line 338 of file SystemBase.h.

Referenced by SystemBase::activeAllMatrixTags(), Assembly::addCachedJacobian(), NonlinearSystemBase::addImplicitGeometricCouplingEntries(), Assembly::addJacobianCoupledVarPair(), Assembly::addJacobianLowerD(), Assembly::addJacobianNeighbor(), Assembly::addJacobianNeighborLowerD(), Assembly::addJacobianNonlocal(), SystemBase::addMatrix(), Assembly::cacheJacobian(), Assembly::cacheJacobianBlock(), Assembly::cacheJacobianBlockNonzero(), Assembly::cacheJacobianCoupledVarPair(), Assembly::cacheJacobianMortar(), Assembly::cacheJacobianNeighbor(), Assembly::cacheJacobianNonlocal(), SystemBase::closeTaggedMatrices(), NonlinearSystemBase::computeJacobianInternal(), FEProblemBase::computeJacobianTags(), FEProblemBase::computeResidualAndJacobian(), NonlinearSystemBase::computeResidualAndJacobianInternal(), NonlinearSystemBase::constraintJacobians(), SystemBase::disassociateMatrixFromTag(), NonlinearSystemBase::enforceNodalConstraintsJacobian(), SystemBase::flushTaggedMatrices(), SystemBase::getMatrix(), DisplacedSystem::hasMatrix(), MooseVariableScalar::reinit(), SystemBase::removeMatrix(), SubProblem::selectMatrixTagsFromSystem(), Assembly::setCachedJacobian(), and Assembly::zeroCachedJacobian().

339  {
340  return tag < _tagged_matrices.size() && _tagged_matrices[tag];
341  }
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:989

◆ hasSaveIn()

bool NonlinearSystemBase::hasSaveIn ( ) const
inlineinherited

Weather or not the nonlinear system has save-ins.

Definition at line 621 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags().

621 { 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 832 of file SystemBase.C.

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

833 {
834  if (system().has_variable(var_name))
835  return system().variable_type(var_name).family == SCALAR;
836  else
837  return false;
838 }
SCALAR
virtual System & system()=0
Get the reference to the libMesh system.

◆ 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 1053 of file SystemBase.h.

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

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

◆ hasVarCopy()

bool SystemBase::hasVarCopy ( ) const
inlineinherited

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

Definition at line 885 of file SystemBase.h.

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

◆ 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 807 of file SystemBase.C.

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

808 {
809  auto & names = getVariableNames();
810  if (system().has_variable(var_name))
811  return system().variable_type(var_name).family != SCALAR;
812  if (std::find(names.begin(), names.end(), var_name) != names.end())
813  // array variable
814  return true;
815  else
816  return false;
817 }
SCALAR
virtual System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:853

◆ 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 259 of file SystemBase.h.

260  {
261  return tag_id < _tagged_vectors.size() && _tagged_vectors[tag_id];
262  }
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:987

◆ haveFieldSplitPreconditioner()

bool NonlinearSystemBase::haveFieldSplitPreconditioner ( ) const
inlineinherited

Definition at line 108 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::setupDM().

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

◆ haveFiniteDifferencedPreconditioner()

bool NonlinearSystemBase::haveFiniteDifferencedPreconditioner ( ) const
inlineinherited

Definition at line 104 of file NonlinearSystemBase.h.

105  {
107  }
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)
inlineinherited

Definition at line 669 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

670  {
671  _ignore_variables_for_autoscaling = ignore_variables_for_autoscaling;
672  }
std::vector< std::string > _ignore_variables_for_autoscaling
A container for variables that do not partipate in autoscaling.

◆ init()

void NonlinearSystem::init ( )
overridevirtualinherited

Initialize the system.

Reimplemented from NonlinearSystemBase.

Definition at line 121 of file NonlinearSystem.C.

122 {
124 
125  if (_automatic_scaling && _resid_vs_jac_scaling_param < 1. - TOLERANCE)
126  // Add diagonal matrix that will be used for computing scaling factors
127  _nl_implicit_sys.add_matrix<DiagonalMatrix>("scaling_matrix");
128 }
virtual void init() override
Initialize the system.
NonlinearImplicitSystem & _nl_implicit_sys
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1019

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

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

Definition at line 161 of file SystemBase.h.

161 {};

◆ initialResidual()

Real NonlinearSystemBase::initialResidual ( ) const
inherited

The initial residual.

Definition at line 728 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::referenceResidual().

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

◆ initialSetup()

void NonlinearSystemBase::initialSetup ( )
overridevirtualinherited

Setup Functions.

Reimplemented from SystemBase.

Definition at line 197 of file NonlinearSystemBase.C.

198 {
199  TIME_SECTION("nlInitialSetup", 2, "Setting Up Nonlinear System");
200 
202 
203  {
204  TIME_SECTION("kernelsInitialSetup", 2, "Setting Up Kernels/BCs/Constraints");
205 
206  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
207  {
208  _kernels.initialSetup(tid);
211  if (_doing_dg)
214 
218 
219  if (_fe_problem.haveFV())
220  {
221  std::vector<FVElementalKernel *> fv_elemental_kernels;
223  .query()
224  .template condition<AttribSystem>("FVElementalKernel")
225  .template condition<AttribThread>(tid)
226  .queryInto(fv_elemental_kernels);
227 
228  for (auto * fv_kernel : fv_elemental_kernels)
229  fv_kernel->initialSetup();
230 
231  std::vector<FVFluxKernel *> fv_flux_kernels;
233  .query()
234  .template condition<AttribSystem>("FVFluxKernel")
235  .template condition<AttribThread>(tid)
236  .queryInto(fv_flux_kernels);
237 
238  for (auto * fv_kernel : fv_flux_kernels)
239  fv_kernel->initialSetup();
240  }
241  }
242 
247  }
248 
249  {
250  TIME_SECTION("mortarSetup", 2, "Initializing Mortar Interfaces");
251 
252  auto create_mortar_functors = [this](const bool displaced)
253  {
254  // go over mortar interfaces and construct functors
255  const auto & mortar_interfaces = _fe_problem.getMortarInterfaces(displaced);
256  for (const auto & mortar_interface : mortar_interfaces)
257  {
258  const auto primary_secondary_boundary_pair = mortar_interface.first;
259  if (!_constraints.hasActiveMortarConstraints(primary_secondary_boundary_pair, displaced))
260  continue;
261 
262  const auto & mortar_generation_object = mortar_interface.second;
263 
264  auto & mortar_constraints =
265  _constraints.getActiveMortarConstraints(primary_secondary_boundary_pair, displaced);
266 
267  auto & subproblem = displaced
268  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
269  : static_cast<SubProblem &>(_fe_problem);
270 
271  auto & mortar_functors =
273 
274  mortar_functors.emplace(primary_secondary_boundary_pair,
275  ComputeMortarFunctor(mortar_constraints,
276  mortar_generation_object,
277  subproblem,
278  _fe_problem,
279  displaced,
280  subproblem.assembly(0, number())));
281  }
282  };
283 
284  create_mortar_functors(false);
285  create_mortar_functors(true);
286  }
287 
288  if (_automatic_scaling)
289  {
291  _scaling_matrix = std::make_unique<OffDiagonalScalingMatrix<Number>>(_communicator);
292  else
293  _scaling_matrix = std::make_unique<DiagonalMatrix<Number>>(_communicator);
294  }
295 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
std::unique_ptr< DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
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.
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:1019
SubProblem & subproblem()
Definition: SystemBase.h:102
MooseObjectTagWarehouse< KernelBase > _kernels
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1132
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:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
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:1483
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ initSolutionState()

void SystemBase::initSolutionState ( )
virtualinherited

Initializes the solution state.

Reimplemented in DisplacedSystem.

Definition at line 1317 of file SystemBase.C.

Referenced by DisplacedSystem::initSolutionState().

1318 {
1319  // Default is the current solution
1320  unsigned int state = 0;
1321 
1322  // Add additional states as required by the variable states requested
1323  for (const auto & var : getVariables(/* tid = */ 0))
1324  state = std::max(state, var->oldestSolutionStateRequested());
1325  for (const auto & var : getScalarVariables(/* tid = */ 0))
1326  state = std::max(state, var->oldestSolutionStateRequested());
1327 
1329 
1331 }
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:1389
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
Definition: SystemBase.h:742
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:747
bool _solution_states_initialized
Whether or not the solution states have been initialized.
Definition: SystemBase.h:1025
auto max(const L &left, const R &right)

◆ initSystemSolution()

void MooseEigenSystem::initSystemSolution ( SYSTEMTAG  tag,
Real  v 
)

Initialize the solution vector with a constant value.

Parameters
tagSystem tag.
vThe value.

Definition at line 160 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

161 {
162  if (tag == ALL)
163  {
164  solution() = v;
165  }
166  else if (tag == EIGEN)
167  {
168  if (_all_eigen_vars)
169  {
170  solution() = v;
171  }
172  else
173  {
174  for (const auto & dof : _eigen_var_indices)
175  solution().set(dof, v);
176  }
177  }
178  solution().close();
179  update();
180 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
NumericVector< Number > & solution()
Definition: SystemBase.h:182
virtual void close()=0
std::set< dof_id_type > _eigen_var_indices
virtual void set(const numeric_index_type i, const Number value)=0

◆ initSystemSolutionOld()

void MooseEigenSystem::initSystemSolutionOld ( SYSTEMTAG  tag,
Real  v 
)

Definition at line 183 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

184 {
185  if (tag == ALL)
186  {
187  solutionOld() = v;
188  }
189  else if (tag == EIGEN)
190  {
191  if (_all_eigen_vars)
192  {
193  solutionOld() = v;
194  }
195  else
196  {
197  for (const auto & dof : _eigen_var_indices)
198  solutionOld().set(dof, v);
199  }
200  }
201  solutionOld().close();
202  update();
203 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
virtual void close()=0
std::set< dof_id_type > _eigen_var_indices
virtual void set(const numeric_index_type i, const Number value)=0
NumericVector< Number > & solutionOld()
Definition: SystemBase.h:183

◆ isArrayVariable()

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

If a variable is an array variable.

Definition at line 820 of file SystemBase.C.

821 {
822  auto & names = getVariableNames();
823  if (!system().has_variable(var_name) &&
824  std::find(names.begin(), names.end(), var_name) != names.end())
825  // array variable
826  return true;
827  else
828  return false;
829 }
virtual System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:853

◆ isScalarVariable()

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

Definition at line 841 of file SystemBase.C.

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

842 {
843  return (system().variable(var_num).type().family == SCALAR);
844 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ jacobianSetup()

void NonlinearSystemBase::jacobianSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 2691 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2692 {
2694 
2695  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
2696  {
2697  _kernels.jacobianSetup(tid);
2700  if (_doing_dg)
2706  }
2711 
2712  // Avoid recursion
2713  if (this == &_fe_problem.currentNonlinearSystem())
2716 }
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:1531
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:138
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
virtual void jacobianSetup(THREAD_ID tid=0) const
ConstraintWarehouse _constraints
Constraints storage object.
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
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:198

◆ markEigenVariable()

void MooseEigenSystem::markEigenVariable ( const VariableName &  var_name)
virtual

Mark a variable as a variable of the eigen system.

Parameters
var_nameThe name of the variable.

Definition at line 74 of file MooseEigenSystem.C.

Referenced by addKernel(), and AddVariableAction::addVariable().

75 {
76  _eigen_var_names.insert(var_name);
77 }
std::set< VariableName > _eigen_var_names

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtualinherited

If or not a matrix tag is active.

Definition at line 1124 of file SystemBase.C.

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

◆ mesh() [1/2]

MooseMesh& SystemBase::mesh ( )
inlineinherited

◆ mesh() [2/2]

const MooseMesh& SystemBase::mesh ( ) const
inlineinherited

Definition at line 101 of file SystemBase.h.

101 { return _mesh; }
MooseMesh & _mesh
Definition: SystemBase.h:959

◆ mortarConstraints()

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

Do mortar constraint residual/jacobian computations.

Definition at line 3685 of file NonlinearSystemBase.C.

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

3688 {
3689  parallel_object_only();
3690 
3691  try
3692  {
3693  for (auto & map_pr : _undisplaced_mortar_functors)
3694  map_pr.second(compute_type, vector_tags, matrix_tags);
3695 
3696  for (auto & map_pr : _displaced_mortar_functors)
3697  map_pr.second(compute_type, vector_tags, matrix_tags);
3698  }
3699  catch (MetaPhysicL::LogicError &)
3700  {
3701  mooseError(
3702  "We caught a MetaPhysicL error in NonlinearSystemBase::mortarConstraints. This is very "
3703  "likely due to AD not having a sufficiently large derivative container size. Please run "
3704  "MOOSE configure with the '--with-derivative-size=<n>' option");
3705  }
3706 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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
inherited

Indicated whether this system needs material properties on boundaries.

Returns
Boolean if IntegratedBCs are active

Definition at line 3653 of file NonlinearSystemBase.C.

3654 {
3655  return _integrated_bcs.hasActiveBoundaryObjects(bnd_id, tid);
3656 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ needInterfaceMaterialOnSide()

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

Indicated whether this system needs material properties on interfaces.

Returns
Boolean if IntegratedBCs are active

Definition at line 3659 of file NonlinearSystemBase.C.

3660 {
3661  return _interface_kernels.hasActiveBoundaryObjects(bnd_id, tid);
3662 }
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 1389 of file SystemBase.C.

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

1391 {
1392  libmesh_parallel_only(this->comm());
1393 
1394  if (hasSolutionState(state, iteration_type))
1395  return;
1396 
1397  auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1398  solution_states.resize(state + 1);
1399 
1400  // The 0-th (current) solution state is owned by libMesh
1401  if (!solution_states[0])
1402  solution_states[0] = &solutionInternal();
1403  else
1404  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1405 
1406  // We will manually add all states past current
1407  for (unsigned int i = 1; i <= state; ++i)
1408  if (!solution_states[i])
1409  {
1410  auto tag = _subproblem.addVectorTag(oldSolutionStateVectorName(i, iteration_type),
1412  solution_states[i] = &addVector(tag, true, GHOSTED);
1413  }
1414  else
1415  mooseAssert(solution_states[i] == &getVector(oldSolutionStateVectorName(i, iteration_type)),
1416  "Inconsistent solution state");
1417 }
virtual NumericVector< Number > & solutionInternal() const =0
Internal getter for solution owned by libMesh.
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:82
const Parallel::Communicator & comm() const
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
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:1053
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:1334
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ needSubdomainMaterialOnSide()

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

Indicates whether this system needs material properties on internal sides.

Returns
Boolean if DGKernels are active

Definition at line 3665 of file NonlinearSystemBase.C.

3667 {
3668  return _doing_dg;
3669 }
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 856 of file SystemBase.C.

Referenced by SystemBase::nVariables().

857 {
858  unsigned int n = 0;
859  for (auto & var : _vars[0].fieldVariables())
860  n += var->count();
861 
862  return n;
863 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 866 of file SystemBase.C.

Referenced by MooseMesh::cacheFVElementalDoFs().

867 {
868  unsigned int n = 0;
869  for (auto & var : _vars[0].fieldVariables())
870  if (var->isFV())
871  n += var->count();
872 
873  return n;
874 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ nLinearIterations()

unsigned int NonlinearSystemBase::nLinearIterations ( ) const
inlineinherited

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
inlineinherited

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
inlineinherited

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 NonlinearSolver<Number>* NonlinearSystem::nonlinearSolver ( )
inlineoverridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 61 of file NonlinearSystem.h.

Referenced by NonlinearSystem::attachPreconditioner(), NonlinearSystem::getSNES(), NonlinearSystem::NonlinearSystem(), and NonlinearSystem::residualAndJacobianTogether().

62  {
63  return _nl_implicit_sys.nonlinear_solver.get();
64  }
NonlinearImplicitSystem & _nl_implicit_sys

◆ nonTimeVectorTag()

TagID NonlinearSystemBase::nonTimeVectorTag ( ) const
inlineoverridevirtualinherited

Reimplemented from SystemBase.

Definition at line 638 of file NonlinearSystemBase.h.

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

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

◆ nResidualEvaluations()

unsigned int NonlinearSystemBase::nResidualEvaluations ( ) const
inlineinherited

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 1132 of file SystemBase.C.

Referenced by FEProblemBase::addCachedResidualDirectly(), FEProblemBase::addJacobian(), FEProblemBase::addJacobianBlockTags(), FEProblemBase::addJacobianLowerD(), FEProblemBase::addJacobianNeighbor(), FEProblemBase::addJacobianNeighborLowerD(), FEProblemBase::addJacobianOffDiagScalar(), FEProblemBase::addJacobianScalar(), LinearFVElementalKernel::addMatrixContribution(), LinearFVFluxKernel::addMatrixContribution(), FEProblemBase::addResidual(), FEProblemBase::addResidualLower(), FEProblemBase::addResidualNeighbor(), FEProblemBase::addResidualScalar(), LinearFVElementalKernel::addRightHandSideContribution(), LinearFVFluxKernel::addRightHandSideContribution(), SystemBase::addScalingVector(), ADKernelTempl< T >::ADKernelTempl(), ArrayKernel::ArrayKernel(), NonlinearSystemBase::assembleScalingVector(), MooseMesh::cacheFaceInfoVariableOwnership(), MooseVariableScalar::computeAD(), FEProblemBase::computeBounds(), Assembly::computeFaceMap(), VectorNodalBC::computeJacobian(), ArrayNodalBC::computeJacobian(), NodalBC::computeJacobian(), FVBoundaryScalarLagrangeMultiplierConstraint::computeJacobian(), FVFluxBC::computeJacobian(), FVFluxKernel::computeJacobian(), FVInterfaceKernel::computeJacobian(), FEProblemBase::computeJacobianBlock(), NonlinearSystemBase::computeJacobianInternal(), FEProblemBase::computeNearNullSpace(), NonlinearSystemBase::computeNodalBCsResidualAndJacobian(), FEProblemBase::computeNullSpace(), VectorNodalBC::computeOffDiagJacobian(), ArrayNodalBC::computeOffDiagJacobian(), NodalBC::computeOffDiagJacobian(), NodalKernel::computeOffDiagJacobian(), ComputeFullJacobianThread::computeOnBoundary(), ComputeFullJacobianThread::computeOnElement(), ComputeFullJacobianThread::computeOnInterface(), ComputeFullJacobianThread::computeOnInternalFace(), FEProblemBase::computePostCheck(), EqualValueEmbeddedConstraint::computeQpJacobian(), EqualValueEmbeddedConstraint::computeQpOffDiagJacobian(), FVOrthogonalBoundaryDiffusion::computeQpResidual(), FVBoundaryScalarLagrangeMultiplierConstraint::computeResidual(), FVFluxBC::computeResidual(), FVFluxKernel::computeResidual(), FVInterfaceKernel::computeResidual(), Kernel::computeResidualAndJacobian(), NodalBC::computeResidualAndJacobian(), IntegratedBC::computeResidualAndJacobian(), NonlinearSystemBase::computeResidualAndJacobianInternal(), NonlinearSystemBase::computeResidualInternal(), NonlinearSystemBase::computeResidualTags(), NonlinearSystemBase::computeScaling(), Assembly::computeSinglePointMapAD(), FEProblemBase::computeTransposeNullSpace(), DebugResidualAux::computeValue(), NearestNodeValueAux::computeValue(), NonlinearSystemBase::constraintJacobians(), Coupleable::coupled(), FEProblemBase::currentLinearSysNum(), FEProblemBase::currentNlSysNum(), PseudoTimestep::currentResidualNorm(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), Moose::doDerivatives(), VariableResidual::execute(), NodalNormalsCorner::execute(), GreaterThanLessThanPostprocessor::execute(), NodalNormalsEvaluator::execute(), NodalNormalsPreprocessor::execute(), ComputeLinearFVElementalThread::fetchSystemContributionObjects(), ComputeLinearFVFaceThread::fetchSystemContributionObjects(), ElementSubdomainModifier::finalize(), NumNonlinearIterations::finalize(), BoundsBase::getDoFIndex(), NonlinearSystemBase::getNodeDofs(), SystemBase::getSubdomainsForVar(), NumLinearIterations::getValue(), Residual::getValue(), NumResidualEvaluations::getValue(), Moose::globalDofIndexToDerivative(), LinearFVFluxKernel::hasFaceSide(), LinearFVBoundaryCondition::hasFaceSide(), FVBoundaryCondition::hasFaceSide(), NonlinearSystemBase::initialSetup(), ActivateElementsUserObjectBase::initSolutions(), EigenExecutionerBase::inversePowerIteration(), Kernel::Kernel(), MooseVariableInterface< Real >::MooseVariableInterface(), EigenExecutionerBase::nonlinearSolve(), ComputeDiracThread::onElement(), ComputeNodalKernelBCJacobiansThread::onNode(), ComputeNodalKernelJacobiansThread::onNode(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), FEProblemBase::prepare(), FEProblemBase::prepareAssembly(), SystemBase::prepareFace(), FEProblemBase::prepareFaceShapes(), FEProblemBase::prepareNeighborShapes(), FEProblemBase::prepareShapes(), EqualValueEmbeddedConstraint::reinitConstraint(), FEProblemBase::reinitDirac(), FEProblemBase::reinitNeighborPhys(), FEProblemBase::reinitOffDiagScalars(), LinearFVFluxKernel::setCurrentFaceInfo(), FEProblemBase::setResidual(), FEProblemBase::setResidualNeighbor(), PhysicsBasedPreconditioner::setup(), FVInterfaceKernel::setupData(), FEProblemSolve::solve(), ActuallyExplicitEuler::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(), and MortarConstraintBase::zeroInactiveLMDofs().

1133 {
1134  return system().number();
1135 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ nVariables()

unsigned int SystemBase::nVariables ( ) const
virtualinherited

Get the number of variables in this system.

Returns
the number of variables

Definition at line 847 of file SystemBase.C.

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

848 {
849  unsigned int n = nFieldVariables();
850  n += _vars[0].scalars().size();
851 
852  return n;
853 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
unsigned int nFieldVariables() const
Get the number of field variables in this system.
Definition: SystemBase.C:856

◆ offDiagonalsInAutoScaling() [1/2]

bool NonlinearSystemBase::offDiagonalsInAutoScaling ( ) const
inlineinherited

Definition at line 674 of file NonlinearSystemBase.h.

Referenced by ComputeJacobianForScalingThread::computeOnElement(), and FEProblemSolve::FEProblemSolve().

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)
inlineinherited

Definition at line 675 of file NonlinearSystemBase.h.

676  {
677  _off_diagonals_in_auto_scaling = off_diagonals_in_auto_scaling;
678  }
bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.

◆ onTimestepBegin()

void NonlinearSystemBase::onTimestepBegin ( )
inherited

Called at the beginning of the time step.

Definition at line 885 of file NonlinearSystemBase.C.

886 {
887  if (_time_integrator)
888  _time_integrator->preSolve();
889  if (_predictor.get())
890  _predictor->timestepSetup();
891 }
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ overwriteNodeFace()

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

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

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

Definition at line 1586 of file NonlinearSystemBase.C.

Referenced by ActuallyExplicitEuler::solve().

1587 {
1588  // Overwrite results from integrator in case we have explicit dynamics contact constraints
1590  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1591  : static_cast<SubProblem &>(_fe_problem);
1592  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1593 
1594  for (const auto & it : penetration_locators)
1595  {
1596  PenetrationLocator & pen_loc = *(it.second);
1597 
1598  const auto & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1599  const BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1600  const BoundaryID primary_boundary = pen_loc._primary_boundary;
1601 
1602  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, true))
1603  {
1604  const auto & constraints =
1605  _constraints.getActiveNodeFaceConstraints(secondary_boundary, true);
1606  for (const auto i : index_range(secondary_nodes))
1607  {
1608  const auto secondary_node_num = secondary_nodes[i];
1609  const Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1610 
1611  if (secondary_node.processor_id() == processor_id())
1612  if (pen_loc._penetration_info[secondary_node_num])
1613  for (const auto & nfc : constraints)
1614  {
1615  if (!nfc->isExplicitConstraint())
1616  continue;
1617 
1618  // Return if this constraint does not correspond to the primary-secondary pair
1619  // prepared by the outer loops.
1620  // This continue statement is required when, e.g. one secondary surface constrains
1621  // more than one primary surface.
1622  if (nfc->secondaryBoundary() != secondary_boundary ||
1623  nfc->primaryBoundary() != primary_boundary)
1624  continue;
1625 
1626  nfc->overwriteBoundaryVariables(soln, secondary_node);
1627  }
1628  }
1629  }
1630  }
1631  soln.close();
1632 }
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:637
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
boundary_id_type BoundaryID
SubProblem & subproblem()
Definition: SystemBase.h:102
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:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
MooseMesh & _mesh
Definition: SystemBase.h:959
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:133

◆ postAddResidualObject()

virtual void NonlinearSystemBase::postAddResidualObject ( ResidualObject )
inlineprotectedvirtualinherited

◆ prepare()

void SystemBase::prepare ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 252 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

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

◆ 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 275 of file SystemBase.C.

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

◆ 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 328 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

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

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 320 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

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

◆ preSMOResidual()

Real NonlinearSystemBase::preSMOResidual ( ) const
inherited

The pre-SMO residual.

Definition at line 719 of file NonlinearSystemBase.C.

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

720 {
722  mooseError("pre-SMO residual is requested but not evaluated.");
723 
724  return _pre_smo_residual;
725 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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 ( )
protectedinherited

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 3988 of file NonlinearSystemBase.C.

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

3989 {
3990  // Clear the iteration counters
3991  _current_l_its.clear();
3992  _current_nl_its = 0;
3993 
3994  // Initialize the solution vector using a predictor and known values from nodal bcs
3996 
3997  // Now that the initial solution has ben set, potentially perform a residual/Jacobian evaluation
3998  // to determine variable scaling factors
3999  if (_automatic_scaling)
4000  {
4001  const bool scaling_succeeded = computeScaling();
4002  if (!scaling_succeeded)
4003  return false;
4004  }
4005 
4006  // We do not know a priori what variable a global degree of freedom corresponds to, so we need a
4007  // map from global dof to scaling factor. We just use a ghosted NumericVector for that mapping
4009 
4010  return true;
4011 }
std::vector< unsigned int > _current_l_its
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1019
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)
inlineinherited

Force the printing of all variable norms after each solve.

Definition at line 549 of file NonlinearSystemBase.h.

◆ referenceResidual()

Real NonlinearSystemBase::referenceResidual ( ) const
inherited

The reference residual used in relative convergence check.

Definition at line 713 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::checkNonlinearConvergence(), and EigenExecutionerBase::inversePowerIteration().

714 {
716 }
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.

◆ 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 336 of file SystemBase.C.

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

◆ reinitElemFace()

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

Reinit assembly info for a side of an element.

Parameters
elemThe element
sideSide of of the element
bnd_idBoundary id on that side
tidThread ID

Reimplemented in AuxiliarySystem.

Definition at line 356 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

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

◆ reinitIncrementAtNodeForDampers()

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

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 3491 of file NonlinearSystemBase.C.

Referenced by ComputeNodalDampingThread::onNode().

3493 {
3494  for (const auto & var : damped_vars)
3495  var->computeIncrementAtNode(*_increment_vec);
3496 }
NumericVector< Number > * _increment_vec
increment vector

◆ reinitIncrementAtQpsForDampers()

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

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 3483 of file NonlinearSystemBase.C.

Referenced by ComputeElemDampingThread::onElement().

3485 {
3486  for (const auto & var : damped_vars)
3487  var->computeIncrementAtQps(*_increment_vec);
3488 }
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 386 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

387 {
388  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
389  for (const auto & var : vars)
390  var->computeLowerDValues();
391 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 378 of file SystemBase.C.

379 {
380  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
381  for (const auto & var : vars)
382  var->computeNeighborValues();
383 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ reinitNeighborFace()

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

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

Definition at line 367 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

371 {
372  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
373  for (const auto & var : vars)
374  var->computeNeighborValuesFace();
375 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 394 of file SystemBase.C.

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

◆ reinitNodeFace() [1/3]

void SystemBase::reinitNodeFace
inherited

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 406 of file SystemBase.C.

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

◆ 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 406 of file SystemBase.C.

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

◆ reinitNodeFace() [3/3]

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

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

Definition at line 1088 of file NonlinearSystemBase.C.

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

1092 {
1093  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1094  : static_cast<SubProblem &>(_fe_problem);
1095 
1096  const Elem * primary_elem = info._elem;
1097  unsigned int primary_side = info._side_num;
1098  std::vector<Point> points;
1099  points.push_back(info._closest_point);
1100 
1101  // *These next steps MUST be done in this order!*
1102  // ADL: This is a Chesterton's fence situation. I don't know which calls exactly the above comment
1103  // is referring to. If I had to guess I would guess just the reinitNodeFace and prepareAssembly
1104  // calls since the former will size the variable's dof indices and then the latter will resize the
1105  // residual/Jacobian based off the variable's cached dof indices size
1106 
1107  // This reinits the variables that exist on the secondary node
1108  _fe_problem.reinitNodeFace(&secondary_node, secondary_boundary, 0);
1109 
1110  // This will set aside residual and jacobian space for the variables that have dofs on
1111  // the secondary node
1113 
1114  _fe_problem.setNeighborSubdomainID(primary_elem, 0);
1115 
1116  //
1117  // Reinit material on undisplaced mesh
1118  //
1119 
1120  const Elem * const undisplaced_primary_elem =
1121  displaced ? _mesh.elemPtr(primary_elem->id()) : primary_elem;
1122  const Point undisplaced_primary_physical_point =
1123  [&points, displaced, primary_elem, undisplaced_primary_elem]()
1124  {
1125  if (displaced)
1126  {
1127  const Point reference_point =
1128  FEMap::inverse_map(primary_elem->dim(), primary_elem, points[0]);
1129  return FEMap::map(primary_elem->dim(), undisplaced_primary_elem, reference_point);
1130  }
1131  else
1132  // If our penetration locator is on the reference mesh, then our undisplaced
1133  // physical point is simply the point coming from the penetration locator
1134  return points[0];
1135  }();
1136 
1138  undisplaced_primary_elem, primary_side, {undisplaced_primary_physical_point}, 0);
1139  // Stateful material properties are only initialized for neighbor material data for internal faces
1140  // for discontinuous Galerkin methods or for conforming interfaces for interface kernels. We don't
1141  // have either of those use cases here where we likely have disconnected meshes
1142  _fe_problem.reinitMaterialsNeighbor(primary_elem->subdomain_id(), 0, /*swap_stateful=*/false);
1143 
1144  // Reinit points for constraint enforcement
1145  if (displaced)
1146  subproblem.reinitNeighborPhys(primary_elem, primary_side, points, 0);
1147 }
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:2864
MPI_Info info
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
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
SubProblem & subproblem()
Definition: SystemBase.h:102
virtual void prepareAssembly(const THREAD_ID tid) override
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
MooseMesh & _mesh
Definition: SystemBase.h:959
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 418 of file SystemBase.C.

419 {
420  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
421  for (const auto & var : vars)
422  {
423  var->reinitNodes(nodes);
424  var->computeNodalValues();
425  }
426 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 429 of file SystemBase.C.

430 {
431  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
432  for (const auto & var : vars)
433  {
434  var->reinitNodesNeighbor(nodes);
435  var->computeNodalNeighborValues();
436  }
437 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ 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 440 of file SystemBase.C.

441 {
442  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
443  for (const auto & var : vars)
444  var->reinit(reinit_for_derivative_reordering);
445 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ removeMatrix()

void SystemBase::removeMatrix ( TagID  tag)
inherited

Removes a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 586 of file SystemBase.C.

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

◆ removeVector() [1/2]

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

Remove a vector from the system with the given name.

Definition at line 1287 of file SystemBase.C.

Referenced by SystemBase::restoreOldSolutions().

1288 {
1289  system().remove_vector(name);
1290 }
virtual const std::string & name() const
Definition: SystemBase.C:1293
virtual System & system()=0
Get the reference to the libMesh system.

◆ 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 697 of file SystemBase.C.

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

◆ residualAndJacobianTogether()

void NonlinearSystem::residualAndJacobianTogether ( )
overridevirtualinherited

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

Implements NonlinearSystemBase.

Definition at line 365 of file NonlinearSystem.C.

366 {
368  mooseError(
369  "Evaluting the residual and Jacobian together does not make sense for a JFNK solve type in "
370  "which only function evaluations are required, e.g. there is no need to form a matrix");
371 
372  nonlinearSolver()->residual_object = nullptr;
373  nonlinearSolver()->jacobian = nullptr;
375 }
SolverParams & solverParams()
Get the solver parameters.
NonlinearImplicitSystem::ComputeResidualandJacobian * residual_and_jacobian_object
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
NonlinearImplicitSystem::ComputeResidual * residual_object
void(* jacobian)(const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)
virtual NonlinearSolver< Number > * nonlinearSolver() override
ComputeResidualAndJacobian _resid_and_jac_functor
Jacobian-Free Newton Krylov.
Definition: MooseTypes.h:758
Moose::SolveType _type
Definition: SolverParams.h:19
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ residualCopy()

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

Reimplemented from SystemBase.

Definition at line 3338 of file NonlinearSystemBase.C.

3339 {
3340  if (!_residual_copy.get())
3342 
3343  return *_residual_copy;
3344 }
const Parallel::Communicator & _communicator
static std::unique_ptr< NumericVector< Number > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
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 ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 3347 of file NonlinearSystemBase.C.

3348 {
3349  _need_residual_ghosted = true;
3350  if (!_residual_ghosted)
3351  {
3352  // The first time we realize we need a ghosted residual vector,
3353  // we add it.
3354  _residual_ghosted = &addVector("residual_ghosted", false, GHOSTED);
3355 
3356  // If we've already realized we need time and/or non-time
3357  // residual vectors, but we haven't yet realized they need to be
3358  // ghosted, fix that now.
3359  //
3360  // If an application changes its mind, the libMesh API lets us
3361  // change the vector.
3362  if (_Re_time)
3363  {
3364  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
3365  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
3366  }
3367  if (_Re_non_time)
3368  {
3369  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
3370  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
3371  }
3372  }
3373  return *_residual_ghosted;
3374 }
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 > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
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:951
virtual System & system() override
Get the reference to the libMesh system.
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:199

◆ residualSetup()

void NonlinearSystemBase::residualSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 1635 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianInternal(), and NonlinearSystemBase::computeResidualInternal().

1636 {
1637  TIME_SECTION("residualSetup", 3);
1638 
1640 
1641  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1642  {
1643  _kernels.residualSetup(tid);
1646  if (_doing_dg)
1652  }
1657 
1658  // Avoid recursion
1659  if (this == &_fe_problem.currentNonlinearSystem())
1662 }
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:138
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
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:1524
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ residualVector()

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

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

Definition at line 1017 of file NonlinearSystemBase.C.

1018 {
1019  mooseDeprecated("Please use getVector()");
1020  switch (tag)
1021  {
1022  case 0:
1023  return getResidualNonTimeVector();
1024 
1025  case 1:
1026  return getResidualTimeVector();
1027 
1028  default:
1029  mooseError("The required residual vector is not available");
1030  }
1031 }
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:299
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:350
NumericVector< Number > & getResidualNonTimeVector()
Return a numeric vector that is associated with the nontime tag.

◆ residualVectorTag()

TagID NonlinearSystemBase::residualVectorTag ( ) const
inlineoverridevirtualinherited

◆ restoreOldSolutions()

void SystemBase::restoreOldSolutions ( )
virtualinherited

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

Definition at line 538 of file SystemBase.C.

539 {
540  const auto states =
541  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
542  if (states > 1)
543  for (unsigned int i = 1; i <= states - 1; ++i)
544  if (_saved_solution_states[i])
545  {
547  removeVector("save_solution_state_" + std::to_string(i));
548  _saved_solution_states[i] = nullptr;
549  }
550 
552  {
554  removeVector("save_solution_dot_old");
555  _saved_dot_old = nullptr;
556  }
558  {
560  removeVector("save_solution_dotdot_old");
561  _saved_dotdot_old = nullptr;
562  }
563 }
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:1380
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:242
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:241
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:998
void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1287
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:999
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1049

◆ restoreSolutions()

void SolverSystem::restoreSolutions ( )
finaloverridevirtualinherited

Restore current solutions (call after your solve failed)

Reimplemented from SystemBase.

Definition at line 41 of file SolverSystem.C.

42 {
43  // call parent
45  // and update _current_solution
46  _current_solution = system().current_local_solution.get();
47 }
virtual System & system()=0
Get the reference to the libMesh system.
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
Definition: SystemBase.C:1270

◆ RHS()

virtual NumericVector<Number>& NonlinearSystem::RHS ( )
inlineoverridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 59 of file NonlinearSystem.h.

Referenced by NonlinearSystem::computeScalingResidual().

59 { return *_nl_implicit_sys.rhs; }
NonlinearImplicitSystem & _nl_implicit_sys

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 506 of file SystemBase.C.

507 {
508  const auto states =
509  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
510  if (states > 1)
511  {
512  _saved_solution_states.resize(states);
513  for (unsigned int i = 1; i <= states - 1; ++i)
514  if (!_saved_solution_states[i])
516  &addVector("save_solution_state_" + std::to_string(i), false, PARALLEL);
517 
518  for (unsigned int i = 1; i <= states - 1; ++i)
520  }
521 
523  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
525  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
526 
527  if (solutionUDotOld())
529 
530  if (solutionUDotDotOld())
532 }
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:604
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:1380
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:242
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:241
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:998
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:999
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1049

◆ scaleSystemSolution()

void MooseEigenSystem::scaleSystemSolution ( SYSTEMTAG  tag,
Real  scaling_factor 
)

Scale the solution vector.

Parameters
tagSystem tag.
factorThe scaling factor.

Definition at line 80 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::makeBXConsistent(), and EigenExecutionerBase::normalizeSolution().

81 {
82  if (tag == ALL)
83  {
84  solution().scale(scaling_factor);
85  }
86  else if (tag == EIGEN)
87  {
88  if (_all_eigen_vars)
89  {
90  solution().scale(scaling_factor);
91  }
92  else
93  {
94  for (const auto & dof : _eigen_var_indices)
95  solution().set(dof, solution()(dof) * scaling_factor);
96  }
97  }
98  solution().close();
99  update();
100 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
NumericVector< Number > & solution()
Definition: SystemBase.h:182
virtual void scale(const Number factor)=0
virtual void close()=0
std::set< dof_id_type > _eigen_var_indices
virtual void set(const numeric_index_type i, const Number value)=0

◆ scalingGroupVariables()

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

Definition at line 663 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

664  {
665  _scaling_group_variables = scaling_group_variables;
666  }
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 1571 of file SystemBase.C.

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

1572 {
1573  if (!_serialized_solution.get())
1574  {
1576  _serialized_solution->init(system().n_dofs(), false, SERIAL);
1577  }
1578 
1579  return *_serialized_solution;
1580 }
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:1032
virtual System & system()=0
Get the reference to the libMesh system.
static std::unique_ptr< NumericVector< Number > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())

◆ serializeSolution()

void SolverSystem::serializeSolution ( )
inherited

Definition at line 50 of file SolverSystem.C.

Referenced by SolverSystem::setSolution().

51 {
52  if (_serialized_solution.get())
53  {
54  if (!_serialized_solution->initialized() || _serialized_solution->size() != system().n_dofs())
55  {
56  _serialized_solution->clear();
57  _serialized_solution->init(system().n_dofs(), false, SERIAL);
58  }
59 
61  }
62 }
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:1032
virtual System & system()=0
Get the reference to the libMesh system.
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
virtual void localize(std::vector< Number > &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 1551 of file SystemBase.C.

Referenced by SubProblem::setActiveScalarVariableCoupleableVectorTags().

1553 {
1554  _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1555 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ setActiveVariableCoupleableVectorTags()

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

Set the active vector tags for the variables.

Definition at line 1545 of file SystemBase.C.

Referenced by SubProblem::setActiveFEVariableCoupleableVectorTags().

1546 {
1547  _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1548 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964

◆ setConstraintSecondaryValues()

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

Sets the value of constrained variables in the solution vector.

Definition at line 1150 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::setInitialSolution().

1151 {
1152 
1153  if (displaced)
1154  mooseAssert(_fe_problem.getDisplacedProblem(),
1155  "If we're calling this method with displaced = true, then we better well have a "
1156  "displaced problem");
1157  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1158  : static_cast<SubProblem &>(_fe_problem);
1159  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1160 
1161  bool constraints_applied = false;
1162 
1163  for (const auto & it : penetration_locators)
1164  {
1165  PenetrationLocator & pen_loc = *(it.second);
1166 
1167  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1168 
1169  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1170  BoundaryID primary_boundary = pen_loc._primary_boundary;
1171 
1172  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
1173  {
1174  const auto & constraints =
1175  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
1176  std::unordered_set<unsigned int> needed_mat_props;
1177  for (const auto & constraint : constraints)
1178  {
1179  const auto & mp_deps = constraint->getMatPropDependencies();
1180  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
1181  }
1182  _fe_problem.setActiveMaterialProperties(needed_mat_props, /*tid=*/0);
1183 
1184  for (unsigned int i = 0; i < secondary_nodes.size(); i++)
1185  {
1186  dof_id_type secondary_node_num = secondary_nodes[i];
1187  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1188 
1189  if (secondary_node.processor_id() == processor_id())
1190  {
1191  if (pen_loc._penetration_info[secondary_node_num])
1192  {
1193  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
1194 
1195  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
1196 
1197  for (const auto & nfc : constraints)
1198  {
1199  if (nfc->isExplicitConstraint())
1200  continue;
1201  // Return if this constraint does not correspond to the primary-secondary pair
1202  // prepared by the outer loops.
1203  // This continue statement is required when, e.g. one secondary surface constrains
1204  // more than one primary surface.
1205  if (nfc->secondaryBoundary() != secondary_boundary ||
1206  nfc->primaryBoundary() != primary_boundary)
1207  continue;
1208 
1209  if (nfc->shouldApply())
1210  {
1211  constraints_applied = true;
1212  nfc->computeSecondaryValue(solution);
1213  }
1214 
1215  if (nfc->hasWritableCoupledVariables())
1216  {
1217  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1218  for (auto * var : nfc->getWritableCoupledVariables())
1219  {
1220  if (var->isNodalDefined())
1221  var->insert(_fe_problem.getAuxiliarySystem().solution());
1222  }
1223  }
1224  }
1225  }
1226  }
1227  }
1228  }
1229  }
1230 
1231  // go over NodeELemConstraints
1232  std::set<dof_id_type> unique_secondary_node_ids;
1233 
1234  for (const auto & secondary_id : _mesh.meshSubdomains())
1235  {
1236  for (const auto & primary_id : _mesh.meshSubdomains())
1237  {
1238  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
1239  {
1240  const auto & constraints =
1241  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
1242 
1243  // get unique set of ids of all nodes on current block
1244  unique_secondary_node_ids.clear();
1245  const MeshBase & meshhelper = _mesh.getMesh();
1246  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
1247  meshhelper.active_subdomain_elements_end(secondary_id)))
1248  {
1249  for (auto & n : elem->node_ref_range())
1250  unique_secondary_node_ids.insert(n.id());
1251  }
1252 
1253  for (auto secondary_node_id : unique_secondary_node_ids)
1254  {
1255  Node & secondary_node = _mesh.nodeRef(secondary_node_id);
1256 
1257  // check if secondary node is on current processor
1258  if (secondary_node.processor_id() == processor_id())
1259  {
1260  // This reinits the variables that exist on the secondary node
1261  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
1262 
1263  // This will set aside residual and jacobian space for the variables that have dofs
1264  // on the secondary node
1266 
1267  for (const auto & nec : constraints)
1268  {
1269  if (nec->shouldApply())
1270  {
1271  constraints_applied = true;
1272  nec->computeSecondaryValue(solution);
1273  }
1274  }
1275  }
1276  }
1277  }
1278  }
1279  }
1280 
1281  // See if constraints were applied anywhere
1282  _communicator.max(constraints_applied);
1283 
1284  if (constraints_applied)
1285  {
1286  solution.close();
1287  update();
1288  }
1289 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
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:182
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
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:637
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:3199
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:102
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:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
MooseMesh & _mesh
Definition: SystemBase.h:959
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...
const std::vector< std::shared_ptr< NodeElemConstraint > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
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:2922

◆ setDecomposition()

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

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 413 of file NonlinearSystemBase.C.

Referenced by FEProblemSolve::FEProblemSolve(), and FieldSplitPreconditioner::FieldSplitPreconditioner().

414 {
416  if (splits.size() && splits.size() != 1)
417  mooseError("Only a single top-level split is allowed in a Problem's decomposition.");
418 
419  if (splits.size())
420  {
421  _decomposition_split = splits[0];
422  _have_decomposition = true;
423  }
424  else
425  _have_decomposition = false;
426 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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)
inherited

Record the initial residual (for later relative convergence check)

Definition at line 734 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::checkNonlinearConvergence().

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

◆ setInitialSolution()

void NonlinearSystemBase::setInitialSolution ( )
inherited

Definition at line 894 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preSolve().

895 {
897 
898  NumericVector<Number> & initial_solution(solution());
899  if (_predictor.get())
900  {
901  if (_predictor->shouldApply())
902  {
903  TIME_SECTION("applyPredictor", 2, "Applying Predictor");
904 
905  _predictor->apply(initial_solution);
906  _fe_problem.predictorCleanup(initial_solution);
907  }
908  else
909  _console << " Skipping predictor this step" << std::endl;
910  }
911 
912  // do nodal BC
913  {
914  TIME_SECTION("initialBCs", 2, "Applying BCs To Initial Condition");
915 
917  for (const auto & bnode : bnd_nodes)
918  {
919  BoundaryID boundary_id = bnode->_bnd_id;
920  Node * node = bnode->_node;
921 
922  if (node->processor_id() == processor_id())
923  {
924  // reinit variables in nodes
925  _fe_problem.reinitNodeFace(node, boundary_id, 0);
926 
928  {
929  const auto & preset_bcs = _preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
930  for (const auto & preset_bc : preset_bcs)
931  preset_bc->computeValue(initial_solution);
932  }
934  {
935  const auto & preset_bcs_res = _ad_preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
936  for (const auto & preset_bc : preset_bcs_res)
937  preset_bc->computeValue(initial_solution);
938  }
939  }
940  }
941  }
942 
943  _sys.solution->close();
944  update();
945 
946  // Set constraint secondary values
947  setConstraintSecondaryValues(initial_solution, false);
948 
950  setConstraintSecondaryValues(initial_solution, true);
951 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1218
NumericVector< Number > & solution()
Definition: SystemBase.h:182
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void deactiveAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1099
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
boundary_id_type BoundaryID
virtual void predictorCleanup(NumericVector< Number > &ghosted_solution)
Perform cleanup tasks after application of predictor to solution vector.
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:954
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:959
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:2026
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
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:1092
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 92 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

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

◆ 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 77 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

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

◆ setPreconditioner()

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

Sets a preconditioner.

Parameters
pcThe preconditioner to be set

Definition at line 3462 of file NonlinearSystemBase.C.

Referenced by SetupPreconditionerAction::act().

3463 {
3464  if (_preconditioner.get() != nullptr)
3465  mooseError("More than one active Preconditioner detected");
3466 
3467  _preconditioner = pc;
3468 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ setPredictor()

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

Definition at line 954 of file NonlinearSystemBase.C.

Referenced by SetupPredictorAction::act().

955 {
956  _predictor = predictor;
957 }
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ setPreSMOResidual()

void NonlinearSystemBase::setPreSMOResidual ( bool  use)
inlineinherited

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 252 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

252 { _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)
virtualinherited

Definition at line 3678 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computePostCheck().

3679 {
3682 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:30
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ 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 65 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().

66 {
67  _current_solution = &soln;
68 
70  associateVectorToTag(const_cast<NumericVector<Number> &>(soln), tag);
71 
72  if (_serialized_solution.get())
74 }
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:181
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:937
void serializeSolution()
Definition: SolverSystem.C:50
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:1032
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
const TagName SOLUTION_TAG
Definition: MooseTypes.C:27

◆ setSolutionUDot()

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

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 3438 of file NonlinearSystemBase.C.

3439 {
3440  *_u_dot = u_dot;
3441 }
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:974

◆ setSolutionUDotDot()

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

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 3444 of file NonlinearSystemBase.C.

3445 {
3446  *_u_dotdot = u_dotdot;
3447 }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:976

◆ setSolutionUDotDotOld()

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

Definition at line 3456 of file NonlinearSystemBase.C.

3457 {
3458  *_u_dotdot_old = u_dotdot_old;
3459 }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:981

◆ setSolutionUDotOld()

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

Definition at line 3450 of file NonlinearSystemBase.C.

3451 {
3452  *_u_dot_old = u_dot_old;
3453 }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:979

◆ setupDampers()

void NonlinearSystemBase::setupDampers ( )
inherited

Setup damping stuff (called before we actually start)

Definition at line 3477 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::init().

3478 {
3479  _increment_vec = &_sys.add_vector("u_increment", true, GHOSTED);
3480 }
NumericVector< Number > * _increment_vec
increment vector

◆ setupDM()

void NonlinearSystemBase::setupDM ( )
inherited

Setup the PETSc DM object (when appropriate)

Definition at line 406 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::solve().

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

◆ setupFieldDecomposition()

void NonlinearSystemBase::setupFieldDecomposition ( )
inherited

Definition at line 429 of file NonlinearSystemBase.C.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner().

430 {
431  if (!_have_decomposition)
432  return;
433 
434  std::shared_ptr<Split> top_split = getSplit(_decomposition_split);
435  top_split->setup(*this);
436 }
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()

void NonlinearSystem::setupFiniteDifferencedPreconditioner ( )
overridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 225 of file NonlinearSystem.C.

Referenced by NonlinearSystem::solve().

226 {
227  std::shared_ptr<FiniteDifferencePreconditioner> fdp =
229  if (!fdp)
230  mooseError("Did not setup finite difference preconditioner, and please add a preconditioning "
231  "block with type = fdp");
232 
233  if (fdp->finiteDifferenceType() == "coloring")
234  {
237  }
238 
239  else if (fdp->finiteDifferenceType() == "standard")
240  {
243  }
244  else
245  mooseError("Unknown finite difference type");
246 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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.
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.
void setupColoringFiniteDifferencedPreconditioner()
According to the nonzero pattern provided in the matrix, a graph is constructed.
bool _use_coloring_finite_difference
Finite difference preconditioner.
void setupStandardFiniteDifferencedPreconditioner()
Form preconditioning matrix via a standard finite difference method column-by-column.

◆ 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 182 of file SystemBase.C.

183 {
184  AllLocalDofIndicesThread aldit(_subproblem, {var_name});
186  Threads::parallel_reduce(elem_range, aldit);
187 
188  // Gather the dof indices across procs to get all the dof indices for var_name
189  aldit.dofIndicesSetUnion();
190 
191  const auto & all_dof_indices = aldit.getDofIndices();
192  _var_all_dof_indices.assign(all_dof_indices.begin(), all_dof_indices.end());
193 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
Definition: SystemBase.h:1028
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:951
MooseMesh & _mesh
Definition: SystemBase.h:959

◆ setVerboseFlag()

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

Sets the verbose flag.

Parameters
[in]verboseVerbose flag

Definition at line 135 of file SystemBase.h.

Referenced by Executioner::Executioner().

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

◆ shouldEvaluatePreSMOResidual()

bool NonlinearSystemBase::shouldEvaluatePreSMOResidual ( ) const
inherited

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 695 of file NonlinearSystemBase.C.

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

696 {
698  return false;
699 
700  // The legacy behavior (#10464) _always_ performs the pre-SMO residual evaluation
701  // regardless of whether it is needed.
702  //
703  // This is not ideal and has been fixed by #23472. This legacy option ensures a smooth transition
704  // to the new behavior. Modules and Apps that want to migrate to the new behavior should set this
705  // parameter to false.
706  if (_app.parameters().get<bool>("use_legacy_initial_residual_evaluation_bahavior"))
707  return true;
708 
709  return _use_pre_smo_residual;
710 }
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.
SolverParams & solverParams()
Get the solver parameters.
InputParameters & parameters()
Get the parameters of the object.
Definition: MooseApp.h:122
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:761
Moose::SolveType _type
Definition: SolverParams.h:19
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954

◆ solution() [1/2]

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

Definition at line 182 of file SystemBase.h.

Referenced by Adaptivity::adaptMesh(), TransientMultiApp::appTransferVector(), combineSystemSolution(), NonlinearSystemBase::computeDamping(), AuxiliarySystem::computeElementalVarsHelper(), NonlinearSystemBase::computeJacobianInternal(), AuxiliarySystem::computeMortarNodalVars(), NonlinearSystemBase::computeNodalBCs(), AuxiliarySystem::computeNodalVarsHelper(), NonlinearSystemBase::computeResidualTags(), AuxiliarySystem::computeScalarVars(), NonlinearSystemBase::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(), initSystemSolution(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeNodalUserObjectsThread::onNode(), FEProblemBase::projectInitialConditionOnCustomRange(), FEProblemBase::projectSolution(), Transient::relativeSolutionDifferenceNorm(), SystemBase::restoreSolutions(), SecantSolve::saveVariableValues(), SteffensenSolve::saveVariableValues(), PicardSolve::saveVariableValues(), scaleSystemSolution(), AuxiliarySystem::serializeSolution(), NonlinearSystemBase::setConstraintSecondaryValues(), NonlinearSystemBase::setInitialSolution(), DisplacedSystem::solutionInternal(), NonlinearEigenSystem::solve(), MultiAppDofCopyTransfer::transfer(), SteffensenSolve::transformVariables(), SecantSolve::transformVariables(), PicardSolve::transformVariables(), AuxiliarySystem::variableWiseRelativeSolutionDifferenceNorm(), and SystemBase::zeroVariables().

182 { 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:1380

◆ solution() [2/2]

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

Definition at line 185 of file SystemBase.h.

185 { 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:1380

◆ solutionInternal()

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

Internal getter for solution owned by libMesh.

Implements SystemBase.

Definition at line 104 of file SolverSystem.h.

105 {
106  return *system().solution;
107 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ solutionOld() [1/2]

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

◆ solutionOld() [2/2]

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

Definition at line 186 of file SystemBase.h.

186 { 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:1380

◆ solutionOlder() [1/2]

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

Definition at line 184 of file SystemBase.h.

Referenced by combineSystemSolution(), CentralDifference::computeTimeDerivatives(), ActivateElementsUserObjectBase::initSolutions(), MooseVariableScalar::reinit(), and ElementSubdomainModifier::setOldAndOlderSolutionsForMovedNodes().

184 { 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:1380

◆ solutionOlder() [2/2]

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

Definition at line 187 of file SystemBase.h.

187 { 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:1380

◆ solutionPreviousNewton() [1/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1308 of file SystemBase.C.

Referenced by SystemBase::copyOldSolutions(), and SystemBase::restoreSolutions().

1309 {
1312  else
1313  return nullptr;
1314 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:30
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ solutionPreviousNewton() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1299 of file SystemBase.C.

1300 {
1303  else
1304  return nullptr;
1305 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:30
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ 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 1380 of file SystemBase.C.

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

1382 {
1383  if (!hasSolutionState(state, iteration_type))
1384  needSolutionState(state, iteration_type);
1385  return *_solution_states[static_cast<unsigned short>(iteration_type)][state];
1386 }
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:1389
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:1053
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047

◆ 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 1353 of file SystemBase.C.

1355 {
1356  if (!hasSolutionState(state, iteration_type))
1357  mooseError("For iteration type '",
1358  Moose::stringify(iteration_type),
1359  "': solution state ",
1360  state,
1361  " was requested in ",
1362  name(),
1363  " but only up to state ",
1364  _solution_states[static_cast<unsigned short>(iteration_type)].size() - 1,
1365  " is available.");
1366 
1367  const auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1368 
1369  if (state == 0)
1370  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1371  else
1372  mooseAssert(solution_states[state] ==
1373  &getVector(oldSolutionStateVectorName(state, iteration_type)),
1374  "Inconsistent solution state");
1375 
1376  return *solution_states[state];
1377 }
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:299
virtual const std::string & name() const
Definition: SystemBase.C:1293
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:1053
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:62
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:1334
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1047
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ 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 898 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:1025

◆ 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 243 of file SystemBase.h.

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

◆ 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 244 of file SystemBase.h.

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

◆ 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 246 of file SystemBase.h.

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

◆ 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 245 of file SystemBase.h.

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

◆ solve()

void NonlinearSystem::solve ( )
overridevirtualinherited

Solve the system (using libMesh magic)

Implements NonlinearSystemBase.

Definition at line 131 of file NonlinearSystem.C.

132 {
133  // Only attach the postcheck function to the solver if we actually
134  // have dampers or if the FEProblemBase needs to update the solution,
135  // which is also done during the linesearch postcheck. It doesn't
136  // hurt to do this multiple times, it is just setting a pointer.
139  _nl_implicit_sys.nonlinear_solver->postcheck = Moose::compute_postcheck;
140 
141  // reset solution invalid counter for the time step
144 
146  {
147  TIME_SECTION("nlPreSMOResidual", 3, "Computing Pre-SMO Residual");
148  // Calculate the pre-SMO residual for use in the convergence criterion.
152  _nl_implicit_sys.rhs->close();
153  _pre_smo_residual = _nl_implicit_sys.rhs->l2_norm();
154  _console << "Pre-SMO residual: " << _pre_smo_residual << std::endl;
155  }
156 
157  const bool presolve_succeeded = preSolve();
158  if (!presolve_succeeded)
159  return;
160 
162  {
163  _nl_implicit_sys.nonlinear_solver->fd_residual_object = &_fd_residual_functor;
165  }
166 
167  PetscNonlinearSolver<Real> & solver =
168  static_cast<PetscNonlinearSolver<Real> &>(*_nl_implicit_sys.nonlinear_solver);
169  solver.mffd_residual_object = &_fd_residual_functor;
170 
171  solver.set_snesmf_reuse_base(_fe_problem.useSNESMFReuseBase());
172 
173  if (_time_integrator)
174  {
175  _time_integrator->solve();
176  _time_integrator->postSolve();
177  _n_iters = _time_integrator->getNumNonlinearIterations();
178  _n_linear_iters = _time_integrator->getNumLinearIterations();
179  }
180  else
181  {
182  system().solve();
183  _n_iters = _nl_implicit_sys.n_nonlinear_iterations();
184  _n_linear_iters = solver.get_total_linear_iterations();
185  }
186 
187  // store info about the solve
188  _final_residual = _nl_implicit_sys.final_nonlinear_residual();
189 
190  // Accumulate only the occurence of solution invalid warnings
192 
193  // determine whether solution invalid occurs in the converged solution
195 
197  MatFDColoringDestroy(&_fdcoloring);
198 }
void solutionInvalidAccumulationTimeStep()
Pass the number of solution invalid occurrences from current iteration to cumulative time iteration c...
void checkInvalidSolution()
Definition: SolverSystem.C:109
NonlinearImplicitSystem & _nl_implicit_sys
void resetSolutionInvalidTimeStep()
Reset the number of solution invalid occurrences back to zero for the current time step...
if(subdm)
virtual void setupFiniteDifferencedPreconditioner() override
Real _pre_smo_residual
The pre-SMO residual, see setPreSMOResidual for a detailed explanation.
bool hasDampers()
Whether or not this system has dampers.
void compute_postcheck(const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, NonlinearImplicitSystem &sys)
ComputeFDResidualFunctor _fd_residual_functor
virtual bool shouldUpdateSolution()
Check to see whether the problem should update the solution.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:138
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.
void needsPreviousNewtonIteration(bool state)
Set a flag that indicated that user required values for the previous Newton iterate.
bool shouldEvaluatePreSMOResidual() const
We offer the option to check convergence against the pre-SMO residual.
bool _use_coloring_finite_difference
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:79
MooseApp & _app
Definition: SystemBase.h:956
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:954
virtual System & system() override
Get the reference to the libMesh system.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:1013
bool useSNESMFReuseBase()
Return a flag that indicates if we are reusing the vector base.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
bool preSolve()
Perform some steps to get ready for the solver.
virtual void computeResidualSys(NonlinearImplicitSystem &sys, const NumericVector< Number > &soln, NumericVector< Number > &residual)
This function is called by Libmesh to form a residual.

◆ stopSolve()

void NonlinearSystem::stopSolve ( const ExecFlagType exec_flag)
overridevirtualinherited

Quit the current solve as soon as possible.

Implements SolverSystem.

Definition at line 201 of file NonlinearSystem.C.

202 {
203  PetscNonlinearSolver<Real> & solver =
204  static_cast<PetscNonlinearSolver<Real> &>(*sys().nonlinear_solver);
205 
206  if (exec_flag == EXEC_LINEAR || exec_flag == EXEC_POSTCHECK)
207  {
208  SNESSetFunctionDomainError(solver.snes());
209 
210  // Clean up by getting vectors into a valid state for a
211  // (possible) subsequent solve. There may be more than just
212  // these...
213  _nl_implicit_sys.rhs->close();
214  if (_Re_time)
215  _Re_time->close();
216  _Re_non_time->close();
217  }
218  else if (exec_flag == EXEC_NONLINEAR)
219  SNESSetJacobianDomainError(solver.snes());
220  else
221  mooseError("Unsupported execute flag: ", Moose::stringify(exec_flag));
222 }
NumericVector< Number > * _Re_time
residual vector for time contributions
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
NonlinearImplicitSystem & _nl_implicit_sys
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:29
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:62
virtual void close()=0
const ExecFlagType EXEC_POSTCHECK
Definition: Moose.C:31
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:30
virtual NonlinearImplicitSystem & sys()

◆ subdomainSetup() [1/3]

void SystemBase::subdomainSetup
inherited

Definition at line 1517 of file SystemBase.C.

1518 {
1519  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1520  _vars[tid].subdomainSetup();
1521 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
virtual void subdomainSetup()
Definition: SystemBase.C:1517
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ subdomainSetup() [2/3]

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

Called from assembling when we hit a new subdomain.

Parameters
subdomainID of the new subdomain
tidThread ID

Definition at line 960 of file NonlinearSystemBase.C.

961 {
963 
964  _kernels.subdomainSetup(subdomain, tid);
965  _nodal_kernels.subdomainSetup(subdomain, tid);
966  _element_dampers.subdomainSetup(subdomain, tid);
967  _nodal_dampers.subdomainSetup(subdomain, tid);
968 }
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:1517
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 1517 of file SystemBase.C.

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

1518 {
1519  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1520  _vars[tid].subdomainSetup();
1521 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:964
virtual void subdomainSetup()
Definition: SystemBase.C:1517
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ subproblem() [1/2]

SubProblem& SystemBase::subproblem ( )
inlineinherited

◆ subproblem() [2/2]

const SubProblem& SystemBase::subproblem ( ) const
inlineinherited

Definition at line 103 of file SystemBase.h.

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

◆ sys()

virtual NonlinearImplicitSystem& NonlinearSystem::sys ( )
inlinevirtualinherited

Definition at line 68 of file NonlinearSystem.h.

Referenced by buildSystemDoFIndices(), and NonlinearSystem::stopSolve().

68 { return _nl_implicit_sys; }
NonlinearImplicitSystem & _nl_implicit_sys

◆ system() [1/2]

virtual System& NonlinearSystemBase::system ( )
inlineoverridevirtualinherited

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 628 of file NonlinearSystemBase.h.

Referenced by Adaptivity::adaptMesh(), PhysicsBasedPreconditioner::addSystem(), PhysicsBasedPreconditioner::apply(), NonlinearSystemBase::computeScaling(), PseudoTimestep::currentResidualNorm(), DMCreateGlobalVector_Moose(), DMCreateMatrix_Moose(), DMMooseFunction(), DMMooseGetEmbedding_Private(), DMMooseGetMeshBlocks_Private(), DMMooseJacobian(), DMSetFromOptions_Moose(), DMSetUp_Moose_Pre(), VariableResidual::execute(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), ReferenceResidualProblem::initialSetup(), Moose::SlepcSupport::mooseMatMult(), Moose::SlepcSupport::moosePetscSNESFormFunction(), Moose::SlepcSupport::moosePetscSNESFormMatricesTags(), Moose::SlepcSupport::moosePetscSNESFormMatrixTag(), Moose::SlepcSupport::mooseSlepcEigenFormFunctionAB(), ConsoleUtils::outputNonlinearSystemInformation(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), NonlinearSystemBase::residualGhosted(), PhysicsBasedPreconditioner::setup(), NonlinearSystemBase::setupScalingData(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), NonlinearSystem::solve(), NonlinearEigenSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TimeIntegrator::solve(), Moose::PetscSupport::storePetscOptions(), NonlinearSystemBase::turnOffJacobian(), ReferenceResidualProblem::updateReferenceResidual(), VariableCondensationPreconditioner::VariableCondensationPreconditioner(), and Console::writeVariableNorms().

628 { return _sys; }

◆ system() [2/2]

virtual const System& NonlinearSystemBase::system ( ) const
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 629 of file NonlinearSystemBase.h.

629 { return _sys; }

◆ systemMatrixTag()

TagID NonlinearSystemBase::systemMatrixTag ( ) const
inlineoverridevirtualinherited

◆ 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.

◆ timestepSetup()

void NonlinearSystemBase::timestepSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 298 of file NonlinearSystemBase.C.

299 {
301 
302  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
303  {
304  _kernels.timestepSetup(tid);
307  if (_doing_dg)
313 
314  if (_fe_problem.haveFV())
315  {
316  std::vector<FVFluxBC *> bcs;
318  .query()
319  .template condition<AttribSystem>("FVFluxBC")
320  .template condition<AttribThread>(tid)
321  .queryInto(bcs);
322 
323  std::vector<FVInterfaceKernel *> iks;
325  .query()
326  .template condition<AttribSystem>("FVInterfaceKernel")
327  .template condition<AttribThread>(tid)
328  .queryInto(iks);
329 
330  std::vector<FVFluxKernel *> kernels;
332  .query()
333  .template condition<AttribSystem>("FVFluxKernel")
334  .template condition<AttribThread>(tid)
335  .queryInto(kernels);
336 
337  for (auto * bc : bcs)
338  bc->timestepSetup();
339  for (auto * ik : iks)
340  ik->timestepSetup();
341  for (auto * kernel : kernels)
342  kernel->timestepSetup();
343  }
344  }
349 }
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:954
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:198
virtual void timestepSetup()
Definition: SystemBase.C:1503

◆ timeVectorTag()

TagID NonlinearSystemBase::timeVectorTag ( ) const
inlineoverridevirtualinherited

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 637 of file NonlinearSystemBase.h.

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

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

◆ turnOffJacobian()

void NonlinearSystemBase::turnOffJacobian ( )
virtualinherited

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

Reimplemented in NonlinearEigenSystem.

Definition at line 190 of file NonlinearSystemBase.C.

191 {
192  system().set_basic_system_only();
193  nonlinearSolver()->jacobian = NULL;
194 }
virtual NonlinearSolver< Number > * nonlinearSolver()=0
void(* jacobian)(const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)
virtual System & system() override
Get the reference to the libMesh system.

◆ update()

void SystemBase::update ( bool  update_libmesh_system = true)
virtualinherited

◆ updateActive()

void NonlinearSystemBase::updateActive ( THREAD_ID  tid)
inherited

Update active objects of Warehouses owned by NonlinearSystemBase.

Definition at line 3203 of file NonlinearSystemBase.C.

3204 {
3211  _kernels.updateActive(tid);
3213  if (tid == 0)
3214  {
3221  }
3222 }
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)
inlineinherited

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

Definition at line 463 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)
inlineinherited

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

Definition at line 448 of file NonlinearSystemBase.h.

Referenced by FiniteDifferencePreconditioner::FiniteDifferencePreconditioner().

449  {
451  }
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.

◆ usePreSMOResidual()

const bool& NonlinearSystemBase::usePreSMOResidual ( ) const
inlineinherited

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

Definition at line 255 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::referenceResidual().

255 { 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.

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 926 of file SystemBase.h.

Referenced by Coupleable::coupled(), and UserObject::UserObject().

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

◆ zeroTaggedVector()

void SystemBase::zeroTaggedVector ( const TagID  tag)
inherited

Zero vector with the given tag.

Definition at line 671 of file SystemBase.C.

Referenced by SystemBase::zeroTaggedVectors().

672 {
673  if (!_subproblem.vectorTagExists(tag))
674  mooseError("Cannot zero vector with TagID ",
675  tag,
676  " in system '",
677  name(),
678  "' because that tag does not exist in the problem");
679  else if (!hasVector(tag))
680  mooseError("Cannot zero vector tag with name '",
682  "' in system '",
683  name(),
684  "' because there is no vector associated with that tag");
685 
686  getVector(tag).zero();
687 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:880
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual void zero()=0
virtual const std::string & name() const
Definition: SystemBase.C:1293
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:951
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:173
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:199
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:889

◆ zeroTaggedVectors()

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

Zero all vectors for given tags.

Definition at line 690 of file SystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags(), and NonlinearSystemBase::computeResidualTags().

691 {
692  for (const auto tag : tags)
693  zeroTaggedVector(tag);
694 }
void zeroTaggedVector(const TagID tag)
Zero vector with the given tag.
Definition: SystemBase.C:671

◆ 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 196 of file SystemBase.C.

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

197 {
198  if (vars_to_be_zeroed.size() > 0)
199  {
201 
202  auto problem = dynamic_cast<FEProblemBase *>(&_subproblem);
203  if (!problem)
204  mooseError("System needs to be registered in FEProblemBase for using zeroVariables.");
205 
206  AllLocalDofIndicesThread aldit(*problem, vars_to_be_zeroed, true);
208  Threads::parallel_reduce(elem_range, aldit);
209 
210  const auto & dof_indices_to_zero = aldit.getDofIndices();
211 
212  solution.close();
213 
214  for (const auto & dof : dof_indices_to_zero)
215  solution.set(dof, 0);
216 
217  solution.close();
218 
219  // Call update to update the current_local_solution for this system
220  system().update();
221  }
222 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1041
NumericVector< Number > & solution()
Definition: SystemBase.h:182
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
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:951
virtual System & system()=0
Get the reference to the libMesh system.
virtual void close()=0
MooseMesh & _mesh
Definition: SystemBase.h:959
virtual void set(const numeric_index_type i, const Number 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 231 of file SystemBase.C.

232 {
234 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:971
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:196

◆ 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 225 of file SystemBase.C.

226 {
228 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:970
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:196

◆ zeroVectorForResidual()

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

Definition at line 740 of file NonlinearSystemBase.C.

741 {
742  for (unsigned int i = 0; i < _vecs_to_zero_for_residual.size(); ++i)
743  if (vector_name == _vecs_to_zero_for_residual[i])
744  return;
745 
746  _vecs_to_zero_for_residual.push_back(vector_name);
747 }
std::vector< std::string > _vecs_to_zero_for_residual
vectors that will be zeroed before a residual computation

Member Data Documentation

◆ _active_on_old

bool MooseEigenSystem::_active_on_old
protected

Definition at line 106 of file MooseEigenSystem.h.

Referenced by activeOnOld(), eigenKernelOnCurrent(), and eigenKernelOnOld().

◆ _ad_preset_nodal_bcs

MooseObjectWarehouse<ADDirichletBCBase> NonlinearSystemBase::_ad_preset_nodal_bcs
protectedinherited

◆ _add_implicit_geometric_coupling_entries_to_jacobian

bool NonlinearSystemBase::_add_implicit_geometric_coupling_entries_to_jacobian
protectedinherited

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

Definition at line 878 of file NonlinearSystemBase.h.

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

◆ _all_eigen_vars

bool MooseEigenSystem::_all_eigen_vars
protected

◆ _app

MooseApp& SystemBase::_app
protectedinherited

◆ _assemble_constraints_separately

bool NonlinearSystemBase::_assemble_constraints_separately
protectedinherited

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

Definition at line 881 of file NonlinearSystemBase.h.

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

◆ _automatic_scaling

bool SystemBase::_automatic_scaling
protectedinherited

Whether to automatically scale the variables.

Definition at line 1019 of file SystemBase.h.

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

◆ _compute_scaling_once

bool NonlinearSystemBase::_compute_scaling_once
protectedinherited

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 936 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeScaling(), and NonlinearSystemBase::computeScalingOnce().

◆ _computed_scaling

bool NonlinearSystemBase::_computed_scaling
protectedinherited

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

Definition at line 931 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computedScalingJacobian(), and NonlinearSystemBase::computeScaling().

◆ _computing_pre_smo_residual

bool NonlinearSystemBase::_computing_pre_smo_residual
protectedinherited

◆ _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::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualProblem::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), FixedPointSolve::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MessageFromInput::execute(), Steady::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualProblem::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), NonlinearSystemBase::setInitialSolution(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), NonlinearSystem::solve(), EigenProblem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), Transient::takeStep(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _constraints

ConstraintWarehouse NonlinearSystemBase::_constraints
protectedinherited

◆ _current_l_its

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

◆ _current_nl_its

unsigned int NonlinearSystemBase::_current_nl_its
inherited

◆ _current_solution

const NumericVector<Number>* SolverSystem::_current_solution
protectedinherited

◆ _debugging_residuals

bool NonlinearSystemBase::_debugging_residuals
protectedinherited

true if debugging residuals

Definition at line 886 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags(), and NonlinearSystemBase::debuggingResiduals().

◆ _decomposition_split

std::string NonlinearSystemBase::_decomposition_split
protectedinherited

Name of the top-level split of the decomposition.

Definition at line 873 of file NonlinearSystemBase.h.

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

◆ _dg_kernels

MooseObjectTagWarehouse<DGKernelBase> NonlinearSystemBase::_dg_kernels
protectedinherited

◆ _dirac_kernels

MooseObjectTagWarehouse<DiracKernelBase> NonlinearSystemBase::_dirac_kernels
protectedinherited

◆ _doing_dg

bool NonlinearSystemBase::_doing_dg
protectedinherited

◆ _du_dot_du

Number NonlinearSystemBase::_du_dot_du
protectedinherited

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

Definition at line 792 of file NonlinearSystemBase.h.

◆ _du_dotdot_du

Number NonlinearSystemBase::_du_dotdot_du
protectedinherited

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

Definition at line 794 of file NonlinearSystemBase.h.

◆ _eigen_kernel_counter

unsigned int MooseEigenSystem::_eigen_kernel_counter
protected

counter of eigen kernels

Definition at line 109 of file MooseEigenSystem.h.

Referenced by addKernel(), and containsEigenKernel().

◆ _eigen_var_indices

std::set<dof_id_type> MooseEigenSystem::_eigen_var_indices
protected

◆ _eigen_var_names

std::set<VariableName> MooseEigenSystem::_eigen_var_names
protected

Definition at line 102 of file MooseEigenSystem.h.

Referenced by addKernel(), getEigenVariableNames(), and markEigenVariable().

◆ _element_dampers

MooseObjectWarehouse<ElementDamper> NonlinearSystemBase::_element_dampers
protectedinherited

◆ _factory

Factory& SystemBase::_factory
protectedinherited

◆ _fd_residual_functor

ComputeFDResidualFunctor NonlinearSystem::_fd_residual_functor
protectedinherited

Definition at line 80 of file NonlinearSystem.h.

Referenced by NonlinearSystem::solve().

◆ _fdcoloring

MatFDColoring NonlinearSystemBase::_fdcoloring
protectedinherited

◆ _fe_problem

FEProblemBase& SystemBase::_fe_problem
protectedinherited

the governing finite element/volume problem

Definition at line 954 of file SystemBase.h.

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

◆ _final_residual

Real NonlinearSystemBase::_final_residual
protectedinherited

◆ _general_dampers

MooseObjectWarehouse<GeneralDamper> NonlinearSystemBase::_general_dampers
protectedinherited

◆ _has_diag_save_in

bool NonlinearSystemBase::_has_diag_save_in
protectedinherited

◆ _has_nodalbc_diag_save_in

bool NonlinearSystemBase::_has_nodalbc_diag_save_in
protectedinherited

◆ _has_nodalbc_save_in

bool NonlinearSystemBase::_has_nodalbc_save_in
protectedinherited

If there is a nodal BC having save_in.

Definition at line 923 of file NonlinearSystemBase.h.

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

◆ _has_save_in

bool NonlinearSystemBase::_has_save_in
protectedinherited

◆ _have_decomposition

bool NonlinearSystemBase::_have_decomposition
protectedinherited

Whether or not the system can be decomposed into splits.

Definition at line 871 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::setDecomposition(), and NonlinearSystemBase::setupFieldDecomposition().

◆ _ignore_variables_for_autoscaling

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

A container for variables that do not partipate in autoscaling.

Definition at line 952 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::ignoreVariablesForAutoscaling(), and NonlinearSystemBase::setupScalingData().

◆ _increment_vec

NumericVector<Number>* NonlinearSystemBase::_increment_vec
protectedinherited

◆ _initial_residual

Real NonlinearSystemBase::_initial_residual
protectedinherited

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

Definition at line 910 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::initialResidual(), and NonlinearSystemBase::setInitialResidual().

◆ _integrated_bcs

MooseObjectTagWarehouse<IntegratedBCBase> NonlinearSystemBase::_integrated_bcs
protectedinherited

◆ _interface_kernels

MooseObjectTagWarehouse<InterfaceKernelBase> NonlinearSystemBase::_interface_kernels
protectedinherited

◆ _Ke_non_time_tag

TagID NonlinearSystemBase::_Ke_non_time_tag
protectedinherited

Tag for non-time contribution Jacobian.

Definition at line 817 of file NonlinearSystemBase.h.

◆ _Ke_system_tag

TagID NonlinearSystemBase::_Ke_system_tag
protectedinherited

Tag for system contribution Jacobian.

Definition at line 820 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::NonlinearSystemBase(), and NonlinearSystemBase::systemMatrixTag().

◆ _kernels

MooseObjectTagWarehouse<KernelBase> NonlinearSystemBase::_kernels
protectedinherited

◆ _ksp_norm

Moose::MooseKSPNormType SolverSystem::_ksp_norm
protectedinherited

KSP norm type.

Definition at line 84 of file SolverSystem.h.

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

◆ _last_nl_rnorm

Real NonlinearSystemBase::_last_nl_rnorm
inherited

◆ _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 1007 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 1010 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 968 of file SystemBase.h.

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

◆ _mesh

MooseMesh& SystemBase::_mesh
protectedinherited

◆ _n_iters

unsigned int NonlinearSystemBase::_n_iters
protectedinherited

◆ _n_linear_iters

unsigned int NonlinearSystemBase::_n_linear_iters
protectedinherited

◆ _n_residual_evaluations

unsigned int NonlinearSystemBase::_n_residual_evaluations
protectedinherited

Total number of residual evaluations that have been performed.

Definition at line 898 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags(), and NonlinearSystemBase::nResidualEvaluations().

◆ _name

std::string SystemBase::_name
protectedinherited

The name of this system.

Definition at line 961 of file SystemBase.h.

◆ _need_residual_ghosted

bool NonlinearSystemBase::_need_residual_ghosted
protectedinherited

◆ _nl_implicit_sys

NonlinearImplicitSystem& NonlinearSystem::_nl_implicit_sys
protectedinherited

◆ _nl_matrix_tags

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

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

Definition at line 803 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeJacobian(), and NonlinearSystemBase::computeJacobianBlocks().

◆ _nl_residual_functor

ComputeResidualFunctor NonlinearSystem::_nl_residual_functor
protectedinherited

Definition at line 79 of file NonlinearSystem.h.

Referenced by NonlinearSystem::NonlinearSystem().

◆ _nl_vector_tags

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

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

Definition at line 800 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeNodalBCs(), and NonlinearSystemBase::computeResidualTag().

◆ _nodal_bcs

MooseObjectTagWarehouse<NodalBCBase> NonlinearSystemBase::_nodal_bcs
protectedinherited

◆ _nodal_dampers

MooseObjectWarehouse<NodalDamper> NonlinearSystemBase::_nodal_dampers
protectedinherited

◆ _nodal_kernels

MooseObjectTagWarehouse<NodalKernelBase> NonlinearSystemBase::_nodal_kernels
protectedinherited

◆ _num_residual_evaluations

unsigned int NonlinearSystemBase::_num_residual_evaluations
inherited

Definition at line 553 of file NonlinearSystemBase.h.

◆ _numbered_vars

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

Map variable number to its pointer.

Definition at line 1016 of file SystemBase.h.

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

◆ _off_diagonals_in_auto_scaling

bool NonlinearSystemBase::_off_diagonals_in_auto_scaling
protectedinherited

Whether to include off diagonals when determining automatic scaling factors.

Definition at line 955 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::initialSetup(), and NonlinearSystemBase::offDiagonalsInAutoScaling().

◆ _pc_side

Moose::PCSideType SolverSystem::_pc_side
protectedinherited

Preconditioning side.

Definition at line 82 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
protectedinherited

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

Definition at line 908 of file NonlinearSystemBase.h.

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

◆ _preconditioner

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

◆ _predictor

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

◆ _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
protectedinherited

◆ _print_all_var_norms

bool NonlinearSystemBase::_print_all_var_norms
protectedinherited

Definition at line 914 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::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 1037 of file SystemBase.h.

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

◆ _Re_non_time

NumericVector<Number>* NonlinearSystemBase::_Re_non_time
protectedinherited

◆ _Re_non_time_tag

TagID NonlinearSystemBase::_Re_non_time_tag
protectedinherited

◆ _Re_tag

TagID NonlinearSystemBase::_Re_tag
protectedinherited

Used for the residual vector from PETSc.

Definition at line 814 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::NonlinearSystemBase(), and NonlinearSystemBase::residualVectorTag().

◆ _Re_time

NumericVector<Number>* NonlinearSystemBase::_Re_time
protectedinherited

◆ _Re_time_tag

TagID NonlinearSystemBase::_Re_time_tag
protectedinherited

◆ _resid_and_jac_functor

ComputeResidualAndJacobian NonlinearSystem::_resid_and_jac_functor
protectedinherited

Definition at line 81 of file NonlinearSystem.h.

Referenced by NonlinearSystem::residualAndJacobianTogether().

◆ _resid_vs_jac_scaling_param

Real NonlinearSystemBase::_resid_vs_jac_scaling_param
protectedinherited

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 941 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::autoScalingParam(), NonlinearSystemBase::computeScaling(), and NonlinearSystem::init().

◆ _residual_copy

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

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

Definition at line 789 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualInternal(), NonlinearSystemBase::init(), and NonlinearSystemBase::residualCopy().

◆ _residual_ghosted

NumericVector<Number>* NonlinearSystemBase::_residual_ghosted
protectedinherited

◆ _saved_dot_old

NumericVector<Real>* SystemBase::_saved_dot_old
protectedinherited

Definition at line 998 of file SystemBase.h.

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

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protectedinherited

Definition at line 999 of file SystemBase.h.

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

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 994 of file SystemBase.h.

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

Definition at line 995 of file SystemBase.h.

◆ _scalar_kernels

MooseObjectTagWarehouse<ScalarKernelBase> NonlinearSystemBase::_scalar_kernels
protectedinherited

◆ _scaling_group_variables

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

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 946 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::scalingGroupVariables(), and NonlinearSystemBase::setupScalingData().

◆ _scaling_matrix

std::unique_ptr<DiagonalMatrix<Number> > NonlinearSystemBase::_scaling_matrix
protectedinherited

◆ _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 1032 of file SystemBase.h.

Referenced by AuxiliarySystem::compute(), SolverSystem::init(), 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 87 of file SolverSystem.h.

Referenced by SolverSystem::checkInvalidSolution(), and NonlinearSystem::converged().

◆ _solution_states_initialized

bool SystemBase::_solution_states_initialized
protectedinherited

Whether or not the solution states have been initialized.

Definition at line 1025 of file SystemBase.h.

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

◆ _splits

MooseObjectWarehouseBase<Split> NonlinearSystemBase::_splits
protectedinherited

Decomposition splits.

Definition at line 855 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::addSplit(), and NonlinearSystemBase::getSplit().

◆ _subproblem

SubProblem& SystemBase::_subproblem
protectedinherited

◆ _sys

System& NonlinearSystemBase::_sys
inherited

◆ _tagged_matrices

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

◆ _tagged_vectors

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

◆ _time_integrator

std::shared_ptr<TimeIntegrator> SystemBase::_time_integrator
protectedinherited

◆ _u_dot

NumericVector<Number>* SystemBase::_u_dot
protectedinherited

solution vector for u^dot

Definition at line 974 of file SystemBase.h.

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

◆ _u_dot_old

NumericVector<Number>* SystemBase::_u_dot_old
protectedinherited

old solution vector for u^dot

Definition at line 979 of file SystemBase.h.

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

◆ _u_dotdot

NumericVector<Number>* SystemBase::_u_dotdot
protectedinherited

solution vector for u^dotdot

Definition at line 976 of file SystemBase.h.

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

◆ _u_dotdot_old

NumericVector<Number>* SystemBase::_u_dotdot_old
protectedinherited

old solution vector for u^dotdot

Definition at line 981 of file SystemBase.h.

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

◆ _use_field_split_preconditioner

bool NonlinearSystemBase::_use_field_split_preconditioner
protectedinherited

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

Definition at line 875 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::haveFieldSplitPreconditioner(), and NonlinearSystemBase::useFieldSplitPreconditioner().

◆ _use_finite_differenced_preconditioner

bool NonlinearSystemBase::_use_finite_differenced_preconditioner
protectedinherited

Whether or not to use a finite differenced preconditioner.

Definition at line 866 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::haveFiniteDifferencedPreconditioner(), NonlinearSystem::solve(), and NonlinearSystemBase::useFiniteDifferencedPreconditioner().

◆ _use_pre_smo_residual

bool NonlinearSystemBase::_use_pre_smo_residual
protectedinherited

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

Definition at line 912 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::setPreSMOResidual(), NonlinearSystemBase::shouldEvaluatePreSMOResidual(), and NonlinearSystemBase::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 1028 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 1002 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 966 of file SystemBase.h.

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

◆ _var_to_copy

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

◆ _variable_autoscaled

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

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

Definition at line 949 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeScaling(), and NonlinearSystemBase::setupScalingData().

◆ _vars

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

Variable warehouses (one for each thread)

Definition at line 964 of file SystemBase.h.

Referenced by NonlinearSystemBase::addBoundaryCondition(), NonlinearSystemBase::addInterfaceKernel(), AuxiliarySystem::addVariable(), SystemBase::addVariable(), SystemBase::applyScalingFactors(), NonlinearSystemBase::assembleScalingVector(), SystemBase::clearAllDofIndices(), AuxiliarySystem::compute(), SystemBase::customSetup(), SystemBase::getActualFieldVariable(), SystemBase::getFieldVariable(), SystemBase::getFVVariable(), AuxiliarySystem::getMinQuadratureOrder(), SystemBase::getMinQuadratureOrder(), SystemBase::getScalarVariable(), SystemBase::getScalarVariables(), SystemBase::getVariable(), SystemBase::getVariableNames(), SystemBase::getVariables(), LinearSystem::initialSetup(), SystemBase::initialSetup(), SystemBase::jacobianSetup(), SystemBase::nFieldVariables(), SystemBase::nFVVariables(), SystemBase::nVariables(), SystemBase::prepare(), SystemBase::prepareFace(), SystemBase::prepareLowerD(), SystemBase::prepareNeighbor(), SystemBase::reinitElem(), SystemBase::reinitElemFace(), SystemBase::reinitLowerD(), SystemBase::reinitNeighbor(), SystemBase::reinitNeighborFace(), SystemBase::reinitNode(), SystemBase::reinitNodeFace(), SystemBase::reinitNodes(), SystemBase::reinitNodesNeighbor(), SystemBase::reinitScalars(), SystemBase::residualSetup(), SystemBase::setActiveScalarVariableCoupleableVectorTags(), SystemBase::setActiveVariableCoupleableVectorTags(), NonlinearSystemBase::setupScalingData(), SystemBase::subdomainSetup(), and SystemBase::timestepSetup().

◆ _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
protectedinherited

vectors that will be zeroed before a residual computation

Definition at line 892 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags(), and NonlinearSystemBase::zeroVectorForResidual().

◆ _verbose

bool SystemBase::_verbose
protectedinherited

True if printing out additional information.

Definition at line 1022 of file SystemBase.h.

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


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