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

Nonlinear system for dumping objects. More...

#include <DumpObjectsNonlinearSystem.h>

Inheritance diagram for DumpObjectsNonlinearSystem:
[legend]

Public Member Functions

 DumpObjectsNonlinearSystem (FEProblemBase &problem, const std::string &name)
 
virtual NonlinearSolver< Number > * nonlinearSolver () override
 
virtual void solve () override
 Solve the system (using libMesh magic) More...
 
virtual void stopSolve (const ExecFlagType &) override
 Quit the current solve as soon as possible. More...
 
virtual bool converged () override
 Returns the convergence state. More...
 
virtual NumericVector< Number > & RHS () override
 
virtual SNES getSNES () override
 
virtual unsigned int getCurrentNonlinearIterationNumber () override
 
virtual void setupFiniteDifferencedPreconditioner () override
 
virtual void attachPreconditioner (Preconditioner< Number > *) 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...
 
virtual void init () override
 Initialize the system. More...
 
bool computedScalingJacobian () const
 
virtual void turnOffJacobian ()
 Turn off the Jacobian (must be called before equation system initialization) More...
 
virtual void restoreSolutions () override
 Restore current solutions (call after your solve failed) More...
 
virtual bool computingInitialResidual ()
 Returns true if this system is currently computing the initial 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 >)
 
void addDotVectors ()
 Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator. More...
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a kernel. More...
 
virtual void addNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a NodalKernel. More...
 
void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a scalar kernel. More...
 
void addBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 Adds a boundary condition. More...
 
void addConstraint (const std::string &c_name, const std::string &name, InputParameters &parameters)
 Adds a Constraint. More...
 
void addDiracKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a Dirac kernel. More...
 
void addDGKernel (std::string dg_kernel_name, const std::string &name, InputParameters &parameters)
 Adds a DG kernel. More...
 
void addInterfaceKernel (std::string interface_kernel_name, const std::string &name, InputParameters &parameters)
 Adds an interface kernel. More...
 
void addDamper (const std::string &damper_name, const std::string &name, InputParameters &parameters)
 Adds a damper. More...
 
void addSplit (const std::string &split_name, const std::string &name, InputParameters &parameters)
 Adds a split. More...
 
std::shared_ptr< SplitgetSplit (const std::string &name)
 Retrieves a split by name. More...
 
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 computeTimeDerivatives (bool jacobian_calculation=false)
 Computes the time derivative vector. 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 ()
 
virtual void setSolution (const NumericVector< Number > &soln)
 
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 > * solutionUDot () override
 
const NumericVector< Number > * solutionUDot () const override
 
NumericVector< Number > * solutionUDotDot () override
 
const NumericVector< Number > * solutionUDotDot () const override
 
NumericVector< Number > * solutionUDotOld () override
 
const NumericVector< Number > * solutionUDotOld () const override
 
NumericVector< Number > * solutionUDotDotOld () override
 
const NumericVector< Number > * solutionUDotDotOld () const override
 
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...
 
const NumericVector< Number > *const & currentSolution () const override
 The solution vector that is currently being operated on. More...
 
virtual void serializeSolution ()
 
virtual NumericVector< Number > & serializedSolution () override
 Returns a reference to a serialized version of the solution vector for this subproblem. 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 ()
 
void setPCSide (MooseEnum pcs)
 
Moose::PCSideType getPCSide ()
 
void setMooseKSPNormType (MooseEnum kspnorm)
 
Moose::MooseKSPNormType getMooseKSPNormType ()
 
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...
 
unsigned int number () const
 Gets the number of this system. More...
 
virtual MooseMeshmesh ()
 
virtual const MooseMeshmesh () const
 
virtual SubProblemsubproblem ()
 
virtual const SubProblemsubproblem () 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 NumberduDotDu ()
 
virtual const NumberduDotDu () const
 
virtual NumberduDotDotDu ()
 
virtual const NumberduDotDotDu () 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 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
 
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
 
FEProblemBase_fe_problem
 
System & _sys
 
Real _last_nl_rnorm
 
Real _initial_residual_before_preset_bcs
 
Real _initial_residual_after_preset_bcs
 
std::vector< unsigned int_current_l_its
 
unsigned int _current_nl_its
 
bool _compute_initial_residual_before_preset_bcs
 
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...
 
NumericVector< Number > & solutionInternal () const override
 Internal getter for solution owned by libMesh. 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)
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 Call to register a named section for timing. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 Call to register a named section for timing. More...
 
std::string timedSectionName (const std::string &section_name) const
 

Protected Attributes

NumericVector< Number > * _dummy
 
const NumericVector< Number > * _current_solution
 solution vector from nonlinear solver More...
 
NumericVector< Number > * _residual_ghosted
 ghosted form of the residual 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::unique_ptr< NumericVector< Number > > _residual_copy
 Copy of the residual vector, or nullptr if a copy is not needed. More...
 
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...
 
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...
 
Moose::PCSideType _pc_side
 Preconditioning side. More...
 
Moose::MooseKSPNormType _ksp_norm
 KSP norm type. 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_initial_residual
 
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...
 
SubProblem_subproblem
 
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
 
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...
 
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

Nonlinear system for dumping objects.

Definition at line 24 of file DumpObjectsNonlinearSystem.h.

Constructor & Destructor Documentation

◆ DumpObjectsNonlinearSystem()

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

Definition at line 13 of file DumpObjectsNonlinearSystem.C.

16  problem, problem.es().add_system<TransientNonlinearImplicitSystem>(name), name),
17  _dummy(nullptr)
18 {
19 }
TransientSystem< NonlinearImplicitSystem > TransientNonlinearImplicitSystem
virtual EquationSystems & es() override
NumericVector< Number > * _dummy
virtual const std::string & name() const
Definition: SystemBase.C:1297
NonlinearSystemBase(FEProblemBase &problem, System &sys, const std::string &name)

Member Function Documentation

◆ activeAllMatrixTags()

void SystemBase::activeAllMatrixTags ( )
virtualinherited

Make all exsiting matrices ative.

Definition at line 1103 of file SystemBase.C.

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

1104 {
1105  auto num_matrix_tags = _subproblem.numMatrixTags();
1106 
1107  _matrix_tag_active_flags.resize(num_matrix_tags);
1108 
1109  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1110  if (hasMatrix(tag))
1111  _matrix_tag_active_flags[tag] = true;
1112  else
1113  _matrix_tag_active_flags[tag] = false;
1114 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:951
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:210

◆ activeMatrixTag()

void SystemBase::activeMatrixTag ( TagID  tag)
virtualinherited

Active a matrix for tag.

Definition at line 1068 of file SystemBase.C.

1069 {
1070  mooseAssert(_subproblem.matrixTagExists(tag),
1071  "Cannot active Matrix with matrix_tag : " << tag << "that does not exist");
1072 
1073  if (_matrix_tag_active_flags.size() < tag + 1)
1074  _matrix_tag_active_flags.resize(tag + 1);
1075 
1076  _matrix_tag_active_flags[tag] = true;
1077 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:951
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

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

539 {
540  // ThreadID
541  THREAD_ID tid = 0;
542 
543  // Create the object
544  std::shared_ptr<BoundaryCondition> bc =
545  _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
547 
548  // Active BoundaryIDs for the object
549  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
550  auto bc_var = dynamic_cast<const MooseVariableFieldBase *>(&bc->variable());
551  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
552 
553  // Cast to the various types of BCs
554  std::shared_ptr<NodalBCBase> nbc = std::dynamic_pointer_cast<NodalBCBase>(bc);
555  std::shared_ptr<IntegratedBCBase> ibc = std::dynamic_pointer_cast<IntegratedBCBase>(bc);
556 
557  // NodalBCBase
558  if (nbc)
559  {
560  if (nbc->checkNodalVar() && !nbc->variable().isNodal())
561  mooseError("Trying to use nodal boundary condition '",
562  nbc->name(),
563  "' on a non-nodal variable '",
564  nbc->variable().name(),
565  "'.");
566 
567  _nodal_bcs.addObject(nbc);
568  _vars[tid].addBoundaryVars(boundary_ids, nbc->getCoupledVars());
569 
570  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
571  _has_nodalbc_save_in = true;
572  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
574 
575  // DirichletBCs that are preset
576  std::shared_ptr<DirichletBCBase> dbc = std::dynamic_pointer_cast<DirichletBCBase>(bc);
577  if (dbc && dbc->preset())
579 
580  std::shared_ptr<ADDirichletBCBase> addbc = std::dynamic_pointer_cast<ADDirichletBCBase>(bc);
581  if (addbc && addbc->preset())
583  }
584 
585  // IntegratedBCBase
586  else if (ibc)
587  {
588  _integrated_bcs.addObject(ibc, tid);
589  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
590 
591  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
592  _has_save_in = true;
593  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
594  _has_diag_save_in = true;
595 
596  for (tid = 1; tid < libMesh::n_threads(); tid++)
597  {
598  // Create the object
599  bc = _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
600 
601  // Give users opportunity to set some parameters
603 
604  // Active BoundaryIDs for the object
605  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
606  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
607 
608  ibc = std::static_pointer_cast<IntegratedBCBase>(bc);
609 
610  _integrated_bcs.addObject(ibc, tid);
611  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
612  }
613  }
614 
615  else
616  mooseError("Unknown BoundaryCondition type for object named ", bc->name());
617 }
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:284
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:927
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:1297
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:934
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 620 of file NonlinearSystemBase.C.

623 {
624  std::shared_ptr<Constraint> constraint = _factory.create<Constraint>(c_name, name, parameters);
625  _constraints.addObject(constraint);
626  postAddResidualObject(*constraint);
627 
628  if (constraint && constraint->addCouplingEntriesToJacobian())
630 }
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:927
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 687 of file NonlinearSystemBase.C.

690 {
691  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
692  {
693  std::shared_ptr<Damper> damper = _factory.create<Damper>(damper_name, name, parameters, tid);
694 
695  // Attempt to cast to the damper types
696  std::shared_ptr<ElementDamper> ed = std::dynamic_pointer_cast<ElementDamper>(damper);
697  std::shared_ptr<NodalDamper> nd = std::dynamic_pointer_cast<NodalDamper>(damper);
698  std::shared_ptr<GeneralDamper> gd = std::dynamic_pointer_cast<GeneralDamper>(damper);
699 
700  if (gd)
701  {
703  break; // not threaded
704  }
705  else if (ed)
706  _element_dampers.addObject(ed, tid);
707  else if (nd)
708  _nodal_dampers.addObject(nd, tid);
709  else
710  mooseError("Invalid damper type");
711  }
712 }
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:284
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:927
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:1297
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 647 of file NonlinearSystemBase.C.

650 {
651  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
652  {
653  auto dg_kernel = _factory.create<DGKernelBase>(dg_kernel_name, name, parameters, tid);
654  _dg_kernels.addObject(dg_kernel, tid);
655  postAddResidualObject(*dg_kernel);
656  }
657 
658  _doing_dg = true;
659 
660  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
661  _has_save_in = true;
662  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
663  _has_diag_save_in = true;
664 }
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:927
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:1297
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 633 of file NonlinearSystemBase.C.

636 {
637  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
638  {
639  std::shared_ptr<DiracKernelBase> kernel =
640  _factory.create<DiracKernelBase>(kernel_name, name, parameters, tid);
641  postAddResidualObject(*kernel);
642  _dirac_kernels.addObject(kernel, tid);
643  }
644 }
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:927
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 NonlinearSystemBase::addDotVectors ( )
inherited

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

Definition at line 203 of file NonlinearSystemBase.C.

204 {
206  _u_dot = &addVector("u_dot", true, GHOSTED);
208  _u_dot_old = &addVector("u_dot_old", true, GHOSTED);
210  _u_dotdot = &addVector("u_dotdot", true, GHOSTED);
212  _u_dotdot_old = &addVector("u_dotdot_old", true, GHOSTED);
213 }
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:597
virtual bool uDotRequested()
Get boolean flag to check whether solution time derivative needs to be stored.
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
virtual bool uDotDotRequested()
Get boolean flag to check whether solution second time derivative needs to be stored.
FEProblemBase & _fe_problem
virtual bool uDotOldRequested()
Get boolean flag to check whether old solution time derivative needs to be stored.
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
NumericVector< Number > * _u_dot
solution vector for u^dot

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

Referenced by NonlinearSystemBase::computeJacobianInternal().

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

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

471  {
473  }
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 667 of file NonlinearSystemBase.C.

670 {
671  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
672  {
673  std::shared_ptr<InterfaceKernelBase> interface_kernel =
674  _factory.create<InterfaceKernelBase>(interface_kernel_name, name, parameters, tid);
675  postAddResidualObject(*interface_kernel);
676 
677  const std::set<BoundaryID> & boundary_ids = interface_kernel->boundaryIDs();
678  auto ik_var = dynamic_cast<const MooseVariableFieldBase *>(&interface_kernel->variable());
679  _vars[tid].addBoundaryVar(boundary_ids, ik_var);
680 
681  _interface_kernels.addObject(interface_kernel, tid);
682  _vars[tid].addBoundaryVars(boundary_ids, interface_kernel->getCoupledVars());
683  }
684 }
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:927
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:1297
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
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 NonlinearSystemBase::addKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters parameters 
)
virtualinherited

Adds a kernel.

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

Reimplemented in MooseEigenSystem.

Definition at line 485 of file NonlinearSystemBase.C.

488 {
489  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
490  {
491  // Create the kernel object via the factory and add to warehouse
492  std::shared_ptr<KernelBase> kernel =
493  _factory.create<KernelBase>(kernel_name, name, parameters, tid);
494  _kernels.addObject(kernel, tid);
495  postAddResidualObject(*kernel);
496  }
497 
498  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
499  _has_save_in = true;
500  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
501  _has_diag_save_in = true;
502 }
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:927
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1297
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
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

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

560 {
561  if (!_subproblem.matrixTagExists(tag))
562  mooseError("Cannot add tagged matrix with TagID ",
563  tag,
564  " in system '",
565  name(),
566  "' because the tag does not exist in the problem");
567 
568  if (hasMatrix(tag))
569  return getMatrix(tag);
570 
571  const auto matrix_name = _subproblem.matrixTagName(tag);
572  SparseMatrix<Number> & mat = system().add_matrix(matrix_name);
573  associateMatrixToTag(mat, tag);
574 
575  return mat;
576 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
virtual const std::string & name() const
Definition: SystemBase.C:1297
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1025
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual System & system()=0
Get the reference to the libMesh system.
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:973
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:323

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

508 {
509  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
510  {
511  // Create the kernel object via the factory and add to the warehouse
512  std::shared_ptr<NodalKernelBase> kernel =
513  _factory.create<NodalKernelBase>(kernel_name, name, parameters, tid);
514  _nodal_kernels.addObject(kernel, tid);
515  postAddResidualObject(*kernel);
516  }
517 
518  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
519  _has_save_in = true;
520  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
521  _has_diag_save_in = true;
522 }
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:927
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 525 of file NonlinearSystemBase.C.

528 {
529  std::shared_ptr<ScalarKernelBase> kernel =
530  _factory.create<ScalarKernelBase>(kernel_name, name, parameters);
531  postAddResidualObject(*kernel);
532  _scalar_kernels.addObject(kernel);
533 }
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:927
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 1474 of file SystemBase.C.

Referenced by MooseVariableBase::initialSetup().

1475 {
1476  addVector("scaling_factors", /*project=*/false, libMesh::ParallelType::GHOSTED);
1478 }
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:597
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:1115
SubProblem & _subproblem
Definition: SystemBase.h:924
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125

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

718 {
719  std::shared_ptr<Split> split = _factory.create<Split>(split_name, name, parameters);
721 }
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:927
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 474 of file NonlinearSystemBase.C.

477 {
478  parameters.set<SystemBase *>("_sys") = this;
479 
480  std::shared_ptr<TimeIntegrator> ti = _factory.create<TimeIntegrator>(type, name, parameters);
481  _time_integrator = ti;
482 }
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:927
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const std::string & name() const
Definition: SystemBase.C:1297
Base class for time integrators.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:973

◆ addTimeIntegrator() [2/4]

virtual void SystemBase::addTimeIntegrator
inlineinherited

Definition at line 861 of file SystemBase.h.

864  {
865  }

◆ addTimeIntegrator() [3/4]

virtual void SystemBase::addTimeIntegrator
inlineinherited

Definition at line 867 of file SystemBase.h.

867 {}

◆ addTimeIntegrator() [4/4]

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

Reimplemented in DisplacedSystem.

Definition at line 867 of file SystemBase.h.

867 {}

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

Referenced by AuxiliarySystem::addVariable().

711 {
713 
714  auto components = parameters.get<unsigned int>("components");
715 
716  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
717  // System::add_variable method
718  std::set<SubdomainID> blocks;
719  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
720  for (const auto & subdomain_name : block_param)
721  {
722  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
723  blocks.insert(blk_id);
724  }
725 
726  auto fe_type = FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
727  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
728 
729  unsigned int var_num;
730 
731  if (var_type == "ArrayMooseVariable")
732  {
733  if (fe_type.family == NEDELEC_ONE || fe_type.family == LAGRANGE_VEC ||
734  fe_type.family == MONOMIAL_VEC || fe_type.family == RAVIART_THOMAS)
735  mooseError("Vector family type cannot be used in an array variable");
736 
737  // Build up the variable names
738  std::vector<std::string> var_names;
739  for (unsigned int i = 0; i < components; i++)
740  var_names.push_back(SubProblem::arrayVariableComponent(name, i));
741 
742  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
743  // _first_
744  var_num = system().add_variables(var_names, fe_type, &blocks) - (components - 1);
745 
746  // Set as array variable
747  if (parameters.isParamSetByUser("array") && !parameters.get<bool>("array"))
748  mooseError("Variable '",
749  name,
750  "' is an array variable ('components' > 1) but 'array' is set to false.");
751  parameters.set<bool>("array") = true;
752  }
753  else
754  var_num = system().add_variable(name, fe_type, &blocks);
755 
756  parameters.set<unsigned int>("_var_num") = var_num;
757  parameters.set<SystemBase *>("_system_base") = this;
758 
759  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
760  {
761  parameters.set<THREAD_ID>("tid") = tid;
762  std::shared_ptr<MooseVariableBase> var =
763  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
764 
765  _vars[tid].add(name, var);
766 
767  if (auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
768  {
769  auto required_size = var_num + components;
770  if (required_size > _numbered_vars[tid].size())
771  _numbered_vars[tid].resize(required_size);
772  for (MooseIndex(components) component = 0; component < components; ++component)
773  _numbered_vars[tid][var_num + component] = fe_var;
774 
775  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(fe_var))
776  _subproblem.addFunctor(name, *functor, tid);
777  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealVectorValue> *>(fe_var))
778  _subproblem.addFunctor(name, *functor, tid);
779  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<RealEigenVector> *>(fe_var))
780  _subproblem.addFunctor(name, *functor, tid);
781  else
782  mooseError("This should be a functor");
783  }
784 
785  if (var->blockRestricted())
786  for (const SubdomainID & id : var->blockIDs())
787  for (MooseIndex(components) component = 0; component < components; ++component)
788  _var_map[var_num + component].insert(id);
789  else
790  for (MooseIndex(components) component = 0; component < components; ++component)
791  _var_map[var_num + component] = std::set<SubdomainID>();
792  }
793 
794  // getMaxVariableNumber is an API method used in Rattlesnake
795  if (var_num > _max_var_number)
796  _max_var_number = var_num;
797 }
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:976
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:284
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:1289
Factory & _factory
Definition: SystemBase.h:927
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
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:936
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:261
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
MooseMesh & _mesh
Definition: SystemBase.h:929
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:938
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:1513

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

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

1146 {
1147  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
1148 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:964
Information about variables that will be copied.
Definition: SystemBase.h:66

◆ addVariableToZeroOnJacobian()

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

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

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 169 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().

170 {
171  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
172 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:941

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

164 {
165  _vars_to_be_zeroed_on_residual.push_back(var_name);
166 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:940

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

Referenced by AuxiliarySystem::addDotVectors(), NonlinearSystemBase::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().

598 {
599  if (hasVector(vector_name))
600  return getVector(vector_name);
601 
602  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
603  return vec;
604 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
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:882

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

608 {
609  if (!_subproblem.vectorTagExists(tag))
610  mooseError("Cannot add tagged vector with TagID ",
611  tag,
612  " in system '",
613  name(),
614  "' because the tag does not exist in the problem");
615 
616  if (hasVector(tag))
617  {
618  auto & vec = getVector(tag);
619 
620  if (type != ParallelType::AUTOMATIC && vec.type() != type)
621  mooseError("Cannot add tagged vector '",
623  "', in system '",
624  name(),
625  "' because a vector with the same name was found with a different parallel type");
626 
627  return vec;
628  }
629 
630  const auto vector_name = _subproblem.vectorTagName(tag);
631  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
632  associateVectorToTag(vec, tag);
633 
634  return vec;
635 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:930
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
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:198
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

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

Referenced by NonlinearSystemBase::computeScaling().

1425 {
1426  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1427  {
1428  auto & field_variables = _vars[thread].fieldVariables();
1429  for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1430  {
1431  auto factors = field_variables[i]->arrayScalingFactor();
1432  for (unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1433  factors[j] /= inverse_scaling_factors[p];
1434 
1435  field_variables[i]->scalingFactor(factors);
1436  }
1437 
1438  auto offset = field_variables.size();
1439 
1440  auto & scalar_variables = _vars[thread].scalars();
1441  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1442  scalar_variables[i]->scalingFactor(
1443  {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1444 
1445  if (thread == 0 && _verbose)
1446  {
1447  _console << "Automatic scaling factors:\n";
1448  auto original_flags = _console.flags();
1449  auto original_precision = _console.precision();
1450  _console.unsetf(std::ios_base::floatfield);
1451  _console.precision(6);
1452 
1453  for (const auto & field_variable : field_variables)
1454  {
1455  const auto & factors = field_variable->arrayScalingFactor();
1456  _console << " " << field_variable->name() << ":";
1457  for (const auto i : make_range(field_variable->count()))
1458  _console << " " << factors[i];
1459  _console << "\n";
1460  }
1461  for (const auto & scalar_variable : scalar_variables)
1462  _console << " " << scalar_variable->name() << ": " << scalar_variable->scalingFactor()
1463  << "\n";
1464  _console << "\n" << std::endl;
1465 
1466  // restore state
1467  _console.flags(original_flags);
1468  _console.precision(original_precision);
1469  }
1470  }
1471 }
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:934
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:982
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 480 of file NonlinearSystemBase.h.

481  {
483  }
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 4008 of file NonlinearSystemBase.C.

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

4009 {
4010  if (!hasVector("scaling_factors"))
4011  // No variables have indicated they need scaling
4012  return;
4013 
4014  auto & scaling_vector = getVector("scaling_factors");
4015 
4016  const auto & lm_mesh = _mesh.getMesh();
4017  const auto & dof_map = dofMap();
4018 
4019  const auto & field_variables = _vars[0].fieldVariables();
4020  const auto & scalar_variables = _vars[0].scalars();
4021 
4022  std::vector<dof_id_type> dof_indices;
4023 
4024  for (const Elem * const elem :
4025  as_range(lm_mesh.active_local_elements_begin(), lm_mesh.active_local_elements_end()))
4026  for (const auto * const field_var : field_variables)
4027  {
4028  const auto & factors = field_var->arrayScalingFactor();
4029  for (const auto i : make_range(field_var->count()))
4030  {
4031  dof_map.dof_indices(elem, dof_indices, field_var->number() + i);
4032  for (const auto dof : dof_indices)
4033  scaling_vector.set(dof, factors[i]);
4034  }
4035  }
4036 
4037  for (const auto * const scalar_var : scalar_variables)
4038  {
4039  mooseAssert(scalar_var->count() == 1,
4040  "Scalar variables should always have only one component.");
4041  dof_map.SCALAR_dof_indices(dof_indices, scalar_var->number());
4042  for (const auto dof : dof_indices)
4043  scaling_vector.set(dof, scalar_var->scalingFactor());
4044  }
4045 
4046  // Parallel assemble
4047  scaling_vector.close();
4048 
4049  if (auto * displaced_problem = _fe_problem.getDisplacedProblem().get())
4050  // copy into the corresponding displaced system vector because they should be the exact same
4051  displaced_problem->systemBaseNonlinear(number()).getVector("scaling_factors") = scaling_vector;
4052 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1131
FEProblemBase & _fe_problem
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3198
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:929
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:882

◆ assignMaxVarNDofsPerElem()

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

assign the maximum element dofs

Definition at line 575 of file SystemBase.h.

575 { _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:967

◆ assignMaxVarNDofsPerNode()

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

assign the maximum node dofs

Definition at line 580 of file SystemBase.h.

580 { _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:970

◆ associateMatrixToTag()

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

Associate a matrix to a tag.

Reimplemented in DisplacedSystem.

Definition at line 1025 of file SystemBase.C.

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

1026 {
1027  if (!_subproblem.matrixTagExists(tag))
1028  mooseError("Cannot associate matrix to tag ", tag, " because that tag does not exist");
1029 
1030  if (_tagged_matrices.size() < tag + 1)
1031  _tagged_matrices.resize(tag + 1);
1032 
1033  _tagged_matrices[tag] = &matrix;
1034 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ associateVectorToTag()

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

Associate a vector for a given tag.

Reimplemented in DisplacedSystem.

Definition at line 930 of file SystemBase.C.

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

931 {
932  if (!_subproblem.vectorTagExists(tag))
933  mooseError("Cannot associate vector to tag ", tag, " because that tag does not exist");
934 
935  if (_tagged_vectors.size() < tag + 1)
936  _tagged_vectors.resize(tag + 1);
937 
938  _tagged_vectors[tag] = &vec;
939 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

◆ attachPreconditioner()

virtual void DumpObjectsNonlinearSystem::attachPreconditioner ( Preconditioner< Number > *  preconditioner)
inlineoverridevirtual

Attach a customized preconditioner that requires physics knowledge.

Generic preconditioners should be implemented in PETSc, instead.

Implements NonlinearSystemBase.

Definition at line 38 of file DumpObjectsNonlinearSystem.h.

38 {}

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

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

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

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

3376 {
3378  {
3380 
3381  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
3382 
3384 
3387  graph);
3388 
3389  const dof_id_type first_dof_on_proc = dofMap().first_dof(processor_id());
3390  const dof_id_type end_dof_on_proc = dofMap().end_dof(processor_id());
3391 
3392  // The total number of dofs on and off processor
3393  const dof_id_type n_dofs_on_proc = dofMap().n_local_dofs();
3394  const dof_id_type n_dofs_not_on_proc = dofMap().n_dofs() - dofMap().n_local_dofs();
3395 
3396  for (const auto & git : graph)
3397  {
3398  dof_id_type dof = git.first;
3399  dof_id_type local_dof = dof - first_dof_on_proc;
3400 
3401  if (dof < first_dof_on_proc || dof >= end_dof_on_proc)
3402  continue;
3403 
3404  const auto & row = git.second;
3405 
3406  SparsityPattern::Row & sparsity_row = sparsity[local_dof];
3407 
3408  unsigned int original_row_length = sparsity_row.size();
3409 
3410  sparsity_row.insert(sparsity_row.end(), row.begin(), row.end());
3411 
3412  SparsityPattern::sort_row(
3413  sparsity_row.begin(), sparsity_row.begin() + original_row_length, sparsity_row.end());
3414 
3415  // Fix up nonzero arrays
3416  for (const auto & coupled_dof : row)
3417  {
3418  if (coupled_dof < first_dof_on_proc || coupled_dof >= end_dof_on_proc)
3419  {
3420  if (n_oz[local_dof] < n_dofs_not_on_proc)
3421  n_oz[local_dof]++;
3422  }
3423  else
3424  {
3425  if (n_nz[local_dof] < n_dofs_on_proc)
3426  n_nz[local_dof]++;
3427  }
3428  }
3429  }
3430  }
3431 }
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:1131
FEProblemBase & _fe_problem
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.
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 117 of file SystemBase.h.

Referenced by SubProblem::automaticScaling().

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

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

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

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

Referenced by FEProblemSolve::FEProblemSolve().

664  {
665  _resid_vs_jac_scaling_param = resid_vs_jac_scaling_param;
666  }
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...

◆ checkKernelCoverage()

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

System Integrity Checks

Definition at line 3534 of file NonlinearSystemBase.C.

3535 {
3536  // Obtain all blocks and variables covered by all kernels
3537  std::set<SubdomainID> input_subdomains;
3538  std::set<std::string> kernel_variables;
3539 
3540  bool global_kernels_exist = false;
3541  global_kernels_exist |= _scalar_kernels.hasActiveObjects();
3542  global_kernels_exist |= _nodal_kernels.hasActiveObjects();
3543 
3544  _kernels.subdomainsCovered(input_subdomains, kernel_variables);
3545  _dg_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3546  _nodal_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3547  _scalar_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3548  _constraints.subdomainsCovered(input_subdomains, kernel_variables);
3549 
3550  if (_fe_problem.haveFV())
3551  {
3552  std::vector<FVElementalKernel *> fv_elemental_kernels;
3554  .query()
3555  .template condition<AttribSystem>("FVElementalKernel")
3556  .queryInto(fv_elemental_kernels);
3557 
3558  for (auto fv_kernel : fv_elemental_kernels)
3559  {
3560  if (fv_kernel->blockRestricted())
3561  for (auto block_id : fv_kernel->blockIDs())
3562  input_subdomains.insert(block_id);
3563  else
3564  global_kernels_exist = true;
3565  kernel_variables.insert(fv_kernel->variable().name());
3566 
3567  // Check for lagrange multiplier
3568  if (dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel))
3569  kernel_variables.insert(dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel)
3570  ->lambdaVariable()
3571  .name());
3572  }
3573 
3574  std::vector<FVFluxKernel *> fv_flux_kernels;
3576  .query()
3577  .template condition<AttribSystem>("FVFluxKernel")
3578  .queryInto(fv_flux_kernels);
3579 
3580  for (auto fv_kernel : fv_flux_kernels)
3581  {
3582  if (fv_kernel->blockRestricted())
3583  for (auto block_id : fv_kernel->blockIDs())
3584  input_subdomains.insert(block_id);
3585  else
3586  global_kernels_exist = true;
3587  kernel_variables.insert(fv_kernel->variable().name());
3588  }
3589 
3590  std::vector<FVInterfaceKernel *> fv_interface_kernels;
3592  .query()
3593  .template condition<AttribSystem>("FVInterfaceKernel")
3594  .queryInto(fv_interface_kernels);
3595 
3596  for (auto fvik : fv_interface_kernels)
3597  if (auto scalar_fvik = dynamic_cast<FVScalarLagrangeMultiplierInterface *>(fvik))
3598  kernel_variables.insert(scalar_fvik->lambdaVariable().name());
3599 
3600  std::vector<FVFluxBC *> fv_flux_bcs;
3602  .query()
3603  .template condition<AttribSystem>("FVFluxBC")
3604  .queryInto(fv_flux_bcs);
3605 
3606  for (auto fvbc : fv_flux_bcs)
3607  if (auto scalar_fvbc = dynamic_cast<FVBoundaryScalarLagrangeMultiplierConstraint *>(fvbc))
3608  kernel_variables.insert(scalar_fvbc->lambdaVariable().name());
3609  }
3610 
3611  // Check kernel coverage of subdomains (blocks) in your mesh
3612  if (!global_kernels_exist)
3613  {
3614  std::set<SubdomainID> difference;
3615  std::set_difference(mesh_subdomains.begin(),
3616  mesh_subdomains.end(),
3617  input_subdomains.begin(),
3618  input_subdomains.end(),
3619  std::inserter(difference, difference.end()));
3620 
3621  // there supposed to be no kernels on this lower-dimensional subdomain
3622  difference.erase(Moose::INTERNAL_SIDE_LOWERD_ID);
3623  difference.erase(Moose::BOUNDARY_SIDE_LOWERD_ID);
3624 
3625  if (!difference.empty())
3626  {
3627  std::vector<SubdomainID> difference_vec =
3628  std::vector<SubdomainID>(difference.begin(), difference.end());
3629  std::vector<SubdomainName> difference_names = _mesh.getSubdomainNames(difference_vec);
3630  std::stringstream missing_block_names;
3631  std::copy(difference_names.begin(),
3632  difference_names.end(),
3633  std::ostream_iterator<std::string>(missing_block_names, " "));
3634  std::stringstream missing_block_ids;
3635  std::copy(difference.begin(),
3636  difference.end(),
3637  std::ostream_iterator<unsigned int>(missing_block_ids, " "));
3638 
3639  mooseError("Each subdomain must contain at least one Kernel.\nThe following block(s) lack an "
3640  "active kernel: " +
3641  missing_block_names.str(),
3642  " (ids: ",
3643  missing_block_ids.str(),
3644  ")");
3645  }
3646  }
3647 
3648  // Check kernel use of variables
3649  std::set<VariableName> variables(getVariableNames().begin(), getVariableNames().end());
3650 
3651  std::set<VariableName> difference;
3652  std::set_difference(variables.begin(),
3653  variables.end(),
3654  kernel_variables.begin(),
3655  kernel_variables.end(),
3656  std::inserter(difference, difference.end()));
3657 
3658  // skip checks for varaibles defined on lower-dimensional subdomain
3659  std::set<VariableName> vars(difference);
3660  for (auto & var_name : vars)
3661  {
3662  auto blks = getSubdomainsForVar(var_name);
3663  if (blks.count(Moose::INTERNAL_SIDE_LOWERD_ID) || blks.count(Moose::BOUNDARY_SIDE_LOWERD_ID))
3664  difference.erase(var_name);
3665  }
3666 
3667  if (!difference.empty())
3668  {
3669  std::stringstream missing_kernel_vars;
3670  std::copy(difference.begin(),
3671  difference.end(),
3672  std::ostream_iterator<std::string>(missing_kernel_vars, " "));
3673  mooseError("Each variable must be referenced by at least one active Kernel.\nThe following "
3674  "variable(s) lack an active kernel: " +
3675  missing_kernel_vars.str());
3676  }
3677 }
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:284
const SubdomainID BOUNDARY_SIDE_LOWERD_ID
Definition: MooseTypes.C:21
FEProblemBase & _fe_problem
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:1543
ConstraintWarehouse _constraints
Constraints storage object.
MooseMesh & _mesh
Definition: SystemBase.h:929
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:843
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:742
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 1529 of file SystemBase.C.

Referenced by SubProblem::clearAllDofIndices().

1530 {
1531  for (auto & var_warehouse : _vars)
1532  var_warehouse.clearAllDofIndices();
1533 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

◆ closeTaggedMatrices()

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

Close all matrices associated the tags.

Definition at line 1009 of file SystemBase.C.

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

1010 {
1011  for (auto tag : tags)
1012  if (hasMatrix(tag))
1013  getMatrix(tag).close();
1014 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
virtual void close()=0
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:973

◆ closeTaggedVector()

void SystemBase::closeTaggedVector ( const TagID  tag)
inherited

Close vector with the given tag.

Definition at line 638 of file SystemBase.C.

Referenced by SystemBase::closeTaggedVectors().

639 {
640  if (!_subproblem.vectorTagExists(tag))
641  mooseError("Cannot close vector with TagID ",
642  tag,
643  " in system '",
644  name(),
645  "' because that tag does not exist in the problem");
646  else if (!hasVector(tag))
647  mooseError("Cannot close vector tag with name '",
649  "' in system '",
650  name(),
651  "' because there is no vector associated with that tag");
652 
653  getVector(tag).close();
654 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
virtual void close()=0
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:198
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

◆ closeTaggedVectors()

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

Close all vectors for given tags.

Definition at line 657 of file SystemBase.C.

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

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

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

Referenced by FEProblemBase::computeDamping().

3223 {
3224  // Default to no damping
3225  Real damping = 1.0;
3226  bool has_active_dampers = false;
3227 
3228  try
3229  {
3231  {
3232  PARALLEL_TRY
3233  {
3234  TIME_SECTION("computeDampers", 3, "Computing Dampers");
3235  has_active_dampers = true;
3238  Threads::parallel_reduce(*_mesh.getActiveLocalElementRange(), cid);
3239  damping = std::min(cid.damping(), damping);
3240  }
3241  PARALLEL_CATCH;
3242  }
3243 
3245  {
3246  PARALLEL_TRY
3247  {
3248  TIME_SECTION("computeDamping::element", 3, "Computing Element Damping");
3249 
3250  has_active_dampers = true;
3253  Threads::parallel_reduce(*_mesh.getLocalNodeRange(), cndt);
3254  damping = std::min(cndt.damping(), damping);
3255  }
3256  PARALLEL_CATCH;
3257  }
3258 
3260  {
3261  PARALLEL_TRY
3262  {
3263  TIME_SECTION("computeDamping::general", 3, "Computing General Damping");
3264 
3265  has_active_dampers = true;
3266  const auto & gdampers = _general_dampers.getActiveObjects();
3267  for (const auto & damper : gdampers)
3268  {
3269  Real gd_damping = damper->computeDamping(solution, update);
3270  try
3271  {
3272  damper->checkMinDamping(gd_damping);
3273  }
3274  catch (MooseException & e)
3275  {
3277  }
3278  damping = std::min(gd_damping, damping);
3279  }
3280  }
3281  PARALLEL_CATCH;
3282  }
3283  }
3284  catch (MooseException & e)
3285  {
3286  // The buck stops here, we have already handled the exception by
3287  // calling stopSolve(), it is now up to PETSc to return a
3288  // "diverged" reason during the next solve.
3289  }
3290 
3291  _communicator.min(damping);
3292 
3293  if (has_active_dampers && damping < 1.0)
3294  _console << " Damping factor: " << damping << std::endl;
3295 
3296  return damping;
3297 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1211
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1040
virtual const char * what() const
Get out the error message.
NumericVector< Number > & solution()
Definition: SystemBase.h:176
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:1077
FEProblemBase & _fe_problem
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
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:929
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 3300 of file NonlinearSystemBase.C.

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

3301 {
3303 
3304  std::set<const Elem *> dirac_elements;
3305 
3307  {
3308  TIME_SECTION("computeDirac", 3, "Computing DiracKernels");
3309 
3310  // TODO: Need a threading fix... but it's complicated!
3311  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
3312  {
3313  const auto & dkernels = _dirac_kernels.getActiveObjects(tid);
3314  for (const auto & dkernel : dkernels)
3315  {
3316  dkernel->clearPoints();
3317  dkernel->addPoints();
3318  }
3319  }
3320 
3321  ComputeDiracThread cd(_fe_problem, tags, is_jacobian);
3322 
3323  _fe_problem.getDiracElements(dirac_elements);
3324 
3325  DistElemRange range(dirac_elements.begin(), dirac_elements.end(), 1);
3326  // TODO: Make Dirac work thread!
3327  // Threads::parallel_reduce(range, cd);
3328 
3329  cd(range);
3330  }
3331 }
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.
FEProblemBase & _fe_problem
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...
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 3071 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobian().

3072 {
3074 
3075  computeJacobianTags(tags);
3076 
3078 }
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:1025
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1037

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

3059 {
3060  _nl_matrix_tags.clear();
3061 
3062  auto & tags = _fe_problem.getMatrixTags();
3063 
3064  for (auto & tag : tags)
3065  _nl_matrix_tags.insert(tag.second);
3066 
3067  computeJacobian(jacobian, _nl_matrix_tags);
3068 }
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.
FEProblemBase & _fe_problem
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:215

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

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

3101 {
3102  _nl_matrix_tags.clear();
3103 
3104  auto & tags = _fe_problem.getMatrixTags();
3105  for (auto & tag : tags)
3106  _nl_matrix_tags.insert(tag.second);
3107 
3109 }
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.
FEProblemBase & _fe_problem
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:215

◆ computeJacobianBlocks() [2/2]

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

Definition at line 3112 of file NonlinearSystemBase.C.

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

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

Referenced by NonlinearSystemBase::computeJacobianTags().

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

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

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

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

1973 {
1974  _nl_vector_tags.clear();
1975 
1976  const auto & residual_vector_tags = _fe_problem.getVectorTags(Moose::VECTOR_TAG_RESIDUAL);
1977  for (const auto & residual_vector_tag : residual_vector_tags)
1978  _nl_vector_tags.insert(residual_vector_tag._id);
1979 
1981  computeNodalBCs(residual, _nl_vector_tags);
1983 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:942
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:930
FEProblemBase & _fe_problem
std::vector< VectorTag > getVectorTags(const std::set< TagID > &tag_ids) const
Definition: SubProblem.C:149
TagID residualVectorTag() const override
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 1986 of file NonlinearSystemBase.C.

1987 {
1989 
1990  computeNodalBCs(tags);
1991 
1993 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:942
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:930
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 1996 of file NonlinearSystemBase.C.

1997 {
1998  // We need to close the diag_save_in variables on the aux system before NodalBCBases clear the
1999  // dofs on boundary nodes
2000  if (_has_save_in)
2002 
2003  PARALLEL_TRY
2004  {
2005  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
2006 
2007  if (!bnd_nodes.empty())
2008  {
2009  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2010 
2011  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2012 
2013  // Select nodal kernels
2014  if (tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL) || !tags.size())
2015  nbc_warehouse = &_nodal_bcs;
2016  else if (tags.size() == 1)
2017  nbc_warehouse = &(_nodal_bcs.getVectorTagObjectWarehouse(*(tags.begin()), 0));
2018  else
2019  nbc_warehouse = &(_nodal_bcs.getVectorTagsObjectWarehouse(tags, 0));
2020 
2021  for (const auto & bnode : bnd_nodes)
2022  {
2023  BoundaryID boundary_id = bnode->_bnd_id;
2024  Node * node = bnode->_node;
2025 
2026  if (node->processor_id() == processor_id())
2027  {
2028  // reinit variables in nodes
2029  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2030  if (nbc_warehouse->hasActiveBoundaryObjects(boundary_id))
2031  {
2032  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
2033  for (const auto & nbc : bcs)
2034  if (nbc->shouldApply())
2035  nbc->computeResidual();
2036  }
2037  }
2038  }
2039  }
2040  }
2041  PARALLEL_CATCH;
2042 
2043  if (_Re_time)
2044  _Re_time->close();
2045  _Re_non_time->close();
2046 }
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:176
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
FEProblemBase & _fe_problem
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
MooseMesh & _mesh
Definition: SystemBase.h:929
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:172
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:1091

◆ computeNodalBCsResidualAndJacobian()

void NonlinearSystemBase::computeNodalBCsResidualAndJacobian ( )
protectedinherited

compute the residual and Jacobian for nodal boundary conditions

Definition at line 2049 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

2050 {
2051  PARALLEL_TRY
2052  {
2053  ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
2054 
2055  if (!bnd_nodes.empty())
2056  {
2057  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2058 
2059  for (const auto & bnode : bnd_nodes)
2060  {
2061  BoundaryID boundary_id = bnode->_bnd_id;
2062  Node * node = bnode->_node;
2063 
2064  if (node->processor_id() == processor_id())
2065  {
2066  // reinit variables in nodes
2067  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2068  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
2069  {
2070  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
2071  for (const auto & nbc : bcs)
2072  if (nbc->shouldApply())
2073  nbc->computeResidualAndJacobian();
2074  }
2075  }
2076  }
2077  }
2078  }
2079  PARALLEL_CATCH;
2080 
2081  // Set the cached NodalBCBase values in the Jacobian matrix
2083 }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
boundary_id_type BoundaryID
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseMesh & _mesh
Definition: SystemBase.h:929
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
Assembly & assembly(const THREAD_ID tid, const unsigned int nl_sys_num) override
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:1091
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 754 of file NonlinearSystemBase.C.

755 {
756  mooseDeprecated(" Please use computeResidualTag");
757 
758  computeResidualTag(residual, tag_id);
759 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313
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 1882 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

1884 {
1885  TIME_SECTION("computeResidualAndJacobianInternal", 3);
1886 
1887  // Make matrix ready to use
1889 
1890  for (auto tag : matrix_tags)
1891  {
1892  if (!hasMatrix(tag))
1893  continue;
1894 
1895  auto & jacobian = getMatrix(tag);
1896  // Necessary for speed
1897  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
1898  {
1899  MatSetOption(petsc_matrix->mat(),
1900  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
1901  PETSC_TRUE);
1903  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
1904  }
1905  }
1906 
1907  residualSetup();
1908 
1909  // Residual contributions from UOs - for now this is used for ray tracing
1910  // and ray kernels that contribute to the residual (think line sources)
1911  std::vector<UserObject *> uos;
1913  .query()
1914  .condition<AttribSystem>("UserObject")
1915  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1916  .queryInto(uos);
1917  for (auto & uo : uos)
1918  uo->residualSetup();
1919  for (auto & uo : uos)
1920  {
1921  uo->initialize();
1922  uo->execute();
1923  uo->finalize();
1924  }
1925 
1926  // reinit scalar variables
1927  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1929 
1930  // residual contributions from the domain
1931  PARALLEL_TRY
1932  {
1933  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1934 
1936 
1937  ComputeResidualAndJacobianThread crj(_fe_problem, vector_tags, matrix_tags);
1938  Threads::parallel_reduce(elem_range, crj);
1939 
1940  using FVRange = StoredRange<MooseMesh::const_face_info_iterator, const FaceInfo *>;
1941  if (_fe_problem.haveFV())
1942  {
1944  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/false);
1946  Threads::parallel_reduce(faces, fvrj);
1947  }
1948  if (auto displaced_problem = _fe_problem.getDisplacedProblem();
1949  displaced_problem && displaced_problem->haveFV())
1950  {
1952  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/true);
1953  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1954  displaced_problem->mesh().ownedFaceInfoEnd());
1955  Threads::parallel_reduce(faces, fvr);
1956  }
1957 
1959 
1960  unsigned int n_threads = libMesh::n_threads();
1961  for (unsigned int i = 0; i < n_threads;
1962  i++) // Add any cached residuals that might be hanging around
1963  {
1966  }
1967  }
1968  PARALLEL_CATCH;
1969 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1040
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:1292
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:328
FEProblemBase & _fe_problem
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:1103
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:929
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:973
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:1301
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 839 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeResidualAndJacobian().

841 {
842  const bool required_residual =
843  vector_tags.find(residualVectorTag()) == vector_tags.end() ? false : true;
844 
845  try
846  {
847  zeroTaggedVectors(vector_tags);
848  computeResidualAndJacobianInternal(vector_tags, matrix_tags);
849  closeTaggedVectors(vector_tags);
850  closeTaggedMatrices(matrix_tags);
851 
852  if (required_residual)
853  {
854  auto & residual = getVector(residualVectorTag());
855  if (_time_integrator)
856  _time_integrator->postResidual(residual);
857  else
858  residual += *_Re_non_time;
859  residual.close();
860  }
861 
863  closeTaggedVectors(vector_tags);
864  closeTaggedMatrices(matrix_tags);
865  }
866  catch (MooseException & e)
867  {
868  // The buck stops here, we have already handled the exception by
869  // calling stopSolve(), it is now up to PETSc to return a
870  // "diverged" reason during the next solve.
871  }
872 }
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:683
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:1009
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:657
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:973
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

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

Referenced by NonlinearSystemBase::computeResidualTags().

1664 {
1665  parallel_object_only();
1666 
1667  TIME_SECTION("computeResidualInternal", 3);
1668 
1669  residualSetup();
1670 
1671  const auto vector_tag_data = _fe_problem.getVectorTags(tags);
1672 
1673  // Residual contributions from UOs - for now this is used for ray tracing
1674  // and ray kernels that contribute to the residual (think line sources)
1675  std::vector<UserObject *> uos;
1677  .query()
1678  .condition<AttribSystem>("UserObject")
1679  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1680  .queryInto(uos);
1681  for (auto & uo : uos)
1682  uo->residualSetup();
1683  for (auto & uo : uos)
1684  {
1685  uo->initialize();
1686  uo->execute();
1687  uo->finalize();
1688  }
1689 
1690  // reinit scalar variables
1691  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1693 
1694  // residual contributions from the domain
1695  PARALLEL_TRY
1696  {
1697  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1698 
1700 
1702  Threads::parallel_reduce(elem_range, cr);
1703 
1704  // We pass face information directly to FV residual objects for their evaluation. Consequently
1705  // we must make sure to do separate threaded loops for 1) undisplaced face information objects
1706  // and undisplaced residual objects and 2) displaced face information objects and displaced
1707  // residual objects
1708  using FVRange = StoredRange<MooseMesh::const_face_info_iterator, const FaceInfo *>;
1709  if (_fe_problem.haveFV())
1710  {
1712  _fe_problem, this->number(), tags, /*on_displaced=*/false);
1714  Threads::parallel_reduce(faces, fvr);
1715  }
1716  if (auto displaced_problem = _fe_problem.getDisplacedProblem();
1717  displaced_problem && displaced_problem->haveFV())
1718  {
1720  _fe_problem, this->number(), tags, /*on_displaced=*/true);
1721  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1722  displaced_problem->mesh().ownedFaceInfoEnd());
1723  Threads::parallel_reduce(faces, fvr);
1724  }
1725 
1726  unsigned int n_threads = libMesh::n_threads();
1727  for (unsigned int i = 0; i < n_threads;
1728  i++) // Add any cached residuals that might be hanging around
1730  }
1731  PARALLEL_CATCH;
1732 
1733  // residual contributions from the scalar kernels
1734  PARALLEL_TRY
1735  {
1736  // do scalar kernels (not sure how to thread this)
1738  {
1739  TIME_SECTION("ScalarKernels", 3 /*, "Computing ScalarKernels"*/);
1740 
1741  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
1742  // This code should be refactored once we can do tags for scalar
1743  // kernels
1744  // Should redo this based on Warehouse
1745  if (!tags.size() || tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL))
1746  scalar_kernel_warehouse = &_scalar_kernels;
1747  else if (tags.size() == 1)
1748  scalar_kernel_warehouse =
1749  &(_scalar_kernels.getVectorTagObjectWarehouse(*(tags.begin()), 0));
1750  else
1751  // scalar_kernels is not threading
1752  scalar_kernel_warehouse = &(_scalar_kernels.getVectorTagsObjectWarehouse(tags, 0));
1753 
1754  bool have_scalar_contributions = false;
1755  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
1756  for (const auto & scalar_kernel : scalars)
1757  {
1758  scalar_kernel->reinit();
1759  const std::vector<dof_id_type> & dof_indices = scalar_kernel->variable().dofIndices();
1760  const DofMap & dof_map = scalar_kernel->variable().dofMap();
1761  const dof_id_type first_dof = dof_map.first_dof();
1762  const dof_id_type end_dof = dof_map.end_dof();
1763  for (dof_id_type dof : dof_indices)
1764  {
1765  if (dof >= first_dof && dof < end_dof)
1766  {
1767  scalar_kernel->computeResidual();
1768  have_scalar_contributions = true;
1769  break;
1770  }
1771  }
1772  }
1773  if (have_scalar_contributions)
1775  }
1776  }
1777  PARALLEL_CATCH;
1778 
1779  // residual contributions from Block NodalKernels
1780  PARALLEL_TRY
1781  {
1783  {
1784  TIME_SECTION("NodalKernels", 3 /*, "Computing NodalKernels"*/);
1785 
1787 
1788  ConstNodeRange & range = *_mesh.getLocalNodeRange();
1789 
1790  if (range.begin() != range.end())
1791  {
1792  _fe_problem.reinitNode(*range.begin(), 0);
1793 
1794  Threads::parallel_reduce(range, cnk);
1795 
1796  unsigned int n_threads = libMesh::n_threads();
1797  for (unsigned int i = 0; i < n_threads;
1798  i++) // Add any cached residuals that might be hanging around
1800  }
1801  }
1802  }
1803  PARALLEL_CATCH;
1804 
1806  // We computed the volumetric objects. We can return now before we get into
1807  // any strongly enforced constraint conditions or penalty-type objects
1808  // (DGKernels, IntegratedBCs, InterfaceKernels, Constraints)
1809  return;
1810 
1811  // residual contributions from boundary NodalKernels
1812  PARALLEL_TRY
1813  {
1815  {
1816  TIME_SECTION("NodalKernelBCs", 3 /*, "Computing NodalKernelBCs"*/);
1817 
1819 
1820  ConstBndNodeRange & bnd_node_range = *_mesh.getBoundaryNodeRange();
1821 
1822  Threads::parallel_reduce(bnd_node_range, cnk);
1823 
1824  unsigned int n_threads = libMesh::n_threads();
1825  for (unsigned int i = 0; i < n_threads;
1826  i++) // Add any cached residuals that might be hanging around
1828  }
1829  }
1830  PARALLEL_CATCH;
1831 
1833 
1834  if (_residual_copy.get())
1835  {
1836  _Re_non_time->close();
1838  }
1839 
1841  {
1842  _Re_non_time->close();
1845  }
1846 
1847  PARALLEL_TRY { computeDiracContributions(tags, false); }
1848  PARALLEL_CATCH;
1849 
1851  {
1852  PARALLEL_TRY { enforceNodalConstraintsResidual(*_Re_non_time); }
1853  PARALLEL_CATCH;
1854  _Re_non_time->close();
1855  }
1856 
1857  // Add in Residual contributions from other Constraints
1859  {
1860  PARALLEL_TRY
1861  {
1862  // Undisplaced Constraints
1864 
1865  // Displaced Constraints
1868 
1871  }
1872  PARALLEL_CATCH;
1873  _Re_non_time->close();
1874  }
1875 
1876  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
1877  // counters
1879 }
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:1040
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:1292
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:1077
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...
FEProblemBase & _fe_problem
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:149
StoredRange< MeshBase::const_node_iterator, const Node *> ConstNodeRange
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
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:926
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:929
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:172
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:1301
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:1091
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 740 of file NonlinearSystemBase.C.

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

741 {
742  _nl_vector_tags.clear();
743  _nl_vector_tags.insert(tag_id);
745 
747 
749 
751 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:942
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:930
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 762 of file NonlinearSystemBase.C.

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

763 {
764  parallel_object_only();
765 
766  TIME_SECTION("nl::computeResidualTags", 5);
767 
770 
771  bool required_residual = tags.find(residualVectorTag()) == tags.end() ? false : true;
772 
774 
775  // not suppose to do anythin on matrix
777 
779 
780  for (const auto & numeric_vec : _vecs_to_zero_for_residual)
781  if (hasVector(numeric_vec))
782  {
783  NumericVector<Number> & vec = getVector(numeric_vec);
784  vec.close();
785  vec.zero();
786  }
787 
788  try
789  {
790  zeroTaggedVectors(tags);
792  closeTaggedVectors(tags);
793 
794  if (required_residual)
795  {
796  auto & residual = getVector(residualVectorTag());
797  if (_time_integrator)
798  _time_integrator->postResidual(residual);
799  else
800  residual += *_Re_non_time;
801  residual.close();
802  }
804  // We don't want to do nodal bcs or anything else
805  return;
806 
807  computeNodalBCs(tags);
808  closeTaggedVectors(tags);
809 
810  // If we are debugging residuals we need one more assignment to have the ghosted copy up to
811  // date
812  if (_need_residual_ghosted && _debugging_residuals && required_residual)
813  {
814  auto & residual = getVector(residualVectorTag());
815 
816  *_residual_ghosted = residual;
818  }
819  // Need to close and update the aux system in case residuals were saved to it.
822  if (hasSaveIn())
824  }
825  catch (MooseException & e)
826  {
827  // The buck stops here, we have already handled the exception by
828  // calling stopSolve(), it is now up to PETSc to return a
829  // "diverged" reason during the next solve.
830  }
831 
832  // not supposed to do anything on matrix
834 
836 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1211
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:683
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
bool _debugging_residuals
true if debugging residuals
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:176
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:1092
FEProblemBase & _fe_problem
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:1103
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
AuxiliarySystem & getAuxiliarySystem()
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:657
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:926
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:973
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:882

◆ computeScalarKernelsJacobians()

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

Definition at line 2642 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

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

Referenced by NonlinearSystemBase::preSolve().

3848 {
3850  return true;
3851 
3852  _console << "\nPerforming automatic scaling calculation\n" << std::endl;
3853 
3854  TIME_SECTION("computeScaling", 3, "Computing Automatic Scaling");
3855 
3856  // It's funny but we need to assemble our vector of scaling factors here otherwise we will be
3857  // applying scaling factors of 0 during Assembly of our scaling Jacobian
3859 
3860  // container for repeated access of element global dof indices
3861  std::vector<dof_id_type> dof_indices;
3862 
3863  if (!_auto_scaling_initd)
3864  setupScalingData();
3865 
3866  std::vector<Real> inverse_scaling_factors(_num_scaling_groups, 0);
3867  std::vector<Real> resid_inverse_scaling_factors(_num_scaling_groups, 0);
3868  std::vector<Real> jac_inverse_scaling_factors(_num_scaling_groups, 0);
3869  auto & dof_map = dofMap();
3870 
3871  // what types of scaling do we want?
3872  bool jac_scaling = _resid_vs_jac_scaling_param < 1. - TOLERANCE;
3873  bool resid_scaling = _resid_vs_jac_scaling_param > TOLERANCE;
3874 
3875  const NumericVector<Number> & scaling_residual = RHS();
3876 
3877  if (jac_scaling)
3878  {
3879  // if (!_auto_scaling_initd)
3880  // We need to reinit this when the number of dofs changes
3881  // but there is no good way to track that
3882  // In theory, it is the job of libmesh system to track this,
3883  // but this special matrix is not owned by libMesh system
3884  // Let us reinit eveytime since it is not expensive
3885  {
3886  auto init_vector = NumericVector<Number>::build(this->comm());
3887  init_vector->init(system().n_dofs(), system().n_local_dofs(), /*fast=*/false, PARALLEL);
3888 
3889  _scaling_matrix->clear();
3890  _scaling_matrix->init(*init_vector);
3891  }
3892 
3894  // Dispatch to derived classes to ensure that we use the correct matrix tag
3897  }
3898 
3899  if (resid_scaling)
3900  {
3903  // Dispatch to derived classes to ensure that we use the correct vector tag
3907  }
3908 
3909  // Did something bad happen during residual/Jacobian scaling computation?
3911  return false;
3912 
3913  auto examine_dof_indices = [this,
3914  jac_scaling,
3915  resid_scaling,
3916  &dof_map,
3917  &jac_inverse_scaling_factors,
3918  &resid_inverse_scaling_factors,
3919  &scaling_residual](const auto & dof_indices, const auto var_number)
3920  {
3921  for (auto dof_index : dof_indices)
3922  if (dof_map.local_index(dof_index))
3923  {
3924  if (jac_scaling)
3925  {
3926  // For now we will use the diagonal for determining scaling
3927  auto mat_value = (*_scaling_matrix)(dof_index, dof_index);
3928  auto & factor = jac_inverse_scaling_factors[_var_to_group_var[var_number]];
3929  factor = std::max(factor, std::abs(mat_value));
3930  }
3931  if (resid_scaling)
3932  {
3933  auto vec_value = scaling_residual(dof_index);
3934  auto & factor = resid_inverse_scaling_factors[_var_to_group_var[var_number]];
3935  factor = std::max(factor, std::abs(vec_value));
3936  }
3937  }
3938  };
3939 
3940  // Compute our scaling factors for the spatial field variables
3941  for (const auto & elem : *mesh().getActiveLocalElementRange())
3942  for (const auto i : make_range(system().n_vars()))
3943  if (_variable_autoscaled[i] && system().variable_type(i).family != SCALAR)
3944  {
3945  dof_map.dof_indices(elem, dof_indices, i);
3946  examine_dof_indices(dof_indices, i);
3947  }
3948 
3949  for (const auto i : make_range(system().n_vars()))
3950  if (_variable_autoscaled[i] && system().variable_type(i).family == SCALAR)
3951  {
3952  dof_map.SCALAR_dof_indices(dof_indices, i);
3953  examine_dof_indices(dof_indices, i);
3954  }
3955 
3956  if (resid_scaling)
3957  _communicator.max(resid_inverse_scaling_factors);
3958  if (jac_scaling)
3959  _communicator.max(jac_inverse_scaling_factors);
3960 
3961  if (jac_scaling && resid_scaling)
3962  for (MooseIndex(inverse_scaling_factors) i = 0; i < inverse_scaling_factors.size(); ++i)
3963  {
3964  // Be careful not to take log(0)
3965  if (!resid_inverse_scaling_factors[i])
3966  {
3967  if (!jac_inverse_scaling_factors[i])
3968  inverse_scaling_factors[i] = 1;
3969  else
3970  inverse_scaling_factors[i] = jac_inverse_scaling_factors[i];
3971  }
3972  else if (!jac_inverse_scaling_factors[i])
3973  // We know the resid is not zero
3974  inverse_scaling_factors[i] = resid_inverse_scaling_factors[i];
3975  else
3976  inverse_scaling_factors[i] =
3977  std::exp(_resid_vs_jac_scaling_param * std::log(resid_inverse_scaling_factors[i]) +
3978  (1 - _resid_vs_jac_scaling_param) * std::log(jac_inverse_scaling_factors[i]));
3979  }
3980  else if (jac_scaling)
3981  inverse_scaling_factors = jac_inverse_scaling_factors;
3982  else if (resid_scaling)
3983  inverse_scaling_factors = resid_inverse_scaling_factors;
3984  else
3985  mooseError("We shouldn't be calling this routine if we're not performing any scaling");
3986 
3987  // We have to make sure that our scaling values are not zero
3988  for (auto & scaling_factor : inverse_scaling_factors)
3989  if (scaling_factor == 0)
3990  scaling_factor = 1;
3991 
3992  // Now flatten the group scaling factors to the individual variable scaling factors
3993  std::vector<Real> flattened_inverse_scaling_factors(system().n_vars());
3994  for (const auto i : index_range(flattened_inverse_scaling_factors))
3995  flattened_inverse_scaling_factors[i] = inverse_scaling_factors[_var_to_group_var[i]];
3996 
3997  // Now set the scaling factors for the variables
3998  applyScalingFactors(flattened_inverse_scaling_factors);
3999  if (auto displaced_problem = _fe_problem.getDisplacedProblem().get())
4000  displaced_problem->systemBaseNonlinear(number()).applyScalingFactors(
4001  flattened_inverse_scaling_factors);
4002 
4003  _computed_scaling = true;
4004  return true;
4005 }
std::unique_ptr< DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
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:1424
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:284
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:1131
FEProblemBase & _fe_problem
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:1125
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.
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.
virtual MooseMesh & mesh()
Definition: SystemBase.h:96
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 DumpObjectsNonlinearSystem::computeScalingJacobian ( )
inlineoverrideprotectedvirtual

Compute a "Jacobian" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 42 of file DumpObjectsNonlinearSystem.h.

42 {}

◆ computeScalingOnce() [1/2]

bool NonlinearSystemBase::computeScalingOnce ( ) const
inlineinherited

Definition at line 652 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

652 { 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 653 of file NonlinearSystemBase.h.

654  {
655  _compute_scaling_once = compute_scaling_once;
656  }
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...

◆ computeScalingResidual()

void DumpObjectsNonlinearSystem::computeScalingResidual ( )
inlineoverrideprotectedvirtual

Compute a "residual" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 43 of file DumpObjectsNonlinearSystem.h.

43 {}

◆ computeTimeDerivatives()

void NonlinearSystemBase::computeTimeDerivatives ( bool  jacobian_calculation = false)
inherited

Computes the time derivative vector.

Definition at line 1019 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeJacobianTags(), and ExplicitSSPRungeKutta::solveStage().

1020 {
1021  // If we're doing any Jacobian calculation other than the initial Jacobian calculation for
1022  // automatic variable scaling, then we can just return because the residual function evaluation
1023  // has already done this work for us
1024  if (jacobian_calculation && !_fe_problem.computingScalingJacobian())
1025  return;
1026 
1027  if (_time_integrator)
1028  {
1029  _time_integrator->preStep();
1030  _time_integrator->computeTimeDerivatives();
1031  }
1032 }
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
FEProblemBase & _fe_problem
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:973

◆ computeVariables()

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

Definition at line 852 of file SystemBase.h.

852 {}

◆ computingInitialResidual()

virtual bool NonlinearSystemBase::computingInitialResidual ( )
inlinevirtualinherited

Returns true if this system is currently computing the initial residual for a solve.

Returns
Whether or not we are currently computing the initial residual.

Definition at line 98 of file NonlinearSystemBase.h.

◆ computingScalingJacobian()

bool SystemBase::computingScalingJacobian ( ) const
inherited

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

Definition at line 1481 of file SystemBase.C.

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

1482 {
1484 }
virtual bool computingScalingJacobian() const =0
Getter for whether we&#39;re computing the scaling jacobian.
SubProblem & _subproblem
Definition: SystemBase.h:924

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

Referenced by NonlinearSystemBase::computeJacobianInternal().

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

Referenced by NonlinearSystemBase::computeResidualInternal().

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

◆ containsTimeKernel()

bool NonlinearSystemBase::containsTimeKernel ( )
inherited

Definition at line 3680 of file NonlinearSystemBase.C.

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

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

◆ converged()

virtual bool DumpObjectsNonlinearSystem::converged ( )
inlineoverridevirtual

Returns the convergence state.

Returns
true if converged, otherwise false

Implements NonlinearSystemBase.

Definition at line 32 of file DumpObjectsNonlinearSystem.h.

32 { return true; }

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 1254 of file SystemBase.C.

Referenced by EigenExecutionerBase::inversePowerIteration().

1255 {
1256  const auto states =
1257  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
1258  if (states > 1)
1259  for (unsigned int i = states - 1; i > 0; --i)
1260  solutionState(i) = solutionState(i - 1);
1261 
1262  if (solutionUDotOld())
1263  *solutionUDotOld() = *solutionUDot();
1264  if (solutionUDotDotOld())
1266  if (solutionPreviousNewton())
1268 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual NumericVector< Number > * solutionUDot()=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:1384
virtual NumericVector< Number > * solutionUDotDotOld()=0
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:998
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1312
virtual NumericVector< Number > * solutionUDotOld()=0
virtual NumericVector< Number > * solutionUDotDot()=0

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 1227 of file SystemBase.C.

1228 {
1229  system().update();
1230 
1231  // Copying the solutions backward so the current solution will become the old, and the old will
1232  // become older. The same applies to the nonlinear iterates.
1233  for (const auto iteration_index : index_range(_solution_states))
1234  {
1235  const auto states = _solution_states[iteration_index].size();
1236  if (states > 1)
1237  for (unsigned int i = states - 1; i > 0; --i)
1238  solutionState(i, Moose::SolutionIterationType(iteration_index)) =
1239  solutionState(i - 1, Moose::SolutionIterationType(iteration_index));
1240  }
1241 
1242  if (solutionUDotOld())
1243  *solutionUDotOld() = *solutionUDot();
1244  if (solutionUDotDotOld())
1246  if (solutionPreviousNewton())
1248 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual NumericVector< Number > * solutionUDot()=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:1384
virtual NumericVector< Number > * solutionUDotDotOld()=0
virtual System & system()=0
Get the reference to the libMesh system.
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:998
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1312
virtual NumericVector< Number > * solutionUDotOld()=0
virtual NumericVector< Number > * solutionUDotDot()=0
auto index_range(const T &sizable)
SolutionIterationType
Definition: MooseTypes.h:229

◆ copyVars()

void SystemBase::copyVars ( ExodusII_IO &  io)
inherited

Definition at line 1151 of file SystemBase.C.

1152 {
1153  int n_steps = io.get_num_time_steps();
1154 
1155  bool did_copy = false;
1156  for (const auto & vci : _var_to_copy)
1157  {
1158  int timestep = -1;
1159 
1160  if (vci._timestep == "LATEST")
1161  // Use the last time step in the file from which to retrieve the solution
1162  timestep = n_steps;
1163  else
1164  {
1165  timestep = MooseUtils::convert<int>(vci._timestep);
1166  if (timestep > n_steps)
1167  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
1168  "a valid integer between 1 and ",
1169  n_steps,
1170  " inclusive, received ",
1171  vci._timestep);
1172  }
1173 
1174  did_copy = true;
1175 
1176  if (hasVariable(vci._dest_name))
1177  {
1178  const auto & var = getVariable(0, vci._dest_name);
1179  if (var.isArray())
1180  {
1181  const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1182  for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1183  {
1184  const auto exodus_var = _subproblem.arrayVariableComponent(vci._source_name, i);
1185  const auto system_var = array_var.componentName(i);
1186  if (var.isNodal())
1187  io.copy_nodal_solution(system(), exodus_var, system_var, timestep);
1188  else
1189  io.copy_elemental_solution(system(), exodus_var, system_var, timestep);
1190  }
1191  }
1192  else
1193  {
1194  if (var.isNodal())
1195  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
1196  else
1197  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
1198  }
1199  }
1200  else if (hasScalarVariable(vci._dest_name))
1201  io.copy_scalar_solution(system(), {vci._dest_name}, {vci._source_name}, timestep);
1202  else
1203  mooseError("Unrecognized variable ", vci._dest_name, " in variables to copy.");
1204  }
1205 
1206  if (did_copy)
1207  solution().close();
1208 }
NumericVector< Number > & solution()
Definition: SystemBase.h:176
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:964
int convert< int >(const std::string &str, bool throw_on_failure)
Definition: MooseUtils.C:999
SubProblem & _subproblem
Definition: SystemBase.h:924
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:800
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:261
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:79
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:825

◆ currentSolution()

const NumericVector<Number>* const& NonlinearSystemBase::currentSolution ( ) const
inlineoverridevirtualinherited

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

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

418  {
419  return _current_solution;
420  }
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver

◆ customSetup()

void NonlinearSystemBase::customSetup ( const ExecFlagType exec_type)
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 387 of file NonlinearSystemBase.C.

388 {
389  SystemBase::customSetup(exec_type);
390 
391  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
392  {
393  _kernels.customSetup(exec_type, tid);
394  _nodal_kernels.customSetup(exec_type, tid);
395  _dirac_kernels.customSetup(exec_type, tid);
396  if (_doing_dg)
397  _dg_kernels.customSetup(exec_type, tid);
398  _interface_kernels.customSetup(exec_type, tid);
399  _element_dampers.customSetup(exec_type, tid);
400  _nodal_dampers.customSetup(exec_type, tid);
401  _integrated_bcs.customSetup(exec_type, tid);
402 
403  if (_fe_problem.haveFV())
404  {
405  std::vector<FVFluxBC *> bcs;
407  .query()
408  .template condition<AttribSystem>("FVFluxBC")
409  .template condition<AttribThread>(tid)
410  .queryInto(bcs);
411 
412  std::vector<FVInterfaceKernel *> iks;
414  .query()
415  .template condition<AttribSystem>("FVInterfaceKernel")
416  .template condition<AttribThread>(tid)
417  .queryInto(iks);
418 
419  std::vector<FVFluxKernel *> kernels;
421  .query()
422  .template condition<AttribSystem>("FVFluxKernel")
423  .template condition<AttribThread>(tid)
424  .queryInto(kernels);
425 
426  for (auto * bc : bcs)
427  bc->customSetup(exec_type);
428  for (auto * ik : iks)
429  ik->customSetup(exec_type);
430  for (auto * kernel : kernels)
431  kernel->customSetup(exec_type);
432  }
433  }
434  _scalar_kernels.customSetup(exec_type);
435  _constraints.customSetup(exec_type);
436  _general_dampers.customSetup(exec_type);
437  _nodal_bcs.customSetup(exec_type);
438 }
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)
FEProblemBase & _fe_problem
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
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:1501
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 1092 of file SystemBase.C.

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

1093 {
1094  auto num_matrix_tags = _subproblem.numMatrixTags();
1095 
1096  _matrix_tag_active_flags.resize(num_matrix_tags);
1097 
1098  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1099  _matrix_tag_active_flags[tag] = false;
1100 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:951
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:210

◆ deactiveMatrixTag()

void SystemBase::deactiveMatrixTag ( TagID  tag)
virtualinherited

deactive a matrix for tag

Definition at line 1080 of file SystemBase.C.

1081 {
1082  mooseAssert(_subproblem.matrixTagExists(tag),
1083  "Cannot deactivate Matrix with matrix_tag : " << tag << "that does not exist");
1084 
1085  if (_matrix_tag_active_flags.size() < tag + 1)
1086  _matrix_tag_active_flags.resize(tag + 1);
1087 
1088  _matrix_tag_active_flags[tag] = false;
1089 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:951
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ debuggingResiduals()

void NonlinearSystemBase::debuggingResiduals ( bool  state)
inlineinherited

Definition at line 548 of file NonlinearSystemBase.h.

548 { _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 287 of file SystemBase.h.

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

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

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

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

281  {
283  }
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:260
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:270
virtual TagID residualVectorTag() const
Definition: SystemBase.h:275

◆ disassociateDefaultMatrixTags()

void SystemBase::disassociateDefaultMatrixTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 1059 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultMatrixTags().

1060 {
1061  const auto tags = defaultMatrixTags();
1062  for (const auto tag : tags)
1063  if (_subproblem.matrixTagExists(tag))
1065 }
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition: SystemBase.h:287
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1037
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ disassociateDefaultVectorTags()

void SystemBase::disassociateDefaultVectorTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 964 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultVectorTags().

965 {
966  const auto tags = defaultVectorTags();
967  for (const auto tag : tags)
968  if (_subproblem.vectorTagExists(tag))
970 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:942
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
Definition: SystemBase.h:280

◆ disassociateMatrixFromTag() [1/2]

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

Disassociate a matrix from a tag.

Reimplemented in DisplacedSystem.

Definition at line 1037 of file SystemBase.C.

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

1038 {
1039  if (!_subproblem.matrixTagExists(tag))
1040  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1041  if (hasMatrix(tag) && &getMatrix(tag) != &matrix)
1042  mooseError("You can not disassociate a matrix from a tag which it was not associated to");
1043 
1045 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1037
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:973
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

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

1049 {
1050  if (!_subproblem.matrixTagExists(tag))
1051  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1052 
1053  if (_tagged_matrices.size() < tag + 1)
1054  _tagged_matrices.resize(tag + 1);
1055  _tagged_matrices[tag] = nullptr;
1056 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

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

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

943 {
944  if (!_subproblem.vectorTagExists(tag))
945  mooseError("Cannot disassociate vector from tag ", tag, " because that tag does not exist");
946  if (hasVector(tag) && &getVector(tag) != &vec)
947  mooseError("You can not disassociate a vector from a tag which it was not associated to");
948 
950 }
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
Definition: SystemBase.C:942
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

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

954 {
955  if (!_subproblem.vectorTagExists(tag))
956  mooseError("Cannot disassociate vector from tag ", tag, " because that tag does not exist");
957 
958  if (_tagged_vectors.size() < tag + 1)
959  _tagged_vectors.resize(tag + 1);
960  _tagged_vectors[tag] = nullptr;
961 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

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

1138 {
1139  return system().get_dof_map();
1140 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ doingDG()

bool NonlinearSystemBase::doingDG ( ) const
inherited

Getter for _doing_dg.

Definition at line 3739 of file NonlinearSystemBase.C.

3740 {
3741  return _doing_dg;
3742 }
bool _doing_dg
true if DG is active (optimization reasons)

◆ duDotDotDu() [1/2]

virtual Number& SystemBase::duDotDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 223 of file SystemBase.h.

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

223 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:944

◆ duDotDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 225 of file SystemBase.h.

225 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:944

◆ duDotDu() [1/2]

virtual Number& SystemBase::duDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 222 of file SystemBase.h.

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

222 { return _du_dot_du; }
Real _du_dot_du
Definition: SystemBase.h:943

◆ duDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 224 of file SystemBase.h.

224 { return _du_dot_du; }
Real _du_dot_du
Definition: SystemBase.h:943

◆ enforceNodalConstraintsJacobian()

void NonlinearSystemBase::enforceNodalConstraintsJacobian ( )
protectedinherited

Definition at line 1060 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

1061 {
1062  if (!hasMatrix(systemMatrixTag()))
1063  mooseError(" A system matrix is required");
1064 
1065  auto & jacobian = getMatrix(systemMatrixTag());
1066  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1067 
1069  {
1070  const auto & ncs = _constraints.getActiveNodalConstraints();
1071  for (const auto & nc : ncs)
1072  {
1073  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1074  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1075 
1076  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1077  {
1078  _fe_problem.reinitNodes(primary_node_ids, tid);
1079  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1080  nc->computeJacobian(jacobian);
1081  }
1082  }
1084  jacobian.close();
1085  }
1086 }
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:284
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:328
FEProblemBase & _fe_problem
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
ConstraintWarehouse _constraints
Constraints storage object.
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:973
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 1035 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualInternal().

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

◆ finalNonlinearResidual()

Real NonlinearSystemBase::finalNonlinearResidual ( ) const
inlineinherited

Return the final nonlinear residual.

Definition at line 534 of file NonlinearSystemBase.h.

534 { 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 1017 of file SystemBase.C.

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

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

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

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

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

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

◆ getConstraintWarehouse()

const ConstraintWarehouse& NonlinearSystemBase::getConstraintWarehouse ( ) const
inlineinherited

Definition at line 606 of file NonlinearSystemBase.h.

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

◆ getCurrentNonlinearIterationNumber()

virtual unsigned int DumpObjectsNonlinearSystem::getCurrentNonlinearIterationNumber ( )
inlineoverridevirtual

Implements NonlinearSystemBase.

Definition at line 36 of file DumpObjectsNonlinearSystem.h.

36 { return 0; }

◆ getDGKernelWarehouse()

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

Definition at line 591 of file NonlinearSystemBase.h.

591 { return _dg_kernels; }
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels

◆ getDiracKernelWarehouse()

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

Definition at line 596 of file NonlinearSystemBase.h.

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

◆ getElementDamperWarehouse()

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

Definition at line 598 of file NonlinearSystemBase.h.

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

599  {
600  return _element_dampers;
601  }
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 100 of file SystemBase.C.

Referenced by Marker::getMarkerValue().

101 {
102  return *_vars[tid].getFieldVariable<T>(var_name);
103 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

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

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

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

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

◆ getIntegratedBCWarehouse() [1/2]

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

Definition at line 597 of file NonlinearSystemBase.h.

Referenced by BoundaryElemIntegrityCheckThread::operator()().

597 { return _integrated_bcs; }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getIntegratedBCWarehouse() [2/2]

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

Return the IntegratedBCBase warehouse.

Definition at line 616 of file NonlinearSystemBase.h.

617  {
618  return _integrated_bcs;
619  }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getInterfaceKernelWarehouse()

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

Definition at line 592 of file NonlinearSystemBase.h.

593  {
594  return _interface_kernels;
595  }
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels

◆ getKernelWarehouse()

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

Access functions to Warehouses from outside NonlinearSystemBase.

Definition at line 590 of file NonlinearSystemBase.h.

Referenced by DOFMapOutput::output().

590 { 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 973 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(), FEProblemBase::computeResidualAndJacobian(), NonlinearSystemBase::computeResidualAndJacobianInternal(), NonlinearSystemBase::constraintJacobians(), SystemBase::disassociateMatrixFromTag(), NonlinearSystemBase::enforceNodalConstraintsJacobian(), SystemBase::flushTaggedMatrices(), DisplacedSystem::getMatrix(), MooseVariableScalar::reinit(), Assembly::setCachedJacobian(), and Assembly::zeroCachedJacobian().

974 {
975  if (!hasMatrix(tag))
976  {
977  if (!_subproblem.matrixTagExists(tag))
978  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
979  else
980  mooseError("Cannot retreive matrix with tag ",
981  tag,
982  " in system '",
983  name(),
984  "'\nbecause a matrix has not been associated with that tag.");
985  }
986 
987  return *_tagged_matrices[tag];
988 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ getMatrix() [2/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 991 of file SystemBase.C.

992 {
993  if (!hasMatrix(tag))
994  {
995  if (!_subproblem.matrixTagExists(tag))
996  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
997  else
998  mooseError("Cannot retreive matrix with tag ",
999  tag,
1000  " in system '",
1001  name(),
1002  "'\nbecause a matrix has not been associated with that tag.");
1003  }
1004 
1005  return *_tagged_matrices[tag];
1006 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inlineinherited

Returns the maximum number of all variables on the system.

Definition at line 850 of file SystemBase.h.

850 { return _max_var_number; }
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:938

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

Referenced by Moose::globalDofIndexToDerivative().

563 { 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:967

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

570 { 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:970

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

231 {
232  Order order = CONSTANT;
233  const std::vector<MooseVariableFieldBase *> & vars = _vars[0].fieldVariables();
234  for (const auto & var : vars)
235  {
236  FEType fe_type = var->feType();
237  if (fe_type.default_quadrature_order() > order)
238  order = fe_type.default_quadrature_order();
239  }
240 
241  return order;
242 }
Order
CONSTANT
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

◆ getMooseKSPNormType()

Moose::MooseKSPNormType NonlinearSystemBase::getMooseKSPNormType ( )
inlineinherited

Definition at line 561 of file NonlinearSystemBase.h.

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

561 { return _ksp_norm; }
Moose::MooseKSPNormType _ksp_norm
KSP norm type.

◆ getNodalBCWarehouse()

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

Return the NodalBCBase warehouse.

Definition at line 611 of file NonlinearSystemBase.h.

611 { return _nodal_bcs; }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs

◆ getNodalDamperWarehouse()

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

Definition at line 602 of file NonlinearSystemBase.h.

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

603  {
604  return _nodal_dampers;
605  }
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 2086 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::findImplicitGeometricCouplingEntries().

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

◆ getPCSide()

Moose::PCSideType NonlinearSystemBase::getPCSide ( )
inlineinherited

Definition at line 557 of file NonlinearSystemBase.h.

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

557 { return _pc_side; }
Moose::PCSideType _pc_side
Preconditioning side.

◆ getPreconditioner()

MoosePreconditioner const * NonlinearSystemBase::getPreconditioner ( ) const
inherited

Definition at line 3506 of file NonlinearSystemBase.C.

Referenced by ConsoleUtils::outputExecutionInformation().

3507 {
3508  return _preconditioner.get();
3509 }
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ getPredictor()

Predictor* NonlinearSystemBase::getPredictor ( )
inlineinherited

Definition at line 553 of file NonlinearSystemBase.h.

Referenced by AB2PredictorCorrector::estimateTimeError().

553 { 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 979 of file NonlinearSystemBase.C.

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

980 {
981  if (!_Re_non_time)
982  {
984 
985  // Most applications don't need the expense of ghosting
987  _Re_non_time = &addVector(_Re_non_time_tag, false, ptype);
988  }
990  {
991  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
992 
993  // If an application changes its mind, the libMesh API lets us
994  // change the vector.
995  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
996  }
997 
998  return *_Re_non_time;
999 }
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:597
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:81
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.
FEProblemBase & _fe_problem
GHOSTED
SubProblem & _subproblem
Definition: SystemBase.h:924
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:198
ParallelType

◆ getResidualTimeVector()

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

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

Definition at line 956 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::residualVector().

957 {
958  if (!_Re_time)
959  {
961 
962  // Most applications don't need the expense of ghosting
964  _Re_time = &addVector(_Re_time_tag, false, ptype);
965  }
966  else if (_need_residual_ghosted && _Re_time->type() == PARALLEL)
967  {
968  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
969 
970  // If an application changes its mind, the libMesh API lets us
971  // change the vector.
972  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
973  }
974 
975  return *_Re_time;
976 }
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:597
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:81
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
FEProblemBase & _fe_problem
GHOSTED
SubProblem & _subproblem
Definition: SystemBase.h:924
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:198
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 134 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().

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

144 {
145  MooseVariableScalar * var =
146  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
147  if (!var)
148  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
149  return *var;
150 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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:934
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 872 of file SystemBase.h.

Referenced by DisplacedProblem::DisplacedProblem().

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

◆ getSNES()

virtual SNES DumpObjectsNonlinearSystem::getSNES ( )
inlineoverridevirtual

Implements NonlinearSystemBase.

Definition at line 34 of file DumpObjectsNonlinearSystem.h.

34 { return nullptr; }

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

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

725 {
726  return _splits.getActiveObject(name);
727 }
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 742 of file SystemBase.h.

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

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

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

754  {
755  return getSubdomainsForVar(getVariable(0, var_name).number());
756  }
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:742
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:79

◆ getTimeIntegrator() [1/2]

TimeIntegrator* SystemBase::getTimeIntegrator ( )
inlineinherited

◆ getTimeIntegrator() [2/2]

const TimeIntegrator* SystemBase::getTimeIntegrator ( ) const
inlineinherited

Definition at line 870 of file SystemBase.h.

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

◆ 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 79 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(), Assembly::initNonlocalCoupling(), PNGOutput::makeMeshFunc(), FEProblemBase::prepare(), Assembly::prepareBlock(), Assembly::prepareBlockNonlocal(), AddPeriodicBCAction::setPeriodicVars(), NonlinearSystemBase::setupScalingData(), UpdateErrorVectorsThread::UpdateErrorVectorsThread(), and VariableCondensationPreconditioner::VariableCondensationPreconditioner().

80 {
82  dynamic_cast<MooseVariableFieldBase *>(_vars[tid].getVariable(var_name));
83  if (!var)
84  mooseError("Variable '", var_name, "' does not exist in this system");
85  return *var;
86 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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:934

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

90 {
91  if (var_number < _numbered_vars[tid].size())
92  if (_numbered_vars[tid][var_number])
93  return *_numbered_vars[tid][var_number];
94 
95  mooseError("Variable #", Moose::stringify(var_number), " does not exist in this system");
96 }
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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 153 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

154 {
155  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
156  if (_var_map[var_number].empty())
157  return nullptr;
158  else
159  return &_var_map[var_number];
160 }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:936

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

825 { 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:988

◆ getVariableNames()

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

◆ getVariables()

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

◆ getVector() [1/4]

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

Get a raw NumericVector by name.

Get a raw NumericVector with the given name.

Reimplemented in DisplacedSystem.

Definition at line 882 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().

883 {
884  return system().get_vector(name);
885 }
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 888 of file SystemBase.C.

889 {
890  return system().get_vector(name);
891 }
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 894 of file SystemBase.C.

895 {
896  if (!hasVector(tag))
897  {
898  if (!_subproblem.vectorTagExists(tag))
899  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
900  else
901  mooseError("Cannot retreive vector with tag ",
902  tag,
903  " in system '",
904  name(),
905  "'\nbecause a vector has not been associated with that tag.");
906  }
907 
908  return *_tagged_vectors[tag];
909 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

◆ getVector() [4/4]

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

Reimplemented in DisplacedSystem.

Definition at line 912 of file SystemBase.C.

913 {
914  if (!hasVector(tag))
915  {
916  if (!_subproblem.vectorTagExists(tag))
917  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
918  else
919  mooseError("Cannot retreive vector with tag ",
920  tag,
921  " in system '",
922  name(),
923  "'\nbecause a vector has not been associated with that tag.");
924  }
925 
926  return *_tagged_vectors[tag];
927 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

◆ hasDiagSaveIn()

bool NonlinearSystemBase::hasDiagSaveIn ( ) const
inlineinherited

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

Definition at line 631 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 328 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(), Assembly::setCachedJacobian(), and Assembly::zeroCachedJacobian().

329  {
330  return tag < _tagged_matrices.size() && _tagged_matrices[tag];
331  }
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949

◆ hasSaveIn()

bool NonlinearSystemBase::hasSaveIn ( ) const
inlineinherited

Weather or not the nonlinear system has save-ins.

Definition at line 626 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags().

626 { 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 825 of file SystemBase.C.

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

826 {
827  if (system().has_variable(var_name))
828  return system().variable_type(var_name).family == SCALAR;
829  else
830  return false;
831 }
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 1004 of file SystemBase.h.

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

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

◆ hasVarCopy()

bool SystemBase::hasVarCopy ( ) const
inlineinherited

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

Definition at line 875 of file SystemBase.h.

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

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

801 {
802  auto & names = getVariableNames();
803  if (system().has_variable(var_name))
804  return system().variable_type(var_name).family != SCALAR;
805  if (std::find(names.begin(), names.end(), var_name) != names.end())
806  // array variable
807  return true;
808  else
809  return false;
810 }
SCALAR
virtual System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:843

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

250  {
251  return tag_id < _tagged_vectors.size() && _tagged_vectors[tag_id];
252  }
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

◆ haveFieldSplitPreconditioner()

bool NonlinearSystemBase::haveFieldSplitPreconditioner ( ) const
inlineinherited

Definition at line 114 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 110 of file NonlinearSystemBase.h.

111  {
113  }
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 674 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

675  {
676  _ignore_variables_for_autoscaling = ignore_variables_for_autoscaling;
677  }
std::vector< std::string > _ignore_variables_for_autoscaling
A container for variables that do not partipate in autoscaling.

◆ init()

void NonlinearSystemBase::init ( )
overridevirtualinherited

Initialize the system.

Reimplemented from SystemBase.

Reimplemented in NonlinearSystem.

Definition at line 186 of file NonlinearSystemBase.C.

Referenced by NonlinearSystem::init().

187 {
189 
190  if (_fe_problem.hasDampers())
191  setupDampers();
192 
193  _current_solution = _sys.current_local_solution.get();
194 
195  if (_serialized_solution.get())
196  _serialized_solution->init(_sys.n_dofs(), false, SERIAL);
197 
198  if (_residual_copy.get())
199  _residual_copy->init(_sys.n_dofs(), false, SERIAL);
200 }
void setupDampers()
Setup damping stuff (called before we actually start)
virtual void init()
Initialize the system.
Definition: SystemBase.h:150
bool hasDampers()
Whether or not this system has dampers.
SERIAL
FEProblemBase & _fe_problem
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

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

Definition at line 155 of file SystemBase.h.

155 {};

◆ initialSetup()

void NonlinearSystemBase::initialSetup ( )
overridevirtualinherited

Setup Functions.

Reimplemented from SystemBase.

Definition at line 232 of file NonlinearSystemBase.C.

233 {
234  TIME_SECTION("nlInitialSetup", 2, "Setting Up Nonlinear System");
235 
237 
238  {
239  TIME_SECTION("kernelsInitialSetup", 2, "Setting Up Kernels/BCs/Constraints");
240 
241  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
242  {
243  _kernels.initialSetup(tid);
246  if (_doing_dg)
249 
253 
254  if (_fe_problem.haveFV())
255  {
256  std::vector<FVElementalKernel *> fv_elemental_kernels;
258  .query()
259  .template condition<AttribSystem>("FVElementalKernel")
260  .template condition<AttribThread>(tid)
261  .queryInto(fv_elemental_kernels);
262 
263  for (auto * fv_kernel : fv_elemental_kernels)
264  fv_kernel->initialSetup();
265 
266  std::vector<FVFluxKernel *> fv_flux_kernels;
268  .query()
269  .template condition<AttribSystem>("FVFluxKernel")
270  .template condition<AttribThread>(tid)
271  .queryInto(fv_flux_kernels);
272 
273  for (auto * fv_kernel : fv_flux_kernels)
274  fv_kernel->initialSetup();
275  }
276  }
277 
282  }
283 
284  {
285  TIME_SECTION("mortarSetup", 2, "Initializing Mortar Interfaces");
286 
287  auto create_mortar_functors = [this](const bool displaced)
288  {
289  // go over mortar interfaces and construct functors
290  const auto & mortar_interfaces = _fe_problem.getMortarInterfaces(displaced);
291  for (const auto & mortar_interface : mortar_interfaces)
292  {
293  const auto primary_secondary_boundary_pair = mortar_interface.first;
294  if (!_constraints.hasActiveMortarConstraints(primary_secondary_boundary_pair, displaced))
295  continue;
296 
297  const auto & mortar_generation_object = mortar_interface.second;
298 
299  auto & mortar_constraints =
300  _constraints.getActiveMortarConstraints(primary_secondary_boundary_pair, displaced);
301 
302  auto & subproblem = displaced
303  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
304  : static_cast<SubProblem &>(_fe_problem);
305 
306  auto & mortar_functors =
308 
309  mortar_functors.emplace(primary_secondary_boundary_pair,
310  ComputeMortarFunctor(mortar_constraints,
311  mortar_generation_object,
312  subproblem,
313  _fe_problem,
314  displaced,
315  subproblem.assembly(0, number())));
316  }
317  };
318 
319  create_mortar_functors(false);
320  create_mortar_functors(true);
321  }
322 
323  if (_automatic_scaling)
324  {
326  _scaling_matrix = std::make_unique<OffDiagonalScalingMatrix<Number>>(_communicator);
327  else
328  _scaling_matrix = std::make_unique<DiagonalMatrix<Number>>(_communicator);
329  }
330 }
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)
FEProblemBase & _fe_problem
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:979
MooseObjectTagWarehouse< KernelBase > _kernels
virtual SubProblem & subproblem()
Definition: SystemBase.h:98
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1125
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
ConstraintWarehouse _constraints
Constraints storage object.
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
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:1487
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int nl_sys_num)=0
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 1321 of file SystemBase.C.

Referenced by DisplacedSystem::initSolutionState().

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

◆ isArrayVariable()

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

If a variable is an array variable.

Definition at line 813 of file SystemBase.C.

814 {
815  auto & names = getVariableNames();
816  if (!system().has_variable(var_name) &&
817  std::find(names.begin(), names.end(), var_name) != names.end())
818  // array variable
819  return true;
820  else
821  return false;
822 }
virtual System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:843

◆ isScalarVariable()

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

Definition at line 834 of file SystemBase.C.

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

835 {
836  return (system().variable(var_num).type().family == SCALAR);
837 }
virtual System & system()=0
Get the reference to the libMesh system.

◆ jacobianSetup()

void NonlinearSystemBase::jacobianSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 2688 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2689 {
2691 
2692  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
2693  {
2694  _kernels.jacobianSetup(tid);
2697  if (_doing_dg)
2703  }
2708 
2709  // Avoid recursion
2710  if (this == &_fe_problem.currentNonlinearSystem())
2713 }
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:1522
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
FEProblemBase & _fe_problem
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:926
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

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtualinherited

If or not a matrix tag is active.

Definition at line 1117 of file SystemBase.C.

1118 {
1119  mooseAssert(_subproblem.matrixTagExists(tag), "Matrix tag " << tag << " does not exist");
1120 
1121  return tag < _matrix_tag_active_flags.size() && _matrix_tag_active_flags[tag];
1122 }
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:951
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:294

◆ mesh() [1/2]

virtual MooseMesh& SystemBase::mesh ( )
inlinevirtualinherited

◆ mesh() [2/2]

virtual const MooseMesh& SystemBase::mesh ( ) const
inlinevirtualinherited

Definition at line 97 of file SystemBase.h.

97 { return _mesh; }
MooseMesh & _mesh
Definition: SystemBase.h:929

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

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

3755 {
3756  parallel_object_only();
3757 
3758  try
3759  {
3760  for (auto & map_pr : _undisplaced_mortar_functors)
3761  map_pr.second(compute_type, vector_tags, matrix_tags);
3762 
3763  for (auto & map_pr : _displaced_mortar_functors)
3764  map_pr.second(compute_type, vector_tags, matrix_tags);
3765  }
3766  catch (MetaPhysicL::LogicError &)
3767  {
3768  mooseError(
3769  "We caught a MetaPhysicL error in NonlinearSystemBase::mortarConstraints. This is very "
3770  "likely due to AD not having a sufficiently large derivative container size. Please run "
3771  "MOOSE configure with the '--with-derivative-size=<n>' option");
3772  }
3773 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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 3720 of file NonlinearSystemBase.C.

3721 {
3722  return _integrated_bcs.hasActiveBoundaryObjects(bnd_id, tid);
3723 }
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 3726 of file NonlinearSystemBase.C.

3727 {
3728  return _interface_kernels.hasActiveBoundaryObjects(bnd_id, tid);
3729 }
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 1393 of file SystemBase.C.

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

1395 {
1396  libmesh_parallel_only(this->comm());
1397 
1398  if (hasSolutionState(state, iteration_type))
1399  return;
1400 
1401  auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1402  solution_states.resize(state + 1);
1403 
1404  // The 0-th (current) solution state is owned by libMesh
1405  if (!solution_states[0])
1406  solution_states[0] = &solutionInternal();
1407  else
1408  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1409 
1410  // We will manually add all states past current
1411  for (unsigned int i = 1; i <= state; ++i)
1412  if (!solution_states[i])
1413  {
1414  auto tag = _subproblem.addVectorTag(oldSolutionStateVectorName(i, iteration_type),
1416  solution_states[i] = &addVector(tag, true, GHOSTED);
1417  }
1418  else
1419  mooseAssert(solution_states[i] == &getVector(oldSolutionStateVectorName(i, iteration_type)),
1420  "Inconsistent solution state");
1421 }
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:597
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:81
const Parallel::Communicator & comm() const
SubProblem & _subproblem
Definition: SystemBase.h:924
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:1004
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:1338
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:998
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

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

3734 {
3735  return _doing_dg;
3736 }
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 849 of file SystemBase.C.

Referenced by SystemBase::nVariables().

850 {
851  unsigned int n = 0;
852  for (auto & var : _vars[0].fieldVariables())
853  n += var->count();
854 
855  return n;
856 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

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

Referenced by MooseMesh::cacheFVElementalDoFs().

860 {
861  unsigned int n = 0;
862  for (auto & var : _vars[0].fieldVariables())
863  if (var->isFV())
864  n += var->count();
865 
866  return n;
867 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

◆ nLinearIterations()

unsigned int NonlinearSystemBase::nLinearIterations ( ) const
inlineinherited

Return the number of linear iterations.

Definition at line 524 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

524 { return _n_linear_iters; }

◆ nNonlinearIterations()

unsigned int NonlinearSystemBase::nNonlinearIterations ( ) const
inlineinherited

Return the number of non-linear iterations.

Definition at line 519 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

519 { 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 540 of file NonlinearSystemBase.h.

Referenced by Console::writeVariableNorms().

540 { return _last_nl_rnorm; }

◆ nonlinearSolver()

virtual NonlinearSolver<Number>* DumpObjectsNonlinearSystem::nonlinearSolver ( )
inlineoverridevirtual

Implements NonlinearSystemBase.

Definition at line 29 of file DumpObjectsNonlinearSystem.h.

29 { return NULL; }

◆ nonTimeVectorTag()

TagID NonlinearSystemBase::nonTimeVectorTag ( ) const
inlineoverridevirtualinherited

Reimplemented from SystemBase.

Definition at line 643 of file NonlinearSystemBase.h.

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

643 { 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 529 of file NonlinearSystemBase.h.

529 { 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 1125 of file SystemBase.C.

Referenced by FEProblemBase::addCachedResidualDirectly(), FEProblemBase::addJacobian(), FEProblemBase::addJacobianBlockTags(), FEProblemBase::addJacobianLowerD(), FEProblemBase::addJacobianNeighbor(), FEProblemBase::addJacobianNeighborLowerD(), FEProblemBase::addJacobianOffDiagScalar(), FEProblemBase::addJacobianScalar(), FEProblemBase::addResidual(), FEProblemBase::addResidualLower(), FEProblemBase::addResidualNeighbor(), FEProblemBase::addResidualScalar(), SystemBase::addScalingVector(), ADKernelTempl< T >::ADKernelTempl(), 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::currentNlSysNum(), PseudoTimestep::currentResidualNorm(), Moose::FV::determineElemOneAndTwo(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), Moose::doDerivatives(), VariableResidual::execute(), GreaterThanLessThanPostprocessor::execute(), NodalNormalsCorner::execute(), NodalNormalsEvaluator::execute(), NodalNormalsPreprocessor::execute(), ElementSubdomainModifier::finalize(), NumNonlinearIterations::finalize(), BoundsBase::getDoFIndex(), NonlinearSystemBase::getNodeDofs(), SystemBase::getSubdomainsForVar(), NumLinearIterations::getValue(), NumResidualEvaluations::getValue(), Residual::getValue(), Moose::globalDofIndexToDerivative(), 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(), 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().

1126 {
1127  return system().number();
1128 }
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 840 of file SystemBase.C.

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

841 {
842  unsigned int n = nFieldVariables();
843  n += _vars[0].scalars().size();
844 
845  return n;
846 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
unsigned int nFieldVariables() const
Get the number of field variables in this system.
Definition: SystemBase.C:849

◆ offDiagonalsInAutoScaling() [1/2]

bool NonlinearSystemBase::offDiagonalsInAutoScaling ( ) const
inlineinherited

Definition at line 679 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 680 of file NonlinearSystemBase.h.

681  {
682  _off_diagonals_in_auto_scaling = off_diagonals_in_auto_scaling;
683  }
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 875 of file NonlinearSystemBase.C.

876 {
877  if (_time_integrator)
878  _time_integrator->preSolve();
879  if (_predictor.get())
880  _predictor->timestepSetup();
881 }
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:973
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 1584 of file NonlinearSystemBase.C.

Referenced by ActuallyExplicitEuler::solve().

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

Referenced by SubProblem::reinitElemFaceRef().

246 {
248  {
249  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
251  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
252  for (const auto & var : vars)
253  var->clearDofIndices();
254 
255  for (const auto & var : active_elemental_moose_variables)
256  if (&(var->sys()) == this)
257  var->prepare();
258  }
259  else
260  {
261  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
262  for (const auto & var : vars)
263  var->prepare();
264  }
265 }
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:420
SubProblem & _subproblem
Definition: SystemBase.h:924
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:426

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

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

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

Referenced by SubProblem::reinitLowerDElem().

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

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 313 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

314 {
315  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
316  for (const auto & var : vars)
317  var->prepareNeighbor();
318 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

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

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

4056 {
4057  // Clear the iteration counters
4058  _current_l_its.clear();
4059  _current_nl_its = 0;
4060 
4061  // Initialize the solution vector using a predictor and known values from nodal bcs
4063 
4064  // Now that the initial solution has ben set, potentially perform a residual/Jacobian evaluation
4065  // to determine variable scaling factors
4066  if (_automatic_scaling)
4067  {
4068  const bool scaling_succeeded = computeScaling();
4069  if (!scaling_succeeded)
4070  return false;
4071  }
4072 
4073  // We do not know a priori what variable a global degree of freedom corresponds to, so we need a
4074  // map from global dof to scaling factor. We just use a ghosted NumericVector for that mapping
4076 
4077  return true;
4078 }
std::vector< unsigned int > _current_l_its
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:979
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 546 of file NonlinearSystemBase.h.

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

330 {
331 
333  {
334  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
336  for (const auto & var : active_elemental_moose_variables)
337  if (&(var->sys()) == this)
338  var->computeElemValues();
339  }
340  else
341  {
342  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
343  for (const auto & var : vars)
344  var->computeElemValues();
345  }
346 }
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:420
SubProblem & _subproblem
Definition: SystemBase.h:924
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:426

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

Referenced by SubProblem::reinitElemFaceRef().

353 {
354  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
355  for (const auto & var : vars)
356  var->computeElemValuesFace();
357 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

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

Referenced by ComputeNodalDampingThread::onNode().

3528 {
3529  for (const auto & var : damped_vars)
3530  var->computeIncrementAtNode(*_increment_vec);
3531 }
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 3518 of file NonlinearSystemBase.C.

Referenced by ComputeElemDampingThread::onElement().

3520 {
3521  for (const auto & var : damped_vars)
3522  var->computeIncrementAtQps(*_increment_vec);
3523 }
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 379 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

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

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

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

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

Referenced by SubProblem::reinitNeighborFaceRef().

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

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

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

◆ reinitNodeFace() [1/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 399 of file SystemBase.C.

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

◆ reinitNodeFace() [2/3]

void SystemBase::reinitNodeFace
inherited

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 399 of file SystemBase.C.

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

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

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

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

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

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

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

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

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

◆ removeMatrix()

void SystemBase::removeMatrix ( TagID  tag)
inherited

Removes a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 579 of file SystemBase.C.

580 {
581  if (!_subproblem.matrixTagExists(tag_id))
582  mooseError("Cannot remove the matrix with TagID ",
583  tag_id,
584  "\nin system '",
585  name(),
586  "', because that tag does not exist in the problem");
587 
588  if (hasMatrix(tag_id))
589  {
590  const auto matrix_name = _subproblem.matrixTagName(tag_id);
591  system().remove_matrix(matrix_name);
592  _tagged_matrices[tag_id] = nullptr;
593  }
594 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:949
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:328
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
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:294
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:323

◆ removeVector() [1/2]

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

Remove a vector from the system with the given name.

Definition at line 1291 of file SystemBase.C.

Referenced by SystemBase::restoreOldSolutions().

1292 {
1293  system().remove_vector(name);
1294 }
virtual const std::string & name() const
Definition: SystemBase.C:1297
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 690 of file SystemBase.C.

691 {
692  if (!_subproblem.vectorTagExists(tag_id))
693  mooseError("Cannot remove the vector with TagID ",
694  tag_id,
695  "\nin system '",
696  name(),
697  "', because that tag does not exist in the problem");
698 
699  if (hasVector(tag_id))
700  {
701  auto vector_name = _subproblem.vectorTagName(tag_id);
702  system().remove_vector(vector_name);
703  _tagged_vectors[tag_id] = nullptr;
704  }
705 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
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:198
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:947

◆ residualAndJacobianTogether()

void DumpObjectsNonlinearSystem::residualAndJacobianTogether ( )
inlineoverridevirtual

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

Implements NonlinearSystemBase.

Definition at line 39 of file DumpObjectsNonlinearSystem.h.

39 {}

◆ residualCopy()

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

Reimplemented from SystemBase.

Definition at line 3334 of file NonlinearSystemBase.C.

3335 {
3336  if (!_residual_copy.get())
3338 
3339  return *_residual_copy;
3340 }
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 3343 of file NonlinearSystemBase.C.

3344 {
3345  _need_residual_ghosted = true;
3346  if (!_residual_ghosted)
3347  {
3348  // The first time we realize we need a ghosted residual vector,
3349  // we add it.
3350  _residual_ghosted = &addVector("residual_ghosted", false, GHOSTED);
3351 
3352  // If we've already realized we need time and/or non-time
3353  // residual vectors, but we haven't yet realized they need to be
3354  // ghosted, fix that now.
3355  //
3356  // If an application changes its mind, the libMesh API lets us
3357  // change the vector.
3358  if (_Re_time)
3359  {
3360  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
3361  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
3362  }
3363  if (_Re_non_time)
3364  {
3365  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
3366  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
3367  }
3368  }
3369  return *_residual_ghosted;
3370 }
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:597
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
Definition: SystemBase.h:924
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:198

◆ residualSetup()

void NonlinearSystemBase::residualSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 1633 of file NonlinearSystemBase.C.

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

1634 {
1635  TIME_SECTION("residualSetup", 3);
1636 
1638 
1639  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1640  {
1641  _kernels.residualSetup(tid);
1644  if (_doing_dg)
1650  }
1655 
1656  // Avoid recursion
1657  if (this == &_fe_problem.currentNonlinearSystem())
1660 }
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)
FEProblemBase & _fe_problem
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:926
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:1515
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 1002 of file NonlinearSystemBase.C.

1003 {
1004  mooseDeprecated("Please use getVector()");
1005  switch (tag)
1006  {
1007  case 0:
1008  return getResidualNonTimeVector();
1009 
1010  case 1:
1011  return getResidualTimeVector();
1012 
1013  default:
1014  mooseError("The required residual vector is not available");
1015  }
1016 }
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:284
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:313
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 531 of file SystemBase.C.

532 {
533  const auto states =
534  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
535  if (states > 1)
536  for (unsigned int i = 1; i <= states - 1; ++i)
537  if (_saved_solution_states[i])
538  {
540  removeVector("save_solution_state_" + std::to_string(i));
541  _saved_solution_states[i] = nullptr;
542  }
543 
545  {
547  removeVector("save_solution_dot_old");
548  _saved_dot_old = nullptr;
549  }
551  {
553  removeVector("save_solution_dotdot_old");
554  _saved_dotdot_old = nullptr;
555  }
556 }
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:1384
virtual NumericVector< Number > * solutionUDotDotOld()=0
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:958
void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1291
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:998
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:959
virtual NumericVector< Number > * solutionUDotOld()=0
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1000

◆ restoreSolutions()

void NonlinearSystemBase::restoreSolutions ( )
overridevirtualinherited

Restore current solutions (call after your solve failed)

Reimplemented from SystemBase.

Definition at line 223 of file NonlinearSystemBase.C.

224 {
225  // call parent
227  // and update _current_solution
228  _current_solution = _sys.current_local_solution.get();
229 }
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
Definition: SystemBase.C:1274

◆ RHS()

virtual NumericVector<Number>& DumpObjectsNonlinearSystem::RHS ( )
inlineoverridevirtual

Implements NonlinearSystemBase.

Definition at line 33 of file DumpObjectsNonlinearSystem.h.

33 { return *_dummy; }
NumericVector< Number > * _dummy

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 499 of file SystemBase.C.

500 {
501  const auto states =
502  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
503  if (states > 1)
504  {
505  _saved_solution_states.resize(states);
506  for (unsigned int i = 1; i <= states - 1; ++i)
507  if (!_saved_solution_states[i])
509  &addVector("save_solution_state_" + std::to_string(i), false, PARALLEL);
510 
511  for (unsigned int i = 1; i <= states - 1; ++i)
513  }
514 
516  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
518  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
519 
520  if (solutionUDotOld())
522 
523  if (solutionUDotDotOld())
525 }
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:597
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:1384
virtual NumericVector< Number > * solutionUDotDotOld()=0
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:958
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:998
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:959
virtual NumericVector< Number > * solutionUDotOld()=0
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1000

◆ scalingGroupVariables()

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

Definition at line 668 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

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

◆ serializedSolution()

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

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

Implements SystemBase.

Definition at line 3485 of file NonlinearSystemBase.C.

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

3486 {
3487  if (!_serialized_solution.get())
3488  {
3490  _serialized_solution->init(_sys.n_dofs(), false, SERIAL);
3491  }
3492 
3493  return *_serialized_solution;
3494 }
const Parallel::Communicator & _communicator
SERIAL
static std::unique_ptr< NumericVector< Number > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...

◆ serializeSolution()

void NonlinearSystemBase::serializeSolution ( )
virtualinherited

Definition at line 3434 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::setSolution().

3435 {
3436  if (_serialized_solution.get())
3437  {
3438  if (!_serialized_solution->initialized() || _serialized_solution->size() != _sys.n_dofs())
3439  {
3440  _serialized_solution->clear();
3441  _serialized_solution->init(_sys.n_dofs(), false, SERIAL);
3442  }
3443 
3445  }
3446 }
SERIAL
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
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 1542 of file SystemBase.C.

Referenced by SubProblem::setActiveScalarVariableCoupleableVectorTags().

1544 {
1545  _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1546 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

◆ setActiveVariableCoupleableVectorTags()

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

Set the active vector tags for the variables.

Definition at line 1536 of file SystemBase.C.

Referenced by SubProblem::setActiveFEVariableCoupleableVectorTags().

1537 {
1538  _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1539 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934

◆ setConstraintSecondaryValues()

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

Sets the value of constrained variables in the solution vector.

Definition at line 1148 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::setInitialSolution().

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

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

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

449 {
451  if (splits.size() && splits.size() != 1)
452  mooseError("Only a single top-level split is allowed in a Problem's decomposition.");
453 
454  if (splits.size())
455  {
456  _decomposition_split = splits[0];
457  _have_decomposition = true;
458  }
459  else
460  _have_decomposition = false;
461 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
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.

◆ setInitialSolution()

void NonlinearSystemBase::setInitialSolution ( )
inherited

Definition at line 884 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preSolve().

885 {
887 
888  NumericVector<Number> & initial_solution(solution());
889  if (_predictor.get() && _predictor->shouldApply())
890  {
891  TIME_SECTION("applyPredictor", 2, "Applying Predictor");
892 
893  _predictor->apply(initial_solution);
894  _fe_problem.predictorCleanup(initial_solution);
895  }
896 
897  // do nodal BC
898  {
899  TIME_SECTION("initialBCs", 2, "Applying BCs To Initial Condition");
900 
902  for (const auto & bnode : bnd_nodes)
903  {
904  BoundaryID boundary_id = bnode->_bnd_id;
905  Node * node = bnode->_node;
906 
907  if (node->processor_id() == processor_id())
908  {
909  // reinit variables in nodes
910  _fe_problem.reinitNodeFace(node, boundary_id, 0);
911 
913  {
914  const auto & preset_bcs = _preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
915  for (const auto & preset_bc : preset_bcs)
916  preset_bc->computeValue(initial_solution);
917  }
919  {
920  const auto & preset_bcs_res = _ad_preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
921  for (const auto & preset_bc : preset_bcs_res)
922  preset_bc->computeValue(initial_solution);
923  }
924  }
925  }
926  }
927 
928  _sys.solution->close();
929  update();
930 
931  // Set constraint secondary values
932  setConstraintSecondaryValues(initial_solution, false);
933 
935  setConstraintSecondaryValues(initial_solution, true);
936 }
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
Definition: SystemBase.C:1211
NumericVector< Number > & solution()
Definition: SystemBase.h:176
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void deactiveAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1092
FEProblemBase & _fe_problem
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
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:929
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:1091
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 NonlinearSystemBase::setMooseKSPNormType ( MooseEnum  kspnorm)
inherited

Definition at line 3703 of file NonlinearSystemBase.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

3704 {
3705  if (kspnorm == "none")
3707  else if (kspnorm == "preconditioned")
3709  else if (kspnorm == "unpreconditioned")
3711  else if (kspnorm == "natural")
3713  else if (kspnorm == "default")
3715  else
3716  mooseError("Unknown ksp norm type specified.");
3717 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Use whatever we have in PETSc.
Definition: MooseTypes.h:749

◆ setPCSide()

void NonlinearSystemBase::setPCSide ( MooseEnum  pcs)
inherited

Definition at line 3688 of file NonlinearSystemBase.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

3689 {
3690  if (pcs == "left")
3692  else if (pcs == "right")
3694  else if (pcs == "symmetric")
3696  else if (pcs == "default")
3698  else
3699  mooseError("Unknown PC side specified.");
3700 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
Use whatever we have in PETSc.
Definition: MooseTypes.h:737
Moose::PCSideType _pc_side
Preconditioning side.

◆ setPreconditioner()

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

Sets a preconditioner.

Parameters
pcThe preconditioner to be set

Definition at line 3497 of file NonlinearSystemBase.C.

Referenced by SetupPreconditionerAction::act().

3498 {
3499  if (_preconditioner.get() != nullptr)
3500  mooseError("More than one active Preconditioner detected");
3501 
3502  _preconditioner = pc;
3503 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ setPredictor()

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

Definition at line 939 of file NonlinearSystemBase.C.

Referenced by SetupPredictorAction::act().

940 {
941  _predictor = predictor;
942 }
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ setPreviousNewtonSolution()

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

Definition at line 3745 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computePostCheck().

3746 {
3749 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
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:882

◆ setSolution()

void NonlinearSystemBase::setSolution ( const NumericVector< Number > &  soln)
virtualinherited

Definition at line 3449 of file NonlinearSystemBase.C.

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

3450 {
3451  _current_solution = &soln;
3452 
3454  associateVectorToTag(const_cast<NumericVector<Number> &>(soln), tag);
3455 
3456  if (_serialized_solution.get())
3458 }
virtual TagID getVectorTagID(const TagName &tag_name) const
Get a TagID from a TagName.
Definition: SubProblem.C:180
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:930
virtual void serializeSolution()
SubProblem & _subproblem
Definition: SystemBase.h:924
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
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 3461 of file NonlinearSystemBase.C.

3462 {
3463  *_u_dot = u_dot;
3464 }
NumericVector< Number > * _u_dot
solution vector for u^dot

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

3468 {
3469  *_u_dotdot = u_dotdot;
3470 }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot

◆ setSolutionUDotDotOld()

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

Definition at line 3479 of file NonlinearSystemBase.C.

3480 {
3481  *_u_dotdot_old = u_dotdot_old;
3482 }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot

◆ setSolutionUDotOld()

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

Definition at line 3473 of file NonlinearSystemBase.C.

3474 {
3475  *_u_dot_old = u_dot_old;
3476 }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot

◆ setupDampers()

void NonlinearSystemBase::setupDampers ( )
inherited

Setup damping stuff (called before we actually start)

Definition at line 3512 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::init().

3513 {
3514  _increment_vec = &_sys.add_vector("u_increment", true, GHOSTED);
3515 }
NumericVector< Number > * _increment_vec
increment vector

◆ setupDM()

void NonlinearSystemBase::setupDM ( )
inherited

Setup the PETSc DM object (when appropriate)

Definition at line 441 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::solve().

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

◆ setupFieldDecomposition()

void NonlinearSystemBase::setupFieldDecomposition ( )
inherited

Definition at line 464 of file NonlinearSystemBase.C.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner().

465 {
466  if (!_have_decomposition)
467  return;
468 
469  std::shared_ptr<Split> top_split = getSplit(_decomposition_split);
470  top_split->setup(*this);
471 }
bool _have_decomposition
Whether or not the system can be decomposed into splits.
std::shared_ptr< Split > getSplit(const std::string &name)
Retrieves a split by name.
std::string _decomposition_split
Name of the top-level split of the decomposition.

◆ setupFiniteDifferencedPreconditioner()

virtual void DumpObjectsNonlinearSystem::setupFiniteDifferencedPreconditioner ( )
inlineoverridevirtual

Implements NonlinearSystemBase.

Definition at line 37 of file DumpObjectsNonlinearSystem.h.

37 {}

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

176 {
177  AllLocalDofIndicesThread aldit(_subproblem, {var_name});
179  Threads::parallel_reduce(elem_range, aldit);
180 
181  // Gather the dof indices across procs to get all the dof indices for var_name
182  aldit.dofIndicesSetUnion();
183 
184  const auto & all_dof_indices = aldit.getDofIndices();
185  _var_all_dof_indices.assign(all_dof_indices.begin(), all_dof_indices.end());
186 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1040
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
Definition: SystemBase.h:988
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in...
SubProblem & _subproblem
Definition: SystemBase.h:924
MooseMesh & _mesh
Definition: SystemBase.h:929

◆ setVerboseFlag()

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

Sets the verbose flag.

Parameters
[in]verboseVerbose flag

Definition at line 129 of file SystemBase.h.

Referenced by Executioner::Executioner().

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

◆ solution() [1/2]

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

Definition at line 176 of file SystemBase.h.

Referenced by Adaptivity::adaptMesh(), TransientMultiApp::appTransferVector(), MooseEigenSystem::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(), NodalNormalsCorner::initialize(), NodalNormalsEvaluator::initialize(), NodalNormalsPreprocessor::initialize(), MooseEigenSystem::initSystemSolution(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeNodalUserObjectsThread::onNode(), FEProblemBase::projectInitialConditionOnCustomRange(), FEProblemBase::projectSolution(), Transient::relativeSolutionDifferenceNorm(), SystemBase::restoreSolutions(), SecantSolve::saveVariableValues(), SteffensenSolve::saveVariableValues(), PicardSolve::saveVariableValues(), MooseEigenSystem::scaleSystemSolution(), AuxiliarySystem::serializeSolution(), NonlinearSystemBase::setConstraintSecondaryValues(), NonlinearSystemBase::setInitialSolution(), DisplacedSystem::solutionInternal(), NonlinearEigenSystem::solve(), MultiAppDofCopyTransfer::transfer(), SteffensenSolve::transformVariables(), SecantSolve::transformVariables(), PicardSolve::transformVariables(), and SystemBase::zeroVariables().

176 { 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:1384

◆ solution() [2/2]

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

Definition at line 179 of file SystemBase.h.

179 { 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:1384

◆ solutionInternal()

NumericVector<Number>& NonlinearSystemBase::solutionInternal ( ) const
inlineoverrideprotectedvirtualinherited

Internal getter for solution owned by libMesh.

Implements SystemBase.

Definition at line 774 of file NonlinearSystemBase.h.

774 { return *_sys.solution; }

◆ solutionOld() [1/2]

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

◆ solutionOld() [2/2]

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

Definition at line 180 of file SystemBase.h.

180 { 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:1384

◆ solutionOlder() [1/2]

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

Definition at line 178 of file SystemBase.h.

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

178 { 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:1384

◆ solutionOlder() [2/2]

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

Definition at line 181 of file SystemBase.h.

181 { 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:1384

◆ solutionPreviousNewton() [1/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1312 of file SystemBase.C.

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

1313 {
1316  else
1317  return nullptr;
1318 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
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:882

◆ solutionPreviousNewton() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1303 of file SystemBase.C.

1304 {
1307  else
1308  return nullptr;
1309 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
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:882

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

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

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

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

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

◆ 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 888 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:985

◆ solutionUDot() [1/2]

NumericVector<Number>* NonlinearSystemBase::solutionUDot ( )
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 393 of file NonlinearSystemBase.h.

Referenced by CentralDifference::initialSetup().

393 { return _u_dot; }
NumericVector< Number > * _u_dot
solution vector for u^dot

◆ solutionUDot() [2/2]

const NumericVector<Number>* NonlinearSystemBase::solutionUDot ( ) const
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 397 of file NonlinearSystemBase.h.

397 { return _u_dot; }
NumericVector< Number > * _u_dot
solution vector for u^dot

◆ solutionUDotDot() [1/2]

NumericVector<Number>* NonlinearSystemBase::solutionUDotDot ( )
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 394 of file NonlinearSystemBase.h.

Referenced by CentralDifference::initialSetup().

394 { return _u_dotdot; }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot

◆ solutionUDotDot() [2/2]

const NumericVector<Number>* NonlinearSystemBase::solutionUDotDot ( ) const
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 398 of file NonlinearSystemBase.h.

398 { return _u_dotdot; }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot

◆ solutionUDotDotOld() [1/2]

NumericVector<Number>* NonlinearSystemBase::solutionUDotDotOld ( )
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 396 of file NonlinearSystemBase.h.

396 { return _u_dotdot_old; }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot

◆ solutionUDotDotOld() [2/2]

const NumericVector<Number>* NonlinearSystemBase::solutionUDotDotOld ( ) const
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 400 of file NonlinearSystemBase.h.

400 { return _u_dotdot_old; }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot

◆ solutionUDotOld() [1/2]

NumericVector<Number>* NonlinearSystemBase::solutionUDotOld ( )
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 395 of file NonlinearSystemBase.h.

395 { return _u_dot_old; }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot

◆ solutionUDotOld() [2/2]

const NumericVector<Number>* NonlinearSystemBase::solutionUDotOld ( ) const
inlineoverridevirtualinherited

Implements SystemBase.

Definition at line 399 of file NonlinearSystemBase.h.

399 { return _u_dot_old; }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot

◆ solve()

virtual void DumpObjectsNonlinearSystem::solve ( )
inlineoverridevirtual

Solve the system (using libMesh magic)

Implements NonlinearSystemBase.

Definition at line 30 of file DumpObjectsNonlinearSystem.h.

30 {}

◆ stopSolve()

virtual void DumpObjectsNonlinearSystem::stopSolve ( const ExecFlagType exec_flag)
inlineoverridevirtual

Quit the current solve as soon as possible.

Implements NonlinearSystemBase.

Definition at line 31 of file DumpObjectsNonlinearSystem.h.

31 {}

◆ subdomainSetup() [1/3]

void SystemBase::subdomainSetup
inherited

Definition at line 1508 of file SystemBase.C.

1509 {
1510  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1511  _vars[tid].subdomainSetup();
1512 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
virtual void subdomainSetup()
Definition: SystemBase.C:1508
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 945 of file NonlinearSystemBase.C.

946 {
948 
949  _kernels.subdomainSetup(subdomain, tid);
950  _nodal_kernels.subdomainSetup(subdomain, tid);
951  _element_dampers.subdomainSetup(subdomain, tid);
952  _nodal_dampers.subdomainSetup(subdomain, tid);
953 }
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:1508
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 1508 of file SystemBase.C.

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

1509 {
1510  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1511  _vars[tid].subdomainSetup();
1512 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:934
virtual void subdomainSetup()
Definition: SystemBase.C:1508
unsigned int THREAD_ID
Definition: MooseTypes.h:198

◆ subproblem() [1/2]

virtual SubProblem& SystemBase::subproblem ( )
inlinevirtualinherited

◆ subproblem() [2/2]

virtual const SubProblem& SystemBase::subproblem ( ) const
inlinevirtualinherited

Definition at line 99 of file SystemBase.h.

99 { return _subproblem; }
SubProblem & _subproblem
Definition: SystemBase.h:924

◆ system() [1/2]

virtual System& NonlinearSystemBase::system ( )
inlineoverridevirtualinherited

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 633 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(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TimeIntegrator::solve(), Moose::PetscSupport::storePetscOptions(), NonlinearSystemBase::turnOffJacobian(), ReferenceResidualProblem::updateReferenceResidual(), VariableCondensationPreconditioner::VariableCondensationPreconditioner(), and Console::writeVariableNorms().

633 { return _sys; }

◆ system() [2/2]

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

Implements SystemBase.

Definition at line 634 of file NonlinearSystemBase.h.

634 { 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 333 of file NonlinearSystemBase.C.

334 {
336 
337  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
338  {
339  _kernels.timestepSetup(tid);
342  if (_doing_dg)
348 
349  if (_fe_problem.haveFV())
350  {
351  std::vector<FVFluxBC *> bcs;
353  .query()
354  .template condition<AttribSystem>("FVFluxBC")
355  .template condition<AttribThread>(tid)
356  .queryInto(bcs);
357 
358  std::vector<FVInterfaceKernel *> iks;
360  .query()
361  .template condition<AttribSystem>("FVInterfaceKernel")
362  .template condition<AttribThread>(tid)
363  .queryInto(iks);
364 
365  std::vector<FVFluxKernel *> kernels;
367  .query()
368  .template condition<AttribSystem>("FVFluxKernel")
369  .template condition<AttribThread>(tid)
370  .queryInto(kernels);
371 
372  for (auto * bc : bcs)
373  bc->timestepSetup();
374  for (auto * ik : iks)
375  ik->timestepSetup();
376  for (auto * kernel : kernels)
377  kernel->timestepSetup();
378  }
379  }
384 }
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)
FEProblemBase & _fe_problem
TheWarehouse & theWarehouse() const
virtual void timestepSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
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:1494

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

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

642 { 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 216 of file NonlinearSystemBase.C.

217 {
218  system().set_basic_system_only();
219  nonlinearSolver()->jacobian = NULL;
220 }
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 3199 of file NonlinearSystemBase.C.

3200 {
3207  _kernels.updateActive(tid);
3209  if (tid == 0)
3210  {
3217  }
3218 }
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 460 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 445 of file NonlinearSystemBase.h.

Referenced by FiniteDifferencePreconditioner::FiniteDifferencePreconditioner().

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

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

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

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

◆ zeroTaggedVector()

void SystemBase::zeroTaggedVector ( const TagID  tag)
inherited

Zero vector with the given tag.

Definition at line 664 of file SystemBase.C.

Referenced by SystemBase::zeroTaggedVectors().

665 {
666  if (!_subproblem.vectorTagExists(tag))
667  mooseError("Cannot zero vector with TagID ",
668  tag,
669  " in system '",
670  name(),
671  "' because that tag does not exist in the problem");
672  else if (!hasVector(tag))
673  mooseError("Cannot zero vector tag with name '",
675  "' in system '",
676  name(),
677  "' because there is no vector associated with that tag");
678 
679  getVector(tag).zero();
680 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:873
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
virtual void zero()=0
virtual const std::string & name() const
Definition: SystemBase.C:1297
SubProblem & _subproblem
Definition: SystemBase.h:924
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:163
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:198
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:882

◆ zeroTaggedVectors()

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

Zero all vectors for given tags.

Definition at line 683 of file SystemBase.C.

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

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

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

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

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

225 {
227 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:941
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:189

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

219 {
221 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:940
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:189

◆ zeroVectorForResidual()

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

Definition at line 730 of file NonlinearSystemBase.C.

731 {
732  for (unsigned int i = 0; i < _vecs_to_zero_for_residual.size(); ++i)
733  if (vector_name == _vecs_to_zero_for_residual[i])
734  return;
735 
736  _vecs_to_zero_for_residual.push_back(vector_name);
737 }
std::vector< std::string > _vecs_to_zero_for_residual
vectors that will be zeroed before a residual computation

Member Data Documentation

◆ _ad_preset_nodal_bcs

MooseObjectWarehouse<ADDirichletBCBase> NonlinearSystemBase::_ad_preset_nodal_bcs
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 909 of file NonlinearSystemBase.h.

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

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

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

◆ _compute_initial_residual_before_preset_bcs

bool NonlinearSystemBase::_compute_initial_residual_before_preset_bcs
inherited

◆ _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 960 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 955 of file NonlinearSystemBase.h.

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

◆ _computing_initial_residual

bool NonlinearSystemBase::_computing_initial_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(), 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(), 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(), SimplePredictor::shouldApply(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), NonlinearSystem::solve(), EigenProblem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), 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>* NonlinearSystemBase::_current_solution
protectedinherited

◆ _debugging_residuals

bool NonlinearSystemBase::_debugging_residuals
protectedinherited

true if debugging residuals

Definition at line 917 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 904 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 819 of file NonlinearSystemBase.h.

◆ _du_dotdot_du

Number NonlinearSystemBase::_du_dotdot_du
protectedinherited

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

Definition at line 821 of file NonlinearSystemBase.h.

◆ _dummy

NumericVector<Number>* DumpObjectsNonlinearSystem::_dummy
protected

Definition at line 45 of file DumpObjectsNonlinearSystem.h.

Referenced by RHS().

◆ _element_dampers

MooseObjectWarehouse<ElementDamper> NonlinearSystemBase::_element_dampers
protectedinherited

◆ _factory

Factory& SystemBase::_factory
protectedinherited

◆ _fdcoloring

MatFDColoring NonlinearSystemBase::_fdcoloring
protectedinherited

◆ _fe_problem

FEProblemBase& NonlinearSystemBase::_fe_problem
inherited

Definition at line 685 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::addDotVectors(), NonlinearSystemBase::assembleScalingVector(), NonlinearSystemBase::augmentSparsity(), NonlinearSystemBase::checkKernelCoverage(), NonlinearSystemBase::computeDamping(), NonlinearSystemBase::computeDiracContributions(), NonlinearSystemBase::computeJacobian(), NonlinearSystemBase::computeJacobianBlocks(), NonlinearSystemBase::computeJacobianInternal(), NonlinearSystemBase::computeNodalBCs(), NonlinearSystemBase::computeNodalBCsResidualAndJacobian(), NonlinearSystemBase::computeResidualAndJacobianInternal(), NonlinearSystemBase::computeResidualInternal(), NonlinearSystemBase::computeResidualTags(), NonlinearSystemBase::computeScalarKernelsJacobians(), NonlinearSystemBase::computeScaling(), NonlinearSystem::computeScalingJacobian(), NonlinearSystem::computeScalingResidual(), NonlinearSystemBase::computeTimeDerivatives(), NonlinearSystemBase::constraintJacobians(), NonlinearSystemBase::constraintResiduals(), NonlinearSystem::converged(), NonlinearSystemBase::customSetup(), DMMooseGetEmbedding_Private(), DMSetFromOptions_Moose(), DMSetUp_Moose_Pre(), MooseEigenSystem::eigenKernelOnCurrent(), MooseEigenSystem::eigenKernelOnOld(), NonlinearSystemBase::enforceNodalConstraintsJacobian(), NonlinearSystemBase::enforceNodalConstraintsResidual(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), NonlinearSystemBase::init(), NonlinearSystemBase::initialSetup(), NonlinearSystemBase::jacobianSetup(), NonlinearSystemBase::NonlinearSystemBase(), NonlinearSystemBase::overwriteNodeFace(), NonlinearSystemBase::reinitNodeFace(), NonlinearSystem::residualAndJacobianTogether(), NonlinearSystemBase::residualSetup(), NonlinearSystemBase::setConstraintSecondaryValues(), NonlinearSystemBase::setInitialSolution(), 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 947 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 902 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 976 of file NonlinearSystemBase.h.

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

◆ _increment_vec

NumericVector<Number>* NonlinearSystemBase::_increment_vec
protectedinherited

◆ _initial_residual_after_preset_bcs

Real NonlinearSystemBase::_initial_residual_after_preset_bcs
inherited

Definition at line 690 of file NonlinearSystemBase.h.

Referenced by FEProblemBase::checkNonlinearConvergence().

◆ _initial_residual_before_preset_bcs

Real NonlinearSystemBase::_initial_residual_before_preset_bcs
inherited

◆ _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 844 of file NonlinearSystemBase.h.

◆ _Ke_system_tag

TagID NonlinearSystemBase::_Ke_system_tag
protectedinherited

Tag for system contribution Jacobian.

Definition at line 847 of file NonlinearSystemBase.h.

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

◆ _kernels

MooseObjectTagWarehouse<KernelBase> NonlinearSystemBase::_kernels
protectedinherited

◆ _ksp_norm

Moose::MooseKSPNormType NonlinearSystemBase::_ksp_norm
protectedinherited

◆ _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 967 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 970 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 938 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 929 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 931 of file SystemBase.h.

◆ _need_residual_ghosted

bool NonlinearSystemBase::_need_residual_ghosted
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 830 of file NonlinearSystemBase.h.

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

◆ _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 827 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 550 of file NonlinearSystemBase.h.

◆ _numbered_vars

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

Map variable number to its pointer.

Definition at line 976 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 979 of file NonlinearSystemBase.h.

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

◆ _pc_side

Moose::PCSideType NonlinearSystemBase::_pc_side
protectedinherited

Preconditioning side.

Definition at line 892 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::getPCSide(), and NonlinearSystemBase::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().

◆ _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 938 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::printAllVariableNorms().

◆ _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 841 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_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 965 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 806 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 958 of file SystemBase.h.

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

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protectedinherited

Definition at line 959 of file SystemBase.h.

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

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 954 of file SystemBase.h.

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

Definition at line 955 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 970 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> > NonlinearSystemBase::_serialized_solution
protectedinherited

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

Definition at line 803 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::init(), NonlinearSystemBase::serializedSolution(), NonlinearSystemBase::serializeSolution(), and NonlinearSystemBase::setSolution().

◆ _solution_states_initialized

bool SystemBase::_solution_states_initialized
protectedinherited

Whether or not the solution states have been initialized.

Definition at line 985 of file SystemBase.h.

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

◆ _splits

MooseObjectWarehouseBase<Split> NonlinearSystemBase::_splits
protectedinherited

Decomposition splits.

Definition at line 882 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>* NonlinearSystemBase::_u_dot
protectedinherited

◆ _u_dot_old

NumericVector<Number>* NonlinearSystemBase::_u_dot_old
protectedinherited

◆ _u_dotdot

NumericVector<Number>* NonlinearSystemBase::_u_dotdot
protectedinherited

◆ _u_dotdot_old

NumericVector<Number>* NonlinearSystemBase::_u_dotdot_old
protectedinherited

◆ _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 906 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 897 of file NonlinearSystemBase.h.

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

◆ _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 988 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 962 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 936 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 973 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 934 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(), 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 923 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 982 of file SystemBase.h.

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


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